]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vp56.c
revert bad checkin
[ffmpeg] / libavcodec / vp56.c
index c69b1201d11f94afe7246dd05cf8040fd8b3c9b1..eb78d02e47c754ee2dabdda6a823752c7c858ba3 100644 (file)
@@ -4,18 +4,20 @@
  *
  * Copyright (C) 2006  Aurelien Jacobs <aurel@gnuage.org>
  *
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
@@ -358,14 +360,11 @@ static void vp56_mc(vp56_context_t *s, int b, uint8_t *src,
         src_block = s->edge_emu_buffer;
         src_offset = 2 + 2*stride;
     } else if (deblock_filtering) {
-        int i;
-        src_block = s->edge_emu_buffer;
-        src += s->block_offset[b] + (dy-2)*stride + (dx-2);
-        for (i=0; i<12; i++) {
-            memcpy(src_block, src, 12);
-            src_block += stride;
-            src += stride;
-        }
+        /* only need a 12x12 block, but there is no such dsp function, */
+        /* so copy a 16x12 block */
+        s->dsp.put_pixels_tab[0][0](s->edge_emu_buffer,
+                                    src + s->block_offset[b] + (dy-2)*stride + (dx-2),
+                                    stride, 12);
         src_block = s->edge_emu_buffer;
         src_offset = 2 + 2*stride;
     } else {
@@ -463,16 +462,16 @@ static int vp56_size_changed(AVCodecContext *avctx, vp56_context_t *s)
     int stride = s->frames[VP56_FRAME_CURRENT].linesize[0];
     int i;
 
-    s->plane_width[0] = s->avctx->width;
-    s->plane_width[1] = s->plane_width[2] = s->avctx->width/2;
-    s->plane_height[0] = s->avctx->height;
-    s->plane_height[1] = s->plane_height[2] = s->avctx->height/2;
+    s->plane_width[0] = s->avctx->coded_width;
+    s->plane_width[1] = s->plane_width[2] = s->avctx->coded_width/2;
+    s->plane_height[0] = s->avctx->coded_height;
+    s->plane_height[1] = s->plane_height[2] = s->avctx->coded_height/2;
 
     for (i=0; i<3; i++)
         s->stride[i] = s->flip * s->frames[VP56_FRAME_CURRENT].linesize[i];
 
-    s->mb_width = (s->avctx->width+15) / 16;
-    s->mb_height = (s->avctx->height+15) / 16;
+    s->mb_width = (s->avctx->coded_width+15) / 16;
+    s->mb_height = (s->avctx->coded_height+15) / 16;
 
     if (s->mb_width > 1000 || s->mb_height > 1000) {
         av_log(avctx, AV_LOG_ERROR, "picture too big\n");
@@ -483,7 +482,8 @@ static int vp56_size_changed(AVCodecContext *avctx, vp56_context_t *s)
                                  (4*s->mb_width+6) * sizeof(*s->above_blocks));
     s->macroblocks = av_realloc(s->macroblocks,
                                 s->mb_width*s->mb_height*sizeof(*s->macroblocks));
-    s->edge_emu_buffer_alloc = av_realloc(s->edge_emu_buffer_alloc, 16*stride);
+    av_free(s->edge_emu_buffer_alloc);
+    s->edge_emu_buffer_alloc = av_malloc(16*stride);
     s->edge_emu_buffer = s->edge_emu_buffer_alloc;
     if (s->flip < 0)
         s->edge_emu_buffer += 15 * stride;