00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef AVCODEC_SNOW_H
00023 #define AVCODEC_SNOW_H
00024
00025 #include "dsputil.h"
00026
00027 #define MID_STATE 128
00028
00029 #define MAX_DECOMPOSITIONS 8
00030 #define MAX_PLANES 4
00031 #define QSHIFT 5
00032 #define QROOT (1<<QSHIFT)
00033 #define LOSSLESS_QLOG -128
00034 #define FRAC_BITS 4
00035 #define MAX_REF_FRAMES 8
00036
00037 #define LOG2_OBMC_MAX 8
00038 #define OBMC_MAX (1<<(LOG2_OBMC_MAX))
00039
00040 #define DWT_97 0
00041 #define DWT_53 1
00042
00044 struct slice_buffer_s {
00045 IDWTELEM * * line;
00046 IDWTELEM * * data_stack;
00047 int data_stack_top;
00048 int line_count;
00049 int line_width;
00050 int data_count;
00051 IDWTELEM * base_buffer;
00052 };
00053
00054 #define liftS lift
00055 #if 1
00056 #define W_AM 3
00057 #define W_AO 0
00058 #define W_AS 1
00059
00060 #undef liftS
00061 #define W_BM 1
00062 #define W_BO 8
00063 #define W_BS 4
00064
00065 #define W_CM 1
00066 #define W_CO 0
00067 #define W_CS 0
00068
00069 #define W_DM 3
00070 #define W_DO 4
00071 #define W_DS 3
00072 #elif 0
00073 #define W_AM 55
00074 #define W_AO 16
00075 #define W_AS 5
00076
00077 #define W_BM 3
00078 #define W_BO 32
00079 #define W_BS 6
00080
00081 #define W_CM 127
00082 #define W_CO 64
00083 #define W_CS 7
00084
00085 #define W_DM 7
00086 #define W_DO 8
00087 #define W_DS 4
00088 #elif 0
00089 #define W_AM 97
00090 #define W_AO 32
00091 #define W_AS 6
00092
00093 #define W_BM 63
00094 #define W_BO 512
00095 #define W_BS 10
00096
00097 #define W_CM 13
00098 #define W_CO 8
00099 #define W_CS 4
00100
00101 #define W_DM 15
00102 #define W_DO 16
00103 #define W_DS 5
00104
00105 #else
00106
00107 #define W_AM 203
00108 #define W_AO 64
00109 #define W_AS 7
00110
00111 #define W_BM 217
00112 #define W_BO 2048
00113 #define W_BS 12
00114
00115 #define W_CM 113
00116 #define W_CO 64
00117 #define W_CS 7
00118
00119 #define W_DM 227
00120 #define W_DO 128
00121 #define W_DS 9
00122 #endif
00123
00124 void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width);
00125 void ff_snow_horizontal_compose97i(IDWTELEM *b, int width);
00126 void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8);
00127
00128 #if CONFIG_SNOW_ENCODER
00129 int w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
00130 int w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
00131 #else
00132 static int w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {assert (0); return 0;}
00133 static int w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {assert (0); return 0;}
00134 #endif
00135
00136
00137
00138 static av_always_inline void snow_interleave_line_header(int * i, int width, IDWTELEM * low, IDWTELEM * high){
00139 (*i) = (width) - 2;
00140
00141 if (width & 1){
00142 low[(*i)+1] = low[((*i)+1)>>1];
00143 (*i)--;
00144 }
00145 }
00146
00147 static av_always_inline void snow_interleave_line_footer(int * i, IDWTELEM * low, IDWTELEM * high){
00148 for (; (*i)>=0; (*i)-=2){
00149 low[(*i)+1] = high[(*i)>>1];
00150 low[*i] = low[(*i)>>1];
00151 }
00152 }
00153
00154 static av_always_inline void snow_horizontal_compose_lift_lead_out(int i, IDWTELEM * dst, IDWTELEM * src, IDWTELEM * ref, int width, int w, int lift_high, int mul, int add, int shift){
00155 for(; i<w; i++){
00156 dst[i] = src[i] - ((mul * (ref[i] + ref[i + 1]) + add) >> shift);
00157 }
00158
00159 if((width^lift_high)&1){
00160 dst[w] = src[w] - ((mul * 2 * ref[w] + add) >> shift);
00161 }
00162 }
00163
00164 static av_always_inline void snow_horizontal_compose_liftS_lead_out(int i, IDWTELEM * dst, IDWTELEM * src, IDWTELEM * ref, int width, int w){
00165 for(; i<w; i++){
00166 dst[i] = src[i] + ((ref[i] + ref[(i+1)]+W_BO + 4 * src[i]) >> W_BS);
00167 }
00168
00169 if(width&1){
00170 dst[w] = src[w] + ((2 * ref[w] + W_BO + 4 * src[w]) >> W_BS);
00171 }
00172 }
00173
00174 #endif