[FFmpeg-cvslog] ff_h264_decode_picture_parameter_set: use the correct sps

Michael Niedermayer git at videolan.org
Mon May 6 02:24:24 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon May  6 00:01:05 2013 +0200| [dc35b77b28f40c99d27c073fe2c22219ba600202] | committer: Michael Niedermayer

ff_h264_decode_picture_parameter_set: use the correct sps

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dc35b77b28f40c99d27c073fe2c22219ba600202
---

 libavcodec/h264_ps.c |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 6172fdd..3cecd30 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -580,18 +580,13 @@ static int more_rbsp_data_in_pps(H264Context *h, PPS *pps)
 int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){
     unsigned int pps_id= get_ue_golomb(&h->gb);
     PPS *pps;
-    const int qp_bd_offset = 6*(h->sps.bit_depth_luma-8);
+    SPS *sps;
+    int qp_bd_offset;
     int bits_left;
 
     if(pps_id >= MAX_PPS_COUNT) {
         av_log(h->avctx, AV_LOG_ERROR, "pps_id (%d) out of range\n", pps_id);
         return -1;
-    } else if (h->sps.bit_depth_luma > 14) {
-        av_log(h->avctx, AV_LOG_ERROR, "Invalid luma bit depth=%d\n", h->sps.bit_depth_luma);
-        return AVERROR_INVALIDDATA;
-    } else if (h->sps.bit_depth_luma == 11 || h->sps.bit_depth_luma == 13) {
-        av_log(h->avctx, AV_LOG_ERROR, "Unimplemented luma bit depth=%d\n", h->sps.bit_depth_luma);
-        return AVERROR_PATCHWELCOME;
     }
 
     pps= av_mallocz(sizeof(PPS));
@@ -602,6 +597,15 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){
         av_log(h->avctx, AV_LOG_ERROR, "sps_id out of range\n");
         goto fail;
     }
+    sps = h->sps_buffers[pps->sps_id];
+    qp_bd_offset = 6*(sps->bit_depth_luma-8);
+    if (sps->bit_depth_luma > 14) {
+        av_log(h->avctx, AV_LOG_ERROR, "Invalid luma bit depth=%d\n", sps->bit_depth_luma);
+        return AVERROR_INVALIDDATA;
+    } else if (sps->bit_depth_luma == 11 || sps->bit_depth_luma == 13) {
+        av_log(h->avctx, AV_LOG_ERROR, "Unimplemented luma bit depth=%d\n", sps->bit_depth_luma);
+        return AVERROR_PATCHWELCOME;
+    }
 
     pps->cabac= get_bits1(&h->gb);
     pps->pic_order_present= get_bits1(&h->gb);
@@ -673,8 +677,8 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){
         pps->chroma_qp_index_offset[1]= pps->chroma_qp_index_offset[0];
     }
 
-    build_qp_table(pps, 0, pps->chroma_qp_index_offset[0], h->sps.bit_depth_luma);
-    build_qp_table(pps, 1, pps->chroma_qp_index_offset[1], h->sps.bit_depth_luma);
+    build_qp_table(pps, 0, pps->chroma_qp_index_offset[0], sps->bit_depth_luma);
+    build_qp_table(pps, 1, pps->chroma_qp_index_offset[1], sps->bit_depth_luma);
     if(pps->chroma_qp_index_offset[0] != pps->chroma_qp_index_offset[1])
         pps->chroma_qp_diff= 1;
 



More information about the ffmpeg-cvslog mailing list