annotate ffmpeg/libavcodec/ra144.h @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents 6840f77b83aa
children
rev   line source
yading@10 1 /*
yading@10 2 * Real Audio 1.0 (14.4K)
yading@10 3 * Copyright (c) 2003 the ffmpeg project
yading@10 4 *
yading@10 5 * This file is part of FFmpeg.
yading@10 6 *
yading@10 7 * FFmpeg is free software; you can redistribute it and/or
yading@10 8 * modify it under the terms of the GNU Lesser General Public
yading@10 9 * License as published by the Free Software Foundation; either
yading@10 10 * version 2.1 of the License, or (at your option) any later version.
yading@10 11 *
yading@10 12 * FFmpeg is distributed in the hope that it will be useful,
yading@10 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@10 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@10 15 * Lesser General Public License for more details.
yading@10 16 *
yading@10 17 * You should have received a copy of the GNU Lesser General Public
yading@10 18 * License along with FFmpeg; if not, write to the Free Software
yading@10 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@10 20 */
yading@10 21
yading@10 22 #ifndef AVCODEC_RA144_H
yading@10 23 #define AVCODEC_RA144_H
yading@10 24
yading@10 25 #include <stdint.h>
yading@10 26 #include "lpc.h"
yading@10 27 #include "audio_frame_queue.h"
yading@10 28
yading@10 29 #define NBLOCKS 4 ///< number of subblocks within a block
yading@10 30 #define BLOCKSIZE 40 ///< subblock size in 16-bit words
yading@10 31 #define BUFFERSIZE 146 ///< the size of the adaptive codebook
yading@10 32 #define FIXED_CB_SIZE 128 ///< size of fixed codebooks
yading@10 33 #define FRAMESIZE 20 ///< size of encoded frame
yading@10 34 #define LPC_ORDER 10 ///< order of LPC filter
yading@10 35
yading@10 36 typedef struct RA144Context {
yading@10 37 AVCodecContext *avctx;
yading@10 38 LPCContext lpc_ctx;
yading@10 39 AudioFrameQueue afq;
yading@10 40 int last_frame;
yading@10 41
yading@10 42 unsigned int old_energy; ///< previous frame energy
yading@10 43
yading@10 44 unsigned int lpc_tables[2][10];
yading@10 45
yading@10 46 /** LPC coefficients: lpc_coef[0] is the coefficients of the current frame
yading@10 47 * and lpc_coef[1] of the previous one. */
yading@10 48 unsigned int *lpc_coef[2];
yading@10 49
yading@10 50 unsigned int lpc_refl_rms[2];
yading@10 51
yading@10 52 int16_t curr_block[NBLOCKS * BLOCKSIZE];
yading@10 53
yading@10 54 /** The current subblock padded by the last 10 values of the previous one. */
yading@10 55 int16_t curr_sblock[50];
yading@10 56
yading@10 57 /** Adaptive codebook, its size is two units bigger to avoid a
yading@10 58 * buffer overflow. */
yading@10 59 int16_t adapt_cb[146+2];
yading@10 60 } RA144Context;
yading@10 61
yading@10 62 void ff_copy_and_dup(int16_t *target, const int16_t *source, int offset);
yading@10 63 int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx);
yading@10 64 void ff_eval_coefs(int *coefs, const int *refl);
yading@10 65 void ff_int_to_int16(int16_t *out, const int *inp);
yading@10 66 int ff_t_sqrt(unsigned int x);
yading@10 67 unsigned int ff_rms(const int *data);
yading@10 68 int ff_interp(RA144Context *ractx, int16_t *out, int a, int copyold,
yading@10 69 int energy);
yading@10 70 unsigned int ff_rescale_rms(unsigned int rms, unsigned int energy);
yading@10 71 int ff_irms(const int16_t *data);
yading@10 72 void ff_subblock_synthesis(RA144Context *ractx, const int16_t *lpc_coefs,
yading@10 73 int cba_idx, int cb1_idx, int cb2_idx,
yading@10 74 int gval, int gain);
yading@10 75
yading@10 76 extern const int16_t ff_gain_val_tab[256][3];
yading@10 77 extern const uint8_t ff_gain_exp_tab[256];
yading@10 78 extern const int8_t ff_cb1_vects[128][40];
yading@10 79 extern const int8_t ff_cb2_vects[128][40];
yading@10 80 extern const uint16_t ff_cb1_base[128];
yading@10 81 extern const uint16_t ff_cb2_base[128];
yading@10 82 extern const int16_t ff_energy_tab[32];
yading@10 83 extern const int16_t * const ff_lpc_refl_cb[10];
yading@10 84
yading@10 85 #endif /* AVCODEC_RA144_H */