Libav
ac3dsp.h
Go to the documentation of this file.
1 /*
2  * AC-3 DSP functions
3  * Copyright (c) 2011 Justin Ruggles
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVCODEC_AC3DSP_H
23 #define AVCODEC_AC3DSP_H
24 
25 #include <stdint.h>
26 
31 extern const uint16_t ff_ac3_bap_bits[16];
32 
33 typedef struct AC3DSPContext {
43  void (*ac3_exponent_min)(uint8_t *exp, int num_reuse_blocks, int nb_coefs);
44 
54  int (*ac3_max_msb_abs_int16)(const int16_t *src, int len);
55 
65  void (*ac3_lshift_int16)(int16_t *src, unsigned int len, unsigned int shift);
66 
76  void (*ac3_rshift_int32)(int32_t *src, unsigned int len, unsigned int shift);
77 
89  void (*float_to_fixed24)(int32_t *dst, const float *src, unsigned int len);
90 
106  void (*bit_alloc_calc_bap)(int16_t *mask, int16_t *psd, int start, int end,
107  int snr_offset, int floor,
108  const uint8_t *bap_tab, uint8_t *bap);
109 
117  void (*update_bap_counts)(uint16_t mant_cnt[16], uint8_t *bap, int len);
118 
125  int (*compute_mantissa_size)(uint16_t mant_cnt[6][16]);
126 
127  void (*extract_exponents)(uint8_t *exp, int32_t *coef, int nb_coefs);
128 
129  void (*downmix)(float **samples, float (*matrix)[2], int out_ch,
130  int in_ch, int len);
131 
143  void (*apply_window_int16)(int16_t *output, const int16_t *input,
144  const int16_t *window, unsigned int len);
145 } AC3DSPContext;
146 
147 void ff_ac3dsp_init (AC3DSPContext *c, int bit_exact);
148 void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact);
149 void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact);
150 
151 #endif /* AVCODEC_AC3DSP_H */
void(* update_bap_counts)(uint16_t mant_cnt[16], uint8_t *bap, int len)
Update bap counts using the supplied array of bap.
Definition: ac3dsp.h:117
void(* extract_exponents)(uint8_t *exp, int32_t *coef, int nb_coefs)
Definition: ac3dsp.h:127
void(* apply_window_int16)(int16_t *output, const int16_t *input, const int16_t *window, unsigned int len)
Apply symmetric window in 16-bit fixed-point.
Definition: ac3dsp.h:143
uint8_t
void(* bit_alloc_calc_bap)(int16_t *mask, int16_t *psd, int start, int end, int snr_offset, int floor, const uint8_t *bap_tab, uint8_t *bap)
Calculate bit allocation pointers.
Definition: ac3dsp.h:106
void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
Definition: ac3dsp_init.c:194
void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact)
static const uint16_t mask[17]
Definition: lzw.c:38
int(* ac3_max_msb_abs_int16)(const int16_t *src, int len)
Calculate the maximum MSB of the absolute value of each element in an array of int16_t.
Definition: ac3dsp.h:54
void(* ac3_lshift_int16)(int16_t *src, unsigned int len, unsigned int shift)
Left-shift each value in an array of int16_t by a specified amount.
Definition: ac3dsp.h:65
void(* ac3_rshift_int32)(int32_t *src, unsigned int len, unsigned int shift)
Right-shift each value in an array of int32_t by a specified amount.
Definition: ac3dsp.h:76
int32_t
const uint16_t ff_ac3_bap_bits[16]
Number of mantissa bits written for each bap value.
Definition: ac3dsp.c:141
void(* downmix)(float **samples, float(*matrix)[2], int out_ch, int in_ch, int len)
Definition: ac3dsp.h:129
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
int(* compute_mantissa_size)(uint16_t mant_cnt[6][16])
Calculate the number of bits needed to encode a set of mantissas.
Definition: ac3dsp.h:125
void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact)
Definition: ac3dsp.c:213
void(* ac3_exponent_min)(uint8_t *exp, int num_reuse_blocks, int nb_coefs)
Set each encoded exponent in a block to the minimum of itself and the exponents in the same frequency...
Definition: ac3dsp.h:43
int len
void(* float_to_fixed24)(int32_t *dst, const float *src, unsigned int len)
Convert an array of float in range [-1.0,1.0] to int32_t with range [-(1<<24),(1<<24)].
Definition: ac3dsp.h:89