Mercurial > libavcodec.hg
comparison libtheoraenc.c @ 9687:d9f8496b3b91 libavcodec
Fix libtheora encoding for non-mod16 sizes
author | conrad |
---|---|
date | Fri, 22 May 2009 22:01:50 +0000 |
parents | 043574c5c153 |
children | 702e111de423 |
comparison
equal
deleted
inserted
replaced
9686:bc32976d6d9d | 9687:d9f8496b3b91 |
---|---|
85 unsigned int offset; | 85 unsigned int offset; |
86 TheoraContext *h = avc_context->priv_data; | 86 TheoraContext *h = avc_context->priv_data; |
87 | 87 |
88 /* Set up the theora_info struct */ | 88 /* Set up the theora_info struct */ |
89 theora_info_init( &t_info ); | 89 theora_info_init( &t_info ); |
90 t_info.width = avc_context->width; | 90 t_info.width = FFALIGN(avc_context->width, 16); |
91 t_info.height = avc_context->height; | 91 t_info.height = FFALIGN(avc_context->height, 16); |
92 t_info.frame_width = avc_context->width; | 92 t_info.frame_width = avc_context->width; |
93 t_info.frame_height = avc_context->height; | 93 t_info.frame_height = avc_context->height; |
94 t_info.offset_x = 0; | 94 t_info.offset_x = 0; |
95 t_info.offset_y = 0; | 95 t_info.offset_y = avc_context->height & 0xf; |
96 /* Swap numerator and denominator as time_base in AVCodecContext gives the | 96 /* Swap numerator and denominator as time_base in AVCodecContext gives the |
97 * time period between frames, but theora_info needs the framerate. */ | 97 * time period between frames, but theora_info needs the framerate. */ |
98 t_info.fps_numerator = avc_context->time_base.den; | 98 t_info.fps_numerator = avc_context->time_base.den; |
99 t_info.fps_denominator = avc_context->time_base.num; | 99 t_info.fps_denominator = avc_context->time_base.num; |
100 if (avc_context->sample_aspect_ratio.num != 0) { | 100 if (avc_context->sample_aspect_ratio.num != 0) { |
184 if (frame->linesize[1] != frame->linesize[2]) { | 184 if (frame->linesize[1] != frame->linesize[2]) { |
185 av_log(avc_context, AV_LOG_ERROR, "U and V stride differ\n"); | 185 av_log(avc_context, AV_LOG_ERROR, "U and V stride differ\n"); |
186 return -1; | 186 return -1; |
187 } | 187 } |
188 | 188 |
189 t_yuv_buffer.y_width = avc_context->width; | 189 t_yuv_buffer.y_width = FFALIGN(avc_context->width, 16); |
190 t_yuv_buffer.y_height = avc_context->height; | 190 t_yuv_buffer.y_height = FFALIGN(avc_context->height, 16); |
191 t_yuv_buffer.y_stride = frame->linesize[0]; | 191 t_yuv_buffer.y_stride = frame->linesize[0]; |
192 t_yuv_buffer.uv_width = t_yuv_buffer.y_width / 2; | 192 t_yuv_buffer.uv_width = t_yuv_buffer.y_width / 2; |
193 t_yuv_buffer.uv_height = t_yuv_buffer.y_height / 2; | 193 t_yuv_buffer.uv_height = t_yuv_buffer.y_height / 2; |
194 t_yuv_buffer.uv_stride = frame->linesize[1]; | 194 t_yuv_buffer.uv_stride = frame->linesize[1]; |
195 | 195 |