comparison h264.c @ 8379:be5e0a75b457 libavcodec

Do not calculate idct_dc_add/idct_add when the variables are unused.
author michael
date Thu, 18 Dec 2008 04:13:02 +0000
parents 9c6512be76b4
children fe7d1c920aeb
comparison
equal deleted inserted replaced
8378:9c6512be76b4 8379:be5e0a75b457
2408 linesize = h->mb_linesize = s->linesize; 2408 linesize = h->mb_linesize = s->linesize;
2409 uvlinesize = h->mb_uvlinesize = s->uvlinesize; 2409 uvlinesize = h->mb_uvlinesize = s->uvlinesize;
2410 // dct_offset = s->linesize * 16; 2410 // dct_offset = s->linesize * 16;
2411 } 2411 }
2412 2412
2413 if(transform_bypass){
2414 idct_dc_add =
2415 idct_add = IS_8x8DCT(mb_type) ? s->dsp.add_pixels8 : s->dsp.add_pixels4;
2416 }else if(IS_8x8DCT(mb_type)){
2417 idct_dc_add = s->dsp.h264_idct8_dc_add;
2418 idct_add = s->dsp.h264_idct8_add;
2419 }else{
2420 idct_dc_add = s->dsp.h264_idct_dc_add;
2421 idct_add = s->dsp.h264_idct_add;
2422 }
2423
2424 if (!simple && IS_INTRA_PCM(mb_type)) { 2413 if (!simple && IS_INTRA_PCM(mb_type)) {
2425 for (i=0; i<16; i++) { 2414 for (i=0; i<16; i++) {
2426 memcpy(dest_y + i* linesize, h->mb + i*8, 16); 2415 memcpy(dest_y + i* linesize, h->mb + i*8, 16);
2427 } 2416 }
2428 for (i=0; i<8; i++) { 2417 for (i=0; i<8; i++) {
2440 } 2429 }
2441 2430
2442 if(IS_INTRA4x4(mb_type)){ 2431 if(IS_INTRA4x4(mb_type)){
2443 if(simple || !s->encoding){ 2432 if(simple || !s->encoding){
2444 if(IS_8x8DCT(mb_type)){ 2433 if(IS_8x8DCT(mb_type)){
2434 if(transform_bypass){
2435 idct_dc_add =
2436 idct_add = s->dsp.add_pixels8;
2437 }else if(IS_8x8DCT(mb_type)){
2438 idct_dc_add = s->dsp.h264_idct8_dc_add;
2439 idct_add = s->dsp.h264_idct8_add;
2440 }
2445 for(i=0; i<16; i+=4){ 2441 for(i=0; i<16; i+=4){
2446 uint8_t * const ptr= dest_y + block_offset[i]; 2442 uint8_t * const ptr= dest_y + block_offset[i];
2447 const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ]; 2443 const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ];
2448 if(transform_bypass && h->sps.profile_idc==244 && dir<=1){ 2444 if(transform_bypass && h->sps.profile_idc==244 && dir<=1){
2449 h->hpc.pred8x8l_add[dir](ptr, h->mb + i*16, linesize); 2445 h->hpc.pred8x8l_add[dir](ptr, h->mb + i*16, linesize);
2457 else 2453 else
2458 idct_add (ptr, h->mb + i*16, linesize); 2454 idct_add (ptr, h->mb + i*16, linesize);
2459 } 2455 }
2460 } 2456 }
2461 } 2457 }
2462 }else 2458 }else{
2459 if(transform_bypass){
2460 idct_dc_add =
2461 idct_add = s->dsp.add_pixels4;
2462 }else{
2463 idct_dc_add = s->dsp.h264_idct_dc_add;
2464 idct_add = s->dsp.h264_idct_add;
2465 }
2463 for(i=0; i<16; i++){ 2466 for(i=0; i<16; i++){
2464 uint8_t * const ptr= dest_y + block_offset[i]; 2467 uint8_t * const ptr= dest_y + block_offset[i];
2465 const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ]; 2468 const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ];
2466 2469
2467 if(transform_bypass && h->sps.profile_idc==244 && dir<=1){ 2470 if(transform_bypass && h->sps.profile_idc==244 && dir<=1){
2491 }else 2494 }else
2492 svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, 0); 2495 svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, 0);
2493 } 2496 }
2494 } 2497 }
2495 } 2498 }
2499 }
2496 } 2500 }
2497 }else{ 2501 }else{
2498 h->hpc.pred16x16[ h->intra16x16_pred_mode ](dest_y , linesize); 2502 h->hpc.pred16x16[ h->intra16x16_pred_mode ](dest_y , linesize);
2499 if(is_h264){ 2503 if(is_h264){
2500 if(!transform_bypass) 2504 if(!transform_bypass)
2519 if(h->sps.profile_idc==244 && (h->intra16x16_pred_mode==VERT_PRED8x8 || h->intra16x16_pred_mode==HOR_PRED8x8)){ 2523 if(h->sps.profile_idc==244 && (h->intra16x16_pred_mode==VERT_PRED8x8 || h->intra16x16_pred_mode==HOR_PRED8x8)){
2520 h->hpc.pred16x16_add[h->intra16x16_pred_mode](dest_y, block_offset, h->mb, linesize); 2524 h->hpc.pred16x16_add[h->intra16x16_pred_mode](dest_y, block_offset, h->mb, linesize);
2521 }else{ 2525 }else{
2522 for(i=0; i<16; i++){ 2526 for(i=0; i<16; i++){
2523 if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]) 2527 if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16])
2524 idct_add(dest_y + block_offset[i], h->mb + i*16, linesize); 2528 s->dsp.add_pixels4(dest_y + block_offset[i], h->mb + i*16, linesize);
2525 } 2529 }
2526 } 2530 }
2527 }else{ 2531 }else{
2528 s->dsp.h264_idct_add16intra(dest_y, block_offset, h->mb, linesize, h->non_zero_count_cache); 2532 s->dsp.h264_idct_add16intra(dest_y, block_offset, h->mb, linesize, h->non_zero_count_cache);
2529 } 2533 }
2530 }else if(h->cbp&15){ 2534 }else if(h->cbp&15){
2531 if(transform_bypass){ 2535 if(transform_bypass){
2532 const int di = IS_8x8DCT(mb_type) ? 4 : 1; 2536 const int di = IS_8x8DCT(mb_type) ? 4 : 1;
2537 idct_add= IS_8x8DCT(mb_type) ? s->dsp.add_pixels8 : s->dsp.add_pixels4;
2533 for(i=0; i<16; i+=di){ 2538 for(i=0; i<16; i+=di){
2534 if(h->non_zero_count_cache[ scan8[i] ]){ 2539 if(h->non_zero_count_cache[ scan8[i] ]){
2535 idct_add(dest_y + block_offset[i], h->mb + i*16, linesize); 2540 idct_add(dest_y + block_offset[i], h->mb + i*16, linesize);
2536 } 2541 }
2537 } 2542 }