FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
aic.c File Reference
#include <inttypes.h>
#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
#include "get_bits.h"
#include "golomb.h"
#include "idctdsp.h"
#include "thread.h"
#include "unary.h"

Go to the source code of this file.

Data Structures

struct  AICContext
 

Macros

#define AIC_HDR_SIZE   24
 
#define AIC_BAND_COEFFS   (64 + 32 + 192 + 96)
 
#define GET_CODE(val, type, add_bits)
 

Enumerations

enum  AICBands {
  COEFF_LUMA = 0, COEFF_CHROMA, COEFF_LUMA_EXT, COEFF_CHROMA_EXT,
  NUM_BANDS
}
 

Functions

static int aic_decode_header (AICContext *ctx, const uint8_t *src, int size)
 
static int aic_decode_coeffs (GetBitContext *gb, int16_t *dst, int band, int slice_width, int force_chroma)
 
static void recombine_block (int16_t *dst, const uint8_t *scan, int16_t **base, int16_t **ext)
 
static void recombine_block_il (int16_t *dst, const uint8_t *scan, int16_t **base, int16_t **ext, int block_no)
 
static void unquant_block (int16_t *block, int q, uint8_t *quant_matrix)
 
static int aic_decode_slice (AICContext *ctx, int mb_x, int mb_y, const uint8_t *src, int src_size)
 
static int aic_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static av_cold int aic_decode_init (AVCodecContext *avctx)
 
static av_cold int aic_decode_close (AVCodecContext *avctx)
 

Variables

static const uint8_t aic_num_band_coeffs [NUM_BANDS] = { 64, 32, 192, 96 }
 
static const uint16_t aic_band_off [NUM_BANDS] = { 0, 64, 96, 288 }
 
static const uint8_t aic_quant_matrix [64]
 
static const uint8_t aic_y_scan [64]
 
static const uint8_t aic_y_ext_scan [192]
 
static const uint8_t aic_c_scan [64]
 
static const uint8_t aic_c_ext_scan [192]
 
static const uint8_t *const aic_scan [NUM_BANDS]
 
const AVCodec ff_aic_decoder
 

Macro Definition Documentation

◆ AIC_HDR_SIZE

#define AIC_HDR_SIZE   24

Definition at line 36 of file aic.c.

◆ AIC_BAND_COEFFS

#define AIC_BAND_COEFFS   (64 + 32 + 192 + 96)

Definition at line 37 of file aic.c.

◆ GET_CODE

#define GET_CODE (   val,
  type,
  add_bits 
)
Value:
do { \
if (type) \
val = get_ue_golomb(gb); \
else \
val = get_unary(gb, 1, 31); \
if (add_bits) \
val = (val << add_bits) + get_bits(gb, add_bits); \
} while (0)

Definition at line 194 of file aic.c.

Enumeration Type Documentation

◆ AICBands

enum AICBands
Enumerator
COEFF_LUMA 
COEFF_CHROMA 
COEFF_LUMA_EXT 
COEFF_CHROMA_EXT 
NUM_BANDS 

Definition at line 39 of file aic.c.

Function Documentation

◆ aic_decode_header()

static int aic_decode_header ( AICContext ctx,
const uint8_t *  src,
int  size 
)
static

Definition at line 161 of file aic.c.

Referenced by aic_decode_frame().

◆ aic_decode_coeffs()

static int aic_decode_coeffs ( GetBitContext gb,
int16_t *  dst,
int  band,
int  slice_width,
int  force_chroma 
)
static

Definition at line 204 of file aic.c.

Referenced by aic_decode_slice().

◆ recombine_block()

static void recombine_block ( int16_t *  dst,
const uint8_t *  scan,
int16_t **  base,
int16_t **  ext 
)
static

Definition at line 255 of file aic.c.

Referenced by aic_decode_slice().

◆ recombine_block_il()

static void recombine_block_il ( int16_t *  dst,
const uint8_t *  scan,
int16_t **  base,
int16_t **  ext,
int  block_no 
)
static

Definition at line 275 of file aic.c.

Referenced by aic_decode_slice().

◆ unquant_block()

static void unquant_block ( int16_t *  block,
int  q,
uint8_t *  quant_matrix 
)
static

Definition at line 297 of file aic.c.

Referenced by aic_decode_slice().

◆ aic_decode_slice()

static int aic_decode_slice ( AICContext ctx,
int  mb_x,
int  mb_y,
const uint8_t *  src,
int  src_size 
)
static

Definition at line 310 of file aic.c.

Referenced by aic_decode_frame().

◆ aic_decode_frame()

static int aic_decode_frame ( AVCodecContext avctx,
void *  data,
int got_frame,
AVPacket avpkt 
)
static

Definition at line 384 of file aic.c.

◆ aic_decode_init()

static av_cold int aic_decode_init ( AVCodecContext avctx)
static

Definition at line 444 of file aic.c.

◆ aic_decode_close()

static av_cold int aic_decode_close ( AVCodecContext avctx)
static

Definition at line 490 of file aic.c.

Variable Documentation

◆ aic_num_band_coeffs

const uint8_t aic_num_band_coeffs[NUM_BANDS] = { 64, 32, 192, 96 }
static

Definition at line 47 of file aic.c.

Referenced by aic_decode_coeffs().

◆ aic_band_off

const uint16_t aic_band_off[NUM_BANDS] = { 0, 64, 96, 288 }
static

Definition at line 49 of file aic.c.

Referenced by aic_decode_init().

◆ aic_quant_matrix

const uint8_t aic_quant_matrix[64]
static
Initial value:
= {
8, 16, 19, 22, 22, 26, 26, 27,
16, 16, 22, 22, 26, 27, 27, 29,
19, 22, 26, 26, 27, 29, 29, 35,
22, 24, 27, 27, 29, 32, 34, 38,
26, 27, 29, 29, 32, 35, 38, 46,
27, 29, 34, 34, 35, 40, 46, 56,
29, 34, 34, 37, 40, 48, 56, 69,
34, 37, 38, 40, 48, 58, 69, 83,
}

Definition at line 51 of file aic.c.

Referenced by aic_decode_init().

◆ aic_y_scan

const uint8_t aic_y_scan[64]
static
Initial value:
= {
0, 4, 1, 2, 5, 8, 12, 9,
6, 3, 7, 10, 13, 14, 11, 15,
47, 43, 46, 45, 42, 39, 35, 38,
41, 44, 40, 37, 34, 33, 36, 32,
16, 20, 17, 18, 21, 24, 28, 25,
22, 19, 23, 26, 29, 30, 27, 31,
63, 59, 62, 61, 58, 55, 51, 54,
57, 60, 56, 53, 50, 49, 52, 48,
}

Definition at line 62 of file aic.c.

◆ aic_y_ext_scan

const uint8_t aic_y_ext_scan[192]
static
Initial value:
= {
64, 72, 65, 66, 73, 80, 88, 81,
74, 67, 75, 82, 89, 90, 83, 91,
0, 4, 1, 2, 5, 8, 12, 9,
6, 3, 7, 10, 13, 14, 11, 15,
16, 20, 17, 18, 21, 24, 28, 25,
22, 19, 23, 26, 29, 30, 27, 31,
155, 147, 154, 153, 146, 139, 131, 138,
145, 152, 144, 137, 130, 129, 136, 128,
47, 43, 46, 45, 42, 39, 35, 38,
41, 44, 40, 37, 34, 33, 36, 32,
63, 59, 62, 61, 58, 55, 51, 54,
57, 60, 56, 53, 50, 49, 52, 48,
96, 104, 97, 98, 105, 112, 120, 113,
106, 99, 107, 114, 121, 122, 115, 123,
68, 76, 69, 70, 77, 84, 92, 85,
78, 71, 79, 86, 93, 94, 87, 95,
100, 108, 101, 102, 109, 116, 124, 117,
110, 103, 111, 118, 125, 126, 119, 127,
187, 179, 186, 185, 178, 171, 163, 170,
177, 184, 176, 169, 162, 161, 168, 160,
159, 151, 158, 157, 150, 143, 135, 142,
149, 156, 148, 141, 134, 133, 140, 132,
191, 183, 190, 189, 182, 175, 167, 174,
181, 188, 180, 173, 166, 165, 172, 164,
}

Definition at line 73 of file aic.c.

◆ aic_c_scan

const uint8_t aic_c_scan[64]
static
Initial value:
= {
0, 4, 1, 2, 5, 8, 12, 9,
6, 3, 7, 10, 13, 14, 11, 15,
31, 27, 30, 29, 26, 23, 19, 22,
25, 28, 24, 21, 18, 17, 20, 16,
32, 36, 33, 34, 37, 40, 44, 41,
38, 35, 39, 42, 45, 46, 43, 47,
63, 59, 62, 61, 58, 55, 51, 54,
57, 60, 56, 53, 50, 49, 52, 48,
}

Definition at line 100 of file aic.c.

◆ aic_c_ext_scan

const uint8_t aic_c_ext_scan[192]
static
Initial value:
= {
16, 24, 17, 18, 25, 32, 40, 33,
26, 19, 27, 34, 41, 42, 35, 43,
0, 4, 1, 2, 5, 8, 12, 9,
6, 3, 7, 10, 13, 14, 11, 15,
20, 28, 21, 22, 29, 36, 44, 37,
30, 23, 31, 38, 45, 46, 39, 47,
95, 87, 94, 93, 86, 79, 71, 78,
85, 92, 84, 77, 70, 69, 76, 68,
63, 59, 62, 61, 58, 55, 51, 54,
57, 60, 56, 53, 50, 49, 52, 48,
91, 83, 90, 89, 82, 75, 67, 74,
81, 88, 80, 73, 66, 65, 72, 64,
112, 120, 113, 114, 121, 128, 136, 129,
122, 115, 123, 130, 137, 138, 131, 139,
96, 100, 97, 98, 101, 104, 108, 105,
102, 99, 103, 106, 109, 110, 107, 111,
116, 124, 117, 118, 125, 132, 140, 133,
126, 119, 127, 134, 141, 142, 135, 143,
191, 183, 190, 189, 182, 175, 167, 174,
181, 188, 180, 173, 166, 165, 172, 164,
159, 155, 158, 157, 154, 151, 147, 150,
153, 156, 152, 149, 146, 145, 148, 144,
187, 179, 186, 185, 178, 171, 163, 170,
177, 184, 176, 169, 162, 161, 168, 160,
}

Definition at line 111 of file aic.c.

◆ aic_scan

const uint8_t* const aic_scan[NUM_BANDS]
static
Initial value:

Definition at line 138 of file aic.c.

Referenced by aic_decode_coeffs().

◆ ff_aic_decoder

const AVCodec ff_aic_decoder
Initial value:
= {
.name = "aic",
.long_name = NULL_IF_CONFIG_SMALL("Apple Intermediate Codec"),
.priv_data_size = sizeof(AICContext),
.close = aic_decode_close,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
}

Definition at line 499 of file aic.c.

FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:42
aic_c_scan
static const uint8_t aic_c_scan[64]
Definition: aic.c:100
get_ue_golomb
static int get_ue_golomb(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to 8190.
Definition: golomb.h:55
init
static int init
Definition: av_tx.c:47
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:380
val
static double val(void *priv, double ch)
Definition: aeval.c:76
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
decode
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
aic_y_ext_scan
static const uint8_t aic_y_ext_scan[192]
Definition: aic.c:73
AV_CODEC_CAP_FRAME_THREADS
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:113
aic_decode_init
static av_cold int aic_decode_init(AVCodecContext *avctx)
Definition: aic.c:444
get_unary
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
Definition: unary.h:46
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
aic_decode_frame
static int aic_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: aic.c:384
aic_y_scan
static const uint8_t aic_y_scan[64]
Definition: aic.c:62
aic_c_ext_scan
static const uint8_t aic_c_ext_scan[192]
Definition: aic.c:111
aic_decode_close
static av_cold int aic_decode_close(AVCodecContext *avctx)
Definition: aic.c:490
AV_CODEC_ID_AIC
@ AV_CODEC_ID_AIC
Definition: codec_id.h:219
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AICContext
Definition: aic.c:142