From 993dbb0f8c5d6e4d10c7ed482b2305e56b0f59cf Mon Sep 17 00:00:00 2001 From: Ding Wei Date: Mon, 2 Jul 2018 15:17:10 +0800 Subject: [PATCH] [vp9d]: fix bug: intra_only reset frame context tips: reset frame context modes a) intraonly && resetctx==2, reset all context. b) intraonly && resetctx==3, rest currently used. c) keyframe || intraonly, set framectxid = 0. Change-Id: I0d2c38277f720d33a98f7f5148c96f560e423365 Signed-off-by: Ding Wei --- mpp/codec/dec/vp9/vp9d_parser.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mpp/codec/dec/vp9/vp9d_parser.c b/mpp/codec/dec/vp9/vp9d_parser.c index 11dbe2b6..5f490c98 100644 --- a/mpp/codec/dec/vp9/vp9d_parser.c +++ b/mpp/codec/dec/vp9/vp9d_parser.c @@ -1059,7 +1059,8 @@ static RK_S32 decode_parser_header(Vp9CodecContext *ctx, } } - if (s->keyframe || s->errorres || s->intraonly) { + if (s->keyframe || s->errorres || + (s->intraonly && s->resetctx == 3)) { s->prob_ctx[0].p = s->prob_ctx[1].p = s->prob_ctx[2].p = s->prob_ctx[3].p = vp9_default_probs; memcpy(s->prob_ctx[0].coef, vp9_default_coef_probs, @@ -1070,7 +1071,13 @@ static RK_S32 decode_parser_header(Vp9CodecContext *ctx, sizeof(vp9_default_coef_probs)); memcpy(s->prob_ctx[3].coef, vp9_default_coef_probs, sizeof(vp9_default_coef_probs)); + } else if (s->intraonly && s->resetctx == 2) { + s->prob_ctx[c].p = vp9_default_probs; + memcpy(s->prob_ctx[c].coef, vp9_default_coef_probs, + sizeof(vp9_default_coef_probs)); } + if (s->keyframe || s->errorres || s->intraonly) + s->framectxid = c = 0; // next 16 bits is size of the rest of the header (arith-coded) size2 = mpp_get_bits(&s->gb, 16);