Commit f5d4d618 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '30da98ad'

* commit '30da98ad':
  h264: move cabac[_state] into the per-slice context

Conflicts:
	libavcodec/h264_cabac.c
	libavcodec/h264_slice.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents d86e8f23 30da98ad
...@@ -433,6 +433,12 @@ typedef struct H264SliceContext { ...@@ -433,6 +433,12 @@ typedef struct H264SliceContext {
///< as mb is addressed by scantable[i] and scantable is uint8_t we can either ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either
///< check that i is not too large or ensure that there is some unused stuff after mb ///< check that i is not too large or ensure that there is some unused stuff after mb
int16_t mb_padding[256 * 2]; int16_t mb_padding[256 * 2];
/**
* Cabac
*/
CABACContext cabac;
uint8_t cabac_state[1024];
} H264SliceContext; } H264SliceContext;
/** /**
...@@ -519,12 +525,6 @@ typedef struct H264Context { ...@@ -519,12 +525,6 @@ typedef struct H264Context {
GetBitContext *intra_gb_ptr; GetBitContext *intra_gb_ptr;
GetBitContext *inter_gb_ptr; GetBitContext *inter_gb_ptr;
/**
* Cabac
*/
CABACContext cabac;
uint8_t cabac_state[1024];
/* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0, 1, 2), 0x0? luma_cbp */ /* 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; uint16_t *cbp_table;
int cbp; int cbp;
......
This diff is collapsed.
...@@ -2423,7 +2423,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg) ...@@ -2423,7 +2423,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
align_get_bits(&h->gb); align_get_bits(&h->gb);
/* init cabac */ /* init cabac */
ff_init_cabac_decoder(&h->cabac, ff_init_cabac_decoder(&sl->cabac,
h->gb.buffer + get_bits_count(&h->gb) / 8, h->gb.buffer + get_bits_count(&h->gb) / 8,
(get_bits_left(&h->gb) + 7) / 8); (get_bits_left(&h->gb) + 7) / 8);
...@@ -2448,23 +2448,23 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg) ...@@ -2448,23 +2448,23 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
ff_h264_hl_decode_mb(h, sl); ff_h264_hl_decode_mb(h, sl);
h->mb_y--; h->mb_y--;
} }
eos = get_cabac_terminate(&h->cabac); eos = get_cabac_terminate(&sl->cabac);
if ((h->workaround_bugs & FF_BUG_TRUNCATED) && if ((h->workaround_bugs & FF_BUG_TRUNCATED) &&
h->cabac.bytestream > h->cabac.bytestream_end + 2) { sl->cabac.bytestream > sl->cabac.bytestream_end + 2) {
er_add_slice(h, sl, h->resync_mb_x, h->resync_mb_y, h->mb_x - 1, er_add_slice(h, sl, h->resync_mb_x, h->resync_mb_y, h->mb_x - 1,
h->mb_y, ER_MB_END); h->mb_y, ER_MB_END);
if (h->mb_x >= lf_x_start) if (h->mb_x >= lf_x_start)
loop_filter(h, sl, lf_x_start, h->mb_x + 1); loop_filter(h, sl, lf_x_start, h->mb_x + 1);
return 0; return 0;
} }
if (h->cabac.bytestream > h->cabac.bytestream_end + 2 ) if (sl->cabac.bytestream > sl->cabac.bytestream_end + 2 )
av_log(h->avctx, AV_LOG_DEBUG, "bytestream overread %"PTRDIFF_SPECIFIER"\n", h->cabac.bytestream_end - h->cabac.bytestream); av_log(h->avctx, AV_LOG_DEBUG, "bytestream overread %"PTRDIFF_SPECIFIER"\n", sl->cabac.bytestream_end - sl->cabac.bytestream);
if (ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 4) { if (ret < 0 || sl->cabac.bytestream > sl->cabac.bytestream_end + 4) {
av_log(h->avctx, AV_LOG_ERROR, av_log(h->avctx, AV_LOG_ERROR,
"error while decoding MB %d %d, bytestream %"PTRDIFF_SPECIFIER"\n", "error while decoding MB %d %d, bytestream %"PTRDIFF_SPECIFIER"\n",
h->mb_x, h->mb_y, h->mb_x, h->mb_y,
h->cabac.bytestream_end - h->cabac.bytestream); sl->cabac.bytestream_end - sl->cabac.bytestream);
er_add_slice(h, sl, h->resync_mb_x, h->resync_mb_y, h->mb_x, er_add_slice(h, sl, h->resync_mb_x, h->resync_mb_y, h->mb_x,
h->mb_y, ER_MB_ERROR); h->mb_y, ER_MB_ERROR);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment