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
00032 #if CONFIG_PRORES_DECODER | CONFIG_PRORES_LGPL_DECODER
00033
00036 static void put_pixels(uint16_t *dst, int stride, const DCTELEM *in)
00037 {
00038 int x, y, src_offset, dst_offset;
00039
00040 for (y = 0, dst_offset = 0; y < 8; y++, dst_offset += stride) {
00041 for (x = 0; x < 8; x++) {
00042 src_offset = (y << 3) + x;
00043
00044 dst[dst_offset + x] = CLIP_AND_BIAS(in[src_offset]);
00045 }
00046 }
00047 }
00048
00049 static void prores_idct_put_c(uint16_t *out, int linesize, DCTELEM *block, const int16_t *qmat)
00050 {
00051 ff_prores_idct(block, qmat);
00052 put_pixels(out, linesize >> 1, block);
00053 }
00054 #endif
00055
00056 #if CONFIG_PRORES_KOSTYA_ENCODER
00057 static void prores_fdct_c(const uint16_t *src, int linesize, DCTELEM *block)
00058 {
00059 int x, y;
00060 const uint16_t *tsrc = src;
00061
00062 for (y = 0; y < 8; y++) {
00063 for (x = 0; x < 8; x++)
00064 block[y * 8 + x] = tsrc[x];
00065 tsrc += linesize >> 1;
00066 }
00067 ff_jpeg_fdct_islow_10(block);
00068 }
00069 #endif
00070
00071 void ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx)
00072 {
00073 #if CONFIG_PRORES_DECODER | CONFIG_PRORES_LGPL_DECODER
00074 dsp->idct_put = prores_idct_put_c;
00075 dsp->idct_permutation_type = FF_NO_IDCT_PERM;
00076
00077 if (HAVE_MMX) ff_proresdsp_x86_init(dsp, avctx);
00078
00079 ff_init_scantable_permutation(dsp->idct_permutation,
00080 dsp->idct_permutation_type);
00081 #endif
00082 #if CONFIG_PRORES_KOSTYA_ENCODER
00083 dsp->fdct = prores_fdct_c;
00084 dsp->dct_permutation_type = FF_NO_IDCT_PERM;
00085 ff_init_scantable_permutation(dsp->dct_permutation,
00086 dsp->dct_permutation_type);
00087 #endif
00088 }