The table is only set when f->ac is set to CUSTOM. Setting it for default range coder tables simplifies hardware accelerator code.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -104,6 +104,11 @@ int ff_ffv1_read_extra_header(FFV1Context *f) · 103 unmodified lines | |||
| 104 | if (f->ac == AC_RANGE_CUSTOM_TAB) { | 104 | if (f->ac == AC_RANGE_CUSTOM_TAB) { |
| 105 | for (int i = 1; i < 256; i++) | 105 | for (int i = 1; i < 256; i++) |
| 106 | f->state_transition[i] = ff_ffv1_get_symbol(&c, state, 1) + c.one_state[i]; | 106 | f->state_transition[i] = ff_ffv1_get_symbol(&c, state, 1) + c.one_state[i]; |
| 107 | } else { | ||
| 108 | RangeCoder rc; | ||
| 109 | ff_build_rac_states(&rc, 0.05 * (1LL << 32), 256 - 8); | ||
| 110 | for (int i = 1; i < 256; i++) | ||
| 111 | f->state_transition[i] = rc.one_state[i]; | ||
| 107 | } | 112 | } |
| 108 | 113 | ||
| 109 | f->colorspace = ff_ffv1_get_symbol(&c, state, 0); //YUV cs type | 114 | 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) · 109 unmodified lines | |||
| 219 | } | 224 | } |
| 220 | f->state_transition[i] = st; | 225 | f->state_transition[i] = st; |
| 221 | } | 226 | } |
| 227 | } else { | ||
| 228 | RangeCoder rc; | ||
| 229 | ff_build_rac_states(&rc, 0.05 * (1LL << 32), 256 - 8); | ||
| 230 | for (int i = 1; i < 256; i++) | ||
| 231 | f->state_transition[i] = rc.one_state[i]; | ||
| 222 | } | 232 | } |
| 223 | 233 | ||
| 224 | colorspace = ff_ffv1_get_symbol(c, state, 0); //YUV cs type | 234 | colorspace = ff_ffv1_get_symbol(c, state, 0); //YUV cs type |