FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
aic.c File Reference
#include <inttypes.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]
 
AVCodec ff_aic_decoder
 

Macro Definition Documentation

◆ AIC_HDR_SIZE

#define AIC_HDR_SIZE   24

Definition at line 34 of file aic.c.

◆ AIC_BAND_COEFFS

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

Definition at line 35 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 192 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 37 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 159 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 202 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 253 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 273 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 295 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 308 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 382 of file aic.c.

◆ aic_decode_init()

static av_cold int aic_decode_init ( AVCodecContext avctx)
static

Definition at line 442 of file aic.c.

◆ aic_decode_close()

static av_cold int aic_decode_close ( AVCodecContext avctx)
static

Definition at line 488 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 45 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 47 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 49 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 60 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 71 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 98 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 109 of file aic.c.

◆ aic_scan

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

Definition at line 136 of file aic.c.

Referenced by aic_decode_coeffs().

◆ ff_aic_decoder

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 497 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:40
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
aic_c_scan
static const uint8_t aic_c_scan[64]
Definition: aic.c:98
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
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:379
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:42
aic_y_ext_scan
static const uint8_t aic_y_ext_scan[192]
Definition: aic.c:71
AV_CODEC_CAP_FRAME_THREADS
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: avcodec.h:1037
aic_decode_init
static av_cold int aic_decode_init(AVCodecContext *avctx)
Definition: aic.c:442
ONLY_IF_THREADS_ENABLED
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
Definition: internal.h:227
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() for allocating buffers and supports custom allocators.
Definition: avcodec.h:981
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:188
init_thread_copy
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have add an init_thread_copy() which re-allocates them for other threads. Add AV_CODEC_CAP_FRAME_THREADS to the codec capabilities. There will be very little speed gain at this point but it should work. If there are inter-frame dependencies
val
const char const char void * val
Definition: avisynth_c.h:863
aic_decode_frame
static int aic_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: aic.c:382
aic_y_scan
static const uint8_t aic_y_scan[64]
Definition: aic.c:60
aic_c_ext_scan
static const uint8_t aic_c_ext_scan[192]
Definition: aic.c:109
aic_decode_close
static av_cold int aic_decode_close(AVCodecContext *avctx)
Definition: aic.c:488
AV_CODEC_ID_AIC
@ AV_CODEC_ID_AIC
Definition: avcodec.h:387
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AICContext
Definition: aic.c:140