assert(k <= 8);
v = get_sr_golomb(gb, k, 12, bits);
- av_dlog(NULL, "v:%d bias:%d error:%d drift:%d count:%d k:%d",
+ ff_dlog(NULL, "v:%d bias:%d error:%d drift:%d count:%d k:%d",
v, state->bias, state->error_sum, state->drift, state->count, k);
#if 0 // JPEG LS
av_assert2(context < p->context_count);
- if (s->ac) {
+ if (s->ac != AC_GOLOMB_RICE) {
diff = get_symbol_inline(c, p->state[context], 1);
} else {
if (context == 0 && run_mode == 0)
} else
diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits);
- av_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n",
+ ff_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n",
run_count, run_index, run_mode, x, get_bits_count(&s->gb));
}
unsigned ps, i, context_count;
memset(state, 128, sizeof(state));
- if (fs->ac > 1) {
+ if (fs->ac == AC_RANGE_CUSTOM_TAB) {
for (i = 1; i < 256; i++) {
fs->c.one_state[i] = f->state_transition[i];
fs->c.zero_state[256 - i] = 256 - fs->c.one_state[i];
x = fs->slice_x;
y = fs->slice_y;
- if (!fs->ac) {
+ if (fs->ac == AC_GOLOMB_RICE) {
if (f->version == 3 && f->minor_version > 1 || f->version > 3)
get_rac(&fs->c, (uint8_t[]) { 129 });
fs->ac_byte_count = f->version > 2 || (!x && !y) ? fs->c.bytestream - fs->c.bytestream_start - 1 : 0;
av_assert1(width && height);
if (f->colorspace == 0) {
- const int chroma_width = -((-width) >> f->chroma_h_shift);
- const int chroma_height = -((-height) >> f->chroma_v_shift);
+ const int chroma_width = AV_CEIL_RSHIFT(width, f->chroma_h_shift);
+ const int chroma_height = AV_CEIL_RSHIFT(height, f->chroma_v_shift);
const int cx = x >> f->chroma_h_shift;
const int cy = y >> f->chroma_v_shift;
decode_plane(fs, p->data[0] + ps * x + y * p->linesize[0], width,
p->data[2] + ps * x + y * p->linesize[2] };
decode_rgb_frame(fs, planes, width, height, p->linesize);
}
- if (fs->ac && f->version > 2) {
+ if (fs->ac != AC_GOLOMB_RICE && f->version > 2) {
int v;
get_rac(&fs->c, (uint8_t[]) { 129 });
v = fs->c.bytestream_end - fs->c.bytestream - 2 - 5 * f->ec;
c->bytestream_end -= 4;
f->minor_version = get_symbol(c, state, 0);
}
- f->ac = f->avctx->coder_type = get_symbol(c, state, 0);
+ f->ac = get_symbol(c, state, 0);
- if (f->ac > 1) {
+ if (f->ac == AC_RANGE_CUSTOM_TAB) {
for (i = 1; i < 256; i++)
f->state_transition[i] = get_symbol(c, state, 1) + c->one_state[i];
}
}
f->version = v;
- f->ac = f->avctx->coder_type = get_symbol(c, state, 0);
+ f->ac = get_symbol(c, state, 0);
- if (f->ac > 1) {
+ if (f->ac == AC_RANGE_CUSTOM_TAB) {
for (i = 1; i < 256; i++)
f->state_transition[i] =
get_symbol(c, state, 1) + c->one_state[i];
}
if (f->colorspace == 0) {
+ if (f->transparency && f->avctx->bits_per_raw_sample > 8) {
+ av_log(f->avctx, AV_LOG_ERROR,
+ "Transparency not supported for bit depth %d\n",
+ f->avctx->bits_per_raw_sample);
+ return AVERROR(ENOSYS);
+ }
if (!f->transparency && !f->chroma_planes) {
if (f->avctx->bits_per_raw_sample <= 8)
f->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
"chroma subsampling not supported in this colorspace\n");
return AVERROR(ENOSYS);
}
+ if (f->transparency) {
+ av_log(f->avctx, AV_LOG_ERROR,
+ "Transparency not supported in this colorspace\n");
+ return AVERROR(ENOSYS);
+ }
switch (f->avctx->bits_per_raw_sample) {
case 0:
case 8:
return AVERROR(ENOSYS);
}
- av_dlog(f->avctx, "%d %d %d\n",
+ ff_dlog(f->avctx, "%d %d %d\n",
f->chroma_h_shift, f->chroma_v_shift, f->avctx->pix_fmt);
if (f->version < 2) {
context_count = read_quant_tables(c, f->quant_table);
static int ffv1_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
+ uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
FFV1Context *f = avctx->priv_data;
RangeCoder *const c = &f->slice_context[0]->c;
int i, ret;
uint8_t keystate = 128;
- const uint8_t *buf_p;
+ uint8_t *buf_p;
AVFrame *const p = data;
f->cur = p;
if (i) {
ff_init_range_decoder(&fs->c, buf_p, v);
} else
- fs->c.bytestream_end = (uint8_t *)(buf_p + v);
+ fs->c.bytestream_end = buf_p + v;
fs->cur = p;
}
f->last_picture->linesize[j] *
(fs->slice_y >> sv) + (fs->slice_x >> sh);
}
- av_image_copy(dst, p->linesize, (const uint8_t **)src,
+ av_image_copy(dst, p->linesize, src,
f->last_picture->linesize,
avctx->pix_fmt, fs->slice_width,
fs->slice_height);
.init = ffv1_decode_init,
.close = ffv1_decode_close,
.decode = ffv1_decode_frame,
- .capabilities = CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/ |
- CODEC_CAP_SLICE_THREADS,
+ .capabilities = AV_CODEC_CAP_DR1 /*| AV_CODEC_CAP_DRAW_HORIZ_BAND*/ |
+ AV_CODEC_CAP_SLICE_THREADS,
};