Go to the documentation of this file.
30 #define BITSTREAM_READER_LE
48 #define IVI5_PIC_SIZE_ESC 15
61 int result,
i, p, tile_size, pic_size_indx, mb_size, blk_size, is_scalable;
62 int quant_mat, blk_size_changed = 0;
73 tile_size = (
ctx->gop_flags & 0x40) ? 64 <<
get_bits(&
ctx->gb, 2) : 0;
74 if (tile_size > 256) {
85 av_log(avctx,
AV_LOG_ERROR,
"Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n",
99 if (
ctx->gop_flags & 2) {
121 ctx->pic_conf = pic_conf;
122 ctx->is_scalable = is_scalable;
123 blk_size_changed = 1;
126 for (p = 0; p <= 1; p++) {
128 band = &
ctx->planes[p].bands[
i];
134 mb_size = blk_size << !mb_size;
136 if (p==0 && blk_size==4) {
141 blk_size_changed = mb_size != band->
mb_size || blk_size != band->
blk_size;
142 if (blk_size_changed) {
153 switch ((p << 2) +
i) {
230 band1 = &
ctx->planes[1].bands[
i];
231 band2 = &
ctx->planes[2].bands[
i];
250 if (blk_size_changed) {
255 "Couldn't reallocate internal structures!\n");
260 if (
ctx->gop_flags & 8) {
278 }
while (
i & 0x8000);
323 ctx->prev_frame_type =
ctx->frame_type;
325 if (
ctx->frame_type >= 5) {
336 ctx->gop_invalid = 1;
339 ctx->gop_invalid = 0;
356 if (
ctx->frame_flags & 0x20)
390 if (band_flags & 1) {
404 if (band_flags & 0x10) {
433 if (band_flags & 0x20) {
457 int x, y, mv_x, mv_y, mv_delta, offs, mb_offset,
486 mb->buf_offs = mb_offset;
503 mb->mv_x =
mb->mv_y = 0;
529 if (ref_mb)
mb->q_delta = ref_mb->
q_delta;
531 (
ctx->frame_flags & 8))) {
539 mb->mv_x =
mb->mv_y = 0;
566 if ( x + (
mb->mv_x >>
s) + (y+ (
mb->mv_y >>
s))*band->
pitch < 0 ||
595 switch (
ctx->prev_frame_type) {
598 ctx->buf_switch ^= 1;
599 ctx->dst_buf =
ctx->buf_switch;
600 ctx->ref_buf =
ctx->buf_switch ^ 1;
603 if (!
ctx->inter_scal) {
608 ctx->ref_buf =
ctx->ref2_buf;
614 switch (
ctx->frame_type) {
620 ctx->dst_buf =
ctx->buf_switch;
621 ctx->ref_buf =
ctx->buf_switch ^ 1;
645 ctx->gop_invalid = 1;
655 ctx->pic_conf.pic_width = avctx->
width;
656 ctx->pic_conf.pic_height = avctx->
height;
657 ctx->pic_conf.chroma_width = (avctx->
width + 3) >> 2;
658 ctx->pic_conf.chroma_height = (avctx->
height + 3) >> 2;
659 ctx->pic_conf.tile_width = avctx->
width;
660 ctx->pic_conf.tile_height = avctx->
height;
661 ctx->pic_conf.luma_bands =
ctx->pic_conf.chroma_bands = 1;
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)
#define FFSWAP(type, a, b)
const uint8_t * inter_scale
quantization coefficient for inter blocks
av_cold void ff_ivi_init_static_vlc(void)
Initialize static codes used for macroblock and block decoding.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
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 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
DCTransformPtr * dc_transform
static int ivi_scale_mv(int mv, int mv_scale)
scale motion vector
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 IVI_TOSIGNED(val)
convert unsigned values into signed ones (the sign is in the LSB)
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.
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 const uint8_t ivi5_scale_quant_4x4_intra[24]
#define IVI5_IS_PROTECTED
@ FRAMETYPE_NULL
empty frame with no data
static av_cold int decode_init(AVCodecContext *avctx)
Initialize Indeo5 decoder.
const uint16_t * intra_base
quantization matrix for intra blocks
#define IVI_MBs_PER_TILE(tile_width, tile_height, mb_size)
calculate number of macroblocks in a tile
void ff_ivi_col_slant8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D column slant transform
information for Indeo macroblock (16x16, 8x8 or 4x4)
static const uint8_t ivi5_scale_quant_4x4_inter[24]
#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)
@ FRAMETYPE_INTER
non-droppable P-frame
AVCodec ff_indeo5_decoder
static void switch_buffers(IVI45DecContext *ctx)
Switch buffers.
int8_t mv_x
motion vector (x component)
@ FRAMETYPE_INTER_SCAL
droppable P-frame used in the scalability mode
void ff_ivi_row_slant8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags)
inverse 1D row slant transform
static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
Decode Indeo5 GOP (Group of pictures) header.
const uint8_t * scan
ptr to the scan pattern
const uint16_t * inter_base
quantization matrix for inter blocks
static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band, IVITile *tile, AVCodecContext *avctx)
Decode info (block type, cbp, quant delta, motion vector) for all macroblocks in the current tile.
and forward the result(frame or status change) to the corresponding input. If nothing is possible
static int skip_hdr_extension(GetBitContext *gb)
Skip a header extension.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int data_size
size of the band data
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)
int inherit_mv
tells if motion vector is inherited from reference macroblock
#define IVI5_PIC_SIZE_ESC
static const uint16_t ivi5_base_quant_4x4_inter[16]
const uint8_t ff_ivi_vertical_scan_8x8[64]
Scan patterns shared between indeo4 and indeo5.
const uint8_t ff_ivi_horizontal_scan_8x8[64]
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
static const uint8_t ivi5_scale_quant_8x8_inter[5][24]
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
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
static const uint8_t ivi5_common_pic_sizes[30]
standard picture dimensions (width, height divided by 4)
static int is_nonnull_frame(IVI45DecContext *ctx)
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 int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
Decode Indeo5 picture header.
information for Indeo tile
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
const char * name
Name of the codec implementation.
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)
@ FRAMETYPE_INTER_NOREF
droppable P-frame
int8_t q_delta
quant delta
static const uint16_t ivi5_base_quant_8x8_intra[5][64]
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.
const uint8_t ff_zigzag_direct[64]
int qdelta_present
tells if Qdelta signal is present in the bitstream (Indeo5 only)
const uint8_t ff_ivi_direct_scan_4x4[16]
static const uint8_t * align_get_bits(GetBitContext *s)
int is_2d_trans
1 indicates that the two-dimensional inverse transform is used
int is_empty
= 1 if this band doesn't contain any data
main external API structure.
static const uint16_t ivi5_base_quant_4x4_intra[16]
static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band, AVCodecContext *avctx)
Decode Indeo5 band header.
IVIHuffTab blk_vlc
vlc table for decoding block data
@ IVI_BLK_HUFF
Huffman table is used for coding macroblocks.
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
int width
picture width / height.
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static const uint16_t ivi5_base_quant_8x8_inter[5][64]
Indeo5 dequantization matrixes consist of two tables: base table and scale table.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int is_halfpel
precision of the motion compensation: 0 - fullpel, 1 - halfpel
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.
static const uint8_t ivi5_scale_quant_8x8_intra[5][24]
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
int8_t mv_y
motion vector (y component)