[FFmpeg-devel] [PATCH 1/2] avcodec/h264_slice: Use non_j_pixfmt() in the format match code
Michael Niedermayer
michaelni at gmx.at
Sun Oct 11 21:16:26 CEST 2015
From: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/h264_slice.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index a346ccb..cce97d9 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -865,6 +865,17 @@ static void init_scan_tables(H264Context *h)
}
}
+static enum AVPixelFormat non_j_pixfmt(enum AVPixelFormat a)
+{
+ switch (a) {
+ case AV_PIX_FMT_YUVJ420P: return AV_PIX_FMT_YUV420P;
+ case AV_PIX_FMT_YUVJ422P: return AV_PIX_FMT_YUV422P;
+ case AV_PIX_FMT_YUVJ444P: return AV_PIX_FMT_YUV444P;
+ default:
+ return a;
+ }
+}
+
static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
{
#define HWACCEL_MAX (CONFIG_H264_DXVA2_HWACCEL + \
@@ -972,7 +983,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
*fmt = AV_PIX_FMT_NONE;
for (i=0; choices[i] != AV_PIX_FMT_NONE; i++)
- if (choices[i] == h->avctx->pix_fmt && !force_callback)
+ if (non_j_pixfmt(choices[i]) == non_j_pixfmt(h->avctx->pix_fmt) && !force_callback)
return choices[i];
return ff_thread_get_format(h->avctx, choices);
}
@@ -1129,17 +1140,6 @@ fail:
return ret;
}
-static enum AVPixelFormat non_j_pixfmt(enum AVPixelFormat a)
-{
- switch (a) {
- case AV_PIX_FMT_YUVJ420P: return AV_PIX_FMT_YUV420P;
- case AV_PIX_FMT_YUVJ422P: return AV_PIX_FMT_YUV422P;
- case AV_PIX_FMT_YUVJ444P: return AV_PIX_FMT_YUV444P;
- default:
- return a;
- }
-}
-
/**
* Decode a slice header.
* This will (re)intialize the decoder and call h264_frame_start() as needed.
--
1.7.9.5
More information about the ffmpeg-devel
mailing list