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

Måns Rullgård mans
Fri May 22 00:01:50 CEST 2009


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.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list