Showing the changes to libavcodec (3 of 3 files). Show all
Unified · Split
| @@ -79,13 +79,14 @@ typedef struct FFV1SliceContext { · 78 unmodified lines | ||
| 79 | 79 | int slice_y; |
| 80 | 80 | |
| 81 | 81 | int run_index; |
| 82 | + | |
| 83 | + PutBitContext pb; | |
| 82 | 84 | } FFV1SliceContext; |
| 83 | 85 | |
| 84 | 86 | typedef struct FFV1Context { |
| 85 | 87 | AVClass *class; |
| 86 | 88 | AVCodecContext *avctx; |
| 87 | 89 | RangeCoder c; |
| 88 | − PutBitContext pb; | |
| 89 | 90 | uint64_t rc_stat[256][2]; |
| 90 | 91 | uint64_t (*rc_stat2[MAX_QUANT_TABLES])[32][2]; |
| 91 | 92 | int version; |
| @@ -1057,7 +1057,7 @@ retry: · 1056 unmodified lines | ||
| 1057 | 1057 | } |
| 1058 | 1058 | if (fs->ac == AC_GOLOMB_RICE) { |
| 1059 | 1059 | fs->ac_byte_count = f->version > 2 || (!x && !y) ? ff_rac_terminate(&fs->c, f->version > 2) : 0; |
| 1060 | − init_put_bits(&fs->pb, | |
| 1060 | + init_put_bits(&sc->pb, | |
| 1061 | 1061 | fs->c.bytestream_start + fs->ac_byte_count, |
| 1062 | 1062 | fs->c.bytestream_end - fs->c.bytestream_start - fs->ac_byte_count); |
| 1063 | 1063 | } |
| @@ -1209,13 +1209,14 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 145 unmodified lines | ||
| 1209 | 1209 | buf_p = pkt->data; |
| 1210 | 1210 | for (i = 0; i < f->slice_count; i++) { |
| 1211 | 1211 | FFV1Context *fs = f->slice_context[i]; |
| 1212 | + FFV1SliceContext *sc = &f->slices[i]; | |
| 1212 | 1213 | int bytes; |
| 1213 | 1214 | |
| 1214 | 1215 | if (fs->ac != AC_GOLOMB_RICE) { |
| 1215 | 1216 | bytes = ff_rac_terminate(&fs->c, 1); |
| 1216 | 1217 | } else { |
| 1217 | − flush_put_bits(&fs->pb); // FIXME: nicer padding | |
| 1218 | − bytes = fs->ac_byte_count + put_bytes_output(&fs->pb); | |
| 1218 | + flush_put_bits(&sc->pb); // FIXME: nicer padding | |
| 1219 | + bytes = fs->ac_byte_count + put_bytes_output(&sc->pb); | |
| 1219 | 1220 | } |
| 1220 | 1221 | if (i > 0 || f->version > 2) { |
| 1221 | 1222 | av_assert0(bytes < pkt->size / f->slice_count); |
| @@ -39,7 +39,7 @@ RENAME(encode_line)(FFV1Context *s, FFV1SliceContext *sc, · 38 unmodified lines | ||
| 39 | 39 | return AVERROR_INVALIDDATA; |
| 40 | 40 | } |
| 41 | 41 | } else { |
| 42 | − if (put_bytes_left(&s->pb, 0) < w * 4) { | |
| 42 | + if (put_bytes_left(&sc->pb, 0) < w * 4) { | |
| 43 | 43 | av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); |
| 44 | 44 | return AVERROR_INVALIDDATA; |
| 45 | 45 | } |
| @@ -86,10 +86,10 @@ RENAME(encode_line)(FFV1Context *s, FFV1SliceContext *sc, · 40 unmodified lines | ||
| 86 | 86 | while (run_count >= 1 << ff_log2_run[run_index]) { |
| 87 | 87 | run_count -= 1 << ff_log2_run[run_index]; |
| 88 | 88 | run_index++; |
| 89 | − put_bits(&s->pb, 1, 1); | |
| 89 | + put_bits(&sc->pb, 1, 1); | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | − put_bits(&s->pb, 1 + ff_log2_run[run_index], run_count); | |
| 92 | + put_bits(&sc->pb, 1 + ff_log2_run[run_index], run_count); | |
| 93 | 93 | if (run_index) |
| 94 | 94 | run_index--; |
| 95 | 95 | run_count = 0; |
| @@ -103,21 +103,21 @@ RENAME(encode_line)(FFV1Context *s, FFV1SliceContext *sc, · 7 unmodified lines | ||
| 103 | 103 | |
| 104 | 104 | ff_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n", |
| 105 | 105 | run_count, run_index, run_mode, x, |
| 106 | − (int)put_bits_count(&s->pb)); | |
| 106 | + (int)put_bits_count(&sc->pb)); | |
| 107 | 107 | |
| 108 | 108 | if (run_mode == 0) |
| 109 | − put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits); | |
| 109 | + put_vlc_symbol(&sc->pb, &p->vlc_state[context], diff, bits); | |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | if (run_mode) { |
| 113 | 113 | while (run_count >= 1 << ff_log2_run[run_index]) { |
| 114 | 114 | run_count -= 1 << ff_log2_run[run_index]; |
| 115 | 115 | run_index++; |
| 116 | − put_bits(&s->pb, 1, 1); | |
| 116 | + put_bits(&sc->pb, 1, 1); | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if (run_count) |
| 120 | − put_bits(&s->pb, 1, 1); | |
| 120 | + put_bits(&sc->pb, 1, 1); | |
| 121 | 121 | } |
| 122 | 122 | sc->run_index = run_index; |
| 123 | 123 | |