*/
#include "libavutil/attributes.h"
+#include "libavutil/emms.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/mem_internal.h"
#include "binkdsp.h"
#include "blockdsp.h"
#include "codec_internal.h"
+#include "decode.h"
#include "get_bits.h"
#include "hpeldsp.h"
-#include "internal.h"
-#include "mathops.h"
#define BINK_FLAG_ALPHA 0x00100000
#define BINK_FLAG_GRAY 0x00020000
BINKB_NB_SRC
};
-static const int binkb_bundle_sizes[BINKB_NB_SRC] = {
+static const uint8_t binkb_bundle_sizes[BINKB_NB_SRC] = {
4, 8, 8, 5, 5, 11, 11, 4, 4, 7
};
-static const int binkb_bundle_signed[BINKB_NB_SRC] = {
+static const uint8_t binkb_bundle_signed[BINKB_NB_SRC] = {
0, 0, 0, 1, 1, 0, 1, 0, 0, 0
};
binkb_init_bundles(c);
ref_start = frame->data[plane_idx];
- ref_end = frame->data[plane_idx] + (bh * frame->linesize[plane_idx] + bw) * 8;
+ ref_end = frame->data[plane_idx] + ((bh - 1) * frame->linesize[plane_idx] + bw - 1) * 8;
for (i = 0; i < 64; i++)
coordmap[i] = (i & 7) + (i >> 3) * stride;
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
ref = dst + xoff + yoff * stride;
- if (ref < ref_start || ref + 8*stride > ref_end) {
+ if (ref < ref_start || ref > ref_end) {
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
c->put_pixels_tab(dst, ref, stride, 8);
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
ref = dst + xoff + yoff * stride;
- if (ref < ref_start || ref + 8 * stride > ref_end) {
+ if (ref < ref_start || ref > ref_end) {
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
c->put_pixels_tab(dst, ref, stride, 8);
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
ref = dst + xoff + yoff * stride;
- if (ref < ref_start || ref + 8 * stride > ref_end) {
+ if (ref < ref_start || ref > ref_end) {
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
c->put_pixels_tab(dst, ref, stride, 8);
emms_c();
if (c->version > 'b') {
- av_frame_unref(c->last);
- if ((ret = av_frame_ref(c->last, frame)) < 0)
+ if ((ret = av_frame_replace(c->last, frame)) < 0)
return ret;
}
bink_trees[i].table = table + offset;
bink_trees[i].table_allocated = 1 << maxbits;
offset += bink_trees[i].table_allocated;
- init_vlc(&bink_trees[i], maxbits, 16,
+ vlc_init(&bink_trees[i], maxbits, 16,
bink_tree_lens[i], 1, 1,
- bink_tree_bits[i], 1, 1, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
+ bink_tree_bits[i], 1, 1, VLC_INIT_USE_STATIC | VLC_INIT_LE);
}
}
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_blockdsp_init(&c->bdsp);
ff_hpeldsp_init(&hdsp, avctx->flags);
c->put_pixels_tab = hdsp.put_pixels_tab[1][0];
ff_binkdsp_init(&c->binkdsp);
const FFCodec ff_bink_decoder = {
.p.name = "binkvideo",
- .p.long_name = NULL_IF_CONFIG_SMALL("Bink video"),
+ CODEC_LONG_NAME("Bink video"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_BINKVIDEO,
.priv_data_size = sizeof(BinkContext),
FF_CODEC_DECODE_CB(decode_frame),
.flush = flush,
.p.capabilities = AV_CODEC_CAP_DR1,
- .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
+ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
};