FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
on2avc.c File Reference
#include "libavutil/channel_layout.h"
#include "libavutil/ffmath.h"
#include "libavutil/float_dsp.h"
#include "libavutil/mem.h"
#include "libavutil/mem_internal.h"
#include "libavutil/tx.h"
#include "avcodec.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "decode.h"
#include "get_bits.h"
#include "on2avcdata.h"

Go to the source code of this file.

Data Structures

struct  On2AVCContext
 

Macros

#define ON2AVC_SUBFRAME_SIZE   1024
 
#define CMUL1_R(s, t, is, it)   s[is + 0] * t[it + 0] - s[is + 1] * t[it + 1]
 
#define CMUL1_I(s, t, is, it)   s[is + 0] * t[it + 1] + s[is + 1] * t[it + 0]
 
#define CMUL2_R(s, t, is, it)   s[is + 0] * t[it + 0] + s[is + 1] * t[it + 1]
 
#define CMUL2_I(s, t, is, it)   s[is + 0] * t[it + 1] - s[is + 1] * t[it + 0]
 
#define CMUL0(dst, id, s0, s1, s2, s3, t0, t1, t2, t3, is, it)
 
#define CMUL1(dst, s0, s1, s2, s3, t0, t1, t2, t3, is, it)
 
#define CMUL2(dst, s0, s1, s2, s3, t0, t1, t2, t3, is, it)
 

Enumerations

enum  WindowTypes {
  WINDOW_TYPE_LONG = 0, WINDOW_TYPE_LONG_STOP, WINDOW_TYPE_LONG_START, WINDOW_TYPE_8SHORT = 3,
  WINDOW_TYPE_EXT4, WINDOW_TYPE_EXT5, WINDOW_TYPE_EXT6, WINDOW_TYPE_EXT7
}
 

Functions

static void on2avc_read_ms_info (On2AVCContext *c, GetBitContext *gb)
 
static int on2avc_decode_band_types (On2AVCContext *c, GetBitContext *gb)
 
static int on2avc_decode_band_scales (On2AVCContext *c, GetBitContext *gb)
 
static float on2avc_scale (int v, float scale)
 
static int on2avc_decode_quads (On2AVCContext *c, GetBitContext *gb, float *dst, int dst_size, int type, float band_scale)
 
static int get_egolomb (GetBitContext *gb)
 
static int on2avc_decode_pairs (On2AVCContext *c, GetBitContext *gb, float *dst, int dst_size, int type, float band_scale)
 
static int on2avc_read_channel_data (On2AVCContext *c, GetBitContext *gb, int ch)
 
static int on2avc_apply_ms (On2AVCContext *c)
 
static void zero_head_and_tail (float *src, int len, int order0, int order1)
 
static void pretwiddle (float *src, float *dst, int dst_len, int tab_step, int step, int order0, int order1, const double *const *tabs)
 
static void twiddle (float *src1, float *src2, int src2_len, const double *tab, int tab_len, int step, int order0, int order1, const double *const *tabs)
 
static void combine_fft (float *s0, float *s1, float *s2, float *s3, float *dst, const float *t0, const float *t1, const float *t2, const float *t3, int len, int step)
 
static void wtf_end_512 (On2AVCContext *c, float *out, float *src, float *tmp0, float *tmp1)
 
static void wtf_end_1024 (On2AVCContext *c, float *out, float *src, float *tmp0, float *tmp1)
 
static void wtf_40 (On2AVCContext *c, float *out, float *src, int size)
 
static void wtf_44 (On2AVCContext *c, float *out, float *src, int size)
 
static int on2avc_reconstruct_channel_ext (On2AVCContext *c, AVFrame *dst, int offset)
 
static int on2avc_reconstruct_channel (On2AVCContext *c, int channel, AVFrame *dst, int offset)
 
static int on2avc_decode_subframe (On2AVCContext *c, const uint8_t *buf, int buf_size, AVFrame *dst, int offset)
 
static int on2avc_decode_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
 
static av_cold void on2avc_free_vlcs (On2AVCContext *c)
 
static av_cold int on2avc_decode_init (AVCodecContext *avctx)
 
static av_cold int on2avc_decode_close (AVCodecContext *avctx)
 

Variables

const FFCodec ff_on2avc_decoder
 

Macro Definition Documentation

◆ ON2AVC_SUBFRAME_SIZE

#define ON2AVC_SUBFRAME_SIZE   1024

Definition at line 38 of file on2avc.c.

◆ CMUL1_R

#define CMUL1_R (   s,
  t,
  is,
  it 
)    s[is + 0] * t[it + 0] - s[is + 1] * t[it + 1]

Definition at line 384 of file on2avc.c.

◆ CMUL1_I

#define CMUL1_I (   s,
  t,
  is,
  it 
)    s[is + 0] * t[it + 1] + s[is + 1] * t[it + 0]

Definition at line 386 of file on2avc.c.

◆ CMUL2_R

#define CMUL2_R (   s,
  t,
  is,
  it 
)    s[is + 0] * t[it + 0] + s[is + 1] * t[it + 1]

Definition at line 388 of file on2avc.c.

◆ CMUL2_I

#define CMUL2_I (   s,
  t,
  is,
  it 
)    s[is + 0] * t[it + 1] - s[is + 1] * t[it + 0]

Definition at line 390 of file on2avc.c.

◆ CMUL0

#define CMUL0 (   dst,
  id,
  s0,
  s1,
  s2,
  s3,
  t0,
  t1,
  t2,
  t3,
  is,
  it 
)
Value:
dst[id] = s0[is] * t0[it] + s1[is] * t1[it] \
+ s2[is] * t2[it] + s3[is] * t3[it]; \
dst[id + 1] = s0[is] * t0[it + 1] + s1[is] * t1[it + 1] \
+ s2[is] * t2[it + 1] + s3[is] * t3[it + 1];

Definition at line 393 of file on2avc.c.

◆ CMUL1

#define CMUL1 (   dst,
  s0,
  s1,
  s2,
  s3,
  t0,
  t1,
  t2,
  t3,
  is,
  it 
)
Value:
*dst++ = CMUL1_R(s0, t0, is, it) \
+ CMUL1_R(s1, t1, is, it) \
+ CMUL1_R(s2, t2, is, it) \
+ CMUL1_R(s3, t3, is, it); \
*dst++ = CMUL1_I(s0, t0, is, it) \
+ CMUL1_I(s1, t1, is, it) \
+ CMUL1_I(s2, t2, is, it) \
+ CMUL1_I(s3, t3, is, it);

Definition at line 399 of file on2avc.c.

◆ CMUL2

#define CMUL2 (   dst,
  s0,
  s1,
  s2,
  s3,
  t0,
  t1,
  t2,
  t3,
  is,
  it 
)
Value:
*dst++ = CMUL2_R(s0, t0, is, it) \
+ CMUL2_R(s1, t1, is, it) \
+ CMUL2_R(s2, t2, is, it) \
+ CMUL2_R(s3, t3, is, it); \
*dst++ = CMUL2_I(s0, t0, is, it) \
+ CMUL2_I(s1, t1, is, it) \
+ CMUL2_I(s2, t2, is, it) \
+ CMUL2_I(s3, t3, is, it);

Definition at line 409 of file on2avc.c.

Enumeration Type Documentation

◆ WindowTypes

Enumerator
WINDOW_TYPE_LONG 
WINDOW_TYPE_LONG_STOP 
WINDOW_TYPE_LONG_START 
WINDOW_TYPE_8SHORT 
WINDOW_TYPE_EXT4 
WINDOW_TYPE_EXT5 
WINDOW_TYPE_EXT6 
WINDOW_TYPE_EXT7 

Definition at line 40 of file on2avc.c.

Function Documentation

◆ on2avc_read_ms_info()

static void on2avc_read_ms_info ( On2AVCContext c,
GetBitContext gb 
)
static

Definition at line 94 of file on2avc.c.

Referenced by on2avc_decode_subframe().

◆ on2avc_decode_band_types()

static int on2avc_decode_band_types ( On2AVCContext c,
GetBitContext gb 
)
static

Definition at line 115 of file on2avc.c.

Referenced by on2avc_read_channel_data().

◆ on2avc_decode_band_scales()

static int on2avc_decode_band_scales ( On2AVCContext c,
GetBitContext gb 
)
static

Definition at line 145 of file on2avc.c.

Referenced by on2avc_read_channel_data().

◆ on2avc_scale()

static float on2avc_scale ( int  v,
float  scale 
)
inlinestatic

Definition at line 192 of file on2avc.c.

Referenced by on2avc_decode_pairs(), and on2avc_decode_quads().

◆ on2avc_decode_quads()

static int on2avc_decode_quads ( On2AVCContext c,
GetBitContext gb,
float dst,
int  dst_size,
int  type,
float  band_scale 
)
static

Definition at line 198 of file on2avc.c.

Referenced by on2avc_read_channel_data().

◆ get_egolomb()

static int get_egolomb ( GetBitContext gb)
inlinestatic

Definition at line 215 of file on2avc.c.

Referenced by on2avc_decode_pairs().

◆ on2avc_decode_pairs()

static int on2avc_decode_pairs ( On2AVCContext c,
GetBitContext gb,
float dst,
int  dst_size,
int  type,
float  band_scale 
)
static

Definition at line 231 of file on2avc.c.

Referenced by on2avc_read_channel_data().

◆ on2avc_read_channel_data()

static int on2avc_read_channel_data ( On2AVCContext c,
GetBitContext gb,
int  ch 
)
static

Definition at line 259 of file on2avc.c.

Referenced by on2avc_decode_subframe().

◆ on2avc_apply_ms()

static int on2avc_apply_ms ( On2AVCContext c)
static

Definition at line 296 of file on2avc.c.

Referenced by on2avc_decode_subframe().

◆ zero_head_and_tail()

static void zero_head_and_tail ( float src,
int  len,
int  order0,
int  order1 
)
static

Definition at line 321 of file on2avc.c.

Referenced by wtf_end_1024(), and wtf_end_512().

◆ pretwiddle()

static void pretwiddle ( float src,
float dst,
int  dst_len,
int  tab_step,
int  step,
int  order0,
int  order1,
const double *const *  tabs 
)
static

Definition at line 327 of file on2avc.c.

Referenced by twiddle(), wtf_end_1024(), and wtf_end_512().

◆ twiddle()

static void twiddle ( float src1,
float src2,
int  src2_len,
const double tab,
int  tab_len,
int  step,
int  order0,
int  order1,
const double *const *  tabs 
)
static

Definition at line 354 of file on2avc.c.

Referenced by wtf_40(), and wtf_44().

◆ combine_fft()

static void combine_fft ( float s0,
float s1,
float s2,
float s3,
float dst,
const float t0,
const float t1,
const float t2,
const float t3,
int  len,
int  step 
)
static

Definition at line 419 of file on2avc.c.

Referenced by wtf_end_1024(), and wtf_end_512().

◆ wtf_end_512()

static void wtf_end_512 ( On2AVCContext c,
float out,
float src,
float tmp0,
float tmp1 
)
static

Definition at line 468 of file on2avc.c.

Referenced by wtf_40(), and wtf_44().

◆ wtf_end_1024()

static void wtf_end_1024 ( On2AVCContext c,
float out,
float src,
float tmp0,
float tmp1 
)
static

Definition at line 496 of file on2avc.c.

Referenced by wtf_40(), and wtf_44().

◆ wtf_40()

static void wtf_40 ( On2AVCContext c,
float out,
float src,
int  size 
)
static

Definition at line 524 of file on2avc.c.

Referenced by on2avc_decode_init().

◆ wtf_44()

static void wtf_44 ( On2AVCContext c,
float out,
float src,
int  size 
)
static

Definition at line 610 of file on2avc.c.

Referenced by on2avc_decode_init().

◆ on2avc_reconstruct_channel_ext()

static int on2avc_reconstruct_channel_ext ( On2AVCContext c,
AVFrame dst,
int  offset 
)
static

Definition at line 684 of file on2avc.c.

Referenced by on2avc_decode_subframe().

◆ on2avc_reconstruct_channel()

static int on2avc_reconstruct_channel ( On2AVCContext c,
int  channel,
AVFrame dst,
int  offset 
)
static

Definition at line 729 of file on2avc.c.

Referenced by on2avc_decode_subframe().

◆ on2avc_decode_subframe()

static int on2avc_decode_subframe ( On2AVCContext c,
const uint8_t *  buf,
int  buf_size,
AVFrame dst,
int  offset 
)
static

Definition at line 794 of file on2avc.c.

Referenced by on2avc_decode_frame().

◆ on2avc_decode_frame()

static int on2avc_decode_frame ( AVCodecContext avctx,
AVFrame frame,
int *  got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 835 of file on2avc.c.

◆ on2avc_free_vlcs()

static av_cold void on2avc_free_vlcs ( On2AVCContext c)
static

Definition at line 892 of file on2avc.c.

Referenced by on2avc_decode_close().

◆ on2avc_decode_init()

static av_cold int on2avc_decode_init ( AVCodecContext avctx)
static

Definition at line 901 of file on2avc.c.

◆ on2avc_decode_close()

static av_cold int on2avc_decode_close ( AVCodecContext avctx)
static

Definition at line 995 of file on2avc.c.

Variable Documentation

◆ ff_on2avc_decoder

const FFCodec ff_on2avc_decoder
Initial value:
= {
.p.name = "on2avc",
CODEC_LONG_NAME("On2 Audio for Video Codec"),
.p.type = AVMEDIA_TYPE_AUDIO,
.priv_data_size = sizeof(On2AVCContext),
.p.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
}

Definition at line 1015 of file on2avc.c.

AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
on2avc_decode_init
static av_cold int on2avc_decode_init(AVCodecContext *avctx)
Definition: on2avc.c:901
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:43
is
The official guide to swscale for confused that is
Definition: swscale.txt:28
CMUL1_I
#define CMUL1_I(s, t, is, it)
Definition: on2avc.c:386
AV_CODEC_ID_ON2AVC
@ AV_CODEC_ID_ON2AVC
Definition: codec_id.h:511
CMUL2_R
#define CMUL2_R(s, t, is, it)
Definition: on2avc.c:388
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:311
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
on2avc_decode_close
static av_cold int on2avc_decode_close(AVCodecContext *avctx)
Definition: on2avc.c:995
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
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
on2avc_decode_frame
static int on2avc_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition: on2avc.c:835
CMUL2_I
#define CMUL2_I(s, t, is, it)
Definition: on2avc.c:390
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
id
enum AVCodecID id
Definition: dts2pts.c:367
CMUL1_R
#define CMUL1_R(s, t, is, it)
Definition: on2avc.c:384
it
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s it
Definition: writing_filters.txt:31
On2AVCContext
Definition: on2avc.c:51