49 #define IVI_VLC_BITS 13
50 #define IVI4_STREAM_ANALYSER 0
51 #define IVI5_IS_PROTECTED 0x20
253 #if IVI4_STREAM_ANALYSER
286 #define IVI_NUM_TILES(stride, tile_size) (((stride) + (tile_size) - 1) / (tile_size))
289 #define IVI_MBs_PER_TILE(tile_width, tile_height, mb_size) \
290 ((((tile_width) + (mb_size) - 1) / (mb_size)) * (((tile_height) + (mb_size) - 1) / (mb_size)))
293 #define IVI_TOSIGNED(val) (-(((val) >> 1) ^ -((val) & 1)))
298 return (mv + (mv > 0) + (mv_scale - 1)) >>
mv_scale;
int is_empty
= 1 if this band doesn't contain any data
uint32_t data_size
size of the frame data in bytes from picture header
uint8_t type
macroblock type: 0 - INTRA, 1 - INTER
int num_MBs
number of macroblocks in this tile
const uint8_t ff_ivi_direct_scan_4x4[16]
static av_always_inline void mv_scale(Mv *dst, Mv *src, int td, int tb)
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
macroblock/block huffman table descriptor
InvTransformPtr * inv_transform
void( DCTransformPtr)(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
intra frame with slightly different bitstream coding
int(* decode_pic_hdr)(struct IVI45DecContext *ctx, AVCodecContext *avctx)
int inter_scal
signals a sequence of scalable inter frames
int8_t b_mv_y
second motion vector (y component)
int(* decode_mb_info)(struct IVI45DecContext *ctx, IVIBandDesc *band, IVITile *tile, AVCodecContext *avctx)
int num_tiles
number of tiles in this band
int dst_buf
buffer index for the currently decoded frame
int16_t * ref_buf
pointer to the reference frame buffer (for motion compensation)
uint8_t eob_sym
end of block symbol
int16_t * buf
pointer to the output buffer for this band
IVITile * tiles
array of tile descriptors
int is_halfpel
precision of the motion compensation: 0 - fullpel, 1 - halfpel
int plane
plane number this band belongs to
int bufsize
band buffer size in bytes
int quant_mat
dequant matrix index
RVMapDesc * rv_map
ptr to the RLE table for this band
int8_t b_mv_x
second motion vector (x component)
VLC * tab
index of one of the predefined tables or "7" for custom one
const uint8_t * frame_data
input frame data pointer
const uint16_t * inter_base
quantization matrix for inter blocks
const uint8_t * data_ptr
ptr to the first byte of the band data
int inherit_mv
tells if motion vector is inherited from reference macroblock
int16_t * bufs[4]
array of pointers to the band buffers
void( InvTransformPtr)(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
Declare inverse transform function types.
int pitch
pitch associated with the buffers above
uint8_t cbp
coded block pattern
int qdelta_present
tells if Qdelta signal is present in the bitstream (Indeo5 only)
uint16_t checksum
frame checksum
bitstream reader API header.
uint32_t pic_hdr_size
picture header size in bytes
int ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height)
Initialize tile and macroblock descriptors.
IVIPlaneDesc planes[3]
color planes
const uint16_t * intra_base
quantization matrix for intra blocks
int data_size
size of the band data
IVIHuffDesc cust_desc
pointer to the table associated with tab_sel
uint8_t corr[61 *2]
rvmap correction pairs
const uint8_t ff_ivi_vertical_scan_8x8[64]
Common scan patterns (defined in ivi_common.c)
RVMapDesc rvmap_tabs[9]
local corrected copy of the static rvmap tables
uint8_t in_q
flag for explicitly stored quantiser delta
int ref_buf
inter frame reference buffer index
DCTransformPtr * dc_transform
void ff_ivi_init_static_vlc(void)
Initialize static codes used for macroblock and block decoding.
static int ivi_pic_config_cmp(IVIPicConfig *str1, IVIPicConfig *str2)
compare some properties of two pictures
Libavcodec external API header.
uint8_t esc_sym
escape symbol
run-value (RLE) table descriptor
int inherit_qdelta
tells if quantiser delta is inherited from reference macroblock
uint8_t num_bands
number of bands this plane subdivided into
int(* decode_band_hdr)(struct IVI45DecContext *ctx, IVIBandDesc *band, AVCodecContext *avctx)
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
IVIMbInfo * mbs
array of macroblock descriptors
int16_t * b_ref_buf
pointer to the second reference frame buffer (for motion compensation)
const uint8_t * inter_scale
quantization coefficient for inter blocks
const uint8_t ff_ivi_horizontal_scan_8x8[64]
int8_t q_delta
quant delta
uint32_t frame_size
frame size in bytes
static const int8_t mv[256][2]
IVIHuffTab mb_vlc
current macroblock table descriptor
int is_2d_trans
1 indicates that the two-dimensional inverse transform is used
int glob_quant
quant base for this band
main external API structure.
int aheight
aligned band height
int is_empty
= 1 if this tile doesn't contain any data
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
int num_corr
number of correction entries
static int ivi_scale_mv(int mv, int mv_scale)
scale motion vector
information for Indeo tile
int(* is_nonnull_frame)(struct IVI45DecContext *ctx)
int buf_switch
used to switch between three buffers
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...
void(* switch_buffers)(struct IVI45DecContext *ctx)
IVIBandDesc * bands
array of band descriptors
int32_t checksum
for debug purposes
int rvmap_sel
rvmap table selector
int8_t mv_x
motion vector (x component)
int8_t mv_y
motion vector (y component)
int mb_size
macroblock size
huffman codebook descriptor
IVIMbInfo * ref_mbs
ptr to the macroblock descriptors of the reference tile
IVIHuffTab blk_vlc
current block table descriptor
const RVMapDesc ff_ivi_rvmap_tabs[9]
Run-value (RLE) tables.
int ref2_buf
temporal storage for switching buffers
VLC cust_tab
custom Huffman codebook descriptor
const uint8_t * scan
ptr to the scan pattern
int transp_status
transparency mode status: 1 - enabled
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out
int prev_frame_type
frame type of the previous frame
information for Indeo macroblock (16x16, 8x8 or 4x4)
IVIHuffTab blk_vlc
vlc table for decoding block data
int scan_size
size of the scantable
const uint8_t * intra_scale
quantization coefficient for intra blocks
color plane (luma or chroma) information
int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg, int is_indeo4)
Initialize planes (prepares descriptors, allocates buffers etc).
int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
uint32_t buf_offs
address in the output buffer for this mb
int b_ref_buf
second reference frame buffer index
information for Indeo wavelet band
This structure stores compressed data.
int ff_ivi_decode_close(AVCodecContext *avctx)
Close Indeo5 decoder and clean up its context.
Huffman table is used for coding macroblocks.
int data_size
size of the data in bytes