*/
/**
- * @file libavcodec/cook.c
+ * @file
* Cook compatible decoder. Bastardization of the G.722.1 standard.
* This decoder handles RealNetworks, RealAudio G2 data.
* Cook is identified by the codec name cook in RM files.
#include "get_bits.h"
#include "dsputil.h"
#include "bytestream.h"
+#include "fft.h"
#include "cookdata.h"
/* data buffers */
uint8_t* decoded_bytes_buffer;
- DECLARE_ALIGNED_16(float,mono_mdct_output)[2048];
+ DECLARE_ALIGNED(16, float,mono_mdct_output)[2048];
float decode_buffer_1[1024];
float decode_buffer_2[1024];
float decode_buffer_0[1060]; /* static allocation for joint decode */
/*************** init functions end ***********/
+#define DECODE_BYTES_PAD1(bytes) (3 - ((bytes)+3) % 4)
+#define DECODE_BYTES_PAD2(bytes) ((bytes) % 4 + DECODE_BYTES_PAD1(2 * (bytes)))
+
/**
* Cook indata decoding, every 32 bits are XORed with 0x37c511f2.
* Why? No idea, some checksum/error detection method maybe.
* @param out pointer to byte array of outdata
* @param bytes number of bytes
*/
-#define DECODE_BYTES_PAD1(bytes) (3 - ((bytes)+3) % 4)
-#define DECODE_BYTES_PAD2(bytes) ((bytes) % 4 + DECODE_BYTES_PAD1(2 * (bytes)))
static inline int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){
int i, off;
/* FIXME: 64 bit platforms would be able to do 64 bits at a time.
* I'm too lazy though, should be something like
* for(i=0 ; i<bitamount/64 ; i++)
- * (int64_t)out[i] = 0x37c511f237c511f2^be2me_64(int64_t)in[i]);
+ * (int64_t)out[i] = 0x37c511f237c511f2^av_be2ne64(int64_t)in[i]);
* Buffer alignment needs to be checked. */
off = (intptr_t)inbuffer & 3;
buf = (const uint32_t*) (inbuffer - off);
- c = be2me_32((0x37c511f2 >> (off*8)) | (0x37c511f2 << (32-(off*8))));
+ c = av_be2ne32((0x37c511f2 >> (off*8)) | (0x37c511f2 << (32-(off*8))));
bytes += 3 + off;
for (i = 0; i < bytes/4; i++)
obuf[i] = c ^ buf[i];
/**
* Fill the gain array for the timedomain quantization.
*
- * @param q pointer to the COOKContext
- * @param gaininfo[9] array of gain indexes
+ * @param gb pointer to the GetBitContext
+ * @param gaininfo[9] array of gain indexes
*/
static void decode_gain_info(GetBitContext *gb, int *gaininfo)
* @param previous_buffer pointer to the previous buffer to be used for overlapping
*/
-static void imlt_window_float (COOKContext *q, float *buffer1,
+static void imlt_window_float (COOKContext *q, float *inbuffer,
cook_gains *gains_ptr, float *previous_buffer)
{
const float fc = pow2tab[gains_ptr->previous[0] + 63];
/* Apply window and overlap */
for(i = 0; i < q->samples_per_channel; i++){
- buffer1[i] = buffer1[i] * fc * q->mlt_window[i] -
+ inbuffer[i] = inbuffer[i] * fc * q->mlt_window[i] -
previous_buffer[i] * q->mlt_window[q->samples_per_channel - 1 - i];
}
}
*
* @param q pointer to the COOKContext
* @param inbuffer pointer to raw stream data
- * @param gain_ptr array of current/prev gain pointers
+ * @param gains_ptr array of current/prev gain pointers
*/
static inline void
*
* @param q pointer to the COOKContext
* @param decode_buffer pointer to the mlt coefficients
- * @param gain_ptr array of current/prev gain pointers
+ * @param gains_ptr array of current/prev gain pointers
* @param previous_buffer pointer to the previous buffer to be used for overlapping
* @param out pointer to the output buffer
* @param chan 0: left or single channel, 1: right channel
static inline void
mlt_compensate_output(COOKContext *q, float *decode_buffer,
- cook_gains *gains, float *previous_buffer,
+ cook_gains *gains_ptr, float *previous_buffer,
int16_t *out, int chan)
{
- imlt_gain(q, decode_buffer, gains, previous_buffer);
+ imlt_gain(q, decode_buffer, gains_ptr, previous_buffer);
q->saturate_output (q, chan, out);
}
*
* @param q pointer to the COOKContext
* @param inbuffer pointer to the inbuffer
- * @param sub_packet_size subpacket size
* @param outbuffer pointer to the outbuffer
*/
-
-
static void decode_subpacket(COOKContext *q, COOKSubpacket* p, const uint8_t *inbuffer, int16_t *outbuffer) {
int sub_packet_size = p->size;
/* packet dump */
AVCodec cook_decoder =
{
.name = "cook",
- .type = CODEC_TYPE_AUDIO,
+ .type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_COOK,
.priv_data_size = sizeof(COOKContext),
.init = cook_decode_init,