* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "dsputil.h"
#include "binkdata.h"
BINK_SRC_X_OFF, ///< X components of motion value
BINK_SRC_Y_OFF, ///< Y components of motion value
BINK_SRC_INTRA_DC, ///< DC values for intrablocks with DCT
- BINK_SRC_INTER_DC, ///< DC values for intrablocks with DCT
+ BINK_SRC_INTER_DC, ///< DC values for interblocks with DCT
BINK_SRC_RUN, ///< run lengths for special fill block
BINK_NB_SRC
};
/**
- * Initializes length length in all bundles.
+ * Initialize length length in all bundles.
*
* @param c decoder context
* @param width plane width
}
/**
- * Allocates memory for bundles.
+ * Allocate memory for bundles.
*
* @param c decoder context
*/
}
/**
- * Frees memory used by bundles.
+ * Free memory used by bundles.
*
* @param c decoder context
*/
}
/**
- * Merges two consequent lists of equal size depending on bits read.
+ * Merge two consequent lists of equal size depending on bits read.
*
* @param gb context for reading bits
* @param dst buffer where merged list will be written to
}
/**
- * Reads information about Huffman tree used to decode data.
+ * Read information about Huffman tree used to decode data.
*
* @param gb context for reading bits
* @param tree pointer for storing tree data
}
/**
- * Prepares bundle for decoding data.
+ * Prepare bundle for decoding data.
*
* @param gb context for reading bits
* @param c decoder context
return 0;
}
-const uint8_t bink_rlelens[4] = { 4, 8, 12, 32 };
+static const uint8_t bink_rlelens[4] = { 4, 8, 12, 32 };
static int read_block_types(AVCodecContext *avctx, GetBitContext *gb, Bundle *b)
{
}
/**
- * Retrieves next value from bundle.
+ * Retrieve next value from bundle.
*
* @param c decoder context
* @param bundle bundle number
}
/**
- * Reads 8x8 block of DCT coefficients.
+ * Read 8x8 block of DCT coefficients.
*
* @param gb context for reading bits
* @param block place for storing coefficients
}
/**
- * Reads 8x8 block with residue after motion compensation.
+ * Read 8x8 block with residue after motion compensation.
*
* @param gb context for reading bits
* @param block place to store read data
int v, col[2];
const uint8_t *scan;
int xoff, yoff;
- DECLARE_ALIGNED_16(DCTELEM, block[64]);
- DECLARE_ALIGNED_16(uint8_t, ublock[64]);
+ LOCAL_ALIGNED_16(DCTELEM, block, [64]);
+ LOCAL_ALIGNED_16(uint8_t, ublock, [64]);
int coordmap[64];
const int stride = c->pic.linesize[plane_idx];
init_get_bits(&gb, pkt->data, bits_count);
if (c->has_alpha) {
- int aplane_bits = get_bits_long(&gb, 32) << 3;
- if (aplane_bits <= 32 || (aplane_bits & 0x1F)) {
- av_log(avctx, AV_LOG_ERROR, "Incorrect alpha plane size %d\n", aplane_bits);
+ if (c->version >= 'i')
+ skip_bits_long(&gb, 32);
+ if (bink_decode_plane(c, &gb, 3, 0) < 0)
return -1;
- }
- skip_bits_long(&gb, aplane_bits - 32);
}
if (c->version >= 'i')
skip_bits_long(&gb, 32);
}
flags = AV_RL32(avctx->extradata);
c->has_alpha = flags & BINK_FLAG_ALPHA;
- c->swap_planes = c->version >= 'i';
+ c->swap_planes = c->version >= 'h';
if (!bink_trees[15].table) {
for (i = 0; i < 16; i++) {
const int maxbits = bink_tree_lens[i][15];
c->pic.data[0] = NULL;
- if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
+ if (av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0) {
return 1;
}
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = c->has_alpha ? PIX_FMT_YUVA420P : PIX_FMT_YUV420P;
avctx->idct_algo = FF_IDCT_BINK;
dsputil_init(&c->dsp, avctx);
AVCodec bink_decoder = {
"binkvideo",
- CODEC_TYPE_VIDEO,
+ AVMEDIA_TYPE_VIDEO,
CODEC_ID_BINKVIDEO,
sizeof(BinkContext),
decode_init,