aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-03-21 15:46:28 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-21 15:48:13 +0100
commit4c5c913dd8d946022ba160ec480694222aab061d (patch)
tree9a334723d85f05425e9d43bad3f18d1435d96f36 /libavcodec
parentf5d4d618242f412626f65e5f9b5a069448bf219b (diff)
parente7226984ac13aacb84eae77a372df8ff7685848f (diff)
downloadffmpeg-4c5c913dd8d946022ba160ec480694222aab061d.tar.gz
Merge commit 'e7226984ac13aacb84eae77a372df8ff7685848f'
* commit 'e7226984ac13aacb84eae77a372df8ff7685848f': h264: move [{top,left}_]cbp into the per-slice context Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.h8
-rw-r--r--libavcodec/h264_cabac.c18
-rw-r--r--libavcodec/h264_cavlc.c2
-rw-r--r--libavcodec/h264_loopfilter.c6
-rw-r--r--libavcodec/h264_mb.c2
-rw-r--r--libavcodec/h264_mb_template.c2
-rw-r--r--libavcodec/h264_mvpred.h8
-rw-r--r--libavcodec/h264_slice.c10
-rw-r--r--libavcodec/svq3.c4
9 files changed, 31 insertions, 29 deletions
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 4b3bf97d61..d43713de6e 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -396,6 +396,10 @@ typedef struct H264SliceContext {
int col_parity;
int col_fieldoff;
+ int cbp;
+ int top_cbp;
+ int left_cbp;
+
int dist_scale_factor[32];
int dist_scale_factor_field[2][32];
int map_col_to_list0[2][16 + 32];
@@ -527,9 +531,7 @@ typedef struct H264Context {
/* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0, 1, 2), 0x0? luma_cbp */
uint16_t *cbp_table;
- int cbp;
- int top_cbp;
- int left_cbp;
+
/* chroma_pred_mode for i4x4 or i16x16, else 0 */
uint8_t *chroma_pred_mode_table;
int last_qscale_diff;
diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
index fea08af49e..c6b0cb09ca 100644
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@ -1406,8 +1406,8 @@ static int decode_cabac_mb_cbp_luma(H264Context *h, H264SliceContext *sl)
{
int cbp_b, cbp_a, ctx, cbp = 0;
- cbp_a = h->left_cbp;
- cbp_b = h->top_cbp;
+ cbp_a = sl->left_cbp;
+ cbp_b = sl->top_cbp;
ctx = !(cbp_a & 0x02) + 2 * !(cbp_b & 0x04);
cbp += get_cabac_noinline(&sl->cabac, &sl->cabac_state[73 + ctx]);
@@ -1424,8 +1424,8 @@ static int decode_cabac_mb_cbp_chroma(H264Context *h, H264SliceContext *sl)
int ctx;
int cbp_a, cbp_b;
- cbp_a = (h->left_cbp>>4)&0x03;
- cbp_b = (h-> top_cbp>>4)&0x03;
+ cbp_a = (sl->left_cbp>>4)&0x03;
+ cbp_b = (sl-> top_cbp>>4)&0x03;
ctx = 0;
if( cbp_a > 0 ) ctx++;
@@ -1555,12 +1555,12 @@ static av_always_inline int get_cabac_cbf_ctx(H264Context *h, H264SliceContext *
if( is_dc ) {
if( cat == 3 ) {
idx -= CHROMA_DC_BLOCK_INDEX;
- nza = (h->left_cbp>>(6+idx))&0x01;
- nzb = (h-> top_cbp>>(6+idx))&0x01;
+ nza = (sl->left_cbp>>(6+idx))&0x01;
+ nzb = (sl-> top_cbp>>(6+idx))&0x01;
} else {
idx -= LUMA_DC_BLOCK_INDEX;
- nza = h->left_cbp&(0x100<<idx);
- nzb = h-> top_cbp&(0x100<<idx);
+ nza = sl->left_cbp&(0x100<<idx);
+ nzb = sl-> top_cbp&(0x100<<idx);
}
} else {
nza = sl->non_zero_count_cache[scan8[idx] - 1];
@@ -2325,7 +2325,7 @@ decode_intra_mb:
}
}
- h->cbp_table[mb_xy] = h->cbp = cbp;
+ h->cbp_table[mb_xy] = sl->cbp = cbp;
if( dct8x8_allowed && (cbp&15) && !IS_INTRA( mb_type ) ) {
mb_type |= MB_TYPE_8x8DCT * get_cabac_noinline(&sl->cabac, &sl->cabac_state[399 + sl->neighbor_transform_size]);
diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
index af8a8b637c..ab60f83baa 100644
--- a/libavcodec/h264_cavlc.c
+++ b/libavcodec/h264_cavlc.c
@@ -1088,7 +1088,7 @@ decode_intra_mb:
if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){
mb_type |= MB_TYPE_8x8DCT*get_bits1(&h->gb);
}
- h->cbp=
+ sl->cbp=
h->cbp_table[mb_xy]= cbp;
h->cur_pic.mb_type[mb_xy] = mb_type;
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
index dc4d771d1a..ba2dade7e3 100644
--- a/libavcodec/h264_loopfilter.c
+++ b/libavcodec/h264_loopfilter.c
@@ -358,7 +358,7 @@ static av_always_inline void h264_filter_mb_fast_internal(H264Context *h,
} else {
LOCAL_ALIGNED(8, int16_t, bS, [2], [4][4]);
int edges;
- if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 && !chroma444 ) {
+ if( IS_8x8DCT(mb_type) && (sl->cbp&7) == 7 && !chroma444 ) {
edges = 4;
AV_WN64A(bS[0][0], 0x0002000200020002ULL);
AV_WN64A(bS[0][2], 0x0002000200020002ULL);
@@ -368,7 +368,7 @@ static av_always_inline void h264_filter_mb_fast_internal(H264Context *h,
int mask_edge1 = (3*(((5*mb_type)>>5)&1)) | (mb_type>>4); //(mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (mb_type & MB_TYPE_16x8) ? 1 : 0;
int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); // (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (h->left_type[LTOP] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0;
int step = 1+(mb_type>>24); //IS_8x8DCT(mb_type) ? 2 : 1;
- edges = 4 - 3*((mb_type>>3) & !(h->cbp & 15)); //(mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4;
+ edges = 4 - 3*((mb_type>>3) & !(sl->cbp & 15)); //(mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4;
h->h264dsp.h264_loop_filter_strength(bS, sl->non_zero_count_cache, sl->ref_cache, sl->mv_cache,
sl->list_count==2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE(h));
}
@@ -485,7 +485,7 @@ static av_always_inline void filter_mb_dir(H264Context *h, H264SliceContext *sl,
static const uint8_t mask_edge_tab[2][8]={{0,3,3,3,1,1,1,1},
{0,3,1,1,3,3,3,3}};
const int mask_edge = mask_edge_tab[dir][(mb_type>>3)&7];
- const int edges = mask_edge== 3 && !(h->cbp&15) ? 1 : 4;
+ const int edges = mask_edge== 3 && !(sl->cbp&15) ? 1 : 4;
// how often to recheck mv-based bS when iterating along each edge
const int mask_par0 = mb_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir));
diff --git a/libavcodec/h264_mb.c b/libavcodec/h264_mb.c
index 57d5b308b0..3e5afe76d0 100644
--- a/libavcodec/h264_mb.c
+++ b/libavcodec/h264_mb.c
@@ -768,7 +768,7 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceCon
linesize,
sl->non_zero_count_cache + p * 5 * 8);
}
- } else if (h->cbp & 15) {
+ } else if (sl->cbp & 15) {
if (transform_bypass) {
const int di = IS_8x8DCT(mb_type) ? 4 : 1;
idct_add = IS_8x8DCT(mb_type) ? h->h264dsp.h264_add_pixels8_clear
diff --git a/libavcodec/h264_mb_template.c b/libavcodec/h264_mb_template.c
index b4ef404649..b7f4a059b2 100644
--- a/libavcodec/h264_mb_template.c
+++ b/libavcodec/h264_mb_template.c
@@ -191,7 +191,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
PIXEL_SHIFT, block_offset, linesize, dest_y, 0);
if ((SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) &&
- (h->cbp & 0x30)) {
+ (sl->cbp & 0x30)) {
uint8_t *dest[2] = { dest_cb, dest_cr };
if (transform_bypass) {
if (IS_INTRA(mb_type) && h->sps.profile_idc == 244 &&
diff --git a/libavcodec/h264_mvpred.h b/libavcodec/h264_mvpred.h
index 0a8726afd7..9da3a5798f 100644
--- a/libavcodec/h264_mvpred.h
+++ b/libavcodec/h264_mvpred.h
@@ -589,16 +589,16 @@ static void fill_decode_caches(H264Context *h, H264SliceContext *sl, int mb_type
if (CABAC(h)) {
// top_cbp
if (top_type)
- h->top_cbp = h->cbp_table[top_xy];
+ sl->top_cbp = h->cbp_table[top_xy];
else
- h->top_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F;
+ sl->top_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F;
// left_cbp
if (left_type[LTOP]) {
- h->left_cbp = (h->cbp_table[left_xy[LTOP]] & 0x7F0) |
+ sl->left_cbp = (h->cbp_table[left_xy[LTOP]] & 0x7F0) |
((h->cbp_table[left_xy[LTOP]] >> (left_block[0] & (~1))) & 2) |
(((h->cbp_table[left_xy[LBOT]] >> (left_block[2] & (~1))) & 2) << 2);
} else {
- h->left_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F;
+ sl->left_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F;
}
}
}
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index b9693b2034..6c9d308780 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -2211,7 +2211,7 @@ static int fill_filter_caches(H264Context *h, H264SliceContext *sl, int mb_type)
AV_COPY32(&nnz_cache[4 + 8 * 2], &nnz[4]);
AV_COPY32(&nnz_cache[4 + 8 * 3], &nnz[8]);
AV_COPY32(&nnz_cache[4 + 8 * 4], &nnz[12]);
- h->cbp = h->cbp_table[mb_xy];
+ sl->cbp = h->cbp_table[mb_xy];
if (top_type) {
nnz = h->non_zero_count[top_xy];
@@ -2248,22 +2248,22 @@ static int fill_filter_caches(H264Context *h, H264SliceContext *sl, int mb_type)
nnz_cache[scan8[0]] =
nnz_cache[scan8[1]] =
nnz_cache[scan8[2]] =
- nnz_cache[scan8[3]] = (h->cbp & 0x1000) >> 12;
+ nnz_cache[scan8[3]] = (sl->cbp & 0x1000) >> 12;
nnz_cache[scan8[0 + 4]] =
nnz_cache[scan8[1 + 4]] =
nnz_cache[scan8[2 + 4]] =
- nnz_cache[scan8[3 + 4]] = (h->cbp & 0x2000) >> 12;
+ nnz_cache[scan8[3 + 4]] = (sl->cbp & 0x2000) >> 12;
nnz_cache[scan8[0 + 8]] =
nnz_cache[scan8[1 + 8]] =
nnz_cache[scan8[2 + 8]] =
- nnz_cache[scan8[3 + 8]] = (h->cbp & 0x4000) >> 12;
+ nnz_cache[scan8[3 + 8]] = (sl->cbp & 0x4000) >> 12;
nnz_cache[scan8[0 + 12]] =
nnz_cache[scan8[1 + 12]] =
nnz_cache[scan8[2 + 12]] =
- nnz_cache[scan8[3 + 12]] = (h->cbp & 0x8000) >> 12;
+ nnz_cache[scan8[3 + 12]] = (sl->cbp & 0x8000) >> 12;
}
}
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 5a5cf26a33..992c100051 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -768,7 +768,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
}
}
- h->cbp = cbp;
+ sl->cbp = cbp;
h->cur_pic.mb_type[mb_xy] = mb_type;
if (IS_INTRA(mb_type))
@@ -1306,7 +1306,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
return -1;
}
- if (mb_type != 0 || h->cbp)
+ if (mb_type != 0 || sl->cbp)
ff_h264_hl_decode_mb(h, &h->slice_ctx[0]);
if (h->pict_type != AV_PICTURE_TYPE_B && !h->low_delay)