History

lavc/ffv1: move RangeCoder to per-slice context

Anton Khirnov committed 2 years ago

Commit 7b2bfba1 parent 28769f66 files · +87 −85Browse files

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

Unified · Split

6 files
  1. libavcodec/ffv1.c +4 −5
  2. libavcodec/ffv1.h +2 −3
  3. libavcodec/ffv1dec.c +37 −35
  4. libavcodec/ffv1dec_template.c +1 −1
  5. libavcodec/ffv1enc.c +42 −40
  6. libavcodec/ffv1enc_template.c +1 −1
libavcodec/ffv1.c+4−5
@@ -53,7 +53,7 @@ av_cold int ff_ffv1_common_init(AVCodecContext *avctx) · 52 unmodified lines
5353 }
5454
5555 av_cold int ff_ffv1_init_slice_state(const FFV1Context *f,
56− FFV1Context *fs, FFV1SliceContext *sc)
56+ FFV1SliceContext *sc)
5757 {
5858 int j, i;
5959
@@ -82,8 +82,8 @@ av_cold int ff_ffv1_init_slice_state(const FFV1Context *f, · 22 unmodified lines
8282 if (f->ac == AC_RANGE_CUSTOM_TAB) {
8383 //FIXME only redo if state_transition changed
8484 for (j = 1; j < 256; j++) {
85− fs->c. one_state[ j] = f->state_transition[j];
86− fs->c.zero_state[256 - j] = 256 - fs->c.one_state[j];
85+ sc->c. one_state[ j] = f->state_transition[j];
86+ sc->c.zero_state[256 - j] = 256 - sc->c.one_state[j];
8787 }
8888 }
8989
@@ -94,8 +94,7 @@ av_cold int ff_ffv1_init_slices_state(FFV1Context *f) · 4 unmodified lines
9494 {
9595 int i, ret;
9696 for (i = 0; i < f->max_slice_count; i++) {
97− FFV1Context *fs = f->slice_context[i];
98− if ((ret = ff_ffv1_init_slice_state(f, fs, &f->slices[i])) < 0)
97+ if ((ret = ff_ffv1_init_slice_state(f, &f->slices[i])) < 0)
9998 return AVERROR(ENOMEM);
10099 }
101100 return 0;
libavcodec/ffv1.h+2−3
@@ -83,12 +83,12 @@ typedef struct FFV1SliceContext { · 82 unmodified lines
8383
8484 PlaneContext plane[MAX_PLANES];
8585 PutBitContext pb;
86+ RangeCoder c;
8687 } FFV1SliceContext;
8788
8889 typedef struct FFV1Context {
8990 AVClass *class;
9091 AVCodecContext *avctx;
91− RangeCoder c;
9292 uint64_t rc_stat[256][2];
9393 uint64_t (*rc_stat2[MAX_QUANT_TABLES])[32][2];
9494 int version;
@@ -138,8 +138,7 @@ typedef struct FFV1Context { · 43 unmodified lines
138138 } FFV1Context;
139139
140140 int ff_ffv1_common_init(AVCodecContext *avctx);
141−int ff_ffv1_init_slice_state(const FFV1Context *f, FFV1Context *fs,
142− FFV1SliceContext *sc);
141+int ff_ffv1_init_slice_state(const FFV1Context *f, FFV1SliceContext *sc);
143142 int ff_ffv1_init_slices_state(FFV1Context *f);
144143 int ff_ffv1_init_slice_contexts(FFV1Context *f);
145144 int ff_ffv1_allocate_initial_states(FFV1Context *f);
libavcodec/ffv1dec.c+37−35
@@ -168,7 +168,7 @@ static int decode_plane(FFV1Context *f, · 167 unmodified lines
168168 static int decode_slice_header(const FFV1Context *f, FFV1Context *fs,
169169 FFV1SliceContext *sc, AVFrame *frame)
170170 {
171− RangeCoder *c = &fs->c;
171+ RangeCoder *c = &sc->c;
172172 uint8_t state[CONTEXT_SIZE];
173173 unsigned ps, context_count;
174174 int sx, sy, sw, sh;
@@ -299,7 +299,7 @@ static int decode_slice(AVCodecContext *c, void *arg) · 124 unmodified lines
299299 sc->slice_rct_ry_coef = 1;
300300
301301 if (f->version > 2) {
302− if (ff_ffv1_init_slice_state(f, fs, sc) < 0)
302+ if (ff_ffv1_init_slice_state(f, sc) < 0)
303303 return AVERROR(ENOMEM);
304304 if (decode_slice_header(f, fs, sc, p) < 0) {
305305 sc->slice_x = sc->slice_y = sc->slice_height = sc->slice_width = 0;
@@ -307,7 +307,7 @@ static int decode_slice(AVCodecContext *c, void *arg) · 1 unmodified line
307307 return AVERROR_INVALIDDATA;
308308 }
309309 }
310− if ((ret = ff_ffv1_init_slice_state(f, fs, sc)) < 0)
310+ if ((ret = ff_ffv1_init_slice_state(f, sc)) < 0)
311311 return ret;
312312 if ((p->flags & AV_FRAME_FLAG_KEY) || fs->slice_reset_contexts) {
313313 ff_ffv1_clear_slice_state(f, sc);
@@ -322,11 +322,11 @@ static int decode_slice(AVCodecContext *c, void *arg) · 8 unmodified lines
322322
323323 if (f->ac == AC_GOLOMB_RICE) {
324324 if (f->version == 3 && f->micro_version > 1 || f->version > 3)
325− get_rac(&fs->c, (uint8_t[]) { 129 });
326− fs->ac_byte_count = f->version > 2 || (!x && !y) ? fs->c.bytestream - fs->c.bytestream_start - 1 : 0;
325+ get_rac(&sc->c, (uint8_t[]) { 129 });
326+ fs->ac_byte_count = f->version > 2 || (!x && !y) ? sc->c.bytestream - sc->c.bytestream_start - 1 : 0;
327327 init_get_bits(&gb,
328− fs->c.bytestream_start + fs->ac_byte_count,
329− (fs->c.bytestream_end - fs->c.bytestream_start - fs->ac_byte_count) * 8);
328+ sc->c.bytestream_start + fs->ac_byte_count,
329+ (sc->c.bytestream_end - sc->c.bytestream_start - fs->ac_byte_count) * 8);
330330 }
331331
332332 av_assert1(width && height);
@@ -361,8 +361,8 @@ static int decode_slice(AVCodecContext *c, void *arg) · 28 unmodified lines
361361 }
362362 if (f->ac != AC_GOLOMB_RICE && f->version > 2) {
363363 int v;
364− get_rac(&fs->c, (uint8_t[]) { 129 });
365− v = fs->c.bytestream_end - fs->c.bytestream - 2 - 5*f->ec;
364+ get_rac(&sc->c, (uint8_t[]) { 129 });
365+ v = sc->c.bytestream_end - sc->c.bytestream - 2 - 5*f->ec;
366366 if (v) {
367367 av_log(f->avctx, AV_LOG_ERROR, "bytestream end mismatching by %d\n", v);
368368 fs->slice_damaged = 1;
@@ -421,7 +421,7 @@ static int read_quant_tables(RangeCoder *c, · 52 unmodified lines
421421
422422 static int read_extra_header(FFV1Context *f)
423423 {
424− RangeCoder *const c = &f->c;
424+ RangeCoder c;
425425 uint8_t state[CONTEXT_SIZE];
426426 int ret;
427427 uint8_t state2[32][CONTEXT_SIZE];
@@ -430,10 +430,10 @@ static int read_extra_header(FFV1Context *f) · 2 unmodified lines
430430 memset(state2, 128, sizeof(state2));
431431 memset(state, 128, sizeof(state));
432432
433− ff_init_range_decoder(c, f->avctx->extradata, f->avctx->extradata_size);
434− ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);
433+ ff_init_range_decoder(&c, f->avctx->extradata, f->avctx->extradata_size);
434+ ff_build_rac_states(&c, 0.05 * (1LL << 32), 256 - 8);
435435
436− f->version = get_symbol(c, state, 0);
436+ f->version = get_symbol(&c, state, 0);
437437 if (f->version < 2) {
438438 av_log(f->avctx, AV_LOG_ERROR, "Invalid version in global header\n");
439439 return AVERROR_INVALIDDATA;
@@ -444,27 +444,27 @@ static int read_extra_header(FFV1Context *f) · 4 unmodified lines
444444 return AVERROR_PATCHWELCOME;
445445 }
446446 if (f->version > 2) {
447− c->bytestream_end -= 4;
448− f->micro_version = get_symbol(c, state, 0);
447+ c.bytestream_end -= 4;
448+ f->micro_version = get_symbol(&c, state, 0);
449449 if (f->micro_version < 0)
450450 return AVERROR_INVALIDDATA;
451451 }
452− f->ac = get_symbol(c, state, 0);
452+ f->ac = get_symbol(&c, state, 0);
453453
454454 if (f->ac == AC_RANGE_CUSTOM_TAB) {
455455 for (int i = 1; i < 256; i++)
456− f->state_transition[i] = get_symbol(c, state, 1) + c->one_state[i];
456+ f->state_transition[i] = get_symbol(&c, state, 1) + c.one_state[i];
457457 }
458458
459− f->colorspace = get_symbol(c, state, 0); //YUV cs type
460− f->avctx->bits_per_raw_sample = get_symbol(c, state, 0);
461− f->chroma_planes = get_rac(c, state);
462− f->chroma_h_shift = get_symbol(c, state, 0);
463− f->chroma_v_shift = get_symbol(c, state, 0);
464− f->transparency = get_rac(c, state);
459+ f->colorspace = get_symbol(&c, state, 0); //YUV cs type
460+ f->avctx->bits_per_raw_sample = get_symbol(&c, state, 0);
461+ f->chroma_planes = get_rac(&c, state);
462+ f->chroma_h_shift = get_symbol(&c, state, 0);
463+ f->chroma_v_shift = get_symbol(&c, state, 0);
464+ f->transparency = get_rac(&c, state);
465465 f->plane_count = 1 + (f->chroma_planes || f->version<4) + f->transparency;
466− f->num_h_slices = 1 + get_symbol(c, state, 0);
467− f->num_v_slices = 1 + get_symbol(c, state, 0);
466+ f->num_h_slices = 1 + get_symbol(&c, state, 0);
467+ f->num_v_slices = 1 + get_symbol(&c, state, 0);
468468
469469 if (f->chroma_h_shift > 4U || f->chroma_v_shift > 4U) {
470470 av_log(f->avctx, AV_LOG_ERROR, "chroma shift parameters %d %d are invalid\n",
@@ -484,7 +484,7 @@ static int read_extra_header(FFV1Context *f) · 13 unmodified lines
484484 return AVERROR_PATCHWELCOME;
485485 }
486486
487− f->quant_table_count = get_symbol(c, state, 0);
487+ f->quant_table_count = get_symbol(&c, state, 0);
488488 if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || !f->quant_table_count) {
489489 av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", f->quant_table_count);
490490 f->quant_table_count = 0;
@@ -492,7 +492,7 @@ static int read_extra_header(FFV1Context *f) · 1 unmodified line
492492 }
493493
494494 for (int i = 0; i < f->quant_table_count; i++) {
495− f->context_count[i] = read_quant_tables(c, f->quant_tables[i]);
495+ f->context_count[i] = read_quant_tables(&c, f->quant_tables[i]);
496496 if (f->context_count[i] < 0) {
497497 av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n");
498498 return AVERROR_INVALIDDATA;
@@ -502,19 +502,19 @@ static int read_extra_header(FFV1Context *f) · 3 unmodified lines
502502 return ret;
503503
504504 for (int i = 0; i < f->quant_table_count; i++)
505− if (get_rac(c, state)) {
505+ if (get_rac(&c, state)) {
506506 for (int j = 0; j < f->context_count[i]; j++)
507507 for (int k = 0; k < CONTEXT_SIZE; k++) {
508508 int pred = j ? f->initial_states[i][j - 1][k] : 128;
509509 f->initial_states[i][j][k] =
510− (pred + get_symbol(c, state2[k], 1)) & 0xFF;
510+ (pred + get_symbol(&c, state2[k], 1)) & 0xFF;
511511 }
512512 }
513513
514514 if (f->version > 2) {
515− f->ec = get_symbol(c, state, 0);
515+ f->ec = get_symbol(&c, state, 0);
516516 if (f->micro_version > 2)
517− f->intra = get_symbol(c, state, 0);
517+ f->intra = get_symbol(&c, state, 0);
518518 }
519519
520520 if (f->version > 2) {
@@ -550,7 +550,7 @@ static int read_header(FFV1Context *f) · 29 unmodified lines
550550 {
551551 uint8_t state[CONTEXT_SIZE];
552552 int context_count = -1; //-1 to avoid warning
553− RangeCoder *const c = &f->slice_context[0]->c;
553+ RangeCoder *const c = &f->slices[0].c;
554554
555555 memset(state, 128, sizeof(state));
556556
@@ -868,7 +868,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 311 unmodified lines
868868 uint8_t *buf = avpkt->data;
869869 int buf_size = avpkt->size;
870870 FFV1Context *f = avctx->priv_data;
871− RangeCoder *const c = &f->slice_context[0]->c;
871+ RangeCoder *const c = &f->slices[0].c;
872872 int ret, key_frame;
873873 uint8_t keystate = 128;
874874 uint8_t *buf_p;
@@ -939,6 +939,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 64 unmodified lines
939939 buf_p = buf + buf_size;
940940 for (int i = f->slice_count - 1; i >= 0; i--) {
941941 FFV1Context *fs = f->slice_context[i];
942+ FFV1SliceContext *sc = &f->slices[i];
942943 int trailer = 3 + 5*!!f->ec;
943944 int v;
944945
@@ -973,9 +974,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 28 unmodified lines
973974 }
974975
975976 if (i) {
976− ff_init_range_decoder(&fs->c, buf_p, v);
977+ ff_init_range_decoder(&sc->c, buf_p, v);
978+ ff_build_rac_states(&sc->c, 0.05 * (1LL << 32), 256 - 8);
977979 } else
978− fs->c.bytestream_end = buf_p + v;
980+ sc->c.bytestream_end = buf_p + v;
979981
980982 fs->avctx = avctx;
981983 }
libavcodec/ffv1dec_template.c+1−1
@@ -30,7 +30,7 @@ RENAME(decode_line)(FFV1Context *f, · 29 unmodified lines
3030 int ac)
3131 {
3232 PlaneContext *const p = &sc->plane[plane_index];
33− RangeCoder *const c = &s->c;
33+ RangeCoder *const c = &sc->c;
3434 const int16_t (*quant_table)[256] = f->quant_tables[p->quant_table_index];
3535 int x;
3636 int run_count = 0;
libavcodec/ffv1enc.c+42−40
@@ -349,7 +349,7 @@ static void write_header(FFV1Context *f) · 348 unmodified lines
349349 {
350350 uint8_t state[CONTEXT_SIZE];
351351 int i, j;
352− RangeCoder *const c = &f->slice_context[0]->c;
352+ RangeCoder *const c = &f->slices[0].c;
353353
354354 memset(state, 128, sizeof(state));
355355
@@ -394,7 +394,7 @@ static void write_header(FFV1Context *f) · 38 unmodified lines
394394
395395 static int write_extradata(FFV1Context *f)
396396 {
397− RangeCoder *const c = &f->c;
397+ RangeCoder c;
398398 uint8_t state[CONTEXT_SIZE];
399399 int i, j, k;
400400 uint8_t state2[32][CONTEXT_SIZE];
@@ -408,56 +408,56 @@ static int write_extradata(FFV1Context *f) · 7 unmodified lines
408408 f->avctx->extradata = av_malloc(f->avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
409409 if (!f->avctx->extradata)
410410 return AVERROR(ENOMEM);
411− ff_init_range_encoder(c, f->avctx->extradata, f->avctx->extradata_size);
412− ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);
411+ ff_init_range_encoder(&c, f->avctx->extradata, f->avctx->extradata_size);
412+ ff_build_rac_states(&c, 0.05 * (1LL << 32), 256 - 8);
413413
414− put_symbol(c, state, f->version, 0);
414+ put_symbol(&c, state, f->version, 0);
415415 if (f->version > 2) {
416416 if (f->version == 3) {
417417 f->micro_version = 4;
418418 } else if (f->version == 4)
419419 f->micro_version = 2;
420− put_symbol(c, state, f->micro_version, 0);
420+ put_symbol(&c, state, f->micro_version, 0);
421421 }
422422
423− put_symbol(c, state, f->ac, 0);
423+ put_symbol(&c, state, f->ac, 0);
424424 if (f->ac == AC_RANGE_CUSTOM_TAB)
425425 for (i = 1; i < 256; i++)
426− put_symbol(c, state, f->state_transition[i] - c->one_state[i], 1);
427−
428− put_symbol(c, state, f->colorspace, 0); // YUV cs type
429− put_symbol(c, state, f->bits_per_raw_sample, 0);
430− put_rac(c, state, f->chroma_planes);
431− put_symbol(c, state, f->chroma_h_shift, 0);
432− put_symbol(c, state, f->chroma_v_shift, 0);
433− put_rac(c, state, f->transparency);
434− put_symbol(c, state, f->num_h_slices - 1, 0);
435− put_symbol(c, state, f->num_v_slices - 1, 0);
436−
437− put_symbol(c, state, f->quant_table_count, 0);
426+ put_symbol(&c, state, f->state_transition[i] - c.one_state[i], 1);
427+
428+ put_symbol(&c, state, f->colorspace, 0); // YUV cs type
429+ put_symbol(&c, state, f->bits_per_raw_sample, 0);
430+ put_rac(&c, state, f->chroma_planes);
431+ put_symbol(&c, state, f->chroma_h_shift, 0);
432+ put_symbol(&c, state, f->chroma_v_shift, 0);
433+ put_rac(&c, state, f->transparency);
434+ put_symbol(&c, state, f->num_h_slices - 1, 0);
435+ put_symbol(&c, state, f->num_v_slices - 1, 0);
436+
437+ put_symbol(&c, state, f->quant_table_count, 0);
438438 for (i = 0; i < f->quant_table_count; i++)
439− write_quant_tables(c, f->quant_tables[i]);
439+ write_quant_tables(&c, f->quant_tables[i]);
440440
441441 for (i = 0; i < f->quant_table_count; i++) {
442442 if (contains_non_128(f->initial_states[i], f->context_count[i])) {
443− put_rac(c, state, 1);
443+ put_rac(&c, state, 1);
444444 for (j = 0; j < f->context_count[i]; j++)
445445 for (k = 0; k < CONTEXT_SIZE; k++) {
446446 int pred = j ? f->initial_states[i][j - 1][k] : 128;
447− put_symbol(c, state2[k],
447+ put_symbol(&c, state2[k],
448448 (int8_t)(f->initial_states[i][j][k] - pred), 1);
449449 }
450450 } else {
451− put_rac(c, state, 0);
451+ put_rac(&c, state, 0);
452452 }
453453 }
454454
455455 if (f->version > 2) {
456− put_symbol(c, state, f->ec, 0);
457− put_symbol(c, state, f->intra = (f->avctx->gop_size < 2), 0);
456+ put_symbol(&c, state, f->ec, 0);
457+ put_symbol(&c, state, f->intra = (f->avctx->gop_size < 2), 0);
458458 }
459459
460− f->avctx->extradata_size = ff_rac_terminate(c, 0);
460+ f->avctx->extradata_size = ff_rac_terminate(&c, 0);
461461 v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, f->avctx->extradata, f->avctx->extradata_size);
462462 AV_WL32(f->avctx->extradata + f->avctx->extradata_size, v);
463463 f->avctx->extradata_size += 4;
@@ -883,6 +883,8 @@ slices_ok: · 419 unmodified lines
883883 p->quant_table_index = s->context_model;
884884 p->context_count = s->context_count[p->quant_table_index];
885885 }
886+
887+ ff_build_rac_states(&s->slices[j].c, 0.05 * (1LL << 32), 256 - 8);
886888 }
887889
888890 if ((ret = ff_ffv1_init_slices_state(s)) < 0)
@@ -910,7 +912,7 @@ slices_ok: · 21 unmodified lines
910912 static void encode_slice_header(FFV1Context *f, FFV1Context *fs,
911913 FFV1SliceContext *sc)
912914 {
913− RangeCoder *c = &fs->c;
915+ RangeCoder *c = &sc->c;
914916 uint8_t state[CONTEXT_SIZE];
915917 int j;
916918 memset(state, 128, sizeof(state));
@@ -1037,7 +1039,7 @@ static int encode_slice(AVCodecContext *c, void *arg) · 120 unmodified lines
10371039 const AVFrame *const p = f->cur_enc_frame;
10381040 const int ps = av_pix_fmt_desc_get(c->pix_fmt)->comp[0].step;
10391041 int ret;
1040− RangeCoder c_bak = fs->c;
1042+ RangeCoder c_bak = sc->c;
10411043 const uint8_t *planes[4] = {p->data[0] + ps*x + y*p->linesize[0],
10421044 p->data[1] ? p->data[1] + ps*x + y*p->linesize[1] : NULL,
10431045 p->data[2] ? p->data[2] + ps*x + y*p->linesize[2] : NULL,
@@ -1058,10 +1060,10 @@ retry: · 14 unmodified lines
10581060 encode_slice_header(f, fs, sc);
10591061 }
10601062 if (f->ac == AC_GOLOMB_RICE) {
1061− fs->ac_byte_count = f->version > 2 || (!x && !y) ? ff_rac_terminate(&fs->c, f->version > 2) : 0;
1063+ fs->ac_byte_count = f->version > 2 || (!x && !y) ? ff_rac_terminate(&sc->c, f->version > 2) : 0;
10621064 init_put_bits(&sc->pb,
1063− fs->c.bytestream_start + fs->ac_byte_count,
1064− fs->c.bytestream_end - fs->c.bytestream_start - fs->ac_byte_count);
1065+ sc->c.bytestream_start + fs->ac_byte_count,
1066+ sc->c.bytestream_end - sc->c.bytestream_start - fs->ac_byte_count);
10651067 }
10661068
10671069 if (f->colorspace == 0 && c->pix_fmt != AV_PIX_FMT_YA8) {
@@ -1095,7 +1097,7 @@ retry: · 27 unmodified lines
10951097 }
10961098 av_log(c, AV_LOG_DEBUG, "Coding slice as PCM\n");
10971099 sc->slice_coding_mode = 1;
1098− fs->c = c_bak;
1100+ sc->c = c_bak;
10991101 goto retry;
11001102 }
11011103
@@ -1106,7 +1108,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 4 unmodified lines
11061108 const AVFrame *pict, int *got_packet)
11071109 {
11081110 FFV1Context *f = avctx->priv_data;
1109− RangeCoder *const c = &f->slice_context[0]->c;
1111+ RangeCoder *const c = &f->slices[0].c;
11101112 uint8_t keystate = 128;
11111113 uint8_t *buf_p;
11121114 int i, ret;
@@ -1194,15 +1196,15 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 81 unmodified lines
11941196 }
11951197
11961198 for (i = 0; i < f->slice_count; i++) {
1197− FFV1Context *fs = f->slice_context[i];
1199+ FFV1SliceContext *sc = &f->slices[i];
11981200 uint8_t *start = pkt->data + pkt->size * (int64_t)i / f->slice_count;
11991201 int len = pkt->size / f->slice_count;
12001202 if (i) {
1201− ff_init_range_encoder(&fs->c, start, len);
1203+ ff_init_range_encoder(&sc->c, start, len);
12021204 } else {
1203− av_assert0(fs->c.bytestream_end >= fs->c.bytestream_start + len);
1204− av_assert0(fs->c.bytestream < fs->c.bytestream_start + len);
1205− fs->c.bytestream_end = fs->c.bytestream_start + len;
1205+ av_assert0(sc->c.bytestream_end >= sc->c.bytestream_start + len);
1206+ av_assert0(sc->c.bytestream < sc->c.bytestream_start + len);
1207+ sc->c.bytestream_end = sc->c.bytestream_start + len;
12061208 }
12071209 }
12081210 avctx->execute(avctx, encode_slice, &f->slice_context[0], NULL,
@@ -1215,14 +1217,14 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 6 unmodified lines
12151217 int bytes;
12161218
12171219 if (f->ac != AC_GOLOMB_RICE) {
1218− bytes = ff_rac_terminate(&fs->c, 1);
1220+ bytes = ff_rac_terminate(&sc->c, 1);
12191221 } else {
12201222 flush_put_bits(&sc->pb); // FIXME: nicer padding
12211223 bytes = fs->ac_byte_count + put_bytes_output(&sc->pb);
12221224 }
12231225 if (i > 0 || f->version > 2) {
12241226 av_assert0(bytes < pkt->size / f->slice_count);
1225− memmove(buf_p, fs->c.bytestream_start, bytes);
1227+ memmove(buf_p, sc->c.bytestream_start, bytes);
12261228 av_assert0(bytes < (1 << 24));
12271229 AV_WB24(buf_p + bytes, bytes);
12281230 bytes += 3;
libavcodec/ffv1enc_template.c+1−1
@@ -29,7 +29,7 @@ RENAME(encode_line)(FFV1Context *f, · 28 unmodified lines
2929 int ac)
3030 {
3131 PlaneContext *const p = &sc->plane[plane_index];
32− RangeCoder *const c = &s->c;
32+ RangeCoder *const c = &sc->c;
3333 int x;
3434 int run_index = sc->run_index;
3535 int run_count = 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