#include "libavutil/opt.h"
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
-#include "libavutil/timer.h"
#include "avcodec.h"
#include "internal.h"
sample[0][-1]= sample[1][0 ];
sample[1][ w]= sample[1][w-1];
-// { START_TIMER
if (s->bits_per_raw_sample <= 8) {
for (x = 0; x < w; x++)
sample[0][x] = src[x * pixel_stride + stride * y];
if((ret = encode_line(s, w, sample, plane_index, s->bits_per_raw_sample)) < 0)
return ret;
}
-// STOP_TIMER("encode line") }
}
return 0;
}
write_quant_table(c, quant_table[i]);
}
+static int contains_non_128(uint8_t (*initial_state)[CONTEXT_SIZE],
+ int nb_contexts)
+{
+ if (!initial_state)
+ return 0;
+ for (int i = 0; i < nb_contexts; i++)
+ for (int j = 0; j < CONTEXT_SIZE; j++)
+ if (initial_state[i][j] != 128)
+ return 1;
+ return 0;
+}
+
static void write_header(FFV1Context *f)
{
uint8_t state[CONTEXT_SIZE];
write_quant_tables(c, f->quant_tables[i]);
for (i = 0; i < f->quant_table_count; i++) {
- for (j = 0; j < f->context_count[i] * CONTEXT_SIZE; j++)
- if (f->initial_states[i] && f->initial_states[i][0][j] != 128)
- break;
- if (j < f->context_count[i] * CONTEXT_SIZE) {
+ if (contains_non_128(f->initial_states[i], f->context_count[i])) {
put_rac(c, state, 1);
for (j = 0; j < f->context_count[i]; j++)
for (k = 0; k < CONTEXT_SIZE; k++) {
return AVERROR_INVALIDDATA;
}
-#if FF_API_CODER_TYPE
-FF_DISABLE_DEPRECATION_WARNINGS
- if (avctx->coder_type != -1)
- s->ac = avctx->coder_type > 0 ? AC_RANGE_CUSTOM_TAB : AC_GOLOMB_RICE;
- else
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
if (s->ac == 1) // Compatbility with common command line usage
s->ac = AC_RANGE_CUSTOM_TAB;
else if (s->ac == AC_RANGE_DEFAULT_TAB_FORCE)
s->ac = AC_RANGE_CUSTOM_TAB;
}
}
-#if FF_API_PRIVATE_OPT
-FF_DISABLE_DEPRECATION_WARNINGS
- if (avctx->context_model)
- s->context_model = avctx->context_model;
- if (avctx->context_model > 1U) {
- av_log(avctx, AV_LOG_ERROR, "Invalid context model %d, valid values are 0 and 1\n", avctx->context_model);
- return AVERROR(EINVAL);
- }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
if (s->ac == AC_RANGE_CUSTOM_TAB) {
for (i = 1; i < 256; i++)
bytes = ff_rac_terminate(&fs->c, 1);
} else {
flush_put_bits(&fs->pb); // FIXME: nicer padding
- bytes = fs->ac_byte_count + (put_bits_count(&fs->pb) + 7) / 8;
+ bytes = fs->ac_byte_count + put_bytes_output(&fs->pb);
}
if (i > 0 || f->version > 2) {
av_assert0(bytes < pkt->size / f->slice_count);
.version = LIBAVUTIL_VERSION_INT,
};
-#if FF_API_CODER_TYPE
-static const AVCodecDefault ffv1_defaults[] = {
- { "coder", "-1" },
- { NULL },
-};
-#endif
-
AVCodec ff_ffv1_encoder = {
.name = "ffv1",
.long_name = NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
AV_PIX_FMT_NONE
},
-#if FF_API_CODER_TYPE
- .defaults = ffv1_defaults,
-#endif
.priv_class = &ffv1_class,
+ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};