Go to the documentation of this file.
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;
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
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static av_cold int init(AVCodecContext *avctx)
static int get_bits_left(GetBitContext *gb)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
#define FFSWAP(type, a, b)
static const uint8_t quant_index_to_tab[22]
Table for mapping quant matrix index from the bitstream into internal quant table number.
const uint8_t * inter_scale
quantization coefficient for inter blocks
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_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
av_cold void ff_ivi_init_static_vlc(void)
Initialize static codes used for macroblock and block decoding.
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.
InvTransformPtr * inv_transform
static const uint8_t *const scan_index_to_tab[15]
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
int rvmap_sel
rvmap table selector
InvTransformPtr * inv_trans
static int is_nonnull_frame(IVI45DecContext *ctx)
DCTransformPtr * dc_transform
VLC * tab
index of one of the predefined tables or "7" for custom one
static int ivi_scale_mv(int mv, int mv_scale)
scale motion vector
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
uint8_t type
macroblock type: 0 - INTRA, 1 - INTER
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.
int num_MBs
number of macroblocks in this tile
#define IVI4_PIC_SIZE_ESC
#define IVI_TOSIGNED(val)
convert unsigned values into signed ones (the sign is in the LSB)
void() DCTransformPtr(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size)
static void skip_bits(GetBitContext *s, int n)
static int ivi_pic_config_cmp(IVIPicConfig *str1, IVIPicConfig *str2)
compare some properties of two pictures
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *arg_band, AVCodecContext *avctx)
Decode Indeo 4 band header.
int num_corr
number of correction entries
information for Indeo wavelet band
av_cold int ff_ivi_decode_close(AVCodecContext *avctx)
Close Indeo5 decoder and clean up its context.
static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
Decode Indeo 4 picture header.
const uint16_t * intra_base
quantization matrix for intra blocks
@ IVI4_FRAMETYPE_BIDIR
bidirectional frame
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...
DCTransformPtr * dc_trans
void ff_ivi_col_slant8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D column slant transform
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
information for Indeo macroblock (16x16, 8x8 or 4x4)
static const uint16_t ivi4_quant_8x8_intra[9][64]
Indeo 4 dequant tables.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define IVI_VLC_BITS
max number of bits of the ivi's huffman codes
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
@ IVI4_FRAMETYPE_NULL_FIRST
empty frame with no data
int8_t mv_x
motion vector (x component)
void ff_ivi_row_slant8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D row slant transform
const uint8_t * scan
ptr to the scan pattern
int64_t max_pixels
The number of pixels per image to maximally accept.
const uint16_t * inter_base
quantization matrix for inter blocks
void ff_ivi_col_slant4(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D column slant transform
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
av_cold int ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height)
Initialize tile and macroblock descriptors.
static unsigned int get_bits1(GetBitContext *s)
static const uint16_t ivi4_common_pic_sizes[14]
standard picture dimensions
int inherit_mv
tells if motion vector is inherited from reference macroblock
static const uint16_t ivi4_quant_4x4_inter[5][16]
const RVMapDesc ff_ivi_rvmap_tabs[9]
Run-value (RLE) tables.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int32_t checksum
for debug purposes
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
av_cold int ff_ivi_init_planes(AVCodecContext *avctx, IVIPlaneDesc *planes, const IVIPicConfig *cfg, int is_indeo4)
Initialize planes (prepares descriptors, allocates buffers etc).
int plane
plane number this band belongs to
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
int mb_size
macroblock size
static av_cold int decode_init(AVCodecContext *avctx)
information for Indeo tile
void ff_ivi_row_slant4(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D row slant transform
int scan_size
size of the scantable
const uint8_t * intra_scale
quantization coefficient for intra blocks
IVIMbInfo * mbs
array of macroblock descriptors
#define i(width, name, range_min, range_max)
int bufsize
band buffer size in bytes
IVIMbInfo * ref_mbs
ptr to the macroblock descriptors of the reference tile
static int decode_plane_subdivision(GetBitContext *gb)
Decode subdivision of a plane.
static void switch_buffers(IVI45DecContext *ctx)
Rearrange decoding and reference buffers.
const char * name
Name of the codec implementation.
AVCodec ff_indeo4_decoder
static const uint16_t ivi4_quant_8x8_inter[9][64]
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
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.
static av_always_inline void mv_scale(Mv *dst, Mv *src, int td, int tb)
int8_t q_delta
quant delta
@ IVI4_FRAMETYPE_INTRA1
intra frame with slightly different bitstream coding
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.
static int scale_tile_size(int def_size, int size_factor)
static const uint8_t * align_get_bits(GetBitContext *s)
int is_2d_trans
1 indicates that the two-dimensional inverse transform is used
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...
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.
#define FF_ARRAY_ELEMS(a)
int is_empty
= 1 if this band doesn't contain any data
main external API structure.
@ IVI4_FRAMETYPE_INTER
non-droppable P-frame
static const struct @99 transforms[18]
IVIHuffTab blk_vlc
vlc table for decoding block data
@ IVI_BLK_HUFF
Huffman table is used for coding macroblocks.
#define avpriv_request_sample(...)
int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
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.
int inherit_qdelta
tells if quantiser delta is inherited from reference macroblock
uint8_t corr[61 *2]
rvmap correction pairs
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
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
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int is_halfpel
precision of the motion compensation: 0 - fullpel, 1 - halfpel
static const uint16_t ivi4_quant_4x4_intra[5][16]
int glob_quant
quant base for this band
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.
int quant_mat
dequant matrix index
ptrdiff_t pitch
pitch associated with the buffers above
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() InvTransformPtr(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
Declare inverse transform function types.
int8_t mv_y
motion vector (y component)