---
configure | 13 +++---
libavcodec/Makefile | 3 +-
libavcodec/asv.h | 2 +
libavcodec/asvenc.c | 6 ++-
libavcodec/bfin/Makefile | 3 +-
libavcodec/bfin/dsputil_init.c | 5 ---
libavcodec/bfin/{fdct_bfin.S => fdctdsp.S} | 0
.../{ppc/dsputil_altivec.h => bfin/fdctdsp_init.c} | 31 +++++++------
libavcodec/dnxhdenc.c | 4 +-
libavcodec/dsputil.c | 24 +---------
libavcodec/dsputil.h | 4 --
libavcodec/dvenc.c | 7 ++-
libavcodec/fdctdsp.c | 52 ++++++++++++++++++++++
libavcodec/{ppc/dsputil_altivec.h => fdctdsp.h} | 26 ++++++-----
libavcodec/mpegvideo.h | 2 +
libavcodec/mpegvideo_enc.c | 21 ++++-----
libavcodec/ppc/Makefile | 5 +--
libavcodec/ppc/dsputil_altivec.h | 2 -
libavcodec/ppc/dsputil_ppc.c | 9 +---
libavcodec/ppc/{dsputil_altivec.h => fdctdsp.h} | 15 ++-----
.../ppc/{fdct_altivec.c => fdctdsp_altivec.c} | 23 +++++++++-
libavcodec/proresenc.c | 31 +++++++------
libavcodec/x86/Makefile | 3 +-
libavcodec/x86/dsputilenc_mmx.c | 14 ------
.../{ppc/dsputil_ppc.c => x86/fdctdsp_init.c} | 35 +++++++--------
25 files changed, 186 insertions(+), 154 deletions(-)
rename libavcodec/bfin/{fdct_bfin.S => fdctdsp.S} (100%)
copy libavcodec/{ppc/dsputil_altivec.h => bfin/fdctdsp_init.c} (56%)
create mode 100644 libavcodec/fdctdsp.c
copy libavcodec/{ppc/dsputil_altivec.h => fdctdsp.h} (53%)
copy libavcodec/ppc/{dsputil_altivec.h => fdctdsp.h} (66%)
rename libavcodec/ppc/{fdct_altivec.c => fdctdsp_altivec.c} (97%)
copy libavcodec/{ppc/dsputil_ppc.c => x86/fdctdsp_init.c} (60%)
diff --git a/configure b/configure
index d462d0a..a095eed 100755
--- a/configure
+++ b/configure
@@ -1475,6 +1475,7 @@ CONFIG_EXTRA="
blockdsp
bswapdsp
dsputil
+ fdctdsp
gcrypt
golomb
gplv3
@@ -1644,7 +1645,7 @@ threads_if_any="$THREADS_LIST"
# subsystems
dct_select="rdft"
-dsputil_select="idctdsp"
+dsputil_select="fdctdsp idctdsp"
error_resilience_select="dsputil"
mdct_select="fft"
rdft_select="fft"
@@ -1668,9 +1669,9 @@ amrwb_decoder_select="lsp"
amv_decoder_select="sp5x_decoder"
ape_decoder_select="bswapdsp"
asv1_decoder_select="blockdsp bswapdsp idctdsp"
-asv1_encoder_select="bswapdsp dsputil"
+asv1_encoder_select="bswapdsp dsputil fdctdsp"
asv2_decoder_select="blockdsp bswapdsp idctdsp"
-asv2_encoder_select="bswapdsp dsputil"
+asv2_encoder_select="bswapdsp dsputil fdctdsp"
atrac1_decoder_select="mdct sinewin"
atrac3_decoder_select="mdct"
atrac3p_decoder_select="mdct sinewin"
@@ -1685,9 +1686,9 @@ cscd_decoder_select="lzo"
cscd_decoder_suggest="zlib"
dca_decoder_select="mdct"
dnxhd_decoder_select="blockdsp idctdsp"
-dnxhd_encoder_select="aandcttables blockdsp dsputil idctdsp mpegvideoenc"
+dnxhd_encoder_select="aandcttables blockdsp dsputil fdctdsp idctdsp
mpegvideoenc"
dvvideo_decoder_select="idctdsp"
-dvvideo_encoder_select="dsputil"
+dvvideo_encoder_select="dsputil fdctdsp"
dxa_decoder_deps="zlib"
eac3_decoder_select="ac3_decoder"
eac3_encoder_select="ac3_encoder"
@@ -1773,7 +1774,7 @@ png_decoder_deps="zlib"
png_encoder_deps="zlib"
png_encoder_select="huffyuvencdsp"
prores_decoder_select="idctdsp"
-prores_encoder_select="dsputil"
+prores_encoder_select="fdctdsp"
qcelp_decoder_select="lsp"
qdm2_decoder_select="mdct rdft mpegaudiodsp"
ra_144_encoder_select="audio_frame_queue lpc"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index d7d8a79..6236df5 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -34,8 +34,9 @@ OBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
OBJS-$(CONFIG_DSPUTIL) += dsputil.o
OBJS-$(CONFIG_DXVA2) += dxva2.o
-OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o
OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o
+OBJS-$(CONFIG_FDCTDSP) += fdctdsp.o faandct.o \
+ jfdctfst.o jfdctint.o
FFT-OBJS-$(CONFIG_HARDCODED_TABLES) += cos_tables.o cos_fixed_tables.o
OBJS-$(CONFIG_FFT) += avfft.o fft_fixed.o fft_float.o \
$(FFT-OBJS-yes)
diff --git a/libavcodec/asv.h b/libavcodec/asv.h
index 3f8d56c..71d2583 100644
--- a/libavcodec/asv.h
+++ b/libavcodec/asv.h
@@ -34,6 +34,7 @@
#include "blockdsp.h"
#include "bswapdsp.h"
#include "dsputil.h"
+#include "fdctdsp.h"
#include "idctdsp.h"
#include "get_bits.h"
#include "put_bits.h"
@@ -43,6 +44,7 @@ typedef struct ASV1Context{
BlockDSPContext bdsp;
BswapDSPContext bbdsp;
DSPContext dsp;
+ FDCTDSPContext fdsp;
IDCTDSPContext idsp;
PutBitContext pb;
GetBitContext gb;
diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c
index e8c6d00..1a7021f 100644
--- a/libavcodec/asvenc.c
+++ b/libavcodec/asvenc.c
@@ -28,6 +28,7 @@
#include "asv.h"
#include "avcodec.h"
+#include "fdctdsp.h"
#include "mathops.h"
#include "mpeg12data.h"
@@ -163,13 +164,13 @@ static inline void dct_get(ASV1Context *a, const AVFrame
*frame,
a->dsp.get_pixels(block[2], ptr_y + 8*linesize , linesize);
a->dsp.get_pixels(block[3], ptr_y + 8*linesize + 8, linesize);
for(i=0; i<4; i++)
- a->dsp.fdct(block[i]);
+ a->fdsp.fdct(block[i]);
if(!(a->avctx->flags&CODEC_FLAG_GRAY)){
a->dsp.get_pixels(block[4], ptr_cb, frame->linesize[1]);
a->dsp.get_pixels(block[5], ptr_cr, frame->linesize[2]);
for(i=4; i<6; i++)
- a->dsp.fdct(block[i]);
+ a->fdsp.fdct(block[i]);
}
}
@@ -248,6 +249,7 @@ static av_cold int encode_init(AVCodecContext *avctx){
ff_asv_common_init(avctx);
ff_dsputil_init(&a->dsp, avctx);
+ ff_fdctdsp_init(&a->fdsp, avctx);
if(avctx->global_quality == 0) avctx->global_quality= 4*FF_QUALITY_SCALE;
diff --git a/libavcodec/bfin/Makefile b/libavcodec/bfin/Makefile
index daa58d0..343d152 100644
--- a/libavcodec/bfin/Makefile
+++ b/libavcodec/bfin/Makefile
@@ -1,8 +1,9 @@
OBJS-$(CONFIG_BLOCKDSP) += bfin/blockdsp.o
OBJS-$(CONFIG_DSPUTIL) += bfin/dsputil_init.o \
bfin/dsputil.o \
- bfin/fdct_bfin.o \
bfin/pixels.o
+OBJS-$(CONFIG_FDCTDSP) += bfin/fdctdsp_init.o \
+ bfin/fdctdsp.o
OBJS-$(CONFIG_HPELDSP) += bfin/hpeldsp_init.o \
bfin/hpel_pixels_no_rnd.o \
bfin/pixels.o
diff --git a/libavcodec/bfin/dsputil_init.c b/libavcodec/bfin/dsputil_init.c
index aa14a81..8928039 100644
--- a/libavcodec/bfin/dsputil_init.c
+++ b/libavcodec/bfin/dsputil_init.c
@@ -30,8 +30,6 @@
#include "libavcodec/dsputil.h"
#include "libavcodec/mpegvideo.h"
-void ff_bfin_fdct(int16_t *block) attribute_l1_text;
-
void ff_bfin_diff_pixels(int16_t *block, const uint8_t *s1, const uint8_t *s2,
int stride) attribute_l1_text;
void ff_bfin_get_pixels(int16_t *restrict block, const uint8_t *pixels,
@@ -140,8 +138,5 @@ av_cold void ff_dsputil_init_bfin(DSPContext *c,
AVCodecContext *avctx,
if (!high_bit_depth) {
c->get_pixels = ff_bfin_get_pixels;
-
- if (avctx->dct_algo == FF_DCT_AUTO)
- c->fdct = ff_bfin_fdct;
}
}
diff --git a/libavcodec/bfin/fdct_bfin.S b/libavcodec/bfin/fdctdsp.S
similarity index 100%
rename from libavcodec/bfin/fdct_bfin.S
rename to libavcodec/bfin/fdctdsp.S
diff --git a/libavcodec/ppc/dsputil_altivec.h b/libavcodec/bfin/fdctdsp_init.c
similarity index 56%
copy from libavcodec/ppc/dsputil_altivec.h
copy to libavcodec/bfin/fdctdsp_init.c
index be5fd58..63d308d 100644
--- a/libavcodec/ppc/dsputil_altivec.h
+++ b/libavcodec/bfin/fdctdsp_init.c
@@ -1,7 +1,8 @@
/*
- * Copyright (c) 2002 Brian Foley
- * Copyright (c) 2002 Dieter Shirley
- * Copyright (c) 2003-2004 Romain Dolbeau <[email protected]>
+ * BlackFin FDCT
+ *
+ * Copyright (C) 2007 Marc Hoffman <[email protected]>
+ * Copyright (c) 2006 Michael Benjamin <[email protected]>
*
* This file is part of Libav.
*
@@ -20,16 +21,18 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef AVCODEC_PPC_DSPUTIL_ALTIVEC_H
-#define AVCODEC_PPC_DSPUTIL_ALTIVEC_H
-
-#include <stdint.h>
-
-#include "libavcodec/dsputil.h"
-
-void ff_fdct_altivec(int16_t *block);
+#include "libavutil/attributes.h"
+#include "libavutil/bfin/attributes.h"
+#include "libavcodec/avcodec.h"
+#include "libavcodec/fdctdsp.h"
-void ff_dsputil_init_altivec(DSPContext *c, AVCodecContext *avctx,
- unsigned high_bit_depth);
+void ff_bfin_fdct(int16_t *block) attribute_l1_text;
-#endif /* AVCODEC_PPC_DSPUTIL_ALTIVEC_H */
+av_cold void ff_fdctdsp_init_bfin(FDCTDSPContext *c, AVCodecContext *avctx,
+ unsigned high_bit_depth)
+{
+ if (!high_bit_depth) {
+ if (avctx->dct_algo == FF_DCT_AUTO)
+ c->fdct = ff_bfin_fdct;
+ }
+}
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 0e46ac0..84603ce 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -32,6 +32,7 @@
#include "avcodec.h"
#include "blockdsp.h"
#include "dsputil.h"
+#include "fdctdsp.h"
#include "internal.h"
#include "mpegvideo.h"
#include "dnxhdenc.h"
@@ -84,7 +85,7 @@ static int dnxhd_10bit_dct_quantize(MpegEncContext *ctx,
int16_t *block,
int last_non_zero = 0;
int i;
- ctx->dsp.fdct(block);
+ ctx->fdsp.fdct(block);
// Divide by 4 with rounding, to compensate scaling of DCT coefficients
block[0] = (block[0] + 2) >> 2;
@@ -265,6 +266,7 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
ff_blockdsp_init(&ctx->bdsp, avctx);
ff_dsputil_init(&ctx->m.dsp, avctx);
+ ff_fdctdsp_init(&ctx->m.fdsp, avctx);
ff_idctdsp_init(&ctx->m.idsp, avctx);
ff_mpegvideoencdsp_init(&ctx->m.mvedsp, avctx);
ff_dct_common_init(&ctx->m);
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 9fe144c..63f434e 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -28,10 +28,8 @@
#include "libavutil/attributes.h"
#include "avcodec.h"
#include "copy_block.h"
-#include "dct.h"
#include "dsputil.h"
#include "simple_idct.h"
-#include "faandct.h"
#include "mpegvideo.h"
#include "config.h"
@@ -580,7 +578,7 @@ static int dct_sad8x8_c(MpegEncContext *s, uint8_t *src1,
assert(h == 8);
s->dsp.diff_pixels(temp, src1, src2, stride);
- s->dsp.fdct(temp);
+ s->fdsp.fdct(temp);
return s->dsp.sum_abs_dctelem(temp);
}
@@ -647,7 +645,7 @@ static int dct_max8x8_c(MpegEncContext *s, uint8_t *src1,
assert(h == 8);
s->dsp.diff_pixels(temp, src1, src2, stride);
- s->dsp.fdct(temp);
+ s->fdsp.fdct(temp);
for (i = 0; i < 64; i++)
sum = FFMAX(sum, FFABS(temp[i]));
@@ -940,24 +938,6 @@ av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext
*avctx)
square_tab_init();
-#if CONFIG_ENCODERS
- if (avctx->bits_per_raw_sample == 10) {
- c->fdct = ff_jpeg_fdct_islow_10;
- c->fdct248 = ff_fdct248_islow_10;
- } else {
- if (avctx->dct_algo == FF_DCT_FASTINT) {
- c->fdct = ff_fdct_ifast;
- c->fdct248 = ff_fdct_ifast248;
- } else if (avctx->dct_algo == FF_DCT_FAAN) {
- c->fdct = ff_faandct;
- c->fdct248 = ff_faandct248;
- } else {
- c->fdct = ff_jpeg_fdct_islow_8; // slow/accurate/default
- c->fdct248 = ff_fdct248_islow_8;
- }
- }
-#endif /* CONFIG_ENCODERS */
-
c->diff_pixels = diff_pixels_c;
c->sum_abs_dctelem = sum_abs_dctelem_c;
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index c323f3f..6f172e4 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -79,10 +79,6 @@ typedef struct DSPContext {
me_cmp_func frame_skip_cmp[6]; // only width 8 used
me_cmp_func pix_abs[2][4];
-
- /* (I)DCT */
- void (*fdct)(int16_t *block /* align 16 */);
- void (*fdct248)(int16_t *block /* align 16 */);
} DSPContext;
void ff_dsputil_init(DSPContext *p, AVCodecContext *avctx);
diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index 0fc94e5..601210f 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -29,6 +29,7 @@
#include "config.h"
#include "avcodec.h"
#include "dsputil.h"
+#include "fdctdsp.h"
#include "internal.h"
#include "put_bits.h"
#include "dv.h"
@@ -38,6 +39,7 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
{
DVVideoContext *s = avctx->priv_data;
DSPContext dsp;
+ FDCTDSPContext fdsp;
if (!avpriv_dv_codec_profile(avctx)) {
av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video. "
@@ -54,13 +56,14 @@ static av_cold int dvvideo_encode_init(AVCodecContext
*avctx)
dv_vlc_map_tableinit();
ff_dsputil_init(&dsp, avctx);
+ ff_fdctdsp_init(&fdsp, avctx);
ff_set_cmp(&dsp, dsp.ildct_cmp, avctx->ildct_cmp);
s->get_pixels = dsp.get_pixels;
s->ildct_cmp = dsp.ildct_cmp[5];
- s->fdct[0] = dsp.fdct;
- s->fdct[1] = dsp.fdct248;
+ s->fdct[0] = fdsp.fdct;
+ s->fdct[1] = fdsp.fdct248;
return ff_dvvideo_init(avctx);
}
diff --git a/libavcodec/fdctdsp.c b/libavcodec/fdctdsp.c
new file mode 100644
index 0000000..960c950
--- /dev/null
+++ b/libavcodec/fdctdsp.c
@@ -0,0 +1,52 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav 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.
+ *
+ * Libav 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 Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/attributes.h"
+#include "avcodec.h"
+#include "dct.h"
+#include "faandct.h"
+#include "fdctdsp.h"
+#include "config.h"
+
+av_cold void ff_fdctdsp_init(FDCTDSPContext *c, AVCodecContext *avctx)
+{
+ const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
+
+ if (avctx->bits_per_raw_sample == 10) {
+ c->fdct = ff_jpeg_fdct_islow_10;
+ c->fdct248 = ff_fdct248_islow_10;
+ } else {
+ if (avctx->dct_algo == FF_DCT_FASTINT) {
+ c->fdct = ff_fdct_ifast;
+ c->fdct248 = ff_fdct_ifast248;
+ } else if (avctx->dct_algo == FF_DCT_FAAN) {
+ c->fdct = ff_faandct;
+ c->fdct248 = ff_faandct248;
+ } else {
+ c->fdct = ff_jpeg_fdct_islow_8; // slow/accurate/default
+ c->fdct248 = ff_fdct248_islow_8;
+ }
+ }
+
+ if (ARCH_BFIN)
+ ff_fdctdsp_init_bfin(c, avctx, high_bit_depth);
+ if (ARCH_PPC)
+ ff_fdctdsp_init_ppc(c, avctx, high_bit_depth);
+ if (ARCH_X86)
+ ff_fdctdsp_init_x86(c, avctx, high_bit_depth);
+}
diff --git a/libavcodec/ppc/dsputil_altivec.h b/libavcodec/fdctdsp.h
similarity index 53%
copy from libavcodec/ppc/dsputil_altivec.h
copy to libavcodec/fdctdsp.h
index be5fd58..7d77411 100644
--- a/libavcodec/ppc/dsputil_altivec.h
+++ b/libavcodec/fdctdsp.h
@@ -1,8 +1,4 @@
/*
- * Copyright (c) 2002 Brian Foley
- * Copyright (c) 2002 Dieter Shirley
- * Copyright (c) 2003-2004 Romain Dolbeau <[email protected]>
- *
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
@@ -20,16 +16,24 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef AVCODEC_PPC_DSPUTIL_ALTIVEC_H
-#define AVCODEC_PPC_DSPUTIL_ALTIVEC_H
+#ifndef AVCODEC_FDCTDSP_H
+#define AVCODEC_FDCTDSP_H
#include <stdint.h>
-#include "libavcodec/dsputil.h"
+#include "avcodec.h"
-void ff_fdct_altivec(int16_t *block);
+typedef struct FDCTDSPContext {
+ void (*fdct)(int16_t *block /* align 16 */);
+ void (*fdct248)(int16_t *block /* align 16 */);
+} FDCTDSPContext;
-void ff_dsputil_init_altivec(DSPContext *c, AVCodecContext *avctx,
- unsigned high_bit_depth);
+void ff_fdctdsp_init(FDCTDSPContext *c, AVCodecContext *avctx);
+void ff_fdctdsp_init_bfin(FDCTDSPContext *c, AVCodecContext *avctx,
+ unsigned high_bit_depth);
+void ff_fdctdsp_init_ppc(FDCTDSPContext *c, AVCodecContext *avctx,
+ unsigned high_bit_depth);
+void ff_fdctdsp_init_x86(FDCTDSPContext *c, AVCodecContext *avctx,
+ unsigned high_bit_depth);
-#endif /* AVCODEC_PPC_DSPUTIL_ALTIVEC_H */
+#endif /* AVCODEC_FDCTDSP_H */
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index c7f02ae..431cb0b 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -32,6 +32,7 @@
#include "blockdsp.h"
#include "dsputil.h"
#include "error_resilience.h"
+#include "fdctdsp.h"
#include "get_bits.h"
#include "h263dsp.h"
#include "hpeldsp.h"
@@ -419,6 +420,7 @@ typedef struct MpegEncContext {
BlockDSPContext bdsp;
DSPContext dsp; ///< pointers for accelerated dsp functions
+ FDCTDSPContext fdsp;
HpelDSPContext hdsp;
IDCTDSPContext idsp;
MpegVideoDSPContext mvc;
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 1d43585..62b4416 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -75,15 +75,15 @@ void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64],
const uint16_t *quant_matrix,
int bias, int qmin, int qmax, int intra)
{
- DSPContext *dsp = &s->dsp;
+ FDCTDSPContext *fdsp = &s->fdsp;
int qscale;
int shift = 0;
for (qscale = qmin; qscale <= qmax; qscale++) {
int i;
- if (dsp->fdct == ff_jpeg_fdct_islow_8 ||
- dsp->fdct == ff_jpeg_fdct_islow_10 ||
- dsp->fdct == ff_faandct) {
+ if (fdsp->fdct == ff_jpeg_fdct_islow_8 ||
+ fdsp->fdct == ff_jpeg_fdct_islow_10 ||
+ fdsp->fdct == ff_faandct) {
for (i = 0; i < 64; i++) {
const int j = s->idsp.idct_permutation[i];
/* 16 <= qscale * quant_matrix[i] <= 7905
@@ -95,7 +95,7 @@ void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64],
qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) /
(qscale * quant_matrix[j]));
}
- } else if (dsp->fdct == ff_fdct_ifast) {
+ } else if (fdsp->fdct == ff_fdct_ifast) {
for (i = 0; i < 64; i++) {
const int j = s->idsp.idct_permutation[i];
/* 16 <= qscale * quant_matrix[i] <= 7905
@@ -134,7 +134,7 @@ void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64],
for (i = intra; i < 64; i++) {
int64_t max = 8191;
- if (dsp->fdct == ff_fdct_ifast) {
+ if (fdsp->fdct == ff_fdct_ifast) {
max = (8191LL * ff_aanscales[i]) >> 14;
}
while (((max * qmat[qscale][i]) >> shift) > INT_MAX) {
@@ -689,6 +689,7 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
if (ARCH_X86)
ff_MPV_encode_init_x86(s);
+ ff_fdctdsp_init(&s->fdsp, avctx);
ff_mpegvideoencdsp_init(&s->mvedsp, avctx);
ff_qpeldsp_init(&s->qdsp);
@@ -3463,7 +3464,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s,
uint8_t * last_length;
const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
- s->dsp.fdct (block);
+ s->fdsp.fdct(block);
if(s->dct_error_sum)
s->denoise_dct(s, block);
@@ -3558,7 +3559,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s,
int dct_coeff= FFABS(block[ scantable[i] ]);
int best_score=256*256*256*120;
- if (s->dsp.fdct == ff_fdct_ifast)
+ if (s->fdsp.fdct == ff_fdct_ifast)
dct_coeff= (dct_coeff*ff_inv_aanscales[ scantable[i] ]) >> 12;
zero_distortion= dct_coeff*dct_coeff;
@@ -3890,7 +3891,7 @@ STOP_TIMER("init rem[]")
STOP_TIMER("rem*w*w")}
{START_TIMER
#endif
- s->dsp.fdct(d1);
+ s->fdsp.fdct(d1);
#ifdef REFINE_STATS
STOP_TIMER("dct")}
#endif
@@ -4137,7 +4138,7 @@ int ff_dct_quantize_c(MpegEncContext *s,
int max=0;
unsigned int threshold1, threshold2;
- s->dsp.fdct (block);
+ s->fdsp.fdct(block);
if(s->dct_error_sum)
s->denoise_dct(s, block);
diff --git a/libavcodec/ppc/Makefile b/libavcodec/ppc/Makefile
index 607a334..b16516c 100644
--- a/libavcodec/ppc/Makefile
+++ b/libavcodec/ppc/Makefile
@@ -8,6 +8,7 @@ OBJS-$(CONFIG_H264DSP) += ppc/h264dsp.o
OBJS-$(CONFIG_H264QPEL) += ppc/h264qpel.o
OBJS-$(CONFIG_HPELDSP) += ppc/hpeldsp_altivec.o
OBJS-$(CONFIG_HUFFYUVDSP) += ppc/huffyuvdsp_altivec.o
+OBJS-$(CONFIG_FDCTDSP) += ppc/fdctdsp_altivec.o
OBJS-$(CONFIG_IDCTDSP) += ppc/idctdsp_altivec.o
OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodsp_altivec.o
OBJS-$(CONFIG_MPEGVIDEO) += ppc/mpegvideo_altivec.o \
@@ -24,8 +25,6 @@ OBJS-$(CONFIG_VORBIS_DECODER) +=
ppc/vorbisdsp_altivec.o
OBJS-$(CONFIG_VP8_DECODER) += ppc/vp8dsp_altivec.o
ALTIVEC-OBJS-$(CONFIG_BLOCKDSP) += ppc/blockdsp_altivec.o
-ALTIVEC-OBJS-$(CONFIG_DSPUTIL) += ppc/dsputil_altivec.o \
- ppc/fdct_altivec.o \
-
+ALTIVEC-OBJS-$(CONFIG_DSPUTIL) += ppc/dsputil_altivec.o
FFT-OBJS-$(HAVE_GNU_AS) += ppc/fft_altivec_s.o
ALTIVEC-OBJS-$(CONFIG_FFT) += $(FFT-OBJS-yes)
diff --git a/libavcodec/ppc/dsputil_altivec.h b/libavcodec/ppc/dsputil_altivec.h
index be5fd58..bbf9a9d 100644
--- a/libavcodec/ppc/dsputil_altivec.h
+++ b/libavcodec/ppc/dsputil_altivec.h
@@ -27,8 +27,6 @@
#include "libavcodec/dsputil.h"
-void ff_fdct_altivec(int16_t *block);
-
void ff_dsputil_init_altivec(DSPContext *c, AVCodecContext *avctx,
unsigned high_bit_depth);
diff --git a/libavcodec/ppc/dsputil_ppc.c b/libavcodec/ppc/dsputil_ppc.c
index 4d30def..890157f 100644
--- a/libavcodec/ppc/dsputil_ppc.c
+++ b/libavcodec/ppc/dsputil_ppc.c
@@ -33,13 +33,6 @@ av_cold void ff_dsputil_init_ppc(DSPContext *c,
AVCodecContext *avctx,
unsigned high_bit_depth)
{
if (PPC_ALTIVEC(av_get_cpu_flags())) {
- if (!high_bit_depth) {
-#if CONFIG_ENCODERS
- if (avctx->dct_algo == FF_DCT_AUTO ||
- avctx->dct_algo == FF_DCT_ALTIVEC) {
- c->fdct = ff_fdct_altivec;
- }
-#endif //CONFIG_ENCODERS
- }
+ ff_dsputil_init_altivec(c, avctx, high_bit_depth);
}
}
diff --git a/libavcodec/ppc/dsputil_altivec.h b/libavcodec/ppc/fdctdsp.h
similarity index 66%
copy from libavcodec/ppc/dsputil_altivec.h
copy to libavcodec/ppc/fdctdsp.h
index be5fd58..845b4fe 100644
--- a/libavcodec/ppc/dsputil_altivec.h
+++ b/libavcodec/ppc/fdctdsp.h
@@ -1,8 +1,4 @@
/*
- * Copyright (c) 2002 Brian Foley
- * Copyright (c) 2002 Dieter Shirley
- * Copyright (c) 2003-2004 Romain Dolbeau <[email protected]>
- *
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
@@ -20,16 +16,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef AVCODEC_PPC_DSPUTIL_ALTIVEC_H
-#define AVCODEC_PPC_DSPUTIL_ALTIVEC_H
+#ifndef AVCODEC_PPC_FDCTDSP_H
+#define AVCODEC_PPC_FDCTDSP_H
#include <stdint.h>
-#include "libavcodec/dsputil.h"
-
void ff_fdct_altivec(int16_t *block);
-void ff_dsputil_init_altivec(DSPContext *c, AVCodecContext *avctx,
- unsigned high_bit_depth);
-
-#endif /* AVCODEC_PPC_DSPUTIL_ALTIVEC_H */
+#endif /* AVCODEC_PPC_FDCTDSP_H */
diff --git a/libavcodec/ppc/fdct_altivec.c b/libavcodec/ppc/fdctdsp_altivec.c
similarity index 97%
rename from libavcodec/ppc/fdct_altivec.c
rename to libavcodec/ppc/fdctdsp_altivec.c
index 8914d9b..963bd67 100644
--- a/libavcodec/ppc/fdct_altivec.c
+++ b/libavcodec/ppc/fdctdsp_altivec.c
@@ -24,7 +24,11 @@
#endif
#include "libavutil/common.h"
-#include "dsputil_altivec.h"
+#include "libavutil/ppc/cpu.h"
+#include "libavcodec/fdctdsp.h"
+#include "fdctdsp.h"
+
+#if HAVE_ALTIVEC
#define vs16(v) ((vector signed short) (v))
#define vs32(v) ((vector signed int) (v))
@@ -454,3 +458,20 @@ void ff_fdct_altivec(int16_t *block)
#undef CTS
/* }}} */
}
+
+#endif /* HAVE_ALTIVEC */
+
+av_cold void ff_fdctdsp_init_ppc(FDCTDSPContext *c, AVCodecContext *avctx,
+ unsigned high_bit_depth)
+{
+#if HAVE_ALTIVEC
+ if (PPC_ALTIVEC(av_get_cpu_flags())) {
+ if (!high_bit_depth) {
+ if (avctx->dct_algo == FF_DCT_AUTO ||
+ avctx->dct_algo == FF_DCT_ALTIVEC) {
+ c->fdct = ff_fdct_altivec;
+ }
+ }
+ }
+#endif /* HAVE_ALTIVEC */
+}
diff --git a/libavcodec/proresenc.c b/libavcodec/proresenc.c
index 51e3783..bdb826c 100644
--- a/libavcodec/proresenc.c
+++ b/libavcodec/proresenc.c
@@ -23,8 +23,7 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
-#include "dct.h"
-#include "dsputil.h"
+#include "fdctdsp.h"
#include "put_bits.h"
#include "bytestream.h"
#include "internal.h"
@@ -192,9 +191,9 @@ typedef struct ProresContext {
const uint8_t *quant_mat;
const uint8_t *scantable;
- void (* fdct)(DSPContext *dsp, const uint16_t *src,
- int linesize, int16_t *block);
- DSPContext dsp;
+ void (*fdct)(FDCTDSPContext *fdsp, const uint16_t *src,
+ int linesize, int16_t *block);
+ FDCTDSPContext fdsp;
int mb_width, mb_height;
int mbs_per_slice;
@@ -263,27 +262,27 @@ static void get_slice_data(ProresContext *ctx, const
uint16_t *src,
mb_width * sizeof(*emu_buf));
}
if (!is_chroma) {
- ctx->fdct(&ctx->dsp, esrc, elinesize, blocks);
+ ctx->fdct(&ctx->fdsp, esrc, elinesize, blocks);
blocks += 64;
if (blocks_per_mb > 2) {
- ctx->fdct(&ctx->dsp, esrc + 8, elinesize, blocks);
+ ctx->fdct(&ctx->fdsp, esrc + 8, elinesize, blocks);
blocks += 64;
}
- ctx->fdct(&ctx->dsp, esrc + elinesize * 4, elinesize, blocks);
+ ctx->fdct(&ctx->fdsp, esrc + elinesize * 4, elinesize, blocks);
blocks += 64;
if (blocks_per_mb > 2) {
- ctx->fdct(&ctx->dsp, esrc + elinesize * 4 + 8, elinesize,
blocks);
+ ctx->fdct(&ctx->fdsp, esrc + elinesize * 4 + 8, elinesize,
blocks);
blocks += 64;
}
} else {
- ctx->fdct(&ctx->dsp, esrc, elinesize, blocks);
+ ctx->fdct(&ctx->fdsp, esrc, elinesize, blocks);
blocks += 64;
- ctx->fdct(&ctx->dsp, esrc + elinesize * 4, elinesize, blocks);
+ ctx->fdct(&ctx->fdsp, esrc + elinesize * 4, elinesize, blocks);
blocks += 64;
if (blocks_per_mb > 2) {
- ctx->fdct(&ctx->dsp, esrc + 8, elinesize, blocks);
+ ctx->fdct(&ctx->fdsp, esrc + 8, elinesize, blocks);
blocks += 64;
- ctx->fdct(&ctx->dsp, esrc + elinesize * 4 + 8, elinesize,
blocks);
+ ctx->fdct(&ctx->fdsp, esrc + elinesize * 4 + 8, elinesize,
blocks);
blocks += 64;
}
}
@@ -1068,7 +1067,7 @@ static av_cold int encode_close(AVCodecContext *avctx)
return 0;
}
-static void prores_fdct(DSPContext *dsp, const uint16_t *src,
+static void prores_fdct(FDCTDSPContext *fdsp, const uint16_t *src,
int linesize, int16_t *block)
{
int x, y;
@@ -1079,7 +1078,7 @@ static void prores_fdct(DSPContext *dsp, const uint16_t
*src,
block[y * 8 + x] = tsrc[x];
tsrc += linesize >> 1;
}
- dsp->fdct(block);
+ fdsp->fdct(block);
}
static av_cold int encode_init(AVCodecContext *avctx)
@@ -1098,7 +1097,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
ctx->fdct = prores_fdct;
ctx->scantable = interlaced ? ff_prores_interlaced_scan
: ff_prores_progressive_scan;
- ff_dsputil_init(&ctx->dsp, avctx);
+ ff_fdctdsp_init(&ctx->fdsp, avctx);
mps = ctx->mbs_per_slice;
if (mps & (mps - 1)) {
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index b6adb3a..09e101b 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -7,6 +7,7 @@ OBJS-$(CONFIG_DCT) += x86/dct_init.o
OBJS-$(CONFIG_DSPUTIL) += x86/dsputil_init.o
OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o \
x86/motion_est.o
+OBJS-$(CONFIG_FDCTDSP) += x86/fdctdsp_init.o
OBJS-$(CONFIG_FFT) += x86/fft_init.o
OBJS-$(CONFIG_H263DSP) += x86/h263dsp_init.o
OBJS-$(CONFIG_H264CHROMA) += x86/h264chroma_init.o
@@ -48,10 +49,10 @@ OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp_init.o
OBJS-$(CONFIG_VP9_DECODER) += x86/vp9dsp_init.o
MMX-OBJS-$(CONFIG_BLOCKDSP) += x86/blockdsp_mmx.o
-MMX-OBJS-$(CONFIG_ENCODERS) += x86/fdct.o
MMX-OBJS-$(CONFIG_HPELDSP) += x86/fpel_mmx.o \
x86/hpeldsp_mmx.o
MMX-OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp_mmx.o
+MMX-OBJS-$(CONFIG_FDCTDSP) += x86/fdct.o
MMX-OBJS-$(CONFIG_IDCTDSP) += x86/idctdsp_mmx.o \
x86/idct_mmx_xvid.o \
x86/idct_sse2_xvid.o \
diff --git a/libavcodec/x86/dsputilenc_mmx.c b/libavcodec/x86/dsputilenc_mmx.c
index 563543e..fb649e4 100644
--- a/libavcodec/x86/dsputilenc_mmx.c
+++ b/libavcodec/x86/dsputilenc_mmx.c
@@ -26,7 +26,6 @@
#include "libavutil/cpu.h"
#include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h"
-#include "libavcodec/dct.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/mpegvideo.h"
#include "dsputil_x86.h"
@@ -823,7 +822,6 @@ av_cold void ff_dsputilenc_init_mmx(DSPContext *c,
AVCodecContext *avctx,
unsigned high_bit_depth)
{
int cpu_flags = av_get_cpu_flags();
- const int dct_algo = avctx->dct_algo;
if (EXTERNAL_MMX(cpu_flags)) {
if (!high_bit_depth)
@@ -837,10 +835,6 @@ av_cold void ff_dsputilenc_init_mmx(DSPContext *c,
AVCodecContext *avctx,
#if HAVE_INLINE_ASM
if (INLINE_MMX(cpu_flags)) {
- if (!high_bit_depth &&
- (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX))
- c->fdct = ff_fdct_mmx;
-
c->sum_abs_dctelem = sum_abs_dctelem_mmx;
c->sse[0] = sse16_mmx;
@@ -855,10 +849,6 @@ av_cold void ff_dsputilenc_init_mmx(DSPContext *c,
AVCodecContext *avctx,
}
if (INLINE_MMXEXT(cpu_flags)) {
- if (!high_bit_depth &&
- (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX))
- c->fdct = ff_fdct_mmxext;
-
c->sum_abs_dctelem = sum_abs_dctelem_mmxext;
c->vsad[4] = vsad_intra16_mmxext;
@@ -868,10 +858,6 @@ av_cold void ff_dsputilenc_init_mmx(DSPContext *c,
AVCodecContext *avctx,
}
if (INLINE_SSE2(cpu_flags)) {
- if (!high_bit_depth &&
- (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX))
- c->fdct = ff_fdct_sse2;
-
c->sum_abs_dctelem = sum_abs_dctelem_sse2;
}
diff --git a/libavcodec/ppc/dsputil_ppc.c b/libavcodec/x86/fdctdsp_init.c
similarity index 60%
copy from libavcodec/ppc/dsputil_ppc.c
copy to libavcodec/x86/fdctdsp_init.c
index 4d30def..93fdd65 100644
--- a/libavcodec/ppc/dsputil_ppc.c
+++ b/libavcodec/x86/fdctdsp_init.c
@@ -1,8 +1,4 @@
/*
- * Copyright (c) 2002 Brian Foley
- * Copyright (c) 2002 Dieter Shirley
- * Copyright (c) 2003-2004 Romain Dolbeau <[email protected]>
- *
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
@@ -20,26 +16,29 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <string.h>
-
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
-#include "libavutil/ppc/cpu.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_altivec.h"
+#include "libavcodec/dct.h"
+#include "libavcodec/fdctdsp.h"
-av_cold void ff_dsputil_init_ppc(DSPContext *c, AVCodecContext *avctx,
+av_cold void ff_fdctdsp_init_x86(FDCTDSPContext *c, AVCodecContext *avctx,
unsigned high_bit_depth)
{
- if (PPC_ALTIVEC(av_get_cpu_flags())) {
- if (!high_bit_depth) {
-#if CONFIG_ENCODERS
- if (avctx->dct_algo == FF_DCT_AUTO ||
- avctx->dct_algo == FF_DCT_ALTIVEC) {
- c->fdct = ff_fdct_altivec;
- }
-#endif //CONFIG_ENCODERS
+ int cpu_flags = av_get_cpu_flags();
+ const int dct_algo = avctx->dct_algo;
+
+ if (!high_bit_depth) {
+ if ((dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX)) {
+ if (INLINE_MMX(cpu_flags))
+ c->fdct = ff_fdct_mmx;
+
+ if (INLINE_MMXEXT(cpu_flags))
+ c->fdct = ff_fdct_mmxext;
+
+ if (INLINE_SSE2(cpu_flags))
+ c->fdct = ff_fdct_sse2;
}
}
}
--
1.8.3.2
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel