[FFmpeg-devel] [PATCH]lavc/hevc_ps: Fix offset for yuv422 and yuv444

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Mar 8 18:56:13 CET 2016


Hi!

Attached patch fixes ticket #4980 for me.
Debugged by Kurosu and Hendrik.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 64d6e2f..b4e5c5b 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -856,11 +856,11 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
         return ret;
 
     if (get_bits1(gb)) { // pic_conformance_flag
-        //TODO: * 2 is only valid for 420
-        sps->pic_conf_win.left_offset   = get_ue_golomb_long(gb) * 2;
-        sps->pic_conf_win.right_offset  = get_ue_golomb_long(gb) * 2;
-        sps->pic_conf_win.top_offset    = get_ue_golomb_long(gb) * 2;
-        sps->pic_conf_win.bottom_offset = get_ue_golomb_long(gb) * 2;
+        int mult = 1 + (sps->chroma_format_idc < 2);
+        sps->pic_conf_win.left_offset   = get_ue_golomb_long(gb) * mult;
+        sps->pic_conf_win.right_offset  = get_ue_golomb_long(gb) * mult;
+        sps->pic_conf_win.top_offset    = get_ue_golomb_long(gb) * mult;
+        sps->pic_conf_win.bottom_offset = get_ue_golomb_long(gb) * mult;
 
         if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) {
             av_log(avctx, AV_LOG_DEBUG,


More information about the ffmpeg-devel mailing list