[FFmpeg-cvslog] dwt: return errors from ff_slice_buffer_init()

Diego Biurrun git at videolan.org
Wed May 23 22:00:56 CEST 2012


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Tue May 22 13:50:23 2012 +0200| [cc7fac9970c61f764cc9ca2a263c11fb1497dd28] | committer: Diego Biurrun

dwt: return errors from ff_slice_buffer_init()

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc7fac9970c61f764cc9ca2a263c11fb1497dd28
---

 libavcodec/dwt.c     |    7 ++++---
 libavcodec/dwt.h     |    6 +++---
 libavcodec/snowdec.c |    7 ++++++-
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/libavcodec/dwt.c b/libavcodec/dwt.c
index 675644d..d3d4f3b 100644
--- a/libavcodec/dwt.c
+++ b/libavcodec/dwt.c
@@ -22,9 +22,9 @@
 #include "dsputil.h"
 #include "dwt.h"
 
-void ff_slice_buffer_init(slice_buffer *buf, int line_count,
-                          int max_allocated_lines, int line_width,
-                          IDWTELEM *base_buffer)
+int ff_slice_buffer_init(slice_buffer *buf, int line_count,
+                         int max_allocated_lines, int line_width,
+                         IDWTELEM *base_buffer)
 {
     int i;
 
@@ -53,6 +53,7 @@ void ff_slice_buffer_init(slice_buffer *buf, int line_count,
     }
 
     buf->data_stack_top = max_allocated_lines - 1;
+    return 0;
 }
 
 IDWTELEM *ff_slice_buffer_load_line(slice_buffer *buf, int line)
diff --git a/libavcodec/dwt.h b/libavcodec/dwt.h
index 6c28447..9229928 100644
--- a/libavcodec/dwt.h
+++ b/libavcodec/dwt.h
@@ -137,9 +137,9 @@ typedef struct DWTContext {
                                  : ff_slice_buffer_load_line((slice_buf),   \
                                                              (line_num)))
 
-void ff_slice_buffer_init(slice_buffer *buf, int line_count,
-                          int max_allocated_lines, int line_width,
-                          IDWTELEM *base_buffer);
+int ff_slice_buffer_init(slice_buffer *buf, int line_count,
+                         int max_allocated_lines, int line_width,
+                         IDWTELEM *base_buffer);
 void ff_slice_buffer_release(slice_buffer *buf, int line);
 void ff_slice_buffer_flush(slice_buffer *buf);
 void ff_slice_buffer_destroy(slice_buffer *buf);
diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
index ef5205d..62ef5f1 100644
--- a/libavcodec/snowdec.c
+++ b/libavcodec/snowdec.c
@@ -396,7 +396,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
 
     // realloc slice buffer for the case that spatial_decomposition_count changed
     ff_slice_buffer_destroy(&s->sb);
-    ff_slice_buffer_init(&s->sb, s->plane[0].height, (MB_SIZE >> s->block_max_depth) + s->spatial_decomposition_count * 8 + 1, s->plane[0].width, s->spatial_idwt_buffer);
+    if ((res = ff_slice_buffer_init(&s->sb, s->plane[0].height,
+                                    (MB_SIZE >> s->block_max_depth) +
+                                    s->spatial_decomposition_count * 8 + 1,
+                                    s->plane[0].width,
+                                    s->spatial_idwt_buffer)) < 0)
+        return res;
 
     for(plane_index=0; plane_index<3; plane_index++){
         Plane *p= &s->plane[plane_index];



More information about the ffmpeg-cvslog mailing list