[FFmpeg-devel] [PATCH] Fix non-mod16 libtheora encoding
Michael Niedermayer
michaelni
Fri May 22 21:52:57 CEST 2009
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
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090522/b01de3c2/attachment.pgp>
More information about the ffmpeg-devel
mailing list