[vlc-devel] [PATCH] [RFC] picture: use the offset to increase the visible lines/pitch

Steve Lhomme robux4 at gmail.com
Thu Sep 10 18:19:17 CEST 2015


On Thu, Sep 10, 2015 at 5:55 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le 2015-09-10 18:50, Steve Lhomme a écrit :
>>
>> Since we don't use the x/y offset when copying planes (plane_t is missing
>> these fields), we may miss some pixels.
>
>
> So?

So it's missing some pixels that should be displayed. Either we add
the offset information in plane_t (unlikely as we need to check all
the code using plane_t). Or we consider the offset adds a visible
area. It should be safe as it only applies to plane_t data when
manipulating pixels. It doesn't affect the cropping handled by the
vout or any filter, they should rely on the values in picture_t.

>> This is the case with offset_test.ogv when the deinterlacer is involved.
>> ---
>>  src/misc/picture.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/misc/picture.c b/src/misc/picture.c
>> index 0cdbd0e..d550b94 100644
>> --- a/src/misc/picture.c
>> +++ b/src/misc/picture.c
>> @@ -153,6 +153,7 @@ int picture_Setup( picture_t *p_picture, const
>> video_format_t *restrict fmt )
>>      video_format_Setup( &p_picture->format, fmt->i_chroma,
>> fmt->i_width, fmt->i_height,
>>                          fmt->i_visible_width, fmt->i_visible_height,
>>                          fmt->i_sar_num, fmt->i_sar_den );
>> +    video_format_CopyCrop( &p_picture->format, fmt );
>>
>>      const vlc_chroma_description_t *p_dsc =
>>          vlc_fourcc_GetChromaDescription( p_picture->format.i_chroma );
>> @@ -185,9 +186,9 @@ int picture_Setup( picture_t *p_picture, const
>> video_format_t *restrict fmt )
>>          plane_t *p = &p_picture->p[i];
>>
>>          p->i_lines         = (i_height_aligned + i_height_extra ) *
>> p_dsc->p[i].h.num / p_dsc->p[i].h.den;
>> -        p->i_visible_lines = fmt->i_visible_height *
>> p_dsc->p[i].h.num / p_dsc->p[i].h.den;
>> +        p->i_visible_lines = (fmt->i_y_offset +
>> fmt->i_visible_height) * p_dsc->p[i].h.num / p_dsc->p[i].h.den;
>>          p->i_pitch         = i_width_aligned * p_dsc->p[i].w.num /
>> p_dsc->p[i].w.den * p_dsc->pixel_size;
>> -        p->i_visible_pitch = fmt->i_visible_width *
>> p_dsc->p[i].w.num / p_dsc->p[i].w.den * p_dsc->pixel_size;
>> +        p->i_visible_pitch = (fmt->i_x_offset +
>> fmt->i_visible_width) * p_dsc->p[i].w.num / p_dsc->p[i].w.den *
>> p_dsc->pixel_size;
>>          p->i_pixel_pitch   = p_dsc->pixel_size;
>
>
> Looks to me that this corrupts the picture cropping.

How can I check that ?

>>          assert( (p->i_pitch % 16) == 0 );
>
>
> --
> Rémi Denis-Courmont
> http://www.remlab.net/
> _______________________________________________
> 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