Commit fec6ded4 authored by Michel Lespinasse's avatar Michel Lespinasse
Browse files

reecriture du deco mpeg audio

* support du layer 1 mono et stereo
* support du layer 2 stereo (j'ai pas encore fait le mono)
* support des low bitrates proposes par le mpeg2 (non teste)
* passage des tests de compliance mpeg :)
* moins de macros qu'avant, mais je dois encore propriser un peu le code.
parent abe1132d
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
* audio_decoder.c: MPEG1 Layer I-II audio decoder thread
* audio_decoder_thread.c: MPEG1 Layer I-II audio decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
......@@ -56,7 +56,6 @@
#include "audio_output.h" /* aout_fifo_t (for audio_decoder.h) */
#include "audio_constants.h"
#include "audio_decoder.h"
#include "audio_decoder_thread.h"
#include "audio_math.h" /* DCT32(), PCM() */
......
......@@ -313,7 +313,7 @@ void DCT32(float *x, adec_bank_t *b)
void PCM(adec_bank_t *b, s16 **pcm, int jump)
{
/* scale factor */
#define F 32768
#define F -32768
/* These values are not in the same order as in Annex 3-B.3 of the ISO/IEC
DIS 11172-3 */
static const float c[512] = {
......
/*****************************************************************************
* audio_test.c: MPEG1 Layer I-II audio decoder test program
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
* Authors:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*****************************************************************************/
/*
* TODO :
*
* - optimiser les NeedBits() et les GetBits() du code l o c'est possible ;
* - vlc_cond_signal() / vlc_cond_wait() ;
*
*/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdio.h>
#include <string.h>
#include "int_types.h"
#include "audio_decoder.h"
#define ADEC_FRAME_SIZE (2*1152)
int main (void)
{
audiodec_t decoder;
adec_sync_info_t sync_info;
adec_byte_stream_t * stream;
s16 buffer [ADEC_FRAME_SIZE];
int framenum;
memset (&decoder, 0, sizeof (decoder));
if (adec_init (&decoder))
return 1;
stream = adec_byte_stream (&decoder);
stream->p_byte = NULL;
stream->p_end = NULL;
stream->info = stdin;
framenum = 0;
while (1) {
int i;
if (adec_sync_frame (&decoder, &sync_info))
return 1;
if (adec_decode_frame (&decoder, buffer))
return 1;
#if 1
for (i = 0; i < (2*1152); i++)
printf ("%04X\n",(u16)buffer[i]);
#endif
}
return 0;
}
void adec_byte_stream_next (adec_byte_stream_t * p_byte_stream)
{
static u8 buffer [1024];
static u8 dummy = 0;
FILE * fd;
int size;
fd = p_byte_stream->info;
size = fread (buffer, 1, 1024, fd);
if (size) {
p_byte_stream->p_byte = buffer;
p_byte_stream->p_end = buffer + size;
} else { /* end of stream, read dummy zeroes */
p_byte_stream->p_byte = &dummy;
p_byte_stream->p_end = &dummy + 1;
}
}
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