Commit d2a4e4b9 authored by Gabriel Dume's avatar Gabriel Dume Committed by Diego Biurrun

wma: K&R formatting cosmetics

Signed-off-by: 's avatarDiego Biurrun <diego@biurrun.de>
parent c487972e
This diff is collapsed.
...@@ -23,10 +23,11 @@ ...@@ -23,10 +23,11 @@
#define AVCODEC_WMA_H #define AVCODEC_WMA_H
#include "libavutil/float_dsp.h" #include "libavutil/float_dsp.h"
#include "get_bits.h"
#include "put_bits.h"
#include "fft.h" #include "fft.h"
#include "fmtconvert.h" #include "fmtconvert.h"
#include "get_bits.h"
#include "put_bits.h"
/* size of blocks */ /* size of blocks */
#define BLOCK_MIN_BITS 7 #define BLOCK_MIN_BITS 7
...@@ -49,9 +50,9 @@ ...@@ -49,9 +50,9 @@
#define LSP_POW_BITS 7 #define LSP_POW_BITS 7
//FIXME should be in wmadec // FIXME should be in wmadec
#define VLCBITS 9 #define VLCBITS 9
#define VLCMAX ((22+VLCBITS-1)/VLCBITS) #define VLCMAX ((22 + VLCBITS - 1) / VLCBITS)
typedef float WMACoef; ///< type for decoded coefficients, int16_t would be enough for wma 1/2 typedef float WMACoef; ///< type for decoded coefficients, int16_t would be enough for wma 1/2
...@@ -64,7 +65,7 @@ typedef struct CoefVLCTable { ...@@ -64,7 +65,7 @@ typedef struct CoefVLCTable {
} CoefVLCTable; } CoefVLCTable;
typedef struct WMACodecContext { typedef struct WMACodecContext {
AVCodecContext* avctx; AVCodecContext *avctx;
GetBitContext gb; GetBitContext gb;
PutBitContext pb; PutBitContext pb;
int version; ///< 1 = 0x160 (WMAV1), 2 = 0x161 (WMAV2) int version; ///< 1 = 0x160 (WMAV1), 2 = 0x161 (WMAV2)
...@@ -88,7 +89,7 @@ typedef struct WMACodecContext { ...@@ -88,7 +89,7 @@ typedef struct WMACodecContext {
int high_band_values[MAX_CHANNELS][HIGH_BAND_MAX_SIZE]; int high_band_values[MAX_CHANNELS][HIGH_BAND_MAX_SIZE];
/* there are two possible tables for spectral coefficients */ /* there are two possible tables for spectral coefficients */
//FIXME the following 3 tables should be shared between decoders // FIXME the following 3 tables should be shared between decoders
VLC coef_vlc[2]; VLC coef_vlc[2];
uint16_t *run_table[2]; uint16_t *run_table[2];
float *level_table[2]; float *level_table[2];
...@@ -135,7 +136,7 @@ typedef struct WMACodecContext { ...@@ -135,7 +136,7 @@ typedef struct WMACodecContext {
#ifdef TRACE #ifdef TRACE
int frame_count; int frame_count;
#endif #endif /* TRACE */
} WMACodecContext; } WMACodecContext;
extern const uint16_t ff_wma_critical_freqs[25]; extern const uint16_t ff_wma_critical_freqs[25];
...@@ -145,15 +146,15 @@ extern const float ff_wma_lsp_codebook[NB_LSP_COEFS][16]; ...@@ -145,15 +146,15 @@ extern const float ff_wma_lsp_codebook[NB_LSP_COEFS][16];
extern const uint32_t ff_aac_scalefactor_code[121]; extern const uint32_t ff_aac_scalefactor_code[121];
extern const uint8_t ff_aac_scalefactor_bits[121]; extern const uint8_t ff_aac_scalefactor_bits[121];
int ff_wma_init(AVCodecContext * avctx, int flags2); int ff_wma_init(AVCodecContext *avctx, int flags2);
int ff_wma_total_gain_to_bits(int total_gain); int ff_wma_total_gain_to_bits(int total_gain);
int ff_wma_end(AVCodecContext *avctx); int ff_wma_end(AVCodecContext *avctx);
unsigned int ff_wma_get_large_val(GetBitContext* gb); unsigned int ff_wma_get_large_val(GetBitContext *gb);
int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb, int ff_wma_run_level_decode(AVCodecContext *avctx, GetBitContext *gb,
VLC *vlc, VLC *vlc, const float *level_table,
const float *level_table, const uint16_t *run_table, const uint16_t *run_table, int version,
int version, WMACoef *ptr, int offset, WMACoef *ptr, int offset, int num_coefs,
int num_coefs, int block_len, int frame_len_bits, int block_len, int frame_len_bits,
int coef_nb_bits); int coef_nb_bits);
#endif /* AVCODEC_WMA_H */ #endif /* AVCODEC_WMA_H */
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
*/ */
#include "libavutil/attributes.h" #include "libavutil/attributes.h"
#include "wma_common.h" #include "wma_common.h"
/** /**
...@@ -31,31 +32,27 @@ ...@@ -31,31 +32,27 @@
av_cold int ff_wma_get_frame_len_bits(int sample_rate, int version, av_cold int ff_wma_get_frame_len_bits(int sample_rate, int version,
unsigned int decode_flags) unsigned int decode_flags)
{ {
int frame_len_bits; int frame_len_bits;
if (sample_rate <= 16000) { if (sample_rate <= 16000)
frame_len_bits = 9; frame_len_bits = 9;
} else if (sample_rate <= 22050 || else if (sample_rate <= 22050 || (sample_rate <= 32000 && version == 1))
(sample_rate <= 32000 && version == 1)) {
frame_len_bits = 10; frame_len_bits = 10;
} else if (sample_rate <= 48000 || version < 3) { else if (sample_rate <= 48000 || version < 3)
frame_len_bits = 11; frame_len_bits = 11;
} else if (sample_rate <= 96000) { else if (sample_rate <= 96000)
frame_len_bits = 12; frame_len_bits = 12;
} else { else
frame_len_bits = 13; frame_len_bits = 13;
}
if (version == 3) { if (version == 3) {
int tmp = decode_flags & 0x6; int tmp = decode_flags & 0x6;
if (tmp == 0x2) { if (tmp == 0x2)
++frame_len_bits; ++frame_len_bits;
} else if (tmp == 0x4) { else if (tmp == 0x4)
--frame_len_bits; --frame_len_bits;
} else if (tmp == 0x6) { else if (tmp == 0x6)
frame_len_bits -= 2; frame_len_bits -= 2;
}
} }
return frame_len_bits; return frame_len_bits;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment