[vlc-devel] [vlc-commits] commit: vmem: By default keep the original image aspect ratio. (Pierre d' Herbemont )

Laurent Aimar fenrir at elivagar.org
Sun Oct 31 15:01:20 CET 2010


On Sun, Oct 31, 2010 at 02:39:00PM +0100, Pierre d'Herbemont wrote:
> On Sun, Oct 31, 2010 at 2:16 PM, Laurent Aimar <fenrir at elivagar.org> wrote:
> > Hi
> >
> > On Sun, Oct 31, 2010 at 02:05:00PM +0100, Pierre d'Herbemont wrote:
> >> >> -    for (int i = 0; i < picture->i_planes; i++)
> >> >> -        picture->p[i].p_pixels = planes[i];
> >> >> +    const int y = sys->place.y;
> >> >> +    const int x = sys->place.x;
> >> >> +    const int pitch = sys->vmem_pitch;
> >> >> +    const int bbp = pitch / sys->vmem_width;
> >> >  This is wrong, the pitch is not a multiple of the width.
> >>
> >> No. "vmem pitch" doesn't include any extra trailer bytes.
> >  Yes it can, the module handle it correctly. The only limitation is
> > that the same pitch is used for each plane.
> 
> Huh? ok, I think I do understand, but this seems really creepy. Tell
> me if I am mistaken.
> 
> Basically the vmem accept, a pitch, a width and a height. That means
> that if we want to compute correctly the bpp, we must figure this out
> from the pitch and the width.
 No, the bpp is simply deduced from the chroma format, it cannot be done
another way (RGB16 will always be 2 bytes per pixel, RGB24 3 bytes, etc).

> So, why do we bother with a pitch? This seems useless if we don't
> directly pass along the bpp.
 They are 2 completly different things:
 - bbp (if I understand) is the number of bytes to go from one pixel to another
 - pitch is the number of bytes to go from one line to another.

The only relation (without external constraints) you can deduce is:
 pitch >= bbp * width

> >> > Use picture->p[i].i_pixel_pitch instead.
> >> Nice shortcut. No idea this was even existing. Why don't we have bpp directly?
> >  i_pixel_pitch is the number of bytes per pixel (per plane). So I don't understand
> > your question.
> 
> So I do understand nothing. pixel pitch is what is generally called
> the byte per pixel... This name could probably be clarified :)
 _pitch is a fine suffix and it makes pixel_pitch consitent with line_pitch.

-- 
fenrir



More information about the vlc-devel mailing list