h264: move the scratch buffers into the per-slice context
[ffmpeg.git] / libavcodec / svq3.c
index 56b5fb4..d28b2d2 100644 (file)
@@ -296,6 +296,7 @@ static inline void svq3_mc_dir_part(SVQ3Context *s,
                                     int thirdpel, int dir, int avg)
 {
     H264Context *h = &s->h;
+    H264SliceContext *sl = &h->slice_ctx[0];
     const H264Picture *pic = (dir == 0) ? s->last_pic : s->next_pic;
     uint8_t *src, *dest;
     int i, emu = 0;
@@ -316,11 +317,11 @@ static inline void svq3_mc_dir_part(SVQ3Context *s,
     src  = pic->f.data[0] + mx + my * h->linesize;
 
     if (emu) {
-        h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src,
+        h->vdsp.emulated_edge_mc(sl->edge_emu_buffer, src,
                                  h->linesize, h->linesize,
                                  width + 1, height + 1,
                                  mx, my, s->h_edge_pos, s->v_edge_pos);
-        src = h->edge_emu_buffer;
+        src = sl->edge_emu_buffer;
     }
     if (thirdpel)
         (avg ? s->tdsp.avg_tpel_pixels_tab
@@ -343,12 +344,12 @@ static inline void svq3_mc_dir_part(SVQ3Context *s,
             src  = pic->f.data[i] + mx + my * h->uvlinesize;
 
             if (emu) {
-                h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src,
+                h->vdsp.emulated_edge_mc(sl->edge_emu_buffer, src,
                                          h->uvlinesize, h->uvlinesize,
                                          width + 1, height + 1,
                                          mx, my, (s->h_edge_pos >> 1),
                                          s->v_edge_pos >> 1);
-                src = h->edge_emu_buffer;
+                src = sl->edge_emu_buffer;
             }
             if (thirdpel)
                 (avg ? s->tdsp.avg_tpel_pixels_tab
@@ -1060,6 +1061,7 @@ static int get_buffer(AVCodecContext *avctx, H264Picture *pic)
 {
     SVQ3Context *s = avctx->priv_data;
     H264Context *h = &s->h;
+    H264SliceContext *sl = &h->slice_ctx[0];
     const int big_mb_num    = h->mb_stride * (h->mb_height + 1) + 1;
     const int mb_array_size = h->mb_stride * h->mb_height;
     const int b4_stride     = h->mb_width * 4 + 1;
@@ -1093,9 +1095,9 @@ static int get_buffer(AVCodecContext *avctx, H264Picture *pic)
     if (ret < 0)
         goto fail;
 
-    if (!h->edge_emu_buffer) {
-        h->edge_emu_buffer = av_mallocz(pic->f.linesize[0] * 17);
-        if (!h->edge_emu_buffer)
+    if (!sl->edge_emu_buffer) {
+        sl->edge_emu_buffer = av_mallocz(pic->f.linesize[0] * 17);
+        if (!sl->edge_emu_buffer)
             return AVERROR(ENOMEM);
     }