This allows getting rid of a hack for conflicting symbol/define names. Signed-off-by: Martin Storsjö <martin@martin.st>tags/n0.11
| @@ -99,7 +99,7 @@ static void init_qexp(void){ | |||||
| double v=128; | double v=128; | ||||
| for(i=0; i<QROOT; i++){ | for(i=0; i<QROOT; i++){ | ||||
| qexp[i]= lrintf(v); | |||||
| ff_qexp[i]= lrintf(v); | |||||
| v *= pow(2, 1.0 / QROOT); | v *= pow(2, 1.0 / QROOT); | ||||
| } | } | ||||
| } | } | ||||
| @@ -443,7 +443,7 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ | |||||
| for(i=0; i<MAX_REF_FRAMES; i++) | for(i=0; i<MAX_REF_FRAMES; i++) | ||||
| for(j=0; j<MAX_REF_FRAMES; j++) | for(j=0; j<MAX_REF_FRAMES; j++) | ||||
| scale_mv_ref[i][j] = 256*(i+1)/(j+1); | |||||
| ff_scale_mv_ref[i][j] = 256*(i+1)/(j+1); | |||||
| s->avctx->get_buffer(s->avctx, &s->mconly_picture); | s->avctx->get_buffer(s->avctx, &s->mconly_picture); | ||||
| s->scratchbuf = av_malloc(s->mconly_picture.linesize[0]*7*MB_SIZE); | s->scratchbuf = av_malloc(s->mconly_picture.linesize[0]*7*MB_SIZE); | ||||
| @@ -165,13 +165,9 @@ typedef struct SnowContext{ | |||||
| }SnowContext; | }SnowContext; | ||||
| /* Tables */ | /* Tables */ | ||||
| extern const uint8_t * const obmc_tab[4]; | |||||
| #ifdef __sgi | |||||
| // Avoid a name clash on SGI IRIX | |||||
| #undef qexp | |||||
| #endif | |||||
| extern uint8_t qexp[QROOT]; | |||||
| extern int scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES]; | |||||
| extern const uint8_t * const ff_obmc_tab[4]; | |||||
| extern uint8_t ff_qexp[QROOT]; | |||||
| extern int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES]; | |||||
| /* C bits used by mmx/sse2/altivec */ | /* C bits used by mmx/sse2/altivec */ | ||||
| @@ -256,7 +252,7 @@ static inline void pred_mv(SnowContext *s, int *mx, int *my, int ref, | |||||
| *mx = mid_pred(left->mx, top->mx, tr->mx); | *mx = mid_pred(left->mx, top->mx, tr->mx); | ||||
| *my = mid_pred(left->my, top->my, tr->my); | *my = mid_pred(left->my, top->my, tr->my); | ||||
| }else{ | }else{ | ||||
| const int *scale = scale_mv_ref[ref]; | |||||
| const int *scale = ff_scale_mv_ref[ref]; | |||||
| *mx = mid_pred((left->mx * scale[left->ref] + 128) >>8, | *mx = mid_pred((left->mx * scale[left->ref] + 128) >>8, | ||||
| (top ->mx * scale[top ->ref] + 128) >>8, | (top ->mx * scale[top ->ref] + 128) >>8, | ||||
| (tr ->mx * scale[tr ->ref] + 128) >>8); | (tr ->mx * scale[tr ->ref] + 128) >>8); | ||||
| @@ -405,7 +401,7 @@ static av_always_inline void predict_slice(SnowContext *s, IDWTELEM *buf, int pl | |||||
| int x, y, mb_x; | int x, y, mb_x; | ||||
| int block_size = MB_SIZE >> s->block_max_depth; | int block_size = MB_SIZE >> s->block_max_depth; | ||||
| int block_w = plane_index ? block_size/2 : block_size; | int block_w = plane_index ? block_size/2 : block_size; | ||||
| const uint8_t *obmc = plane_index ? obmc_tab[s->block_max_depth+1] : obmc_tab[s->block_max_depth]; | |||||
| const uint8_t *obmc = plane_index ? ff_obmc_tab[s->block_max_depth+1] : ff_obmc_tab[s->block_max_depth]; | |||||
| const int obmc_stride= plane_index ? block_size : 2*block_size; | const int obmc_stride= plane_index ? block_size : 2*block_size; | ||||
| int ref_stride= s->current_picture.linesize[plane_index]; | int ref_stride= s->current_picture.linesize[plane_index]; | ||||
| uint8_t *dst8= s->current_picture.data[plane_index]; | uint8_t *dst8= s->current_picture.data[plane_index]; | ||||
| @@ -496,7 +492,7 @@ static inline void init_ref(MotionEstContext *c, uint8_t *src[3], uint8_t *ref[3 | |||||
| /* bitstream functions */ | /* bitstream functions */ | ||||
| extern const int8_t quant3bA[256]; | |||||
| extern const int8_t ff_quant3bA[256]; | |||||
| #define QEXPSHIFT (7-FRAC_BITS+8) //FIXME try to change this to 0 | #define QEXPSHIFT (7-FRAC_BITS+8) //FIXME try to change this to 0 | ||||
| @@ -642,7 +638,7 @@ static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, i | |||||
| v=get_rac(&s->c, &b->state[0][context]); | v=get_rac(&s->c, &b->state[0][context]); | ||||
| if(v){ | if(v){ | ||||
| v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1); | v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1); | ||||
| v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l&0xFF] + 3*quant3bA[t&0xFF]]); | |||||
| v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + ff_quant3bA[l&0xFF] + 3*ff_quant3bA[t&0xFF]]); | |||||
| xc->x=x; | xc->x=x; | ||||
| (xc++)->coeff= v; | (xc++)->coeff= v; | ||||
| @@ -101,7 +101,7 @@ static const uint8_t obmc4[16]={ | |||||
| //error:0.000000 | //error:0.000000 | ||||
| }; | }; | ||||
| const int8_t quant3bA[256]={ | |||||
| const int8_t ff_quant3bA[256]={ | |||||
| 0, 0, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, | 0, 0, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, | ||||
| 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, | 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, | ||||
| 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, | 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, | ||||
| @@ -120,13 +120,13 @@ const int8_t quant3bA[256]={ | |||||
| 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, | 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, | ||||
| }; | }; | ||||
| const uint8_t * const obmc_tab[4]= { | |||||
| const uint8_t * const ff_obmc_tab[4]= { | |||||
| obmc32, obmc16, obmc8, obmc4 | obmc32, obmc16, obmc8, obmc4 | ||||
| }; | }; | ||||
| /* runtime generated tables */ | /* runtime generated tables */ | ||||
| uint8_t qexp[QROOT]; | |||||
| int scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES]; | |||||
| uint8_t ff_qexp[QROOT]; | |||||
| int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES]; | |||||
| #endif /* AVCODEC_SNOW_H */ | #endif /* AVCODEC_SNOW_H */ | ||||
| @@ -42,7 +42,7 @@ static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer | |||||
| int x, y, mb_x; | int x, y, mb_x; | ||||
| int block_size = MB_SIZE >> s->block_max_depth; | int block_size = MB_SIZE >> s->block_max_depth; | ||||
| int block_w = plane_index ? block_size/2 : block_size; | int block_w = plane_index ? block_size/2 : block_size; | ||||
| const uint8_t *obmc = plane_index ? obmc_tab[s->block_max_depth+1] : obmc_tab[s->block_max_depth]; | |||||
| const uint8_t *obmc = plane_index ? ff_obmc_tab[s->block_max_depth+1] : ff_obmc_tab[s->block_max_depth]; | |||||
| int obmc_stride= plane_index ? block_size : 2*block_size; | int obmc_stride= plane_index ? block_size : 2*block_size; | ||||
| int ref_stride= s->current_picture.linesize[plane_index]; | int ref_stride= s->current_picture.linesize[plane_index]; | ||||
| uint8_t *dst8= s->current_picture.data[plane_index]; | uint8_t *dst8= s->current_picture.data[plane_index]; | ||||
| @@ -95,7 +95,7 @@ static inline void decode_subband_slice_buffered(SnowContext *s, SubBand *b, sli | |||||
| const int w= b->width; | const int w= b->width; | ||||
| int y; | int y; | ||||
| const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); | const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); | ||||
| int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); | |||||
| int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); | |||||
| int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; | int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; | ||||
| int new_index = 0; | int new_index = 0; | ||||
| @@ -184,7 +184,7 @@ static void decode_q_branch(SnowContext *s, int level, int x, int y){ | |||||
| static void dequantize_slice_buffered(SnowContext *s, slice_buffer * sb, SubBand *b, IDWTELEM *src, int stride, int start_y, int end_y){ | static void dequantize_slice_buffered(SnowContext *s, slice_buffer * sb, SubBand *b, IDWTELEM *src, int stride, int start_y, int end_y){ | ||||
| const int w= b->width; | const int w= b->width; | ||||
| const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); | const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); | ||||
| const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); | |||||
| const int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); | |||||
| const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; | const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; | ||||
| int x,y; | int x,y; | ||||
| @@ -575,7 +575,7 @@ static int get_dc(SnowContext *s, int mb_x, int mb_y, int plane_index){ | |||||
| Plane *p= &s->plane[plane_index]; | Plane *p= &s->plane[plane_index]; | ||||
| const int block_size = MB_SIZE >> s->block_max_depth; | const int block_size = MB_SIZE >> s->block_max_depth; | ||||
| const int block_w = plane_index ? block_size/2 : block_size; | const int block_w = plane_index ? block_size/2 : block_size; | ||||
| const uint8_t *obmc = plane_index ? obmc_tab[s->block_max_depth+1] : obmc_tab[s->block_max_depth]; | |||||
| const uint8_t *obmc = plane_index ? ff_obmc_tab[s->block_max_depth+1] : ff_obmc_tab[s->block_max_depth]; | |||||
| const int obmc_stride= plane_index ? block_size : 2*block_size; | const int obmc_stride= plane_index ? block_size : 2*block_size; | ||||
| const int ref_stride= s->current_picture.linesize[plane_index]; | const int ref_stride= s->current_picture.linesize[plane_index]; | ||||
| uint8_t *src= s-> input_picture.data[plane_index]; | uint8_t *src= s-> input_picture.data[plane_index]; | ||||
| @@ -766,7 +766,7 @@ static int get_4block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index){ | |||||
| Plane *p= &s->plane[plane_index]; | Plane *p= &s->plane[plane_index]; | ||||
| const int block_size = MB_SIZE >> s->block_max_depth; | const int block_size = MB_SIZE >> s->block_max_depth; | ||||
| const int block_w = plane_index ? block_size/2 : block_size; | const int block_w = plane_index ? block_size/2 : block_size; | ||||
| const uint8_t *obmc = plane_index ? obmc_tab[s->block_max_depth+1] : obmc_tab[s->block_max_depth]; | |||||
| const uint8_t *obmc = plane_index ? ff_obmc_tab[s->block_max_depth+1] : ff_obmc_tab[s->block_max_depth]; | |||||
| const int obmc_stride= plane_index ? block_size : 2*block_size; | const int obmc_stride= plane_index ? block_size : 2*block_size; | ||||
| const int ref_stride= s->current_picture.linesize[plane_index]; | const int ref_stride= s->current_picture.linesize[plane_index]; | ||||
| uint8_t *dst= s->current_picture.data[plane_index]; | uint8_t *dst= s->current_picture.data[plane_index]; | ||||
| @@ -939,7 +939,7 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, IDWTELEM *src, IDWTE | |||||
| int t2= 2*FFABS(t) + (t<0); | int t2= 2*FFABS(t) + (t<0); | ||||
| put_symbol2(&s->c, b->state[context + 2], FFABS(v)-1, context-4); | put_symbol2(&s->c, b->state[context + 2], FFABS(v)-1, context-4); | ||||
| put_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l2&0xFF] + 3*quant3bA[t2&0xFF]], v<0); | |||||
| put_rac(&s->c, &b->state[0][16 + 1 + 3 + ff_quant3bA[l2&0xFF] + 3*ff_quant3bA[t2&0xFF]], v<0); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -1090,7 +1090,7 @@ static void iterative_me(SnowContext *s){ | |||||
| //FIXME precalculate | //FIXME precalculate | ||||
| { | { | ||||
| int x, y; | int x, y; | ||||
| memcpy(obmc_edged, obmc_tab[s->block_max_depth], b_w*b_w*4); | |||||
| memcpy(obmc_edged, ff_obmc_tab[s->block_max_depth], b_w*b_w*4); | |||||
| if(mb_x==0) | if(mb_x==0) | ||||
| for(y=0; y<b_w*2; y++) | for(y=0; y<b_w*2; y++) | ||||
| memset(obmc_edged[y], obmc_edged[y][0] + obmc_edged[y][b_w-1], b_w); | memset(obmc_edged[y], obmc_edged[y][0] + obmc_edged[y][b_w-1], b_w); | ||||
| @@ -1286,7 +1286,7 @@ static void quantize(SnowContext *s, SubBand *b, IDWTELEM *dst, DWTELEM *src, in | |||||
| const int w= b->width; | const int w= b->width; | ||||
| const int h= b->height; | const int h= b->height; | ||||
| const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); | const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); | ||||
| const int qmul= qexp[qlog&(QROOT-1)]<<((qlog>>QSHIFT) + ENCODER_EXTRA_BITS); | |||||
| const int qmul= ff_qexp[qlog&(QROOT-1)]<<((qlog>>QSHIFT) + ENCODER_EXTRA_BITS); | |||||
| int x,y, thres1, thres2; | int x,y, thres1, thres2; | ||||
| if(s->qlog == LOSSLESS_QLOG){ | if(s->qlog == LOSSLESS_QLOG){ | ||||
| @@ -1347,7 +1347,7 @@ static void dequantize(SnowContext *s, SubBand *b, IDWTELEM *src, int stride){ | |||||
| const int w= b->width; | const int w= b->width; | ||||
| const int h= b->height; | const int h= b->height; | ||||
| const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); | const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); | ||||
| const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); | |||||
| const int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); | |||||
| const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; | const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; | ||||
| int x,y; | int x,y; | ||||
| @@ -1538,7 +1538,7 @@ static int ratecontrol_1pass(SnowContext *s, AVFrame *pict) | |||||
| const int h= b->height; | const int h= b->height; | ||||
| const int stride= b->stride; | const int stride= b->stride; | ||||
| const int qlog= av_clip(2*QROOT + b->qlog, 0, QROOT*16); | const int qlog= av_clip(2*QROOT + b->qlog, 0, QROOT*16); | ||||
| const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); | |||||
| const int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); | |||||
| const int qdiv= (1<<16)/qmul; | const int qdiv= (1<<16)/qmul; | ||||
| int x, y; | int x, y; | ||||
| //FIXME this is ugly | //FIXME this is ugly | ||||