30 #define BITSTREAM_READER_LE
39 #define IVI4_PIC_SIZE_ESC 7
85 for (
i = 0;
i < 4;
i++)
96 return size_factor == 15 ? def_size : (size_factor + 1) << 5;
108 int pic_size_indx,
i, p;
116 ctx->prev_frame_type =
ctx->frame_type;
118 if (
ctx->frame_type == 7) {
124 ctx->has_b_frames = 1;
138 ff_dlog(avctx,
"Null frame encountered!\n");
147 ff_dlog(avctx,
"Password-protected clip!\n");
161 if (
ctx->uses_tiling) {
191 av_log(avctx,
AV_LOG_ERROR,
"Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n",
200 ctx->pic_conf.luma_bands = 0;
204 ctx->pic_conf = pic_conf;
207 for (p = 0; p <= 2; p++) {
209 ctx->planes[p].bands[
i].mb_size = !p ? (!
ctx->is_scalable ? 16 : 8) : 4;
210 ctx->planes[p].bands[
i].blk_size = !p ? 8 : 4;
215 ctx->pic_conf.tile_height)) {
217 "Couldn't reallocate internal structures!\n");
247 ff_dlog(avctx,
"Pic hdr extension encountered!\n");
274 int plane, band_num, indx, transform_id, scan_indx;
278 memcpy(&temp_band, arg_band,
sizeof(temp_band));
302 ctx->uses_fullpel = 1;
328 if ((transform_id >= 7 && transform_id <= 9) ||
329 transform_id == 17) {
334 if (transform_id < 10 && band->blk_size < 8) {
338 if ((transform_id >= 0 && transform_id <= 2) || transform_id == 10)
345 if (transform_id < 10)
356 if (scan_indx == 15) {
360 if (scan_indx > 4 && scan_indx < 10) {
374 if (quant_mat == 31) {
385 if (old_blk_size != band->
blk_size) {
387 "The band block size does not match the configuration "
453 memcpy(arg_band, band,
sizeof(*arg_band));
472 int x, y, mv_x, mv_y, mv_delta, offs, mb_offset, blks_per_mb,
499 mb->buf_offs = mb_offset;
523 mb->mv_x =
mb->mv_y = 0;
553 if (ref_mb)
mb->q_delta = ref_mb->
q_delta;
562 mb->mv_x =
mb->mv_y = 0;
586 ctx->mb_vlc.tab->table,
590 ctx->mb_vlc.tab->table,
598 mb->b_mv_x = -
mb->mv_x;
599 mb->b_mv_y = -
mb->mv_y;
608 if ( x + (
mb->mv_x >>
s) + (y+ (
mb->mv_y >>
s))*band->
pitch < 0 ||
637 int is_prev_ref = 0, is_ref = 0;
639 switch (
ctx->prev_frame_type) {
647 switch (
ctx->frame_type) {
655 if (is_prev_ref && is_ref) {
657 }
else if (is_prev_ref) {
681 ctx->pic_conf.pic_width = 0;
682 ctx->pic_conf.pic_height = 0;
693 ctx->show_indeo4_info = 1;
Libavcodec external API header.
static av_cold int init(AVCodecContext *avctx)
#define FFSWAP(type, a, b)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
bitstream reader API header.
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
static int get_bits_left(GetBitContext *gb)
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static const uint8_t * align_get_bits(GetBitContext *s)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enum AVPixelFormat pix_fmt, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of a plane of an image with...
static av_always_inline void mv_scale(Mv *dst, Mv *src, int td, int tb)
static int scale_tile_size(int def_size, int size_factor)
static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
Decode Indeo 4 picture header.
#define IVI4_PIC_SIZE_ESC
InvTransformPtr * inv_trans
static int is_nonnull_frame(IVI45DecContext *ctx)
static av_cold int decode_init(AVCodecContext *avctx)
DCTransformPtr * dc_trans
static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *arg_band, AVCodecContext *avctx)
Decode Indeo 4 band header.
static const struct @72 transforms[18]
static void switch_buffers(IVI45DecContext *ctx)
Rearrange decoding and reference buffers.
static int decode_plane_subdivision(GetBitContext *gb)
Decode subdivision of a plane.
AVCodec ff_indeo4_decoder
static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band, IVITile *tile, AVCodecContext *avctx)
Decode information (block type, cbp, quant delta, motion vector) for all macroblocks in the current t...
This file contains data needed for the Indeo 4 decoder.
static const uint8_t *const scan_index_to_tab[15]
static const uint16_t ivi4_quant_8x8_intra[9][64]
Indeo 4 dequant tables.
static const uint16_t ivi4_quant_8x8_inter[9][64]
static const uint16_t ivi4_quant_4x4_intra[5][16]
static const uint8_t quant_index_to_tab[22]
Table for mapping quant matrix index from the bitstream into internal quant table number.
static const uint16_t ivi4_common_pic_sizes[14]
standard picture dimensions
static const uint16_t ivi4_quant_4x4_inter[5][16]
int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
const RVMapDesc ff_ivi_rvmap_tabs[9]
Run-value (RLE) tables.
av_cold void ff_ivi_init_static_vlc(void)
Initialize static codes used for macroblock and block decoding.
av_cold int ff_ivi_init_planes(AVCodecContext *avctx, IVIPlaneDesc *planes, const IVIPicConfig *cfg, int is_indeo4)
Initialize planes (prepares descriptors, allocates buffers etc).
av_cold int ff_ivi_decode_close(AVCodecContext *avctx)
Close Indeo5 decoder and clean up its context.
int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab, IVIHuffTab *huff_tab, AVCodecContext *avctx)
Decode a huffman codebook descriptor from the bitstream and select specified huffman table.
av_cold int ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height)
Initialize tile and macroblock descriptors.
This file contains structures and macros shared by both Indeo4 and Indeo5 decoders.
#define IVI_TOSIGNED(val)
convert unsigned values into signed ones (the sign is in the LSB)
void() InvTransformPtr(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
Declare inverse transform function types.
void() DCTransformPtr(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size)
static int ivi_pic_config_cmp(IVIPicConfig *str1, IVIPicConfig *str2)
compare some properties of two pictures
@ IVI_BLK_HUFF
Huffman table is used for coding macroblocks.
static int ivi_scale_mv(int mv, int mv_scale)
scale motion vector
@ IVI4_FRAMETYPE_INTER
non-droppable P-frame
@ IVI4_FRAMETYPE_BIDIR
bidirectional frame
@ IVI4_FRAMETYPE_INTRA1
intra frame with slightly different bitstream coding
@ IVI4_FRAMETYPE_NULL_FIRST
empty frame with no data
#define IVI_VLC_BITS
max number of bits of the ivi's huffman codes
void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size)
DC-only inverse row slant transform.
void ff_ivi_row_haar8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
one-dimensional inverse 8-point Haar transform on rows for Indeo 4
void ff_ivi_col_haar4(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
one-dimensional inverse 4-point Haar transform on columns for Indeo 4
void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size)
DC-only two-dimensional inverse Haar transform for Indeo 4.
void ff_ivi_col_haar8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
one-dimensional inverse 8-point Haar transform on columns for Indeo 4
void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
two-dimensional inverse slant 8x8 transform
void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size)
Copy the DC coefficient into the first pixel of the block and zero all others.
void ff_ivi_row_slant4(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D row slant transform
void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
two-dimensional inverse Haar 8x8 transform for Indeo 4
void ff_ivi_col_slant4(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D column slant transform
void ff_ivi_row_haar4(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
one-dimensional inverse 4-point Haar transform on rows for Indeo 4
void ff_ivi_inverse_haar_4x4(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
two-dimensional inverse Haar 4x4 transform for Indeo 4
void ff_ivi_col_slant8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D column slant transform
void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
Copy the pixels into the frame buffer.
void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
two-dimensional inverse slant 4x4 transform
void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size)
DC-only inverse column slant transform.
void ff_ivi_row_slant8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D row slant transform
void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size)
DC-only two-dimensional inverse slant transform.
DSP functions (inverse transforms, motion compensations, wavelet recomposition) for Indeo Video Inter...
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
#define FF_ARRAY_ELEMS(a)
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int64_t max_pixels
The number of pixels per image to maximally accept.
const char * name
Name of the codec implementation.
information for Indeo wavelet band
const uint8_t * inter_scale
quantization coefficient for inter blocks
int inherit_qdelta
tells if quantiser delta is inherited from reference macroblock
const uint8_t * intra_scale
quantization coefficient for intra blocks
int inherit_mv
tells if motion vector is inherited from reference macroblock
int is_2d_trans
1 indicates that the two-dimensional inverse transform is used
DCTransformPtr * dc_transform
int quant_mat
dequant matrix index
const uint16_t * inter_base
quantization matrix for inter blocks
IVIHuffTab blk_vlc
vlc table for decoding block data
int bufsize
band buffer size in bytes
InvTransformPtr * inv_transform
int scan_size
size of the scantable
int num_corr
number of correction entries
int mb_size
macroblock size
int is_halfpel
precision of the motion compensation: 0 - fullpel, 1 - halfpel
const uint16_t * intra_base
quantization matrix for intra blocks
uint8_t corr[61 *2]
rvmap correction pairs
const uint8_t * scan
ptr to the scan pattern
int glob_quant
quant base for this band
int rvmap_sel
rvmap table selector
int32_t checksum
for debug purposes
int is_empty
= 1 if this band doesn't contain any data
int plane
plane number this band belongs to
ptrdiff_t pitch
pitch associated with the buffers above
VLC * tab
index of one of the predefined tables or "7" for custom one
information for Indeo macroblock (16x16, 8x8 or 4x4)
uint8_t type
macroblock type: 0 - INTRA, 1 - INTER
int8_t mv_y
motion vector (y component)
int8_t q_delta
quant delta
int8_t mv_x
motion vector (x component)
information for Indeo tile
IVIMbInfo * ref_mbs
ptr to the macroblock descriptors of the reference tile
IVIMbInfo * mbs
array of macroblock descriptors
int num_MBs
number of macroblocks in this tile
#define avpriv_request_sample(...)