From ed62e6e3c3ca8066456392d5e0dbe12c49d67a6c Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 10 Dec 2012 09:57:10 +0000 Subject: [PATCH 1/2] mjpegdec: use put_pixels instead of copy_block8 Signed-off-by: Mans Rullgard --- libavcodec/mjpegdec.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index d13c85e6d7..e63287a46b 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -864,8 +864,9 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, ptr = data[c] + block_offset; if (!s->progressive) { if (copy_mb) - copy_block8(ptr, reference_data[c] + block_offset, - linesize[c], linesize[c], 8); + s->dsp.put_pixels_tab[1][0](ptr, + reference_data[c] + block_offset, + linesize[c], 8); else { s->dsp.clear_block(s->block); if (decode_block(s, s->block, i, @@ -979,8 +980,9 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, if (last_scan) { if (copy_mb) { - copy_block8(ptr, reference_data + block_offset, - linesize, linesize, 8); + s->dsp.put_pixels_tab[1][0](ptr, + reference_data + block_offset, + linesize, 8); } else { s->dsp.idct_put(ptr, linesize, *block); ptr += 8; From b9ee5f2cab3ffe1c962e542346b1ed61394864ec Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 9 Dec 2012 19:18:47 +0000 Subject: [PATCH 2/2] indeo3: replace use of copy_block4 with put_pixels The destination is sufficiently aligned for put_pixels here. Signed-off-by: Mans Rullgard --- libavcodec/indeo3.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index 261c651b52..22f5e7916b 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -254,7 +254,7 @@ static void copy_cell(Indeo3DecodeContext *ctx, Plane *plane, Cell *cell) } if (w >= 1) { - copy_block4(dst, src, plane->pitch, plane->pitch, h); + ctx->dsp.put_no_rnd_pixels_tab[2][0](dst, src, plane->pitch, h); w--; src += 4; dst += 4; @@ -324,7 +324,7 @@ if (*data_ptr >= last_ptr) \ #define RLE_BLOCK_COPY \ if (cell->mv_ptr || !skip_flag) \ - copy_block4(dst, ref, row_offset, row_offset, 4 << v_zoom) + ctx->dsp.put_pixels_tab[2][0](dst, ref, row_offset, 4 << v_zoom) #define RLE_BLOCK_COPY_8 \ pix64 = AV_RN64A(ref);\ @@ -336,7 +336,7 @@ if (*data_ptr >= last_ptr) \ fill_64(dst, pix64, 8, row_offset) #define RLE_LINES_COPY \ - copy_block4(dst, ref, row_offset, row_offset, num_lines << v_zoom) + ctx->dsp.put_pixels_tab[2][0](dst, ref, row_offset, num_lines << v_zoom) #define RLE_LINES_COPY_M10 \ pix64 = AV_RN64A(ref);\ @@ -404,7 +404,8 @@ if (*data_ptr >= last_ptr) \ } -static int decode_cell_data(Cell *cell, uint8_t *block, uint8_t *ref_block, +static int decode_cell_data(Indeo3DecodeContext *ctx, Cell *cell, + uint8_t *block, uint8_t *ref_block, int pitch, int h_zoom, int v_zoom, int mode, const vqEntry *delta[2], int swap_quads[2], const uint8_t **data_ptr, const uint8_t *last_ptr) @@ -637,14 +638,16 @@ static int decode_cell(Indeo3DecodeContext *ctx, AVCodecContext *avctx, } zoom_fac = mode >= 3; - error = decode_cell_data(cell, block, ref_block, plane->pitch, 0, zoom_fac, - mode, delta, swap_quads, &data_ptr, last_ptr); + error = decode_cell_data(ctx, cell, block, ref_block, plane->pitch, + 0, zoom_fac, mode, delta, swap_quads, + &data_ptr, last_ptr); break; case 10: /*-------------------- MODE 10 (8x8 block processing) ---------------------*/ case 11: /*----------------- MODE 11 (4x8 INTER block processing) ------------------*/ if (mode == 10 && !cell->mv_ptr) { /* MODE 10 INTRA processing */ - error = decode_cell_data(cell, block, ref_block, plane->pitch, 1, 1, - mode, delta, swap_quads, &data_ptr, last_ptr); + error = decode_cell_data(ctx, cell, block, ref_block, plane->pitch, + 1, 1, mode, delta, swap_quads, + &data_ptr, last_ptr); } else { /* mode 10 and 11 INTER processing */ if (mode == 11 && !cell->mv_ptr) { av_log(avctx, AV_LOG_ERROR, "Attempt to use Mode 11 for an INTRA cell!\n"); @@ -652,7 +655,7 @@ static int decode_cell(Indeo3DecodeContext *ctx, AVCodecContext *avctx, } zoom_fac = mode == 10; - error = decode_cell_data(cell, block, ref_block, plane->pitch, + error = decode_cell_data(ctx, cell, block, ref_block, plane->pitch, zoom_fac, 1, mode, delta, swap_quads, &data_ptr, last_ptr); }