comparison libschroedingerenc.c @ 10061:09f2db2d7c90 libavcodec

Fix bug caused by difference in stride and picture width. When a frame is allocated using libschroedinger routines, the frame data size does not match the actual frame size if the width is not a multiple of 16. So we cannot do a straightforward memcpy of the frame returned by libschroedinger into the FFmpeg picture as the stride differs from the width. Fix this bug by allocating for the libschroedinger frame with the dimensions in AVCodecContext within libavcodec and passing the frame to libschroedinger. patch by Anuradha Suraparaju, anuradha rd.bbc.co uk
author diego
date Sat, 15 Aug 2009 11:59:53 +0000
parents 965220ebc611
children 38cfe222e1a4
comparison
equal deleted inserted replaced
10060:965220ebc611 10061:09f2db2d7c90
221 FfmpegSchroEncoderParams* p_schro_params = avccontext->priv_data; 221 FfmpegSchroEncoderParams* p_schro_params = avccontext->priv_data;
222 SchroFrame *in_frame; 222 SchroFrame *in_frame;
223 /* Input line size may differ from what the codec supports. Especially 223 /* Input line size may differ from what the codec supports. Especially
224 * when transcoding from one format to another. So use avpicture_layout 224 * when transcoding from one format to another. So use avpicture_layout
225 * to copy the frame. */ 225 * to copy the frame. */
226 in_frame = schro_frame_new_and_alloc(NULL, 226 in_frame = ff_create_schro_frame(avccontext, p_schro_params->frame_format);
227 p_schro_params->frame_format, 227
228 p_schro_params->format->width, 228 if (in_frame)
229 p_schro_params->format->height); 229 avpicture_layout((AVPicture *)in_data, avccontext->pix_fmt,
230 230 avccontext->width, avccontext->height,
231 avpicture_layout((AVPicture *)in_data, avccontext->pix_fmt, 231 in_frame->components[0].data,
232 avccontext->width, avccontext->height, 232 p_schro_params->frame_size);
233 in_frame->components[0].data,
234 p_schro_params->frame_size);
235 233
236 return in_frame; 234 return in_frame;
237 } 235 }
238 236
239 static void SchroedingerFreeFrame(void *data) 237 static void SchroedingerFreeFrame(void *data)