]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mpegvideo.c
dcadsp: add int8x8_fmul_int32 to dsp context
[ffmpeg] / libavcodec / mpegvideo.c
index 0003aedc81462f86fbacad4aee4c871995096cc1..73778f51b4bbce97ac1430e4636a05450108b4fd 100644 (file)
@@ -31,6 +31,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
+#include "libavutil/timer.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "internal.h"
@@ -371,8 +372,6 @@ av_cold int ff_dct_common_init(MpegEncContext *s)
 
     if (ARCH_ARM)
         ff_MPV_common_init_arm(s);
-    if (ARCH_BFIN)
-        ff_MPV_common_init_bfin(s);
     if (ARCH_PPC)
         ff_MPV_common_init_ppc(s);
     if (ARCH_X86)
@@ -424,15 +423,21 @@ fail:
  */
 static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
 {
+    int edges_needed = av_codec_is_encoder(s->avctx->codec);
     int r, ret;
 
     pic->tf.f = &pic->f;
     if (s->codec_id != AV_CODEC_ID_WMV3IMAGE &&
         s->codec_id != AV_CODEC_ID_VC1IMAGE  &&
-        s->codec_id != AV_CODEC_ID_MSS2)
+        s->codec_id != AV_CODEC_ID_MSS2) {
+        if (edges_needed) {
+            pic->f.width  = s->avctx->width  + 2 * EDGE_WIDTH;
+            pic->f.height = s->avctx->height + 2 * EDGE_WIDTH;
+        }
+
         r = ff_thread_get_buffer(s->avctx, &pic->tf,
                                  pic->reference ? AV_GET_BUFFER_FLAG_REF : 0);
-    else {
+    else {
         pic->f.width  = s->avctx->width;
         pic->f.height = s->avctx->height;
         pic->f.format = s->avctx->pix_fmt;
@@ -445,6 +450,18 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
         return -1;
     }
 
+    if (edges_needed) {
+        int i;
+        for (i = 0; pic->f.data[i]; i++) {
+            int offset = (EDGE_WIDTH >> (i ? s->chroma_y_shift : 0)) *
+                         pic->f.linesize[i] +
+                         (EDGE_WIDTH >> (i ? s->chroma_x_shift : 0));
+            pic->f.data[i] += offset;
+        }
+        pic->f.width  = s->avctx->width;
+        pic->f.height = s->avctx->height;
+    }
+
     if (s->avctx->hwaccel) {
         assert(!pic->hwaccel_picture_private);
         if (s->avctx->hwaccel->priv_data_size) {
@@ -1834,28 +1851,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
     } else
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif /* FF_API_XVMC */
-    if (s->er.error_count  &&
-        !s->avctx->hwaccel &&
-        s->unrestricted_mv &&
-        s->current_picture.reference &&
-        !s->intra_only &&
-        !(s->flags & CODEC_FLAG_EMU_EDGE)) {
-        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
-        int hshift = desc->log2_chroma_w;
-        int vshift = desc->log2_chroma_h;
-        s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
-                          s->h_edge_pos, s->v_edge_pos,
-                          EDGE_WIDTH, EDGE_WIDTH,
-                          EDGE_TOP | EDGE_BOTTOM);
-        s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize,
-                          s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
-                          EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
-                          EDGE_TOP | EDGE_BOTTOM);
-        s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize,
-                          s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
-                          EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
-                          EDGE_TOP | EDGE_BOTTOM);
-    }
 
     emms_c();
 
@@ -2318,13 +2313,11 @@ void ff_MPV_decode_mb(MpegEncContext *s, int16_t block[12][64]){
 /**
  * @param h is the normal height, this will be reduced automatically if needed for the last row
  */
-void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur,
+void ff_draw_horiz_band(AVCodecContext *avctx, Picture *cur,
                         Picture *last, int y, int h, int picture_structure,
-                        int first_field, int draw_edges, int low_delay,
-                        int v_edge_pos, int h_edge_pos)
+                        int first_field, int low_delay)
 {
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
-    int hshift = desc->log2_chroma_w;
     int vshift = desc->log2_chroma_h;
     const int field_pic = picture_structure != PICT_FRAME;
     if(field_pic){
@@ -2332,29 +2325,6 @@ void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur,
         y <<= 1;
     }
 
-    if (!avctx->hwaccel &&
-        draw_edges &&
-        cur->reference &&
-        !(avctx->flags & CODEC_FLAG_EMU_EDGE)) {
-        int *linesize = cur->f.linesize;
-        int sides = 0, edge_h;
-        if (y==0) sides |= EDGE_TOP;
-        if (y + h >= v_edge_pos)
-            sides |= EDGE_BOTTOM;
-
-        edge_h= FFMIN(h, v_edge_pos - y);
-
-        dsp->draw_edges(cur->f.data[0] + y * linesize[0],
-                        linesize[0], h_edge_pos, edge_h,
-                        EDGE_WIDTH, EDGE_WIDTH, sides);
-        dsp->draw_edges(cur->f.data[1] + (y >> vshift) * linesize[1],
-                        linesize[1], h_edge_pos >> hshift, edge_h >> vshift,
-                        EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, sides);
-        dsp->draw_edges(cur->f.data[2] + (y >> vshift) * linesize[2],
-                        linesize[2], h_edge_pos >> hshift, edge_h >> vshift,
-                        EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, sides);
-    }
-
     h = FFMIN(h, avctx->height - y);
 
     if(field_pic && first_field && !(avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return;
@@ -2394,11 +2364,9 @@ void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur,
 
 void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
 {
-    int draw_edges = s->unrestricted_mv && !s->intra_only;
-    ff_draw_horiz_band(s->avctx, &s->dsp, &s->current_picture,
+    ff_draw_horiz_band(s->avctx, &s->current_picture,
                        &s->last_picture, y, h, s->picture_structure,
-                       s->first_field, draw_edges, s->low_delay,
-                       s->v_edge_pos, s->h_edge_pos);
+                       s->first_field, s->low_delay);
 }
 
 void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename