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

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
86 RangeCoder c;86 RangeCoder c;
87 87
88 int ac_byte_count; ///< number of bytes used for AC coding88 int ac_byte_count; ///< number of bytes used for AC coding
89 uint64_t rc_stat[256][2];89
90 uint64_t (*rc_stat2[MAX_QUANT_TABLES])[32][2];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 };
91} FFV1SliceContext;102} FFV1SliceContext;
92 103
93typedef struct FFV1Context {104typedef struct FFV1Context {
@@ -135,7 +146,6 @@ typedef struct FFV1Context { · 41 unmodified lines
135 int max_slice_count;146 int max_slice_count;
136 int num_v_slices;147 int num_v_slices;
137 int num_h_slices;148 int num_h_slices;
138 int slice_reset_contexts;
139 149
140 FFV1SliceContext *slices;150 FFV1SliceContext *slices;
141} FFV1Context;151} FFV1Context;
libavcodec/ffv1dec.c+2−2
@@ -239,7 +239,7 @@ static int decode_slice_header(const FFV1Context *f, FFV1Context *fs, · 238 unmodified lines
239 }239 }
240 240
241 if (fs->version > 3) {241 if (fs->version > 3) {
242 fs->slice_reset_contexts = get_rac(c, state);242 sc->slice_reset_contexts = get_rac(c, state);
243 sc->slice_coding_mode = get_symbol(c, state, 0);243 sc->slice_coding_mode = get_symbol(c, state, 0);
244 if (sc->slice_coding_mode != 1) {244 if (sc->slice_coding_mode != 1) {
245 sc->slice_rct_by_coef = get_symbol(c, state, 0);245 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
309 }309 }
310 if ((ret = ff_ffv1_init_slice_state(f, sc)) < 0)310 if ((ret = ff_ffv1_init_slice_state(f, sc)) < 0)
311 return ret;311 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) {
313 ff_ffv1_clear_slice_state(f, sc);313 ff_ffv1_clear_slice_state(f, sc);
314 } else if (fs->slice_damaged) {314 } else if (fs->slice_damaged) {
315 return AVERROR_INVALIDDATA;315 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