00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "proresdsp.h"
00024 #include "simple_idct.h"
00025
00026 #define BIAS (1 << (PRORES_BITS_PER_SAMPLE - 1))
00027 #define CLIP_MIN (1 << (PRORES_BITS_PER_SAMPLE - 8))
00028 #define CLIP_MAX (1 << PRORES_BITS_PER_SAMPLE) - CLIP_MIN - 1
00029
00030 #define CLIP_AND_BIAS(x) (av_clip((x) + BIAS, CLIP_MIN, CLIP_MAX))
00031
00035 static void put_pixels(uint16_t *dst, int stride, const DCTELEM *in)
00036 {
00037 int x, y, src_offset, dst_offset;
00038
00039 for (y = 0, dst_offset = 0; y < 8; y++, dst_offset += stride) {
00040 for (x = 0; x < 8; x++) {
00041 src_offset = (y << 3) + x;
00042
00043 dst[dst_offset + x] = CLIP_AND_BIAS(in[src_offset]);
00044 }
00045 }
00046 }
00047
00048 static void prores_idct_put_c(uint16_t *out, int linesize, DCTELEM *block, const int16_t *qmat)
00049 {
00050 ff_prores_idct(block, qmat);
00051 put_pixels(out, linesize >> 1, block);
00052 }
00053
00054 void ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx)
00055 {
00056 dsp->idct_put = prores_idct_put_c;
00057 dsp->idct_permutation_type = FF_NO_IDCT_PERM;
00058
00059 if (HAVE_MMX) ff_proresdsp_x86_init(dsp, avctx);
00060
00061 ff_init_scantable_permutation(dsp->idct_permutation,
00062 dsp->idct_permutation_type);
00063 }