summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-08-11 02:52:14 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-08-11 02:52:14 +0000
commitfaa7e3946690c5b42cb815d7c48cc9a91f89c9bd (patch)
tree4602a1239e6a9d886530e162f02f88babfa37b14 /libavcodec/h264.c
parentd1d10e9125153d0000be34c78c92c54d59d38108 (diff)
Simplify constrained_intra_pred code in fill_caches().
Originally committed as revision 14688 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index b24e4910fc..746c28a228 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -207,23 +207,24 @@ static void fill_caches(H264Context *h, int mb_type, int for_deblock){
}
if(IS_INTRA(mb_type)){
+ int type_mask= h->pps.constrained_intra_pred ? IS_INTRA(-1) : -1;
h->topleft_samples_available=
h->top_samples_available=
h->left_samples_available= 0xFFFF;
h->topright_samples_available= 0xEEEA;
- if(!IS_INTRA(top_type) && (top_type==0 || h->pps.constrained_intra_pred)){
+ if(!(top_type & type_mask)){
h->topleft_samples_available= 0xB3FF;
h->top_samples_available= 0x33FF;
h->topright_samples_available= 0x26EA;
}
if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[0])){
if(IS_INTERLACED(mb_type)){
- if(!IS_INTRA(left_type[0]) && (left_type[0]==0 || h->pps.constrained_intra_pred)){
+ if(!(left_type[0] & type_mask)){
h->topleft_samples_available&= 0xDFFF;
h->left_samples_available&= 0x5FFF;
}
- if(!IS_INTRA(left_type[1]) && (left_type[1]==0 || h->pps.constrained_intra_pred)){
+ if(!(left_type[1] & type_mask)){
h->topleft_samples_available&= 0xFF5F;
h->left_samples_available&= 0xFF5F;
}
@@ -231,22 +232,22 @@ static void fill_caches(H264Context *h, int mb_type, int for_deblock){
int left_typei = h->slice_table[left_xy[0] + s->mb_stride ] == h->slice_num
? s->current_picture.mb_type[left_xy[0] + s->mb_stride] : 0;
assert(left_xy[0] == left_xy[1]);
- if(!(IS_INTRA(left_typei) && IS_INTRA(left_type[0])) && (left_typei==0 || h->pps.constrained_intra_pred)){
+ if(!((left_typei & type_mask) && (left_type[0] & type_mask))){
h->topleft_samples_available&= 0xDF5F;
h->left_samples_available&= 0x5F5F;
}
}
}else{
- if(!IS_INTRA(left_type[0]) && (left_type[0]==0 || h->pps.constrained_intra_pred)){
+ if(!(left_type[0] & type_mask)){
h->topleft_samples_available&= 0xDF5F;
h->left_samples_available&= 0x5F5F;
}
}
- if(!IS_INTRA(topleft_type) && (topleft_type==0 || h->pps.constrained_intra_pred))
+ if(!(topleft_type & type_mask))
h->topleft_samples_available&= 0x7FFF;
- if(!IS_INTRA(topright_type) && (topright_type==0 || h->pps.constrained_intra_pred))
+ if(!(topright_type & type_mask))
h->topright_samples_available&= 0xFBFF;
if(IS_INTRA4x4(mb_type)){
@@ -257,7 +258,7 @@ static void fill_caches(H264Context *h, int mb_type, int for_deblock){
h->intra4x4_pred_mode_cache[7+8*0]= h->intra4x4_pred_mode[top_xy][3];
}else{
int pred;
- if(!top_type || (IS_INTER(top_type) && h->pps.constrained_intra_pred))
+ if(!(top_type & type_mask))
pred= -1;
else{
pred= 2;
@@ -273,7 +274,7 @@ static void fill_caches(H264Context *h, int mb_type, int for_deblock){
h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[1+2*i]];
}else{
int pred;
- if(!left_type[i] || (IS_INTER(left_type[i]) && h->pps.constrained_intra_pred))
+ if(!(left_type[i] & type_mask))
pred= -1;
else{
pred= 2;