Mercurial > libavcodec.hg
comparison h264.c @ 5434:4f2e3ef72b32 libavcodec
use ENABLE_GRAY
author | michael |
---|---|
date | Wed, 01 Aug 2007 01:01:03 +0000 |
parents | 1fdfea5024a7 |
children | 07cd560e9a8c |
comparison
equal
deleted
inserted
replaced
5433:ce0db8111f94 | 5434:4f2e3ef72b32 |
---|---|
2430 qpix_op[luma_xy](dest_y, src_y, h->mb_linesize); //FIXME try variable height perhaps? | 2430 qpix_op[luma_xy](dest_y, src_y, h->mb_linesize); //FIXME try variable height perhaps? |
2431 if(!square){ | 2431 if(!square){ |
2432 qpix_op[luma_xy](dest_y + delta, src_y + delta, h->mb_linesize); | 2432 qpix_op[luma_xy](dest_y + delta, src_y + delta, h->mb_linesize); |
2433 } | 2433 } |
2434 | 2434 |
2435 if(s->flags&CODEC_FLAG_GRAY) return; | 2435 if(ENABLE_GRAY && s->flags&CODEC_FLAG_GRAY) return; |
2436 | 2436 |
2437 if(MB_MBAFF){ | 2437 if(MB_MBAFF){ |
2438 // chroma offset when predicting from a field of opposite parity | 2438 // chroma offset when predicting from a field of opposite parity |
2439 my += 2 * ((s->mb_y & 1) - (h->ref_cache[list][scan8[n]] & 1)); | 2439 my += 2 * ((s->mb_y & 1) - (h->ref_cache[list][scan8[n]] & 1)); |
2440 emu |= (my>>3) < 0 || (my>>3) + 8 >= (pic_height>>1); | 2440 emu |= (my>>3) < 0 || (my>>3) + 8 >= (pic_height>>1); |
3005 } | 3005 } |
3006 | 3006 |
3007 *(uint64_t*)(h->top_borders[0][s->mb_x]+0)= *(uint64_t*)(src_y + 16*linesize); | 3007 *(uint64_t*)(h->top_borders[0][s->mb_x]+0)= *(uint64_t*)(src_y + 16*linesize); |
3008 *(uint64_t*)(h->top_borders[0][s->mb_x]+8)= *(uint64_t*)(src_y +8+16*linesize); | 3008 *(uint64_t*)(h->top_borders[0][s->mb_x]+8)= *(uint64_t*)(src_y +8+16*linesize); |
3009 | 3009 |
3010 if(simple || !(s->flags&CODEC_FLAG_GRAY)){ | 3010 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ |
3011 h->left_border[17 ]= h->top_borders[0][s->mb_x][16+7]; | 3011 h->left_border[17 ]= h->top_borders[0][s->mb_x][16+7]; |
3012 h->left_border[17+9]= h->top_borders[0][s->mb_x][24+7]; | 3012 h->left_border[17+9]= h->top_borders[0][s->mb_x][24+7]; |
3013 for(i=1; i<9; i++){ | 3013 for(i=1; i<9; i++){ |
3014 h->left_border[i+17 ]= src_cb[7+i*uvlinesize]; | 3014 h->left_border[i+17 ]= src_cb[7+i*uvlinesize]; |
3015 h->left_border[i+17+9]= src_cr[7+i*uvlinesize]; | 3015 h->left_border[i+17+9]= src_cr[7+i*uvlinesize]; |
3058 if(s->mb_x+1 < s->mb_width){ | 3058 if(s->mb_x+1 < s->mb_width){ |
3059 XCHG(*(uint64_t*)(h->top_borders[0][s->mb_x+1]), *(uint64_t*)(src_y +17), temp64, 1); | 3059 XCHG(*(uint64_t*)(h->top_borders[0][s->mb_x+1]), *(uint64_t*)(src_y +17), temp64, 1); |
3060 } | 3060 } |
3061 } | 3061 } |
3062 | 3062 |
3063 if(simple || !(s->flags&CODEC_FLAG_GRAY)){ | 3063 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ |
3064 if(deblock_left){ | 3064 if(deblock_left){ |
3065 for(i = !deblock_top; i<9; i++){ | 3065 for(i = !deblock_top; i<9; i++){ |
3066 XCHG(h->left_border[i+17 ], src_cb[i*uvlinesize], temp8, xchg); | 3066 XCHG(h->left_border[i+17 ], src_cb[i*uvlinesize], temp8, xchg); |
3067 XCHG(h->left_border[i+17+9], src_cr[i*uvlinesize], temp8, xchg); | 3067 XCHG(h->left_border[i+17+9], src_cr[i*uvlinesize], temp8, xchg); |
3068 } | 3068 } |
3093 *(uint64_t*)(h->top_borders[0][s->mb_x]+0)= *(uint64_t*)(src_y + 32*linesize); | 3093 *(uint64_t*)(h->top_borders[0][s->mb_x]+0)= *(uint64_t*)(src_y + 32*linesize); |
3094 *(uint64_t*)(h->top_borders[0][s->mb_x]+8)= *(uint64_t*)(src_y +8+32*linesize); | 3094 *(uint64_t*)(h->top_borders[0][s->mb_x]+8)= *(uint64_t*)(src_y +8+32*linesize); |
3095 *(uint64_t*)(h->top_borders[1][s->mb_x]+0)= *(uint64_t*)(src_y + 33*linesize); | 3095 *(uint64_t*)(h->top_borders[1][s->mb_x]+0)= *(uint64_t*)(src_y + 33*linesize); |
3096 *(uint64_t*)(h->top_borders[1][s->mb_x]+8)= *(uint64_t*)(src_y +8+33*linesize); | 3096 *(uint64_t*)(h->top_borders[1][s->mb_x]+8)= *(uint64_t*)(src_y +8+33*linesize); |
3097 | 3097 |
3098 if(!(s->flags&CODEC_FLAG_GRAY)){ | 3098 if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ |
3099 h->left_border[34 ]= h->top_borders[0][s->mb_x][16+7]; | 3099 h->left_border[34 ]= h->top_borders[0][s->mb_x][16+7]; |
3100 h->left_border[34+ 1]= h->top_borders[1][s->mb_x][16+7]; | 3100 h->left_border[34+ 1]= h->top_borders[1][s->mb_x][16+7]; |
3101 h->left_border[34+18 ]= h->top_borders[0][s->mb_x][24+7]; | 3101 h->left_border[34+18 ]= h->top_borders[0][s->mb_x][24+7]; |
3102 h->left_border[34+18+1]= h->top_borders[1][s->mb_x][24+7]; | 3102 h->left_border[34+18+1]= h->top_borders[1][s->mb_x][24+7]; |
3103 for(i=2; i<18; i++){ | 3103 for(i=2; i<18; i++){ |
3145 XCHG(*(uint64_t*)(h->top_borders[0][s->mb_x+1]), *(uint64_t*)(src_y +17), temp64, 1); | 3145 XCHG(*(uint64_t*)(h->top_borders[0][s->mb_x+1]), *(uint64_t*)(src_y +17), temp64, 1); |
3146 XCHG(*(uint64_t*)(h->top_borders[1][s->mb_x+1]), *(uint64_t*)(src_y +17 +linesize), temp64, 1); | 3146 XCHG(*(uint64_t*)(h->top_borders[1][s->mb_x+1]), *(uint64_t*)(src_y +17 +linesize), temp64, 1); |
3147 } | 3147 } |
3148 } | 3148 } |
3149 | 3149 |
3150 if(!(s->flags&CODEC_FLAG_GRAY)){ | 3150 if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ |
3151 if(deblock_left){ | 3151 if(deblock_left){ |
3152 for(i = (!deblock_top) << 1; i<18; i++){ | 3152 for(i = (!deblock_top) << 1; i<18; i++){ |
3153 XCHG(h->left_border[i+34 ], src_cb[i*uvlinesize], temp8, xchg); | 3153 XCHG(h->left_border[i+34 ], src_cb[i*uvlinesize], temp8, xchg); |
3154 XCHG(h->left_border[i+34+18], src_cr[i*uvlinesize], temp8, xchg); | 3154 XCHG(h->left_border[i+34+18], src_cr[i*uvlinesize], temp8, xchg); |
3155 } | 3155 } |
3267 } else { | 3267 } else { |
3268 if(IS_INTRA(mb_type)){ | 3268 if(IS_INTRA(mb_type)){ |
3269 if(h->deblocking_filter && (simple || !FRAME_MBAFF)) | 3269 if(h->deblocking_filter && (simple || !FRAME_MBAFF)) |
3270 xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1, simple); | 3270 xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1, simple); |
3271 | 3271 |
3272 if(simple || !(s->flags&CODEC_FLAG_GRAY)){ | 3272 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ |
3273 h->pred8x8[ h->chroma_pred_mode ](dest_cb, uvlinesize); | 3273 h->pred8x8[ h->chroma_pred_mode ](dest_cb, uvlinesize); |
3274 h->pred8x8[ h->chroma_pred_mode ](dest_cr, uvlinesize); | 3274 h->pred8x8[ h->chroma_pred_mode ](dest_cr, uvlinesize); |
3275 } | 3275 } |
3276 | 3276 |
3277 if(IS_INTRA4x4(mb_type)){ | 3277 if(IS_INTRA4x4(mb_type)){ |
3368 } | 3368 } |
3369 } | 3369 } |
3370 } | 3370 } |
3371 } | 3371 } |
3372 | 3372 |
3373 if(simple || !(s->flags&CODEC_FLAG_GRAY)){ | 3373 if(simple || !ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ |
3374 uint8_t *dest[2] = {dest_cb, dest_cr}; | 3374 uint8_t *dest[2] = {dest_cb, dest_cr}; |
3375 if(transform_bypass){ | 3375 if(transform_bypass){ |
3376 idct_add = idct_dc_add = s->dsp.add_pixels4; | 3376 idct_add = idct_dc_add = s->dsp.add_pixels4; |
3377 }else{ | 3377 }else{ |
3378 idct_add = s->dsp.h264_idct_add; | 3378 idct_add = s->dsp.h264_idct_add; |
3457 MpegEncContext * const s = &h->s; | 3457 MpegEncContext * const s = &h->s; |
3458 const int mb_x= s->mb_x; | 3458 const int mb_x= s->mb_x; |
3459 const int mb_y= s->mb_y; | 3459 const int mb_y= s->mb_y; |
3460 const int mb_xy= mb_x + mb_y*s->mb_stride; | 3460 const int mb_xy= mb_x + mb_y*s->mb_stride; |
3461 const int mb_type= s->current_picture.mb_type[mb_xy]; | 3461 const int mb_type= s->current_picture.mb_type[mb_xy]; |
3462 int is_complex = FRAME_MBAFF || MB_FIELD || IS_INTRA_PCM(mb_type) || s->codec_id != CODEC_ID_H264 || (s->flags&CODEC_FLAG_GRAY) || s->encoding; | 3462 int is_complex = FRAME_MBAFF || MB_FIELD || IS_INTRA_PCM(mb_type) || s->codec_id != CODEC_ID_H264 || (ENABLE_GRAY && (s->flags&CODEC_FLAG_GRAY)) || s->encoding; |
3463 | 3463 |
3464 if(!s->decode) | 3464 if(!s->decode) |
3465 return; | 3465 return; |
3466 | 3466 |
3467 if (is_complex) | 3467 if (is_complex) |