Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2014-02-20 05:38:32 +0400
committerReinhard Tartler <siretart@tauware.de>2014-03-02 20:42:36 +0400
commit63169474b3927e6a1b8ef21728cad6034b09d302 (patch)
tree04e695ad5440bc119516fa68fe4024e1ef3f0038 /libavcodec/h264.c
parent9b6ccf0f243c5764e3889126f5e8316d48667284 (diff)
h264: Lower bound check for slice offsets
And use the value from the specification. Sample-Id: 00000451-google Found-by: Mateusz j00ru Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org Signed-off-by: Luca Barbato <lu_zero@gentoo.org> (cherry picked from commit f777504f640260337974848c7d5d7a3f064bbb45)
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 421e12a2b3..2ca331ada0 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3836,8 +3836,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
get_se_golomb(&h->gb); /* slice_qs_delta */
h->deblocking_filter = 1;
- h->slice_alpha_c0_offset = 52;
- h->slice_beta_offset = 52;
+ h->slice_alpha_c0_offset = 0;
+ h->slice_beta_offset = 0;
if (h->pps.deblocking_filter_parameters_present) {
tmp = get_ue_golomb_31(&h->gb);
if (tmp > 2) {
@@ -3850,10 +3850,12 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
h->deblocking_filter ^= 1; // 1<->0
if (h->deblocking_filter) {
- h->slice_alpha_c0_offset += get_se_golomb(&h->gb) << 1;
- h->slice_beta_offset += get_se_golomb(&h->gb) << 1;
- if (h->slice_alpha_c0_offset > 104U ||
- h->slice_beta_offset > 104U) {
+ h->slice_alpha_c0_offset = get_se_golomb(&h->gb) * 2;
+ h->slice_beta_offset = get_se_golomb(&h->gb) * 2;
+ if (h->slice_alpha_c0_offset > 12 ||
+ h->slice_alpha_c0_offset < -12 ||
+ h->slice_beta_offset > 12 ||
+ h->slice_beta_offset < -12) {
av_log(h->avctx, AV_LOG_ERROR,
"deblocking filter parameters %d %d out of range\n",
h->slice_alpha_c0_offset, h->slice_beta_offset);
@@ -3890,7 +3892,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
}
}
}
- h->qp_thresh = 15 + 52 -
+ h->qp_thresh = 15 +
FFMIN(h->slice_alpha_c0_offset, h->slice_beta_offset) -
FFMAX3(0,
h->pps.chroma_qp_index_offset[0],
@@ -3952,7 +3954,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
h->ref_count[0], h->ref_count[1],
h->qscale,
h->deblocking_filter,
- h->slice_alpha_c0_offset / 2 - 26, h->slice_beta_offset / 2 - 26,
+ h->slice_alpha_c0_offset, h->slice_beta_offset,
h->use_weight,
h->use_weight == 1 && h->use_weight_chroma ? "c" : "",
h->slice_type == AV_PICTURE_TYPE_B ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : "");