diff mbox series

[FFmpeg-devel,14/18] avcodec/vp8: Move fade_present from context to stack

Message ID AS8P250MB07444823F8B80D5F8BF06AA08F429@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 4130789f4f20e67ef44f8c721955c5e3bcbc1b09
Headers show
Series [FFmpeg-devel,01/18] avcodec/vp8: Disable segmentation for VP7 | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 10, 2022, 1:07 a.m. UTC
It is only an auxiliary value used for parsing the VP7 frame header.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
I think that vp7_fade_frame() needs a check for whether the
previous frame is writable before writing to it.
Does anyone have a sample for this fading?

 libavcodec/vp8.c | 6 +++---
 libavcodec/vp8.h | 5 -----
 2 files changed, 3 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index a7df4601ef..baf9820ce6 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -580,6 +580,7 @@  static int vp7_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si
     int height = s->avctx->height;
     int alpha = 0;
     int beta  = 0;
+    int fade_present = 1;
 
     if (buf_size < 4) {
         return AVERROR_INVALIDDATA;
@@ -679,7 +680,6 @@  static int vp7_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si
 
     s->update_last          = 1;
     s->update_probabilities = 1;
-    s->fade_present         = 1;
 
     if (s->profile > 0) {
         s->update_probabilities = vp89_rac_get(c);
@@ -687,13 +687,13 @@  static int vp7_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si
             s->prob[1] = s->prob[0];
 
         if (!s->keyframe)
-            s->fade_present = vp89_rac_get(c);
+            fade_present = vp89_rac_get(c);
     }
 
     if (vpx_rac_is_end(c))
         return AVERROR_INVALIDDATA;
     /* E. Fading information for previous frame */
-    if (s->fade_present && vp89_rac_get(c)) {
+    if (fade_present && vp89_rac_get(c)) {
         alpha = (int8_t) vp89_rac_get_uint(c, 8);
         beta  = (int8_t) vp89_rac_get_uint(c, 8);
     }
diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h
index ed79bc79c1..db0155237a 100644
--- a/libavcodec/vp8.h
+++ b/libavcodec/vp8.h
@@ -335,11 +335,6 @@  typedef struct VP8Context {
 
     int vp7;
 
-    /**
-     * Fade bit present in bitstream (VP7)
-     */
-    int fade_present;
-
     /**
      * Interframe DC prediction (VP7)
      * [0] VP8_FRAME_PREVIOUS