00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00027 #include "dsputil.h"
00028 #include "rv34dsp.h"
00029
00035 static av_always_inline void rv34_row_transform(int temp[16], DCTELEM *block)
00036 {
00037 int i;
00038
00039 for(i = 0; i < 4; i++){
00040 const int z0 = 13*(block[i+8*0] + block[i+8*2]);
00041 const int z1 = 13*(block[i+8*0] - block[i+8*2]);
00042 const int z2 = 7* block[i+8*1] - 17*block[i+8*3];
00043 const int z3 = 17* block[i+8*1] + 7*block[i+8*3];
00044
00045 temp[4*i+0] = z0 + z3;
00046 temp[4*i+1] = z1 + z2;
00047 temp[4*i+2] = z1 - z2;
00048 temp[4*i+3] = z0 - z3;
00049 }
00050 }
00051
00056 static void rv34_inv_transform_c(DCTELEM *block){
00057 int temp[16];
00058 int i;
00059
00060 rv34_row_transform(temp, block);
00061
00062 for(i = 0; i < 4; i++){
00063 const int z0 = 13*(temp[4*0+i] + temp[4*2+i]) + 0x200;
00064 const int z1 = 13*(temp[4*0+i] - temp[4*2+i]) + 0x200;
00065 const int z2 = 7* temp[4*1+i] - 17*temp[4*3+i];
00066 const int z3 = 17* temp[4*1+i] + 7*temp[4*3+i];
00067
00068 block[i*8+0] = (z0 + z3) >> 10;
00069 block[i*8+1] = (z1 + z2) >> 10;
00070 block[i*8+2] = (z1 - z2) >> 10;
00071 block[i*8+3] = (z0 - z3) >> 10;
00072 }
00073 }
00074
00081 static void rv34_inv_transform_noround_c(DCTELEM *block){
00082 int temp[16];
00083 int i;
00084
00085 rv34_row_transform(temp, block);
00086
00087 for(i = 0; i < 4; i++){
00088 const int z0 = 13*(temp[4*0+i] + temp[4*2+i]);
00089 const int z1 = 13*(temp[4*0+i] - temp[4*2+i]);
00090 const int z2 = 7* temp[4*1+i] - 17*temp[4*3+i];
00091 const int z3 = 17* temp[4*1+i] + 7*temp[4*3+i];
00092
00093 block[i*8+0] = ((z0 + z3) * 3) >> 11;
00094 block[i*8+1] = ((z1 + z2) * 3) >> 11;
00095 block[i*8+2] = ((z1 - z2) * 3) >> 11;
00096 block[i*8+3] = ((z0 - z3) * 3) >> 11;
00097 }
00098 }
00099
00101
00102
00103 av_cold void ff_rv34dsp_init(RV34DSPContext *c, DSPContext* dsp) {
00104 c->rv34_inv_transform_tab[0] = rv34_inv_transform_c;
00105 c->rv34_inv_transform_tab[1] = rv34_inv_transform_noround_c;
00106
00107 if (HAVE_NEON)
00108 ff_rv34dsp_init_neon(c, dsp);
00109 }