Mercurial > libavcodec.hg
comparison h264.c @ 7532:c4de4b187b4f libavcodec
Support MBAFF + constrained intra prediction.
(no i would not have tried to implement this had i known what mess it is)
fixes at least:
CAMACI3_Sony_C
author | michael |
---|---|
date | Mon, 11 Aug 2008 02:21:33 +0000 |
parents | 553ec99ac3b0 |
children | e61de3e409eb |
comparison
equal
deleted
inserted
replaced
7531:63c782094e3a | 7532:c4de4b187b4f |
---|---|
215 if(!IS_INTRA(top_type) && (top_type==0 || h->pps.constrained_intra_pred)){ | 215 if(!IS_INTRA(top_type) && (top_type==0 || h->pps.constrained_intra_pred)){ |
216 h->topleft_samples_available= 0xB3FF; | 216 h->topleft_samples_available= 0xB3FF; |
217 h->top_samples_available= 0x33FF; | 217 h->top_samples_available= 0x33FF; |
218 h->topright_samples_available= 0x26EA; | 218 h->topright_samples_available= 0x26EA; |
219 } | 219 } |
220 for(i=0; i<2; i++){ | 220 if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[0])){ |
221 if(!IS_INTRA(left_type[i]) && (left_type[i]==0 || h->pps.constrained_intra_pred)){ | 221 if(IS_INTERLACED(mb_type)){ |
222 if(!IS_INTRA(left_type[0]) && (left_type[0]==0 || h->pps.constrained_intra_pred)){ | |
223 h->topleft_samples_available&= 0xDFFF; | |
224 h->left_samples_available&= 0x5FFF; | |
225 } | |
226 if(!IS_INTRA(left_type[1]) && (left_type[1]==0 || h->pps.constrained_intra_pred)){ | |
227 h->topleft_samples_available&= 0xFF5F; | |
228 h->left_samples_available&= 0xFF5F; | |
229 } | |
230 }else{ | |
231 int left_typei = h->slice_table[left_xy[0] + s->mb_stride ] == h->slice_num | |
232 ? s->current_picture.mb_type[left_xy[0] + s->mb_stride] : 0; | |
233 assert(left_xy[0] == left_xy[1]); | |
234 if(!(IS_INTRA(left_typei) && IS_INTRA(left_type[0])) && (left_typei==0 || h->pps.constrained_intra_pred)){ | |
235 h->topleft_samples_available&= 0xDF5F; | |
236 h->left_samples_available&= 0x5F5F; | |
237 } | |
238 } | |
239 }else{ | |
240 if(!IS_INTRA(left_type[0]) && (left_type[0]==0 || h->pps.constrained_intra_pred)){ | |
222 h->topleft_samples_available&= 0xDF5F; | 241 h->topleft_samples_available&= 0xDF5F; |
223 h->left_samples_available&= 0x5F5F; | 242 h->left_samples_available&= 0x5F5F; |
224 } | 243 } |
225 } | 244 } |
226 | 245 |
563 h->intra4x4_pred_mode_cache[scan8[0] + i]= status; | 582 h->intra4x4_pred_mode_cache[scan8[0] + i]= status; |
564 } | 583 } |
565 } | 584 } |
566 } | 585 } |
567 | 586 |
568 if(!(h->left_samples_available&0x8000)){ | 587 if((h->left_samples_available&0x8888)!=0x8888){ |
588 static const int mask[4]={0x8000,0x2000,0x80,0x20}; | |
569 for(i=0; i<4; i++){ | 589 for(i=0; i<4; i++){ |
590 if(!(h->left_samples_available&mask[i])){ | |
570 int status= left[ h->intra4x4_pred_mode_cache[scan8[0] + 8*i] ]; | 591 int status= left[ h->intra4x4_pred_mode_cache[scan8[0] + 8*i] ]; |
571 if(status<0){ | 592 if(status<0){ |
572 av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y); | 593 av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y); |
573 return -1; | 594 return -1; |
574 } else if(status){ | 595 } else if(status){ |
575 h->intra4x4_pred_mode_cache[scan8[0] + 8*i]= status; | 596 h->intra4x4_pred_mode_cache[scan8[0] + 8*i]= status; |
597 } | |
576 } | 598 } |
577 } | 599 } |
578 } | 600 } |
579 | 601 |
580 return 0; | 602 return 0; |
599 av_log(h->s.avctx, AV_LOG_ERROR, "top block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y); | 621 av_log(h->s.avctx, AV_LOG_ERROR, "top block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y); |
600 return -1; | 622 return -1; |
601 } | 623 } |
602 } | 624 } |
603 | 625 |
604 if(!(h->left_samples_available&0x8000)){ | 626 if((h->left_samples_available&0x8080) != 0x8080){ |
605 mode= left[ mode ]; | 627 mode= left[ mode ]; |
628 if(h->left_samples_available&0x8080){ //mad cow disease mode, aka MBAFF + constrained_intra_pred | |
629 mode= ALZHEIMER_DC_L0T_PRED8x8 + (!(h->left_samples_available&0x8000)) + 2*(mode == DC_128_PRED8x8); | |
630 } | |
606 if(mode<0){ | 631 if(mode<0){ |
607 av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y); | 632 av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y); |
608 return -1; | 633 return -1; |
609 } | 634 } |
610 } | 635 } |