ffmpeg | branch: master | Lynne <d...@lynne.ee> | Tue Feb 18 23:47:13 2025 
+0100| [5cf4f145addeca84968cb2d687e5b20494fa7db8] | committer: Lynne

ffv1dec: set f->state_transition for default range coder table

The table is only set when f->ac is set to CUSTOM. Setting it
for default range coder tables simplifies hardware accelerator code.

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

 libavcodec/ffv1_parse.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/ffv1_parse.c b/libavcodec/ffv1_parse.c
index 81224df214..636e2c62ab 100644
--- a/libavcodec/ffv1_parse.c
+++ b/libavcodec/ffv1_parse.c
@@ -104,6 +104,11 @@ int ff_ffv1_read_extra_header(FFV1Context *f)
     if (f->ac == AC_RANGE_CUSTOM_TAB) {
         for (int i = 1; i < 256; i++)
             f->state_transition[i] = ff_ffv1_get_symbol(&c, state, 1) + 
c.one_state[i];
+    } else {
+        RangeCoder rc;
+        ff_build_rac_states(&rc, 0.05 * (1LL << 32), 256 - 8);
+        for (int i = 1; i < 256; i++)
+            f->state_transition[i] = rc.one_state[i];
     }
 
     f->colorspace                 = ff_ffv1_get_symbol(&c, state, 0); //YUV cs 
type
@@ -219,6 +224,11 @@ int ff_ffv1_parse_header(FFV1Context *f, RangeCoder *c, 
uint8_t *state)
                 }
                 f->state_transition[i] = st;
             }
+        } else {
+            RangeCoder rc;
+            ff_build_rac_states(&rc, 0.05 * (1LL << 32), 256 - 8);
+            for (int i = 1; i < 256; i++)
+                f->state_transition[i] = rc.one_state[i];
         }
 
         colorspace          = ff_ffv1_get_symbol(c, state, 0); //YUV cs type

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to