Hi,

2011/7/10 Måns Rullgård <[email protected]>:
> "Ronald S. Bultje" <[email protected]> writes:
>
>> Hi,
>>
>> 2011/7/10 Måns Rullgård <[email protected]>:
>>> "Ronald S. Bultje" <[email protected]> writes:
>>>
>>>> From: Anton Mitrofanov <[email protected]>
>>>>
>>>> ptrdiff_t can be 4 bytes, which leads to the next element being 4-byte
>>>> aligned and thus at a different offset than intended. Forcing 8-byte
>>>> alignment forces equal offset of dither16/32 on x86-32 and x86-64.
>>>>
>>>> Signed-off-by: Ronald S. Bultje <[email protected]>
>>>> ---
>>>>  libswscale/swscale_internal.h |    4 ++--
>>>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
>>>> index b602541..a6d4a2f 100644
>>>> --- a/libswscale/swscale_internal.h
>>>> +++ b/libswscale/swscale_internal.h
>>>> @@ -347,8 +347,8 @@ typedef struct SwsContext {
>>>>      int32_t  alpMmxFilter[4*MAX_FILTER_SIZE];
>>>>      DECLARE_ALIGNED(8, ptrdiff_t, uv_off_px);   ///< offset (in pixels) 
>>>> between u and v planes
>>>>      DECLARE_ALIGNED(8, ptrdiff_t, uv_off_byte); ///< offset (in bytes) 
>>>> between u and v planes
>>>> -    uint16_t dither16[8];
>>>> -    uint32_t dither32[8];
>>>> +    DECLARE_ALIGNED(8, uint16_t, dither16)[8];
>>>> +    DECLARE_ALIGNED(8, uint32_t, dither32)[8];
>>>>
>>>>      const uint8_t *chrDither8, *lumDither8;
>>>>
>>>> --
>>>
>>> Since the asm is inline, why not pass the offset using an operand with
>>> "i" constraint instead of this?
>>>
>>> If those fields really need 8-byte alignment for some other reason, the
>>> commit message should state that instead or in addition.
>>
>> I plan to do that, but as said before, it's a major undertaking. I
>> can't fix the world all at once. World hunger will continue for
>> considerably longer beyond today, and so will swscale being broken.
>> I'll fix it, really, but small pieces at a time.
>
> Then please add a comment by those fields or when this discussion is
> forgotten, someone looking at it will assume alignment is required for
> some reason.

OK, committed as such.

BTW I'm really actually trying to fix all these issues, so I'll get
back to using proper offset identifiers in the inline assembly soon.

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to