summaryrefslogtreecommitdiff
path: root/libavcodec/dsputil.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-12 05:33:52 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-12 05:40:57 +0200
commitb81f8880e010ccdef3604d9beb681d3c4c6a7bc0 (patch)
tree0a6534f8fd2d53e84f6b5716047e473b1598cd3d /libavcodec/dsputil.c
parentb75d89a4784e027cec99236d58e9bd4121ec4309 (diff)
parent5f3fb599536dd5bceb1d45cb73cd0b0ce3e5560c (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (23 commits) fix AC3ENC_OPT_MODE_ON/OFF h264: fix HRD parameters parsing prores: implement multithreading. prores: idct sse2/sse4 optimizations. swscale: use aligned move for storage into temporary buffer. prores: extract idct into its own dspcontext and merge with put_pixels. h264: fix invalid shifts in init_cavlc_level_tab() intfloat_readwrite: fix signed addition overflows mov: do not misreport empty stts mov: cosmetics, fix for and if spacing id3v2: fix NULL pointer dereference mov: read album_artist atom mov: fix disc/track numbers and totals doc: fix references to obsolete presets directories for avconv/ffmpeg flashsv: return more meaningful error value flashsv: fix typo in av_log() message smacker: validate channels and sample format. smacker: check buffer size before reading output size smacker: validate number of channels smacker: Separate audio flags from sample rates in smacker demuxer. ... Conflicts: cmdutils.h doc/ffmpeg.texi libavcodec/Makefile libavcodec/motion_est_template.c libavformat/id3v2.c libavformat/mov.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r--libavcodec/dsputil.c65
1 files changed, 37 insertions, 28 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index ebce93039f..c451c97155 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -144,6 +144,41 @@ void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_s
}
}
+void ff_init_scantable_permutation(uint8_t *idct_permutation,
+ int idct_permutation_type)
+{
+ int i;
+
+ switch(idct_permutation_type){
+ case FF_NO_IDCT_PERM:
+ for(i=0; i<64; i++)
+ idct_permutation[i]= i;
+ break;
+ case FF_LIBMPEG2_IDCT_PERM:
+ for(i=0; i<64; i++)
+ idct_permutation[i]= (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2);
+ break;
+ case FF_SIMPLE_IDCT_PERM:
+ for(i=0; i<64; i++)
+ idct_permutation[i]= simple_mmx_permutation[i];
+ break;
+ case FF_TRANSPOSE_IDCT_PERM:
+ for(i=0; i<64; i++)
+ idct_permutation[i]= ((i&7)<<3) | (i>>3);
+ break;
+ case FF_PARTTRANS_IDCT_PERM:
+ for(i=0; i<64; i++)
+ idct_permutation[i]= (i&0x24) | ((i&3)<<3) | ((i>>3)&3);
+ break;
+ case FF_SSE2_IDCT_PERM:
+ for(i=0; i<64; i++)
+ idct_permutation[i]= (i&0x38) | idct_sse2_row_perm[i&7];
+ break;
+ default:
+ av_log(NULL, AV_LOG_ERROR, "Internal error, IDCT permutation not set\n");
+ }
+}
+
static int pix_sum_c(uint8_t * pix, int line_size)
{
int s, i, j;
@@ -3107,32 +3142,6 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->avg_2tap_qpel_pixels_tab[0][i]= c->avg_h264_qpel_pixels_tab[0][i];
}
- switch(c->idct_permutation_type){
- case FF_NO_IDCT_PERM:
- for(i=0; i<64; i++)
- c->idct_permutation[i]= i;
- break;
- case FF_LIBMPEG2_IDCT_PERM:
- for(i=0; i<64; i++)
- c->idct_permutation[i]= (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2);
- break;
- case FF_SIMPLE_IDCT_PERM:
- for(i=0; i<64; i++)
- c->idct_permutation[i]= simple_mmx_permutation[i];
- break;
- case FF_TRANSPOSE_IDCT_PERM:
- for(i=0; i<64; i++)
- c->idct_permutation[i]= ((i&7)<<3) | (i>>3);
- break;
- case FF_PARTTRANS_IDCT_PERM:
- for(i=0; i<64; i++)
- c->idct_permutation[i]= (i&0x24) | ((i&3)<<3) | ((i>>3)&3);
- break;
- case FF_SSE2_IDCT_PERM:
- for(i=0; i<64; i++)
- c->idct_permutation[i]= (i&0x38) | idct_sse2_row_perm[i&7];
- break;
- default:
- av_log(avctx, AV_LOG_ERROR, "Internal error, IDCT permutation not set\n");
- }
+ ff_init_scantable_permutation(c->idct_permutation,
+ c->idct_permutation_type);
}