FFmpeg
Data Structures | Macros | Functions | Variables
osq.c File Reference
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "decode.h"
#include "internal.h"
#include "get_bits.h"
#include "unary.h"

Go to the source code of this file.

Data Structures

struct  OSQChannel
 
struct  OSQContext
 

Macros

#define BITSTREAM_READER_LE
 
#define OFFSET   5
 
#define A   (-1)
 
#define B   (-2)
 
#define C   (-3)
 
#define D   (-4)
 
#define E   (-5)
 
#define P2   (((unsigned)dst[A] + dst[A]) - dst[B])
 
#define P3   (((unsigned)dst[A] - dst[B]) * 3 + dst[C])
 

Functions

static void osq_flush (AVCodecContext *avctx)
 
static av_cold int osq_close (AVCodecContext *avctx)
 
static av_cold int osq_init (AVCodecContext *avctx)
 
static void reset_stats (OSQChannel *cb)
 
static void update_stats (OSQChannel *cb, int val)
 
static int update_residue_parameter (OSQChannel *cb)
 
static uint32_t get_urice (GetBitContext *gb, int k)
 
static int32_t get_srice (GetBitContext *gb, int x)
 
static int osq_channel_parameters (AVCodecContext *avctx, int ch)
 
static int do_decode (AVCodecContext *avctx, AVFrame *frame, int decorrelate, int downsample)
 
static int osq_decode_block (AVCodecContext *avctx, AVFrame *frame)
 
static int osq_receive_frame (AVCodecContext *avctx, AVFrame *frame)
 

Variables

const FFCodec ff_osq_decoder
 

Macro Definition Documentation

◆ BITSTREAM_READER_LE

#define BITSTREAM_READER_LE

Definition at line 29 of file osq.c.

◆ OFFSET

#define OFFSET   5

Definition at line 33 of file osq.c.

◆ A

#define A   (-1)

Definition at line 226 of file osq.c.

◆ B

#define B   (-2)

Definition at line 227 of file osq.c.

◆ C

#define C   (-3)

Definition at line 228 of file osq.c.

◆ D

#define D   (-4)

Definition at line 229 of file osq.c.

◆ E

#define E   (-5)

Definition at line 230 of file osq.c.

◆ P2

#define P2   (((unsigned)dst[A] + dst[A]) - dst[B])

Definition at line 231 of file osq.c.

◆ P3

#define P3   (((unsigned)dst[A] - dst[B]) * 3 + dst[C])

Definition at line 232 of file osq.c.

Function Documentation

◆ osq_flush()

static void osq_flush ( AVCodecContext avctx)
static

Definition at line 65 of file osq.c.

◆ osq_close()

static av_cold int osq_close ( AVCodecContext avctx)
static

Definition at line 73 of file osq.c.

◆ osq_init()

static av_cold int osq_init ( AVCodecContext avctx)
static

Definition at line 86 of file osq.c.

◆ reset_stats()

static void reset_stats ( OSQChannel cb)
static

Definition at line 141 of file osq.c.

Referenced by osq_channel_parameters().

◆ update_stats()

static void update_stats ( OSQChannel cb,
int  val 
)
static

Definition at line 147 of file osq.c.

Referenced by do_decode().

◆ update_residue_parameter()

static int update_residue_parameter ( OSQChannel cb)
static

Definition at line 157 of file osq.c.

Referenced by do_decode().

◆ get_urice()

static uint32_t get_urice ( GetBitContext gb,
int  k 
)
static

Definition at line 180 of file osq.c.

Referenced by get_srice(), and osq_channel_parameters().

◆ get_srice()

static int32_t get_srice ( GetBitContext gb,
int  x 
)
static

Definition at line 191 of file osq.c.

Referenced by do_decode().

◆ osq_channel_parameters()

static int osq_channel_parameters ( AVCodecContext avctx,
int  ch 
)
static

Definition at line 197 of file osq.c.

Referenced by osq_decode_block().

◆ do_decode()

static int do_decode ( AVCodecContext avctx,
AVFrame frame,
int  decorrelate,
int  downsample 
)
static

Definition at line 234 of file osq.c.

Referenced by osq_decode_block().

◆ osq_decode_block()

static int osq_decode_block ( AVCodecContext avctx,
AVFrame frame 
)
static

Definition at line 356 of file osq.c.

Referenced by osq_receive_frame().

◆ osq_receive_frame()

static int osq_receive_frame ( AVCodecContext avctx,
AVFrame frame 
)
static

Definition at line 416 of file osq.c.

Variable Documentation

◆ ff_osq_decoder

const FFCodec ff_osq_decoder
Initial value:
= {
.p.name = "osq",
CODEC_LONG_NAME("OSQ (Original Sound Quality)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_OSQ,
.priv_data_size = sizeof(OSQContext),
.close = osq_close,
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF |
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
.flush = osq_flush,
}

Definition at line 480 of file osq.c.

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
osq_flush
static void osq_flush(AVCodecContext *avctx)
Definition: osq.c:65
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:65
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
OSQContext
Definition: osq.c:46
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
AV_CODEC_CAP_CHANNEL_CONF
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: codec.h:106
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
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
AV_SAMPLE_FMT_U8P
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
Definition: samplefmt.h:63
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:64
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
osq_receive_frame
static int osq_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Definition: osq.c:416
FF_CODEC_RECEIVE_FRAME_CB
#define FF_CODEC_RECEIVE_FRAME_CB(func)
Definition: codec_internal.h:317
osq_init
static av_cold int osq_init(AVCodecContext *avctx)
Definition: osq.c:86
osq_close
static av_cold int osq_close(AVCodecContext *avctx)
Definition: osq.c:73
AV_CODEC_ID_OSQ
@ AV_CODEC_ID_OSQ
Definition: codec_id.h:544