History

lavc/ffv1: always use the main context values of plane_count/transparency

They cannot change between slices.

Anton Khirnov committed 2 years ago

Commit 39486a21 parent 492df655 files · +5 −8Browse files

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

Unified · Split

5 files
  1. libavcodec/ffv1.c +0 −2
  2. libavcodec/ffv1dec.c +2 −3
  3. libavcodec/ffv1dec_template.c +1 −1
  4. libavcodec/ffv1enc.c +1 −1
  5. libavcodec/ffv1enc_template.c +1 −1
libavcodec/ffv1.c+0−2
@@ -56,8 +56,6 @@ av_cold int ff_ffv1_init_slice_state(const FFV1Context *f, FFV1Context *fs) · 55 unmodified lines
56{56{
57 int j, i;57 int j, i;
58 58
59 fs->plane_count = f->plane_count;
60 fs->transparency = f->transparency;
61 for (j = 0; j < f->plane_count; j++) {59 for (j = 0; j < f->plane_count; j++) {
62 PlaneContext *const p = &fs->plane[j];60 PlaneContext *const p = &fs->plane[j];
63 61
libavcodec/ffv1dec.c+2−3
@@ -270,7 +270,6 @@ static int decode_slice(AVCodecContext *c, void *arg) · 269 unmodified lines
270 270
271 if(f->fsrc && !(p->flags & AV_FRAME_FLAG_KEY)) {271 if(f->fsrc && !(p->flags & AV_FRAME_FLAG_KEY)) {
272 FFV1Context *fssrc = f->fsrc->slice_context[si];272 FFV1Context *fssrc = f->fsrc->slice_context[si];
273 av_assert1(fs->plane_count == fssrc->plane_count);
274 273
275 if (!(p->flags & AV_FRAME_FLAG_KEY))274 if (!(p->flags & AV_FRAME_FLAG_KEY))
276 fs->slice_damaged |= fssrc->slice_damaged;275 fs->slice_damaged |= fssrc->slice_damaged;
@@ -330,7 +329,7 @@ static int decode_slice(AVCodecContext *c, void *arg) · 53 unmodified lines
330 }329 }
331 330
332 av_assert1(width && height);331 av_assert1(width && height);
333 if (f->colorspace == 0 && (f->chroma_planes || !fs->transparency)) {332 if (f->colorspace == 0 && (f->chroma_planes || !f->transparency)) {
334 const int chroma_width = AV_CEIL_RSHIFT(width, f->chroma_h_shift);333 const int chroma_width = AV_CEIL_RSHIFT(width, f->chroma_h_shift);
335 const int chroma_height = AV_CEIL_RSHIFT(height, f->chroma_v_shift);334 const int chroma_height = AV_CEIL_RSHIFT(height, f->chroma_v_shift);
336 const int cx = x >> f->chroma_h_shift;335 const int cx = x >> f->chroma_h_shift;
@@ -341,7 +340,7 @@ static int decode_slice(AVCodecContext *c, void *arg) · 4 unmodified lines
341 decode_plane(f, fs, sc, &gb, p->data[1] + ps*cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1, 1);340 decode_plane(f, fs, sc, &gb, p->data[1] + ps*cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1, 1);
342 decode_plane(f, fs, sc, &gb, p->data[2] + ps*cx+cy*p->linesize[2], chroma_width, chroma_height, p->linesize[2], 1, 1);341 decode_plane(f, fs, sc, &gb, p->data[2] + ps*cx+cy*p->linesize[2], chroma_width, chroma_height, p->linesize[2], 1, 1);
343 }342 }
344 if (fs->transparency)343 if (f->transparency)
345 decode_plane(f, fs, sc, &gb, p->data[3] + ps*x + y*p->linesize[3], width, height, p->linesize[3], (f->version >= 4 && !f->chroma_planes) ? 1 : 2, 1);344 decode_plane(f, fs, sc, &gb, p->data[3] + ps*x + y*p->linesize[3], width, height, p->linesize[3], (f->version >= 4 && !f->chroma_planes) ? 1 : 2, 1);
346 } else if (f->colorspace == 0) {345 } else if (f->colorspace == 0) {
347 decode_plane(f, fs, sc, &gb, p->data[0] + ps*x + y*p->linesize[0] , width, height, p->linesize[0], 0, 2);346 decode_plane(f, fs, sc, &gb, p->data[0] + ps*x + y*p->linesize[0] , width, height, p->linesize[0], 0, 2);
libavcodec/ffv1dec_template.c+1−1
@@ -141,7 +141,7 @@ static int RENAME(decode_rgb_frame)(FFV1Context *f, · 140 unmodified lines
141 int lbd = s->avctx->bits_per_raw_sample <= 8;141 int lbd = s->avctx->bits_per_raw_sample <= 8;
142 int bits = s->avctx->bits_per_raw_sample > 0 ? s->avctx->bits_per_raw_sample : 8;142 int bits = s->avctx->bits_per_raw_sample > 0 ? s->avctx->bits_per_raw_sample : 8;
143 int offset = 1 << bits;143 int offset = 1 << bits;
144 int transparency = s->transparency;144 int transparency = f->transparency;
145 145
146 for (x = 0; x < 4; x++) {146 for (x = 0; x < 4; x++) {
147 sample[x][0] = RENAME(sc->sample_buffer) + x * 2 * (w + 6) + 3;147 sample[x][0] = RENAME(sc->sample_buffer) + x * 2 * (w + 6) + 3;
libavcodec/ffv1enc.c+1−1
@@ -1072,7 +1072,7 @@ retry: · 1071 unmodified lines
1072 ret |= encode_plane(f, fs, sc, p->data[1] + ps*cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1, 1);1072 ret |= encode_plane(f, fs, sc, p->data[1] + ps*cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1, 1);
1073 ret |= encode_plane(f, fs, sc, p->data[2] + ps*cx+cy*p->linesize[2], chroma_width, chroma_height, p->linesize[2], 1, 1);1073 ret |= encode_plane(f, fs, sc, p->data[2] + ps*cx+cy*p->linesize[2], chroma_width, chroma_height, p->linesize[2], 1, 1);
1074 }1074 }
1075 if (fs->transparency)1075 if (f->transparency)
1076 ret |= encode_plane(f, fs, sc, p->data[3] + ps*x + y*p->linesize[3], width, height, p->linesize[3], 2, 1);1076 ret |= encode_plane(f, fs, sc, p->data[3] + ps*x + y*p->linesize[3], width, height, p->linesize[3], 2, 1);
1077 } else if (c->pix_fmt == AV_PIX_FMT_YA8) {1077 } else if (c->pix_fmt == AV_PIX_FMT_YA8) {
1078 ret = encode_plane(f, fs, sc, p->data[0] + ps*x + y*p->linesize[0], width, height, p->linesize[0], 0, 2);1078 ret = encode_plane(f, fs, sc, p->data[0] + ps*x + y*p->linesize[0], width, height, p->linesize[0], 0, 2);
libavcodec/ffv1enc_template.c+1−1
@@ -138,7 +138,7 @@ static int RENAME(encode_rgb_frame)(FFV1Context *f, · 137 unmodified lines
138 int packed = !src[1];138 int packed = !src[1];
139 int bits = s->bits_per_raw_sample > 0 ? s->bits_per_raw_sample : 8;139 int bits = s->bits_per_raw_sample > 0 ? s->bits_per_raw_sample : 8;
140 int offset = 1 << bits;140 int offset = 1 << bits;
141 int transparency = s->transparency;141 int transparency = f->transparency;
142 int packed_size = (3 + transparency)*2;142 int packed_size = (3 + transparency)*2;
143 143
144 sc->run_index = 0;144 sc->run_index = 0;

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