Mercurial > libavcodec.hg
comparison snow.c @ 5651:ab023c9f03d0 libavcodec
store halfpel filter coefficients in the header as well as the
flag for diagonal interpolation
the primary reason for this change is that previously MC up to 1/4 pel
matched H.264 exactly and that increases the risk of stumbling over
patents
secondly this allows 0.10 db or more quality gain by choosing a longer
filter and the filter could also be chosen optimally for each frame
though that of course would cause speed loss at the decoder and encoder
side ...
author | michael |
---|---|
date | Sat, 08 Sep 2007 14:51:13 +0000 |
parents | 2a25f7167c09 |
children | 941e5deeb2a4 |
comparison
equal
deleted
inserted
replaced
5650:2a25f7167c09 | 5651:ab023c9f03d0 |
---|---|
392 }; | 392 }; |
393 | 393 |
394 #define LOG2_MB_SIZE 4 | 394 #define LOG2_MB_SIZE 4 |
395 #define MB_SIZE (1<<LOG2_MB_SIZE) | 395 #define MB_SIZE (1<<LOG2_MB_SIZE) |
396 #define ENCODER_EXTRA_BITS 4 | 396 #define ENCODER_EXTRA_BITS 4 |
397 #define HTAPS 6 | 397 #define HTAPS 8 |
398 | 398 |
399 typedef struct x_and_coeff{ | 399 typedef struct x_and_coeff{ |
400 int16_t x; | 400 int16_t x; |
401 uint16_t coeff; | 401 uint16_t coeff; |
402 } x_and_coeff; | 402 } x_and_coeff; |
419 | 419 |
420 typedef struct Plane{ | 420 typedef struct Plane{ |
421 int width; | 421 int width; |
422 int height; | 422 int height; |
423 SubBand band[MAX_DECOMPOSITIONS][4]; | 423 SubBand band[MAX_DECOMPOSITIONS][4]; |
424 | |
425 int htaps; | |
426 int8_t hcoeff[HTAPS/2]; | |
427 int diag_mc; | |
428 int fast_mc; | |
429 | |
430 int last_htaps; | |
431 int8_t last_hcoeff[HTAPS/2]; | |
432 int last_diag_mc; | |
424 }Plane; | 433 }Plane; |
425 | 434 |
426 typedef struct SnowContext{ | 435 typedef struct SnowContext{ |
427 // MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to make the motion estimation eventually independent of MpegEncContext, so this will be removed then (FIXME/XXX) | 436 // MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to make the motion estimation eventually independent of MpegEncContext, so this will be removed then (FIXME/XXX) |
428 | 437 |
2141 decode_q_branch(s, 0, x, y); | 2150 decode_q_branch(s, 0, x, y); |
2142 } | 2151 } |
2143 } | 2152 } |
2144 } | 2153 } |
2145 | 2154 |
2146 static void mc_block(uint8_t *dst, const uint8_t *src, uint8_t *tmp, int stride, int b_w, int b_h, int dx, int dy){ | 2155 static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, uint8_t *tmp, int stride, int b_w, int b_h, int dx, int dy){ |
2147 const static uint8_t weight[64]={ | 2156 const static uint8_t weight[64]={ |
2148 8,7,6,5,4,3,2,1, | 2157 8,7,6,5,4,3,2,1, |
2149 7,7,0,0,0,0,0,1, | 2158 7,7,0,0,0,0,0,1, |
2150 6,0,6,0,0,0,2,0, | 2159 6,0,6,0,0,0,2,0, |
2151 5,0,0,5,0,3,0,0, | 2160 5,0,0,5,0,3,0,0, |
2191 assert(dx<16 && dy<16); | 2200 assert(dx<16 && dy<16); |
2192 r= brane[dx + 16*dy]&15; | 2201 r= brane[dx + 16*dy]&15; |
2193 l= brane[dx + 16*dy]>>4; | 2202 l= brane[dx + 16*dy]>>4; |
2194 | 2203 |
2195 b= needs[l] | needs[r]; | 2204 b= needs[l] | needs[r]; |
2205 if(p && !p->diag_mc) | |
2206 b= 15; | |
2196 | 2207 |
2197 if(b&5){ | 2208 if(b&5){ |
2198 for(y=0; y < b_h+HTAPS-1; y++){ | 2209 for(y=0; y < b_h+HTAPS-1; y++){ |
2199 for(x=0; x < b_w; x++){ | 2210 for(x=0; x < b_w; x++){ |
2200 int a_2=src[x + HTAPS/2-5]; | |
2201 int a_1=src[x + HTAPS/2-4]; | 2211 int a_1=src[x + HTAPS/2-4]; |
2202 int a0= src[x + HTAPS/2-3]; | 2212 int a0= src[x + HTAPS/2-3]; |
2203 int a1= src[x + HTAPS/2-2]; | 2213 int a1= src[x + HTAPS/2-2]; |
2204 int a2= src[x + HTAPS/2-1]; | 2214 int a2= src[x + HTAPS/2-1]; |
2205 int a3= src[x + HTAPS/2+0]; | 2215 int a3= src[x + HTAPS/2+0]; |
2206 int a4= src[x + HTAPS/2+1]; | 2216 int a4= src[x + HTAPS/2+1]; |
2207 int a5= src[x + HTAPS/2+2]; | 2217 int a5= src[x + HTAPS/2+2]; |
2208 int a6= src[x + HTAPS/2+3]; | 2218 int a6= src[x + HTAPS/2+3]; |
2209 int a7= src[x + HTAPS/2+4]; | 2219 int am=0; |
2210 #if HTAPS==6 | 2220 if(!p || p->fast_mc){ |
2211 int am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5); | 2221 am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5); |
2212 #else | 2222 tmpI[x]= am; |
2213 int am= 21*(a2+a3) - 7*(a1+a4) + 3*(a0+a5) - (a_1+a6); | 2223 am= (am+16)>>5; |
2214 #endif | 2224 }else{ |
2215 | 2225 am= p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) + p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6); |
2216 tmpI[x]= am; | 2226 tmpI[x]= am; |
2217 am= (am+16)>>5; | 2227 am= (am+32)>>6; |
2228 } | |
2229 | |
2218 if(am&(~255)) am= ~(am>>31); | 2230 if(am&(~255)) am= ~(am>>31); |
2219 tmp2[x]= am; | 2231 tmp2[x]= am; |
2220 } | 2232 } |
2221 tmpI+= 64; | 2233 tmpI+= 64; |
2222 tmp2+= stride; | 2234 tmp2+= stride; |
2228 tmp2= tmp2t[1]; | 2240 tmp2= tmp2t[1]; |
2229 | 2241 |
2230 if(b&2){ | 2242 if(b&2){ |
2231 for(y=0; y < b_h; y++){ | 2243 for(y=0; y < b_h; y++){ |
2232 for(x=0; x < b_w+1; x++){ | 2244 for(x=0; x < b_w+1; x++){ |
2233 int a_2=src[x + (HTAPS/2-5)*stride]; | |
2234 int a_1=src[x + (HTAPS/2-4)*stride]; | 2245 int a_1=src[x + (HTAPS/2-4)*stride]; |
2235 int a0= src[x + (HTAPS/2-3)*stride]; | 2246 int a0= src[x + (HTAPS/2-3)*stride]; |
2236 int a1= src[x + (HTAPS/2-2)*stride]; | 2247 int a1= src[x + (HTAPS/2-2)*stride]; |
2237 int a2= src[x + (HTAPS/2-1)*stride]; | 2248 int a2= src[x + (HTAPS/2-1)*stride]; |
2238 int a3= src[x + (HTAPS/2+0)*stride]; | 2249 int a3= src[x + (HTAPS/2+0)*stride]; |
2239 int a4= src[x + (HTAPS/2+1)*stride]; | 2250 int a4= src[x + (HTAPS/2+1)*stride]; |
2240 int a5= src[x + (HTAPS/2+2)*stride]; | 2251 int a5= src[x + (HTAPS/2+2)*stride]; |
2241 int a6= src[x + (HTAPS/2+3)*stride]; | 2252 int a6= src[x + (HTAPS/2+3)*stride]; |
2242 int a7= src[x + (HTAPS/2+4)*stride]; | 2253 int am=0; |
2243 #if HTAPS==6 | 2254 if(!p || p->fast_mc) |
2244 int am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5); | 2255 am= (20*(a2+a3) - 5*(a1+a4) + (a0+a5) + 16)>>5; |
2245 #else | 2256 else |
2246 int am= 21*(a2+a3) - 7*(a1+a4) + 3*(a0+a5) - (a_1+a6); | 2257 am= (p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) + p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6) + 32)>>6; |
2247 #endif | 2258 |
2248 | |
2249 am= (am + 16)>>5; | |
2250 if(am&(~255)) am= ~(am>>31); | 2259 if(am&(~255)) am= ~(am>>31); |
2251 tmp2[x]= am; | 2260 tmp2[x]= am; |
2252 } | 2261 } |
2253 src += stride; | 2262 src += stride; |
2254 tmp2+= stride; | 2263 tmp2+= stride; |
2259 tmp2= tmp2t[2]; | 2268 tmp2= tmp2t[2]; |
2260 tmpI= tmpIt; | 2269 tmpI= tmpIt; |
2261 if(b&4){ | 2270 if(b&4){ |
2262 for(y=0; y < b_h; y++){ | 2271 for(y=0; y < b_h; y++){ |
2263 for(x=0; x < b_w; x++){ | 2272 for(x=0; x < b_w; x++){ |
2264 int a_2=tmpI[x + (HTAPS/2-5)*64]; | |
2265 int a_1=tmpI[x + (HTAPS/2-4)*64]; | 2273 int a_1=tmpI[x + (HTAPS/2-4)*64]; |
2266 int a0= tmpI[x + (HTAPS/2-3)*64]; | 2274 int a0= tmpI[x + (HTAPS/2-3)*64]; |
2267 int a1= tmpI[x + (HTAPS/2-2)*64]; | 2275 int a1= tmpI[x + (HTAPS/2-2)*64]; |
2268 int a2= tmpI[x + (HTAPS/2-1)*64]; | 2276 int a2= tmpI[x + (HTAPS/2-1)*64]; |
2269 int a3= tmpI[x + (HTAPS/2+0)*64]; | 2277 int a3= tmpI[x + (HTAPS/2+0)*64]; |
2270 int a4= tmpI[x + (HTAPS/2+1)*64]; | 2278 int a4= tmpI[x + (HTAPS/2+1)*64]; |
2271 int a5= tmpI[x + (HTAPS/2+2)*64]; | 2279 int a5= tmpI[x + (HTAPS/2+2)*64]; |
2272 int a6= tmpI[x + (HTAPS/2+3)*64]; | 2280 int a6= tmpI[x + (HTAPS/2+3)*64]; |
2273 int a7= tmpI[x + (HTAPS/2+4)*64]; | 2281 int am=0; |
2274 #if HTAPS==6 | 2282 if(!p || p->fast_mc) |
2275 int am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5); | 2283 am= (20*(a2+a3) - 5*(a1+a4) + (a0+a5) + 512)>>10; |
2276 #else | 2284 else |
2277 int am= 21*(a2+a3) - 7*(a1+a4) + 3*(a0+a5) - (a_1+a6); | 2285 am= (p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) + p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6) + 2048)>>12; |
2278 #endif | |
2279 am= (am + 512)>>10; | |
2280 if(am&(~255)) am= ~(am>>31); | 2286 if(am&(~255)) am= ~(am>>31); |
2281 tmp2[x]= am; | 2287 tmp2[x]= am; |
2282 } | 2288 } |
2283 tmpI+= 64; | 2289 tmpI+= 64; |
2284 tmp2+= stride; | 2290 tmp2+= stride; |
2334 | 2340 |
2335 #define mca(dx,dy,b_w)\ | 2341 #define mca(dx,dy,b_w)\ |
2336 static void mc_block_hpel ## dx ## dy ## b_w(uint8_t *dst, const uint8_t *src, int stride, int h){\ | 2342 static void mc_block_hpel ## dx ## dy ## b_w(uint8_t *dst, const uint8_t *src, int stride, int h){\ |
2337 uint8_t tmp[stride*(b_w+HTAPS-1)];\ | 2343 uint8_t tmp[stride*(b_w+HTAPS-1)];\ |
2338 assert(h==b_w);\ | 2344 assert(h==b_w);\ |
2339 mc_block(dst, src-(HTAPS/2-1)-(HTAPS/2-1)*stride, tmp, stride, b_w, b_w, dx, dy);\ | 2345 mc_block(NULL, dst, src-(HTAPS/2-1)-(HTAPS/2-1)*stride, tmp, stride, b_w, b_w, dx, dy);\ |
2340 } | 2346 } |
2341 | 2347 |
2342 mca( 0, 0,16) | 2348 mca( 0, 0,16) |
2343 mca( 8, 0,16) | 2349 mca( 8, 0,16) |
2344 mca( 0, 8,16) | 2350 mca( 0, 8,16) |
2405 } | 2411 } |
2406 // assert(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h); | 2412 // assert(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h); |
2407 // assert(!(b_w&(b_w-1))); | 2413 // assert(!(b_w&(b_w-1))); |
2408 assert(b_w>1 && b_h>1); | 2414 assert(b_w>1 && b_h>1); |
2409 assert(tab_index>=0 && tab_index<4 || b_w==32); | 2415 assert(tab_index>=0 && tab_index<4 || b_w==32); |
2410 if((dx&3) || (dy&3) || !(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h) || (b_w&(b_w-1)) || HTAPS != 6) | 2416 if((dx&3) || (dy&3) || !(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h) || (b_w&(b_w-1)) || !s->plane[plane_index].fast_mc ) |
2411 mc_block(dst, src, tmp, stride, b_w, b_h, dx, dy); | 2417 mc_block(&s->plane[plane_index], dst, src, tmp, stride, b_w, b_h, dx, dy); |
2412 else if(b_w==32){ | 2418 else if(b_w==32){ |
2413 int y; | 2419 int y; |
2414 for(y=0; y<b_h; y+=16){ | 2420 for(y=0; y<b_h; y+=16){ |
2415 s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + y*stride, src + 2 + (y+2)*stride,stride); | 2421 s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + y*stride, src + 3 + (y+3)*stride,stride); |
2416 s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + 16 + y*stride, src + 18 + (y+2)*stride,stride); | 2422 s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + 16 + y*stride, src + 19 + (y+3)*stride,stride); |
2417 } | 2423 } |
2418 }else if(b_w==b_h) | 2424 }else if(b_w==b_h) |
2419 s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst,src + 2 + 2*stride,stride); | 2425 s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst,src + 3 + 3*stride,stride); |
2420 else if(b_w==2*b_h){ | 2426 else if(b_w==2*b_h){ |
2421 s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst ,src + 2 + 2*stride,stride); | 2427 s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst ,src + 3 + 3*stride,stride); |
2422 s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst+b_h,src + 2 + b_h + 2*stride,stride); | 2428 s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst+b_h,src + 3 + b_h + 3*stride,stride); |
2423 }else{ | 2429 }else{ |
2424 assert(2*b_w==b_h); | 2430 assert(2*b_w==b_h); |
2425 s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst ,src + 2 + 2*stride ,stride); | 2431 s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst ,src + 3 + 3*stride ,stride); |
2426 s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst+b_w*stride,src + 2 + 2*stride+b_w*stride,stride); | 2432 s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst+b_w*stride,src + 3 + 3*stride+b_w*stride,stride); |
2427 } | 2433 } |
2428 } | 2434 } |
2429 } | 2435 } |
2430 | 2436 |
2431 void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, | 2437 void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, |
3512 } | 3518 } |
3513 } | 3519 } |
3514 } | 3520 } |
3515 | 3521 |
3516 static void encode_header(SnowContext *s){ | 3522 static void encode_header(SnowContext *s){ |
3517 int plane_index, level, orientation; | 3523 int plane_index, level, orientation, i; |
3518 uint8_t kstate[32]; | 3524 uint8_t kstate[32]; |
3519 | 3525 |
3520 memset(kstate, MID_STATE, sizeof(kstate)); | 3526 memset(kstate, MID_STATE, sizeof(kstate)); |
3521 | 3527 |
3522 put_rac(&s->c, kstate, s->keyframe); | 3528 put_rac(&s->c, kstate, s->keyframe); |
3525 s->last_spatial_decomposition_type= | 3531 s->last_spatial_decomposition_type= |
3526 s->last_qlog= | 3532 s->last_qlog= |
3527 s->last_qbias= | 3533 s->last_qbias= |
3528 s->last_mv_scale= | 3534 s->last_mv_scale= |
3529 s->last_block_max_depth= 0; | 3535 s->last_block_max_depth= 0; |
3536 for(plane_index=0; plane_index<2; plane_index++){ | |
3537 Plane *p= &s->plane[plane_index]; | |
3538 p->last_htaps=0; | |
3539 p->last_diag_mc=0; | |
3540 memset(p->last_hcoeff, 0, sizeof(p->last_hcoeff)); | |
3541 } | |
3530 } | 3542 } |
3531 if(s->keyframe){ | 3543 if(s->keyframe){ |
3532 put_symbol(&s->c, s->header_state, s->version, 0); | 3544 put_symbol(&s->c, s->header_state, s->version, 0); |
3533 put_rac(&s->c, s->header_state, s->always_reset); | 3545 put_rac(&s->c, s->header_state, s->always_reset); |
3534 put_symbol(&s->c, s->header_state, s->temporal_decomposition_type, 0); | 3546 put_symbol(&s->c, s->header_state, s->temporal_decomposition_type, 0); |
3548 put_symbol(&s->c, s->header_state, s->plane[plane_index].band[level][orientation].qlog, 1); | 3560 put_symbol(&s->c, s->header_state, s->plane[plane_index].band[level][orientation].qlog, 1); |
3549 } | 3561 } |
3550 } | 3562 } |
3551 } | 3563 } |
3552 } | 3564 } |
3565 | |
3566 if(!s->keyframe){ | |
3567 int update_mc=0; | |
3568 for(plane_index=0; plane_index<2; plane_index++){ | |
3569 Plane *p= &s->plane[plane_index]; | |
3570 update_mc |= p->last_htaps != p->htaps; | |
3571 update_mc |= p->last_diag_mc != p->diag_mc; | |
3572 update_mc |= !!memcmp(p->last_hcoeff, p->hcoeff, sizeof(p->hcoeff)); | |
3573 } | |
3574 if(!s->always_reset) | |
3575 put_rac(&s->c, s->header_state, update_mc); | |
3576 if(update_mc){ | |
3577 for(plane_index=0; plane_index<2; plane_index++){ | |
3578 Plane *p= &s->plane[plane_index]; | |
3579 put_rac(&s->c, s->header_state, p->diag_mc); | |
3580 put_symbol(&s->c, s->header_state, p->htaps/2-1, 0); | |
3581 for(i= p->htaps/2; i; i--) | |
3582 put_symbol(&s->c, s->header_state, FFABS(p->hcoeff[i]), 0); | |
3583 | |
3584 p->last_diag_mc= p->diag_mc; | |
3585 p->last_htaps= p->htaps; | |
3586 memcpy(p->last_hcoeff, p->hcoeff, sizeof(p->hcoeff)); | |
3587 } | |
3588 } | |
3589 } | |
3590 | |
3553 put_symbol(&s->c, s->header_state, s->spatial_decomposition_type - s->last_spatial_decomposition_type, 1); | 3591 put_symbol(&s->c, s->header_state, s->spatial_decomposition_type - s->last_spatial_decomposition_type, 1); |
3554 put_symbol(&s->c, s->header_state, s->qlog - s->last_qlog , 1); | 3592 put_symbol(&s->c, s->header_state, s->qlog - s->last_qlog , 1); |
3555 put_symbol(&s->c, s->header_state, s->mv_scale - s->last_mv_scale, 1); | 3593 put_symbol(&s->c, s->header_state, s->mv_scale - s->last_mv_scale, 1); |
3556 put_symbol(&s->c, s->header_state, s->qbias - s->last_qbias , 1); | 3594 put_symbol(&s->c, s->header_state, s->qbias - s->last_qbias , 1); |
3557 put_symbol(&s->c, s->header_state, s->block_max_depth - s->last_block_max_depth, 1); | 3595 put_symbol(&s->c, s->header_state, s->block_max_depth - s->last_block_max_depth, 1); |
3603 else if(orientation==2) q= s->plane[plane_index].band[level][1].qlog; | 3641 else if(orientation==2) q= s->plane[plane_index].band[level][1].qlog; |
3604 else q= get_symbol(&s->c, s->header_state, 1); | 3642 else q= get_symbol(&s->c, s->header_state, 1); |
3605 s->plane[plane_index].band[level][orientation].qlog= q; | 3643 s->plane[plane_index].band[level][orientation].qlog= q; |
3606 } | 3644 } |
3607 } | 3645 } |
3646 } | |
3647 } | |
3648 | |
3649 if(!s->keyframe){ | |
3650 if(s->always_reset || get_rac(&s->c, s->header_state)){ | |
3651 for(plane_index=0; plane_index<2; plane_index++){ | |
3652 int htaps, i, sum=0, absum=0; | |
3653 Plane *p= &s->plane[plane_index]; | |
3654 p->diag_mc= get_rac(&s->c, s->header_state); | |
3655 htaps= get_symbol(&s->c, s->header_state, 0)*2 + 2; | |
3656 if((unsigned)htaps > HTAPS || htaps==0) | |
3657 return -1; | |
3658 p->htaps= htaps; | |
3659 for(i= htaps/2; i; i--){ | |
3660 p->hcoeff[i]= get_symbol(&s->c, s->header_state, 0) * (1-2*(i&1)); | |
3661 sum += p->hcoeff[i]; | |
3662 } | |
3663 p->hcoeff[0]= 32-sum; | |
3664 } | |
3665 s->plane[2].diag_mc= s->plane[1].diag_mc; | |
3666 s->plane[2].htaps = s->plane[1].htaps; | |
3667 memcpy(s->plane[2].hcoeff, s->plane[1].hcoeff, sizeof(s->plane[1].hcoeff)); | |
3608 } | 3668 } |
3609 } | 3669 } |
3610 | 3670 |
3611 s->spatial_decomposition_type+= get_symbol(&s->c, s->header_state, 1); | 3671 s->spatial_decomposition_type+= get_symbol(&s->c, s->header_state, 1); |
3612 if(s->spatial_decomposition_type > 1){ | 3672 if(s->spatial_decomposition_type > 1){ |
3713 w>>= s->chroma_h_shift; | 3773 w>>= s->chroma_h_shift; |
3714 h>>= s->chroma_v_shift; | 3774 h>>= s->chroma_v_shift; |
3715 } | 3775 } |
3716 s->plane[plane_index].width = w; | 3776 s->plane[plane_index].width = w; |
3717 s->plane[plane_index].height= h; | 3777 s->plane[plane_index].height= h; |
3778 | |
3779 s->plane[plane_index].diag_mc= 1; | |
3780 s->plane[plane_index].htaps= 6; | |
3781 s->plane[plane_index].hcoeff[0]= 40; | |
3782 s->plane[plane_index].hcoeff[1]= -10; | |
3783 s->plane[plane_index].hcoeff[2]= 2; | |
3784 s->plane[plane_index].fast_mc= 1; | |
3785 | |
3718 //av_log(NULL, AV_LOG_DEBUG, "%d %d\n", w, h); | 3786 //av_log(NULL, AV_LOG_DEBUG, "%d %d\n", w, h); |
3719 for(level=s->spatial_decomposition_count-1; level>=0; level--){ | 3787 for(level=s->spatial_decomposition_count-1; level>=0; level--){ |
3720 for(orientation=level ? 1 : 0; orientation<4; orientation++){ | 3788 for(orientation=level ? 1 : 0; orientation<4; orientation++){ |
3721 SubBand *b= &s->plane[plane_index].band[level][orientation]; | 3789 SubBand *b= &s->plane[plane_index].band[level][orientation]; |
3722 | 3790 |
4352 ff_init_range_decoder(c, buf, buf_size); | 4420 ff_init_range_decoder(c, buf, buf_size); |
4353 ff_build_rac_states(c, 0.05*(1LL<<32), 256-8); | 4421 ff_build_rac_states(c, 0.05*(1LL<<32), 256-8); |
4354 | 4422 |
4355 s->current_picture.pict_type= FF_I_TYPE; //FIXME I vs. P | 4423 s->current_picture.pict_type= FF_I_TYPE; //FIXME I vs. P |
4356 decode_header(s); | 4424 decode_header(s); |
4425 | |
4426 for(plane_index=0; plane_index<3; plane_index++){ | |
4427 Plane *p= &s->plane[plane_index]; | |
4428 p->fast_mc= p->diag_mc && p->htaps==6 && p->hcoeff[0]==40 | |
4429 && p->hcoeff[1]==-10 | |
4430 && p->hcoeff[2]==2; | |
4431 } | |
4432 | |
4357 if(!s->block) alloc_blocks(s); | 4433 if(!s->block) alloc_blocks(s); |
4358 | 4434 |
4359 frame_start(s); | 4435 frame_start(s); |
4360 //keyframe flag dupliaction mess FIXME | 4436 //keyframe flag dupliaction mess FIXME |
4361 if(avctx->debug&FF_DEBUG_PICT_INFO) | 4437 if(avctx->debug&FF_DEBUG_PICT_INFO) |