00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00029 #include "dsputil.h"
00030
00031 #define H264_DCT_PART1(X) \
00032 a = block[0][X]+block[3][X]; \
00033 c = block[0][X]-block[3][X]; \
00034 b = block[1][X]+block[2][X]; \
00035 d = block[1][X]-block[2][X]; \
00036 pieces[0][X] = a+b; \
00037 pieces[2][X] = a-b; \
00038 pieces[1][X] = (c<<1)+d; \
00039 pieces[3][X] = c-(d<<1);
00040
00041 #define H264_DCT_PART2(X) \
00042 a = pieces[X][0]+pieces[X][3]; \
00043 c = pieces[X][0]-pieces[X][3]; \
00044 b = pieces[X][1]+pieces[X][2]; \
00045 d = pieces[X][1]-pieces[X][2]; \
00046 block[0][X] = a+b; \
00047 block[2][X] = a-b; \
00048 block[1][X] = (c<<1)+d; \
00049 block[3][X] = c-(d<<1);
00050
00059 static void h264_dct_c(DCTELEM block[4][4])
00060 {
00061 DCTELEM pieces[4][4];
00062 DCTELEM a, b, c, d;
00063
00064 H264_DCT_PART1(0);
00065 H264_DCT_PART1(1);
00066 H264_DCT_PART1(2);
00067 H264_DCT_PART1(3);
00068 H264_DCT_PART2(0);
00069 H264_DCT_PART2(1);
00070 H264_DCT_PART2(2);
00071 H264_DCT_PART2(3);
00072 }
00073
00074 void ff_h264dspenc_init(DSPContext* c, AVCodecContext *avctx)
00075 {
00076 c->h264_dct = h264_dct_c;
00077 }
00078