summaryrefslogtreecommitdiff
path: root/libavcodec/h264_cavlc.c
diff options
context:
space:
mode:
authorOskar Arvidsson <oskar@irock.se>2011-03-29 17:48:58 +0200
committerRonald S. Bultje <rsbultje@gmail.com>2011-05-10 07:24:35 -0400
commitfcc0224e4fbd44ae268903185b0cf83560b13555 (patch)
treed41ef6b55e9cf1575c4077c7f44cf25b93a99fb9 /libavcodec/h264_cavlc.c
parent6e3ef511d787ff632547059f8730396ff4498e70 (diff)
Add support for higher QP values in h264.
In high bit depth, the QP values may now be up to (51 + 6*(bit_depth-8)). Preparatory patch for high bit depth h264 decoding support. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec/h264_cavlc.c')
-rw-r--r--libavcodec/h264_cavlc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
index 61b057176b..2e5ea54679 100644
--- a/libavcodec/h264_cavlc.c
+++ b/libavcodec/h264_cavlc.c
@@ -922,6 +922,7 @@ decode_intra_mb:
int dquant;
GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr;
const uint8_t *scan, *scan8x8;
+ const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8);
if(IS_INTERLACED(mb_type)){
scan8x8= s->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0;
@@ -935,10 +936,10 @@ decode_intra_mb:
s->qscale += dquant;
- if(((unsigned)s->qscale) > 51){
- if(s->qscale<0) s->qscale+= 52;
- else s->qscale-= 52;
- if(((unsigned)s->qscale) > 51){
+ if(((unsigned)s->qscale) > max_qp){
+ if(s->qscale<0) s->qscale+= max_qp+1;
+ else s->qscale-= max_qp+1;
+ if(((unsigned)s->qscale) > max_qp){
av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y);
return -1;
}