diff 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
line wrap: on
line diff
--- a/libschroedingerenc.c	Sat Aug 15 11:42:15 2009 +0000
+++ b/libschroedingerenc.c	Sat Aug 15 11:59:53 2009 +0000
@@ -223,15 +223,13 @@
     /* Input line size may differ from what the codec supports. Especially
      * when transcoding from one format to another. So use avpicture_layout
      * to copy the frame. */
-    in_frame = schro_frame_new_and_alloc(NULL,
-                                         p_schro_params->frame_format,
-                                         p_schro_params->format->width,
-                                         p_schro_params->format->height);
+    in_frame = ff_create_schro_frame(avccontext, p_schro_params->frame_format);
 
-    avpicture_layout((AVPicture *)in_data, avccontext->pix_fmt,
-                     avccontext->width, avccontext->height,
-                     in_frame->components[0].data,
-                     p_schro_params->frame_size);
+    if (in_frame)
+        avpicture_layout((AVPicture *)in_data, avccontext->pix_fmt,
+                          avccontext->width, avccontext->height,
+                          in_frame->components[0].data,
+                          p_schro_params->frame_size);
 
     return in_frame;
 }