[vlc-devel] [PATCH v3] picture: align pictures on 64 bytes

Thomas Guillem thomas at gllm.fr
Mon Nov 12 10:13:06 CET 2018


OpenGL chose 64 as a min alignement too: https://www.khronos.org/opengl/wiki/Buffer_Object#Alignment

"The smallest this value will be is 64, thus allowing this to work for any strictly aligned type in existence and some that aren't."

On Mon, Nov 12, 2018, at 10:10, Thomas Guillem wrote:
> Fine with me.
> 
> On Mon, Nov 12, 2018, at 09:39, Steve Lhomme wrote:
> > Code relying on AVX-2 (like dav1d) cannot work without an alignment of 32 bytes
> > at least. Even avcodec has a requirement of 64 (likely to get at least 32 on all
> > planes). So it's probably time to upgrade.
> > 
> > picture_Setup ensures a horizontal alignment to 32 bytes and a vertical to 16
> > bytes. So for all buffers allocated by the core, we have a size multiple of 512
> > bytes.
> > ---
> >  src/misc/picture.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/misc/picture.c b/src/misc/picture.c
> > index b373ebd21f..90c6bd7c8d 100644
> > --- a/src/misc/picture.c
> > +++ b/src/misc/picture.c
> > @@ -73,16 +73,16 @@ static void picture_Destroy(picture_t *pic)
> >  
> >  VLC_WEAK void *picture_Allocate(int *restrict fdp, size_t size)
> >  {
> > -    assert((size % 16) == 0);
> > +    assert((size % 64) == 0);
> >      *fdp = -1;
> > -    return aligned_alloc(16, size);
> > +    return aligned_alloc(64, size);
> >  }
> >  
> >  VLC_WEAK void picture_Deallocate(int fd, void *base, size_t size)
> >  {
> >      assert(fd == -1);
> >      aligned_free(base);
> > -    assert((size % 16) == 0);
> > +    assert((size % 64) == 0);
> >  }
> >  
> >  /*****************************************************************************
> > -- 
> > 2.17.1
> > 
> > _______________________________________________
> > 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