static int read_block_types(AVCodecContext *avctx, GetBitContext *gb, Bundle *b)
{
+ BinkContext * const c = avctx->priv_data;
int t, v;
int last = 0;
const uint8_t *dec_end;
CHECK_READ_VAL(gb, b, t);
+ if (c->version == 'k') {
+ t ^= 0xBBu;
+ if (t == 0) {
+ b->cur_dec = NULL;
+ return 0;
+ }
+ }
dec_end = b->cur_dec + t;
if (dec_end > b->data_end) {
av_log(avctx, AV_LOG_ERROR, "Too many block type values\n");
* @param quant_matrices quantization matrices
* @return 0 for success, negative value in other cases
*/
-static int read_dct_coeffs(GetBitContext *gb, int32_t block[64],
+static int read_dct_coeffs(BinkContext *c, GetBitContext *gb, int32_t block[64],
const uint8_t *scan, int *coef_count_,
int coef_idx[64], int q)
{
} else {
quant_idx = q;
if (quant_idx > 15U) {
- av_log(NULL, AV_LOG_ERROR, "quant_index %d out of range\n", quant_idx);
+ av_log(c->avctx, AV_LOG_ERROR, "quant_index %d out of range\n", quant_idx);
return AVERROR_INVALIDDATA;
}
}
memset(dctblock, 0, sizeof(*dctblock) * 64);
dctblock[0] = binkb_get_value(c, BINKB_SRC_INTRA_DC);
qp = binkb_get_value(c, BINKB_SRC_INTRA_Q);
- if ((quant_idx = read_dct_coeffs(gb, dctblock, bink_scan, &coef_count, coef_idx, qp)) < 0)
+ if ((quant_idx = read_dct_coeffs(c, gb, dctblock, bink_scan, &coef_count, coef_idx, qp)) < 0)
return quant_idx;
unquantize_dct_coeffs(dctblock, binkb_intra_quant[quant_idx], coef_count, coef_idx, bink_scan);
c->binkdsp.idct_put(dst, stride, dctblock);
memset(dctblock, 0, sizeof(*dctblock) * 64);
dctblock[0] = binkb_get_value(c, BINKB_SRC_INTER_DC);
qp = binkb_get_value(c, BINKB_SRC_INTER_Q);
- if ((quant_idx = read_dct_coeffs(gb, dctblock, bink_scan, &coef_count, coef_idx, qp)) < 0)
+ if ((quant_idx = read_dct_coeffs(c, gb, dctblock, bink_scan, &coef_count, coef_idx, qp)) < 0)
return quant_idx;
unquantize_dct_coeffs(dctblock, binkb_inter_quant[quant_idx], coef_count, coef_idx, bink_scan);
c->binkdsp.idct_add(dst, stride, dctblock);
int bw = is_chroma ? (c->avctx->width + 15) >> 4 : (c->avctx->width + 7) >> 3;
int bh = is_chroma ? (c->avctx->height + 15) >> 4 : (c->avctx->height + 7) >> 3;
int width = c->avctx->width >> is_chroma;
+ int height = c->avctx->height >> is_chroma;
+
+ if (c->version == 'k' && get_bits1(gb)) {
+ int fill = get_bits(gb, 8);
+
+ dst = frame->data[plane_idx];
+
+ for (i = 0; i < height; i++)
+ memset(dst + i * stride, fill, width);
+ goto end;
+ }
init_lengths(c, FFMAX(width, 8), bw);
for (i = 0; i < BINK_NB_SRC; i++)
case INTRA_BLOCK:
memset(dctblock, 0, sizeof(*dctblock) * 64);
dctblock[0] = get_value(c, BINK_SRC_INTRA_DC);
- if ((quant_idx = read_dct_coeffs(gb, dctblock, bink_scan, &coef_count, coef_idx, -1)) < 0)
+ if ((quant_idx = read_dct_coeffs(c, gb, dctblock, bink_scan, &coef_count, coef_idx, -1)) < 0)
return quant_idx;
unquantize_dct_coeffs(dctblock, bink_intra_quant[quant_idx], coef_count, coef_idx, bink_scan);
c->binkdsp.idct_put(ublock, 8, dctblock);
case INTRA_BLOCK:
memset(dctblock, 0, sizeof(*dctblock) * 64);
dctblock[0] = get_value(c, BINK_SRC_INTRA_DC);
- if ((quant_idx = read_dct_coeffs(gb, dctblock, bink_scan, &coef_count, coef_idx, -1)) < 0)
+ if ((quant_idx = read_dct_coeffs(c, gb, dctblock, bink_scan, &coef_count, coef_idx, -1)) < 0)
return quant_idx;
unquantize_dct_coeffs(dctblock, bink_intra_quant[quant_idx], coef_count, coef_idx, bink_scan);
c->binkdsp.idct_put(dst, stride, dctblock);
return ret;
memset(dctblock, 0, sizeof(*dctblock) * 64);
dctblock[0] = get_value(c, BINK_SRC_INTER_DC);
- if ((quant_idx = read_dct_coeffs(gb, dctblock, bink_scan, &coef_count, coef_idx, -1)) < 0)
+ if ((quant_idx = read_dct_coeffs(c, gb, dctblock, bink_scan, &coef_count, coef_idx, -1)) < 0)
return quant_idx;
unquantize_dct_coeffs(dctblock, bink_inter_quant[quant_idx], coef_count, coef_idx, bink_scan);
c->binkdsp.idct_add(dst, stride, dctblock);
}
}
}
+
+end:
if (get_bits_count(gb) & 0x1F) //next plane data starts at 32-bit boundary
skip_bits_long(gb, 32 - (get_bits_count(gb) & 0x1F));
return ret;
avctx->pix_fmt = c->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
+ avctx->color_range = c->version == 'k' ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
ff_blockdsp_init(&c->bdsp, avctx);
ff_hpeldsp_init(&c->hdsp, avctx->flags);