History

lavc/ffv1dec: move slice_reset_contexts to per-slice context

Anton Khirnov committed 2 years ago

Commit f2aeba51 parent 84dda322 files · +15 −5Browse files

Showing the changes to libavcodec (2 of 2 files). Show all

Unified · Split

2 files
  1. libavcodec/ffv1.h +13 −3
  2. libavcodec/ffv1dec.c +2 −2
libavcodec/ffv1.h+13−3
@@ -86,8 +86,19 @@ typedef struct FFV1SliceContext { · 85 unmodified lines
8686 RangeCoder c;
8787
8888 int ac_byte_count; ///< number of bytes used for AC coding
89− uint64_t rc_stat[256][2];
90− uint64_t (*rc_stat2[MAX_QUANT_TABLES])[32][2];
89+
90+ union {
91+ // decoder-only
92+ struct {
93+ int slice_reset_contexts;
94+ };
95+
96+ // encoder-only
97+ struct {
98+ uint64_t rc_stat[256][2];
99+ uint64_t (*rc_stat2[MAX_QUANT_TABLES])[32][2];
100+ };
101+ };
91102 } FFV1SliceContext;
92103
93104 typedef struct FFV1Context {
@@ -135,7 +146,6 @@ typedef struct FFV1Context { · 41 unmodified lines
135146 int max_slice_count;
136147 int num_v_slices;
137148 int num_h_slices;
138− int slice_reset_contexts;
139149
140150 FFV1SliceContext *slices;
141151 } FFV1Context;
libavcodec/ffv1dec.c+2−2
@@ -239,7 +239,7 @@ static int decode_slice_header(const FFV1Context *f, FFV1Context *fs, · 238 unmodified lines
239239 }
240240
241241 if (fs->version > 3) {
242− fs->slice_reset_contexts = get_rac(c, state);
242+ sc->slice_reset_contexts = get_rac(c, state);
243243 sc->slice_coding_mode = get_symbol(c, state, 0);
244244 if (sc->slice_coding_mode != 1) {
245245 sc->slice_rct_by_coef = get_symbol(c, state, 0);
@@ -309,7 +309,7 @@ static int decode_slice(AVCodecContext *c, void *arg) · 63 unmodified lines
309309 }
310310 if ((ret = ff_ffv1_init_slice_state(f, sc)) < 0)
311311 return ret;
312− if ((p->flags & AV_FRAME_FLAG_KEY) || fs->slice_reset_contexts) {
312+ if ((p->flags & AV_FRAME_FLAG_KEY) || sc->slice_reset_contexts) {
313313 ff_ffv1_clear_slice_state(f, sc);
314314 } else if (fs->slice_damaged) {
315315 return AVERROR_INVALIDDATA;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t