Also rename the enum values to be consistent with other DCT permutations. ---
There's a bit of cosmetic realignment mixed in here, I can easily drop it if preferred... libavcodec/arm/idctdsp_init_arm.c | 16 ++++++++-------- libavcodec/arm/idctdsp_init_armv5te.c | 8 ++++---- libavcodec/arm/idctdsp_init_armv6.c | 8 ++++---- libavcodec/arm/idctdsp_init_neon.c | 8 ++++---- libavcodec/bfin/idctdsp_init.c | 8 ++++---- libavcodec/cavsdsp.c | 2 +- libavcodec/eamad.c | 2 +- libavcodec/eatgq.c | 2 +- libavcodec/eatqi.c | 2 +- libavcodec/idctdsp.c | 24 ++++++++++++------------ libavcodec/idctdsp.h | 21 ++++++++++++--------- libavcodec/mpegvideo_enc.c | 2 +- libavcodec/ppc/idctdsp_altivec.c | 6 +++--- libavcodec/proresdsp.c | 2 +- libavcodec/wmv2.c | 2 +- libavcodec/wmv2dsp.c | 2 +- libavcodec/x86/cavsdsp.c | 2 +- libavcodec/x86/idctdsp_init.c | 12 ++++++------ libavcodec/x86/mpegvideoenc_template.c | 2 +- libavcodec/x86/proresdsp_init.c | 6 +++--- 20 files changed, 70 insertions(+), 67 deletions(-) diff --git a/libavcodec/arm/idctdsp_init_arm.c b/libavcodec/arm/idctdsp_init_arm.c index b4d1899..cf75383 100644 --- a/libavcodec/arm/idctdsp_init_arm.c +++ b/libavcodec/arm/idctdsp_init_arm.c @@ -75,15 +75,15 @@ av_cold void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx, if (!high_bit_depth) { if (avctx->idct_algo == FF_IDCT_AUTO || avctx->idct_algo == FF_IDCT_ARM) { - c->idct_put = j_rev_dct_arm_put; - c->idct_add = j_rev_dct_arm_add; - c->idct = ff_j_rev_dct_arm; - c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM; + c->idct_put = j_rev_dct_arm_put; + c->idct_add = j_rev_dct_arm_add; + c->idct = ff_j_rev_dct_arm; + c->perm_type = FF_IDCT_PERM_LIBMPEG2; } else if (avctx->idct_algo == FF_IDCT_SIMPLEARM) { - c->idct_put = simple_idct_arm_put; - c->idct_add = simple_idct_arm_add; - c->idct = ff_simple_idct_arm; - c->idct_permutation_type = FF_NO_IDCT_PERM; + c->idct_put = simple_idct_arm_put; + c->idct_add = simple_idct_arm_add; + c->idct = ff_simple_idct_arm; + c->perm_type = FF_IDCT_PERM_NONE; } } diff --git a/libavcodec/arm/idctdsp_init_armv5te.c b/libavcodec/arm/idctdsp_init_armv5te.c index e2492a5..1088563 100644 --- a/libavcodec/arm/idctdsp_init_armv5te.c +++ b/libavcodec/arm/idctdsp_init_armv5te.c @@ -35,9 +35,9 @@ av_cold void ff_idctdsp_init_armv5te(IDCTDSPContext *c, AVCodecContext *avctx, if (!high_bit_depth && (avctx->idct_algo == FF_IDCT_AUTO || avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) { - c->idct_put = ff_simple_idct_put_armv5te; - c->idct_add = ff_simple_idct_add_armv5te; - c->idct = ff_simple_idct_armv5te; - c->idct_permutation_type = FF_NO_IDCT_PERM; + c->idct_put = ff_simple_idct_put_armv5te; + c->idct_add = ff_simple_idct_add_armv5te; + c->idct = ff_simple_idct_armv5te; + c->perm_type = FF_IDCT_PERM_NONE; } } diff --git a/libavcodec/arm/idctdsp_init_armv6.c b/libavcodec/arm/idctdsp_init_armv6.c index 15d16ea..282128f 100644 --- a/libavcodec/arm/idctdsp_init_armv6.c +++ b/libavcodec/arm/idctdsp_init_armv6.c @@ -39,10 +39,10 @@ av_cold void ff_idctdsp_init_armv6(IDCTDSPContext *c, AVCodecContext *avctx, if (!high_bit_depth) { if (avctx->idct_algo == FF_IDCT_AUTO || avctx->idct_algo == FF_IDCT_SIMPLEARMV6) { - c->idct_put = ff_simple_idct_put_armv6; - c->idct_add = ff_simple_idct_add_armv6; - c->idct = ff_simple_idct_armv6; - c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM; + c->idct_put = ff_simple_idct_put_armv6; + c->idct_add = ff_simple_idct_add_armv6; + c->idct = ff_simple_idct_armv6; + c->perm_type = FF_IDCT_PERM_LIBMPEG2; } } c->add_pixels_clamped = ff_add_pixels_clamped_armv6; diff --git a/libavcodec/arm/idctdsp_init_neon.c b/libavcodec/arm/idctdsp_init_neon.c index 1790597..66783d8 100644 --- a/libavcodec/arm/idctdsp_init_neon.c +++ b/libavcodec/arm/idctdsp_init_neon.c @@ -40,10 +40,10 @@ av_cold void ff_idctdsp_init_neon(IDCTDSPContext *c, AVCodecContext *avctx, if (!high_bit_depth) { if (avctx->idct_algo == FF_IDCT_AUTO || avctx->idct_algo == FF_IDCT_SIMPLENEON) { - c->idct_put = ff_simple_idct_put_neon; - c->idct_add = ff_simple_idct_add_neon; - c->idct = ff_simple_idct_neon; - c->idct_permutation_type = FF_PARTTRANS_IDCT_PERM; + c->idct_put = ff_simple_idct_put_neon; + c->idct_add = ff_simple_idct_add_neon; + c->idct = ff_simple_idct_neon; + c->perm_type = FF_IDCT_PERM_PARTTRANS; } } diff --git a/libavcodec/bfin/idctdsp_init.c b/libavcodec/bfin/idctdsp_init.c index c348598..23feff3 100644 --- a/libavcodec/bfin/idctdsp_init.c +++ b/libavcodec/bfin/idctdsp_init.c @@ -56,10 +56,10 @@ av_cold void ff_idctdsp_init_bfin(IDCTDSPContext *c, AVCodecContext *avctx, if (!high_bit_depth) { if (avctx->idct_algo == FF_IDCT_AUTO) { - c->idct_permutation_type = FF_NO_IDCT_PERM; - c->idct = ff_bfin_idct; - c->idct_add = bfin_idct_add; - c->idct_put = bfin_idct_put; + c->perm_type = FF_IDCT_PERM_NONE; + c->idct = ff_bfin_idct; + c->idct_add = bfin_idct_add; + c->idct_put = bfin_idct_put; } } } diff --git a/libavcodec/cavsdsp.c b/libavcodec/cavsdsp.c index 958e3c5..b0f94de 100644 --- a/libavcodec/cavsdsp.c +++ b/libavcodec/cavsdsp.c @@ -561,7 +561,7 @@ av_cold void ff_cavsdsp_init(CAVSDSPContext* c, AVCodecContext *avctx) { c->cavs_filter_cv = cavs_filter_cv_c; c->cavs_filter_ch = cavs_filter_ch_c; c->cavs_idct8_add = cavs_idct8_add_c; - c->idct_perm = FF_NO_IDCT_PERM; + c->idct_perm = FF_IDCT_PERM_NONE; if (ARCH_X86) ff_cavsdsp_init_x86(c, avctx); diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c index 9edf344..19a6783 100644 --- a/libavcodec/eamad.c +++ b/libavcodec/eamad.c @@ -68,7 +68,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ff_blockdsp_init(&s->bdsp, avctx); ff_bswapdsp_init(&s->bbdsp); ff_idctdsp_init(&s->idsp, avctx); - ff_init_scantable_permutation(s->idsp.idct_permutation, FF_NO_IDCT_PERM); + ff_init_scantable_permutation(s->idsp.idct_permutation, FF_IDCT_PERM_NONE); ff_init_scantable(s->idsp.idct_permutation, &s->scantable, ff_zigzag_direct); ff_mpeg12_init_vlcs(); diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c index d8320c9..0e4ba2f 100644 --- a/libavcodec/eatgq.c +++ b/libavcodec/eatgq.c @@ -51,7 +51,7 @@ static av_cold int tgq_decode_init(AVCodecContext *avctx) TgqContext *s = avctx->priv_data; uint8_t idct_permutation[64]; s->avctx = avctx; - ff_init_scantable_permutation(idct_permutation, FF_NO_IDCT_PERM); + ff_init_scantable_permutation(idct_permutation, FF_IDCT_PERM_NONE); ff_init_scantable(idct_permutation, &s->scantable, ff_zigzag_direct); avctx->time_base = (AVRational){1, 15}; avctx->pix_fmt = AV_PIX_FMT_YUV420P; diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c index 93c03af..9b2e468 100644 --- a/libavcodec/eatqi.c +++ b/libavcodec/eatqi.c @@ -52,7 +52,7 @@ static av_cold int tqi_decode_init(AVCodecContext *avctx) ff_blockdsp_init(&s->bdsp, avctx); ff_bswapdsp_init(&t->bsdsp); ff_idctdsp_init(&s->idsp, avctx); - ff_init_scantable_permutation(s->idsp.idct_permutation, FF_NO_IDCT_PERM); + ff_init_scantable_permutation(s->idsp.idct_permutation, FF_IDCT_PERM_NONE); ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct); s->qscale = 1; avctx->time_base = (AVRational){1, 15}; diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c index a6c358d..839282c 100644 --- a/libavcodec/idctdsp.c +++ b/libavcodec/idctdsp.c @@ -47,29 +47,29 @@ av_cold void ff_init_scantable(uint8_t *permutation, ScanTable *st, } av_cold void ff_init_scantable_permutation(uint8_t *idct_permutation, - int idct_permutation_type) + enum idct_permutation_type perm_type) { int i; if (ARCH_X86) if (ff_init_scantable_permutation_x86(idct_permutation, - idct_permutation_type)) + perm_type)) return; - switch (idct_permutation_type) { - case FF_NO_IDCT_PERM: + switch (perm_type) { + case FF_IDCT_PERM_NONE: for (i = 0; i < 64; i++) idct_permutation[i] = i; break; - case FF_LIBMPEG2_IDCT_PERM: + case FF_IDCT_PERM_LIBMPEG2: for (i = 0; i < 64; i++) idct_permutation[i] = (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2); break; - case FF_TRANSPOSE_IDCT_PERM: + case FF_IDCT_PERM_TRANSPOSE: for (i = 0; i < 64; i++) idct_permutation[i] = ((i & 7) << 3) | (i >> 3); break; - case FF_PARTTRANS_IDCT_PERM: + case FF_IDCT_PERM_PARTTRANS: for (i = 0; i < 64; i++) idct_permutation[i] = (i & 0x24) | ((i & 3) << 3) | ((i >> 3) & 3); break; @@ -161,23 +161,23 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx) c->idct_put = ff_simple_idct_put_10; c->idct_add = ff_simple_idct_add_10; c->idct = ff_simple_idct_10; - c->idct_permutation_type = FF_NO_IDCT_PERM; + c->perm_type = FF_IDCT_PERM_NONE; } else { if (avctx->idct_algo == FF_IDCT_INT) { c->idct_put = jref_idct_put; c->idct_add = jref_idct_add; c->idct = ff_j_rev_dct; - c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM; + c->perm_type = FF_IDCT_PERM_LIBMPEG2; } else if (avctx->idct_algo == FF_IDCT_FAAN) { c->idct_put = ff_faanidct_put; c->idct_add = ff_faanidct_add; c->idct = ff_faanidct; - c->idct_permutation_type = FF_NO_IDCT_PERM; + c->perm_type = FF_IDCT_PERM_NONE; } else { // accurate/default c->idct_put = ff_simple_idct_put_8; c->idct_add = ff_simple_idct_add_8; c->idct = ff_simple_idct_8; - c->idct_permutation_type = FF_NO_IDCT_PERM; + c->perm_type = FF_IDCT_PERM_NONE; } } @@ -195,5 +195,5 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx) ff_idctdsp_init_x86(c, avctx, high_bit_depth); ff_init_scantable_permutation(c->idct_permutation, - c->idct_permutation_type); + c->perm_type); } diff --git a/libavcodec/idctdsp.h b/libavcodec/idctdsp.h index 40eb8b7..4059727 100644 --- a/libavcodec/idctdsp.h +++ b/libavcodec/idctdsp.h @@ -32,12 +32,21 @@ typedef struct ScanTable { uint8_t raster_end[64]; } ScanTable; +enum idct_permutation_type { + FF_IDCT_PERM_NONE, + FF_IDCT_PERM_LIBMPEG2, + FF_IDCT_PERM_SIMPLE, + FF_IDCT_PERM_TRANSPOSE, + FF_IDCT_PERM_PARTTRANS, + FF_IDCT_PERM_SSE2, +}; + void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable); void ff_init_scantable_permutation(uint8_t *idct_permutation, - int idct_permutation_type); + enum idct_permutation_type perm_type); int ff_init_scantable_permutation_x86(uint8_t *idct_permutation, - int idct_permutation_type); + enum idct_permutation_type perm_type); typedef struct IDCTDSPContext { /* pixel ops : interface with DCT */ @@ -83,13 +92,7 @@ typedef struct IDCTDSPContext { * -> simple_idct_mmx -> ...) */ uint8_t idct_permutation[64]; - int idct_permutation_type; -#define FF_NO_IDCT_PERM 1 -#define FF_LIBMPEG2_IDCT_PERM 2 -#define FF_SIMPLE_IDCT_PERM 3 -#define FF_TRANSPOSE_IDCT_PERM 4 -#define FF_PARTTRANS_IDCT_PERM 5 -#define FF_SSE2_IDCT_PERM 6 + enum idct_permutation_type perm_type; } IDCTDSPContext; void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx); diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index ebec01c..36deb45 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -4194,7 +4194,7 @@ int ff_dct_quantize_c(MpegEncContext *s, *overflow= s->max_qcoeff < max; //overflow might have happened /* we need this permutation so that we correct the IDCT, we only permute the !=0 elements */ - if (s->idsp.idct_permutation_type != FF_NO_IDCT_PERM) + if (s->idsp.perm_type != FF_IDCT_PERM_NONE) ff_block_permute(block, s->idsp.idct_permutation, scantable, last_non_zero); diff --git a/libavcodec/ppc/idctdsp_altivec.c b/libavcodec/ppc/idctdsp_altivec.c index 8a1d290..e1dde82 100644 --- a/libavcodec/ppc/idctdsp_altivec.c +++ b/libavcodec/ppc/idctdsp_altivec.c @@ -235,9 +235,9 @@ av_cold void ff_idctdsp_init_ppc(IDCTDSPContext *c, AVCodecContext *avctx, if (!high_bit_depth) { if ((avctx->idct_algo == FF_IDCT_AUTO) || (avctx->idct_algo == FF_IDCT_ALTIVEC)) { - c->idct_add = idct_add_altivec; - c->idct_put = idct_put_altivec; - c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; + c->idct_add = idct_add_altivec; + c->idct_put = idct_put_altivec; + c->perm_type = FF_IDCT_PERM_TRANSPOSE; } } } diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c index 1d92d36..3af2f0b 100644 --- a/libavcodec/proresdsp.c +++ b/libavcodec/proresdsp.c @@ -58,7 +58,7 @@ static void prores_idct_put_c(uint16_t *out, int linesize, int16_t *block, const av_cold void ff_proresdsp_init(ProresDSPContext *dsp) { dsp->idct_put = prores_idct_put_c; - dsp->idct_permutation_type = FF_NO_IDCT_PERM; + dsp->idct_permutation_type = FF_IDCT_PERM_NONE; if (ARCH_X86) ff_proresdsp_init_x86(dsp); diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c index b6c7bc0..7b1ea57 100644 --- a/libavcodec/wmv2.c +++ b/libavcodec/wmv2.c @@ -31,7 +31,7 @@ av_cold void ff_wmv2_common_init(Wmv2Context * w){ ff_blockdsp_init(&s->bdsp, s->avctx); ff_wmv2dsp_init(&w->wdsp); - s->idsp.idct_permutation_type = w->wdsp.idct_perm; + s->idsp.perm_type = w->wdsp.idct_perm; ff_init_scantable_permutation(s->idsp.idct_permutation, w->wdsp.idct_perm); ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[0], diff --git a/libavcodec/wmv2dsp.c b/libavcodec/wmv2dsp.c index 49df436..8af71f4 100644 --- a/libavcodec/wmv2dsp.c +++ b/libavcodec/wmv2dsp.c @@ -252,7 +252,7 @@ av_cold void ff_wmv2dsp_init(WMV2DSPContext *c) { c->idct_add = wmv2_idct_add_c; c->idct_put = wmv2_idct_put_c; - c->idct_perm = FF_NO_IDCT_PERM; + c->idct_perm = FF_IDCT_PERM_NONE; c->put_mspel_pixels_tab[0] = ff_put_pixels8x8_c; c->put_mspel_pixels_tab[1] = put_mspel8_mc10_c; diff --git a/libavcodec/x86/cavsdsp.c b/libavcodec/x86/cavsdsp.c index f0e8cfc..b85912b 100644 --- a/libavcodec/x86/cavsdsp.c +++ b/libavcodec/x86/cavsdsp.c @@ -493,7 +493,7 @@ static av_cold void cavsdsp_init_mmx(CAVSDSPContext *c, c->avg_cavs_qpel_pixels_tab[1][0] = avg_cavs_qpel8_mc00_mmx; c->cavs_idct8_add = cavs_idct8_add_mmx; - c->idct_perm = FF_TRANSPOSE_IDCT_PERM; + c->idct_perm = FF_IDCT_PERM_TRANSPOSE; } #endif /* HAVE_MMX_INLINE */ diff --git a/libavcodec/x86/idctdsp_init.c b/libavcodec/x86/idctdsp_init.c index 21bf2c3..5d34da2 100644 --- a/libavcodec/x86/idctdsp_init.c +++ b/libavcodec/x86/idctdsp_init.c @@ -28,16 +28,16 @@ #include "idctdsp.h" av_cold int ff_init_scantable_permutation_x86(uint8_t *idct_permutation, - int idct_permutation_type) + enum idct_permutation_type perm_type) { int i; - switch (idct_permutation_type) { - case FF_SIMPLE_IDCT_PERM: + switch (perm_type) { + case FF_IDCT_PERM_SIMPLE: for (i = 0; i < 64; i++) idct_permutation[i] = simple_mmx_permutation[i]; return 1; - case FF_SSE2_IDCT_PERM: + case FF_IDCT_PERM_SSE2: for (i = 0; i < 64; i++) idct_permutation[i] = (i & 0x38) | idct_sse2_row_perm[i & 7]; return 1; @@ -63,7 +63,7 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx, c->idct_put = ff_simple_idct_put_mmx; c->idct_add = ff_simple_idct_add_mmx; c->idct = ff_simple_idct_mmx; - c->idct_permutation_type = FF_SIMPLE_IDCT_PERM; + c->perm_type = FF_IDCT_PERM_SIMPLE; break; case FF_IDCT_XVIDMMX: c->idct_put = ff_idct_xvid_mmx_put; @@ -87,7 +87,7 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx, c->idct_put = ff_idct_xvid_sse2_put; c->idct_add = ff_idct_xvid_sse2_add; c->idct = ff_idct_xvid_sse2; - c->idct_permutation_type = FF_SSE2_IDCT_PERM; + c->perm_type = FF_IDCT_PERM_SSE2; } } } diff --git a/libavcodec/x86/mpegvideoenc_template.c b/libavcodec/x86/mpegvideoenc_template.c index 2269d28..487da00 100644 --- a/libavcodec/x86/mpegvideoenc_template.c +++ b/libavcodec/x86/mpegvideoenc_template.c @@ -229,7 +229,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s, if(s->mb_intra) block[0]= level; else block[0]= temp_block[0]; - if (s->idsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM) { + if (s->idsp.perm_type == FF_IDCT_PERM_SIMPLE) { if(last_non_zero_p1 <= 1) goto end; block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08]; block[0x20] = temp_block[0x10]; diff --git a/libavcodec/x86/proresdsp_init.c b/libavcodec/x86/proresdsp_init.c index a66fc70..e82dac0 100644 --- a/libavcodec/x86/proresdsp_init.c +++ b/libavcodec/x86/proresdsp_init.c @@ -38,17 +38,17 @@ av_cold void ff_proresdsp_init_x86(ProresDSPContext *dsp) int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_SSE2(cpu_flags)) { - dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; + dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE; dsp->idct_put = ff_prores_idct_put_10_sse2; } if (EXTERNAL_SSE4(cpu_flags)) { - dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; + dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE; dsp->idct_put = ff_prores_idct_put_10_sse4; } if (EXTERNAL_AVX(cpu_flags)) { - dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; + dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE; dsp->idct_put = ff_prores_idct_put_10_avx; } #endif /* ARCH_X86_64 */ -- 1.8.3.2 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel