[FFmpeg-devel] [PATCH] lavc/hevc_ps: fix crop info

James Almer jamrial at gmail.com
Thu Aug 16 17:23:12 EEST 2018


On 8/16/2018 2:00 AM, Zhao Zhili wrote:
> 
> 
> On 2018年08月16日 11:46, James Almer wrote:
>> On 8/16/2018 12:29 AM, Zhao Zhili wrote:
>>> ---
>>>   libavcodec/hevc_ps.c | 26 ++++++++++++++++++++++----
>>>   1 file changed, 22 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
>>> index fbd9fbf..4161ab6 100644
>>> --- a/libavcodec/hevc_ps.c
>>> +++ b/libavcodec/hevc_ps.c
>>> @@ -628,8 +628,17 @@ static void decode_vui(GetBitContext *gb,
>>> AVCodecContext *avctx,
>>>           vui->default_display_window_flag = get_bits1(gb);
>>>         if (vui->default_display_window_flag) {
>>> -        int vert_mult  = 1 + (sps->chroma_format_idc < 2);
>>> -        int horiz_mult = 1 + (sps->chroma_format_idc < 3);
>>> +        unsigned horiz_mult, vert_mult;
>>> +        if (sps->chroma_format_idc == 1) {
>>> +            horiz_mult = 2;
>>> +            vert_mult = 2;
>>> +        } else if (sps->chroma_format_idc == 2) {
>>> +            horiz_mult = 2;
>>> +            vert_mult = 1;
>>> +        } else {
>>> +            horiz_mult = 1;
>>> +            vert_mult = 1;
>> Can you explain what this patch is meant to do? For chroma_format_idc ==
>> 1, 2 and 3 nothing changes with this, only chroma_format_idc == 0, where
>> both horiz_mult and vert_mult become 1 instead of 2. Is that
>> correct/intended?
> 
> Yes, this is intended. See ISO/IEC 23008-2 Table 6-1.
> 
> ./ffprobe ~/Videos/hevc-monochrome.ts
>     Stream #0:0[0x100]: Video: hevc (Rext) ([36][0][0][0] / 0x0024),
> gray(tv), 384x224, 15 fps, 15 tbr, 90k tbn, 15 tbc
> 
> The correct size is 384x240.

Alright, can you mention that in the commit message? Thanks!

> 
>>> +        }
>>>           vui->def_disp_win.left_offset   = get_ue_golomb_long(gb) *
>>> horiz_mult;
>>>           vui->def_disp_win.right_offset  = get_ue_golomb_long(gb) *
>>> horiz_mult;
>>>           vui->def_disp_win.top_offset    = get_ue_golomb_long(gb) * 
>>> vert_mult;
>>> @@ -923,8 +932,17 @@ int ff_hevc_parse_sps(HEVCSPS *sps,
>>> GetBitContext *gb, unsigned int *sps_id,
>>>           return ret;
>>>         if (get_bits1(gb)) { // pic_conformance_flag
>>> -        int vert_mult  = 1 + (sps->chroma_format_idc < 2);
>>> -        int horiz_mult = 1 + (sps->chroma_format_idc < 3);
>>> +        unsigned horiz_mult, vert_mult;
>>> +        if (sps->chroma_format_idc == 1) {
>>> +            horiz_mult = 2;
>>> +            vert_mult = 2;
>>> +        } else if (sps->chroma_format_idc == 2) {
>>> +            horiz_mult = 2;
>>> +            vert_mult = 1;
>>> +        } else {
>>> +            horiz_mult = 1;
>>> +            vert_mult = 1;
>>> +        }
>>>           sps->pic_conf_win.left_offset   = get_ue_golomb_long(gb) *
>>> horiz_mult;
>>>           sps->pic_conf_win.right_offset  = get_ue_golomb_long(gb) *
>>> horiz_mult;
>>>           sps->pic_conf_win.top_offset    = get_ue_golomb_long(gb) * 
>>> vert_mult;
>>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



More information about the ffmpeg-devel mailing list