Commit dc35b77b authored by Michael Niedermayer's avatar Michael Niedermayer

ff_h264_decode_picture_parameter_set: use the correct sps

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 7c23922c
......@@ -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;
......
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