77 for (j = 0; j <
f->plane_count; j++) {
88 p->vlc_state =
av_calloc(p->context_count,
sizeof(*p->vlc_state));
91 for (
i = 0;
i < p->context_count;
i++) {
92 p->vlc_state[
i].error_sum = 4;
93 p->vlc_state[
i].count = 1;
101 for (j = 1; j < 256; j++) {
102 sc->
c. one_state[ j] =
f->state_transition[j];
113 for (
i = 0;
i <
f->max_slice_count;
i++) {
121 int mpw = 1<<chroma_shift;
128 int mpw = 1<<chroma_shift;
133 if (
f->combined_version <= 0x40002)
134 return width * sx / num_h_slices;
136 sx = (2LL * awidth * sx + num_h_slices * mpw) / (2 * num_h_slices * mpw) * mpw;
144 int max_slice_count =
f->num_h_slices *
f->num_v_slices;
148 f->slices =
av_calloc(max_slice_count,
sizeof(*
f->slices));
152 f->max_slice_count = max_slice_count;
154 for (
int i = 0;
i < max_slice_count;
i++) {
156 int sx =
i %
f->num_h_slices;
157 int sy =
i /
f->num_h_slices;
158 int sxs =
ff_slice_coord(
f,
f->avctx->width , sx ,
f->num_h_slices,
f->chroma_h_shift);
159 int sxe =
ff_slice_coord(
f,
f->avctx->width , sx + 1,
f->num_h_slices,
f->chroma_h_shift);
160 int sys =
ff_slice_coord(
f,
f->avctx->height, sy ,
f->num_v_slices,
f->chroma_v_shift);
161 int sye =
ff_slice_coord(
f,
f->avctx->height, sy + 1,
f->num_v_slices,
f->chroma_v_shift);
189 for (
i = 0;
i <
f->quant_table_count;
i++) {
191 sizeof(*
f->initial_states[
i]));
192 if (!
f->initial_states[
i])
194 memset(
f->initial_states[
i], 128,
195 f->context_count[
i] *
sizeof(*
f->initial_states[
i]));
204 for (
i = 0;
i <
f->plane_count;
i++) {
208 if (
f->initial_states[p->quant_table_index]) {
209 memcpy(p->state,
f->initial_states[p->quant_table_index],
214 for (j = 0; j < p->context_count; j++) {
215 p->vlc_state[j].drift = 0;
216 p->vlc_state[j].error_sum = 4;
217 p->vlc_state[j].bias = 0;
218 p->vlc_state[j].count = 1;
231 sc->
remap_count[3] = 1 << (bits_per_raw_sample > 0 ? bits_per_raw_sample : 8);
238 for (
int p=0; p<3+
f->transparency+
f->bayer; p++) {
255 if (
f->combined_version < 0x40008) {
272 for (j = 0; j <
s->max_slice_count; j++) {
277 for(
int p = 0; p < 4 ; p++) {
289 for (j = 0; j <
s->quant_table_count; j++) {
291 for (
i = 0;
i <
s->max_slice_count;
i++) {
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
#define i(width, name, range_min, range_max)
static struct @346255127015250356166251341105367306144006377143 state
static const uint8_t bits[8]
av_cold int ff_ffv1_init_slice_state(const FFV1Context *f, FFV1SliceContext *sc)
av_cold int ff_ffv1_common_init(AVCodecContext *avctx, FFV1Context *s)
PlaneContext * ff_ffv1_planes_alloc(void)
static void planes_free(AVRefStructOpaque opaque, void *obj)
av_cold int ff_ffv1_init_slices_state(FFV1Context *f)
int ff_slice_coord(const FFV1Context *f, int width, int sx, int num_h_slices, int chroma_shift)
This is intended for both width and height.
int ff_need_new_slices(int width, int num_h_slices, int chroma_shift)
av_cold void ff_ffv1_close(FFV1Context *s)
int ff_ffv1_allocate_initial_states(FFV1Context *f)
void ff_ffv1_clear_slice_state(const FFV1Context *f, FFV1SliceContext *sc)
void ff_ffv1_compute_bits_per_plane(const FFV1Context *f, FFV1SliceContext *sc, int bits[4], int *offset, int mask[4], int bits_per_raw_sample)
av_cold int ff_ffv1_init_slice_contexts(FFV1Context *f)
int ff_ffv1_get_symbol(RangeCoder *c, uint8_t *state, int is_signed)
FF Video Codec 1 (a lossless codec)
#define AC_RANGE_CUSTOM_TAB
static av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state, int is_signed)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Macro definitions for various function/variable attributes.
static const struct @257111027162314367033347246032313251342043035002 planes[]
static const uint16_t mask[17]
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
static void * av_refstruct_alloc_ext(size_t size, unsigned flags, void *opaque, void(*free_cb)(AVRefStructOpaque opaque, void *obj))
A wrapper around av_refstruct_alloc_ext_c() for the common case of a non-const qualified opaque.
main external API structure.
int width
picture width / height.
int flags
AV_CODEC_FLAG_*.
unsigned int fltmap32_size[4]
uint64_t(*[MAX_QUANT_TABLES] rc_stat2)[32][2]
int32_t * sample_buffer32
unsigned int fltmap_size[4]
#define av_malloc_array(a, b)
RefStruct is an API for creating reference-counted objects with minimal overhead.