comparison h264.c @ 7522:4017c5ba7bab libavcodec

Remove odd pairwise deblock filtering applied to MBAFF MBs.
author michael
date Sat, 09 Aug 2008 01:17:34 +0000
parents e7006afcb1c6
children 919182093931
comparison
equal deleted inserted replaced
7521:560ebb4bca76 7522:4017c5ba7bab
182 left_type[0] = h->slice_table[left_xy[0] ] < 255 ? s->current_picture.mb_type[left_xy[0]] : 0; 182 left_type[0] = h->slice_table[left_xy[0] ] < 255 ? s->current_picture.mb_type[left_xy[0]] : 0;
183 left_type[1] = h->slice_table[left_xy[1] ] < 255 ? s->current_picture.mb_type[left_xy[1]] : 0; 183 left_type[1] = h->slice_table[left_xy[1] ] < 255 ? s->current_picture.mb_type[left_xy[1]] : 0;
184 184
185 if(FRAME_MBAFF && !IS_INTRA(mb_type)){ 185 if(FRAME_MBAFF && !IS_INTRA(mb_type)){
186 int list; 186 int list;
187 int v = *(uint16_t*)&h->non_zero_count[mb_xy][14];
188 for(i=0; i<16; i++)
189 h->non_zero_count_cache[scan8[i]] = (v>>i)&1;
190 for(list=0; list<h->list_count; list++){ 187 for(list=0; list<h->list_count; list++){
191 if(USES_LIST(mb_type,list)){ 188 if(USES_LIST(mb_type,list)){
192 uint32_t *src = (uint32_t*)s->current_picture.motion_val[list][h->mb2b_xy[mb_xy]]; 189 uint32_t *src = (uint32_t*)s->current_picture.motion_val[list][h->mb2b_xy[mb_xy]];
193 uint32_t *dst = (uint32_t*)h->mv_cache[list][scan8[0]]; 190 uint32_t *dst = (uint32_t*)h->mv_cache[list][scan8[0]];
194 int8_t *ref = &s->current_picture.ref_index[list][h->mb2b8_xy[mb_xy]]; 191 int8_t *ref = &s->current_picture.ref_index[list][h->mb2b8_xy[mb_xy]];
654 h->non_zero_count[mb_xy][7]= h->non_zero_count_cache[2+8*1]; 651 h->non_zero_count[mb_xy][7]= h->non_zero_count_cache[2+8*1];
655 652
656 h->non_zero_count[mb_xy][12]=h->non_zero_count_cache[1+8*5]; 653 h->non_zero_count[mb_xy][12]=h->non_zero_count_cache[1+8*5];
657 h->non_zero_count[mb_xy][11]=h->non_zero_count_cache[2+8*5]; 654 h->non_zero_count[mb_xy][11]=h->non_zero_count_cache[2+8*5];
658 h->non_zero_count[mb_xy][10]=h->non_zero_count_cache[2+8*4]; 655 h->non_zero_count[mb_xy][10]=h->non_zero_count_cache[2+8*4];
659
660 if(FRAME_MBAFF){
661 // store all luma nnzs, for deblocking
662 int v = 0, i;
663 for(i=0; i<16; i++)
664 v += (!!h->non_zero_count_cache[scan8[i]]) << i;
665 *(uint16_t*)&h->non_zero_count[mb_xy][14] = v;
666 }
667 } 656 }
668 657
669 /** 658 /**
670 * gets the predicted number of non-zero coefficients. 659 * gets the predicted number of non-zero coefficients.
671 * @param n block index 660 * @param n block index
2268 } 2257 }
2269 2258
2270 static inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int simple){ 2259 static inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int simple){
2271 MpegEncContext * const s = &h->s; 2260 MpegEncContext * const s = &h->s;
2272 int i; 2261 int i;
2262 int step = 1;
2263 int offset = 1;
2264 int uvoffset= 1;
2265 int top_idx = 1;
2266 int skiplast= 0;
2273 2267
2274 src_y -= linesize; 2268 src_y -= linesize;
2275 src_cb -= uvlinesize; 2269 src_cb -= uvlinesize;
2276 src_cr -= uvlinesize; 2270 src_cr -= uvlinesize;
2277 2271
2272 if(!simple && FRAME_MBAFF){
2273 if(s->mb_y&1){
2274 offset = MB_MBAFF ? 1 : 17;
2275 uvoffset= MB_MBAFF ? 1 : 9;
2276 if(!MB_MBAFF){
2277 *(uint64_t*)(h->top_borders[0][s->mb_x]+ 0)= *(uint64_t*)(src_y + 15*linesize);
2278 *(uint64_t*)(h->top_borders[0][s->mb_x]+ 8)= *(uint64_t*)(src_y +8+15*linesize);
2279 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
2280 *(uint64_t*)(h->top_borders[0][s->mb_x]+16)= *(uint64_t*)(src_cb+7*uvlinesize);
2281 *(uint64_t*)(h->top_borders[0][s->mb_x]+24)= *(uint64_t*)(src_cr+7*uvlinesize);
2282 }
2283 }
2284 }else{
2285 if(!MB_MBAFF){
2286 h->left_border[0]= h->top_borders[0][s->mb_x][15];
2287 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
2288 h->left_border[34 ]= h->top_borders[0][s->mb_x][16+7 ];
2289 h->left_border[34+18]= h->top_borders[0][s->mb_x][16+8+7];
2290 }
2291 skiplast= 1;
2292 }
2293 offset =
2294 uvoffset=
2295 top_idx = MB_MBAFF ? 0 : 1;
2296 }
2297 step= MB_MBAFF ? 2 : 1;
2298 }
2299
2278 // There are two lines saved, the line above the the top macroblock of a pair, 2300 // There are two lines saved, the line above the the top macroblock of a pair,
2279 // and the line above the bottom macroblock 2301 // and the line above the bottom macroblock
2280 h->left_border[0]= h->top_borders[0][s->mb_x][15]; 2302 h->left_border[offset]= h->top_borders[top_idx][s->mb_x][15];
2281 for(i=1; i<17; i++){ 2303 for(i=1; i<17 - skiplast; i++){
2282 h->left_border[i]= src_y[15+i* linesize]; 2304 h->left_border[offset+i*step]= src_y[15+i* linesize];
2283 } 2305 }
2284 2306
2285 *(uint64_t*)(h->top_borders[0][s->mb_x]+0)= *(uint64_t*)(src_y + 16*linesize); 2307 *(uint64_t*)(h->top_borders[top_idx][s->mb_x]+0)= *(uint64_t*)(src_y + 16*linesize);
2286 *(uint64_t*)(h->top_borders[0][s->mb_x]+8)= *(uint64_t*)(src_y +8+16*linesize); 2308 *(uint64_t*)(h->top_borders[top_idx][s->mb_x]+8)= *(uint64_t*)(src_y +8+16*linesize);
2287 2309
2288 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ 2310 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
2289 h->left_border[17 ]= h->top_borders[0][s->mb_x][16+7]; 2311 h->left_border[uvoffset+34 ]= h->top_borders[top_idx][s->mb_x][16+7];
2290 h->left_border[17+9]= h->top_borders[0][s->mb_x][24+7]; 2312 h->left_border[uvoffset+34+18]= h->top_borders[top_idx][s->mb_x][24+7];
2291 for(i=1; i<9; i++){ 2313 for(i=1; i<9 - skiplast; i++){
2292 h->left_border[i+17 ]= src_cb[7+i*uvlinesize]; 2314 h->left_border[uvoffset+34 +i*step]= src_cb[7+i*uvlinesize];
2293 h->left_border[i+17+9]= src_cr[7+i*uvlinesize]; 2315 h->left_border[uvoffset+34+18+i*step]= src_cr[7+i*uvlinesize];
2294 } 2316 }
2295 *(uint64_t*)(h->top_borders[0][s->mb_x]+16)= *(uint64_t*)(src_cb+8*uvlinesize); 2317 *(uint64_t*)(h->top_borders[top_idx][s->mb_x]+16)= *(uint64_t*)(src_cb+8*uvlinesize);
2296 *(uint64_t*)(h->top_borders[0][s->mb_x]+24)= *(uint64_t*)(src_cr+8*uvlinesize); 2318 *(uint64_t*)(h->top_borders[top_idx][s->mb_x]+24)= *(uint64_t*)(src_cr+8*uvlinesize);
2297 } 2319 }
2298 } 2320 }
2299 2321
2300 static inline void xchg_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int xchg, int simple){ 2322 static inline void xchg_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int xchg, int simple){
2301 MpegEncContext * const s = &h->s; 2323 MpegEncContext * const s = &h->s;
2302 int temp8, i; 2324 int temp8, i;
2303 uint64_t temp64; 2325 uint64_t temp64;
2304 int deblock_left; 2326 int deblock_left;
2305 int deblock_top; 2327 int deblock_top;
2306 int mb_xy; 2328 int mb_xy;
2329 int step = 1;
2330 int offset = 1;
2331 int uvoffset= 1;
2332 int top_idx = 1;
2333
2334 if(!simple && FRAME_MBAFF){
2335 if(s->mb_y&1){
2336 offset = MB_MBAFF ? 1 : 17;
2337 uvoffset= MB_MBAFF ? 1 : 9;
2338 }else{
2339 offset =
2340 uvoffset=
2341 top_idx = MB_MBAFF ? 0 : 1;
2342 }
2343 step= MB_MBAFF ? 2 : 1;
2344 }
2307 2345
2308 if(h->deblocking_filter == 2) { 2346 if(h->deblocking_filter == 2) {
2309 mb_xy = h->mb_xy; 2347 mb_xy = h->mb_xy;
2310 deblock_left = h->slice_table[mb_xy] == h->slice_table[mb_xy - 1]; 2348 deblock_left = h->slice_table[mb_xy] == h->slice_table[mb_xy - 1];
2311 deblock_top = h->slice_table[mb_xy] == h->slice_table[h->top_mb_xy]; 2349 deblock_top = h->slice_table[mb_xy] == h->slice_table[h->top_mb_xy];
2323 if(xchg)\ 2361 if(xchg)\
2324 a= b;\ 2362 a= b;\
2325 b= t; 2363 b= t;
2326 2364
2327 if(deblock_left){ 2365 if(deblock_left){
2328 for(i = !deblock_top; i<17; i++){ 2366 for(i = !deblock_top; i<16; i++){
2329 XCHG(h->left_border[i ], src_y [i* linesize], temp8, xchg); 2367 XCHG(h->left_border[offset+i*step], src_y [i* linesize], temp8, xchg);
2330 } 2368 }
2369 XCHG(h->left_border[offset+i*step], src_y [i* linesize], temp8, 1);
2331 } 2370 }
2332 2371
2333 if(deblock_top){ 2372 if(deblock_top){
2334 XCHG(*(uint64_t*)(h->top_borders[0][s->mb_x]+0), *(uint64_t*)(src_y +1), temp64, xchg); 2373 XCHG(*(uint64_t*)(h->top_borders[top_idx][s->mb_x]+0), *(uint64_t*)(src_y +1), temp64, xchg);
2335 XCHG(*(uint64_t*)(h->top_borders[0][s->mb_x]+8), *(uint64_t*)(src_y +9), temp64, 1); 2374 XCHG(*(uint64_t*)(h->top_borders[top_idx][s->mb_x]+8), *(uint64_t*)(src_y +9), temp64, 1);
2336 if(s->mb_x+1 < s->mb_width){ 2375 if(s->mb_x+1 < s->mb_width){
2337 XCHG(*(uint64_t*)(h->top_borders[0][s->mb_x+1]), *(uint64_t*)(src_y +17), temp64, 1); 2376 XCHG(*(uint64_t*)(h->top_borders[top_idx][s->mb_x+1]), *(uint64_t*)(src_y +17), temp64, 1);
2338 } 2377 }
2339 } 2378 }
2340 2379
2341 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ 2380 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
2342 if(deblock_left){ 2381 if(deblock_left){
2343 for(i = !deblock_top; i<9; i++){ 2382 for(i = !deblock_top; i<8; i++){
2344 XCHG(h->left_border[i+17 ], src_cb[i*uvlinesize], temp8, xchg); 2383 XCHG(h->left_border[uvoffset+34 +i*step], src_cb[i*uvlinesize], temp8, xchg);
2345 XCHG(h->left_border[i+17+9], src_cr[i*uvlinesize], temp8, xchg); 2384 XCHG(h->left_border[uvoffset+34+18+i*step], src_cr[i*uvlinesize], temp8, xchg);
2346 } 2385 }
2386 XCHG(h->left_border[uvoffset+34 +i*step], src_cb[i*uvlinesize], temp8, 1);
2387 XCHG(h->left_border[uvoffset+34+18+i*step], src_cr[i*uvlinesize], temp8, 1);
2347 } 2388 }
2348 if(deblock_top){ 2389 if(deblock_top){
2349 XCHG(*(uint64_t*)(h->top_borders[0][s->mb_x]+16), *(uint64_t*)(src_cb+1), temp64, 1); 2390 XCHG(*(uint64_t*)(h->top_borders[top_idx][s->mb_x]+16), *(uint64_t*)(src_cb+1), temp64, 1);
2350 XCHG(*(uint64_t*)(h->top_borders[0][s->mb_x]+24), *(uint64_t*)(src_cr+1), temp64, 1); 2391 XCHG(*(uint64_t*)(h->top_borders[top_idx][s->mb_x]+24), *(uint64_t*)(src_cr+1), temp64, 1);
2351 }
2352 }
2353 }
2354
2355 static inline void backup_pair_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize){
2356 MpegEncContext * const s = &h->s;
2357 int i;
2358
2359 src_y -= 2 * linesize;
2360 src_cb -= 2 * uvlinesize;
2361 src_cr -= 2 * uvlinesize;
2362
2363 // There are two lines saved, the line above the the top macroblock of a pair,
2364 // and the line above the bottom macroblock
2365 h->left_border[0]= h->top_borders[0][s->mb_x][15];
2366 h->left_border[1]= h->top_borders[1][s->mb_x][15];
2367 for(i=2; i<34; i++){
2368 h->left_border[i]= src_y[15+i* linesize];
2369 }
2370
2371 *(uint64_t*)(h->top_borders[0][s->mb_x]+0)= *(uint64_t*)(src_y + 32*linesize);
2372 *(uint64_t*)(h->top_borders[0][s->mb_x]+8)= *(uint64_t*)(src_y +8+32*linesize);
2373 *(uint64_t*)(h->top_borders[1][s->mb_x]+0)= *(uint64_t*)(src_y + 33*linesize);
2374 *(uint64_t*)(h->top_borders[1][s->mb_x]+8)= *(uint64_t*)(src_y +8+33*linesize);
2375
2376 if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
2377 h->left_border[34 ]= h->top_borders[0][s->mb_x][16+7];
2378 h->left_border[34+ 1]= h->top_borders[1][s->mb_x][16+7];
2379 h->left_border[34+18 ]= h->top_borders[0][s->mb_x][24+7];
2380 h->left_border[34+18+1]= h->top_borders[1][s->mb_x][24+7];
2381 for(i=2; i<18; i++){
2382 h->left_border[i+34 ]= src_cb[7+i*uvlinesize];
2383 h->left_border[i+34+18]= src_cr[7+i*uvlinesize];
2384 }
2385 *(uint64_t*)(h->top_borders[0][s->mb_x]+16)= *(uint64_t*)(src_cb+16*uvlinesize);
2386 *(uint64_t*)(h->top_borders[0][s->mb_x]+24)= *(uint64_t*)(src_cr+16*uvlinesize);
2387 *(uint64_t*)(h->top_borders[1][s->mb_x]+16)= *(uint64_t*)(src_cb+17*uvlinesize);
2388 *(uint64_t*)(h->top_borders[1][s->mb_x]+24)= *(uint64_t*)(src_cr+17*uvlinesize);
2389 }
2390 }
2391
2392 static inline void xchg_pair_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int xchg){
2393 MpegEncContext * const s = &h->s;
2394 int temp8, i;
2395 uint64_t temp64;
2396 int deblock_left = (s->mb_x > 0);
2397 int deblock_top = (s->mb_y > 1);
2398
2399 tprintf(s->avctx, "xchg_pair_border: src_y:%p src_cb:%p src_cr:%p ls:%d uvls:%d\n", src_y, src_cb, src_cr, linesize, uvlinesize);
2400
2401 src_y -= 2 * linesize + 1;
2402 src_cb -= 2 * uvlinesize + 1;
2403 src_cr -= 2 * uvlinesize + 1;
2404
2405 #define XCHG(a,b,t,xchg)\
2406 t= a;\
2407 if(xchg)\
2408 a= b;\
2409 b= t;
2410
2411 if(deblock_left){
2412 for(i = (!deblock_top)<<1; i<34; i++){
2413 XCHG(h->left_border[i ], src_y [i* linesize], temp8, xchg);
2414 }
2415 }
2416
2417 if(deblock_top){
2418 XCHG(*(uint64_t*)(h->top_borders[0][s->mb_x]+0), *(uint64_t*)(src_y +1), temp64, xchg);
2419 XCHG(*(uint64_t*)(h->top_borders[0][s->mb_x]+8), *(uint64_t*)(src_y +9), temp64, 1);
2420 XCHG(*(uint64_t*)(h->top_borders[1][s->mb_x]+0), *(uint64_t*)(src_y +1 +linesize), temp64, xchg);
2421 XCHG(*(uint64_t*)(h->top_borders[1][s->mb_x]+8), *(uint64_t*)(src_y +9 +linesize), temp64, 1);
2422 if(s->mb_x+1 < s->mb_width){
2423 XCHG(*(uint64_t*)(h->top_borders[0][s->mb_x+1]), *(uint64_t*)(src_y +17), temp64, 1);
2424 XCHG(*(uint64_t*)(h->top_borders[1][s->mb_x+1]), *(uint64_t*)(src_y +17 +linesize), temp64, 1);
2425 }
2426 }
2427
2428 if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
2429 if(deblock_left){
2430 for(i = (!deblock_top) << 1; i<18; i++){
2431 XCHG(h->left_border[i+34 ], src_cb[i*uvlinesize], temp8, xchg);
2432 XCHG(h->left_border[i+34+18], src_cr[i*uvlinesize], temp8, xchg);
2433 }
2434 }
2435 if(deblock_top){
2436 XCHG(*(uint64_t*)(h->top_borders[0][s->mb_x]+16), *(uint64_t*)(src_cb+1), temp64, 1);
2437 XCHG(*(uint64_t*)(h->top_borders[0][s->mb_x]+24), *(uint64_t*)(src_cr+1), temp64, 1);
2438 XCHG(*(uint64_t*)(h->top_borders[1][s->mb_x]+16), *(uint64_t*)(src_cb+1 +uvlinesize), temp64, 1);
2439 XCHG(*(uint64_t*)(h->top_borders[1][s->mb_x]+24), *(uint64_t*)(src_cr+1 +uvlinesize), temp64, 1);
2440 } 2392 }
2441 } 2393 }
2442 } 2394 }
2443 2395
2444 static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){ 2396 static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
2505 }else{ 2457 }else{
2506 idct_dc_add = s->dsp.h264_idct_dc_add; 2458 idct_dc_add = s->dsp.h264_idct_dc_add;
2507 idct_add = s->dsp.h264_idct_add; 2459 idct_add = s->dsp.h264_idct_add;
2508 } 2460 }
2509 2461
2510 if(!simple && FRAME_MBAFF && h->deblocking_filter && IS_INTRA(mb_type)
2511 && (!bottom || !IS_INTRA(s->current_picture.mb_type[mb_xy-s->mb_stride]))){
2512 int mbt_y = mb_y&~1;
2513 uint8_t *top_y = s->current_picture.data[0] + (mbt_y * 16* s->linesize ) + mb_x * 16;
2514 uint8_t *top_cb = s->current_picture.data[1] + (mbt_y * 8 * s->uvlinesize) + mb_x * 8;
2515 uint8_t *top_cr = s->current_picture.data[2] + (mbt_y * 8 * s->uvlinesize) + mb_x * 8;
2516 xchg_pair_border(h, top_y, top_cb, top_cr, s->linesize, s->uvlinesize, 1);
2517 }
2518
2519 if (!simple && IS_INTRA_PCM(mb_type)) { 2462 if (!simple && IS_INTRA_PCM(mb_type)) {
2520 for (i=0; i<16; i++) { 2463 for (i=0; i<16; i++) {
2521 memcpy(dest_y + i* linesize, h->mb + i*8, 16); 2464 memcpy(dest_y + i* linesize, h->mb + i*8, 16);
2522 } 2465 }
2523 for (i=0; i<8; i++) { 2466 for (i=0; i<8; i++) {
2524 memcpy(dest_cb+ i*uvlinesize, h->mb + 128 + i*4, 8); 2467 memcpy(dest_cb+ i*uvlinesize, h->mb + 128 + i*4, 8);
2525 memcpy(dest_cr+ i*uvlinesize, h->mb + 160 + i*4, 8); 2468 memcpy(dest_cr+ i*uvlinesize, h->mb + 160 + i*4, 8);
2526 } 2469 }
2527 } else { 2470 } else {
2528 if(IS_INTRA(mb_type)){ 2471 if(IS_INTRA(mb_type)){
2529 if(h->deblocking_filter && (simple || !FRAME_MBAFF)) 2472 if(h->deblocking_filter)
2530 xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1, simple); 2473 xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1, simple);
2531 2474
2532 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ 2475 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
2533 h->hpc.pred8x8[ h->chroma_pred_mode ](dest_cb, uvlinesize); 2476 h->hpc.pred8x8[ h->chroma_pred_mode ](dest_cb, uvlinesize);
2534 h->hpc.pred8x8[ h->chroma_pred_mode ](dest_cr, uvlinesize); 2477 h->hpc.pred8x8[ h->chroma_pred_mode ](dest_cr, uvlinesize);
2587 if(!transform_bypass) 2530 if(!transform_bypass)
2588 h264_luma_dc_dequant_idct_c(h->mb, s->qscale, h->dequant4_coeff[0][s->qscale][0]); 2531 h264_luma_dc_dequant_idct_c(h->mb, s->qscale, h->dequant4_coeff[0][s->qscale][0]);
2589 }else 2532 }else
2590 svq3_luma_dc_dequant_idct_c(h->mb, s->qscale); 2533 svq3_luma_dc_dequant_idct_c(h->mb, s->qscale);
2591 } 2534 }
2592 if(h->deblocking_filter && (simple || !FRAME_MBAFF)) 2535 if(h->deblocking_filter)
2593 xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0, simple); 2536 xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0, simple);
2594 }else if(is_h264){ 2537 }else if(is_h264){
2595 hl_motion(h, dest_y, dest_cb, dest_cr, 2538 hl_motion(h, dest_y, dest_cb, dest_cr,
2596 s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab, 2539 s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
2597 s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab, 2540 s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
2656 } 2599 }
2657 } 2600 }
2658 } 2601 }
2659 } 2602 }
2660 if(h->deblocking_filter) { 2603 if(h->deblocking_filter) {
2604 backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, simple);
2605 fill_caches(h, mb_type, 1); //FIXME don't fill stuff which isn't used by filter_mb
2606 h->chroma_qp[0] = get_chroma_qp(h, 0, s->current_picture.qscale_table[mb_xy]);
2607 h->chroma_qp[1] = get_chroma_qp(h, 1, s->current_picture.qscale_table[mb_xy]);
2661 if (!simple && FRAME_MBAFF) { 2608 if (!simple && FRAME_MBAFF) {
2662 //FIXME try deblocking one mb at a time? 2609 filter_mb (h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize);
2663 // the reduction in load/storing mvs and such might outweigh the extra backup/xchg_border
2664 const int mb_y = s->mb_y - 1;
2665 uint8_t *pair_dest_y, *pair_dest_cb, *pair_dest_cr;
2666 const int mb_xy= mb_x + mb_y*s->mb_stride;
2667 const int mb_type_top = s->current_picture.mb_type[mb_xy];
2668 const int mb_type_bottom= s->current_picture.mb_type[mb_xy+s->mb_stride];
2669 if (!bottom) return;
2670 pair_dest_y = s->current_picture.data[0] + (mb_y * 16* s->linesize ) + mb_x * 16;
2671 pair_dest_cb = s->current_picture.data[1] + (mb_y * 8 * s->uvlinesize) + mb_x * 8;
2672 pair_dest_cr = s->current_picture.data[2] + (mb_y * 8 * s->uvlinesize) + mb_x * 8;
2673
2674 if(IS_INTRA(mb_type_top | mb_type_bottom))
2675 xchg_pair_border(h, pair_dest_y, pair_dest_cb, pair_dest_cr, s->linesize, s->uvlinesize, 0);
2676
2677 backup_pair_border(h, pair_dest_y, pair_dest_cb, pair_dest_cr, s->linesize, s->uvlinesize);
2678 // deblock a pair
2679 // top
2680 s->mb_y--; h->mb_xy -= s->mb_stride;
2681 tprintf(h->s.avctx, "call mbaff filter_mb mb_x:%d mb_y:%d pair_dest_y = %p, dest_y = %p\n", mb_x, mb_y, pair_dest_y, dest_y);
2682 fill_caches(h, mb_type_top, 1); //FIXME don't fill stuff which isn't used by filter_mb
2683 h->chroma_qp[0] = get_chroma_qp(h, 0, s->current_picture.qscale_table[mb_xy]);
2684 h->chroma_qp[1] = get_chroma_qp(h, 1, s->current_picture.qscale_table[mb_xy]);
2685 filter_mb(h, mb_x, mb_y, pair_dest_y, pair_dest_cb, pair_dest_cr, linesize, uvlinesize);
2686 // bottom
2687 s->mb_y++; h->mb_xy += s->mb_stride;
2688 tprintf(h->s.avctx, "call mbaff filter_mb\n");
2689 fill_caches(h, mb_type_bottom, 1); //FIXME don't fill stuff which isn't used by filter_mb
2690 h->chroma_qp[0] = get_chroma_qp(h, 0, s->current_picture.qscale_table[mb_xy+s->mb_stride]);
2691 h->chroma_qp[1] = get_chroma_qp(h, 1, s->current_picture.qscale_table[mb_xy+s->mb_stride]);
2692 filter_mb(h, mb_x, mb_y+1, dest_y, dest_cb, dest_cr, linesize, uvlinesize);
2693 } else { 2610 } else {
2694 tprintf(h->s.avctx, "call filter_mb\n");
2695 backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, simple);
2696 fill_caches(h, mb_type, 1); //FIXME don't fill stuff which isn't used by filter_mb
2697 h->chroma_qp[0] = get_chroma_qp(h, 0, s->current_picture.qscale_table[mb_xy]);
2698 h->chroma_qp[1] = get_chroma_qp(h, 1, s->current_picture.qscale_table[mb_xy]);
2699 filter_mb_fast(h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize); 2611 filter_mb_fast(h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize);
2700 } 2612 }
2701 } 2613 }
2702 } 2614 }
2703 2615