From 92e598a57a7ce4b8ac9ea56274af39f5fd888311 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 27 Feb 2014 14:49:54 -0800 Subject: [PATCH] prores: Drop DSP infrastructure for prores encoder bits None of the encoder bits are arch-optimized. --- libavcodec/Makefile | 2 +- libavcodec/proresdsp.c | 24 +----------------------- libavcodec/proresdsp.h | 1 - libavcodec/proresenc.c | 35 ++++++++++++++++++++++++----------- 4 files changed, 26 insertions(+), 36 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index f975f16..fcb36ee 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -291,7 +291,7 @@ OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o OBJS-$(CONFIG_PPM_DECODER) += pnmdec.o pnm.o OBJS-$(CONFIG_PPM_ENCODER) += pnmenc.o OBJS-$(CONFIG_PRORES_DECODER) += proresdec.o proresdata.o proresdsp.o -OBJS-$(CONFIG_PRORES_ENCODER) += proresenc.o proresdata.o proresdsp.o +OBJS-$(CONFIG_PRORES_ENCODER) += proresenc.o proresdata.o OBJS-$(CONFIG_PTX_DECODER) += ptx.o OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o \ celp_filters.o acelp_vectors.o \ diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c index 09008ea..1d60897 100644 --- a/libavcodec/proresdsp.c +++ b/libavcodec/proresdsp.c @@ -20,9 +20,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.h" #include "libavutil/attributes.h" #include "libavutil/common.h" -#include "dct.h" #include "dsputil.h" #include "proresdsp.h" #include "simple_idct.h" @@ -33,7 +33,6 @@ #define CLIP_AND_BIAS(x) (av_clip((x) + BIAS, CLIP_MIN, CLIP_MAX)) -#if CONFIG_PRORES_DECODER /** * Add bias value, clamp and output pixels of a slice */ @@ -55,26 +54,9 @@ static void prores_idct_put_c(uint16_t *out, int linesize, int16_t *block, const ff_prores_idct(block, qmat); put_pixels(out, linesize >> 1, block); } -#endif - -#if CONFIG_PRORES_ENCODER -static void prores_fdct_c(const uint16_t *src, int linesize, int16_t *block) -{ - int x, y; - const uint16_t *tsrc = src; - - for (y = 0; y < 8; y++) { - for (x = 0; x < 8; x++) - block[y * 8 + x] = tsrc[x]; - tsrc += linesize >> 1; - } - ff_jpeg_fdct_islow_10(block); -} -#endif av_cold void ff_proresdsp_init(ProresDSPContext *dsp) { -#if CONFIG_PRORES_DECODER dsp->idct_put = prores_idct_put_c; dsp->idct_permutation_type = FF_NO_IDCT_PERM; @@ -83,8 +65,4 @@ av_cold void ff_proresdsp_init(ProresDSPContext *dsp) ff_init_scantable_permutation(dsp->idct_permutation, dsp->idct_permutation_type); -#endif -#if CONFIG_PRORES_ENCODER - dsp->fdct = prores_fdct_c; -#endif } diff --git a/libavcodec/proresdsp.h b/libavcodec/proresdsp.h index 71a0706..e8a3ea9 100644 --- a/libavcodec/proresdsp.h +++ b/libavcodec/proresdsp.h @@ -31,7 +31,6 @@ typedef struct ProresDSPContext { int idct_permutation_type; uint8_t idct_permutation[64]; void (* idct_put) (uint16_t *out, int linesize, int16_t *block, const int16_t *qmat); - void (* fdct) (const uint16_t *src, int linesize, int16_t *block); } ProresDSPContext; void ff_proresdsp_init(ProresDSPContext *dsp); diff --git a/libavcodec/proresenc.c b/libavcodec/proresenc.c index 4f5d0c4..d7d4af0 100644 --- a/libavcodec/proresenc.c +++ b/libavcodec/proresenc.c @@ -23,11 +23,11 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "avcodec.h" +#include "dct.h" #include "dsputil.h" #include "put_bits.h" #include "bytestream.h" #include "internal.h" -#include "proresdsp.h" #include "proresdata.h" #define CFACTOR_Y422 2 @@ -192,7 +192,7 @@ typedef struct ProresContext { const uint8_t *quant_mat; const uint8_t *scantable; - ProresDSPContext dsp; + void (* fdct) (const uint16_t *src, int linesize, int16_t *block); int mb_width, mb_height; int mbs_per_slice; @@ -261,27 +261,27 @@ static void get_slice_data(ProresContext *ctx, const uint16_t *src, mb_width * sizeof(*emu_buf)); } if (!is_chroma) { - ctx->dsp.fdct(esrc, elinesize, blocks); + ctx->fdct(esrc, elinesize, blocks); blocks += 64; if (blocks_per_mb > 2) { - ctx->dsp.fdct(esrc + 8, elinesize, blocks); + ctx->fdct(esrc + 8, elinesize, blocks); blocks += 64; } - ctx->dsp.fdct(esrc + elinesize * 4, elinesize, blocks); + ctx->fdct(esrc + elinesize * 4, elinesize, blocks); blocks += 64; if (blocks_per_mb > 2) { - ctx->dsp.fdct(esrc + elinesize * 4 + 8, elinesize, blocks); + ctx->fdct(esrc + elinesize * 4 + 8, elinesize, blocks); blocks += 64; } } else { - ctx->dsp.fdct(esrc, elinesize, blocks); + ctx->fdct(esrc, elinesize, blocks); blocks += 64; - ctx->dsp.fdct(esrc + elinesize * 4, elinesize, blocks); + ctx->fdct(esrc + elinesize * 4, elinesize, blocks); blocks += 64; if (blocks_per_mb > 2) { - ctx->dsp.fdct(esrc + 8, elinesize, blocks); + ctx->fdct(esrc + 8, elinesize, blocks); blocks += 64; - ctx->dsp.fdct(esrc + elinesize * 4 + 8, elinesize, blocks); + ctx->fdct(esrc + elinesize * 4 + 8, elinesize, blocks); blocks += 64; } } @@ -1066,6 +1066,19 @@ static av_cold int encode_close(AVCodecContext *avctx) return 0; } +static void prores_fdct(const uint16_t *src, int linesize, int16_t *block) +{ + int x, y; + const uint16_t *tsrc = src; + + for (y = 0; y < 8; y++) { + for (x = 0; x < 8; x++) + block[y * 8 + x] = tsrc[x]; + tsrc += linesize >> 1; + } + ff_jpeg_fdct_islow_10(block); +} + static av_cold int encode_init(AVCodecContext *avctx) { ProresContext *ctx = avctx->priv_data; @@ -1079,7 +1092,7 @@ static av_cold int encode_init(AVCodecContext *avctx) if (!avctx->coded_frame) return AVERROR(ENOMEM); - ff_proresdsp_init(&ctx->dsp); + ctx->fdct = prores_fdct; ctx->scantable = interlaced ? ff_prores_interlaced_scan : ff_prores_progressive_scan; -- 2.7.4