MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / encode_histogram_remap

Function encode_histogram_remap

libavcodec/ffv1enc.c:1202–1235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1200}
1201
1202static void encode_histogram_remap(FFV1Context *f, FFV1SliceContext *sc)
1203{
1204 int len = 1 << f->bits_per_raw_sample;
1205 int flip = sc->remap == 2 ? 0x7FFF : 0;
1206
1207 for (int p= 0; p < 1 + 2*f->chroma_planes + f->transparency; p++) {
1208 int j = 0;
1209 int lu = 0;
1210 uint8_t state[2][32];
1211 int run = 0;
1212
1213 memset(state, 128, sizeof(state));
1214 put_symbol(&sc->c, state[0], 0, 0);
1215 memset(state, 128, sizeof(state));
1216 for (int i= 0; i<len; i++) {
1217 int ri = i ^ ((i&0x8000) ? 0 : flip);
1218 int u = sc->fltmap[p][ri];
1219 sc->fltmap[p][ri] = j;
1220 j+= u;
1221
1222 if (lu == u) {
1223 run ++;
1224 } else {
1225 put_symbol_inline(&sc->c, state[lu], run, 0, NULL, NULL);
1226 if (run == 0)
1227 lu = u;
1228 run = 0;
1229 }
1230 }
1231 if (run)
1232 put_symbol(&sc->c, state[lu], run, 0);
1233 sc->remap_count[p] = j;
1234 }
1235}
1236
1237static void load_rgb_float32_frame(FFV1Context *f, FFV1SliceContext *sc,
1238 const uint8_t *src[4],

Callers 1

encode_sliceFunction · 0.85

Calls 2

put_symbol_inlineFunction · 0.85
put_symbolFunction · 0.70

Tested by

no test coverage detected