vorbisdec.c File Reference

Vorbis I decoder. More...

#include <inttypes.h>
#include <math.h>
#include "libavutil/float_dsp.h"
#include "libavutil/avassert.h"
#include "avcodec.h"
#include "get_bits.h"
#include "fft.h"
#include "fmtconvert.h"
#include "internal.h"
#include "vorbis.h"
#include "vorbisdsp.h"
#include "xiph.h"
Include dependency graph for vorbisdec.c:

Go to the source code of this file.

Data Structures

struct  vorbis_codebook
 
struct  vorbis_floor
 
union  vorbis_floor::vorbis_floor_u
 
struct  vorbis_floor::vorbis_floor_u::vorbis_floor0_s
 
struct  vorbis_floor::vorbis_floor_u::vorbis_floor1_s
 
struct  vorbis_residue
 
struct  vorbis_mapping
 
struct  vorbis_mode
 
struct  vorbis_context_s
 

Macros

#define BITSTREAM_READER_LE
 
#define V_NB_BITS   8
 
#define V_NB_BITS2   11
 
#define V_MAX_VLCS   (1 << 16)
 
#define V_MAX_PARTITIONS   (1 << 20)
 
#define BARK(x)   (13.1f * atan(0.00074f * (x)) + 2.24f * atan(1.85e-8f * (x) * (x)) + 1e-4f * (x))
 
#define VALIDATE_INDEX(idx, limit)
 
#define GET_VALIDATED_INDEX(idx, bits, limit)
 

Typedefs

typedef union vorbis_floor_u vorbis_floor_data
 
typedef struct vorbis_floor0_s vorbis_floor0
 
typedef struct vorbis_floor1_s vorbis_floor1
 
typedef int(* vorbis_floor_decode_func) (struct vorbis_context_s *, vorbis_floor_data *, float *)
 
typedef struct vorbis_context_s vorbis_context
 

Functions

static float vorbisfloat2float (unsigned val)
 
static void vorbis_free (vorbis_context *vc)
 
static int vorbis_parse_setup_hdr_codebooks (vorbis_context *vc)
 
static int vorbis_parse_setup_hdr_tdtransforms (vorbis_context *vc)
 
static int vorbis_floor0_decode (vorbis_context *vc, vorbis_floor_data *vfu, float *vec)
 
static int create_map (vorbis_context *vc, unsigned floor_number)
 
static int vorbis_floor1_decode (vorbis_context *vc, vorbis_floor_data *vfu, float *vec)
 
static int vorbis_parse_setup_hdr_floors (vorbis_context *vc)
 
static int vorbis_parse_setup_hdr_residues (vorbis_context *vc)
 
static int vorbis_parse_setup_hdr_mappings (vorbis_context *vc)
 
static int vorbis_parse_setup_hdr_modes (vorbis_context *vc)
 
static int vorbis_parse_setup_hdr (vorbis_context *vc)
 
static int vorbis_parse_id_hdr (vorbis_context *vc)
 
static av_cold int vorbis_decode_init (AVCodecContext *avctx)
 
static av_always_inline int vorbis_residue_decode_internal (vorbis_context *vc, vorbis_residue *vr, unsigned ch, uint8_t *do_not_decode, float *vec, unsigned vlen, unsigned ch_left, int vr_type)
 
static int vorbis_residue_decode (vorbis_context *vc, vorbis_residue *vr, unsigned ch, uint8_t *do_not_decode, float *vec, unsigned vlen, unsigned ch_left)
 
void ff_vorbis_inverse_coupling (float *mag, float *ang, intptr_t blocksize)
 
static int vorbis_parse_audio_packet (vorbis_context *vc, float **floor_ptr)
 
static int vorbis_decode_frame (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
 
static av_cold int vorbis_decode_close (AVCodecContext *avctx)
 
static av_cold void vorbis_decode_flush (AVCodecContext *avctx)
 

Variables

static const char idx_err_str [] = "Index value %d out of range (0 - %d) for %s at %s:%i\n"
 
AVCodec ff_vorbis_decoder
 

Detailed Description

Vorbis I decoder.

Author
Denes Balatoni ( dbalatoni programozo hu )

This file is part of FFmpeg.

FFmpeg is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

FFmpeg is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with FFmpeg; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Author
Denes Balatoni ( dbalatoni programozo hu )

Definition in file vorbisdec.c.

Macro Definition Documentation

#define BARK (   x)    (13.1f * atan(0.00074f * (x)) + 2.24f * atan(1.85e-8f * (x) * (x)) + 1e-4f * (x))

Definition at line 161 of file vorbisdec.c.

Referenced by create_map().

#define BITSTREAM_READER_LE

Definition at line 32 of file vorbisdec.c.

#define GET_VALIDATED_INDEX (   idx,
  bits,
  limit 
)
Value:
{\
idx = get_bits(gb, bits);\
VALIDATE_INDEX(idx, limit)\
}
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:240
uint8_t bits
Definition: crc.c:216
#define VALIDATE_INDEX(idx, limit)
Definition: vorbisdec.c:165

Definition at line 172 of file vorbisdec.c.

Referenced by vorbis_parse_audio_packet(), vorbis_parse_setup_hdr_floors(), vorbis_parse_setup_hdr_mappings(), vorbis_parse_setup_hdr_modes(), and vorbis_parse_setup_hdr_residues().

#define V_MAX_PARTITIONS   (1 << 20)

Definition at line 48 of file vorbisdec.c.

Referenced by vorbis_parse_setup_hdr_residues().

#define V_MAX_VLCS   (1 << 16)

Definition at line 47 of file vorbisdec.c.

Referenced by vorbis_parse_setup_hdr_codebooks().

#define V_NB_BITS   8

Definition at line 45 of file vorbisdec.c.

Referenced by vorbis_parse_setup_hdr_codebooks().

#define V_NB_BITS2   11

Definition at line 46 of file vorbisdec.c.

Referenced by vorbis_parse_setup_hdr_codebooks().

#define VALIDATE_INDEX (   idx,
  limit 
)
Value:
if (idx >= limit) {\
av_log(vc->avctx, AV_LOG_ERROR,\
(int)(idx), (int)(limit - 1), #idx, __FILE__, __LINE__);\
}
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
static const char idx_err_str[]
Definition: vorbisdec.c:164
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:246
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:148
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame This method is called when a frame is wanted on an output For an it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return it should return

Definition at line 165 of file vorbisdec.c.

Referenced by vorbis_parse_setup_hdr_floors().

Typedef Documentation

typedef struct vorbis_floor0_s vorbis_floor0

Definition at line 60 of file vorbisdec.c.

typedef struct vorbis_floor1_s vorbis_floor1

Definition at line 61 of file vorbisdec.c.

typedef union vorbis_floor_u vorbis_floor_data

Definition at line 59 of file vorbisdec.c.

typedef int(* vorbis_floor_decode_func) (struct vorbis_context_s *, vorbis_floor_data *, float *)

Definition at line 65 of file vorbisdec.c.

Function Documentation

static int create_map ( vorbis_context vc,
unsigned  floor_number 
)
static
void ff_vorbis_inverse_coupling ( float *  mag,
float *  ang,
intptr_t  blocksize 
)

Definition at line 1491 of file vorbisdec.c.

Referenced by ff_vorbisdsp_init().

static av_cold int vorbis_decode_close ( AVCodecContext avctx)
static

Definition at line 1768 of file vorbisdec.c.

static av_cold void vorbis_decode_flush ( AVCodecContext avctx)
static

Definition at line 1777 of file vorbisdec.c.

static int vorbis_decode_frame ( AVCodecContext avctx,
void data,
int *  got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 1678 of file vorbisdec.c.

static av_cold int vorbis_decode_init ( AVCodecContext avctx)
static

Definition at line 1012 of file vorbisdec.c.

static int vorbis_floor0_decode ( vorbis_context vc,
vorbis_floor_data vfu,
float *  vec 
)
static
static int vorbis_floor1_decode ( vorbis_context vc,
vorbis_floor_data vfu,
float *  vec 
)
static
static void vorbis_free ( vorbis_context vc)
static

Definition at line 190 of file vorbisdec.c.

Referenced by vorbis_decode_close(), vorbis_decode_frame(), and vorbis_decode_init().

static int vorbis_parse_audio_packet ( vorbis_context vc,
float **  floor_ptr 
)
static

Definition at line 1517 of file vorbisdec.c.

Referenced by vorbis_decode_frame().

static int vorbis_parse_id_hdr ( vorbis_context vc)
static

Definition at line 945 of file vorbisdec.c.

Referenced by vorbis_decode_frame(), and vorbis_decode_init().

static int vorbis_parse_setup_hdr ( vorbis_context vc)
static

Definition at line 899 of file vorbisdec.c.

Referenced by vorbis_decode_frame(), and vorbis_decode_init().

static int vorbis_parse_setup_hdr_codebooks ( vorbis_context vc)
static

Definition at line 239 of file vorbisdec.c.

Referenced by vorbis_parse_setup_hdr().

static int vorbis_parse_setup_hdr_floors ( vorbis_context vc)
static

Definition at line 493 of file vorbisdec.c.

Referenced by vorbis_parse_setup_hdr().

static int vorbis_parse_setup_hdr_mappings ( vorbis_context vc)
static

Definition at line 760 of file vorbisdec.c.

Referenced by vorbis_parse_setup_hdr().

static int vorbis_parse_setup_hdr_modes ( vorbis_context vc)
static

Definition at line 870 of file vorbisdec.c.

Referenced by vorbis_parse_setup_hdr().

static int vorbis_parse_setup_hdr_residues ( vorbis_context vc)
static

Definition at line 678 of file vorbisdec.c.

Referenced by vorbis_parse_setup_hdr().

static int vorbis_parse_setup_hdr_tdtransforms ( vorbis_context vc)
static

Definition at line 467 of file vorbisdec.c.

Referenced by vorbis_parse_setup_hdr().

static int vorbis_residue_decode ( vorbis_context vc,
vorbis_residue vr,
unsigned  ch,
uint8_t do_not_decode,
float *  vec,
unsigned  vlen,
unsigned  ch_left 
)
inlinestatic

Definition at line 1473 of file vorbisdec.c.

Referenced by vorbis_parse_audio_packet().

static av_always_inline int vorbis_residue_decode_internal ( vorbis_context vc,
vorbis_residue vr,
unsigned  ch,
uint8_t do_not_decode,
float *  vec,
unsigned  vlen,
unsigned  ch_left,
int  vr_type 
)
static

Definition at line 1313 of file vorbisdec.c.

Referenced by vorbis_residue_decode().

static float vorbisfloat2float ( unsigned  val)
static

Definition at line 178 of file vorbisdec.c.

Referenced by vorbis_parse_setup_hdr_codebooks().

Variable Documentation

AVCodec ff_vorbis_decoder
Initial value:
= {
.name = "vorbis",
.priv_data_size = sizeof(vorbis_context),
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
.channel_layouts = ff_vorbis_channel_layouts,
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
}
static av_cold int vorbis_decode_close(AVCodecContext *avctx)
Definition: vorbisdec.c:1768
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
float, planar
Definition: samplefmt.h:60
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static void flush(AVCodecContext *avctx)
static int vorbis_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: vorbisdec.c:1678
static void close(AVCodecParserContext *s)
Definition: h264_parser.c:375
const uint64_t ff_vorbis_channel_layouts[9]
Definition: vorbis_data.c:47
static av_cold int vorbis_decode_init(AVCodecContext *avctx)
Definition: vorbisdec.c:1012
struct vorbis_context_s vorbis_context
AVSampleFormat
Audio Sample Formats.
Definition: samplefmt.h:49
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: crystalhd.c:868
static av_cold void vorbis_decode_flush(AVCodecContext *avctx)
Definition: vorbisdec.c:1777

Definition at line 1788 of file vorbisdec.c.

const char idx_err_str[] = "Index value %d out of range (0 - %d) for %s at %s:%i\n"
static

Definition at line 164 of file vorbisdec.c.