FFmpeg
Loading...
Searching...
No Matches
4xm.c File Reference

4XM codec. More...

#include <inttypes.h>
#include "libavutil/avassert.h"
#include "libavutil/frame.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "avcodec.h"
#include "blockdsp.h"
#include "bswapdsp.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "decode.h"
#include "get_bits.h"

Go to the source code of this file.

Data Structures

struct  CFrameBuffer
 
struct  FourXContext
 

Macros

#define BLOCK_TYPE_VLC_BITS   5
 
#define ACDC_VLC_BITS   9
 
#define CFRAME_BUFFER_COUNT   100
 
#define FIX_1_082392200   70936
 
#define FIX_1_414213562   92682
 
#define FIX_1_847759065   121095
 
#define FIX_2_613125930   171254
 
#define MULTIPLY(var, const)
 
#define LE_CENTRIC_MUL(dst, src, scale, dc)
 

Functions

static void idct (int16_t block[64])
 
static av_cold void init_vlcs (void)
 
static void init_mv (FourXContext *f, int linesize)
 
static void mcdc (uint16_t *dst, const uint16_t *src, int log2w, int h, int stride, int scale, unsigned dc)
 
static int decode_p_block (FourXContext *f, uint16_t *dst, const uint16_t *src, int log2w, int log2h, int stride)
 
static int decode_p_frame (FourXContext *f, const uint8_t *buf, int length)
 
static int decode_i_block (FourXContext *f, int16_t *block)
 decode block and dequantize.
 
static void idct_put (FourXContext *f, int x, int y)
 
static int decode_i_mb (FourXContext *f)
 
static const uint8_t * read_huffman_tables (FourXContext *f, const uint8_t *const buf, int buf_size)
 
static int mix (int c0, int c1)
 
static int decode_i2_frame (FourXContext *f, const uint8_t *buf, int length)
 
static int decode_i_frame (FourXContext *f, const uint8_t *buf, int length)
 
static int decode_frame (AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
 
static av_cold int decode_end (AVCodecContext *avctx)
 
static av_cold int decode_init (AVCodecContext *avctx)
 

Variables

static const uint8_t block_type_tab [2][4][8][2]
 
static const uint8_t size2index [4][4]
 
static const int8_t mv [256][2]
 
static const uint8_t dequant_table [64]
 
static VLCElem block_type_vlc [2][4][32]
 
const FFCodec ff_fourxm_decoder
 

Detailed Description

4XM codec.

Definition in file 4xm.c.

Macro Definition Documentation

◆ BLOCK_TYPE_VLC_BITS

#define BLOCK_TYPE_VLC_BITS   5

Definition at line 45 of file 4xm.c.

Referenced by decode_p_block(), and init_vlcs().

◆ ACDC_VLC_BITS

#define ACDC_VLC_BITS   9

Definition at line 46 of file 4xm.c.

Referenced by decode_i_block(), decode_i_frame(), and read_huffman_tables().

◆ CFRAME_BUFFER_COUNT

#define CFRAME_BUFFER_COUNT   100

Definition at line 48 of file 4xm.c.

Referenced by decode_end(), and decode_frame().

◆ FIX_1_082392200

#define FIX_1_082392200   70936

Definition at line 160 of file 4xm.c.

Referenced by ff_column_fidct_c(), ff_row_idct_c(), and idct().

◆ FIX_1_414213562

#define FIX_1_414213562   92682

Definition at line 161 of file 4xm.c.

Referenced by ff_column_fidct_c(), ff_row_idct_c(), and idct().

◆ FIX_1_847759065

#define FIX_1_847759065   121095

◆ FIX_2_613125930

#define FIX_2_613125930   171254

Definition at line 163 of file 4xm.c.

Referenced by ff_column_fidct_c(), ff_row_idct_c(), and idct().

◆ MULTIPLY

#define MULTIPLY ( var,
const )
Value:
((int)((var) * (unsigned)(const)) >> 16)

Definition at line 165 of file 4xm.c.

Referenced by idct().

◆ LE_CENTRIC_MUL

#define LE_CENTRIC_MUL ( dst,
src,
scale,
dc )
Value:
{ \
unsigned tmpval = AV_RN32(src) * (scale) + (dc); \
AV_WN32A(dst, tmpval); \
}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition intra.c:278
#define AV_RN32(p)
#define src
Definition vp8dsp.c:248

Definition at line 289 of file 4xm.c.

Referenced by mcdc().

Function Documentation

◆ idct()

static void idct ( int16_t block[64])
static

◆ init_vlcs()

static av_cold void init_vlcs ( void )
static

Definition at line 252 of file 4xm.c.

Referenced by decode_init(), and decode_init().

◆ init_mv()

static void init_mv ( FourXContext * f,
int linesize )
static

Definition at line 267 of file 4xm.c.

Referenced by decode_p_frame().

◆ mcdc()

static void mcdc ( uint16_t * dst,
const uint16_t * src,
int log2w,
int h,
int stride,
int scale,
unsigned dc )
inlinestatic

Definition at line 296 of file 4xm.c.

Referenced by decode_p_block().

◆ decode_p_block()

static int decode_p_block ( FourXContext * f,
uint16_t * dst,
const uint16_t * src,
int log2w,
int log2h,
int stride )
static

Definition at line 345 of file 4xm.c.

Referenced by decode_p_block(), and decode_p_frame().

◆ decode_p_frame()

static int decode_p_frame ( FourXContext * f,
const uint8_t * buf,
int length )
static

Definition at line 432 of file 4xm.c.

Referenced by decode_frame().

◆ decode_i_block()

static int decode_i_block ( FourXContext * f,
int16_t * block )
static

decode block and dequantize.

Note this is almost identical to MJPEG.

Definition at line 500 of file 4xm.c.

Referenced by decode_i_mb().

◆ idct_put()

static void idct_put ( FourXContext * f,
int x,
int y )
inlinestatic

Definition at line 559 of file 4xm.c.

Referenced by checkasm_check_vp3dsp(), decode_i_frame(), and dv_decode_video_segment().

◆ decode_i_mb()

static int decode_i_mb ( FourXContext * f)
static

Definition at line 605 of file 4xm.c.

Referenced by decode_i_frame().

◆ read_huffman_tables()

static const uint8_t * read_huffman_tables ( FourXContext * f,
const uint8_t *const buf,
int buf_size )
static

Definition at line 619 of file 4xm.c.

Referenced by decode_i_frame().

◆ mix()

◆ decode_i2_frame()

static int decode_i2_frame ( FourXContext * f,
const uint8_t * buf,
int length )
static

Definition at line 725 of file 4xm.c.

Referenced by decode_frame().

◆ decode_i_frame()

static int decode_i_frame ( FourXContext * f,
const uint8_t * buf,
int length )
static

Definition at line 773 of file 4xm.c.

Referenced by decode_frame().

◆ decode_frame()

static int decode_frame ( AVCodecContext * avctx,
AVFrame * picture,
int * got_frame,
AVPacket * avpkt )
static

Definition at line 837 of file 4xm.c.

Referenced by sipr_decoder_init().

◆ decode_end()

static av_cold int decode_end ( AVCodecContext * avctx)
static

Definition at line 980 of file 4xm.c.

Referenced by decode_reset(), and ff_vk_decode_frame().

◆ decode_init()

static av_cold int decode_init ( AVCodecContext * avctx)
static

Definition at line 998 of file 4xm.c.

Variable Documentation

◆ block_type_tab

const uint8_t block_type_tab[2][4][8][2]
static
Initial value:
= {
{
{
{ 0, 1 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 30, 5 }, { 31, 5 }, { 0, 0 }
}, {
{ 0, 1 }, { 0, 0 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 15, 4 }, { 0, 0 }
}, {
{ 0, 1 }, { 2, 2 }, { 0, 0 }, { 6, 3 }, { 14, 4 }, { 15, 4 }, { 0, 0 }
}, {
{ 0, 1 }, { 0, 0 }, { 0, 0 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 15, 4 }
}
}, {
{
{ 1, 2 }, { 4, 3 }, { 5, 3 }, { 0, 2 }, { 6, 3 }, { 7, 3 }, { 0, 0 }
}, {
{ 1, 2 }, { 0, 0 }, { 2, 2 }, { 0, 2 }, { 6, 3 }, { 7, 3 }, { 0, 0 }
}, {
{ 1, 2 }, { 2, 2 }, { 0, 0 }, { 0, 2 }, { 6, 3 }, { 7, 3 }, { 0, 0 }
}, {
{ 1, 2 }, { 0, 0 }, { 0, 0 }, { 0, 2 }, { 2, 2 }, { 6, 3 }, { 7, 3 }
}
}
}

Definition at line 50 of file 4xm.c.

Referenced by init_vlcs().

◆ size2index

const uint8_t size2index[4][4]
static
Initial value:
= {
{ -1, 3, 1, 1 },
{ 3, 0, 0, 0 },
{ 2, 0, 0, 0 },
{ 2, 0, 0, 0 },
}

Definition at line 74 of file 4xm.c.

Referenced by decode_p_block().

◆ mv

const int8_t mv[256][2]
static

Definition at line 81 of file 4xm.c.

Referenced by add_mv_data(), add_mv_data(), affine_mvp_const2(), apply_obmc(), chroma_mc_uni(), clv_decode_frame(), compare_mv_ref_idx(), decode_13(), decode_cu_r(), decode_inter(), decode_mode(), decode_packet(), decode_tile(), derive_affine_mvc(), derive_sb_mv(), derive_spatial_merge_candidates(), dist_scale(), dmvr_mv_refine(), dwt_decode53(), dwt_decode97_float(), dwt_decode97_int(), dwt_encode53(), dwt_encode97_float(), dwt_encode97_int(), encode_frame(), fetch_diagonal_mv(), ff_h264_loop_filter_strength_lasx(), ff_h264_loop_filter_strength_lsx(), ff_h264_loop_filter_strength_mmxext(), ff_h264_loop_filter_strength_msa(), ff_hevc_luma_mv_merge_mode(), ff_hevc_luma_mv_mvp_mode(), ff_me_search_ds(), ff_me_search_epzs(), ff_me_search_esa(), ff_me_search_fss(), ff_me_search_hexbs(), ff_me_search_ntss(), ff_me_search_tdls(), ff_me_search_tss(), ff_me_search_umh(), ff_put_h264_qpel4_mc00_msa(), ff_vp9_fill_mv(), ff_vvc_clip_mv(), ff_vvc_luma_mv_merge_gpm(), ff_vvc_luma_mv_merge_ibc(), ff_vvc_luma_mv_merge_mode(), ff_vvc_mvp_ibc(), ff_vvc_round_mv(), ff_vvc_set_intra_mvf(), ff_vvc_store_sb_mvs(), fill_decode_caches(), filter_frame(), filter_frame(), filter_frame(), find_block_motion(), find_motion(), find_ref_mvs(), h263_get_modb(), h264_er_decode_mb(), hevc_await_progress(), hevc_luma_mv_mvp_mode(), hls_mvd_coding(), ibc_add_mvp(), ibc_check_mv(), ibc_merge_candidates(), init_mv(), init_mv_penalty(), ivi_scale_mv(), luma_mc_uni(), luma_prof(), luma_prof_bi(), luma_prof_uni(), mc(), mc(), mc_bi(), mc_bi_scaled(), mc_chroma_scaled(), mc_chroma_unscaled(), mc_dir_part(), mc_luma_scaled(), mc_luma_unscaled(), mc_part_std(), mc_scaled(), mc_uni(), mc_uni_scaled(), mpeg4_encode_init_static(), mpeg_er_decode_mb(), mv_compression(), mv_merge_pairwise_candidate(), mv_mp_mode_mx(), mv_mp_mode_mx_lt(), mv_read_header(), mv_read_packet(), mv_read_seek(), mvi_update_prediction(), mvp(), mvp_candidate(), mvp_data_ibc(), mvp_history_candidates(), mvp_spatial_candidates(), mvp_temporal_candidates(), obmc_motion(), parse_audio_var(), parse_global_var(), pred_affine_blk(), pred_get_refs(), pred_get_y(), pred_gpm_blk(), pred_pskip_motion(), pred_regular_blk(), pred_spatial_direct_motion(), predict_motion(), predict_mv(), read_mv(), reconstruct(), sb_temproal_luma_motion(), scaled_ref_pos_and_step(), search_mv(), set_mvs(), svq1_decode_motion_vector(), svq1_motion_inter_4v_block(), svq1_motion_inter_block(), svq3_mc_dir(), tgq_decode_mb(), var_size_bme(), vc1_p_h_loop_filter(), vc1_p_v_loop_filter(), vp56_conceal_mv(), vp56_decode_4mv(), vp56_decode_mv(), vp6_filter(), vp7_decode_mvs(), vp8_mc_chroma(), vp8_mc_luma(), and vp8_mc_part().

◆ dequant_table

const uint8_t dequant_table[64]
static
Initial value:
= {
16, 15, 13, 19, 24, 31, 28, 17,
17, 23, 25, 31, 36, 63, 45, 21,
18, 24, 27, 37, 52, 59, 49, 20,
16, 28, 34, 40, 60, 80, 51, 20,
18, 31, 48, 66, 68, 86, 56, 21,
19, 38, 56, 59, 64, 64, 48, 20,
27, 48, 55, 55, 56, 51, 35, 15,
20, 35, 34, 32, 31, 22, 15, 8,
}

Definition at line 118 of file 4xm.c.

Referenced by decode_i_block(), and fill_tone_level_array().

◆ block_type_vlc

VLCElem block_type_vlc[2][4][32]
static

Definition at line 129 of file 4xm.c.

Referenced by decode_p_block(), and init_vlcs().

◆ ff_fourxm_decoder

const FFCodec ff_fourxm_decoder
Initial value:
= {
.p.name = "4xm",
CODEC_LONG_NAME("4X Movie"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_4XM,
.priv_data_size = sizeof(FourXContext),
.p.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}
static av_cold void close(AVCodecParserContext *s)
Definition apv_parser.c:197
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
@ AV_CODEC_ID_4XM
Definition codec_id.h:84
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static av_cold int decode_init(AVCodecContext *avctx)
Definition 4xm.c:998
static av_cold int decode_end(AVCodecContext *avctx)
Definition 4xm.c:980
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
Definition 4xm.c:837

Definition at line 1037 of file 4xm.c.