[FFmpeg-cvslog] h264: avoid calling get_format() multiple times
Michael Niedermayer
git at videolan.org
Sun Feb 17 22:28:43 CET 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Feb 17 20:41:16 2013 +0100| [dece584a639c9fd61a72e21800815e8397b3b617] | committer: Michael Niedermayer
h264: avoid calling get_format() multiple times
Some applications do not like that.
Fixes VDA
Reduces noise for VDPAU
Tested-by: Guillaume POIRIER <poirierg at gmail.com>
Tested-by: Carl Eugen Hoyos <cehoyos at ag.or.at>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dece584a639c9fd61a72e21800815e8397b3b617
---
libavcodec/h264.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 89fc222..c14b95a 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2931,11 +2931,17 @@ static enum PixelFormat get_pixel_format(H264Context *h)
return h->avctx->color_range == AVCOL_RANGE_JPEG ? AV_PIX_FMT_YUVJ422P
: AV_PIX_FMT_YUV422P;
} else {
- return h->avctx->get_format(h->avctx, h->avctx->codec->pix_fmts ?
+ int i;
+ const enum AVPixelFormat * fmt = h->avctx->codec->pix_fmts ?
h->avctx->codec->pix_fmts :
h->avctx->color_range == AVCOL_RANGE_JPEG ?
hwaccel_pixfmt_list_h264_jpeg_420 :
- ff_hwaccel_pixfmt_list_420);
+ ff_hwaccel_pixfmt_list_420;
+
+ for (i=0; fmt[i] != AV_PIX_FMT_NONE; i++)
+ if (fmt[i] == h->avctx->pix_fmt)
+ return fmt[i];
+ return h->avctx->get_format(h->avctx, fmt);
}
break;
default:
More information about the ffmpeg-cvslog
mailing list