diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-07-18 21:55:55 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-07-18 22:01:17 +0200 |
commit | 42d326353c17085a98f0e81844f0c6320d70e8f3 (patch) | |
tree | b3ca4f4affde4d81b6e6f826828fdbaecb9d2a17 | |
parent | f6ed5df9c00c3fda2571ccc75e3055c215e4fc1a (diff) | |
parent | b4987f72197e0c62cf2633bf835a9c32d2a445ae (diff) | |
download | ffmpeg-42d326353c17085a98f0e81844f0c6320d70e8f3.tar.gz |
Merge commit 'b4987f72197e0c62cf2633bf835a9c32d2a445ae'
* commit 'b4987f72197e0c62cf2633bf835a9c32d2a445ae':
idct: Convert IDCT permutation #defines to an enum
Conflicts:
libavcodec/idctdsp.c
libavcodec/x86/cavsdsp.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/arm/idctdsp_init_arm.c | 4 | ||||
-rw-r--r-- | libavcodec/arm/idctdsp_init_armv5te.c | 2 | ||||
-rw-r--r-- | libavcodec/arm/idctdsp_init_armv6.c | 2 | ||||
-rw-r--r-- | libavcodec/arm/idctdsp_init_neon.c | 2 | ||||
-rw-r--r-- | libavcodec/cavsdsp.c | 2 | ||||
-rw-r--r-- | libavcodec/eamad.c | 2 | ||||
-rw-r--r-- | libavcodec/eatgq.c | 2 | ||||
-rw-r--r-- | libavcodec/eatqi.c | 2 | ||||
-rw-r--r-- | libavcodec/idctdsp.c | 32 | ||||
-rw-r--r-- | libavcodec/idctdsp.h | 21 | ||||
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 2 | ||||
-rw-r--r-- | libavcodec/ppc/idctdsp.c | 2 | ||||
-rw-r--r-- | libavcodec/proresdsp.c | 2 | ||||
-rw-r--r-- | libavcodec/wmv2.c | 2 | ||||
-rw-r--r-- | libavcodec/wmv2dsp.c | 2 | ||||
-rw-r--r-- | libavcodec/x86/cavsdsp.c | 2 | ||||
-rw-r--r-- | libavcodec/x86/idctdsp_init.c | 12 | ||||
-rw-r--r-- | libavcodec/x86/mpegvideoenc_template.c | 4 | ||||
-rw-r--r-- | libavcodec/x86/proresdsp_init.c | 6 |
19 files changed, 54 insertions, 51 deletions
diff --git a/libavcodec/arm/idctdsp_init_arm.c b/libavcodec/arm/idctdsp_init_arm.c index cc5e116766..0eebe2a8bc 100644 --- a/libavcodec/arm/idctdsp_init_arm.c +++ b/libavcodec/arm/idctdsp_init_arm.c @@ -78,12 +78,12 @@ av_cold void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx, 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->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->perm_type = FF_IDCT_PERM_NONE; } } diff --git a/libavcodec/arm/idctdsp_init_armv5te.c b/libavcodec/arm/idctdsp_init_armv5te.c index 9ca36879d7..c2d94e6c07 100644 --- a/libavcodec/arm/idctdsp_init_armv5te.c +++ b/libavcodec/arm/idctdsp_init_armv5te.c @@ -39,6 +39,6 @@ av_cold void ff_idctdsp_init_armv5te(IDCTDSPContext *c, AVCodecContext *avctx, 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->perm_type = FF_IDCT_PERM_NONE; } } diff --git a/libavcodec/arm/idctdsp_init_armv6.c b/libavcodec/arm/idctdsp_init_armv6.c index 27ca6cedb7..dab7ff0ca1 100644 --- a/libavcodec/arm/idctdsp_init_armv6.c +++ b/libavcodec/arm/idctdsp_init_armv6.c @@ -41,7 +41,7 @@ av_cold void ff_idctdsp_init_armv6(IDCTDSPContext *c, AVCodecContext *avctx, 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->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 d8684e7012..7cd7ae8dcd 100644 --- a/libavcodec/arm/idctdsp_init_neon.c +++ b/libavcodec/arm/idctdsp_init_neon.c @@ -44,7 +44,7 @@ av_cold void ff_idctdsp_init_neon(IDCTDSPContext *c, AVCodecContext *avctx, 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->perm_type = FF_IDCT_PERM_PARTTRANS; } } diff --git a/libavcodec/cavsdsp.c b/libavcodec/cavsdsp.c index 6ca11b9564..41d54b26e5 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 f4944ee83a..6457e2a134 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 100abe92ab..34cb6428b0 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 f22a75320d..864291a95c 100644 --- a/libavcodec/eatqi.c +++ b/libavcodec/eatqi.c @@ -53,7 +53,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 31a4854ccb..feefc34983 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; @@ -253,44 +253,44 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx) c->idct_put = ff_jref_idct4_put; c->idct_add = ff_jref_idct4_add; c->idct = ff_j_rev_dct4; - c->idct_permutation_type = FF_NO_IDCT_PERM; + c->perm_type = FF_IDCT_PERM_NONE; } else if (avctx->lowres==2) { c->idct_put = ff_jref_idct2_put; c->idct_add = ff_jref_idct2_add; c->idct = ff_j_rev_dct2; - c->idct_permutation_type = FF_NO_IDCT_PERM; + c->perm_type = FF_IDCT_PERM_NONE; } else if (avctx->lowres==3) { c->idct_put = ff_jref_idct1_put; c->idct_add = ff_jref_idct1_add; c->idct = ff_j_rev_dct1; - c->idct_permutation_type = FF_NO_IDCT_PERM; + c->perm_type = FF_IDCT_PERM_NONE; } else { if (avctx->bits_per_raw_sample == 10) { 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->bits_per_raw_sample == 12) { c->idct_put = ff_simple_idct_put_12; c->idct_add = ff_simple_idct_add_12; c->idct = ff_simple_idct_12; - 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; } } } @@ -309,5 +309,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 b1fa6e29cb..04510b16bb 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 cf873b1c4c..7fa568792d 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -4463,7 +4463,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.c b/libavcodec/ppc/idctdsp.c index a09c2b7b9d..2d36da1ab8 100644 --- a/libavcodec/ppc/idctdsp.c +++ b/libavcodec/ppc/idctdsp.c @@ -254,7 +254,7 @@ av_cold void ff_idctdsp_init_ppc(IDCTDSPContext *c, AVCodecContext *avctx, c->idct = idct_altivec; c->idct_add = idct_add_altivec; c->idct_put = idct_put_altivec; - c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; + c->perm_type = FF_IDCT_PERM_TRANSPOSE; } } } diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c index e628554933..82d6009b58 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, AVCodecContext *avctx) { 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, avctx); diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c index d53ba91dbc..0fe56033b5 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 511cc548ee..70a22c66a8 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 b80623f233..a57fd0d666 100644 --- a/libavcodec/x86/cavsdsp.c +++ b/libavcodec/x86/cavsdsp.c @@ -524,7 +524,7 @@ static av_cold void cavsdsp_init_mmx(CAVSDSPContext *c, #if HAVE_MMX_INLINE 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 b2332b2d4e..0a9432e59e 100644 --- a/libavcodec/x86/idctdsp_init.c +++ b/libavcodec/x86/idctdsp_init.c @@ -41,16 +41,16 @@ static const uint8_t simple_mmx_permutation[64] = { static const uint8_t idct_sse2_row_perm[8] = { 0, 4, 1, 5, 2, 6, 3, 7 }; 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; @@ -76,7 +76,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; @@ -103,7 +103,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; } } if (EXTERNAL_SSE2(cpu_flags)) { diff --git a/libavcodec/x86/mpegvideoenc_template.c b/libavcodec/x86/mpegvideoenc_template.c index 386fbcdf7b..df0ee63827 100644 --- a/libavcodec/x86/mpegvideoenc_template.c +++ b/libavcodec/x86/mpegvideoenc_template.c @@ -232,7 +232,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]; @@ -276,7 +276,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s, block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36]; block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37]; block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; - }else if(s->idsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){ + }else if(s->idsp.perm_type == FF_IDCT_PERM_LIBMPEG2){ if(last_non_zero_p1 <= 1) goto end; block[0x04] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; diff --git a/libavcodec/x86/proresdsp_init.c b/libavcodec/x86/proresdsp_init.c index 6974ca494c..d647788e6b 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, AVCodecContext *avctx) 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 */ |