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

Function write_header

libavcodec/ffv1enc.c:384–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384static void write_header(FFV1Context *f)
385{
386 uint8_t state[CONTEXT_SIZE];
387 int i, j;
388 RangeCoder *const c = &f->slices[0].c;
389
390 memset(state, 128, sizeof(state));
391
392 if (f->version < 2) {
393 put_symbol(c, state, f->version, 0);
394 put_symbol(c, state, f->ac, 0);
395 if (f->ac == AC_RANGE_CUSTOM_TAB) {
396 for (i = 1; i < 256; i++)
397 put_symbol(c, state,
398 f->state_transition[i] - c->one_state[i], 1);
399 }
400 put_symbol(c, state, f->colorspace, 0); //YUV cs type
401 if (f->version > 0)
402 put_symbol(c, state, f->bits_per_raw_sample, 0);
403 put_rac(c, state, f->chroma_planes);
404 put_symbol(c, state, f->chroma_h_shift, 0);
405 put_symbol(c, state, f->chroma_v_shift, 0);
406 put_rac(c, state, f->transparency);
407
408 write_quant_tables(c, f->quant_tables[f->context_model]);
409 } else if (f->version < 3) {
410 put_symbol(c, state, f->slice_count, 0);
411 for (i = 0; i < f->slice_count; i++) {
412 FFV1SliceContext *fs = &f->slices[i];
413 put_symbol(c, state,
414 (fs->slice_x + 1) * f->num_h_slices / f->width, 0);
415 put_symbol(c, state,
416 (fs->slice_y + 1) * f->num_v_slices / f->height, 0);
417 put_symbol(c, state,
418 (fs->slice_width + 1) * f->num_h_slices / f->width - 1,
419 0);
420 put_symbol(c, state,
421 (fs->slice_height + 1) * f->num_v_slices / f->height - 1,
422 0);
423 for (j = 0; j < f->plane_count; j++) {
424 put_symbol(c, state, fs->plane[j].quant_table_index, 0);
425 av_assert0(fs->plane[j].quant_table_index == f->context_model);
426 }
427 }
428 }
429}
430
431static void set_micro_version(FFV1Context *f)
432{

Callers 1

encode_frameFunction · 0.70

Calls 3

put_racFunction · 0.85
write_quant_tablesFunction · 0.85
put_symbolFunction · 0.70

Tested by

no test coverage detected