ffmpeg / libavcodec / ac3dsp.h @ f4855a90
History  View  Annotate  Download (3.51 KB)
1 
/*


2 
* AC3 DSP utils

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 021101301 USA

20 
*/

21  
22 
#ifndef AVCODEC_AC3DSP_H

23 
#define AVCODEC_AC3DSP_H

24  
25 
#include <stdint.h> 
26  
27 
typedef struct AC3DSPContext { 
28 
/**

29 
* Set each encoded exponent in a block to the minimum of itself and the

30 
* exponents in the same frequency bin of up to 5 following blocks.

31 
* @param exp pointer to the start of the current block of exponents.

32 
* constraints: align 16

33 
* @param num_reuse_blocks number of blocks that will reuse exponents from the current block.

34 
* constraints: range 0 to 5

35 
* @param nb_coefs number of frequency coefficients.

36 
*/

37 
void (*ac3_exponent_min)(uint8_t *exp, int num_reuse_blocks, int nb_coefs); 
38  
39 
/**

40 
* Calculate the maximum MSB of the absolute value of each element in an

41 
* array of int16_t.

42 
* @param src input array

43 
* constraints: align 16. values must be in range [32767,32767]

44 
* @param len number of values in the array

45 
* constraints: multiple of 16 greater than 0

46 
* @return a value with the same MSB as max(abs(src[]))

47 
*/

48 
int (*ac3_max_msb_abs_int16)(const int16_t *src, int len); 
49  
50 
/**

51 
* Leftshift each value in an array of int16_t by a specified amount.

52 
* @param src input array

53 
* constraints: align 16

54 
* @param len number of values in the array

55 
* constraints: multiple of 32 greater than 0

56 
* @param shift left shift amount

57 
* constraints: range [0,15]

58 
*/

59 
void (*ac3_lshift_int16)(int16_t *src, unsigned int len, unsigned int shift); 
60  
61 
/**

62 
* Rightshift each value in an array of int32_t by a specified amount.

63 
* @param src input array

64 
* constraints: align 16

65 
* @param len number of values in the array

66 
* constraints: multiple of 16 greater than 0

67 
* @param shift right shift amount

68 
* constraints: range [0,31]

69 
*/

70 
void (*ac3_rshift_int32)(int32_t *src, unsigned int len, unsigned int shift); 
71  
72 
/**

73 
* Convert an array of float in range [1.0,1.0] to int32_t with range

74 
* [(1<<24),(1<<24)]

75 
*

76 
* @param dst destination array of int32_t.

77 
* constraints: 16byte aligned

78 
* @param src source array of float.

79 
* constraints: 16byte aligned

80 
* @param len number of elements to convert.

81 
* constraints: multiple of 32 greater than zero

82 
*/

83 
void (*float_to_fixed24)(int32_t *dst, const float *src, unsigned int len); 
84 
} AC3DSPContext; 
85  
86 
void ff_ac3dsp_init (AC3DSPContext *c, int bit_exact); 
87 
void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact); 
88 
void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact); 
89  
90 
#endif /* AVCODEC_AC3DSP_H */ 