aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-17 20:41:16 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-18 18:14:11 +0100
commitc6f59b95c529baf2ea6729ab9089fddce3ddd86a (patch)
tree95cff36028a5e7e48b5f7e8e803ab15939d1ecaa
parent6407800521d26b103db4c22d9de709e957381e4b (diff)
downloadffmpeg-c6f59b95c529baf2ea6729ab9089fddce3ddd86a.tar.gz
h264: avoid calling get_format() multiple times
Some applications do not like that. Fixes VDA Reduces noise for VDPAU Tested-by: Guillaume POIRIER <poirierg@gmail.com> Tested-by: Carl Eugen Hoyos <cehoyos@ag.or.at> Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit dece584a639c9fd61a72e21800815e8397b3b617) Conflicts: libavcodec/h264.c
-rw-r--r--libavcodec/h264.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 56ef1092bd..da749a241d 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2537,11 +2537,17 @@ static enum PixelFormat get_pixel_format(H264Context *h)
return s->avctx->color_range == AVCOL_RANGE_JPEG ? AV_PIX_FMT_YUVJ422P
: AV_PIX_FMT_YUV422P;
} else {
- return s->avctx->get_format(s->avctx, s->avctx->codec->pix_fmts ?
+ int i;
+ const enum AVPixelFormat * fmt = s->avctx->codec->pix_fmts ?
s->avctx->codec->pix_fmts :
s->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] == s->avctx->pix_fmt)
+ return fmt[i];
+ return s->avctx->get_format(s->avctx, fmt);
}
break;
default: