[FFmpeg-devel] [PATCH] Fix non-mod16 libtheora encoding

David Conrad lessen42
Fri May 22 23:32:22 CEST 2009


On May 22, 2009, at 3:52 PM, Michael Niedermayer wrote:

> On Thu, May 21, 2009 at 08:54:30PM -0400, David Conrad wrote:
>> On May 21, 2009, at 6:56 PM, David Conrad wrote:
>>
>>> On May 21, 2009, at 6:01 PM, M?ns Rullg?rd wrote:
>>>
>>>> David Conrad <lessen42 at gmail.com> writes:
>>>>
>>>>> Hi,
>>>>>
>>>>> Currently using non-mod16 sizes produces garbage.
>>>>>
>>>>>
>>>>> commit 7af4d351600878e1c37467837d8d10c226e2b805
>>>>> Author: David Conrad <lessen42 at gmail.com>
>>>>> Date:   Thu May 21 17:38:44 2009 -0400
>>>>>
>>>>>  Fix libtheora encoding for non-mod16 sizes
>>>>>
>>>>> diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c
>>>>> index dbc98e3..ef8b6aa 100644
>>>>> --- a/libavcodec/libtheoraenc.c
>>>>> +++ b/libavcodec/libtheoraenc.c
>>>>> @@ -87,12 +87,12 @@ static av_cold int encode_init(AVCodecContext*
>>>>> avc_context)
>>>>>
>>>>>   /* Set up the theora_info struct */
>>>>>   theora_info_init( &t_info );
>>>>> -    t_info.width = avc_context->width;
>>>>> -    t_info.height = avc_context->height;
>>>>> +    t_info.width = (avc_context->width + 15) & 0xFFFFFFF0;
>>>>> +    t_info.height = (avc_context->height + 15) & 0xFFFFFFF0;
>>>>
>>>> Isn't there a macro for that somewhere?  If not, & ~15 is both  
>>>> easier
>>>> to read and safe against non-32-bit types.
>>>
>>> It doesn't look like it; patch adding and using it where I found  
>>> attached
>>
>> Loren pointed me at the ALIGN macros in libavcodec/utils.c and
>> libavfilter/defaults.c, so here's a more general macro.
>>
>
>> commit d47112cff7adfc867cfc3b1b8bd670a1def64cf8
>> Author: David Conrad <lessen42 at gmail.com>
>> Date:   Thu May 21 18:55:43 2009 -0400
>>
>>    Move ALIGN macro to libavutil/common.h and use it in various  
>> places
>>
>
> patch ok

Applied.



More information about the ffmpeg-devel mailing list