[vlc-devel] [PATCH] mediacodec: detect size changed by comparing visible size

Zhao Zhili quinkblack at foxmail.com
Fri Aug 10 11:21:44 CEST 2018



On 2018年08月10日 16:47, Zhao Zhili wrote:
>
>
> On 2018年08月10日 15:01, Thomas Guillem wrote:
>> Do you have an hevc sample for that ?
>
> I managed to create an mov to show the align issue with x265 
> --min-cu-size option:
>
> -c:v libx265  -x265-params preset=ultrafast:min-cu-size=32
>
> https://drive.google.com/file/d/1ufe8wfjtXaH6BfrooQDJU0Te1hDDAArE/view?usp=sharing 
>
>
> But I don't know how to force add sps/pps per GOP for mov (or is it 
> possible?)
>
> 273450E        Width:                           320 (0x0140)
> 2734510        Height:                          240 (0x00F0)
>
> 2734594            sps_seq_parameter_set_id:    0 (0x0)
> 2734594            chroma_format_idc:           1 (0x1) - 4:2:0
> 2734594            pic_width_in_luma_samples:   320 (0x0140)
> 2734596            pic_height_in_luma_samples:  256 (0x0100)
> 2734598            conformance_window_flag (2 bytes)
> 2734598             conformance_window_flag:    Yes
> 2734599             conf_win_left_offset:       0 (0x0)
> 2734599             conf_win_right_offset:      0 (0x0)
> 2734599             conf_win_top_offset:        0 (0x0)
> 2734599             conf_win_bottom_offset:     8 (0x08)
> 273459A            bit_depth_luma_minus8:       0 (0x0)
> 273459A            bit_depth_chroma_minus8:     0 (0x0)
> 273459A            log2_max_pic_order_cnt_lsb_minus4: 4 (0x4)
> 273459B            sps_sub_layer_ordering_info_present_flag: Yes
> 273459B            SubLayer (1 bytes)
> 273459B             sps_max_dec_pic_buffering_minus1: 5 (0x5)
> 273459B             sps_max_num_reorder_pics:   2 (0x2)
> 273459C             sps_max_latency_increase_plus1: 5 (0x5)
> 273459C            log2_min_luma_coding_block_size_minus3: 2 (0x2)
> 273459D            log2_diff_max_min_luma_coding_block_size: 1 (0x1)
> 273459D            log2_min_transform_block_size_minus2: 0 (0x0)
> 273459D            log2_diff_max_min_transform_block_size: 3 (0x3)
>

By the way, for hevc_get_picture_size:

bool hevc_get_picture_size( const hevc_sequence_parameter_set_t *p_sps,
                             unsigned *p_w, unsigned *p_h, unsigned 
*p_vw, unsigned *p_vh )
{
     *p_w = *p_vw = p_sps->pic_width_in_luma_samples;
     *p_h = *p_vh = p_sps->pic_height_in_luma_samples;
     if( p_sps->conformance_window_flag )
     {
         *p_vh -= p_sps->conf_win.bottom_offset + 
p_sps->conf_win.top_offset;
         *p_vh -= p_sps->conf_win.left_offset + 
p_sps->conf_win.right_offset;
     }
     return true;
}

I think it missed the SubWidthC and SubHeightC part:

23008-2 (D-28)
croppedWidth = pic_width_in_luma_samples −
SubWidthC * ( conf_win_right_offset + conf_win_left_offset )

23008-2 (D-29)
croppedHeight = pic_height_in_luma_samples −
SubHeightC * ( conf_win_bottom_offset + conf_win_top_offset )

>>
>> On Thu, Aug 9, 2018, at 04:20, Zhao Zhili wrote:
>>> The commit message is incorrect, please see the next patch. And
>>> for my bad English grammar please feel free to reword the commit
>>> message if the patch itself is correct.
>>>
>>>
>>> On 2018年08月09日 09:52, Zhao Zhili wrote:
>>>> Input size may not aligned to the requirement of codec. For H.264 
>>>> We can
>>>> divide the size by macroblock size before comparing, but it doesn't 
>>>> work
>>>> with HEVC.
>>>> ---
>>>>    modules/codec/omxil/mediacodec.c | 14 +++++++-------
>>>>    1 file changed, 7 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/modules/codec/omxil/mediacodec.c 
>>>> b/modules/codec/omxil/mediacodec.c
>>>> index 9ee2cf6..40bc5d7 100644
>>>> --- a/modules/codec/omxil/mediacodec.c
>>>> +++ b/modules/codec/omxil/mediacodec.c
>>>> @@ -112,7 +112,7 @@ typedef struct
>>>>            {
>>>>                void *p_surface, *p_jsurface;
>>>>                unsigned i_angle;
>>>> -            unsigned i_input_width, i_input_height;
>>>> +            unsigned i_input_visible_width, i_input_visible_height;
>>>>                unsigned int i_stride, i_slice_height;
>>>>                int i_pixel_format;
>>>>                struct hxxx_helper hh;
>>>> @@ -259,10 +259,10 @@ static void HXXXInitSize(decoder_t *p_dec, 
>>>> bool *p_size_changed)
>>>>            unsigned i_w, i_h, i_vw, i_vh;
>>>>            hxxx_helper_get_current_picture_size(hh, &i_w, &i_h, 
>>>> &i_vw, &i_vh);
>>>>    -        *p_size_changed = (i_w != p_sys->video.i_input_width
>>>> -                        || i_h != p_sys->video.i_input_height);
>>>> -        p_sys->video.i_input_width = i_w;
>>>> -        p_sys->video.i_input_height = i_h;
>>>> +        *p_size_changed = (i_vw != p_sys->video.i_input_visible_width
>>>> +                        || i_vh != 
>>>> p_sys->video.i_input_visible_height);
>>>> +        p_sys->video.i_input_visible_width = i_vw;
>>>> +        p_sys->video.i_input_visible_height = i_vh;
>>>>            /* fmt_out video size will be updated by mediacodec 
>>>> output callback */
>>>>        }
>>>>    }
>>>> @@ -731,9 +731,9 @@ static int OpenDecoder(vlc_object_t *p_this, 
>>>> pf_MediaCodecApi_init pf_init)
>>>>                    p_dec->fmt_out.video.i_sar_den = 1;
>>>>                }
>>>>    -            p_sys->video.i_input_width =
>>>> +            p_sys->video.i_input_visible_width = 
>>>> p_dec->fmt_in.video.i_visible_width;
>>>> +            p_sys->video.i_input_visible_height = 
>>>> p_dec->fmt_in.video.i_visible_height;
>>>>                p_dec->fmt_out.video.i_visible_width = 
>>>> p_dec->fmt_out.video.i_width;
>>>> -            p_sys->video.i_input_height =
>>>>                p_dec->fmt_out.video.i_visible_height = 
>>>> p_dec->fmt_out.video.i_height;
>>>>                   if (UpdateVout(p_dec) != VLC_SUCCESS)
>>>
>>>
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel





More information about the vlc-devel mailing list