[FFmpeg-devel,1/3] avcodec/h264_parse: clear invalid luma weights in ff_h264_pred_weight_table()

Submitted by James Almer on April 9, 2019, 6:32 p.m.

Details

Message ID 20190409183227.7680-1-jamrial@gmail.com
State New
Headers show

Commit Message

James Almer April 9, 2019, 6:32 p.m.
Based on commit 85c85fffff3f9c75301db3eba1bd5f2fb1e6285d.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/h264_parse.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer April 10, 2019, 7:44 a.m.
On Tue, Apr 09, 2019 at 03:32:25PM -0300, James Almer wrote:
> Based on commit 85c85fffff3f9c75301db3eba1bd5f2fb1e6285d.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/h264_parse.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

LGTM

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
index a075443d17..8bdd886000 100644
--- a/libavcodec/h264_parse.c
+++ b/libavcodec/h264_parse.c
@@ -62,8 +62,11 @@  int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
                 pwt->luma_weight[i][list][0] = get_se_golomb(gb);
                 pwt->luma_weight[i][list][1] = get_se_golomb(gb);
                 if ((int8_t)pwt->luma_weight[i][list][0] != pwt->luma_weight[i][list][0] ||
-                    (int8_t)pwt->luma_weight[i][list][1] != pwt->luma_weight[i][list][1])
+                    (int8_t)pwt->luma_weight[i][list][1] != pwt->luma_weight[i][list][1]) {
+                    pwt->luma_weight[i][list][0] = luma_def;
+                    pwt->luma_weight[i][list][1] = 0;
                     goto out_range_weight;
+                }
                 if (pwt->luma_weight[i][list][0] != luma_def ||
                     pwt->luma_weight[i][list][1] != 0) {
                     pwt->use_weight             = 1;