mirror of
https://github.com/mpv-player/mpv
synced 2024-12-15 19:35:49 +00:00
57f3213401
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18786 b3059339-0415-0410-9bf9-f77b7e298cf2
432 lines
14 KiB
Diff
432 lines
14 KiB
Diff
--- libfaad2.orig/bits.h 2006-03-16 20:15:04.000000000 +0100
|
|
+++ libfaad2/bits.h 2006-03-16 20:37:21.000000000 +0100
|
|
@@ -22,7 +22,10 @@
|
|
** Commercial non-GPL licensing of this software is possible.
|
|
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
|
|
**
|
|
+** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30
|
|
** $Id: bits.h,v 1.40 2004/09/04 14:56:27 menno Exp $
|
|
+** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
|
|
+** local_changes.diff contains the exact changes to this file.
|
|
**/
|
|
|
|
#ifndef __BITS_H__
|
|
@@ -58,7 +61,7 @@
|
|
|
|
#if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__)
|
|
#define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax
|
|
-#elif defined(LINUX) || defined(DJGPP) || defined(__MINGW32__)
|
|
+#elif defined(LINUX) || defined(DJGPP)
|
|
#define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) )
|
|
#else
|
|
#define BSWAP(a) \
|
|
--- libfaad2.orig/common.h 2006-03-16 20:15:04.000000000 +0100
|
|
+++ libfaad2/common.h 2006-03-16 20:56:56.000000000 +0100
|
|
@@ -22,7 +22,10 @@
|
|
** Commercial non-GPL licensing of this software is possible.
|
|
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
|
|
**
|
|
+** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30
|
|
** $Id: common.h,v 1.65 2004/09/08 09:43:11 gcp Exp $
|
|
+** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
|
|
+** local_changes.diff contains the exact changes to this file.
|
|
**/
|
|
|
|
#ifndef __COMMON_H__
|
|
@@ -32,10 +35,13 @@
|
|
extern "C" {
|
|
#endif
|
|
|
|
-#ifdef HAVE_CONFIG_H
|
|
-# include "../config.h"
|
|
+/* Allow build on Cygwin*/
|
|
+#if defined(__CYGWIN__)
|
|
+#define __STRICT_ANSI__
|
|
#endif
|
|
|
|
+#include "../config.h"
|
|
+
|
|
#define INLINE __inline
|
|
#if 0 //defined(_WIN32) && !defined(_WIN32_WCE)
|
|
#define ALIGN __declspec(align(16))
|
|
@@ -61,7 +67,7 @@
|
|
/* Use if target platform has address generators with autoincrement */
|
|
//#define PREFER_POINTERS
|
|
|
|
-#ifdef _WIN32_WCE
|
|
+#if defined(_WIN32_WCE) || defined(__arm__)
|
|
#define FIXED_POINT
|
|
#endif
|
|
|
|
@@ -117,6 +123,9 @@
|
|
# ifdef MAIN_DEC
|
|
# undef MAIN_DEC
|
|
# endif
|
|
+# ifdef SBR_DEC
|
|
+# undef SBR_DEC
|
|
+# endif
|
|
#endif // FIXED_POINT
|
|
|
|
#ifdef DRM
|
|
@@ -151,6 +160,7 @@
|
|
|
|
#include <stdlib.h>
|
|
|
|
+#if 0
|
|
typedef unsigned __int64 uint64_t;
|
|
typedef unsigned __int32 uint32_t;
|
|
typedef unsigned __int16 uint16_t;
|
|
@@ -159,11 +169,31 @@
|
|
typedef __int32 int32_t;
|
|
typedef __int16 int16_t;
|
|
typedef __int8 int8_t;
|
|
+#else
|
|
+#include <inttypes.h>
|
|
+#endif
|
|
+
|
|
typedef float float32_t;
|
|
|
|
|
|
#else
|
|
|
|
+/* #undef HAVE_FLOAT32_T */
|
|
+/* Define if you have the <inttypes.h> header file. */
|
|
+#define HAVE_INTTYPES_H 1
|
|
+
|
|
+/* Define if you have the `memcpy' function. */
|
|
+#define HAVE_MEMCPY 1
|
|
+
|
|
+/* Define if you have the <stdint.h> header file. */
|
|
+#define HAVE_STDINT_H 1
|
|
+
|
|
+/* Define if you have the `strchr' function. */
|
|
+#define HAVE_STRCHR 1
|
|
+
|
|
+/* Define if you have the ANSI C header files. */
|
|
+#define STDC_HEADERS 1
|
|
+
|
|
#include <stdio.h>
|
|
#if HAVE_SYS_TYPES_H
|
|
# include <sys/types.h>
|
|
@@ -289,7 +319,7 @@
|
|
}
|
|
|
|
|
|
- #if defined(_WIN32) && !defined(__MINGW32__)
|
|
+ #if defined(_WIN32) && !defined(__MINGW32__) && !defined(HAVE_LRINTF)
|
|
#define HAS_LRINTF
|
|
static INLINE int lrintf(float f)
|
|
{
|
|
@@ -301,7 +331,7 @@
|
|
}
|
|
return i;
|
|
}
|
|
- #elif (defined(__i386__) && defined(__GNUC__))
|
|
+ #elif (defined(__i386__) && defined(__GNUC__)) && !defined(HAVE_LRINTF)
|
|
#define HAS_LRINTF
|
|
// from http://www.stereopsis.com/FPU.html
|
|
static INLINE int lrintf(float f)
|
|
@@ -330,6 +360,8 @@
|
|
|
|
#else
|
|
|
|
+#include <math.h>
|
|
+
|
|
#ifdef HAVE_LRINTF
|
|
# define HAS_LRINTF
|
|
# define _ISOC9X_SOURCE 1
|
|
@@ -338,8 +370,6 @@
|
|
# define __USE_ISOC99 1
|
|
#endif
|
|
|
|
- #include <math.h>
|
|
-
|
|
#ifdef HAVE_SINF
|
|
# define sin sinf
|
|
#error
|
|
--- libfaad2.orig/output.c 2006-03-16 20:15:04.000000000 +0100
|
|
+++ libfaad2/output.c 2006-04-18 19:50:26.000000000 +0200
|
|
@@ -19,10 +19,9 @@
|
|
** Any non-GPL usage of this software or parts of this software is strictly
|
|
** forbidden.
|
|
**
|
|
-** Commercial non-GPL licensing of this software is possible.
|
|
-** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
|
|
-**
|
|
-** $Id: output.c,v 1.42 2004/09/04 14:56:28 menno Exp $
|
|
+** Initially modified for use with MPlayer by Rich Felker on 2005/03/29
|
|
+** $Id: output.c,v 1.11 2005/04/05 05:43:41 rfelker Exp $
|
|
+** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
|
|
**/
|
|
|
|
#include "common.h"
|
|
@@ -463,7 +462,7 @@
|
|
}
|
|
}
|
|
|
|
-void* output_to_PCM(NeAACDecHandle hDecoder,
|
|
+void* output_to_PCM_sux(NeAACDecHandle hDecoder,
|
|
real_t **input, void *sample_buffer, uint8_t channels,
|
|
uint16_t frame_len, uint8_t format)
|
|
{
|
|
@@ -554,4 +553,51 @@
|
|
return sample_buffer;
|
|
}
|
|
|
|
+void* output_to_PCM(NeAACDecHandle hDecoder,
|
|
+ real_t **input, void *sample_buffer, uint8_t channels,
|
|
+ uint16_t frame_len, uint8_t format)
|
|
+{
|
|
+ int ch;
|
|
+ int i;
|
|
+ int16_t *short_sample_buffer = (int16_t*)sample_buffer;
|
|
+ real_t *ch0 = input[hDecoder->internal_channel[0]];
|
|
+ real_t *ch1 = input[hDecoder->internal_channel[1]];
|
|
+ real_t *ch2 = input[hDecoder->internal_channel[2]];
|
|
+ real_t *ch3 = input[hDecoder->internal_channel[3]];
|
|
+ real_t *ch4 = input[hDecoder->internal_channel[4]];
|
|
+
|
|
+ if (format != FAAD_FMT_16BIT)
|
|
+ return output_to_PCM_sux(hDecoder, input, sample_buffer, channels, frame_len, format);
|
|
+
|
|
+ if (hDecoder->downMatrix) {
|
|
+ for(i = 0; i < frame_len; i++)
|
|
+ {
|
|
+ int32_t tmp;
|
|
+ tmp = (ch1[i] + ((ch0[i]+ch3[i])>>1) + ((ch0[i]+ch3[i])>>2) + (1<<(REAL_BITS))) >> (REAL_BITS+1);
|
|
+ if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000;
|
|
+ short_sample_buffer[0] = tmp;
|
|
+ tmp = (ch2[i] + ((ch0[i]+ch4[i])>>1) + ((ch0[i]+ch4[i])>>2) + (1<<(REAL_BITS))) >> (REAL_BITS+1);
|
|
+ if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000;
|
|
+ short_sample_buffer[1] = tmp;
|
|
+ short_sample_buffer += channels;
|
|
+ }
|
|
+ return sample_buffer;
|
|
+ }
|
|
+
|
|
+ /* Copy output to a standard PCM buffer */
|
|
+ for(i = 0; i < frame_len; i++)
|
|
+ {
|
|
+ for (ch = 0; ch < channels; ch++)
|
|
+ {
|
|
+ int32_t tmp = input[hDecoder->internal_channel[ch]][i];
|
|
+ tmp += (1 << (REAL_BITS-1));
|
|
+ tmp >>= REAL_BITS;
|
|
+ if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000;
|
|
+ *(short_sample_buffer++) = tmp;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return sample_buffer;
|
|
+}
|
|
+
|
|
#endif
|
|
--- libfaad2.orig/ps_dec.c 2006-03-16 20:15:04.000000000 +0100
|
|
+++ libfaad2/ps_dec.c 2006-04-18 20:29:38.000000000 +0200
|
|
@@ -22,7 +22,10 @@
|
|
** Commercial non-GPL licensing of this software is possible.
|
|
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
|
|
**
|
|
+** Initially modified for use with MPlayer on 2005/12/05
|
|
** $Id: ps_dec.c,v 1.10 2004/09/04 14:56:28 menno Exp $
|
|
+** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
|
|
+** local_changes.diff contains the exact changes to this file.
|
|
**/
|
|
|
|
#include "common.h"
|
|
@@ -159,7 +162,7 @@
|
|
|
|
/* static function declarations */
|
|
static void ps_data_decode(ps_info *ps);
|
|
-static hyb_info *hybrid_init();
|
|
+static hyb_info *hybrid_init(void);
|
|
static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
|
|
qmf_t *buffer, qmf_t **X_hybrid);
|
|
static void INLINE DCT3_4_unscaled(real_t *y, real_t *x);
|
|
@@ -189,7 +192,7 @@
|
|
/* */
|
|
|
|
|
|
-static hyb_info *hybrid_init()
|
|
+static hyb_info *hybrid_init(void)
|
|
{
|
|
uint8_t i;
|
|
|
|
@@ -1935,8 +1938,8 @@
|
|
/* main Parametric Stereo decoding function */
|
|
uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
|
|
{
|
|
- qmf_t X_hybrid_left[32][32] = {{0}};
|
|
- qmf_t X_hybrid_right[32][32] = {{0}};
|
|
+ qmf_t X_hybrid_left[32][32] = {{{0}}};
|
|
+ qmf_t X_hybrid_right[32][32] = {{{0}}};
|
|
|
|
/* delta decoding of the bitstream data */
|
|
ps_data_decode(ps);
|
|
--- libfaad2.orig/sbr_dec.c 2006-03-16 20:15:04.000000000 +0100
|
|
+++ libfaad2/sbr_dec.c 2006-04-18 20:33:57.000000000 +0200
|
|
@@ -22,7 +22,10 @@
|
|
** Commercial non-GPL licensing of this software is possible.
|
|
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
|
|
**
|
|
+** Initially modified for use with MPlayer on 2005/12/05
|
|
** $Id: sbr_dec.c,v 1.39 2004/09/04 14:56:28 menno Exp $
|
|
+** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
|
|
+** local_changes.diff contains the exact changes to this file.
|
|
**/
|
|
|
|
|
|
@@ -526,8 +529,8 @@
|
|
uint8_t l, k;
|
|
uint8_t dont_process = 0;
|
|
uint8_t ret = 0;
|
|
- ALIGN qmf_t X_left[38][64] = {{0}};
|
|
- ALIGN qmf_t X_right[38][64] = {{0}}; /* must set this to 0 */
|
|
+ ALIGN qmf_t X_left[38][64] = {{{0}}};
|
|
+ ALIGN qmf_t X_right[38][64] = {{{0}}}; /* must set this to 0 */
|
|
|
|
if (sbr == NULL)
|
|
return 20;
|
|
--- libfaad2.orig/specrec.c 2006-03-16 20:15:04.000000000 +0100
|
|
+++ libfaad2/specrec.c 2006-04-18 20:38:09.000000000 +0200
|
|
@@ -19,10 +19,10 @@
|
|
** Any non-GPL usage of this software or parts of this software is strictly
|
|
** forbidden.
|
|
**
|
|
-** Commercial non-GPL licensing of this software is possible.
|
|
-** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
|
|
-**
|
|
+** Initially modified for use with MPlayer on 2006/04/18
|
|
** $Id: specrec.c,v 1.56 2004/09/08 09:43:11 gcp Exp $
|
|
+** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
|
|
+** local_changes.diff contains the exact changes to this file.
|
|
**/
|
|
|
|
/*
|
|
@@ -673,29 +673,19 @@
|
|
/* MAIN object type prediction */
|
|
if (hDecoder->object_type == MAIN)
|
|
{
|
|
- /* allocate the state only when needed */
|
|
- if (hDecoder->pred_stat[channel] == NULL)
|
|
- {
|
|
- hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state));
|
|
+ hDecoder->pred_stat[channel] = (pred_state*)realloc(hDecoder->pred_stat[channel], hDecoder->frameLength * sizeof(pred_state));
|
|
reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength);
|
|
- }
|
|
}
|
|
#endif
|
|
|
|
#ifdef LTP_DEC
|
|
if (is_ltp_ot(hDecoder->object_type))
|
|
{
|
|
- /* allocate the state only when needed */
|
|
- if (hDecoder->lt_pred_stat[channel] == NULL)
|
|
- {
|
|
- hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t));
|
|
+ hDecoder->lt_pred_stat[channel] = (int16_t*)realloc(hDecoder->lt_pred_stat[channel], hDecoder->frameLength*4 * sizeof(int16_t));
|
|
memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t));
|
|
- }
|
|
}
|
|
#endif
|
|
|
|
- if (hDecoder->time_out[channel] == NULL)
|
|
- {
|
|
mul = 1;
|
|
#ifdef SBR_DEC
|
|
hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0;
|
|
@@ -706,41 +696,28 @@
|
|
hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1;
|
|
}
|
|
#endif
|
|
- hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
|
|
+ hDecoder->time_out[channel] = (real_t*)realloc(hDecoder->time_out[channel], mul*hDecoder->frameLength*sizeof(real_t));
|
|
memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t));
|
|
- }
|
|
#if (defined(PS_DEC) || defined(DRM_PS))
|
|
if (output_channels == 2)
|
|
{
|
|
- if (hDecoder->time_out[channel+1] == NULL)
|
|
- {
|
|
- hDecoder->time_out[channel+1] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
|
|
+ hDecoder->time_out[channel+1] = (real_t*)realloc(hDecoder->time_out[channel+1], mul*hDecoder->frameLength*sizeof(real_t));
|
|
memset(hDecoder->time_out[channel+1], 0, mul*hDecoder->frameLength*sizeof(real_t));
|
|
- }
|
|
}
|
|
#endif
|
|
|
|
- if (hDecoder->fb_intermed[channel] == NULL)
|
|
- {
|
|
- hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t));
|
|
+ hDecoder->fb_intermed[channel] = (real_t*)realloc(hDecoder->fb_intermed[channel], hDecoder->frameLength*sizeof(real_t));
|
|
memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t));
|
|
- }
|
|
|
|
#ifdef SSR_DEC
|
|
if (hDecoder->object_type == SSR)
|
|
{
|
|
- if (hDecoder->ssr_overlap[channel] == NULL)
|
|
- {
|
|
- hDecoder->ssr_overlap[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
|
|
- memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
|
|
- }
|
|
- if (hDecoder->prev_fmd[channel] == NULL)
|
|
- {
|
|
uint16_t k;
|
|
- hDecoder->prev_fmd[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
|
|
+ hDecoder->ssr_overlap[channel] = (real_t*)realloc(hDecoder->ssr_overlap[channel], 2*hDecoder->frameLength*sizeof(real_t));
|
|
+ memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
|
|
+ hDecoder->prev_fmd[channel] = (real_t*)realloc(hDecoder->prev_fmd[channel], 2*hDecoder->frameLength*sizeof(real_t));
|
|
for (k = 0; k < 2*hDecoder->frameLength; k++)
|
|
hDecoder->prev_fmd[channel][k] = REAL_CONST(-1);
|
|
- }
|
|
}
|
|
#endif
|
|
|
|
@@ -865,22 +842,13 @@
|
|
|
|
/* always allocate 2 channels, PS can always "suddenly" turn up */
|
|
#if (defined(PS_DEC) || defined(DRM_PS))
|
|
- output_channels = 2;
|
|
+ output_channels = hDecoder->ps_used[hDecoder->fr_ch_ele] ? 2 : 1;
|
|
#else
|
|
output_channels = 1;
|
|
#endif
|
|
|
|
- if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
|
|
- {
|
|
- /* element_output_channels not set yet */
|
|
+ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] < output_channels) {
|
|
hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
|
|
- } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) {
|
|
- /* element inconsistency */
|
|
- return 21;
|
|
- }
|
|
-
|
|
- if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)
|
|
- {
|
|
retval = allocate_single_channel(hDecoder, sce->channel, output_channels);
|
|
if (retval > 0)
|
|
return retval;
|
|
@@ -1026,11 +994,10 @@
|
|
{
|
|
return 23;
|
|
}
|
|
-#endif
|
|
|
|
/* copy L to R when no PS is used */
|
|
#if (defined(PS_DEC) || defined(DRM_PS))
|
|
- if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0))
|
|
+ if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0) && (output_channels == 2))
|
|
{
|
|
uint8_t ele = hDecoder->fr_ch_ele;
|
|
uint8_t ch = sce->channel;
|
|
@@ -1040,6 +1007,7 @@
|
|
memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size);
|
|
}
|
|
#endif
|
|
+#endif
|
|
|
|
return 0;
|
|
}
|