diff --git a/mplayer/Changelog b/mplayer/Changelog index 98b9a7ff..b822ae25 100644 --- a/mplayer/Changelog +++ b/mplayer/Changelog @@ -3,7 +3,8 @@ MPlayer (1.0) rc5: Decoders: - * FFmpeg AAC decoder is now preferred over libfaad2 + * FFmpeg AAC decoder is now preferred over libfaad2 and the internal + libfaad2 forked copy has been removed in its favor Demuxers: * experimental support for using binary Quicktime codecs with -demuxer lavf. diff --git a/mplayer/Copyright b/mplayer/Copyright index aefcc134..1c816c25 100644 --- a/mplayer/Copyright +++ b/mplayer/Copyright @@ -21,14 +21,6 @@ License: GNU Lesser General Public License, some parts GNU General Public License, GNU General Public License when combined -Name: FAAD2 -Version: 2.1 beta (20040915 CVS snapshot) + fixes and portability patches -URL: http://www.audiocoding.com -Directory: libfaad2 -Copyright: 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -License: GNU General Public License - - Name: libdvdcss Version: Subversion r237 + local changes URL: http://developers.videolan.org/libdvdcss/ diff --git a/mplayer/DOCS/codecs-status.html b/mplayer/DOCS/codecs-status.html index 0fd72888..96e85992 100644 --- a/mplayer/DOCS/codecs-status.html +++ b/mplayer/DOCS/codecs-status.html @@ -674,7 +674,7 @@

Status of codecs support

FFmpeg H.264 - H264
h264
X264
x264
avc1
AVC1
davc
DAVC
vvvc
+ H264
h264
X264
x264
avc1
AVC1
davc
DAVC
vvvc
ai55
ai15
ai1q
ai5q
h264 YV12
I420
IYUV
- @@ -682,7 +682,7 @@

Status of codecs support

FFmpeg H.264 (VDPAU) - H264
h264
X264
x264
avc1
AVC1
davc
DAVC
+ H264
h264
X264
x264
avc1
AVC1
davc
DAVC
ai55
ai15
ai1q
ai5q
h264_vdpau VDPAU_H264 - @@ -690,7 +690,7 @@

Status of codecs support

CoreAVC H.264 for x86 - http://corecodec.org/ - H264
h264
X264
x264
avc1
davc
DAVC
VSSH
+ H264
h264
X264
x264
avc1
davc
DAVC
VSSH
ai55
ai15
ai1q
ai5q
CoreAVCDecoder.ax YV12
IYUV
I420
YUY2
this codec will only work after purchasing it @@ -1906,7 +1906,7 @@

Status of codecs support

Apple ProRes 422 (HQ) decoder - apch
apcn
apcs
+ apch
apcn
apcs
apco
ap4h
AppleProResDecoder.qtx YUY2 - @@ -2087,6 +2087,14 @@

Status of codecs support

BGR24
BGR15
BGR8
- + + + FFmpeg XAN wc4 + Xxan + xan_wc4 + YV12 + - + FFmpeg Electronic Arts TGV @@ -3240,9 +3248,9 @@

Status of codecs support

FFmpeg XAN DPCM audio - 0x6E617841 + 0x6E617841
0x594A
xan_dpcm - only works with libavformat demuxer + Wing Commander 4 files only work with libavformat demuxer @@ -3552,6 +3560,13 @@

Status of codecs support

pcm_bluray - + + + Leitch/Harris PCM + 0x46584C50 + pcm_lxf + - + FFmpeg AC-3 diff --git a/mplayer/DOCS/man/cs/mplayer.1 b/mplayer/DOCS/man/cs/mplayer.1 index 8c8e9377..559c5727 100644 --- a/mplayer/DOCS/man/cs/mplayer.1 +++ b/mplayer/DOCS/man/cs/mplayer.1 @@ -365,30 +365,6 @@ Převíjení zpět/\:vpřed o 1 minutu. .PD 1 .PP .RS -(Následující klávesy jsou platné, pokud jste zakompilovali podporu GUI -a dostanou přednost před výše uvedenými definicemi tlačítek.) -.RE -.PP -.PD 0 -.RS -.IPs "ENTER" -Start přehrávání. -.IPs "ESC\ \ " -Stop přehrávání. -.IPs "l\ \ \ \ " -Načtení souboru. -.IPs "t\ \ \ \ " -Načtení titulků. -.IPs "c\ \ \ \ " -Otevře volič skinů. -.IPs "p\ \ \ \ " -Otevře playlist. -.IPs "r\ \ \ \ " -Otevře předvolby. -.RE -.PD 1 -.PP -.RS (Následující klávesy jsou platné, pokud jste zakompilovali podporu vstupu z TV nebo DVB a dostanou přednost před výše uvedenými definicemi tlačítek.) .RE diff --git a/mplayer/DOCS/man/de/mplayer.1 b/mplayer/DOCS/man/de/mplayer.1 index ebfecdde..a2cd58a6 100644 --- a/mplayer/DOCS/man/de/mplayer.1 +++ b/mplayer/DOCS/man/de/mplayer.1 @@ -377,30 +377,6 @@ Im Minutenschritt zur .PD 1 .PP .RS -(Die folgenden Tasten sind nur gltig, falls MPlayer mit GUI-Untersttzung -bersetzt wurde und haben Vorrang vor den oben definierten Tasten.) -.RE -.PP -.PD 0 -.RSs -.IPs ENTER -Startet Wiedergabe. -.IPs "ESC\ \ " -Beendet die Wiedergabe. -.IPs "l\ \ \ \ " -Datei laden. -.IPs "t\ \ \ \ " -Untertitel laden. -.IPs "c\ \ \ \ " -Skinbrowser ffnen. -.IPs "p\ \ \ \ " -Playlist ffnen. -.IPs "r\ \ \ \ " -Konfigurationsdialog ffnen. -.RE -.PD 1 -.PP -.RS (Die folgenden Tasten sind nur gltig, falls MPlayer mit Untersttzung fr TV-Karten oder DVB-Input bersetzt wurde und haben Vorrang vor den oben definierten Tasten.) @@ -2416,6 +2392,24 @@ Deaktiviert das automatische Laden von Untertiteln. Setzt die Anzeigedauer der OSD-Meldungen in ms (Standard: 1000). . .TP +.B \-osd\-fractions <0\-2> +Setzt die Art der Anzeige von Nachkommastellen des aktuellen Zeitstempels im +OSD: +.PD 0 +.RSs +.IPs 0 +Keine Anzeige der Nachkommastellen (Standard). +.IPs 1 +Zeige die ersten beiden Nachkommastellen. +.IPs 2 +Zeige genherte Framezahl an. +Die angezeigte Framezahl ist nicht exakt, sondern nur genhert. +Fr variable FPS ist die Nherung weit von der tatschlichen Framezahl +entfernt. +.RE +.PD 1 +. +.TP .B \-osdlevel <0\-3> (nur bei MPlayer) Gibt den Modus an, in dem das OSD startet: .PD 0 @@ -11265,10 +11259,22 @@ Eingabebelegungen (siehe '\-input keylist' f aller Tastennamen) . .TP +~/.mplayer/\:gui.conf +Konfigurationsdatei fr die GUI +. +.TP +~/.mplayer/\:gui.history +Verzeichnis-Verlaufsdatei fr die GUI +. +.TP ~/.mplayer/\:gui.pl Playlist fr die GUI . .TP +~/.mplayer/\:gui.url +URL-Liste fr die GUI +. +.TP ~/.mplayer/\:font/ Schriftartenverzeichnis (es mssen sich eine Datei font.desc und Dateien mit der Erweiterung .RAW in dem Verzeichnis befinden) diff --git a/mplayer/DOCS/man/en/mplayer.1 b/mplayer/DOCS/man/en/mplayer.1 index 5b0fbb77..799b366f 100644 --- a/mplayer/DOCS/man/en/mplayer.1 +++ b/mplayer/DOCS/man/en/mplayer.1 @@ -1,4 +1,4 @@ -.\" $Revision: 32699 $ +.\" $Revision: 32946 $ .\" MPlayer (C) 2000-2010 MPlayer Team .\" This man page was/is done by Gabucino, Diego Biurrun, Jonas Jermann . @@ -374,30 +374,6 @@ Seek backward/\:forward 1 minute. .PD 1 .PP .RS -(The following keys are only valid if GUI support is compiled in -and will take precedence over the keys defined above.) -.RE -.PP -.PD 0 -.RS -.IPs ENTER -Start playing. -.IPs "ESC\ \ " -Stop playing. -.IPs "l\ \ \ \ " -Load file. -.IPs "t\ \ \ \ " -Load subtitle. -.IPs "c\ \ \ \ " -Open skin browser. -.IPs "p\ \ \ \ " -Open playlist. -.IPs "r\ \ \ \ " -Open preferences. -.RE -.PD 1 -.PP -.RS (The following keys are only valid if you compiled with TV or DVB input support and will take precedence over the keys defined above.) .RE @@ -1552,8 +1528,7 @@ on how to use this. Stop at given time or byte position. .br .I NOTE: -Byte position is enabled only for MEncoder and will not be accurate, as it can -only stop at a frame boundary. +Byte position may not be accurate, as it can only stop at a frame boundary. When used in conjunction with \-ss option, \-endpos time will shift forward by seconds specified with \-ss. .sp 1 @@ -2427,6 +2402,23 @@ Turns off automatic subtitle file loading. Set the duration of the OSD messages in ms (default: 1000). . .TP +.B \-osd\-fractions <0\-2> +Set how fractions of seconds of the current timestamp are printed on the OSD: +.PD 0 +.RSs +.IPs 0 +Do not display fractions (default). +.IPs 1 +Show the first two decimals. +.IPs 2 +Show approximated frame count within current second. +This frame count is not accurate but only an approximation. +For variable fps, the approximation is known to be far off the correct frame +count. +.RE +.PD 1 +. +.TP .B \-osdlevel <0\-3> (MPlayer only) Specifies which mode the OSD should start in. .PD 0 @@ -2558,7 +2550,7 @@ exact match .IPs 1 Load all subs containing movie name. .IPs 2 -Load all subs in the current directory. +Load all subs in the current and \-sub\-paths directories. .RE .PD 1 . @@ -2625,6 +2617,27 @@ Guess the encoding for Polish, fall back on cp1250. .PD 1 . .TP +.B \-sub\-paths +Specify extra subtitle paths to track in the media directory. +.sp 1 +.I EXAMPLE: +Assuming that /path/\:to/\:movie/\:movie.avi is played and \-sub\-paths +sub,subtitles,/tmp/subs is specified, MPlayer searches for subtitle files in +these directories: +.RSs +/path/\:to/\:movie/ +.br +/path/\:to/\:movie/\:sub/ +.br +/path/\:to/\:movie/\:subtitles/ +.br +/tmp/\:subs/ +.br +~/.mplayer/\:sub/ +.RE +.PD 1 +. +.TP .B \-subdelay Delays subtitles by seconds. Can be negative. @@ -4593,6 +4606,8 @@ Specifies the compression level. 0 is no compression, 9 is maximum compression. .IPs outdir= Specify the directory to save the PNG files to (default: ./). +.IPs prefix= +Specify the prefix to be used for the PNG filenames (default: no prefix). .IPs alpha (default: noalpha) Create PNG files with an alpha channel. Note that MPlayer in general does not support alpha, so this will only @@ -10341,6 +10356,8 @@ Note that quantization in H.264 works differently from MPEG-1/2/4: H.264's quantization parameter (QP) is on a logarithmic scale. The mapping is approximately H264QP = 12 + 6*log2(MPEGQP). For example, MPEG at QP=2 is equivalent to H.264 at QP=18. +Generally, this option should be avoided and crf should be used instead +as crf will yield better visual results for the same size. . .TP .B crf=<1.0\-50.0> @@ -10348,6 +10365,7 @@ Enables constant quality mode, and selects the quality. The scale is similar to QP. Like the bitrate-based modes, this allows each frame to use a different QP based on the frame's complexity. +This option should generally be used instead of qp. . .TP .B pass=<1\-3> @@ -11727,24 +11745,24 @@ input bindings (see '\-input keylist' for the full list) GUI configuration file . .TP +~/.mplayer/\:gui.history +GUI directory history +. +.TP ~/.mplayer/\:gui.pl GUI playlist . .TP +~/.mplayer/\:gui.url +GUI URL list +. +.TP ~/.mplayer/\:font/ font directory (There must be a font.desc file and files with .RAW extension.) . .TP ~/.mplayer/\:DVDkeys/ cached CSS keys -. -.TP -Assuming that /path/\:to/\:movie.avi is played, MPlayer searches for sub files -in this order: -.RS -/path/\:to/\:movie.sub -.br -~/.mplayer/\:sub/\:movie.sub .RE .PD 1 . diff --git a/mplayer/DOCS/man/en/mplayer.1.html b/mplayer/DOCS/man/en/mplayer.1.html index aa9fb4b9..799ed4fe 100644 --- a/mplayer/DOCS/man/en/mplayer.1.html +++ b/mplayer/DOCS/man/en/mplayer.1.html @@ -1,5 +1,5 @@ - + @@ -479,37 +479,6 @@

INTERACTIVE CONTROL

Seek backward/forward 1 minute.

-

(The following -keys are only valid if GUI support is compiled in and will -take precedence over the keys defined above.)
-ENTER

- -

Start playing.

- -

ESC  

- -

Stop playing.

- -

l    

- -

Load file.

- -

t    

- -

Load subtitle.

- -

c    

- -

Open skin browser.

- -

p    

- -

Open playlist.

- -

r    

- -

Open preferences.

-

(The following keys are only valid if you compiled with TV or DVB input support and will take precedence over the keys defined @@ -3410,6 +3379,52 @@

OSD/SUBTITLE OPTIONS

Set the duration of the OSD messages in ms (default: 1000).

+

−osd−fractions +<0−2>

+ +

Set how fractions of seconds of +the current timestamp are printed on the OSD:

+ + + + + + + + + + + + + + + + + +
+ + +

0

+ + +

Do not display fractions (default).

+ + +

1

+ + +

Show the first two decimals.

+ + +

2

+ + +

Show approximated frame count within current second. +This frame count is not accurate but only an approximation. +For variable fps, the approximation is known to be far off +the correct frame count.

+

−osdlevel <0−3> (MPlayer only)

@@ -3709,12 +3724,10 @@

OSD/SUBTITLE OPTIONS

0

- + -

exact match

- - +

exact match

@@ -3722,12 +3735,10 @@

OSD/SUBTITLE OPTIONS

1

- + -

Load all subs containing movie name.

- - +

Load all subs containing movie name.

@@ -3735,12 +3746,11 @@

OSD/SUBTITLE OPTIONS

2

- + -

Load all subs in the current directory.

- - +

Load all subs in the current and −sub−paths +directories.

@@ -3842,6 +3852,25 @@

OSD/SUBTITLE OPTIONS

Guess the encoding for Polish, fall back on cp1250.

+

−sub−paths +<path1,path2,...>

+ +

Specify extra subtitle paths to +track in the media directory.

+ + +

EXAMPLE: +Assuming that /path/to/movie/movie.avi is played and +−sub−paths sub,subtitles,/tmp/subs is specified, +MPlayer searches for subtitle files in these +directories:

+ +

/path/to/movie/
+/path/to/movie/sub/
+/path/to/movie/subtitles/
+/tmp/subs/
+~/.mplayer/sub/

+

−subdelay <sec>

@@ -6759,6 +6788,11 @@

VIDEO OUTPUT DRIVERS (MPLAYER ONLY)

Specify the directory to save the PNG files to (default: ./).

+

prefix=<prefix>

+ +

Specify the prefix to be used +for the PNG filenames (default: no prefix).

+

alpha

Create PNG files with an alpha @@ -17689,10 +17723,18 @@

FILES

GUI configuration file

+

~/.mplayer/gui.history

+ +

GUI directory history

+

~/.mplayer/gui.pl

GUI playlist

+

~/.mplayer/gui.url

+ +

GUI URL list

+

~/.mplayer/font/

font directory (There must be a @@ -17702,14 +17744,6 @@

FILES

cached CSS keys

-

Assuming that -/path/to/movie.avi is played, MPlayer searches for sub
-files

- -

in this order:
-/path/to/movie.sub
-~/.mplayer/sub/movie.sub

-

EXAMPLES OF MPLAYER USAGE

diff --git a/mplayer/DOCS/man/es/mplayer.1 b/mplayer/DOCS/man/es/mplayer.1 index cdd9a7bd..b7cebbc2 100644 --- a/mplayer/DOCS/man/es/mplayer.1 +++ b/mplayer/DOCS/man/es/mplayer.1 @@ -350,24 +350,6 @@ Detiene la reproducci Posiciona atrs/\:adelante 1 minuto. .PD 1 .PP -(Las siguientes teclas son vlidas nicamente cuando se ha compilado con soporte - para la interfaz grfica y tienen precedencia sobre las anteriores) -.PP -.PD 0 -.IPs "ENTER" -Comienza la reproduccin. -.IPs "ESC\ \ \ \ " -Detiene la reproduccin. -.IPs "l\ \ \ \ " -Carga un fichero. -.IPs "t\ \ \ \ " -Carga los subttulos. -.IPs "c\ \ \ \ " -Abre el navegador de temas. -.IPs "r\ \ \ \ " -Abre el dilogo de preferencias. -.PD 1 -.PP (Las siguientes teclas son vlidas nicamente cuando se ha compilado con soporte para la TV o DVB y tienen precedencia sobre las anteriores) .PP diff --git a/mplayer/DOCS/man/fr/mplayer.1 b/mplayer/DOCS/man/fr/mplayer.1 index 25db3bf0..ef205713 100644 --- a/mplayer/DOCS/man/fr/mplayer.1 +++ b/mplayer/DOCS/man/fr/mplayer.1 @@ -384,32 +384,6 @@ Navigue en arri . .PP .RS -(Les touches suivantes sont valides uniquement si MPlayer a t -compil avec le support de la GUI et si elles ont une priorit suprieure celles -dfinies plus haut dans ce document.) -.RE -.PP -.PD 0 -.RS -.IPs "ENTRE" -Dmarre la lecture. -.IPs "ESC\ \ " -Stoppe la lecture. -.IPs "l\ \ \ \ " -Charge un fichier. -.IPs "t\ \ \ \ " -Charge un sous-titre. -.IPs "c\ \ \ \ " -Ouvre le navigateur de skins. -.IPs "p\ \ \ \ " -Ouvre la liste de lecture (playlist). -.IPs "r\ \ \ \ " -Ouvre la fentre de prfrences. -.RE -.PD 1 -. -.PP -.RS (Les touches suivantes ne sont valides que si MPlayer a t compil avec le support de l'entre TV ou DVB et si elles ont une priorit suprieure celles dfinies plus haut dans ce document.) diff --git a/mplayer/DOCS/man/hu/mplayer.1 b/mplayer/DOCS/man/hu/mplayer.1 index 692c0d63..19b00014 100644 --- a/mplayer/DOCS/man/hu/mplayer.1 +++ b/mplayer/DOCS/man/hu/mplayer.1 @@ -372,30 +372,6 @@ L .PD 1 .PP .RS -(A kvetkez gombok csak akkor mkdnek, ha GUI tmogats be van fordtva -s elsbbsget lveznek a fenti gomb-defincikkal szemben.) -.RE -.PP -.PD 0 -.RS -.IPs ENTER -Lejtszs elindtsa. -.IPs "ESC\ \ " -Lejtszs meglltsa. -.IPs "l\ \ \ \ " -Fjl betltse. -.IPs "t\ \ \ \ " -Felirat betltse. -.IPs "c\ \ \ \ " -Skin bngsz megnyitsa. -.IPs "p\ \ \ \ " -Lejtszsi lista megnyitsa. -.IPs "r\ \ \ \ " -Belltsok megnyitsa. -.RE -.PD 1 -.PP -.RS (A kvetkez gombok csak akkor mkdnek, ha TV vagy DVB bemenet tmogatssal fordtottl s elsbbsget lveznek a fenti gomb-defincikkal szemben.) .RE diff --git a/mplayer/DOCS/man/it/mplayer.1 b/mplayer/DOCS/man/it/mplayer.1 index 6732e679..370eb8b7 100644 --- a/mplayer/DOCS/man/it/mplayer.1 +++ b/mplayer/DOCS/man/it/mplayer.1 @@ -383,30 +383,6 @@ Ricerca indietro/\:avanti di 1 minuto. .PP .RS (I seguenti tasti sono validi solo se MPlayer stato compilato col supporto -GUI e hanno precedenza su quelli definiti precedentemente.) -.RE -.PP -.PD 0 -.RS -.IPs ENTER -Inizia la riproduzione. -.IPs "ESC\ \ " -Ferma la riproduzione. -.IPs "l\ \ \ \ " -Carica file. -.IPs "t\ \ \ \ " -Carica sottotitoli. -.IPs "c\ \ \ \ " -Apre il selezionatore di skin. -.IPs "p\ \ \ \ " -Apre la playlist. -.IPs "r\ \ \ \ " -Apre le preferenze. -.RE -.PD 1 -.PP -.RS -(I seguenti tasti sono validi solo se MPlayer stato compilato col supporto di ingresso TV o DVB e hanno precedenza su quelli definiti precedentemente.) .RE .PP diff --git a/mplayer/DOCS/man/pl/mplayer.1 b/mplayer/DOCS/man/pl/mplayer.1 index e22fafbe..5b30245c 100644 --- a/mplayer/DOCS/man/pl/mplayer.1 +++ b/mplayer/DOCS/man/pl/mplayer.1 @@ -350,24 +350,6 @@ Prze Ustawia przezroczysto okna filmu. .RE .PD 1 - -. -.TP -.B Kontrola GUI klawiatur -.PD 0 -.RSs -.IPs ENTER -Zaczyna odtwarzanie. -.IPs "ESC\ \ " -Zatrzymuje odtwarzanie. -.IPs "l\ \ \ \ " -Wczytuje zbir. -.IPs "c\ \ \ \ " -Przegldarka skrek. -.IPs "p\ \ \ \ " -Przecza list odtwarzania. -.RE -.PD 1 . .TP .B Kontrola wejcia TV diff --git a/mplayer/DOCS/man/ru/mplayer.1 b/mplayer/DOCS/man/ru/mplayer.1 index bde08a9e..8c05a826 100644 --- a/mplayer/DOCS/man/ru/mplayer.1 +++ b/mplayer/DOCS/man/ru/mplayer.1 @@ -347,30 +347,6 @@ Stop playing (and quit if \-idle is not used). .PD 1 .PP .RS -( MPlayer GUI - .) -.RE -.PP -.PD 0 -.RS -.IPs ENTER - . -.IPs "ESC\ \ " - . -.IPs "l\ \ \ \ " - . -.IPs "t\ \ \ \ " - . -.IPs "c\ \ \ \ " - . -.IPs "p\ \ \ \ " - . -.IPs "r\ \ \ \ " - . -.RE -.PD 1 -.PP -.RS ( , MPlayer TV .) .RE diff --git a/mplayer/DOCS/man/zh_CN/mplayer.1 b/mplayer/DOCS/man/zh_CN/mplayer.1 index e7930d93..1356534f 100644 --- a/mplayer/DOCS/man/zh_CN/mplayer.1 +++ b/mplayer/DOCS/man/zh_CN/mplayer.1 @@ -1,4 +1,4 @@ -.\" sync with en/mplayer.1 rev. 32699 +.\" sync with en/mplayer.1 rev. 32880 .\" Encoding: UTF-8 .\" .\" MPlayer (C) 2000-2010 MPlayer 团队 @@ -1450,10 +1450,10 @@ MPlayer在关闭时将驱动器的速度重置至默认值。 . .TP .B \-endpos <[[hh:]mm:]ss[.ms]|size[b|kb|mb]> (也请参见 \-ss 和 \-sb) -停止在给定的时间或字节位置。 +停止在给定的时间或以字节计的位置。 .br -.I 注意: -字节位置仅为了 MEncoder 而启用但不精确, 因为它只会停在帧的边缘。 +.I 注意: +以字节计的位置可能不精确,因为只能暂停在帧数据块的边界上。 当与 \-ss 选项组合使用时, \-endpos 的时间会向前移动 \-ss 指定的秒数。 .sp 1 .I 示例: @@ -2255,6 +2255,22 @@ SSA/ASS 提供器能在那里放置字幕 (与 \-ass\-use\-margins 组合用)。 设置 OSD 信息的停留时间(以毫秒 ms 为单位) (默认是: 1000)。 . .TP +.B \-osd\-fractions <0\-2> +设置 OSD 中当前时间的秒数的小数部分如何显示: +.PD 0 +.RSs +.IPs 0 +不显示小数部分(默认行为)。 +.IPs 1 +显示头两位十进制数字。 +.IPs 2 +显示当前秒钟内大致的帧计数值。 +该帧计数值并不精确而只是一个近似值。 +在可变帧数编码的情况下,发现这个近似值远远偏离实际的帧计数值。 +.RE +.PD 1 +. +.TP .B \-osdlevel <0\-3> (仅用于 MPlayer) 指定 OSD 的启始模式。 .PD 0 @@ -2378,7 +2394,7 @@ MPlayer 在 verbose (\-v) 模式下会打印可用的语言。 .IPs 1 装载所有包含电影名称的字幕。 .IPs 2 -装载当前目录的所有字幕。 +装载当前目录以及 \-sub\-paths 目录中的所有字幕。 .RE .PD 1 . @@ -2440,8 +2456,28 @@ CC 字幕到目前为止还没有在其它地区码的 DVD 中发现。 .PD 1 . .TP -.B \-subdelay <数> -字幕延迟 <数> 秒。可以是负数。 +.B \-sub\-paths <路径1,路径2,...> +指定媒体文件的目录额外需要追踪的字幕路径。 +.sp 1 +.I 示例: +假设播放 /path/\:to/\:movie/\:movie.avi,并且指定了 \-sub\-paths +sub,subtitles,/tmp/subs,那么 MPlayer 将在这些目录下搜索字幕文件: +.RSs +/path/\:to/\:movie/ +.br +/path/\:to/\:movie/\:sub/ +.br +/path/\:to/\:movie/\:subtitles/ +.br +/tmp/\:subs/ +.br +~/.mplayer/\:sub/ +.RE +.PD 1 +. +.TP +.B \-subdelay <秒数> +字幕延迟 <秒数> 秒。可以是负数。 . .TP .B \-subfile <文件名> (BETA 代码) @@ -4286,6 +4322,9 @@ PGMYUV 像 PGM, 但也包含 U 和 V 平面, 添加在图像的底部。 0 没压缩, 9 最强压缩。 .IPs outdir=<目录名> 指定保存 PNG 文件的目录(默认值:./)。 +.IPs prefix=<前缀字符串> +指定用于 PNG 文件名的前缀。(默认:无前缀)。 +Specify the prefix to be used for the PNG filenames (default: no prefix). .IPs alpha(默认值:noalpha) 创建使用 alpha 通道的 PNG 文件。 注意 MPlayer 通常不支持 alpha 通道,所以该选项只在极少数情况下才有用。 @@ -9667,12 +9706,15 @@ I与B帧的话分别是该值加上ip_factor与pb_factor后得到的值。 H.264的量化参数是基于对数尺度的。 两者之间的映射关系大至是H264QP = 12 + 6*log2(MPEGQP)。 例如,MPEG的QP=2与H.264的QP=18是等价的。 +通常情况下,应避免使用该选项,而是使用 crf,因为 crf 在相同数据量下 +能产生更好的视觉效果。 . .TP .B crf=<1.0\-50.0> 启用恒定质量模式,并选择质量值。 该质量值的尺度与QP的相类似。 就像基于比特率的模式一样,该模式允许每个帧根据帧的复杂度使用不同的QP。 +通常情况下应使用该选项而非 qp。 . .TP .B pass=<1\-3> @@ -10957,13 +10999,6 @@ GUI 播放列表 .TP ~/.mplayer/\:DVDkeys/ 缓存的 CSS 钥匙 -. -.TP -假如播放文件是 /path/\:to/\:movie.avi, MPlayer 按以下顺序搜索字幕文件: -.RS -/path/\:to/\:movie.sub -.br -~/.mplayer/\:sub/\:movie.sub .RE .PD 1 . diff --git a/mplayer/DOCS/tech/MAINTAINERS b/mplayer/DOCS/tech/MAINTAINERS index 8765ba3c..a0884b8d 100644 --- a/mplayer/DOCS/tech/MAINTAINERS +++ b/mplayer/DOCS/tech/MAINTAINERS @@ -84,8 +84,8 @@ MPlayer code: * playtree, input layer: Alban Bedel * libswscale: Michael Niedermayer, Luca Abeni * DVB support: Nico Sabbi - * GUI: None - * GUI skins: Diego Biurrun + * GUI: Ingo Brückl + * GUI skins: Ingo Brückl * EDL code: Oded Shimon Imported libs/projects: @@ -96,7 +96,6 @@ Imported libs/projects: * libmpeg2: None * libdvdcss: Diego Biurrun * libdvdread: Diego Biurrun - * libfaad2: None * realrtsp: Roberto Togni * librtsp: Benjamin Zores * freesdp: Benjamin Zores diff --git a/mplayer/DOCS/tech/TODO b/mplayer/DOCS/tech/TODO index d5e10ceb..cfa7ff73 100644 --- a/mplayer/DOCS/tech/TODO +++ b/mplayer/DOCS/tech/TODO @@ -39,9 +39,6 @@ FOR THE NEXT RELEASE: FOR THE v1.00 RELEASE: ~~~~~~~~~~~~~~~~~~~~~~ -cruft removal: -- remove support for skins directories using the obsolete name 'Skin' - DVB: - display OSD and subtitles using DVB card's OSD @@ -90,4 +87,3 @@ remove externals: - remove tremor when ffvorbis has integer-only decoder. - remove libmpeg2 when ffmpeg12 is faster - remove mp3lib when ffmp3 is faster -- remove libfaad2 after soc aac is 100% diff --git a/mplayer/DOCS/tech/binary-packaging.txt b/mplayer/DOCS/tech/binary-packaging.txt index e9097d81..7b29dcf1 100644 --- a/mplayer/DOCS/tech/binary-packaging.txt +++ b/mplayer/DOCS/tech/binary-packaging.txt @@ -43,7 +43,6 @@ the following features MUST be included in any official binary package: - X11/Xvideo * codecs - - FAAD(internal) - libavcodec(internal) - native codecs (libmpeg2/mp3lib) - Vorbis Tremor codec(internal) diff --git a/mplayer/DOCS/tech/codecs.conf.txt b/mplayer/DOCS/tech/codecs.conf.txt index d2ec8e09..40d306d0 100644 --- a/mplayer/DOCS/tech/codecs.conf.txt +++ b/mplayer/DOCS/tech/codecs.conf.txt @@ -189,7 +189,11 @@ file. The "out" colorspace can be found in the codec source file in the PIX_FMT struct. Note that some codecs may have several pix_fmt structs. The pix_fmt can be converted to the codecs.conf "out" format by reading -the fmt_conversion.c file. +the fmt-conversion.c file. + +If there are BE and LE versions of a pix_fmt, ignore them and use the short +native format instead. e.g. 422P16_LE becomes out 422P16. also to note that +underscores cause parse errors, so 422P16_LE becomes out 422P16LE. libmpdemux/mp_taglists.c -------------- diff --git a/mplayer/DOCS/tech/dvdnav-howto.txt b/mplayer/DOCS/tech/dvdnav-howto.txt deleted file mode 100644 index 4588f4b6..00000000 --- a/mplayer/DOCS/tech/dvdnav-howto.txt +++ /dev/null @@ -1,42 +0,0 @@ -How to compile MPlayer with support for dvdnav: - -Since the versions of dvdnav and dvdread generally shipped with most Linux -distributions are outdated and unmaintained remove any traces of dvdnav and -dvdread from your computer (something like the command below should suffice): -$ rm -rf /usr/lib/libdvdnav* /usr/lib/libdvdread* /usr/include/dvdnav* \ - /usr/include/dvdread* /usr/local/lib/libdvdnav* \ - /usr/local/lib/libdvdread* /usr/local/include/dvdnav* \ - /usr/local/include/dvdread* /usr/bin/dvdnav-config \ - /usr/local/bin/dvdnav-config - -Now download dvdnav from MPHQ libdvdread and libdvdnav (in this order) : -$ svn co svn://svn.mplayerhq.hu/dvdnav/trunk/libdvdread libdvdread -$ cd libdvdread -$ ./autogen.sh && ./configure && make -(or, if you feel brave and want to help us improve the new build system) -$ ./configure2 && make -install it as root with -$ make install - -$ svn co svn://svn.mplayerhq.hu/dvdnav/trunk/libdvdnav libdvdnav -$ cd libdvdnav -$ ./autogen.sh && ./configure && make -(or, if you feel brave and want to help us improve the new build system) -$ ./configure2 && make -install it as root with -$ make install - -From within the MPlayer source tree run -$ ./configure --disable-dvdread-internal -followed by your preferred parameters. -Be warned that you *MUST* disable MPlayer's internal copy of dvdread or something -- most likely - won't work as expected (if at all). -After configure is run it should say that support for dvdnav and dvdread was -enabled. If not, investigate the dvdnav and dvdread sections in config.log -and try to understand what went wrong. If you can't solve the problem yourself -post the two sections to mplayer-users. - -Notice: Audio and subtitle language selection by means of menus doesn't work yet. -Nonetheless they can be switched as usual at any time during -playback by pressing '#' and 'j' (or the keys you chose to override those two -bindings). diff --git a/mplayer/DOCS/tech/mingw-crosscompile.txt b/mplayer/DOCS/tech/mingw-crosscompile.txt index 62e901a0..40579373 100644 --- a/mplayer/DOCS/tech/mingw-crosscompile.txt +++ b/mplayer/DOCS/tech/mingw-crosscompile.txt @@ -15,8 +15,8 @@ After extracting this package into the MPlayer source-tree, you only need to run the included linux-mingw.sh to configure (it just runs ./configure --host-cc=cc --target=i686-mingw32msvc --cc=i586-mingw32msvc-cc --windres=i586-mingw32msvc-windres --ranlib=i586-mingw32msvc-ranlib ---with-extraincdir="$PWD/osdep/mingw32" ---with-extralibdir="$PWD/osdep/mingw32" +--extra-cflags="-I$PWD/osdep/mingw32" +--extra-ldflags="-L$PWD/osdep/mingw32" --with-freetype-config="$PWD/osdep/mingw32/ftconf") and then run make. You should be able to run the generated binary with Wine, if you want to. diff --git a/mplayer/DOCS/xml/cs/bugreports.xml b/mplayer/DOCS/xml/cs/bugreports.xml index cbdf3c20..ce119407 100644 --- a/mplayer/DOCS/xml/cs/bugreports.xml +++ b/mplayer/DOCS/xml/cs/bugreports.xml @@ -232,7 +232,7 @@ obdrželi svou odpověď. Bude potřeba připojit log, konfiguraci nebo vzorky souborů ke svému hlášení chyb. Pokud jsou některé z nich opravdu velké, pak je raději nahrajte na náš -FTP server +FTP server v komprimovaném formátu (preferujeme gzip a bzip2) a do zprávy zahrňte pouze cestu a název souboru. Naše konference mají limit velikosti zprávy 80k, pokud máte něco většího, musíte to zkomprimovat a nahrát na FTP. @@ -386,7 +386,7 @@ mplayer -v volby film > Pokud se problém vztahuje k jednomu nebo více souborům, pak prosím nahrajte potížisty na: - + diff --git a/mplayer/DOCS/xml/cs/install.xml b/mplayer/DOCS/xml/cs/install.xml index 2acaf2b2..15a4f4b1 100644 --- a/mplayer/DOCS/xml/cs/install.xml +++ b/mplayer/DOCS/xml/cs/install.xml @@ -432,43 +432,6 @@ Now rerun ./configure for - -Kodek AAC - - -AAC (Advanced Audio Coding) je audio kodek, který lze občas nalézt v MOV a -MP4 souborech. Open source dekodér jménem FAAD je k dispozici na -. -MPlayer obsahuje CVS obraz libfaad 2.1 beta, -takže jej nemusíte stahovat dodatečně. - - - -Pokud používáte gcc 3.2 které nedokáže zkompilovat naši zabudovanou FAAD, -nebo chcete použít externí knihovnu z jiných důvodů, stáhněte si ji z -download stránky -a předejte volbu skriptu -./configure. -Pro dekódování AAC souborů nepotřebujete celou faad2, libfaad stačí. -Zkompilujete ji takto: - -cd faad2/ -sh bootstrap -./configure -cd libfaad -make -make install - -Binárky na audiocoding.com nenajdete, ale můžete si je opatřit v balíčcích pro -Debian z -domácí stránky Christiana Marillata, -Mandrake/Mandriva RPM z P.L.F -a Fedora RPM ze stránek Livna. - - - - - AMR kodeky diff --git a/mplayer/DOCS/xml/cs/ports.xml b/mplayer/DOCS/xml/cs/ports.xml index 8657248e..af0e0c42 100644 --- a/mplayer/DOCS/xml/cs/ports.xml +++ b/mplayer/DOCS/xml/cs/ports.xml @@ -417,7 +417,7 @@ Níže uvádíme řešení některých běžných problémů: Řešení: Použijte volbu extralibdir v configure - + diff --git a/mplayer/DOCS/xml/de/bugreports.xml b/mplayer/DOCS/xml/de/bugreports.xml index a0d7e84e..8875ae0e 100644 --- a/mplayer/DOCS/xml/de/bugreports.xml +++ b/mplayer/DOCS/xml/de/bugreports.xml @@ -194,7 +194,7 @@ make Du wirst wahrscheinlich Logdateien, Konfigurationsinformationen und Beispieldateien in deinen Fehlerbericht aufnehmen müssen. Werden einige von ihnen ziemlich groß, ist es besser, wenn du sie auf unseren - FTP-Server + FTP-Server hochlädst, und zwar in komprimierter Form (gzip und bzip2 bevorzugt). Gib dann in deinem Fehlerbericht nur den Pfad- und den Dateinamen an. Unsere Mailinglisten haben ein Nachrichten-Größenlimit von 80k, wenn du etwas größeres hast, musst du es @@ -363,7 +363,7 @@ ld -v Wenn dein Problem speziell mit einer oder mehreren Dateien zu tun hat, lade diese bitte hoch nach: - + diff --git a/mplayer/DOCS/xml/de/install.xml b/mplayer/DOCS/xml/de/install.xml index d63e8dbf..6eac56ec 100644 --- a/mplayer/DOCS/xml/de/install.xml +++ b/mplayer/DOCS/xml/de/install.xml @@ -472,43 +472,6 @@ make install - - AAC Codec - - AAC (Advanced Audio Coding) ist ein Audiocodec, der vorwiegend - in MOV- und MP4-Dateien vorkommt. Ein Open-Source-Decoder namens - FAAD ist auf - verfügbar. MPlayer enthält - eine CVS Version von libfaad 2.1 beta, so dass es nicht extra - installiert werden muss. - - - - Um die externe FAAD-Bibliothek verwenden zu können (z.B. um mit gcc 3.2 - compilieren zu können, der die interne Version nicht übersetzt), muss - die Bibliothek von der - Download Seite - heruntergeladen und installiert werden. Anschließend muss die Option - an ./configure - übergeben werden, damit die externe Bibliothek erkannt wird. - Es ist lediglich erforderlich, vorher libfaad zu installieren, und zwar so: - -cd faad2/ -sh bootstrap -./configure -cd libfaad -make -make install - Binärpakete sind auf audiocoding.com nicht erhältlich, Debian-Pakete - können aber mit (apt-)get von - Christian Marillat's Homepage, Mandrake/Mandriva RPMs von - P.L.F und RedHat RPMs - von Grey Sector - heruntergeladen werden. - - - AMR Codecs diff --git a/mplayer/DOCS/xml/de/ports.xml b/mplayer/DOCS/xml/de/ports.xml index 6e6c85a5..a746ed89 100644 --- a/mplayer/DOCS/xml/de/ports.xml +++ b/mplayer/DOCS/xml/de/ports.xml @@ -391,7 +391,7 @@ ctl 1 8/16/5.7.0 sctl CLAIMED DEVICE Lösung: Benutze die Option extralibdir von configure - + diff --git a/mplayer/DOCS/xml/de/skin.xml b/mplayer/DOCS/xml/de/skin.xml index 60d78819..aef288e0 100644 --- a/mplayer/DOCS/xml/de/skin.xml +++ b/mplayer/DOCS/xml/de/skin.xml @@ -20,7 +20,7 @@ - $(DATADIR)/skins/ + ~/.mplayer/skins/ @@ -28,16 +28,11 @@ $(PREFIX)/share/mplayer/skins/ - - - ~/.mplayer/skins/ - - - Beachte, dass der erste Pfad je nach Art der + Beachte, dass der zweite Pfad je nach Art der MPlayer-Konfiguration variieren kann (siehe Argumente und des configure-Scripts). @@ -77,17 +72,17 @@ Zur Zeit sind vier Fenster zu dekorieren: das Hauptfenster, das Unterfenster, die - Abspielleitse und das - Skin-Menü (das durch einen - Rechtsklick aktiviert werden kann). + Abspielleiste und das + Skin-Menü. - Das Hauptfenster und/oder die - Abspielleiste befindet sich dort, wo du - MPlayer kontrollieren kannst. Der Hintergrund - des Fensters ist eine Grafik. + Mit dem Hauptfenster kontrolliert + man den MPlayer. + Die Abspielleiste erscheint im + Vollbild-Modus, sobald man die Maus unten an den Bildschirm bewegt. + Der Hintergrund der Fenster ist eine Grafik. Ins Fenster können (und müssen) diverse Elemente platziert werden: Buttons, Potentiometer (Schieberegler) und Labels. @@ -145,8 +140,9 @@ Das Skin-Menü ist ganz einfach ein - Weg, MPlayer mittels der Menüeinträge zu - kontrollieren. Zwei Grafiken sind für das Menü erforderlich: + Weg, MPlayer mittels Menüeinträgen zu + kontrollieren. Es wird durch die mittlere Maustaste aktiviert. + Zwei Grafiken sind für das Menü erforderlich: eine davon ist die Basisgrafik, die den Normalzustand des Menüs darstellt, die andere wird zur Anzeige der gewählten Einträge verwendet. Wenn du das Menü aufklappst, wird die erste Grafik angezeigt. Bewegst du @@ -259,14 +255,16 @@ end main - für das Hauptfenster sub - für das Unterfenster + playbar - für die Abspielleiste menu - für das Skin-Menü - playbar - Abspielleiste - (Die sub- und menu-Blöcke sind optional - du musst kein Menü erzeugen oder - das Unterfenster dekorieren.) + (Die sub-, playbar- und menu-Blöcke sind optional - es ist nicht + nötig, das Unterfenster zu dekorieren, eine Abspielleiste zu haben + oder ein Menü zu erzeugen. Ein Standard-Menü steht immer über die + rechte Maustaste zur Verfügung.) @@ -547,15 +545,15 @@ end - font = fontfile, fontid + font = fontfile Definiert eine Schrift. fontfile ist der Name der Schrift-Beschreibungsdatei mit der Erweiterung .fnt - (gieb hier keine Erweiterung an). - fontid wird verwendet, um auf die Schrift zu verweisen + (gib hier keine Erweiterung an) und + wird verwendet, um auf die Schrift zu verweisen (siehe dlabel und slabel). Bis zu 25 Schriften können definiert werden. @@ -566,18 +564,18 @@ end - slabel = X, Y, fontid, "text" + slabel = X, Y, fontfile, "text" Platziere ein statisches Label an Position X,Y. text wird mittels der identifizierten - fontid angezeigt. Der Text ist einfach ein + fontfile angezeigt. Der Text ist einfach ein eine Ausgangszeichenkette ($x-Variablen funktionieren nicht), eingeschlossen von doppelten Anführungszeichen (das "-Zeichen kann jedoch nicht Teil des Textes sein). - Das Label wird mittels der über die fontid identifizierten + Das Label wird mittels der über die fontfile identifizierten Schrift angezeigt. @@ -586,19 +584,19 @@ end - dlabel = X, Y, length, align, fontid, "text" + dlabel = X, Y, width, align, fontfile, "text" Platziere ein dynamisches Label an Position X,Y. Das Label wird als dynamisch bezeichnet, weil sein Text periodisch - aktualisiert wird. Die Maximallänge des Labels wird mit dem - Wert length vorgegeben (seine Höhe ist die der + aktualisiert wird. Die maximale Breite des Labels wird mit dem + Wert width vorgegeben (seine Höhe ist die der Zeichen). Wird der anzuzeigende Text breiter als dieser Wert, wird er gescrollt, - andernfalls wird er innerhalb des Mittels des Wertes des vom - align-Parameter festgelegten Zwischenraums ausgerichtet: + andernfalls wird er innerhalb des angegebenen Bereichs gemäß des + align-Parameters ausgerichtet: 0 steht für rechts, 1 steht für zentriert, 2 steht für links. @@ -607,7 +605,7 @@ end Der anzuzeigende Text wird mit text festgelegt: Er muss zwischen doppelten Anführungszeichen stehen (das "-Zeichen kann jedoch nicht Teil des Textes sein). - Das Label wird mittels der über die fontid identifizierten + Das Label wird mittels der über die fontfile identifizierten Schrift angezeigt. Du kannst folgende Variablen im Text verwenden: @@ -882,7 +880,7 @@ end char-Zeichens innerhalb der Grafik fest (0,0 steht für die obere linke Ecke). width und height sind die Maße der - Zeichen in Pixel. + Zeichen in Pixel. Das Zeichen kann in UTF-8-Kodierung angegeben werden. diff --git a/mplayer/DOCS/xml/en/bugreports.xml b/mplayer/DOCS/xml/en/bugreports.xml index 5b0e9432..072c11ef 100644 --- a/mplayer/DOCS/xml/en/bugreports.xml +++ b/mplayer/DOCS/xml/en/bugreports.xml @@ -1,5 +1,5 @@ - + How to report bugs @@ -237,7 +237,7 @@ to subscribe to actually receive your answer. You may need to include log, configuration or sample files in your bug report. If some of them are quite big then it is better to upload them to our -FTP server in a +FTP server in a compressed format (gzip and bzip2 preferred) and include only the path and file name in your bug report. Our mailing lists have a message size limit of 80k, if you have something bigger you have to compress or upload it. @@ -391,7 +391,7 @@ mplayer -v options filename If your problem is specific to one or more files, then please upload the offender(s) to: - + diff --git a/mplayer/DOCS/xml/en/install.xml b/mplayer/DOCS/xml/en/install.xml index fe7c5ae4..5e140ccf 100644 --- a/mplayer/DOCS/xml/en/install.xml +++ b/mplayer/DOCS/xml/en/install.xml @@ -1,5 +1,5 @@ - + Installation @@ -431,40 +431,6 @@ Now rerun ./configure for - -AAC - - -An open source AAC decoder called FAAD2 is available from -. -MPlayer includes a copy of it in its source tree. -If you want to use the external library instead, install it and pass - to ./configure. - - - -FAAD2 binaries are not available from audiocoding.com, but you can (apt-)get -Debian packages from -Christian Marillat, -Mandrake/Mandriva RPMs from the P.L.F -and Fedora/CentOS/RHEL RPMs from RPMFusion. - - -If you choose to build from source, you do not need all of FAAD2 to decode -AAC files, libfaad is enough. Build it like this: - -cd faad2/ -sh bootstrap -./configure -cd libfaad -make -make install - - - - - - AMR diff --git a/mplayer/DOCS/xml/en/ports.xml b/mplayer/DOCS/xml/en/ports.xml index 52a49cdf..f26c8151 100644 --- a/mplayer/DOCS/xml/en/ports.xml +++ b/mplayer/DOCS/xml/en/ports.xml @@ -1,5 +1,5 @@ - + Ports @@ -394,7 +394,7 @@ Below are solutions for some common problems: Solution: Use the extralibdir option of configure - + diff --git a/mplayer/DOCS/xml/en/skin.xml b/mplayer/DOCS/xml/en/skin.xml index 749e1938..f887cfbb 100644 --- a/mplayer/DOCS/xml/en/skin.xml +++ b/mplayer/DOCS/xml/en/skin.xml @@ -1,5 +1,5 @@ - + <application>MPlayer</application> skin format @@ -22,15 +22,15 @@ Currently there are four windows to be decorated: the main window, the subwindow, the playbar, and the -skin menu (which can be activated -by a right click). +skin menu. - The main window and/or the - playbar is where you can control - MPlayer. The background of the window is an image. + The main window is where you can control + MPlayer. The playbar + shows up in fullscreen mode when moving the mouse to the bottom of + the screen. The background of the windows is an image. Various items can (and must) be placed in the window: buttons, potmeters (sliders) and labels. @@ -82,7 +82,8 @@ by a right click). The skin menu is just a way to control - MPlayer by means of menu entries. Two images + MPlayer by means of menu entries (which can be + activated by a middle mouse button click). Two images are required for the menu: one of them is the base image that shows the menu in its normal state, the other one is used to display the selected entries. When you pop up the menu, the first image is shown. If you move @@ -206,17 +207,18 @@ where window name can be one of these strings: sub - for the subwindow - menu - for the skin menu + playbar - for the playbar - playbar - playbar + menu - for the skin menu -(The sub and menu blocks are optional - you do not need to create a menu or -decorate the subwindow.) +(The sub, playbar and menu blocks are optional - you do not need to decorate +the subwindow, have a playbar or create a menu. A default menu is always +available by a right mouse button click.) @@ -446,12 +448,12 @@ blocks. - font = fontfile, fontid + font = fontfile Defines a font. fontfile is the name of a font description file with a .fnt extension (do not specify the extension - here). fontid is used to refer to the font + here) and is used to refer to the font (see dlabel and slabel). Up to 25 fonts can be defined. @@ -459,27 +461,27 @@ blocks. - slabel = X, Y, fontid, "text" + slabel = X, Y, fontfile, "text" Place a static label at the position X,Y. text is displayed using the font identified by - fontid. The text is just a raw string + fontfile. The text is just a raw string ($x variables do not work) that must be enclosed between double quotes (but the " character cannot be part of the text). The - label is displayed using the font identified by fontid. + label is displayed using the font identified by fontfile. - dlabel = X, Y, length, align, fontid, "text" + dlabel = X, Y, width, align, fontfile, "text" Place a dynamic label at the position X,Y. The label is - called dynamic because its text is refreshed periodically. The maximum length - of the label is given by length (its height is the height + called dynamic because its text is refreshed periodically. The maximum width + of the label is given by width (its height is the height of a character). If the text to be displayed is wider than that, it will be scrolled, otherwise it is aligned within the specified space by the value of the @@ -490,7 +492,7 @@ blocks. The text to be displayed is given by text: It must be written between double quotes (but the " character cannot be part of the text). The label is displayed using the font identified by - fontid. You can use the following variables in the text: + fontfile. You can use the following variables in the text: @@ -742,7 +744,8 @@ image file to be used for the font (you do not have to specify the extension). Here X and Y specify the position of the char character in the image (0,0 is the upper left corner). width and height are -the dimensions of the character in pixels. +the dimensions of the character in pixels. The character may be in UTF-8 +encoding. diff --git a/mplayer/DOCS/xml/es/bugreports.xml b/mplayer/DOCS/xml/es/bugreports.xml index 5d190f68..4afa92cf 100644 --- a/mplayer/DOCS/xml/es/bugreports.xml +++ b/mplayer/DOCS/xml/es/bugreports.xml @@ -104,7 +104,7 @@ una respuesta. Necesita incluir un historial, archivos de configuración o muestras en su informe de error. Si alguno de estos es muy grande entonces es mejor subirlos a nuestro -servidor FTP en un +servidor FTP en un formato comprimido (gzip y bzip2 preferentemente) e incluir solo la ruta al nombre del archivo en su informe de error. Nuestras listas de correo tienen un límite en el tamaño del mensaje de 80k, si tiene algo más grande entonces deberá comprimirlo @@ -253,7 +253,7 @@ así: Si su problema es específico con uno o más archivos, suba las víctimas a: - + diff --git a/mplayer/DOCS/xml/es/install.xml b/mplayer/DOCS/xml/es/install.xml index 23bafebb..b17e17a3 100644 --- a/mplayer/DOCS/xml/es/install.xml +++ b/mplayer/DOCS/xml/es/install.xml @@ -648,41 +648,6 @@ tengan el mismo origen. - - - -AAC - -AAC (Codificación Avanzada de Audio) es un codec de audio que algunas veces -se encuentra en archivos MOV y MP4. Un decodificador llamado FAAD de código -abierto está disponible en -. -MPlayer incluye libfaad 2.0RC1, por lo que no -necesita obtenerlo por separado. - - - -Si usa gcc 3.2 y falla al compilar nuestro FAAD interno o desea usar la -biblioteca externa por alguna otra razón, descargue la biblioteca desde la -página de descargas -y pase la opción a configure. -No necesita todo el faad2 para decodificar archivos AAC, libfaad es suficiente. -Constrúyalo como sigue: -cd faad2/ -chmod +x bootstrap -./bootstrap -./configure -cd libfaad -make -make install - -No hay binarios disponibles en audiocoding.com, pero puede apetegetear paquetes Debian -desde la página personal de Christian Marillat, -paquetes RPM para Mandrake desde la P.L.F. y RPMs -para Red Hat en Grey Sector. - - - diff --git a/mplayer/DOCS/xml/es/skin.xml b/mplayer/DOCS/xml/es/skin.xml index bc51205a..2fee4216 100644 --- a/mplayer/DOCS/xml/es/skin.xml +++ b/mplayer/DOCS/xml/es/skin.xml @@ -484,13 +484,13 @@ La etiqueta es mostrada usando la tipografía identificada por fontid - dlabel = X, Y, length, align, fontid, "text" + dlabel = X, Y, width, align, fontid, "text" Coloca una etiqueta dinámica en la posición X,Y. La etiqueta se llama dinámica porque su texto es refrescado periódicamente. La longitud máxima de la -etiqueta viene dada por length (su altura es la altura de un caracter). +etiqueta viene dada por width (su altura es la altura de un caracter). Si el texto que ha de ser mostrado es más ancho que esta, será desplazado, si no será alineado dentro del espacio especificado por el valor del parámetro align: 0 es para derecha, diff --git a/mplayer/DOCS/xml/fr/bugreports.xml b/mplayer/DOCS/xml/fr/bugreports.xml index 6299cb9d..5aa27538 100644 --- a/mplayer/DOCS/xml/fr/bugreports.xml +++ b/mplayer/DOCS/xml/fr/bugreports.xml @@ -248,7 +248,7 @@ et que c'est donc une bonne idée de souscrire pour recevoir votre réponse. Vous pouvez avoir besoin d'inclure des fichiers de log, de configuration ou d'échantillon. Si certains sont très gros alors il vaut mieux les uploader -sur notre serveur FTP +sur notre serveur FTP en format compressé (gzip et bzip2 préférés) et indiquer uniquement leur chemin et nom dans le rapport de bogue. Nos listes de diffusion ont une taille de message limite de 80k, si vous @@ -398,7 +398,7 @@ dans un fichier comme ceci : Si votre problème est spécifique à un ou plusieurs fichiers, alors merci d'uploader le(s) fautif(s) sur : - + diff --git a/mplayer/DOCS/xml/fr/install.xml b/mplayer/DOCS/xml/fr/install.xml index c8ef67b6..0fceba1f 100644 --- a/mplayer/DOCS/xml/fr/install.xml +++ b/mplayer/DOCS/xml/fr/install.xml @@ -422,34 +422,6 @@ Now rerun ./configure for x264 support. - - - -Codec AAC - -Un décodeur open source appelé FAAD est disponible sur -. -MPlayer inclus une copie, vous n'avez donc pas -à l'obtenir séparemment. -Si vous voulez utiliser une librairie externe, passez - à ./configure. -Vous n'avez pas besoin de tout faad2 pour décoder les fichiers AAC, libfaad suffit. -Construisez comme ceci : - -cd faad2/ -sh bootstrap -./configure -cd libfaad -make -make install - -Les binaires ne sont pas disponibles sur audiocoding.com, mais vous pouvez -obtenir les paquets Debian sur la -page web de Christian Marillat, -les RPMs Mandrake/Mandriva sur le P.L.F et les RPMS -Fedora sur Livna. - - diff --git a/mplayer/DOCS/xml/fr/ports.xml b/mplayer/DOCS/xml/fr/ports.xml index 5fa71163..9282fd4d 100644 --- a/mplayer/DOCS/xml/fr/ports.xml +++ b/mplayer/DOCS/xml/fr/ports.xml @@ -433,7 +433,7 @@ Plante à la lecture avec le message d'erreur suivant : Solution : Utiliser l'option extralibdir lors de configure - + diff --git a/mplayer/DOCS/xml/hu/bugreports.xml b/mplayer/DOCS/xml/hu/bugreports.xml index c4952683..31d93d94 100644 --- a/mplayer/DOCS/xml/hu/bugreports.xml +++ b/mplayer/DOCS/xml/hu/bugreports.xml @@ -237,7 +237,7 @@ feliratkozol, hogy megkapd te is a választ. A hibajelentésedhez csatolnod kell a log-ot, konfigurációs vagy minta fájlokat. Ha ezek közül valamelyik nagy, jobb ha feltöltöd az -FTP szerverünkre tömörített +FTP szerverünkre tömörített formátumban (gzip és bzip2 a javasolt) és csak az elérési utat és a fájl nevet írod bele a hiba jelentésedbe. A levelezési listáinkon az üzenet mérete maximum 80k lehet, ha ennél nagyobb fájlod van, tömörítened kell, vagy feltöltened. @@ -390,7 +390,7 @@ mplayer -v options filename Ha a probléma egy vagy több fájl esetén specifikus, kérlek töltsd fel ide: - + diff --git a/mplayer/DOCS/xml/hu/install.xml b/mplayer/DOCS/xml/hu/install.xml index e9fcca02..3499ae39 100644 --- a/mplayer/DOCS/xml/hu/install.xml +++ b/mplayer/DOCS/xml/hu/install.xml @@ -434,39 +434,6 @@ az MPlayerbe belekerüljön az - -AAC - - -Egy FAAD2-nek hívott nyílt forráskódú AAC dekódoló elérhető itt: -. -Az MPlayer tartalmaz egy másolatot a forrásfájában. -Ha inkább a külső függvénykönyvtárat használnád, telepítsd és add meg a - kapcsolót a ./configure-nak. - - - -FAAD2 binárisok nem tölthetőek le az audiocoding.com-ról, de (apt-)get-tel -telepítheted Christian Marillat Debian csomagjait, -vagy Mandrake/Mandriva RPM-et a P.L.F-ről, -Fedora/CentOS/RHEL RPM-et pedig az RPMFusion-ról. - - -Ha úgy döntesz, hogy forrásból fordítasz, nem kell a teljes FAAD2 az AAC fájlok -dekódolásához, elég a libfaad. Így készítsd el: - -cd faad2/ -sh bootstrap -./configure -cd libfaad -make -make install - - - - - - AMR diff --git a/mplayer/DOCS/xml/hu/ports.xml b/mplayer/DOCS/xml/hu/ports.xml index 1f1b5ee2..1cdb937e 100644 --- a/mplayer/DOCS/xml/hu/ports.xml +++ b/mplayer/DOCS/xml/hu/ports.xml @@ -394,7 +394,7 @@ Itt van pár gyakori probléma megoldása: Megoldás: Használd a configure extralibdir opcióját - + diff --git a/mplayer/DOCS/xml/hu/skin.xml b/mplayer/DOCS/xml/hu/skin.xml index 0d6a738a..9fa7f25a 100644 --- a/mplayer/DOCS/xml/hu/skin.xml +++ b/mplayer/DOCS/xml/hu/skin.xml @@ -473,13 +473,13 @@ blokkokban. - dlabel = X, Y, length, align, fontid, "text" + dlabel = X, Y, width, align, fontid, "text" Egy dinamikus címkét tesz ki az X, Y pozícióba. A címke azért dinamikus, mert a szövege periódikusan frissül. A címke - maximum hosszát a length szabályozza (a magassága + maximum hosszát a width szabályozza (a magassága egy karakter magasságával egyezik meg). Ha a megjelenítendő szöveg szélesebb ennél, scrollozva lesz, különben az align paraméter által megadott módon diff --git a/mplayer/DOCS/xml/it/bugreports.xml b/mplayer/DOCS/xml/it/bugreports.xml index 690d09ae..066df02a 100644 --- a/mplayer/DOCS/xml/it/bugreports.xml +++ b/mplayer/DOCS/xml/it/bugreports.xml @@ -242,7 +242,7 @@ una buona idea iscriversi per poter effettivamente ricevere la risposta. Potrebbe servire che tu includa nel tuo rapporto sul bug registrazioni, configurazioni o file di esempio. Se alcune di queste cose sono abbastanza grandi, è meglio caricarle sul nostro -server FTP in +server FTP in un formato compresso (si preferiscono gzip e bzip2) e inserisci nel rapporto solo il nome e il percorso del file. Le nostre mailing list hanno un limite sulla dimensione di 80k, se hai qualcosa di più grande devi comprimerlo o @@ -398,7 +398,7 @@ mplayer -v options filename Se il tuo problema è specifico per uno o più file, allora per favore carica quello/i incriminato/i in: - + diff --git a/mplayer/DOCS/xml/it/install.xml b/mplayer/DOCS/xml/it/install.xml index a237d6da..5dcc1a59 100644 --- a/mplayer/DOCS/xml/it/install.xml +++ b/mplayer/DOCS/xml/it/install.xml @@ -435,40 +435,6 @@ Poi riesegui ./configure affinché - -AAC - - -E' disponibile da un -decodificatore open source che si chiama FAAD2. -MPlayer ne include una copia nei suoi sorgenti. -Se vuoi usare la libreria esterna per qualche altra ragione, installala e passa - a ./configure. - - - -Gli eseguibili di FAAD2 non sono disponibili da audiocoding.com, ma puoi -ottenere con apt(-get) i pacchetti Debian da -Christian Marillat, -gli RPM per Mandrake/Mandriva da P.L.F -e quelli per Fedora da Livna. - - -Se decidi di compilarli dai sorgenti, non ti serve tutto di faad2 per -decodificare i file AAC, ti basta libfaad. Compilala così: - -cd faad2/ -sh bootstrap -./configure -cd libfaad -make -make install - - - - - - AMR diff --git a/mplayer/DOCS/xml/pl/bugreports.xml b/mplayer/DOCS/xml/pl/bugreports.xml index 9ebfc086..f56a484c 100644 --- a/mplayer/DOCS/xml/pl/bugreports.xml +++ b/mplayer/DOCS/xml/pl/bugreports.xml @@ -252,7 +252,7 @@ odpowiedzi. Może zajść potrzeba dołączenia logu, konfiguracji lub przykładowego pliku w Twoim zgłoszeniu błędu. Jeżeli któryś z nich ma duży rozmiar, lepiej załadować go na -nasz serwer FTP +nasz serwer FTP w skompresowanej postaci (gzip i bzip2 są preferowanymi formatami) i załączyć tylko ścieżkę i nazwę pliku do zgłoszenia błędu. Nasza lista ma ustawiony limit rozmiaru każdej wiadomości na 80k. Jeżeli potrzebujesz wysłać coś większego, @@ -411,7 +411,7 @@ do pliku w ten sposób: Jeżeli Twój problem jest specyficzny dla jednego albo wielu plików, załaduj winowajcę(ów) na: - + diff --git a/mplayer/DOCS/xml/pl/install.xml b/mplayer/DOCS/xml/pl/install.xml index 7299f02c..03d62f17 100644 --- a/mplayer/DOCS/xml/pl/install.xml +++ b/mplayer/DOCS/xml/pl/install.xml @@ -462,44 +462,6 @@ Now rerun ./configure for - -Kodek AAC - - -AAC (Advanced Audio Coding) jest kodekiem audio spotykanym czasami w plikach -MOV i MP4. Otwarty dekoder nazywany FAAD dostępny jest na stronie -. -MPlayer zawiera migawkę CVS z -libfaad 2.1beta, więc nie musisz ściągać go oddzielnie. - - - -Jeżeli używasz gcc 3.2, który ma kłopoty z kompilacją wbudowanej wersji -FAAD lub chcesz z jakichś powodów użyć zewnętrznej biblioteki, -ściągnij ją z -tej strony -i dodaj opcję do -./configure. Nie potrzebujesz całego faad2 do dekodowanie -plików AAC. Wystarczy użyć samej biblioteki libfaad. Zbudujesz ją w następujący -sposób - -cd faad2/ -sh bootstrap -./configure -cd libfaad -make -make install - -Wersje binarne nie są dostępne na stronie audiocoding.com, ale możesz -ściągnąć (apt-getem) Debianowe paczki ze -strony domowej Christiana Marillata, -RPM-y dla Mandrake/Mandriva ze strony P.L.F, -a RPM-y dla Fedory z Livna. - - - - - Kodeki AMR diff --git a/mplayer/DOCS/xml/pl/ports.xml b/mplayer/DOCS/xml/pl/ports.xml index 7c9dd7a5..70294916 100644 --- a/mplayer/DOCS/xml/pl/ports.xml +++ b/mplayer/DOCS/xml/pl/ports.xml @@ -393,7 +393,7 @@ Wysypanie się programu przy odtwarzaniu z komunikatem: Rozwiązanie: Skorzystaj z opcji extralibdir skryptu configure - + diff --git a/mplayer/DOCS/xml/ru/bugreports.xml b/mplayer/DOCS/xml/ru/bugreports.xml index 8738ad73..18b99854 100644 --- a/mplayer/DOCS/xml/ru/bugreports.xml +++ b/mplayer/DOCS/xml/ru/bugreports.xml @@ -235,7 +235,7 @@ HTML почта и почему это — зло, прочтите Вам необходимо включить лог, конфигурацию или примеры файлов в сообщение об ошибке. Если что-то из этого большое, то лучше загрузить это на наш -FTP сервер +FTP сервер в сжатом виде (предпочтительно gzip или bzip2) и включить в сообщение об ошибке только путь и имя файла. На наших рассылках стоит ограничение размера сообщения в 80КБ. Если у Вас что-то большее, то сожмите или загрузите это. @@ -384,7 +384,7 @@ mplayer -v опции имя-файла< Если проблема специфична для одного или нескольких файлов, пожалуйста, загрузите проблемные файлы на: - + diff --git a/mplayer/DOCS/xml/ru/install.xml b/mplayer/DOCS/xml/ru/install.xml index baabf02e..ccb7769f 100644 --- a/mplayer/DOCS/xml/ru/install.xml +++ b/mplayer/DOCS/xml/ru/install.xml @@ -436,40 +436,6 @@ Now rerun ./configure for - -AAC кодек - -AAC (Advanced Audio Coding) - это кодек, иногда обнаруживаемый в MOV и MP4 -файлах. Декодер с открытым исходным кодом, называемый FAAD, доступен с -. -MPlayer включает в себя CVS версию libfaad 2.1 beta, поэтому -Вам ничего не нужно дополнительно скачивать. - - - -Если Вы используете gcc 3.2, который не может скомпилировать встроенный FAAD, -или просто хотите использовать внешнюю библиотеку, скачаете её с -страницы загрузок -и укажите ./configure . -Вам не нужен весь faad2, чтобы декодировать AAC файлы, достаточно libfaad. -Вот как Вы можете её собрать: - -cd faad2/ -sh bootstrap -./configure -cd libfaad -make -make install - -Бинарники отсутствуют на audiocoding.com, но вы можете скачать (apt-get) Debian -пакеты с домашней страницы Christian Marillat, -Mandrake RPM'ники с P.L.F и RedHat RPM'ники -с Livna. - - - - - AMR кодеки diff --git a/mplayer/DOCS/xml/ru/ports.xml b/mplayer/DOCS/xml/ru/ports.xml index 4a9830df..210b5e5c 100644 --- a/mplayer/DOCS/xml/ru/ports.xml +++ b/mplayer/DOCS/xml/ru/ports.xml @@ -410,7 +410,7 @@ ln -s /dev/rdsk/c<SCSI bus instance>t Решение: Используйте опцию extralibdir программы configure - + diff --git a/mplayer/DOCS/xml/ru/skin.xml b/mplayer/DOCS/xml/ru/skin.xml index 402ec3be..ce479951 100644 --- a/mplayer/DOCS/xml/ru/skin.xml +++ b/mplayer/DOCS/xml/ru/skin.xml @@ -505,13 +505,13 @@ end - dlabel = X, Y, length, align, fontid, "text" + dlabel = X, Y, width, align, fontid, "text" Размещает динамическую метку на позиции X,Y. Метка зовется динамической, потому что ее текст периодически обновляется. Максимальная длина - метки задается параметром length (ее высота равна высоте символа). + метки задается параметром width (ее высота равна высоте символа). Если отображаемый текст шире этого значения, он будет скроллироваться, иначе он выравнивается в пределах указанного пространства в соответствии со значением параметра diff --git a/mplayer/DOCS/xml/zh_CN/bugreports.xml b/mplayer/DOCS/xml/zh_CN/bugreports.xml index 01100d20..f4faf2e4 100644 --- a/mplayer/DOCS/xml/zh_CN/bugreports.xml +++ b/mplayer/DOCS/xml/zh_CN/bugreports.xml @@ -210,7 +210,7 @@ README文件中。如果这未能提供帮助,请查询 已知错误 你可能要在你的错误报告中包含日志,配置或例子文件。如果他们中一些非常大, 最好把它压缩(请尽量使用gzip或bzip2)并提交到我们的 -FTP服务器 +FTP服务器 上并且在你的错误报告中只包含路径及文件名称。我们的邮件列表有80k的信息限制, 如果你有更大的附件,你不得不压缩后提交。 @@ -359,7 +359,7 @@ mplayer -v options filename 如果你的问题只针对一个或更多文件,请把他们上传到: - + diff --git a/mplayer/Makefile b/mplayer/Makefile index 2a77c0f1..bc311268 100644 --- a/mplayer/Makefile +++ b/mplayer/Makefile @@ -58,45 +58,6 @@ SRCS_COMMON-$(DVDREAD_INTERNAL) += libdvdread4/bitreader.c \ libdvdread4/nav_read.c \ SRCS_COMMON-$(FAAD) += libmpcodecs/ad_faad.c -SRCS_COMMON-$(FAAD_INTERNAL) += libfaad2/bits.c \ - libfaad2/cfft.c \ - libfaad2/common.c \ - libfaad2/decoder.c \ - libfaad2/drc.c \ - libfaad2/drm_dec.c \ - libfaad2/error.c \ - libfaad2/filtbank.c \ - libfaad2/hcr.c \ - libfaad2/huffman.c \ - libfaad2/ic_predict.c \ - libfaad2/is.c \ - libfaad2/lt_predict.c \ - libfaad2/mdct.c \ - libfaad2/mp4.c \ - libfaad2/ms.c \ - libfaad2/output.c \ - libfaad2/pns.c \ - libfaad2/ps_dec.c \ - libfaad2/ps_syntax.c \ - libfaad2/pulse.c \ - libfaad2/rvlc.c \ - libfaad2/sbr_dct.c \ - libfaad2/sbr_dec.c \ - libfaad2/sbr_e_nf.c \ - libfaad2/sbr_fbt.c \ - libfaad2/sbr_hfadj.c \ - libfaad2/sbr_hfgen.c \ - libfaad2/sbr_huff.c \ - libfaad2/sbr_qmf.c \ - libfaad2/sbr_syntax.c \ - libfaad2/sbr_tf_grid.c \ - libfaad2/specrec.c \ - libfaad2/ssr.c \ - libfaad2/ssr_fb.c \ - libfaad2/ssr_ipqf.c \ - libfaad2/syntax.c \ - libfaad2/tns.c \ - SRCS_COMMON-$(FASTMEMCPY) += libvo/aclib.c SRCS_COMMON-$(FFMPEG) += av_opts.c \ libaf/af_lavcresample.c \ @@ -340,6 +301,7 @@ SRCS_COMMON = asxparser.c \ m_option.c \ m_struct.c \ mp_msg.c \ + mp_strings.c \ mpcommon.c \ parser-cfg.c \ path.c \ @@ -741,7 +703,6 @@ SRCS_MENCODER = mencoder.c \ COMMON_LIBS-$(FFMPEG_A) += ffmpeg/libavformat/libavformat.a \ ffmpeg/libavcodec/libavcodec.a \ - ffmpeg/libavcore/libavcore.a \ ffmpeg/libavutil/libavutil.a \ ffmpeg/libpostproc/libpostproc.a \ ffmpeg/libswscale/libswscale.a @@ -777,7 +738,6 @@ DIRS = . \ ffmpeg/libavcodec/sh4 \ ffmpeg/libavcodec/sparc \ ffmpeg/libavcodec/x86 \ - ffmpeg/libavcore \ ffmpeg/libavformat \ ffmpeg/libavutil \ ffmpeg/libavutil/arm \ @@ -807,7 +767,6 @@ DIRS = . \ libdvdnav \ libdvdnav/vm \ libdvdread4 \ - libfaad2 \ libmenu \ libmpcodecs \ libmpcodecs/native \ @@ -836,7 +795,6 @@ ADD_ALL_DIRS = $(call ADDSUFFIXES,$(1),$(DIRS)) ADD_ALL_EXESUFS = $(1) $(call ADDSUFFIXES,$(EXESUFS_ALL),$(1)) FFMPEGPARTS = libavcodec \ - libavcore \ libavformat \ libavutil \ libpostproc \ @@ -883,13 +841,6 @@ mencoder$(EXESUF) mplayer$(EXESUF): codec-cfg$(EXESUF): codec-cfg.c codec-cfg.h help_mp.h $(HOST_CC) -O -DCODECS2HTML -I. -Iffmpeg -o $@ $< -#TOOLS/netstream$(EXESUF) TOOLS/vivodump$(EXESUF): $(subst mplayer.o,mplayer-nomain.o,$(OBJS_MPLAYER)) $(filter-out %mencoder.o,$(OBJS_MENCODER)) $(OBJS_COMMON) $(COMMON_LIBS) -# $(CC) $(CFLAGS) -o $@ $^ $(EXTRALIBS_MPLAYER) $(EXTRALIBS_MENCODER) $(COMMON_LDFLAGS) - - -#codec-cfg$(EXESUF): codec-cfg.c help_mp.h -# $(HOST_CC) -O -DCODECS2HTML -I. -o $@ $< - #codecs.conf.h: codec-cfg$(EXESUF) etc/codecs.conf # ./$^ > $@ @@ -933,7 +884,6 @@ gui/%: CFLAGS += -Wno-strict-prototypes libdvdcss/%: CFLAGS := -Ilibdvdcss -D_GNU_SOURCE -DVERSION=\"1.2.10\" $(CFLAGS_LIBDVDCSS) $(CFLAGS) libdvdnav/%: CFLAGS := -Ilibdvdnav -D_GNU_SOURCE -DHAVE_CONFIG_H -DVERSION=\"MPlayer-custom\" $(CFLAGS) libdvdread4/%: CFLAGS := -Ilibdvdread4 -D_GNU_SOURCE $(CFLAGS_LIBDVDCSS_DVDREAD) $(CFLAGS) -libfaad2/%: CFLAGS := -Ilibfaad2 -DHAVE_CONFIG_H $(CFLAGS_FAAD_FIXED) $(CFLAGS) loader/%: CFLAGS += -fno-omit-frame-pointer $(CFLAGS_NO_OMIT_LEAF_FRAME_POINTER) #loader/%: CFLAGS += -Ddbg_printf=__vprintf -DTRACE=__vprintf -DDETAILED_OUT diff --git a/mplayer/TOOLS/asfinfo.c b/mplayer/TOOLS/asfinfo.c index 33cdab76..70dde28e 100644 --- a/mplayer/TOOLS/asfinfo.c +++ b/mplayer/TOOLS/asfinfo.c @@ -155,7 +155,7 @@ static void print_video_header(BITMAPINFOHEADER *h){ printf(" biHeight %ld\n", h->biHeight); printf(" biPlanes %d\n", h->biPlanes); printf(" biBitCount %d\n", h->biBitCount); - printf(" biCompression %ld='%.4s'\n", h->biCompression, &h->biCompression); + printf(" biCompression %ld='%.4s'\n", h->biCompression, (const char*)&h->biCompression); printf(" biSizeImage %ld\n", h->biSizeImage); printf("===========================\n"); } @@ -284,5 +284,6 @@ int main(int argc, char* argv[]){ fseek(f, pos + objh.size - sizeof(objh), SEEK_SET); } + fclose(f); return 0; } diff --git a/mplayer/TOOLS/avisubdump.c b/mplayer/TOOLS/avisubdump.c index e2d1f195..b2d02b75 100644 --- a/mplayer/TOOLS/avisubdump.c +++ b/mplayer/TOOLS/avisubdump.c @@ -180,8 +180,12 @@ int main(int argc,char* argv[]) exit(1); } - if (strcmp(argv[argc-1], "-") == 0) f=stdin; - else f=fopen(argv[argc-1],"rb"); + if (strcmp(argv[argc-1], "-") == 0) { + dump(stdin); + return 0; + } + + f=fopen(argv[argc-1],"rb"); if (!f) { fprintf(stderr, "Could not open '%s': %s\n", @@ -190,6 +194,7 @@ int main(int argc,char* argv[]) } dump(f); + fclose(f); return 0; } diff --git a/mplayer/TOOLS/mp-uncrustify-style.cfg b/mplayer/TOOLS/mp-uncrustify-style.cfg new file mode 100644 index 00000000..e68e6f6b --- /dev/null +++ b/mplayer/TOOLS/mp-uncrustify-style.cfg @@ -0,0 +1,1397 @@ +# Uncrustify 0.57 + +### +###### TODO/FIXME ### +### +### - Align comments? +### +### - New line after function +### +### nl_after_func_body force one blank line after each function, but it should +### not when surrounded with #ifdef: +### +### #ifdef CONFIG_DVDNAV +### static void mp_dvdnav_context_free(MPContext *ctx) +### { +### // [...] +### } +### +### #endif +### +### void uninit_player(unsigned int mask) +### + +# +# General options +# + +# The type of line endings +newlines = lf # auto/lf/crlf/cr + +# The original size of tabs in the input +input_tab_size = 8 # number + +# The size of tabs in the output (only used if align_with_tabs=true) +output_tab_size = 8 # number + +# The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) +string_escape_char = 92 # number + +# Alternate string escape char for Pawn. Only works right before the quote char. +string_escape_char2 = 0 # number + +# +# Indenting +# + +# The number of columns to indent per level. +# Usually 2, 3, 4, or 8. +indent_columns = 4 # number + +# The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. +# For FreeBSD, this is set to 4. +indent_continue = 0 # number + +# How to use tabs when indenting code +# 0=spaces only +# 1=indent with tabs to brace level, align with spaces +# 2=indent and align with tabs, using spaces when not on a tabstop +indent_with_tabs = 0 # number + +# Comments that are not a brace level are indented with tabs on a tabstop. +# Requires indent_with_tabs=2. If false, will use spaces. +indent_cmt_with_tabs = false # false/true + +# Whether to indent strings broken by '\' so that they line up +indent_align_string = true # false/true + +# The number of spaces to indent multi-line XML strings. +# Requires indent_align_string=True +indent_xml_string = 0 # number + +# Spaces to indent '{' from level +indent_brace = 0 # number + +# Whether braces are indented to the body level +indent_braces = false # false/true + +# Disabled indenting function braces if indent_braces is true +indent_braces_no_func = false # false/true + +# Disabled indenting class braces if indent_braces is true +indent_braces_no_class = false # false/true + +# Disabled indenting struct braces if indent_braces is true +indent_braces_no_struct = false # false/true + +# Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. +indent_brace_parent = false # false/true + +# Whether the 'namespace' body is indented +indent_namespace = false # false/true + +# The number of spaces to indent a namespace block +indent_namespace_level = 0 # number + +# If the body of the namespace is longer than this number, it won't be indented. +# Requires indent_namespace=true. Default=0 (no limit) +indent_namespace_limit = 0 # number + +# Whether the 'extern "C"' body is indented +indent_extern = false # false/true + +# Whether the 'class' body is indented +indent_class = false # false/true + +# Whether to indent the stuff after a leading class colon +indent_class_colon = false # false/true + +# False=treat 'else\nif' as 'else if' for indenting purposes +# True=indent the 'if' one level +indent_else_if = false # false/true + +# Amount to indent variable declarations after a open brace. neg=relative, pos=absolute +indent_var_def_blk = 0 # number + +# Indent continued variable declarations instead of aligning. +indent_var_def_cont = false # false/true + +# True: indent continued function call parameters one indent level +# False: align parameters under the open paren +indent_func_call_param = false # false/true + +# Same as indent_func_call_param, but for function defs +indent_func_def_param = false # false/true + +# Same as indent_func_call_param, but for function protos +indent_func_proto_param = false # false/true + +# Same as indent_func_call_param, but for class declarations +indent_func_class_param = false # false/true + +# Same as indent_func_call_param, but for class variable constructors +indent_func_ctor_var_param = false # false/true + +# Same as indent_func_call_param, but for templates +indent_template_param = false # false/true + +# Double the indent for indent_func_xxx_param options +indent_func_param_double = false # false/true + +# Indentation column for standalone 'const' function decl/proto qualifier +indent_func_const = 0 # number + +# Indentation column for standalone 'throw' function decl/proto qualifier +indent_func_throw = 0 # number + +# The number of spaces to indent a continued '->' or '.' +# Usually set to 0, 1, or indent_columns. +indent_member = 0 # number + +# Spaces to indent single line ('//') comments on lines before code +indent_sing_line_comments = 0 # number + +# If set, will indent trailing single line ('//') comments relative +# to the code instead of trying to keep the same absolute column +indent_relative_single_line_comments = false # false/true + +# Spaces to indent 'case' from 'switch' +# Usually 0 or indent_columns. +indent_switch_case = 0 # number + +# Spaces to shift the 'case' line, without affecting any other lines +# Usually 0. +indent_case_shift = 0 # number + +# Spaces to indent '{' from 'case'. +# By default, the brace will appear under the 'c' in case. +# Usually set to 0 or indent_columns. +indent_case_brace = 0 # number + +# Whether to indent comments found in first column +indent_col1_comment = false # false/true + +# How to indent goto labels +# >0 : absolute column where 1 is the leftmost column +# <=0 : subtract from brace indent +indent_label = 1 # number + +# Same as indent_label, but for access specifiers that are followed by a colon +indent_access_spec = 1 # number + +# Indent the code after an access specifier by one level. +# If set, this option forces 'indent_access_spec=0' +indent_access_spec_body = false # false/true + +# If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) +indent_paren_nl = false # false/true + +# Controls the indent of a close paren after a newline. +# 0: Indent to body level +# 1: Align under the open paren +# 2: Indent to the brace level +indent_paren_close = 0 # number + +# Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren +indent_comma_paren = false # false/true + +# Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren +indent_bool_paren = false # false/true + +# If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones +indent_first_bool_expr = false # false/true + +# If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) +indent_square_nl = false # false/true + +# Don't change the relative indent of ESQL/C 'EXEC SQL' bodies +indent_preserve_sql = false # false/true + +# Align continued statements at the '='. Default=True +# If FALSE or the '=' is followed by a newline, the next line is indent one tab. +indent_align_assign = true # false/true + +# +# Spacing options +# + +# Add or remove space around arithmetic operator '+', '-', '/', '*', etc +sp_arith = force # ignore/add/remove/force + +# Add or remove space around assignment operator '=', '+=', etc +sp_assign = force # ignore/add/remove/force + +# Add or remove space around assignment operator '=' in a prototype +sp_assign_default = ignore # ignore/add/remove/force + +# Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. +sp_before_assign = ignore # ignore/add/remove/force + +# Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. +sp_after_assign = ignore # ignore/add/remove/force + +# Add or remove space around assignment '=' in enum +sp_enum_assign = force # ignore/add/remove/force + +# Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. +sp_enum_before_assign = ignore # ignore/add/remove/force + +# Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. +sp_enum_after_assign = ignore # ignore/add/remove/force + +# Add or remove space around preprocessor '##' concatenation operator. Default=Add +sp_pp_concat = add # ignore/add/remove/force + +# Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. Default=Add +sp_pp_stringify = add # ignore/add/remove/force + +# Add or remove space around boolean operators '&&' and '||' +sp_bool = force # ignore/add/remove/force + +# Add or remove space around compare operator '<', '>', '==', etc +sp_compare = force # ignore/add/remove/force + +# Add or remove space inside '(' and ')' +sp_inside_paren = remove # ignore/add/remove/force + +# Add or remove space between nested parens +sp_paren_paren = remove # ignore/add/remove/force + +# Whether to balance spaces inside nested parens +sp_balance_nested_parens = false # false/true + +# Add or remove space between ')' and '{' +sp_paren_brace = force # ignore/add/remove/force + +# Add or remove space before pointer star '*' +sp_before_ptr_star = force # ignore/add/remove/force + +# Add or remove space before pointer star '*' that isn't followed by a variable name +# If set to 'ignore', sp_before_ptr_star is used instead. +sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force + +# Add or remove space between pointer stars '*' +sp_between_ptr_star = remove # ignore/add/remove/force + +# Add or remove space after pointer star '*', if followed by a word. +sp_after_ptr_star = remove # ignore/add/remove/force + +# Add or remove space after a pointer star '*', if followed by a func proto/def. +sp_after_ptr_star_func = remove # ignore/add/remove/force + +# Add or remove space before a pointer star '*', if followed by a func proto/def. +sp_before_ptr_star_func = ignore # ignore/add/remove/force + +# Add or remove space before a reference sign '&' +sp_before_byref = force # ignore/add/remove/force + +# Add or remove space before a reference sign '&' that isn't followed by a variable name +# If set to 'ignore', sp_before_byref is used instead. +sp_before_unnamed_byref = force # ignore/add/remove/force + +# Add or remove space after reference sign '&', if followed by a word. +sp_after_byref = ignore # ignore/add/remove/force + +# Add or remove space after a reference sign '&', if followed by a func proto/def. +sp_after_byref_func = ignore # ignore/add/remove/force + +# Add or remove space before a reference sign '&', if followed by a func proto/def. +sp_before_byref_func = ignore # ignore/add/remove/force + +# Add or remove space between type and word. Default=Force +sp_after_type = force # ignore/add/remove/force + +# Add or remove space in 'template <' vs 'template<'. +# If set to ignore, sp_before_angle is used. +sp_template_angle = ignore # ignore/add/remove/force + +# Add or remove space before '<>' +sp_before_angle = ignore # ignore/add/remove/force + +# Add or remove space inside '<' and '>' +sp_inside_angle = ignore # ignore/add/remove/force + +# Add or remove space after '<>' +sp_after_angle = ignore # ignore/add/remove/force + +# Add or remove space between '<>' and '(' as found in 'new List();' +sp_angle_paren = ignore # ignore/add/remove/force + +# Add or remove space between '<>' and a word as in 'List m;' +sp_angle_word = ignore # ignore/add/remove/force + +# Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add +sp_angle_shift = add # ignore/add/remove/force + +# Add or remove space before '(' of 'if', 'for', 'switch', and 'while' +sp_before_sparen = force # ignore/add/remove/force + +# Add or remove space inside if-condition '(' and ')' +sp_inside_sparen = remove # ignore/add/remove/force + +# Add or remove space before if-condition ')'. Overrides sp_inside_sparen. +sp_inside_sparen_close = ignore # ignore/add/remove/force + +# Add or remove space after ')' of 'if', 'for', 'switch', and 'while' +sp_after_sparen = ignore # ignore/add/remove/force + +# Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' +sp_sparen_brace = force # ignore/add/remove/force + +# Add or remove space between 'invariant' and '(' in the D language. +sp_invariant_paren = ignore # ignore/add/remove/force + +# Add or remove space after the ')' in 'invariant (C) c' in the D language. +sp_after_invariant_paren = ignore # ignore/add/remove/force + +# Add or remove space before empty statement ';' on 'if', 'for' and 'while' +sp_special_semi = ignore # ignore/add/remove/force + +# Add or remove space before ';'. Default=Remove +sp_before_semi = remove # ignore/add/remove/force + +# Add or remove space before ';' in non-empty 'for' statements +sp_before_semi_for = ignore # ignore/add/remove/force + +# Add or remove space before a semicolon of an empty part of a for statement. +sp_before_semi_for_empty = ignore # ignore/add/remove/force + +# Add or remove space after ';', except when followed by a comment. Default=Add +sp_after_semi = force # ignore/add/remove/force + +# Add or remove space after ';' in non-empty 'for' statements. Default=Force +sp_after_semi_for = force # ignore/add/remove/force + +# Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). +sp_after_semi_for_empty = ignore # ignore/add/remove/force + +# Add or remove space before '[' (except '[]') +sp_before_square = remove # ignore/add/remove/force + +# Add or remove space before '[]' +sp_before_squares = ignore # ignore/add/remove/force + +# Add or remove space inside '[' and ']' +sp_inside_square = ignore # ignore/add/remove/force + +# Add or remove space after ',' +sp_after_comma = force # ignore/add/remove/force + +# Add or remove space before ',' +sp_before_comma = remove # ignore/add/remove/force + +# Add or remove space between an open paren and comma: '(,' vs '( ,' +sp_paren_comma = force # ignore/add/remove/force + +# Add or remove space before the variadic '...' when preceded by a non-punctuator +sp_before_ellipsis = ignore # ignore/add/remove/force + +# Add or remove space after class ':' +sp_after_class_colon = ignore # ignore/add/remove/force + +# Add or remove space before class ':' +sp_before_class_colon = ignore # ignore/add/remove/force + +# Add or remove space before case ':'. Default=Remove +sp_before_case_colon = remove # ignore/add/remove/force + +# Add or remove space between 'operator' and operator sign +sp_after_operator = ignore # ignore/add/remove/force + +# Add or remove space between the operator symbol and the open paren, as in 'operator ++(' +sp_after_operator_sym = ignore # ignore/add/remove/force + +# Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' +sp_after_cast = remove # ignore/add/remove/force + +# Add or remove spaces inside cast parens +sp_inside_paren_cast = ignore # ignore/add/remove/force + +# Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' +sp_cpp_cast_paren = ignore # ignore/add/remove/force + +# Add or remove space between 'sizeof' and '(' +sp_sizeof_paren = remove # ignore/add/remove/force + +# Add or remove space after the tag keyword (Pawn) +sp_after_tag = ignore # ignore/add/remove/force + +# Add or remove space inside enum '{' and '}' +sp_inside_braces_enum = remove # ignore/add/remove/force + +# Add or remove space inside struct/union '{' and '}' +sp_inside_braces_struct = force # ignore/add/remove/force + +# Add or remove space inside '{' and '}' +sp_inside_braces = force # ignore/add/remove/force + +# Add or remove space inside '{}' +sp_inside_braces_empty = remove # ignore/add/remove/force + +# Add or remove space between return type and function name +# A minimum of 1 is forced except for pointer return types. +sp_type_func = remove # ignore/add/remove/force + +# Add or remove space between function name and '(' on function declaration +sp_func_proto_paren = remove # ignore/add/remove/force + +# Add or remove space between function name and '(' on function definition +sp_func_def_paren = remove # ignore/add/remove/force + +# Add or remove space inside empty function '()' +sp_inside_fparens = remove # ignore/add/remove/force + +# Add or remove space inside function '(' and ')' +sp_inside_fparen = remove # ignore/add/remove/force + +# Add or remove space between ']' and '(' when part of a function call. +sp_square_fparen = ignore # ignore/add/remove/force + +# Add or remove space between ')' and '{' of function +sp_fparen_brace = ignore # ignore/add/remove/force + +# Add or remove space between function name and '(' on function calls +sp_func_call_paren = remove # ignore/add/remove/force + +# Add or remove space between function name and '()' on function calls without parameters. +# If set to 'ignore' (the default), sp_func_call_paren is used. +sp_func_call_paren_empty = ignore # ignore/add/remove/force + +# Add or remove space between the user function name and '(' on function calls +# You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. +sp_func_call_user_paren = ignore # ignore/add/remove/force + +# Add or remove space between a constructor/destructor and the open paren +sp_func_class_paren = ignore # ignore/add/remove/force + +# Add or remove space between 'return' and '(' +sp_return_paren = ignore # ignore/add/remove/force + +# Add or remove space between '__attribute__' and '(' +sp_attribute_paren = remove # ignore/add/remove/force + +# Add or remove space between 'defined' and '(' in '#if defined (FOO)' +sp_defined_paren = ignore # ignore/add/remove/force + +# Add or remove space between 'throw' and '(' in 'throw (something)' +sp_throw_paren = ignore # ignore/add/remove/force + +# Add or remove space between macro and value +sp_macro = ignore # ignore/add/remove/force + +# Add or remove space between macro function ')' and value +sp_macro_func = ignore # ignore/add/remove/force + +# Add or remove space between 'else' and '{' if on the same line +sp_else_brace = force # ignore/add/remove/force + +# Add or remove space between '}' and 'else' if on the same line +sp_brace_else = force # ignore/add/remove/force + +# Add or remove space between '}' and the name of a typedef on the same line +sp_brace_typedef = force # ignore/add/remove/force + +# Add or remove space between 'catch' and '{' if on the same line +sp_catch_brace = ignore # ignore/add/remove/force + +# Add or remove space between '}' and 'catch' if on the same line +sp_brace_catch = ignore # ignore/add/remove/force + +# Add or remove space between 'finally' and '{' if on the same line +sp_finally_brace = ignore # ignore/add/remove/force + +# Add or remove space between '}' and 'finally' if on the same line +sp_brace_finally = ignore # ignore/add/remove/force + +# Add or remove space between 'try' and '{' if on the same line +sp_try_brace = ignore # ignore/add/remove/force + +# Add or remove space between get/set and '{' if on the same line +sp_getset_brace = ignore # ignore/add/remove/force + +# Add or remove space before the '::' operator +sp_before_dc = ignore # ignore/add/remove/force + +# Add or remove space after the '::' operator +sp_after_dc = ignore # ignore/add/remove/force + +# Add or remove around the D named array initializer ':' operator +sp_d_array_colon = ignore # ignore/add/remove/force + +# Add or remove space after the '!' (not) operator. Default=Remove +sp_not = remove # ignore/add/remove/force + +# Add or remove space after the '~' (invert) operator. Default=Remove +sp_inv = remove # ignore/add/remove/force + +# Add or remove space after the '&' (address-of) operator. Default=Remove +# This does not affect the spacing after a '&' that is part of a type. +sp_addr = remove # ignore/add/remove/force + +# Add or remove space around the '.' or '->' operators. Default=Remove +sp_member = remove # ignore/add/remove/force + +# Add or remove space after the '*' (dereference) operator. Default=Remove +# This does not affect the spacing after a '*' that is part of a type. +sp_deref = remove # ignore/add/remove/force + +# Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove +sp_sign = remove # ignore/add/remove/force + +# Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove +sp_incdec = remove # ignore/add/remove/force + +# Add or remove space before a backslash-newline at the end of a line. Default=Add +sp_before_nl_cont = add # ignore/add/remove/force + +# Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' +sp_after_oc_scope = ignore # ignore/add/remove/force + +# Add or remove space after the colon in message specs +# '-(int) f:(int) x;' vs '-(int) f: (int) x;' +sp_after_oc_colon = ignore # ignore/add/remove/force + +# Add or remove space before the colon in message specs +# '-(int) f: (int) x;' vs '-(int) f : (int) x;' +sp_before_oc_colon = ignore # ignore/add/remove/force + +# Add or remove space after the colon in message specs +# '[object setValue:1];' vs '[object setValue: 1];' +sp_after_send_oc_colon = ignore # ignore/add/remove/force + +# Add or remove space before the colon in message specs +# '[object setValue:1];' vs '[object setValue :1];' +sp_before_send_oc_colon = ignore # ignore/add/remove/force + +# Add or remove space after the (type) in message specs +# '-(int)f: (int) x;' vs '-(int)f: (int)x;' +sp_after_oc_type = ignore # ignore/add/remove/force + +# Add or remove space after the first (type) in message specs +# '-(int) f:(int)x;' vs '-(int)f:(int)x;' +sp_after_oc_return_type = ignore # ignore/add/remove/force + +# Add or remove space between '@selector' and '(' +# '@selector(msgName)' vs '@selector (msgName)' +# Also applies to @protocol() constructs +sp_after_oc_at_sel = ignore # ignore/add/remove/force + +# Add or remove space between '@selector(x)' and the following word +# '@selector(foo) a:' vs '@selector(foo)a:' +sp_after_oc_at_sel_parens = ignore # ignore/add/remove/force + +# Add or remove space inside '@selector' parens +# '@selector(foo)' vs '@selector( foo )' +# Also applies to @protocol() constructs +sp_inside_oc_at_sel_parens = ignore # ignore/add/remove/force + +# Add or remove space before a block pointer caret +# '^int (int arg){...}' vs. ' ^int (int arg){...}' +sp_before_oc_block_caret = ignore # ignore/add/remove/force + +# Add or remove space after a block pointer caret +# '^int (int arg){...}' vs. '^ int (int arg){...}' +sp_after_oc_block_caret = ignore # ignore/add/remove/force + +# Add or remove space around the ':' in 'b ? t : f' +sp_cond_colon = force # ignore/add/remove/force + +# Add or remove space around the '?' in 'b ? t : f' +sp_cond_question = force # ignore/add/remove/force + +# Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. +sp_case_label = ignore # ignore/add/remove/force + +# Control the space around the D '..' operator. +sp_range = ignore # ignore/add/remove/force + +# Control the space after the opening of a C++ comment '// A' vs '//A' +sp_cmt_cpp_start = force # ignore/add/remove/force + +# Controls the spaces between #else or #endif and a trailing comment +sp_endif_cmt = ignore # ignore/add/remove/force + +# +# Code alignment (not left column spaces/tabs) +# + +# Whether to keep non-indenting tabs +align_keep_tabs = false # false/true + +# Whether to use tabs for aligning +align_with_tabs = false # false/true + +# Whether to bump out to the next tab when aligning +align_on_tabstop = false # false/true + +# Whether to left-align numbers +align_number_left = false # false/true + +# Align variable definitions in prototypes and functions +align_func_params = false # false/true + +# Align parameters in single-line functions that have the same name. +# The function names must already be aligned with each other. +align_same_func_call_params = false # false/true + +# The span for aligning variable definitions (0=don't align) +align_var_def_span = 0 # number + +# How to align the star in variable definitions. +# 0=Part of the type 'void * foo;' +# 1=Part of the variable 'void *foo;' +# 2=Dangling 'void *foo;' +align_var_def_star_style = 2 # number + +# How to align the '&' in variable definitions. +# 0=Part of the type +# 1=Part of the variable +# 2=Dangling +align_var_def_amp_style = 0 # number + +# The threshold for aligning variable definitions (0=no limit) +align_var_def_thresh = 0 # number + +# The gap for aligning variable definitions +align_var_def_gap = 0 # number + +# Whether to align the colon in struct bit fields +align_var_def_colon = false # false/true + +# Whether to align any attribute after the variable name +align_var_def_attribute = false # false/true + +# Whether to align inline struct/enum/union variable definitions +align_var_def_inline = false # false/true + +# The span for aligning on '=' in assignments (0=don't align) +align_assign_span = 1 # number + +# The threshold for aligning on '=' in assignments (0=no limit) +align_assign_thresh = 6 # number + +# The span for aligning on '=' in enums (0=don't align) +align_enum_equ_span = 1 # number + +# The threshold for aligning on '=' in enums (0=no limit) +align_enum_equ_thresh = 0 # number + +# The span for aligning struct/union (0=don't align) +align_var_struct_span = 0 # number + +# The threshold for aligning struct/union member definitions (0=no limit) +align_var_struct_thresh = 0 # number + +# The gap for aligning struct/union member definitions +align_var_struct_gap = 0 # number + +# The span for aligning struct initializer values (0=don't align) +align_struct_init_span = 1 # number + +# The minimum space between the type and the synonym of a typedef +align_typedef_gap = 0 # number + +# The span for aligning single-line typedefs (0=don't align) +align_typedef_span = 0 # number + +# How to align typedef'd functions with other typedefs +# 0: Don't mix them at all +# 1: align the open paren with the types +# 2: align the function type name with the other type names +align_typedef_func = 0 # number + +# Controls the positioning of the '*' in typedefs. Just try it. +# 0: Align on typedef type, ignore '*' +# 1: The '*' is part of type name: typedef int *pint; +# 2: The '*' is part of the type, but dangling: typedef int *pint; +align_typedef_star_style = 0 # number + +# Controls the positioning of the '&' in typedefs. Just try it. +# 0: Align on typedef type, ignore '&' +# 1: The '&' is part of type name: typedef int &pint; +# 2: The '&' is part of the type, but dangling: typedef int &pint; +align_typedef_amp_style = 0 # number + +# The span for aligning comments that end lines (0=don't align) +align_right_cmt_span = 0 # number + +# If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment +align_right_cmt_mix = false # false/true + +# If a trailing comment is more than this number of columns away from the text it follows, +# it will qualify for being aligned. This has to be > 0 to do anything. +align_right_cmt_gap = 0 # number + +# Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) +align_right_cmt_at_col = 0 # number + +# The span for aligning function prototypes (0=don't align) +align_func_proto_span = 0 # number + +# Minimum gap between the return type and the function name. +align_func_proto_gap = 0 # number + +# Align function protos on the 'operator' keyword instead of what follows +align_on_operator = false # false/true + +# Whether to mix aligning prototype and variable declarations. +# If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. +align_mix_var_proto = false # false/true + +# Align single-line functions with function prototypes, uses align_func_proto_span +align_single_line_func = false # false/true + +# Aligning the open brace of single-line functions. +# Requires align_single_line_func=true, uses align_func_proto_span +align_single_line_brace = false # false/true + +# Gap for align_single_line_brace. +align_single_line_brace_gap = 0 # number + +# The span for aligning ObjC msg spec (0=don't align) +align_oc_msg_spec_span = 0 # number + +# Whether to align macros wrapped with a backslash and a newline. +# This will not work right if the macro contains a multi-line comment. +align_nl_cont = false # false/true + +# The minimum space between label and value of a preprocessor define +align_pp_define_gap = 0 # number + +# The span for aligning on '#define' bodies (0=don't align) +align_pp_define_span = 0 # number + +# Align lines that start with '<<' with previous '<<'. Default=true +align_left_shift = true # false/true + +# Span for aligning parameters in an Obj-C message call on the ':' (0=don't align) +align_oc_msg_colon_span = 0 # number + +# Aligning parameters in an Obj-C '+' or '-' declaration on the ':' +align_oc_decl_colon = false # false/true + +# +# Newline adding and removing options +# + +# Whether to collapse empty blocks between '{' and '}' +nl_collapse_empty_body = false # false/true + +# Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' +nl_assign_leave_one_liners = false # false/true + +# Don't split one-line braced statements inside a class xx { } body +nl_class_leave_one_liners = false # false/true + +# Don't split one-line enums: 'enum foo { BAR = 15 };' +nl_enum_leave_one_liners = false # false/true + +# Don't split one-line get or set functions +nl_getset_leave_one_liners = false # false/true + +# Don't split one-line function definitions - 'int foo() { return 0; }' +nl_func_leave_one_liners = false # false/true + +# Don't split one-line if/else statements - 'if(a) b++;' +nl_if_leave_one_liners = false # false/true + +# Add or remove newlines at the start of the file +nl_start_of_file = remove # ignore/add/remove/force + +# The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' +nl_start_of_file_min = 0 # number + +# Add or remove newline at the end of the file +nl_end_of_file = force # ignore/add/remove/force + +# The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') +nl_end_of_file_min = 1 # number + +# Add or remove newline between '=' and '{' +nl_assign_brace = remove # ignore/add/remove/force + +# Add or remove newline between '=' and '[' (D only) +nl_assign_square = ignore # ignore/add/remove/force + +# Add or remove newline after '= [' (D only). Will also affect the newline before the ']' +nl_after_square_assign = ignore # ignore/add/remove/force + +# The number of blank lines after a block of variable definitions +nl_func_var_def_blk = 0 # number + +# Add or remove newline between a function call's ')' and '{', as in: +# list_for_each(item, &list) { } +nl_fcall_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'enum' and '{' +nl_enum_brace = remove # ignore/add/remove/force + +# Add or remove newline between 'struct and '{' +nl_struct_brace = remove # ignore/add/remove/force + +# Add or remove newline between 'union' and '{' +nl_union_brace = remove # ignore/add/remove/force + +# Add or remove newline between 'if' and '{' +nl_if_brace = remove # ignore/add/remove/force + +# Add or remove newline between '}' and 'else' +nl_brace_else = remove # ignore/add/remove/force + +# Add or remove newline between 'else if' and '{' +# If set to ignore, nl_if_brace is used instead +nl_elseif_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'else' and '{' +nl_else_brace = remove # ignore/add/remove/force + +# Add or remove newline between 'else' and 'if' +nl_else_if = remove # ignore/add/remove/force + +# Add or remove newline between '}' and 'finally' +nl_brace_finally = ignore # ignore/add/remove/force + +# Add or remove newline between 'finally' and '{' +nl_finally_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'try' and '{' +nl_try_brace = ignore # ignore/add/remove/force + +# Add or remove newline between get/set and '{' +nl_getset_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'for' and '{' +nl_for_brace = remove # ignore/add/remove/force + +# Add or remove newline between 'catch' and '{' +nl_catch_brace = ignore # ignore/add/remove/force + +# Add or remove newline between '}' and 'catch' +nl_brace_catch = ignore # ignore/add/remove/force + +# Add or remove newline between 'while' and '{' +nl_while_brace = remove # ignore/add/remove/force + +# Add or remove newline between 'using' and '{' +nl_using_brace = ignore # ignore/add/remove/force + +# Add or remove newline between two open or close braces. +# Due to general newline/brace handling, REMOVE may not work. +nl_brace_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'do' and '{' +nl_do_brace = remove # ignore/add/remove/force + +# Add or remove newline between '}' and 'while' of 'do' statement +nl_brace_while = remove # ignore/add/remove/force + +# Add or remove newline between 'switch' and '{' +nl_switch_brace = remove # ignore/add/remove/force + +# Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. +# Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. +nl_multi_line_cond = false # false/true + +# Force a newline in a define after the macro name for multi-line defines. +nl_multi_line_define = false # false/true + +# Whether to put a newline before 'case' statement +nl_before_case = false # false/true + +# Add or remove newline between ')' and 'throw' +nl_before_throw = ignore # ignore/add/remove/force + +# Whether to put a newline after 'case' statement +nl_after_case = false # false/true + +# Newline between namespace and { +nl_namespace_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'template<>' and whatever follows. +nl_template_class = ignore # ignore/add/remove/force + +# Add or remove newline between 'class' and '{' +nl_class_brace = ignore # ignore/add/remove/force + +# Add or remove newline after each ',' in the constructor member initialization +nl_class_init_args = ignore # ignore/add/remove/force + +# Add or remove newline between return type and function name in a function definition +nl_func_type_name = remove # ignore/add/remove/force + +# Add or remove newline between return type and function name inside a class {} +# Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. +nl_func_type_name_class = ignore # ignore/add/remove/force + +# Add or remove newline between function scope and name in a definition +# Controls the newline after '::' in 'void A::f() { }' +nl_func_scope_name = ignore # ignore/add/remove/force + +# Add or remove newline between return type and function name in a prototype +nl_func_proto_type_name = remove # ignore/add/remove/force + +# Add or remove newline between a function name and the opening '(' +nl_func_paren = remove # ignore/add/remove/force + +# Add or remove newline between a function name and the opening '(' in the definition +nl_func_def_paren = remove # ignore/add/remove/force + +# Add or remove newline after '(' in a function declaration +nl_func_decl_start = remove # ignore/add/remove/force + +# Add or remove newline after '(' in a function definition +nl_func_def_start = ignore # ignore/add/remove/force + +# Overrides nl_func_decl_start when there is only one parameter. +nl_func_decl_start_single = ignore # ignore/add/remove/force + +# Overrides nl_func_def_start when there is only one parameter. +nl_func_def_start_single = ignore # ignore/add/remove/force + +# Add or remove newline after each ',' in a function declaration +nl_func_decl_args = ignore # ignore/add/remove/force + +# Add or remove newline after each ',' in a function definition +nl_func_def_args = ignore # ignore/add/remove/force + +# Add or remove newline before the ')' in a function declaration +nl_func_decl_end = remove # ignore/add/remove/force + +# Add or remove newline before the ')' in a function definition +nl_func_def_end = ignore # ignore/add/remove/force + +# Overrides nl_func_decl_end when there is only one parameter. +nl_func_decl_end_single = ignore # ignore/add/remove/force + +# Overrides nl_func_def_end when there is only one parameter. +nl_func_def_end_single = ignore # ignore/add/remove/force + +# Add or remove newline between '()' in a function declaration. +nl_func_decl_empty = ignore # ignore/add/remove/force + +# Add or remove newline between '()' in a function definition. +nl_func_def_empty = ignore # ignore/add/remove/force + +# Add or remove newline between function signature and '{' +nl_fdef_brace = force # ignore/add/remove/force + +# Whether to put a newline after 'return' statement +nl_after_return = false # false/true + +# Add or remove a newline between the return keyword and return expression. +nl_return_expr = ignore # ignore/add/remove/force + +# Whether to put a newline after semicolons, except in 'for' statements +nl_after_semicolon = true # false/true + +# Whether to put a newline after brace open. +# This also adds a newline before the matching brace close. +nl_after_brace_open = false # false/true + +# If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is +# placed between the open brace and a trailing single-line comment. +nl_after_brace_open_cmt = false # false/true + +# Whether to put a newline after a virtual brace open with a non-empty body. +# These occur in un-braced if/while/do/for statement bodies. +nl_after_vbrace_open = true # false/true + +# Whether to put a newline after a virtual brace open with an empty body. +# These occur in un-braced if/while/do/for statement bodies. +nl_after_vbrace_open_empty = false # false/true + +# Whether to put a newline after a brace close. +# Does not apply if followed by a necessary ';'. +nl_after_brace_close = false # false/true + +# Whether to put a newline after a virtual brace close. +# Would add a newline before return in: 'if (foo) a++; return;' +nl_after_vbrace_close = false # false/true + +# Whether to alter newlines in '#define' macros +nl_define_macro = false # false/true + +# Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' +nl_squeeze_ifdef = false # false/true + +# Add or remove blank line before 'if' +nl_before_if = ignore # ignore/add/remove/force + +# Add or remove blank line after 'if' statement +nl_after_if = ignore # ignore/add/remove/force + +# Add or remove blank line before 'for' +nl_before_for = ignore # ignore/add/remove/force + +# Add or remove blank line after 'for' statement +nl_after_for = ignore # ignore/add/remove/force + +# Add or remove blank line before 'while' +nl_before_while = ignore # ignore/add/remove/force + +# Add or remove blank line after 'while' statement +nl_after_while = ignore # ignore/add/remove/force + +# Add or remove blank line before 'switch' +nl_before_switch = ignore # ignore/add/remove/force + +# Add or remove blank line after 'switch' statement +nl_after_switch = ignore # ignore/add/remove/force + +# Add or remove blank line before 'do' +nl_before_do = ignore # ignore/add/remove/force + +# Add or remove blank line after 'do/while' statement +nl_after_do = ignore # ignore/add/remove/force + +# Whether to double-space commented-entries in struct/enum +nl_ds_struct_enum_cmt = false # false/true + +# Whether to double-space before the close brace of a struct/union/enum +# (lower priority than 'eat_blanks_before_close_brace') +nl_ds_struct_enum_close_brace = false # false/true + +# Add or remove a newline around a class colon. +# Related to pos_class_colon, nl_class_init_args, and pos_comma. +nl_class_colon = ignore # ignore/add/remove/force + +# Change simple unbraced if statements into a one-liner +# 'if(b)\n i++;' => 'if(b) i++;' +nl_create_if_one_liner = false # false/true + +# Change simple unbraced for statements into a one-liner +# 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' +nl_create_for_one_liner = false # false/true + +# Change simple unbraced while statements into a one-liner +# 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' +nl_create_while_one_liner = false # false/true + +# +# Positioning options +# + +# The position of arithmetic operators in wrapped expressions +pos_arith = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of assignment in wrapped expressions. +# Do not affect '=' followed by '{' +pos_assign = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of boolean operators in wrapped expressions +pos_bool = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of comparison operators in wrapped expressions +pos_compare = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of conditional (b ? t : f) operators in wrapped expressions +pos_conditional = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of the comma in wrapped expressions +pos_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of the comma in the constructor initialization list +pos_class_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force + +# The position of colons between constructor and member initialization +pos_class_colon = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force + +# +# Line Splitting options +# + +# Try to limit code width to N number of columns +code_width = 0 # number + +# Whether to fully split long 'for' statements at semi-colons +ls_for_split_full = false # false/true + +# Whether to fully split long function protos/calls at commas +ls_func_split_full = false # false/true + +# +# Blank line options +# + +# The maximum consecutive newlines +nl_max = 2 # number + +# The number of newlines after a function prototype, if followed by another function prototype +nl_after_func_proto = 0 # number + +# The number of newlines after a function prototype, if not followed by another function prototype +nl_after_func_proto_group = 0 # number + +# The number of newlines after '}' of a multi-line function body +nl_after_func_body = 2 # number + +# The number of newlines after '}' of a single line function body +nl_after_func_body_one_liner = 2 # number + +# The minimum number of newlines before a multi-line comment. +# Doesn't apply if after a brace open or another multi-line comment. +nl_before_block_comment = 0 # number + +# The minimum number of newlines before a single-line C comment. +# Doesn't apply if after a brace open or other single-line C comments. +nl_before_c_comment = 0 # number + +# The minimum number of newlines before a CPP comment. +# Doesn't apply if after a brace open or other CPP comments. +nl_before_cpp_comment = 0 # number + +# Whether to force a newline after a multi-line comment. +nl_after_multiline_comment = false # false/true + +# The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. +# Will not change the newline count if after a brace open. +# 0 = No change. +nl_before_access_spec = 0 # number + +# The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. +# 0 = No change. +nl_after_access_spec = 0 # number + +# The number of newlines between a function def and the function comment. +# 0 = No change. +nl_comment_func_def = 0 # number + +# The number of newlines after a try-catch-finally block that isn't followed by a brace close. +# 0 = No change. +nl_after_try_catch_finally = 0 # number + +# The number of newlines before and after a property, indexer or event decl. +# 0 = No change. +nl_around_cs_property = 0 # number + +# The number of newlines between the get/set/add/remove handlers in C#. +# 0 = No change. +nl_between_get_set = 0 # number + +# Whether to remove blank lines after '{' +eat_blanks_after_open_brace = true # false/true + +# Whether to remove blank lines before '}' +eat_blanks_before_close_brace = true # false/true + +# +# Code modifying options (non-whitespace) +# + +# Add or remove braces on single-line 'do' statement +mod_full_brace_do = remove # ignore/add/remove/force + +# Add or remove braces on single-line 'for' statement +mod_full_brace_for = remove # ignore/add/remove/force + +# Add or remove braces on single-line function definitions. (Pawn) +mod_full_brace_function = ignore # ignore/add/remove/force + +# Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. +mod_full_brace_if = ignore # ignore/add/remove/force + +# Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. +# If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. +mod_full_brace_if_chain = false # false/true + +# Don't remove braces around statements that span N newlines +mod_full_brace_nl = 0 # number + +# Add or remove braces on single-line 'while' statement +mod_full_brace_while = remove # ignore/add/remove/force + +# Add or remove braces on single-line 'using ()' statement +mod_full_brace_using = remove # ignore/add/remove/force + +# Add or remove unnecessary paren on 'return' statement +mod_paren_on_return = remove # ignore/add/remove/force + +# Whether to change optional semicolons to real semicolons +mod_pawn_semicolon = false # false/true + +# Add parens on 'while' and 'if' statement around bools +mod_full_paren_if_bool = false # false/true + +# Whether to remove superfluous semicolons +mod_remove_extra_semicolon = true # false/true + +# If a function body exceeds the specified number of newlines and doesn't have a comment after +# the close brace, a comment will be added. +mod_add_long_function_closebrace_comment = 0 # number + +# If a switch body exceeds the specified number of newlines and doesn't have a comment after +# the close brace, a comment will be added. +mod_add_long_switch_closebrace_comment = 0 # number + +# If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after +# the #else, a comment will be added. +mod_add_long_ifdef_endif_comment = 0 # number + +# If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after +# the #endif, a comment will be added. +mod_add_long_ifdef_else_comment = 0 # number + +# If TRUE, will sort consecutive single-line 'import' statements [Java, D] +mod_sort_import = false # false/true + +# If TRUE, will sort consecutive single-line 'using' statements [C#] +mod_sort_using = false # false/true + +# If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] +# This is generally a bad idea, as it may break your code. +mod_sort_include = false # false/true + +# If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. +mod_move_case_break = false # false/true + +# Will add or remove the braces around a fully braced case statement. +# Will only remove the braces if there are no variable declarations in the block. +mod_case_brace = ignore # ignore/add/remove/force + +# If TRUE, it will remove a void 'return;' that appears as the last statement in a function. +mod_remove_empty_return = false # false/true + +# +# Comment modifications +# + +# Try to wrap comments at cmt_width columns +cmt_width = 0 # number + +# Set the comment reflow mode (default: 0) +# 0: no reflowing (apart from the line wrapping due to cmt_width) +# 1: no touching at all +# 2: full reflow +cmt_reflow_mode = 0 # number + +# If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars. +# Default is true. +cmt_indent_multi = true # false/true + +# Whether to group c-comments that look like they are in a block +cmt_c_group = false # false/true + +# Whether to put an empty '/*' on the first line of the combined c-comment +cmt_c_nl_start = false # false/true + +# Whether to put a newline before the closing '*/' of the combined c-comment +cmt_c_nl_end = false # false/true + +# Whether to group cpp-comments that look like they are in a block +cmt_cpp_group = false # false/true + +# Whether to put an empty '/*' on the first line of the combined cpp-comment +cmt_cpp_nl_start = false # false/true + +# Whether to put a newline before the closing '*/' of the combined cpp-comment +cmt_cpp_nl_end = false # false/true + +# Whether to change cpp-comments into c-comments +cmt_cpp_to_c = false # false/true + +# Whether to put a star on subsequent comment lines +cmt_star_cont = true # false/true + +# The number of spaces to insert at the start of subsequent comment lines +cmt_sp_before_star_cont = 0 # number + +# The number of spaces to insert after the star on subsequent comment lines +cmt_sp_after_star_cont = 0 # number + +# For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of +# the comment are the same length. Default=True +cmt_multi_check_last = false # false/true + +# The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. +# Will substitute $(filename) with the current file's name. +cmt_insert_file_header = "" # string + +# The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. +# Will substitute $(filename) with the current file's name. +cmt_insert_file_footer = "" # string + +# The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. +# Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. +# Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } +cmt_insert_func_header = "" # string + +# The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. +# Will substitute $(class) with the class name. +cmt_insert_class_header = "" # string + +# If a preprocessor is encountered when stepping backwards from a function name, then +# this option decides whether the comment should be inserted. +# Affects cmt_insert_func_header and cmt_insert_class_header. +cmt_insert_before_preproc = false # false/true + +# +# Preprocessor options +# + +# Control indent of preprocessors inside #if blocks at brace level 0 +pp_indent = remove # ignore/add/remove/force + +# Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) +pp_indent_at_level = false # false/true + +# If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. +pp_indent_count = 1 # number + +# Add or remove space after # based on pp_level of #if blocks +pp_space = remove # ignore/add/remove/force + +# Sets the number of spaces added with pp_space +pp_space_count = 0 # number + +# The indent for #region and #endregion in C# and '#pragma region' in C/C++ +pp_indent_region = 0 # number + +# Whether to indent the code between #region and #endregion +pp_region_indent_code = false # false/true + +# If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level +pp_indent_if = 0 # number + +# Control whether to indent the code between #if, #else and #endif when not at file-level +pp_if_indent_code = false # false/true + +# Whether to indent '#define' at the brace level (true) or from column 1 (false) +pp_define_at_level = false # false/true + +# You can force a token to be a type with the 'type' option. +# Example: +# type myfoo1 myfoo2 +# +# You can create custom macro-based indentation using macro-open, +# macro-else and macro-close. +# Example: +# macro-open BEGIN_TEMPLATE_MESSAGE_MAP +# macro-open BEGIN_MESSAGE_MAP +# macro-close END_MESSAGE_MAP +# +# You can assign any keyword to any type with the set option. +# set func_call_user _ N_ +# +# The full syntax description of all custom definition config entries +# is shown below: +# +# define custom tokens as: +# - embed whitespace in token using '' escape character, or +# put token in quotes +# - these: ' " and ` are recognized as quote delimiters +# +# type token1 token2 token3 ... +# ^ optionally specify multiple tokens on a single line +# define def_token output_token +# ^ output_token is optional, then NULL is assumed +# macro-open token +# macro-close token +# macro-else token +# set id token1 token2 ... +# ^ optionally specify multiple tokens on a single line +# ^ id is one of the names in token_enum.h sans the CT_ prefix, +# e.g. PP_PRAGMA +# +# all tokens are separated by any mix of ',' commas, '=' equal signs +# and whitespace (space, tab) +# diff --git a/mplayer/av_opts.c b/mplayer/av_opts.c index 04c35f18..7da41b29 100644 --- a/mplayer/av_opts.c +++ b/mplayer/av_opts.c @@ -38,7 +38,7 @@ int parse_avopts(void *v, char *str){ arg = strchr(str, '='); if(arg) *arg++= 0; - if(!av_set_string(v, str, arg)){ + if(av_set_string3(v, str, arg, 0, NULL) < 0){ free(start); return -1; } diff --git a/mplayer/cfg-common.h b/mplayer/cfg-common.h index 0ebbed91..5641f308 100644 --- a/mplayer/cfg-common.h +++ b/mplayer/cfg-common.h @@ -564,6 +564,7 @@ const m_option_t common_opts[] = { // ------------------------- subtitles options -------------------- {"sub", &sub_name, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL}, + {"sub-paths", &sub_paths, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL}, #ifdef CONFIG_FRIBIDI {"fribidi-charset", &fribidi_charset, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"flip-hebrew", &flip_hebrew, CONF_TYPE_FLAG, 0, 0, 1, NULL}, diff --git a/mplayer/cfg-mplayer.h b/mplayer/cfg-mplayer.h index a5dd73a1..3f359802 100644 --- a/mplayer/cfg-mplayer.h +++ b/mplayer/cfg-mplayer.h @@ -235,6 +235,7 @@ const m_option_t mplayer_opts[]={ #endif {"osdlevel", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 4, NULL}, {"osd-duration", &osd_duration, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL}, + {"osd-fractions", &osd_fractions, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL}, #ifdef CONFIG_MENU {"menu", &use_menu, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL}, {"nomenu", &use_menu, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL}, diff --git a/mplayer/codecs.conf.h b/mplayer/codecs.conf.h index d12e2d3b..37757c47 100644 --- a/mplayer/codecs.conf.h +++ b/mplayer/codecs.conf.h @@ -1280,8 +1280,8 @@ NULL, /* comment */ { 0x00000000, 0, 0,{ 0, 0, 0, 0, 0, 0, 0, 0 } }, /* GUID */ 0 /* flags */, 0 /* status */, 0 /* cpuflags */ } , -{{ 0x34363248, 0x34363268, 0x34363258, 0x34363278, 0x31637661, 0x31435641, 0x63766164, 0x43564144, 0x63767676, 0x10000005, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* fourcc */ -{ 0x34363248, 0x34363268, 0x34363258, 0x34363278, 0x31637661, 0x31435641, 0x63766164, 0x43564144, 0x63767676, 0x10000005, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fourccmap */ +{{ 0x34363248, 0x34363268, 0x34363258, 0x34363278, 0x31637661, 0x31435641, 0x63766164, 0x43564144, 0x63767676, 0x35356961, 0x35316961, 0x71316961, 0x71356961, 0x10000005, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* fourcc */ +{ 0x34363248, 0x34363268, 0x34363258, 0x34363278, 0x31637661, 0x31435641, 0x63766164, 0x43564144, 0x63767676, 0x35356961, 0x35316961, 0x71316961, 0x71356961, 0x10000005, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fourccmap */ { 0x32315659, 0x30323449, 0x56555949, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* outfmt */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* outflags */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* infmt */ @@ -1294,8 +1294,8 @@ NULL, /* comment */ { 0x00000000, 0, 0,{ 0, 0, 0, 0, 0, 0, 0, 0 } }, /* GUID */ 0 /* flags */, 1 /* status */, 0 /* cpuflags */ } , -{{ 0x34363248, 0x34363268, 0x34363258, 0x34363278, 0x31637661, 0x31435641, 0x63766164, 0x43564144, 0x10000005, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* fourcc */ -{ 0x34363248, 0x34363268, 0x34363258, 0x34363278, 0x31637661, 0x31435641, 0x63766164, 0x43564144, 0x10000005, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fourccmap */ +{{ 0x34363248, 0x34363268, 0x34363258, 0x34363278, 0x31637661, 0x31435641, 0x63766164, 0x43564144, 0x35356961, 0x35316961, 0x71316961, 0x71356961, 0x10000005, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* fourcc */ +{ 0x34363248, 0x34363268, 0x34363258, 0x34363278, 0x31637661, 0x31435641, 0x63766164, 0x43564144, 0x35356961, 0x35316961, 0x71316961, 0x71356961, 0x10000005, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fourccmap */ { 0x1DC80003, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* outfmt */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* outflags */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* infmt */ @@ -1308,8 +1308,8 @@ NULL, /* comment */ { 0x00000000, 0, 0,{ 0, 0, 0, 0, 0, 0, 0, 0 } }, /* GUID */ 0 /* flags */, 1 /* status */, 0 /* cpuflags */ } , -{{ 0x34363248, 0x34363268, 0x34363258, 0x34363278, 0x31637661, 0x63766164, 0x43564144, 0x48535356, 0x10000005, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* fourcc */ -{ 0x34363248, 0x34363268, 0x34363258, 0x34363278, 0x31435641, 0x63766164, 0x43564144, 0x48535356, 0x10000005, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fourccmap */ +{{ 0x34363248, 0x34363268, 0x34363258, 0x34363278, 0x31637661, 0x63766164, 0x43564144, 0x48535356, 0x35356961, 0x35316961, 0x71316961, 0x71356961, 0x10000005, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* fourcc */ +{ 0x34363248, 0x34363268, 0x34363258, 0x34363278, 0x31435641, 0x63766164, 0x43564144, 0x48535356, 0x35356961, 0x35316961, 0x71316961, 0x71356961, 0x10000005, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fourccmap */ { 0x32315659, 0x56555949, 0x30323449, 0x32595559, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* outfmt */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* outflags */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* infmt */ @@ -3954,8 +3954,8 @@ NULL, /* comment */ { 0x00000000, 0, 0,{ 0, 0, 0, 0, 0, 0, 0, 0 } }, /* GUID */ 0 /* flags */, 2 /* status */, 0 /* cpuflags */ } , -{{ 0x68637061, 0x6E637061, 0x73637061, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* fourcc */ -{ 0x68637061, 0x6E637061, 0x73637061, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fourccmap */ +{{ 0x68637061, 0x6E637061, 0x73637061, 0x6F637061, 0x68347061, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* fourcc */ +{ 0x68637061, 0x6E637061, 0x73637061, 0x6F637061, 0x68347061, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fourccmap */ { 0x32595559, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* outfmt */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* outflags */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* infmt */ @@ -4332,6 +4332,20 @@ NULL, /* comment */ { 0x00000000, 0, 0,{ 0, 0, 0, 0, 0, 0, 0, 0 } }, /* GUID */ 0 /* flags */, 1 /* status */, 0 /* cpuflags */ } , +{{ 0x6E617858, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* fourcc */ +{ 0x6E617858, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fourccmap */ +{ 0x32315659, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* outfmt */ +{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* outflags */ +{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* infmt */ +{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* inflags */ +"ffwc4", /* name */ +"FFmpeg XAN wc4", /* info */ +NULL, /* comment */ +"xan_wc4", /* dll */ +"ffmpeg", /* drv */ +{ 0x00000000, 0, 0,{ 0, 0, 0, 0, 0, 0, 0, 0 } }, /* GUID */ +0 /* flags */, 1 /* status */, 0 /* cpuflags */ } +, {{ 0x56334357, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* fourcc */ { 0x56334357, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fourccmap */ { 0x42475208, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* outfmt */ @@ -5763,15 +5777,15 @@ NULL, /* comment */ { 0x00000000, 0, 0,{ 0, 0, 0, 0, 0, 0, 0, 0 } }, /* GUID */ 0 /* flags */, 1 /* status */, 0 /* cpuflags */ } , -{{ 0x6E617841, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* fourcc */ -{ 0x6E617841, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fourccmap */ +{{ 0x6E617841, 0x594A, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* fourcc */ +{ 0x6E617841, 0x594A, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fourccmap */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* outfmt */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* outflags */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* infmt */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* inflags */ "ffxandpcm", /* name */ "FFmpeg XAN DPCM audio", /* info */ -"only works with libavformat demuxer", /* comment */ +"Wing Commander 4 files only work with libavformat demuxer", /* comment */ "xan_dpcm", /* dll */ "ffmpeg", /* drv */ { 0x00000000, 0, 0,{ 0, 0, 0, 0, 0, 0, 0, 0 } }, /* GUID */ @@ -6505,6 +6519,20 @@ NULL, /* comment */ { 0x00000000, 0, 0,{ 0, 0, 0, 0, 0, 0, 0, 0 } }, /* GUID */ 0 /* flags */, 1 /* status */, 0 /* cpuflags */ } , +{{ 0x46584C50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* fourcc */ +{ 0x46584C50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fourccmap */ +{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* outfmt */ +{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* outflags */ +{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* infmt */ +{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* inflags */ +"ffpcmlxf", /* name */ +"Leitch/Harris PCM", /* info */ +NULL, /* comment */ +"pcm_lxf", /* dll */ +"ffmpeg", /* drv */ +{ 0x00000000, 0, 0,{ 0, 0, 0, 0, 0, 0, 0, 0 } }, /* GUID */ +0 /* flags */, 1 /* status */, 0 /* cpuflags */ } +, {{ 0x2000, 0x332D6361, 0x332D4341, 0x20736D, 0x74656E64, 0x33636173, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* fourcc */ { 0x2000, 0x332D6361, 0x332D4341, 0x20736D, 0x74656E64, 0x33636173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fourccmap */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, /* outfmt */ diff --git a/mplayer/command.c b/mplayer/command.c index b1c88252..c74ff9d7 100644 --- a/mplayer/command.c +++ b/mplayer/command.c @@ -70,8 +70,6 @@ #include "libavutil/avstring.h" #include "edl.h" -#define ROUND(x) ((int)((x)<0 ? (x)-0.5 : (x)+0.5)) - static void rescale_input_coordinates(int ix, int iy, double *dx, double *dy) { //remove the borders, if any, and rescale to the range [0,1],[0,1] @@ -1942,6 +1940,7 @@ static int mp_property_sub_scale(m_option_t *prop, int action, void *arg, #endif text_font_scale_factor = *(float *) arg; force_load_font = 1; + vo_osd_changed(OSDTYPE_SUBTITLE); return M_PROPERTY_OK; case M_PROPERTY_STEP_UP: case M_PROPERTY_STEP_DOWN: @@ -1957,6 +1956,7 @@ static int mp_property_sub_scale(m_option_t *prop, int action, void *arg, (action == M_PROPERTY_STEP_UP ? 1.0 : -1.0); M_PROPERTY_CLAMP(prop, text_font_scale_factor); force_load_font = 1; + vo_osd_changed(OSDTYPE_SUBTITLE); return M_PROPERTY_OK; default: #ifdef CONFIG_ASS diff --git a/mplayer/config.gc.h b/mplayer/config.gc.h index 557a5a7d..db5a805f 100644 --- a/mplayer/config.gc.h +++ b/mplayer/config.gc.h @@ -45,17 +45,11 @@ char MPLAYER_LIBDIR[100]; #define HAVE_ERRNO_H 1 /* libdvdcss + libdvdread */ #define HAVE_LIMITS_H 1 -/* libdvdcss + libfaad2 */ +/* libdvdcss */ #define HAVE_UNISTD_H 1 -/* libfaad2 + libdvdread */ +/* libdvdread */ #define STDC_HEADERS 1 #define HAVE_MEMCPY 1 -/* libfaad2 */ -#define HAVE_STDLIB_H 1 -#define HAVE_STRING_H 1 -#undef HAVE_STRINGS_H -#define HAVE_SYS_STAT_H 1 -#define HAVE_SYS_TYPES_H 1 /* libdvdnav */ #define READ_CACHE_TRACE 0 /* libdvdread */ @@ -72,9 +66,9 @@ char MPLAYER_LIBDIR[100]; #undef HAVE_SOUNDCARD_H #undef HAVE_SYS_ASOUNDLIB_H -#define HAVE_SYS_SOUNDCARD_H 1 +#undef HAVE_SYS_SOUNDCARD_H #undef HAVE_SYS_SYSINFO_H -#define HAVE_TERMIOS_H 1 +#undef HAVE_TERMIOS_H #undef HAVE_SYS_TERMIOS_H #define HAVE_WINSOCK2_H 0 @@ -86,25 +80,25 @@ char MPLAYER_LIBDIR[100]; #define HAVE_LANGINFO 1 #define HAVE_MEMALIGN 1 -#undef HAVE_NANOSLEEP +#define HAVE_NANOSLEEP 1 #undef HAVE_POSIX_SELECT -#define HAVE_AUDIO_SELECT 1 +#undef HAVE_AUDIO_SELECT #define HAVE_SETENV 1 #define HAVE_SETMODE 0 -#define HAVE_SHM 1 +#undef HAVE_SHM #define HAVE_STRSEP 1 #define HAVE_SWAB 1 #undef HAVE_TERMCAP -#define HAVE_TERMIOS 1 +#undef HAVE_TERMIOS #define HAVE_VSSCANF 1 /* system-specific features */ #define HAVE_BUILTIN_EXPECT 1 -#define HAVE_LIBDL 1 +#undef HAVE_LIBDL #define HAVE_DOS_PATHS 0 #define EXTERN_ASM #define EXTERN_PREFIX "" @@ -133,7 +127,7 @@ char MPLAYER_LIBDIR[100]; #define CONFIG_SIGHANDLER 1 #define CONFIG_SORTSUB 1 #define CONFIG_STREAM_CACHE 1 -#define PTHREAD_CACHE 1 +#undef PTHREAD_CACHE /* CPU stuff */ @@ -211,7 +205,6 @@ char MPLAYER_LIBDIR[100]; /* codec libraries */ #undef CONFIG_FAAC #undef CONFIG_FAAD -#undef CONFIG_FAAD_INTERNAL #undef CONFIG_LIBA52 #undef CONFIG_LIBDCA #undef CONFIG_LIBDV095 @@ -329,7 +322,7 @@ char MPLAYER_LIBDIR[100]; #define HAVE_SOCKLEN_T 1 #define HAVE_STRUCT_IPV6_MREQ 0 #define HAVE_STRUCT_SOCKADDR_IN6 0 -#define HAVE_STRUCT_SOCKADDR_SA_LEN 0 +#define HAVE_STRUCT_SOCKADDR_SA_LEN 1 #undef CONFIG_VSTREAM #define HAVE_STRUCT_ADDRINFO 0 #define HAVE_GETADDRINFO 0 @@ -381,7 +374,7 @@ char MPLAYER_LIBDIR[100]; #undef CONFIG_XVR100 #undef CONFIG_TGA #undef CONFIG_V4L2_DECODER -#undef CONFIG_VDPAU +#define CONFIG_VDPAU 0 #undef CONFIG_VESA #undef CONFIG_VIDIX #undef CONFIG_VIDIX_DRV_CYBERBLADE @@ -407,7 +400,7 @@ char MPLAYER_LIBDIR[100]; #undef CONFIG_XMGA #undef CONFIG_XSS #undef CONFIG_XV -#undef CONFIG_XVMC +#define CONFIG_XVMC 0 #undef CONFIG_YUV4MPEG #undef CONFIG_ZR @@ -450,11 +443,11 @@ char MPLAYER_LIBDIR[100]; #define CONFIG_NETWORK 0 #define CONFIG_PIC 0 #define HAVE_POSIX_MEMALIGN 0 -#undef HAVE_PTHREADS +#define HAVE_PTHREADS 0 #define HAVE_ROUND 1 #define HAVE_ROUNDF 1 #define HAVE_TEN_OPERANDS 0 -#define HAVE_THREADS 1 +#define HAVE_THREADS 0 #define HAVE_TRUNCF 1 #define HAVE_XFORM_ASM 1 #define HAVE_XMM_CLOBBERS 0 @@ -478,7 +471,7 @@ char MPLAYER_LIBDIR[100]; #define HAVE_LDBRX 0 #define HAVE_POLL_H 0 #define HAVE_PPC4XX 0 -#define HAVE_STRERROR_R 0 +#define HAVE_STRERROR_R 1 #define HAVE_SYMVER_ASM_LABEL 0 #define HAVE_SYMVER_GNU_ASM 0 #define HAVE_SYS_SELECT_H 0 @@ -667,12 +660,13 @@ char MPLAYER_LIBDIR[100]; #define CONFIG_WMV3_VDPAU_DECODER 0 #define CONFIG_WNV1_DECODER 0 #define CONFIG_XAN_WC3_DECODER 0 +#define CONFIG_XAN_WC4_DECODER 0 #define CONFIG_XL_DECODER 0 #define CONFIG_YOP_DECODER 0 #define CONFIG_ZLIB_DECODER 0 #define CONFIG_ZMBV_DECODER 0 #define CONFIG_AAC_DECODER 1 -#define CONFIG_AAC_LATM_DECODER 1 +#define CONFIG_AAC_LATM_DECODER 0 #define CONFIG_AC3_DECODER 1 #define CONFIG_ALAC_DECODER 0 #define CONFIG_ALS_DECODER 0 @@ -694,15 +688,15 @@ char MPLAYER_LIBDIR[100]; #define CONFIG_MACE3_DECODER 0 #define CONFIG_MACE6_DECODER 0 #define CONFIG_MLP_DECODER 0 -#define CONFIG_MP1_DECODER 1 +#define CONFIG_MP1_DECODER 0 #define CONFIG_MP1FLOAT_DECODER 0 #define CONFIG_MP2_DECODER 1 #define CONFIG_MP2FLOAT_DECODER 0 #define CONFIG_MP3_DECODER 1 #define CONFIG_MP3FLOAT_DECODER 0 -#define CONFIG_MP3ADU_DECODER 1 +#define CONFIG_MP3ADU_DECODER 0 #define CONFIG_MP3ADUFLOAT_DECODER 0 -#define CONFIG_MP3ON4_DECODER 1 +#define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MP3ON4FLOAT_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 @@ -908,7 +902,7 @@ char MPLAYER_LIBDIR[100]; #define CONFIG_LIBXAVS_ENCODER 0 #define CONFIG_LIBXVID_ENCODER 0 #define CONFIG_AAC_PARSER 1 -#define CONFIG_AAC_LATM_PARSER 1 +#define CONFIG_AAC_LATM_PARSER 0 #define CONFIG_AC3_PARSER 1 #define CONFIG_CAVSVIDEO_PARSER 0 #define CONFIG_DCA_PARSER 1 diff --git a/mplayer/config.gc.mak b/mplayer/config.gc.mak index f5d2f40f..626a99a9 100644 --- a/mplayer/config.gc.mak +++ b/mplayer/config.gc.mak @@ -32,7 +32,6 @@ CXXFLAGS = -Wundef -Wall -Wno-switch -Wno-parentheses -Wpointer-arith -Wredundan CC_DEPFLAGS = -MD -MP -O2 -meabi -mogc -mcpu=750 -mtune=750 -mhard-float -mdouble-float -mpaired -pipe -g -ffast-math -fomit-frame-pointer CFLAGS_DHAHELPER = -CFLAGS_FAAD_FIXED = CFLAGS_LIBDVDCSS = CFLAGS_LIBDVDCSS_DVDREAD = CFLAGS_LIBDVDNAV = @@ -106,7 +105,6 @@ ESD = no FAAC=no GEKKO = yes FAAD = no -FAAD_INTERNAL = no FASTMEMCPY = yes FBDEV = no FREETYPE = yes @@ -293,9 +291,8 @@ CONFIG_ZLIB = no HAVE_GNU_AS = no HAVE_PTHREADS = no -HAVE_SHM = yes +HAVE_SHM = no HAVE_W32THREADS = no -HAVE_GEKKOTHREADS = yes HAVE_YASM = no CONFIG_AASC_DECODER=no @@ -437,12 +434,13 @@ CONFIG_WMV2_DECODER=no CONFIG_WMV3_DECODER=yes CONFIG_WNV1_DECODER=no CONFIG_XAN_WC3_DECODER=no +CONFIG_XAN_WC4_DECODER=no CONFIG_XL_DECODER=no CONFIG_YOP_DECODER=no CONFIG_ZLIB_DECODER=no CONFIG_ZMBV_DECODER=no CONFIG_AAC_DECODER=yes -CONFIG_AAC_LATM_DECODER=yes +CONFIG_AAC_LATM_DECODER=no CONFIG_AC3_DECODER=yes CONFIG_ALAC_DECODER=no CONFIG_ALS_DECODER=no @@ -464,15 +462,15 @@ CONFIG_IMC_DECODER=no CONFIG_MACE3_DECODER=no CONFIG_MACE6_DECODER=no CONFIG_MLP_DECODER=no -CONFIG_MP1_DECODER=yes +CONFIG_MP1_DECODER=no CONFIG_MP1FLOAT_DECODER=no CONFIG_MP2_DECODER=yes CONFIG_MP2FLOAT_DECODER=no CONFIG_MP3_DECODER=yes CONFIG_MP3FLOAT_DECODER=no -CONFIG_MP3ADU_DECODER=yes +CONFIG_MP3ADU_DECODER=no CONFIG_MP3ADUFLOAT_DECODER=no -CONFIG_MP3ON4_DECODER=yes +CONFIG_MP3ON4_DECODER=no CONFIG_MP3ON4FLOAT_DECODER=no CONFIG_MPC7_DECODER=no CONFIG_MPC8_DECODER=no @@ -656,7 +654,7 @@ CONFIG_DVBSUB_ENCODER=no CONFIG_DVDSUB_ENCODER=no CONFIG_XSUB_ENCODER=no CONFIG_AAC_PARSER=yes -CONFIG_AAC_LATM_PARSER=yes +CONFIG_AAC_LATM_PARSER=no CONFIG_AC3_PARSER=yes CONFIG_CAVSVIDEO_PARSER=no CONFIG_DCA_PARSER=yes diff --git a/mplayer/config.h b/mplayer/config.h index 737c1214..dcc2889a 100644 --- a/mplayer/config.h +++ b/mplayer/config.h @@ -45,17 +45,11 @@ char MPLAYER_LIBDIR[100]; #define HAVE_ERRNO_H 1 /* libdvdcss + libdvdread */ #define HAVE_LIMITS_H 1 -/* libdvdcss + libfaad2 */ +/* libdvdcss */ #define HAVE_UNISTD_H 1 -/* libfaad2 + libdvdread */ +/* libdvdread */ #define STDC_HEADERS 1 #define HAVE_MEMCPY 1 -/* libfaad2 */ -#define HAVE_STDLIB_H 1 -#define HAVE_STRING_H 1 -#undef HAVE_STRINGS_H -#define HAVE_SYS_STAT_H 1 -#define HAVE_SYS_TYPES_H 1 /* libdvdnav */ #define READ_CACHE_TRACE 0 /* libdvdread */ @@ -72,9 +66,9 @@ char MPLAYER_LIBDIR[100]; #undef HAVE_SOUNDCARD_H #undef HAVE_SYS_ASOUNDLIB_H -#define HAVE_SYS_SOUNDCARD_H 1 +#undef HAVE_SYS_SOUNDCARD_H #undef HAVE_SYS_SYSINFO_H -#define HAVE_TERMIOS_H 1 +#undef HAVE_TERMIOS_H #undef HAVE_SYS_TERMIOS_H #define HAVE_WINSOCK2_H 0 @@ -86,25 +80,25 @@ char MPLAYER_LIBDIR[100]; #define HAVE_LANGINFO 1 #define HAVE_MEMALIGN 1 -#undef HAVE_NANOSLEEP +#define HAVE_NANOSLEEP 1 #undef HAVE_POSIX_SELECT -#define HAVE_AUDIO_SELECT 1 +#undef HAVE_AUDIO_SELECT #define HAVE_SETENV 1 #define HAVE_SETMODE 0 -#define HAVE_SHM 1 +#undef HAVE_SHM #define HAVE_STRSEP 1 #define HAVE_SWAB 1 #undef HAVE_TERMCAP -#define HAVE_TERMIOS 1 +#undef HAVE_TERMIOS #define HAVE_VSSCANF 1 /* system-specific features */ #define HAVE_BUILTIN_EXPECT 1 -#define HAVE_LIBDL 1 +#undef HAVE_LIBDL #define HAVE_DOS_PATHS 0 #define EXTERN_ASM #define EXTERN_PREFIX "" @@ -133,7 +127,7 @@ char MPLAYER_LIBDIR[100]; #define CONFIG_SIGHANDLER 1 #define CONFIG_SORTSUB 1 #define CONFIG_STREAM_CACHE 1 -#define PTHREAD_CACHE 1 +#undef PTHREAD_CACHE /* CPU stuff */ @@ -211,7 +205,6 @@ char MPLAYER_LIBDIR[100]; /* codec libraries */ #undef CONFIG_FAAC #undef CONFIG_FAAD -#undef CONFIG_FAAD_INTERNAL #undef CONFIG_LIBA52 #undef CONFIG_LIBDCA #undef CONFIG_LIBDV095 @@ -317,7 +310,7 @@ char MPLAYER_LIBDIR[100]; /* networking */ -#define HAVE_CLOSESOCKET 0 +#define HAVE_CLOSESOCKET 1 #define CONFIG_FTP 1 #undef HAVE_AF_INET6 #define HAVE_INET_ATON 1 @@ -329,7 +322,7 @@ char MPLAYER_LIBDIR[100]; #define HAVE_SOCKLEN_T 1 #define HAVE_STRUCT_IPV6_MREQ 0 #define HAVE_STRUCT_SOCKADDR_IN6 0 -#define HAVE_STRUCT_SOCKADDR_SA_LEN 0 +#define HAVE_STRUCT_SOCKADDR_SA_LEN 1 #undef CONFIG_VSTREAM #define HAVE_STRUCT_ADDRINFO 0 #define HAVE_GETADDRINFO 0 @@ -367,7 +360,7 @@ char MPLAYER_LIBDIR[100]; #undef CONFIG_IVTV #undef CONFIG_JPEG -#undef CONFIG_MD5SUM +#define CONFIG_MD5SUM 1 #undef CONFIG_MGA #undef CONFIG_MNG #undef CONFIG_PNG @@ -381,7 +374,7 @@ char MPLAYER_LIBDIR[100]; #undef CONFIG_XVR100 #undef CONFIG_TGA #undef CONFIG_V4L2_DECODER -#undef CONFIG_VDPAU +#define CONFIG_VDPAU 0 #undef CONFIG_VESA #undef CONFIG_VIDIX #undef CONFIG_VIDIX_DRV_CYBERBLADE @@ -407,7 +400,7 @@ char MPLAYER_LIBDIR[100]; #undef CONFIG_XMGA #undef CONFIG_XSS #undef CONFIG_XV -#undef CONFIG_XVMC +#define CONFIG_XVMC 0 #undef CONFIG_YUV4MPEG #undef CONFIG_ZR @@ -450,11 +443,11 @@ char MPLAYER_LIBDIR[100]; #define CONFIG_NETWORK 1 #define CONFIG_PIC 0 #define HAVE_POSIX_MEMALIGN 0 -#undef HAVE_PTHREADS +#define HAVE_PTHREADS 0 #define HAVE_ROUND 1 #define HAVE_ROUNDF 1 #define HAVE_TEN_OPERANDS 0 -#define HAVE_THREADS 1 +#define HAVE_THREADS 0 #define HAVE_TRUNCF 1 #define HAVE_XFORM_ASM 1 #define HAVE_XMM_CLOBBERS 0 @@ -478,7 +471,7 @@ char MPLAYER_LIBDIR[100]; #define HAVE_LDBRX 0 #define HAVE_POLL_H 0 #define HAVE_PPC4XX 0 -#define HAVE_STRERROR_R 0 +#define HAVE_STRERROR_R 1 #define HAVE_SYMVER_ASM_LABEL 0 #define HAVE_SYMVER_GNU_ASM 0 #define HAVE_SYS_SELECT_H 0 @@ -667,6 +660,7 @@ char MPLAYER_LIBDIR[100]; #define CONFIG_WMV3_VDPAU_DECODER 0 #define CONFIG_WNV1_DECODER 1 #define CONFIG_XAN_WC3_DECODER 1 +#define CONFIG_XAN_WC4_DECODER 1 #define CONFIG_XL_DECODER 1 #define CONFIG_YOP_DECODER 1 #define CONFIG_ZLIB_DECODER 1 @@ -1041,7 +1035,7 @@ char MPLAYER_LIBDIR[100]; #define CONFIG_RSO_DEMUXER 1 #define CONFIG_RTP_DEMUXER 0 #define CONFIG_RTSP_DEMUXER 0 -#define CONFIG_SAP_DEMUXER 1 +#define CONFIG_SAP_DEMUXER 0 #define CONFIG_SDP_DEMUXER 0 #define CONFIG_SEGAFILM_DEMUXER 1 #define CONFIG_SHORTEN_DEMUXER 1 @@ -1194,19 +1188,19 @@ char MPLAYER_LIBDIR[100]; #define CONFIG_RTP_PROTOCOL 0 #define CONFIG_TCP_PROTOCOL 1 #define CONFIG_UDP_PROTOCOL 0 -#define CONFIG_AAC_ADTSTOASC_BSF 1 -#define CONFIG_CHOMP_BSF 1 -#define CONFIG_DUMP_EXTRADATA_BSF 1 -#define CONFIG_H264_MP4TOANNEXB_BSF 1 -#define CONFIG_IMX_DUMP_HEADER_BSF 1 -#define CONFIG_MJPEG2JPEG_BSF 1 -#define CONFIG_MJPEGA_DUMP_HEADER_BSF 1 -#define CONFIG_MP3_HEADER_COMPRESS_BSF 1 -#define CONFIG_MP3_HEADER_DECOMPRESS_BSF 1 -#define CONFIG_MOV2TEXTSUB_BSF 1 -#define CONFIG_NOISE_BSF 1 -#define CONFIG_REMOVE_EXTRADATA_BSF 1 -#define CONFIG_TEXT2MOVSUB_BSF 1 +#define CONFIG_AAC_ADTSTOASC_BSF 0 +#define CONFIG_CHOMP_BSF 0 +#define CONFIG_DUMP_EXTRADATA_BSF 0 +#define CONFIG_H264_MP4TOANNEXB_BSF 0 +#define CONFIG_IMX_DUMP_HEADER_BSF 0 +#define CONFIG_MJPEG2JPEG_BSF 0 +#define CONFIG_MJPEGA_DUMP_HEADER_BSF 0 +#define CONFIG_MP3_HEADER_COMPRESS_BSF 0 +#define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0 +#define CONFIG_MOV2TEXTSUB_BSF 0 +#define CONFIG_NOISE_BSF 0 +#define CONFIG_REMOVE_EXTRADATA_BSF 0 +#define CONFIG_TEXT2MOVSUB_BSF 0 #define CONFIG_H263_VAAPI_HWACCEL 0 #define CONFIG_H264_DXVA2_HWACCEL 0 #define CONFIG_H264_VAAPI_HWACCEL 0 diff --git a/mplayer/config.mak b/mplayer/config.mak index 81825390..fbdc1ab0 100644 --- a/mplayer/config.mak +++ b/mplayer/config.mak @@ -32,7 +32,6 @@ CXXFLAGS = -Wundef -Wall -Wno-switch -Wno-parentheses -Wpointer-arith -Wredundan CC_DEPFLAGS = -MD -MP -O3 -meabi -mrvl -mcpu=750 -mtune=750 -mhard-float -mdouble-float -mpaired -pipe -g -ffast-math CFLAGS_DHAHELPER = -CFLAGS_FAAD_FIXED = CFLAGS_LIBDVDCSS = CFLAGS_LIBDVDCSS_DVDREAD = -Ilibdvdcss CFLAGS_LIBDVDNAV = -Ilibdvdnav @@ -106,7 +105,6 @@ ESD = no FAAC=no GEKKO = yes FAAD = no -FAAD_INTERNAL = no FASTMEMCPY = yes FBDEV = no FREETYPE = yes @@ -152,7 +150,7 @@ LIBTHEORA = no LIRC = no LIVE555 = no MACOSX_FINDER = no -MD5SUM = no +MD5SUM = yes MGA = no MNG = no MP3LAME = no @@ -293,9 +291,8 @@ CONFIG_ZLIB = yes HAVE_GNU_AS = no HAVE_PTHREADS = no -HAVE_SHM = yes +HAVE_SHM = no HAVE_W32THREADS = no -HAVE_GEKKOTHREADS = yes HAVE_YASM = no CONFIG_AASC_DECODER=yes @@ -437,6 +434,7 @@ CONFIG_WMV2_DECODER=yes CONFIG_WMV3_DECODER=yes CONFIG_WNV1_DECODER=yes CONFIG_XAN_WC3_DECODER=yes +CONFIG_XAN_WC4_DECODER=yes CONFIG_XL_DECODER=yes CONFIG_YOP_DECODER=yes CONFIG_ZLIB_DECODER=yes @@ -788,7 +786,7 @@ CONFIG_RPL_DEMUXER=yes CONFIG_RSO_DEMUXER=yes CONFIG_RTP_DEMUXER=no CONFIG_RTSP_DEMUXER=no -CONFIG_SAP_DEMUXER=yes +CONFIG_SAP_DEMUXER=no CONFIG_SDP_DEMUXER=no CONFIG_SEGAFILM_DEMUXER=yes CONFIG_SHORTEN_DEMUXER=yes @@ -937,17 +935,17 @@ CONFIG_RTMPS_PROTOCOL=yes CONFIG_RTP_PROTOCOL=no CONFIG_TCP_PROTOCOL=yes CONFIG_UDP_PROTOCOL=no -CONFIG_AAC_ADTSTOASC_BSF=yes -CONFIG_CHOMP_BSF=yes -CONFIG_DUMP_EXTRADATA_BSF=yes -CONFIG_H264_MP4TOANNEXB_BSF=yes -CONFIG_IMX_DUMP_HEADER_BSF=yes -CONFIG_MJPEG2JPEG_BSF=yes -CONFIG_MJPEGA_DUMP_HEADER_BSF=yes -CONFIG_MP3_HEADER_COMPRESS_BSF=yes -CONFIG_MP3_HEADER_DECOMPRESS_BSF=yes -CONFIG_MOV2TEXTSUB_BSF=yes -CONFIG_NOISE_BSF=yes -CONFIG_REMOVE_EXTRADATA_BSF=yes -CONFIG_TEXT2MOVSUB_BSF=yes +CONFIG_AAC_ADTSTOASC_BSF=no +CONFIG_CHOMP_BSF=no +CONFIG_DUMP_EXTRADATA_BSF=no +CONFIG_H264_MP4TOANNEXB_BSF=no +CONFIG_IMX_DUMP_HEADER_BSF=no +CONFIG_MJPEG2JPEG_BSF=no +CONFIG_MJPEGA_DUMP_HEADER_BSF=no +CONFIG_MP3_HEADER_COMPRESS_BSF=no +CONFIG_MP3_HEADER_DECOMPRESS_BSF=no +CONFIG_MOV2TEXTSUB_BSF=no +CONFIG_NOISE_BSF=no +CONFIG_REMOVE_EXTRADATA_BSF=no +CONFIG_TEXT2MOVSUB_BSF=no CONFIG_=yes diff --git a/mplayer/configure b/mplayer/configure index c748276f..670133f1 100644 --- a/mplayer/configure +++ b/mplayer/configure @@ -35,6 +35,29 @@ # ############################################################################# +if test -e ffmpeg/.svn ; then + echo "You have an outdated FFmpeg SVN checkout in ffmpeg/, please (re)move or replace it" + exit 1 +fi + +if test -e ffmpeg/mp_auto_pull ; then + if ! (cd ffmpeg && git pull --rebase --ff-only) ; then + echo "git pull failed, (re)move ffmpeg/mp_auto_pull to disable pulling" + exit 1 + fi +fi + +if ! test -e ffmpeg ; then + echo "No FFmpeg checkout, press enter to download one with git or CTRL+C to abort" + read tmp + if ! git clone --depth 1 git://git.videolan.org/ffmpeg.git ffmpeg ; then + rm -rf ffmpeg + echo "Failed to get a FFmpeg checkout" + exit 1 + fi + touch ffmpeg/mp_auto_pull +fi + # Prevent locale nonsense from breaking basic text processing utils export LC_ALL=C @@ -73,6 +96,24 @@ EOF compile_check $TMPC $@ } +header_check() { + cat > $TMPC << EOF +#include <$1> +int main(void) { return 0; } +EOF + shift + compile_check $TMPC $@ +} + +return_check() { + cat > $TMPC << EOF +#include <$1> +int main(void) { return $2; } +EOF + shift 2 + compile_check $TMPC $@ +} + statement_check() { cat > $TMPC << EOF #include <$1> @@ -83,12 +124,22 @@ EOF compile_check $TMPC $@ } -header_check() { +define_statement_check() { + cat > $TMPC << EOF +#define $1 +#include <$2> +int main(void) { $3; return 0; } +EOF + shift 3 + compile_check $TMPC $@ +} + +return_statement_check() { cat > $TMPC << EOF #include <$1> -int main(void) { return 0; } +int main(void) { $2; return $3; } EOF - shift + shift 3 compile_check $TMPC $@ } @@ -358,9 +409,7 @@ Codecs: --disable-speex disable Speex support [autodetect] --disable-libgsm disable libgsm support [autodetect] --enable-theora enable OggTheora libraries [autodetect] - --enable-faad enable external FAAD2 (AAC) [autodetect] - --disable-faad-internal disable internal FAAD2 (AAC) [autodetect] - --enable-faad-fixed enable fixed-point mode in internal FAAD2 [disabled] + --enable-faad enable FAAD2 (AAC) [autodetect] --disable-faac disable support for FAAC (AAC encoder) [autodetect] --disable-faac-lavc disable support for FAAC in libavcodec [autodetect] --disable-ladspa disable LADSPA plugin support [autodetect] @@ -378,7 +427,7 @@ Codecs: --disable-liba52 disable liba52 [autodetect] --disable-libmpeg2 disable libmpeg2 [autodetect] --disable-libmpeg2-internal disable builtin libmpeg2 [autodetect] - --disable-musepack disable musepack support [autodetect] + --enable-musepack enable libmpcdec support (deprecated in favour of libavcodec) [disabled] --disable-libopencore_amrnb disable libopencore_amr narrowband [autodetect] --disable-libopencore_amrwb disable libopencore_amr wideband [autodetect] --disable-libopenjpeg disable OpenJPEG (JPEG2000) input/output support [autodetect] @@ -669,8 +718,6 @@ _libdca=auto _libmpeg2=auto _libmpeg2_internal=auto _faad=auto -_faad_internal=auto -_faad_fixed=no _faac=auto _faac_lavc=auto _ladspa=auto @@ -782,7 +829,7 @@ _enca=auto _inet6=auto _gethostbyname2=auto _ftp=auto -_musepack=auto +_musepack=no _vstream=auto _pthreads=auto _w32threads=auto @@ -796,7 +843,7 @@ def_dos_paths="#define HAVE_DOS_PATHS 0" def_stream_cache="#define CONFIG_STREAM_CACHE 1" def_priority="#undef CONFIG_PRIORITY" def_pthread_cache="#undef PTHREAD_CACHE" -_need_shmem=yes +need_shmem=yes for ac_option do case "$ac_option" in --help|-help|-h) @@ -1076,10 +1123,6 @@ for ac_option do --disable-musepack) _musepack=no ;; --enable-faad) _faad=yes ;; --disable-faad) _faad=no ;; - --enable-faad-internal) _faad_internal=yes ;; - --disable-faad-internal) _faad_internal=no ;; - --enable-faad-fixed) _faad_fixed=yes ;; - --disable-faad-fixed) _faad_fixed=no ;; --enable-faac) _faac=yes ;; --disable-faac) _faac=no ;; --enable-faac-lavc) _faac_lavc=yes ;; @@ -1519,15 +1562,9 @@ if win32 ; then def_priority="#define CONFIG_PRIORITY 1" fi -if cygwin ; then - # e.g. priority.c needs _WIN32 define, but - # latest cygwin no longer defines it - extra_cflags="-D_WIN32 $extra_cflags" -fi - if mingw32 ; then _getch=getch2-win.c - _need_shmem=no + need_shmem=no fi if amigaos ; then @@ -1545,7 +1582,7 @@ fi if os2 ; then _exesuf=".exe" _getch=getch2-os2.c - _need_shmem=no + need_shmem=no _priority=yes def_dos_paths="#define HAVE_DOS_PATHS 1" def_priority="#define CONFIG_PRIORITY 1" @@ -2518,8 +2555,8 @@ __attribute__((noinline)) static int foo3(int i1, int i2, int i3) { return i3; } int main(void) { return foo3(1, 2, 3) == 3 ? 0 : 1; } EOF cc_check -O4 -mstackrealign && tmp_run && cflags_stackrealign=-mstackrealign - test -z "$cflags_stackrealign" && cc_check -O4 -mstackrealign -fno-unit-at-a-time \ - && tmp_run && cflags_stackrealign="-mstackrealign -fno-unit-at-a-time" + test -z "$cflags_stackrealign" && cc_check -O4 -mstackrealign -fno-unit-at-a-time && + tmp_run && cflags_stackrealign="-mstackrealign -fno-unit-at-a-time" test -n "$cflags_stackrealign" && echores "yes" || echores "no" fi # if darwin && test "$cc_vendor" = "gnu" ; then @@ -2562,7 +2599,7 @@ else fi cflag_check -mno-omit-leaf-frame-pointer && cflags_no_omit_leaf_frame_pointer="-mno-omit-leaf-frame-pointer" -cflag_check -MD -MP && DEPFLAGS="-MD -MP $CFLAGS" +cflag_check -MD -MP && DEPFLAGS="-MD -MP" if test -n "$LDFLAGS" ; then @@ -2856,7 +2893,7 @@ if arm ; then _armv6t2=no inline_asm_check '"movt r0, #0"' && _armv6t2=yes fi - echores "$_armv6" + echores "$_armv6t2" echocheck "ARM VFP" if test $_armvfp = "auto" ; then @@ -3096,13 +3133,8 @@ done echocheck "mkstemp" -cat > $TMPC << EOF -#define _XOPEN_SOURCE 500 -#include -int main(void) { mkstemp(""); return 0; } -EOF _mkstemp=no -cc_check && _mkstemp=yes +define_statement_check "_XOPEN_SOURCE 600" "stdlib.h" 'mkstemp("")' && _mkstemp=yes if test "$_mkstemp" = yes ; then def_mkstemp='#define HAVE_MKSTEMP 1' else @@ -3257,7 +3289,7 @@ cat > $TMPC << EOF #endif int main(void) { const void *p = &((struct sockaddr *)0)->sa_len; return 0; } EOF -cc_check $cc_check_winsock2_h && _struct_sockaddr_sa_len=yes && \ +cc_check $cc_check_winsock2_h && _struct_sockaddr_sa_len=yes && def_struct_sockaddr_sa_len="#define HAVE_STRUCT_SOCKADDR_SA_LEN 1" echores "$_struct_sockaddr_sa_len" @@ -3344,7 +3376,7 @@ echocheck "inet6" if test "$_inet6" = auto ; then cat > $TMPC << EOF #include -#if !defined(_WIN32) || defined(__CYGWIN__) +#if !defined(_WIN32) #include #include #else @@ -3386,6 +3418,14 @@ fi echores "$_gethostbyname2" +echocheck "sys/poll.h" +poll_h=no +def_poll_h='#define HAVE_POLL_H 0' +header_check sys/poll.h && poll_h=yes && + def_poll_h='#define HAVE_POLL_H 1' +echores "$poll_h" + + echocheck "inttypes.h (required)" _inttypes=no header_check inttypes.h && _inttypes=yes @@ -3403,12 +3443,8 @@ fi echocheck "int_fastXY_t in inttypes.h" -cat > $TMPC << EOF -#include -int main(void) { volatile int_fast16_t v = 0; return v; } -EOF _fast_inttypes=no -cc_check && _fast_inttypes=yes +statement_check "inttypes.h" 'volatile int_fast16_t v = 0' && _fast_inttypes=yes if test "$_fast_inttypes" = no ; then def_fast_inttypes=' typedef signed char int_fast8_t; @@ -3452,12 +3488,8 @@ echores "$_memalign" echocheck "posix_memalign()" posix_memalign=no def_posix_memalign='#define HAVE_POSIX_MEMALIGN 0' -cat > $TMPC << EOF -#define _XOPEN_SOURCE 600 -#include -int main(void) { posix_memalign(NULL, 0, 0); } -EOF -cc_check && posix_memalign=yes && def_posix_memalign='#define HAVE_POSIX_MEMALIGN 1' +define_statement_check "_XOPEN_SOURCE 600" "stdlib.h" 'posix_memalign(NULL, 0, 0)' && + posix_memalign=yes && def_posix_memalign='#define HAVE_POSIX_MEMALIGN 1' echores "$posix_memalign" @@ -3495,10 +3527,12 @@ echocheck "mman.h" _mman=no statement_check sys/mman.h 'mmap(0, 0, 0, 0, 0, 0)' && _mman=yes if test "$_mman" = yes ; then + def_mmap='#define HAVE_MMAP 1' def_mman_h='#define HAVE_SYS_MMAN_H 1' else + def_mmap='#define HAVE_MMAP 0' def_mman_h='#undef HAVE_SYS_MMAN_H' - os2 && _need_mmap=yes + os2 && need_mmap=yes fi echores "$_mman" @@ -3564,7 +3598,7 @@ if test "$_pthreads" = yes ; then extra_cflags="$extra_cflags $THREAD_CFLAGS" else res_comment="v4l, v4l2, ao_nas, win32 loader disabled" - def_pthreads='#undef HAVE_PTHREADS' + def_pthreads='#define HAVE_PTHREADS 0' _nas=no ; _tv_v4l1=no ; _tv_v4l2=no mingw32 || _win32dll=no fi @@ -3636,7 +3670,7 @@ int main(void) { EOF _iconv=no for _ld_tmp in "" "-liconv" "-liconv $_ld_dl" ; do - cc_check $_ld_lm $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" && \ + cc_check $_ld_lm $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" && _iconv=yes && break done fi @@ -3797,12 +3831,8 @@ echores "$_termios" echocheck "shm" if test "$_shm" = auto ; then - cat > $TMPC << EOF -#include -int main(void) { shmget(0, 0, 0); shmat(0, 0, 0); shmctl(0, 0, 0); return 0; } -EOF _shm=no - cc_check && _shm=yes + statement_check sys/shm.h 'shmget(0, 0, 0); shmat(0, 0, 0); shmctl(0, 0, 0)' && _shm=yes fi if test "$_shm" = yes ; then def_shm='#define HAVE_SHM 1' @@ -3813,18 +3843,14 @@ echores "$_shm" echocheck "strsep()" -cat > $TMPC << EOF -#include -int main(void) { char *s = "Hello, world!"; strsep(&s, ","); return 0; } -EOF _strsep=no -cc_check && _strsep=yes +statement_check string.h 'char *s = "Hello, world!"; strsep(&s, ",")' && _strsep=yes if test "$_strsep" = yes ; then def_strsep='#define HAVE_STRSEP 1' - _need_strsep=no + need_strsep=no else def_strsep='#undef HAVE_STRSEP' - _need_strsep=yes + need_strsep=yes fi echores "$_strsep" @@ -3834,34 +3860,29 @@ cat > $TMPC << EOF #define _ISOC99_SOURCE #include #include -int main(void) { va_list ap = NULL; vsscanf("foo", "bar", ap); return 0; } +int main(void) { va_list ap = { 0 }; vsscanf("foo", "bar", ap); return 0; } EOF _vsscanf=no cc_check && _vsscanf=yes if test "$_vsscanf" = yes ; then def_vsscanf='#define HAVE_VSSCANF 1' - _need_vsscanf=no + need_vsscanf=no else def_vsscanf='#undef HAVE_VSSCANF' - _need_vsscanf=yes + need_vsscanf=yes fi echores "$_vsscanf" echocheck "swab()" -cat > $TMPC << EOF -#define _XOPEN_SOURCE 600 -#include -int main(void) { int a, b; swab(&a, &b, 0); return 0; } -EOF _swab=no -cc_check && _swab=yes +define_statement_check "_XOPEN_SOURCE 600" "unistd.h" 'int a, b; swab(&a, &b, 0)' && _swab=yes if test "$_swab" = yes ; then def_swab='#define HAVE_SWAB 1' - _need_swab=no + need_swab=no else def_swab='#undef HAVE_SWAB' - _need_swab=yes + need_swab=yes fi echores "$_swab" @@ -3878,8 +3899,8 @@ EOF _posix_select=no def_posix_select='#undef HAVE_POSIX_SELECT' #select() of kLIBC (OS/2) supports socket only -! os2 && cc_check && _posix_select=yes \ - && def_posix_select='#define HAVE_POSIX_SELECT 1' +! os2 && cc_check && _posix_select=yes && + def_posix_select='#define HAVE_POSIX_SELECT 1' echores "$_posix_select" @@ -3893,18 +3914,14 @@ echores "$_select" echocheck "gettimeofday()" -cat > $TMPC << EOF -#include -int main(void) {struct timeval tv; struct timezone tz; gettimeofday(&tv, &tz); return 0; } -EOF _gettimeofday=no -cc_check && _gettimeofday=yes +statement_check sys/time.h 'struct timeval tv; struct timezone tz; gettimeofday(&tv, &tz)' && _gettimeofday=yes if test "$_gettimeofday" = yes ; then def_gettimeofday='#define HAVE_GETTIMEOFDAY 1' - _need_gettimeofday=no + need_gettimeofday=no else def_gettimeofday='#undef HAVE_GETTIMEOFDAY' - _need_gettimeofday=yes + need_gettimeofday=yes fi echores "$_gettimeofday" @@ -3914,10 +3931,10 @@ _glob=no statement_check glob.h 'glob("filename", 0, 0, 0)' && _glob=yes if test "$_glob" = yes ; then def_glob='#define HAVE_GLOB 1' - _need_glob=no + need_glob=no else def_glob='#undef HAVE_GLOB' - _need_glob=yes + need_glob=yes fi echores "$_glob" @@ -3927,10 +3944,10 @@ _setenv=no statement_check stdlib.h 'setenv("", "", 0)' && _setenv=yes if test "$_setenv" = yes ; then def_setenv='#define HAVE_SETENV 1' - _need_setenv=no + need_setenv=no else def_setenv='#undef HAVE_SETENV' - _need_setenv=yes + need_setenv=yes fi echores "$_setenv" @@ -3948,11 +3965,7 @@ _sysi86=no statement_check sys/sysi86.h 'sysi86(0)' && _sysi86=yes if test "$_sysi86" = yes ; then def_sysi86='#define HAVE_SYSI86 1' - cat > $TMPC << EOF -#include -int main(void) { int sysi86(int, void*); sysi86(0); return 0; } -EOF - cc_check && def_sysi86_iv='#define HAVE_SYSI86_iv 1' + statement_check sys/sysi86.h 'int sysi86(int, void*); sysi86(0)' && def_sysi86_iv='#define HAVE_SYSI86_iv 1' else def_sysi86='#undef HAVE_SYSI86' fi @@ -3961,12 +3974,8 @@ fi #if sunos echocheck "sys/sysinfo.h" -cat > $TMPC << EOF -#include -int main(void) { struct sysinfo s_info; sysinfo(&s_info); return 0; } -EOF _sys_sysinfo=no -cc_check && _sys_sysinfo=yes +statement_check sys/sysinfo.h 'struct sysinfo s_info; sysinfo(&s_info)' && _sys_sysinfo=yes if test "$_sys_sysinfo" = yes ; then def_sys_sysinfo_h='#define HAVE_SYS_SYSINFO_H 1' else @@ -4038,11 +4047,7 @@ if linux; then echocheck "Apple IR" if test "$_apple_ir" = auto ; then _apple_ir=no - cat > $TMPC < -int main(void) { struct input_event ev; struct input_id id; return 0; } -EOF - cc_check && _apple_ir=yes + statement_check linux/input.h 'struct input_event ev; struct input_id id' && _apple_ir=yes fi if test "$_apple_ir" = yes ; then def_apple_ir='#define CONFIG_APPLE_IR 1' @@ -4297,13 +4302,8 @@ echores "$_x11" echocheck "Xss screensaver extensions" if test "$_xss" = auto ; then - cat > $TMPC << EOF -#include -#include -int main(void) { XScreenSaverSuspend(NULL, True); return 0; } -EOF _xss=no - cc_check -lXss && _xss=yes + statement_check "X11/extensions/scrnsaver.h" 'XScreenSaverSuspend(NULL, True)' -lXss && _xss=yes fi if test "$_xss" = yes ; then def_xss='#define CONFIG_XSS 1' @@ -4393,13 +4393,7 @@ echocheck "VDPAU" if test "$_vdpau" = auto ; then _vdpau=no if test "$_dl" = yes ; then - cat > $TMPC < -int main(void) { - vdp_device_create_x11(0, 0, 0, 0); - return VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1; } -EOF - cc_check -lvdpau && _vdpau=yes + return_statement_check vdpau/vdpau_x11.h 'vdp_device_create_x11(0, 0, 0, 0)' VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 -lvdpau && _vdpau=yes fi fi if test "$_vdpau" = yes ; then @@ -4454,11 +4448,7 @@ echores "$_vm" echocheck "XF86keysym" if test "$_xf86keysym" = auto; then _xf86keysym=no - cat > $TMPC < -int main(void) { return XF86XK_AudioPause; } -EOF - cc_check && _xf86keysym=yes + return_check X11/XF86keysym.h XF86XK_AudioPause && _xf86keysym=yes fi if test "$_xf86keysym" = yes ; then def_xf86keysym='#define CONFIG_XF86XK 1' @@ -4558,8 +4548,8 @@ def_vidix_drv_unichrome='#undef CONFIG_VIDIX_DRV_UNICHROME' _vidix_drv_unichrome=no if test "$_vidix" = auto ; then _vidix=no - x86 && (linux || freebsd || netbsd || openbsd || dragonfly || sunos || win32) \ - && _vidix=yes + x86 && (linux || freebsd || netbsd || openbsd || dragonfly || sunos || win32) && _vidix=yes + win32 && ! header_check ddk/ntddk.h && _vidix=no x86_64 && ! linux && _vidix=no (ppc || alpha) && linux && _vidix=yes fi @@ -4754,7 +4744,7 @@ cat >$TMPC << EOF int main(void) {return 0;} EOF for _inc_tmp in "" "-I/usr/src/DVB/include" ; do - cc_check $_inc_tmp && _dvb=yes && \ + cc_check $_inc_tmp && _dvb=yes && extra_cflags="$extra_cflags $_inc_tmp" && break done fi @@ -4780,17 +4770,8 @@ if darwin; then echocheck "QuickTime" if test "$quicktime" = auto ; then - cat > $TMPC < -int main(void) { - ImageDescription *desc; - EnterMovies(); - ExitMovies(); - return 0; -} -EOF quicktime=no - cc_check -framework QuickTime && quicktime=yes + statement_check QuickTime/QuickTime.h 'ImageDescription *desc; EnterMovies(); ExitMovies()' -framework QuickTime && quicktime=yes fi if test "$quicktime" = yes ; then extra_ldflags="$extra_ldflags -framework QuickTime" @@ -4873,16 +4854,7 @@ fi echocheck "MNG support" if test "$_mng" = auto ; then _mng=no - cat > $TMPC << EOF -#include -int main(void) { - const char * p_ver = mng_version_text(); - return !p_ver || p_ver[0] == 0; -} -EOF - if cc_check -lmng -lz $_ld_lm ; then - _mng=yes - fi + return_statement_check libmng.h 'const char * p_ver = mng_version_text()' '!p_ver || p_ver[0] == 0' -lmng -lz $_ld_lm && _mng=yes fi echores "$_mng" if test "$_mng" = yes ; then @@ -4912,12 +4884,7 @@ fi echocheck "OpenJPEG (JPEG2000) support" if test "$libopenjpeg" = auto ; then libopenjpeg=no -cat > $TMPC << EOF -#define OPJ_STATIC -#include -int main(void) { opj_dparameters_t dec_params; opj_set_default_decoder_parameters(&dec_params); return 0; } -EOF - cc_check -lopenjpeg $_ld_lm && libopenjpeg=yes + define_statement_check OPJ_STATIC openjpeg.h 'opj_dparameters_t dec_params; opj_set_default_decoder_parameters(&dec_params)' -lopenjpeg $_ld_lm && libopenjpeg=yes fi echores "$libopenjpeg" if test "$libopenjpeg" = yes ; then @@ -5342,6 +5309,7 @@ echores "$_dxr3" echocheck "IVTV TV-Out (pre linux-2.6.24)" if test "$_ivtv" = auto ; then cat > $TMPC << EOF +#include #include #include #include @@ -5370,6 +5338,7 @@ echores "$_ivtv" echocheck "V4L2 MPEG Decoder" if test "$_v4l2" = auto ; then cat > $TMPC << EOF +#include #include #include int main(void) { @@ -5404,12 +5373,8 @@ echores "$_v4l2" echocheck "OSS Audio" if test "$_ossaudio" = auto ; then - cat > $TMPC << EOF -#include <$_soundcard_header> -int main(void) { return SNDCTL_DSP_SETFRAGMENT; } -EOF _ossaudio=no - cc_check && _ossaudio=yes + return_check $_soundcard_header SNDCTL_DSP_SETFRAGMENT && _ossaudio=yes fi if test "$_ossaudio" = yes ; then def_ossaudio='#define CONFIG_OSS_AUDIO 1' @@ -5856,10 +5821,10 @@ echocheck "dvdread" if test "$_dvdread_internal" = auto ; then _dvdread_internal=no _dvdread=no - if (linux || freebsd || netbsd || openbsd || dragonfly || sunos || hpux) \ - && (test "$_dvd" = yes || test "$_cdrom" = yes || test "$_cdio" = yes || \ - test "$_dvdio" = yes || test "$_bsdi_dvd" = yes) \ - || darwin || win32 || os2; then + if (linux || freebsd || netbsd || openbsd || dragonfly || sunos || hpux) && + (test "$_dvd" = yes || test "$_cdrom" = yes || test "$_cdio" = yes || + test "$_dvdio" = yes || test "$_bsdi_dvd" = yes) || + darwin || win32 || os2; then _dvdread_internal=yes _dvdread=yes extra_cflags="-Ilibdvdread4 $extra_cflags" @@ -5938,7 +5903,7 @@ int main(void) { void *test = cdda_verbose_set; return test == (void *)1; } EOF _cdparanoia=no for _inc_tmp in "" "-I/usr/include/cdda" "-I/usr/local/include/cdda" ; do - cc_check $_inc_tmp -lcdda_interface -lcdda_paranoia $_ld_lm && \ + cc_check $_inc_tmp -lcdda_interface -lcdda_paranoia $_ld_lm && _cdparanoia=yes && extra_cflags="$extra_cflags $_inc_tmp" && break done fi @@ -5966,14 +5931,14 @@ EOF _libcdio=no for _ld_tmp in "" "-lwinmm" ; do _ld_tmp="-lcdio_cdda -lcdio -lcdio_paranoia $_ld_tmp" - cc_check $_ld_tmp $_ld_lm \ - && _libcdio=yes && extra_ldflags="$extra_ldflags $_ld_tmp" && break + cc_check $_ld_tmp $_ld_lm && _libcdio=yes && + extra_ldflags="$extra_ldflags $_ld_tmp" && break done if test "$_libcdio" = no && $_pkg_config --exists libcdio_paranoia ; then _inc_tmp=$($_pkg_config --cflags libcdio_paranoia) _ld_tmp=$($_pkg_config --libs libcdio_paranoia) - cc_check $_inc_tmp $_ld_tmp $_ld_lm && _libcdio=yes \ - && extra_ldflags="$extra_ldflags $_ld_tmp" && extra_cflags="$extra_cflags $_inc_tmp" + cc_check $_inc_tmp $_ld_tmp $_ld_lm && _libcdio=yes && + extra_ldflags="$extra_ldflags $_ld_tmp" && extra_cflags="$extra_cflags $_inc_tmp" fi fi if test "$_libcdio" = yes && test "$_cdparanoia" = no ; then @@ -6084,8 +6049,8 @@ EOF if test "$_fontconfig" = no && $_pkg_config --exists fontconfig ; then _inc_tmp=$($_pkg_config --cflags fontconfig) _ld_tmp=$($_pkg_config --libs fontconfig) - cc_check $_inc_tmp $_ld_tmp && _fontconfig=yes \ - && extra_ldflags="$extra_ldflags $_ld_tmp" && extra_cflags="$extra_cflags $_inc_tmp" + cc_check $_inc_tmp $_ld_tmp && _fontconfig=yes && + extra_ldflags="$extra_ldflags $_ld_tmp" && extra_cflags="$extra_cflags $_inc_tmp" fi fi if test "$_fontconfig" = yes ; then @@ -6330,7 +6295,9 @@ elif test "$_tremor" = auto; then fi if test "$_libvorbis" = auto; then _libvorbis=no - statement_check vorbis/codec.h 'vorbis_packet_blocksize(0, 0)' -lvorbis -logg $_ld_lm && _libvorbis=yes + for vorbislibs in '-lvorbis -logg' '-lvorbis -lvorbisenc -logg' ; do + statement_check vorbis/vorbisenc.h 'vorbis_encode_ctl(0, 0, 0)' $vorbislibs $_ld_lm && _libvorbis=yes && break + done fi if test "$_tremor_internal" = yes ; then _vorbis=yes @@ -6354,7 +6321,7 @@ elif test "$_libvorbis" = yes ; then def_vorbis='#define CONFIG_OGGVORBIS 1' codecmodules="libvorbis $codecmodules" res_comment="libvorbis" - extra_ldflags="$extra_ldflags -lvorbis -logg" + extra_ldflags="$extra_ldflags $vorbislibs" libavencoders="$libavencoders LIBVORBIS_ENCODER" else _vorbis=no @@ -6569,7 +6536,7 @@ fi echores "$_libdca" echocheck "libmpcdec (musepack, version >= 1.2.1 required)" -if test "$_musepack" = auto ; then +if test "$_musepack" = yes ; then _musepack=no cat > $TMPC << EOF #include @@ -6627,27 +6594,8 @@ echores "$_faac" echocheck "FAAD2 support" -if test "$_faad_internal" = auto ; then - if cygwin ; then - _faad_internal=no - res_comment="does not compile on cygwin" - elif x86_32 && test cc_vendor=gnu; then - case $cc_version in - 3.1*|3.2) # ICE/insn with these versions - _faad_internal=no - res_comment="broken gcc" - ;; - *) - _faad=yes - _faad_internal=yes - ;; - esac - else - _faad=yes - _faad_internal=yes - fi -fi if test "$_faad" = auto ; then + _faad=no cat > $TMPC << EOF #include #ifndef FAAD_MIN_STREAMSIZE @@ -6660,29 +6608,11 @@ EOF fi def_faad='#undef CONFIG_FAAD' -def_faad_internal="#undef CONFIG_FAAD_INTERNAL" -if test "$_faad_internal" = yes ; then - def_faad_internal="#define CONFIG_FAAD_INTERNAL 1" - res_comment="internal floating-point" - if test "$_faad_fixed" = yes ; then - # The FIXED_POINT implementation of FAAD2 improves performance - # on some platforms, especially for SBR files. - cflags_faad_fixed="-DFIXED_POINT" - res_comment="internal fixed-point" - fi -elif test "$_faad" = yes ; then - extra_ldflags="$extra_ldflags -lfaad" -fi - if test "$_faad" = yes ; then def_faad='#define CONFIG_FAAD 1' - if test "$_faad_internal" = yes ; then - codecmodules="faad2(internal) $codecmodules" - else - codecmodules="faad2 $codecmodules" - fi + extra_ldflags="$extra_ldflags -lfaad" + codecmodules="faad2 $codecmodules" else - _faad=no nocodecmodules="faad2 $nocodecmodules" fi echores "$_faad" @@ -6866,8 +6796,8 @@ EOF _live=no for I in $extra_cflags "-I$_libdir/live" "-I/usr/lib/live" "-I/usr/lib64/live" "-I/usr/local/live" "-I/usr/local/lib/live" ; do - cxx_check $I/liveMedia/include $I/UsageEnvironment/include \ - $I/groupsock/include && _livelibdir=$(echo $I| sed s/-I//) && \ + cxx_check $I/liveMedia/include $I/UsageEnvironment/include $I/groupsock/include && + _livelibdir=$(echo $I| sed s/-I//) && extra_ldflags="$_livelibdir/liveMedia/libliveMedia.a \ $_livelibdir/groupsock/libgroupsock.a \ $_livelibdir/UsageEnvironment/libUsageEnvironment.a \ @@ -6876,7 +6806,7 @@ EOF extra_cxxflags="-I$_livelibdir/liveMedia/include \ -I$_livelibdir/UsageEnvironment/include \ -I$_livelibdir/BasicUsageEnvironment/include \ - -I$_livelibdir/groupsock/include" && \ + -I$_livelibdir/groupsock/include" && _live=yes && break done if test "$_live" != yes ; then @@ -6895,8 +6825,7 @@ elif test "$_live_dist" = yes && test "$networking" = yes; then _live="yes" def_live='#define CONFIG_LIVE555 1' extra_ldflags="$extra_ldflags $ld_tmp" - extra_cxxflags="-I/usr/include/liveMedia -I/usr/include/UsageEnvironment \ - -I/usr/include/BasicUsageEnvironment -I/usr/include/groupsock" + extra_cxxflags="-I/usr/include/liveMedia -I/usr/include/UsageEnvironment -I/usr/include/BasicUsageEnvironment -I/usr/include/groupsock" inputmodules="live555 $inputmodules" else _live=no @@ -6912,8 +6841,8 @@ if test "$_librtmp" = auto && test "$networking" = yes ; then if test "$_librtmp" != yes && $_pkg_config --exists librtmp ; then _inc_tmp=$($_pkg_config --cflags librtmp) _ld_tmp=$($_pkg_config --libs librtmp) - cc_check $_inc_tmp $_ld_tmp && _librtmp=yes && \ - extra_ldflags="$extra_ldflags $_ld_tmp" && \ + cc_check $_inc_tmp $_ld_tmp && _librtmp=yes && + extra_ldflags="$extra_ldflags $_ld_tmp" && extra_cflags="$extra_cflags $_inc_tmp" fi fi @@ -6935,16 +6864,16 @@ test -d ffmpeg/libavutil || die "MPlayer will not compile without libavutil in the source tree." ffmpeg=no if test "$ffmpeg_a" = auto ; then - test -d ffmpeg/libavcore && ffmpeg_a=yes && ffmpeg=yes + test -d ffmpeg/libavutil && ffmpeg_a=yes && ffmpeg=yes && extra_cflags="$extra_cflags -DFF_API_MAX_STREAMS=0" elif test "$ffmpeg_so" = auto ; then ffmpeg_so=no - if $_pkg_config --exists libavcore ; then - inc_ffmpeg=$($_pkg_config --cflags libpostproc libswscale libavformat libavcodec libavutil libavcore) - _ld_tmp=$($_pkg_config --libs libpostproc libswscale libavformat libavcodec libavutil libavcore) - header_check libavcore/avcore.h $inc_ffmpeg $_ld_tmp && + if $_pkg_config --exists libavutil ; then + inc_ffmpeg=$($_pkg_config --cflags libpostproc libswscale libavformat libavcodec libavutil) + _ld_tmp=$($_pkg_config --libs libpostproc libswscale libavformat libavcodec libavutil) + header_check libavutil/avutil.h $inc_ffmpeg $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" && ffmpeg_so=yes && ffmpeg=yes - elif header_check libavcore/avcore.h -lpostproc -lswscale -lavformat -lavcodec -lavutil -lavcore $_ld_lm ; then - extra_ldflags="$extra_ldflags -lpostproc -lswscale -lavformat -lavcodec -lavutil -lavcore" + elif header_check libavutil/avutil.h -lpostproc -lswscale -lavformat -lavcodec -lavutil $_ld_lm ; then + extra_ldflags="$extra_ldflags -lpostproc -lswscale -lavformat -lavcodec -lavutil" ffmpeg_so=yes ffmpeg=yes fi @@ -6966,9 +6895,9 @@ else def_ffmpeg_so='#undef CONFIG_FFMPEG_SO' nocodecmodules="ffmpeg $nocodecmodules" fi -test "$_libavcodec_mpegaudio_hp" = yes \ - && def_libavcodec_mpegaudio_hp='#define CONFIG_MPEGAUDIO_HP 1' \ - && mak_libavcodec_mpegaudio_hp='CONFIG_MPEGAUDIO_HP = yes' +test "$_libavcodec_mpegaudio_hp" = yes && + def_libavcodec_mpegaudio_hp='#define CONFIG_MPEGAUDIO_HP 1' && + mak_libavcodec_mpegaudio_hp='CONFIG_MPEGAUDIO_HP = yes' echores "$ffmpeg" @@ -7053,11 +6982,7 @@ echores "$_xvid" echocheck "Xvid two pass plugin" if test "$_mencoder" = yes && test "$_xvid" = yes && test "$_xvid_lavc" = auto ; then - cat > $TMPC << EOF -#include -int main(void) { xvid_plugin_2pass2_t s; s.vbv_size=0; return 0; } -EOF - cc_check && _xvid_lavc=yes + statement_check xvid.h 'xvid_plugin_2pass2_t s; s.vbv_size = 0' && _xvid_lavc=yes fi if test "$_xvid_lavc" = yes ; then def_xvid_lavc='#define CONFIG_LIBXVID 1' @@ -7211,13 +7136,8 @@ echores "$_libvpx_lavc" echocheck "libnut" if test "$_libnut" = auto ; then - cat > $TMPC << EOF -#include -nut_context_tt * nut; -int main(void) { nut_error(0); return 0; } -EOF _libnut=no - cc_check -lnut && _libnut=yes + statement_check libnut.h 'nut_context_tt * nut; nut_error(0)' -lnut && _libnut=yes fi if test "$_libnut" = yes ; then @@ -7351,23 +7271,13 @@ EOF echocheck "*BSD ioctl_meteor.h" _ioctl_meteor_h=no - for file in "machine/ioctl_meteor.h" \ - "dev/bktr/ioctl_meteor.h" \ - "dev/video/bktr/ioctl_meteor.h" ; do - cat > $TMPC < -#include <$file> -int main(void) { ioctl(0, METEORSINPUT, 0); return 0; } -EOF - if cc_check ; then - _ioctl_meteor_h=yes - _ioctl_meteor_h_name="$file" - break; - fi + for ioctl_meteor_h_path in "machine/ioctl_meteor.h" "dev/bktr/ioctl_meteor.h" "dev/video/bktr/ioctl_meteor.h" ; do + statement_check_broken "sys/types.h" "$ioctl_meteor_h_path" 'ioctl(0, METEORSINPUT, 0)' && + _ioctl_meteor_h=yes && break done if test "$_ioctl_meteor_h" = yes ; then - def_ioctl_meteor_h_name="#define IOCTL_METEOR_H_NAME <$_ioctl_meteor_h_name>" - res_comment="using $_ioctl_meteor_h_name" + def_ioctl_meteor_h_name="#define IOCTL_METEOR_H_NAME <$ioctl_meteor_h_path>" + res_comment="using $ioctl_meteor_h_path" else def_ioctl_meteor_h_name="#undef IOCTL_METEOR_H_NAME" fi @@ -7411,15 +7321,7 @@ echocheck "DirectShow TV interface" if test "$_tv_dshow" = auto ; then _tv_dshow=no if test "$_tv" = yes && win32 ; then - cat > $TMPC < -int main(void) { - void* p; - CoCreateInstance((GUID*)&GUID_NULL, NULL, CLSCTX_INPROC_SERVER, &GUID_NULL, &p); - return 0; -} -EOF - cc_check -lole32 -luuid && _tv_dshow=yes + statement_check ole2.h 'void* p; CoCreateInstance((GUID*)&GUID_NULL, NULL, CLSCTX_INPROC_SERVER, &GUID_NULL, &p)' -lole32 -luuid && _tv_dshow=yes fi fi if test "$_tv_dshow" = yes ; then @@ -7437,7 +7339,7 @@ echocheck "Video 4 Linux TV interface" if test "$_tv_v4l1" = auto ; then _tv_v4l1=no if test "$_tv" = yes && linux ; then - header_check linux/videodev.h && _tv_v4l1=yes + header_check_broken sys/time.h linux/videodev.h && _tv_v4l1=yes fi fi if test "$_tv_v4l1" = yes ; then @@ -7457,7 +7359,7 @@ echocheck "Video 4 Linux 2 TV interface" if test "$_tv_v4l2" = auto ; then _tv_v4l2=no if test "$_tv" = yes && linux ; then - header_check linux/videodev2.h && _tv_v4l2=yes + header_check_broken sys/time.h linux/videodev2.h && _tv_v4l2=yes fi fi if test "$_tv_v4l2" = yes ; then @@ -7524,8 +7426,8 @@ else fi echores "$_radio_v4l" -if freebsd || netbsd || openbsd || dragonfly || bsdos \ - && test "$_radio" = yes && test "$_radio_bsdbt848" = auto ; then +if freebsd || netbsd || openbsd || dragonfly || bsdos && + test "$_radio" = yes && test "$_radio_bsdbt848" = auto ; then echocheck "*BSD BrookTree 848 Radio interface" _radio_bsdbt848=no cat > $TMPC < $TMPC < #include int main(void) { struct v4l2_ext_controls ext; return ext.controls->value; } EOF @@ -7658,7 +7561,7 @@ if test "$_gui" = yes ; then ! echo $libavdecoders | grep -q PNG_DECODER ; then die "The GUI requires libavcodec with PNG support (needs zlib)." fi - test "$_freetype" = no && test "$_bitmap_font" = no && \ + test "$_freetype" = no && test "$_bitmap_font" = no && die "The GUI requires either FreeType or bitmap font support." if ! win32 ; then _gui_gtk=yes @@ -8023,7 +7926,6 @@ CXXFLAGS = $WARNFLAGS $CXXFLAGS $extra_cflags $extra_cxxflags CC_DEPFLAGS = $DEPFLAGS CFLAGS_DHAHELPER = $cflags_dhahelper -CFLAGS_FAAD_FIXED = $cflags_faad_fixed CFLAGS_LIBDVDCSS = $cflags_libdvdcss CFLAGS_LIBDVDCSS_DVDREAD = $cflags_libdvdcss_dvdread CFLAGS_LIBDVDNAV = $cflags_libdvdnav @@ -8051,14 +7953,14 @@ $(mak_enable "$cpuexts_all" "$cpuexts" HAVE) MENCODER = $_mencoder MPLAYER = $_mplayer -NEED_GETTIMEOFDAY = $_need_gettimeofday -NEED_GLOB = $_need_glob -NEED_MMAP = $_need_mmap -NEED_SETENV = $_need_setenv -NEED_SHMEM = $_need_shmem -NEED_STRSEP = $_need_strsep -NEED_SWAB = $_need_swab -NEED_VSSCANF = $_need_vsscanf +NEED_GETTIMEOFDAY = $need_gettimeofday +NEED_GLOB = $need_glob +NEED_MMAP = $need_mmap +NEED_SETENV = $need_setenv +NEED_SHMEM = $need_shmem +NEED_STRSEP = $need_strsep +NEED_SWAB = $need_swab +NEED_VSSCANF = $need_vsscanf # features 3DFX = $_3dfx @@ -8092,7 +7994,6 @@ DXR3 = $_dxr3 ESD = $_esd FAAC=$_faac FAAD = $_faad -FAAD_INTERNAL = $_faad_internal FASTMEMCPY = $_fastmemcpy FBDEV = $_fbdev FREETYPE = $_freetype @@ -8297,13 +8198,14 @@ EOF ff_config_enable () { list=$(echo $1 | tr '[a-z]' '[A-Z]') item=$(echo $2 | tr '[a-z]' '[A-Z]') -_nprefix=$3; +_nprefix=$4; +_defineprefix=$3; test -z "$_nprefix" && _nprefix='CONFIG' for part in $list; do if $(echo $item | grep -q -E "(^| )$part($| )"); then - echo "#define ${_nprefix}_$part 1" + echo "${_defineprefix}define ${_nprefix}_$part 1" else - echo "#define ${_nprefix}_$part 0" + echo "${_defineprefix}define ${_nprefix}_$part 0" fi done } @@ -8357,17 +8259,11 @@ $def_fast_inttypes #define HAVE_ERRNO_H 1 /* libdvdcss + libdvdread */ #define HAVE_LIMITS_H 1 -/* libdvdcss + libfaad2 */ +/* libdvdcss */ #define HAVE_UNISTD_H 1 -/* libfaad2 + libdvdread */ +/* libdvdread */ #define STDC_HEADERS 1 #define HAVE_MEMCPY 1 -/* libfaad2 */ -#define HAVE_STDLIB_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_SYS_TYPES_H 1 /* libdvdnav */ #define READ_CACHE_TRACE 0 /* libdvdread */ @@ -8453,9 +8349,9 @@ $def_pthread_cache $def_ebx_available $def_words_endian $def_bigendian -$(ff_config_enable "$arch_all" "$arch" "ARCH") -$(ff_config_enable "$subarch_all" "$subarch" "ARCH") -$(ff_config_enable "$cpuexts_all" "$cpuexts" "HAVE") +$(ff_config_enable "$arch_all" "$arch" "#" "ARCH") +$(ff_config_enable "$subarch_all" "$subarch" "#" "ARCH") +$(ff_config_enable "$cpuexts_all" "$cpuexts" "#" "HAVE") /* Blu-ray/DVD/VCD/CD */ @@ -8484,7 +8380,6 @@ $def_vcd /* codec libraries */ $def_faac $def_faad -$def_faad_internal $def_liba52 $def_libdca $def_libdv @@ -8717,8 +8612,10 @@ $def_lrint $def_lrintf $def_mlib $def_mkstemp +$def_mmap $def_network $def_pic +$def_poll_h $def_posix_memalign $def_pthreads $def_round @@ -8746,7 +8643,6 @@ $def_yasm #define HAVE_INLINE_ASM 1 #define HAVE_ISATTY 0 #define HAVE_LDBRX 0 -#define HAVE_POLL_H 1 #define HAVE_PPC4XX 0 #define HAVE_STRERROR_R 0 #define HAVE_SYMVER_ASM_LABEL 0 @@ -8791,14 +8687,14 @@ $def_mp3lame_lavc $def_x264_lavc $def_xvid_lavc -$(ff_config_enable "$libavdecoders_all" "$libavdecoders") -$(ff_config_enable "$libavencoders_all" "$libavencoders") -$(ff_config_enable "$libavparsers_all" "$libavparsers") -$(ff_config_enable "$libavdemuxers_all" "$libavdemuxers") -$(ff_config_enable "$libavmuxers_all" "$libavmuxers") -$(ff_config_enable "$libavprotocols_all" "$libavprotocols") -$(ff_config_enable "$libavbsfs_all" "$libavbsfs") -$(ff_config_enable "$libavhwaccels_all" "$libavhwaccels") +$(ff_config_enable "$libavdecoders_all" "$libavdecoders" "#") +$(ff_config_enable "$libavencoders_all" "$libavencoders" "#") +$(ff_config_enable "$libavparsers_all" "$libavparsers" "#") +$(ff_config_enable "$libavdemuxers_all" "$libavdemuxers" "#") +$(ff_config_enable "$libavmuxers_all" "$libavmuxers" "#") +$(ff_config_enable "$libavprotocols_all" "$libavprotocols" "#") +$(ff_config_enable "$libavbsfs_all" "$libavbsfs" "#") +$(ff_config_enable "$libavhwaccels_all" "$libavhwaccels" "#") #endif /* MPLAYER_CONFIG_H */ EOF @@ -8825,10 +8721,12 @@ cmp -s "$TMPH" ffmpeg/libavutil/avconfig.h || mv -f "$TMPH" ffmpeg/libavutil/avc if x86; then # Create a skeleton config.asm with just the ARCH_ definitions for FFmpeg. > "$TMPS" +echo "%define CONFIG_GPL" >> "$TMPS" for part in $arch $subarch; do part=$(echo $part | tr '[a-z]' '[A-Z]') echo "%define ARCH_${part}" >> "$TMPS" done +echo "$(ff_config_enable "$cpuexts_all" "$cpuexts" "%" "HAVE")" >> "$TMPS" cmp -s "$TMPS" config.asm || mv -f "$TMPS" config.asm fi diff --git a/mplayer/debian/control b/mplayer/debian/control index 43aee1f5..a88cf8ef 100644 --- a/mplayer/debian/control +++ b/mplayer/debian/control @@ -15,6 +15,7 @@ Build-Depends: debhelper (>= 7), libaudio-dev, libcaca-dev, libcdparanoia-dev | libcdparanoia0-dev, + libbluray-dev, libdirectfb-dev, libdts-dev, libesd0-dev, diff --git a/mplayer/debian/copyright b/mplayer/debian/copyright index 0b13283e..926eef29 100644 --- a/mplayer/debian/copyright +++ b/mplayer/debian/copyright @@ -62,64 +62,6 @@ Copyright (c) The ffmpeg Project License: GNU Lesser General Public License, some parts GNU General Public License, GNU General Public License when combined -Name: FAAD2 -Version: 2.1 beta (20040915 CVS snapshot) + fixes and portability patches -Homepage: http://www.audiocoding.com -Directory: libfaad2 -Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -License: GNU General Public License - -Name: GSM 06.10 library -Version: patchlevel 10 -Homepage: http://kbs.cs.tu-berlin.de/~jutta/toast.html -Copyright 1992 by Jutta Degener and Carsten Bormann, Technische Universitaet Berlin -Directory: libmpcodecs/native/ -License: - Any use of this software is permitted provided that this notice is - not removed and that neither the authors nor the Technische - Universitaet Berlin are deemed to have made any representations as to - the suitability of this software for any purpose nor are held - responsible for any defects of this software. THERE IS ABSOLUTELY NO - WARRANTY FOR THIS SOFTWARE. - As a matter of courtesy, the authors request to be informed about - uses this software has found, about bugs in this software, and about - any improvements that may be of general interest. - . - As of the libgsm debian package version 1.0.13-1, the following - copyright addition has been made to the libgsm package: - . - Since the original terms of 15 years ago maybe do not make our - intentions completely clear given today's refined usage of the legal - terms, we append this additional permission: - . - Permission to use, copy, modify, and distribute this software - for any purpose with or without fee is hereby granted, - provided that this notice is not removed and that neither - the authors nor the Technische Universitaet Berlin are - deemed to have made any representations as to the suitability - of this software for any purpose nor are held responsible - for any defects of this software. THERE IS ABSOLUTELY NO - WARRANTY FOR THIS SOFTWARE. - . - Berkeley/Bremen, 05.04.2009 - Jutta Degener - Carsten Bormann - -Name: miniLZO -Version: 1.07 -Homepage: http://www.oberhumer.com/opensource/lzo/#minilzo -File: libmpcodecs/native/minilzo.c libmpcodecs/native/minilzo.h -Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer -License: GNU General Public License - -Name: liba52 -Version: 0.7.4 + patches -Homepage: http://liba52.sourceforge.net/ -Directory: liba52 -Copyright (C) 2000-2001 Michel Lespinasse -Copyright (C) 1999-2000 Aaron Holtzman -License: GNU General Public License - Name: libmpeg2 Version: 0.4.0b + patches Homepage: http://libmpeg2.sourceforge.net/ @@ -209,12 +151,6 @@ Directory: libmpdemux/genres.h Copyright (C) 2001 Jason Carter License: GNU General Public License -Name: matroxset -Version: 0.3 -Homepage: ftp://platan.vc.cvut.cz/pub/linux/matrox-latest/ -Directory: TOOLS/TVout/matroxset/ -License: GNU General Public License - Name: unrarlib Version: 0.4.0 + patches Homepage: http://www.unrarlib.org/ diff --git a/mplayer/debian/rules b/mplayer/debian/rules index 3c5eb747..25548400 100644 --- a/mplayer/debian/rules +++ b/mplayer/debian/rules @@ -154,7 +154,7 @@ clean: dh_testroot -test ! -f config.mak || ( $(MAKE) -C DOCS/xml releaseclean ; $(MAKE) distclean ) # in case the previous command fails for some reason, remove 'svn ignored' files - rm -rf DOCS/HTML DOCS/HTML-single DOCS/codecs-status.html + rm -rf DOCS/HTML DOCS/codecs-status.html # Build architecture-independent packages binary-indep: install-indep diff --git a/mplayer/etc/codecs.conf b/mplayer/etc/codecs.conf index 9ee2fd86..72e5f600 100644 --- a/mplayer/etc/codecs.conf +++ b/mplayer/etc/codecs.conf @@ -986,6 +986,8 @@ videocodec ffh264 fourcc avc1,AVC1 fourcc davc,DAVC fourcc vvvc ; only one sample using this fourcc + fourcc ai55,ai15 ; flip4mac avc intra + fourcc ai1q,ai5q ; flip4mac avc intra format 0x10000005 driver ffmpeg dll h264 @@ -998,6 +1000,8 @@ videocodec ffh264vdpau fourcc X264,x264 fourcc avc1,AVC1 fourcc davc,DAVC + fourcc ai55,ai15 ; flip4mac avc intra + fourcc ai1q,ai5q ; flip4mac avc intra format 0x10000005 driver ffmpeg dll h264_vdpau @@ -1012,6 +1016,8 @@ videocodec coreavcwindows fourcc avc1 AVC1,AVC1 fourcc davc,DAVC fourcc VSSH + fourcc ai55,ai15 ; flip4mac avc intra + fourcc ai1q,ai5q ; flip4mac avc intra format 0x10000005 driver dshow dll "CoreAVCDecoder.ax" @@ -2894,6 +2900,8 @@ videocodec qtprores fourcc apch fourcc apcn fourcc apcs + fourcc apco + fourcc ap4h driver qtvideo dll "AppleProResDecoder.qtx" out YUY2 @@ -3130,6 +3138,14 @@ videocodec xan dll "xanlib.dll" out BGR24,BGR15,BGR8 query,flip +videocodec ffwc4 + info "FFmpeg XAN wc4" + status working + fourcc Xxan + driver ffmpeg + dll "xan_wc4" + out YV12 + videocodec ffwc3 info "FFmpeg XAN wc3" status buggy @@ -3992,9 +4008,10 @@ audiocodec ffadpcmxa audiocodec ffxandpcm info "FFmpeg XAN DPCM audio" - comment "only works with libavformat demuxer" + comment "Wing Commander 4 files only work with libavformat demuxer" status working fourcc Axan + format 0x594A driver ffmpeg dll xan_dpcm @@ -4471,6 +4488,13 @@ audiocodec fflpcm driver ffmpeg dll pcm_bluray +audiocodec ffpcmlxf + info "Leitch/Harris PCM" + status working + fourcc PLXF ; internal MPlayer FourCC + driver ffmpeg + dll pcm_lxf + ; add every new fourcc also to allocate_parser() ; in libmpdemux/demuxer.c audiocodec ffac3 diff --git a/mplayer/etc/example.conf b/mplayer/etc/example.conf index 9895cfc0..6be7a346 100644 --- a/mplayer/etc/example.conf +++ b/mplayer/etc/example.conf @@ -2,7 +2,7 @@ # MPlayer configuration file # # Configuration files are read system-wide from /usr/local/etc/mplayer.conf -# and per user from ~/.mplayer/config, where per-user settings override +# and per-user from ~/.mplayer/config, where per-user settings override # system-wide settings, all of which are overrriden by the command line. # # The configuration file settings are the same as the command line @@ -11,23 +11,14 @@ # See the CONFIGURATION FILES section in the man page # for a detailed description of the syntax. # -# Profiles should be at the bottom of the config file to ensure you dont -# put default options under profiles accidentally. +# Profiles should be placed at the bottom of the configuration file to ensure +# that settings wanted as defaults are not restricted to specific profiles. ################## # video settings # ################## -# Specify vdpau codecs when using -vo vdpau. -#[vo.vdpau] -#vc=ffmpeg12vdpau,ffwmv3vdpau,ffvc1vdpau,ffh264vdpau,ffodivxvdpau, -# Most video filters do not work with vdpau. -#vf-clr=yes - -# Make sure options under vo.vdpau profile are counted when vdpau is not used -#[default] - # Specify default video driver (see -vo help for a list). #vo=xv @@ -98,6 +89,7 @@ #ao=alsa:device=spdif #ac=hwac3,hwdts,hwmpa, + ################## # other settings # ################## @@ -149,13 +141,25 @@ # DVD: Play English audio tracks if available. #alang = en -################### -# DVDNAV Settings # -################### + +############ +# Profiles # +############ + +# The options declared as part of profiles override global default settings, +# but only take effect when the profile is active. + [protocol.dvdnav] #vc=ffmpeg12, #mouse-movements=yes #nocache=yes +#[vo.vdpau] +#vc=ffmpeg12vdpau,ffwmv3vdpau,ffvc1vdpau,ffh264vdpau,ffodivxvdpau, +# Most video filters do not work with vdpau. +#vf-clr=yes + + + # You can also include other configuration files. #include = /path/to/the/file/you/want/to/include diff --git a/mplayer/ffmpeg/Changelog b/mplayer/ffmpeg/Changelog index 8b7efb61..dc47dabd 100644 --- a/mplayer/ffmpeg/Changelog +++ b/mplayer/ffmpeg/Changelog @@ -55,7 +55,7 @@ version : - Win64 support for optimized asm functions - MJPEG/AVI1 to JPEG/JFIF bitstream filter - ASS subtitle encoder and decoder -- IEC 61937 encapsulation for E-AC3 and TrueHD (for HDMI passthrough) +- IEC 61937 encapsulation for E-AC3, TrueHD, DTS-HD (for HDMI passthrough) - overlay filter added - rename aspect filter to setdar, and pixelaspect to setsar - IEC 61937 demuxer @@ -74,6 +74,9 @@ version : - Lagarith decoder - ffmpeg -copytb option added - IVF muxer added +- Wing Commander IV movies decoder added +- movie source added +- Bink version 'b' audio and video decoder version 0.6: diff --git a/mplayer/ffmpeg/Makefile b/mplayer/ffmpeg/Makefile index 2658a30d..ad1f737e 100644 --- a/mplayer/ffmpeg/Makefile +++ b/mplayer/ffmpeg/Makefile @@ -15,7 +15,7 @@ OBJS = $(PROGS-yes:%=%.o) cmdutils.o MANPAGES = $(PROGS-yes:%=doc/%.1) PODPAGES = $(PROGS-yes:%=doc/%.pod) HTMLPAGES = $(PROGS-yes:%=doc/%.html) -TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher)) +TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws graph2dot lavfi-showfiltfmts pktdumper probetest qt-faststart trasher)) TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64 HOSTPROGS := $(TESTTOOLS:%=tests/%) @@ -23,7 +23,6 @@ BASENAMES = ffmpeg ffplay ffprobe ffserver ALLPROGS = $(BASENAMES:%=%$(EXESUF)) ALLPROGS_G = $(BASENAMES:%=%_g$(EXESUF)) ALLMANPAGES = $(BASENAMES:%=%.1) -ALLHTMLPAGES= $(BASENAMES:%=%.html) FFLIBS-$(CONFIG_AVDEVICE) += avdevice FFLIBS-$(CONFIG_AVFILTER) += avfilter @@ -31,7 +30,6 @@ FFLIBS-$(CONFIG_AVFORMAT) += avformat FFLIBS-$(CONFIG_AVCODEC) += avcodec FFLIBS-$(CONFIG_POSTPROC) += postproc FFLIBS-$(CONFIG_SWSCALE) += swscale -FFLIBS-$(CONFIG_AVCORE) += avcore FFLIBS := avutil @@ -67,7 +65,7 @@ config.h: .config SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \ ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \ - HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS + HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS define RESET $(1) := @@ -94,6 +92,8 @@ tools/%$(EXESUF): tools/%.o tools/%.o: tools/%.c $(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $< +-include $(wildcard tools/*.d) + ffplay.o: CFLAGS += $(SDL_CFLAGS) VERSION_SH = $(SRC_PATH_BARE)/version.sh @@ -112,22 +112,22 @@ version.h .version: alltools: $(TOOLS) -documentation: $(addprefix doc/, developer.html faq.html general.html libavfilter.html \ - $(ALLHTMLPAGES) $(ALLMANPAGES)) +DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES) + +documentation: $(DOCS) -$(HTMLPAGES) $(PODPAGES): doc/fftools-common-opts.texi +-include $(wildcard $(DOCS:%=%.d)) -doc/ffmpeg.pod doc/ffmpeg.html: doc/demuxers.texi doc/bitstream_filters.texi doc/eval.texi doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi doc/metadata.texi -doc/ffplay.pod doc/ffplay.html: doc/demuxers.texi doc/eval.texi doc/indevs.texi doc/filters.texi doc/outdevs.texi doc/protocols.texi -doc/ffprobe.pod doc/ffprobe.html: doc/demuxers.texi doc/indevs.texi doc/protocols.texi -doc/libavfilter.html: doc/filters.texi +TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d) doc/%.html: TAG = HTML doc/%.html: doc/%.texi $(SRC_PATH_BARE)/doc/t2h.init + $(Q)$(TEXIDEP) $(M)cd doc && texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init $(<:doc/%=%) doc/%.pod: TAG = POD doc/%.pod: doc/%.texi + $(Q)$(TEXIDEP) $(M)doc/texi2pod.pl $< $@ doc/%.1: TAG = MAN @@ -170,6 +170,7 @@ clean:: testclean $(RM) $(CLEANSUFFIXES) $(RM) doc/*.html doc/*.pod doc/*.1 $(RM) $(TOOLS) + $(RM) $(CLEANSUFFIXES:%=tools/%) distclean:: $(RM) $(DISTCLEANSUFFIXES) diff --git a/mplayer/ffmpeg/cmdutils.c b/mplayer/ffmpeg/cmdutils.c index 58fe85cf..514ebadb 100644 --- a/mplayer/ffmpeg/cmdutils.c +++ b/mplayer/ffmpeg/cmdutils.c @@ -35,10 +35,10 @@ #include "libswscale/swscale.h" #include "libpostproc/postprocess.h" #include "libavutil/avstring.h" +#include "libavutil/parseutils.h" #include "libavutil/pixdesc.h" #include "libavutil/eval.h" #include "libavcodec/opt.h" -#include "libavcore/avcore.h" #include "cmdutils.h" #include "version.h" #if CONFIG_NETWORK @@ -78,6 +78,16 @@ void uninit_opts(void) #if CONFIG_SWSCALE av_freep(&sws_opts); #endif + for (i = 0; i < opt_name_count; i++) { + //opt_values are only stored for codec-specific options in which case + //both the name and value are dup'd + if (opt_values[i]) { + av_freep(&opt_names[i]); + av_freep(&opt_values[i]); + } + } + av_freep(&opt_names); + av_freep(&opt_values); } void log_callback_help(void* ptr, int level, const char* fmt, va_list vl) @@ -104,8 +114,8 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration) { - int64_t us = parse_date(timestr, is_duration); - if (us == INT64_MIN) { + int64_t us; + if (av_parse_time(&us, timestr, is_duration) < 0) { fprintf(stderr, "Invalid %s specification for %s: %s\n", is_duration ? "duration" : "date", context, timestr); exit(1); @@ -268,9 +278,9 @@ int opt_default(const char *opt, const char *arg){ //FIXME we should always use avcodec_opts, ... for storing options so there will not be any need to keep track of what i set over this opt_values= av_realloc(opt_values, sizeof(void*)*(opt_name_count+1)); - opt_values[opt_name_count]= o ? NULL : arg; + opt_values[opt_name_count]= o ? NULL : av_strdup(arg); opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1)); - opt_names[opt_name_count++]= o ? o->name : opt; + opt_names[opt_name_count++]= o ? o->name : av_strdup(opt); if ((*avcodec_opts && avcodec_opts[0]->debug) || (avformat_opts && avformat_opts->debug)) av_log_set_level(AV_LOG_DEBUG); @@ -403,7 +413,6 @@ static int warned_cfg = 0; static void print_all_libs_info(FILE* outstream, int flags) { PRINT_LIB_INFO(outstream, avutil, AVUTIL, flags); - PRINT_LIB_INFO(outstream, avcore, AVCORE, flags); PRINT_LIB_INFO(outstream, avcodec, AVCODEC, flags); PRINT_LIB_INFO(outstream, avformat, AVFORMAT, flags); PRINT_LIB_INFO(outstream, avdevice, AVDEVICE, flags); diff --git a/mplayer/ffmpeg/common.mak b/mplayer/ffmpeg/common.mak index 110f5056..3d1a1293 100644 --- a/mplayer/ffmpeg/common.mak +++ b/mplayer/ffmpeg/common.mak @@ -31,7 +31,7 @@ $(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR)))) $(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL)) endif -ALLFFLIBS = avcodec avcore avdevice avfilter avformat avutil postproc swscale +ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale IFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH) CPPFLAGS := $(IFLAGS) $(CPPFLAGS) diff --git a/mplayer/ffmpeg/configure b/mplayer/ffmpeg/configure index 46f4e441..04f6e132 100644 --- a/mplayer/ffmpeg/configure +++ b/mplayer/ffmpeg/configure @@ -86,7 +86,6 @@ Configuration options: --disable-ffserver disable ffserver build --disable-avdevice disable libavdevice build --disable-avcodec disable libavcodec build - --disable-avcore disable libavcore build --disable-avformat disable libavformat build --disable-swscale disable libswscale build --enable-postproc enable GPLed postprocessing support [no] @@ -223,6 +222,7 @@ Advanced options (experts only): --disable-mmx2 disable MMX2 optimizations --disable-sse disable SSE optimizations --disable-ssse3 disable SSSE3 optimizations + --disable-avx disable AVX optimizations --disable-armv5te disable armv5te optimizations --disable-armv6 disable armv6 optimizations --disable-armv6t2 disable armv6t2 optimizations @@ -243,7 +243,8 @@ Developer options (useful when working on FFmpeg itself): --disable-optimizations disable compiler optimizations --enable-extra-warnings enable more compiler warnings --disable-stripping disable stripping of executables and shared libraries - --samples=PATH location of test samples for FATE + --samples=PATH location of test samples for FATE, if not set use + \$FATE_SAMPLES at make invocation time. NOTE: Object files are built at the place where configure is launched. EOF @@ -313,6 +314,10 @@ sh_quote(){ echo "$v" } +cleanws(){ + echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//' +} + filter(){ pat=$1 shift @@ -867,7 +872,6 @@ CONFIG_LIST=" $COMPONENT_LIST aandct avcodec - avcore avdevice avfilter avformat @@ -973,6 +977,7 @@ ARCH_EXT_LIST=' armv6 armv6t2 armvfp + avx iwmmxt mmi mmx @@ -1181,6 +1186,7 @@ mmx_deps="x86" mmx2_deps="mmx" sse_deps="mmx" ssse3_deps="sse" +avx_deps="ssse3" aligned_stack_if_any="ppc x86" fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64" @@ -1585,7 +1591,6 @@ host_os=$target_os_default # configurable options enable avcodec -enable avcore enable avdevice enable avfilter enable avformat @@ -1861,8 +1866,11 @@ if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then elif $cc -v 2>&1 | grep -qi ^gcc; then cc_type=gcc cc_version=__VERSION__ - gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)') - cc_ident="gcc $($cc -dumpversion) $gcc_extra_ver" + gcc_version=$($cc --version | head -n1) + gcc_basever=$($cc -dumpversion) + gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)') + gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)") + cc_ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver") if ! $cc -dumpversion | grep -q '^2\.'; then CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' @@ -2038,7 +2046,7 @@ add_asflags $extra_cflags if test -n "$sysroot"; then case "$cc_type" in - gcc|llvm_gcc) + gcc|llvm_gcc|clang) add_cppflags --sysroot="$sysroot" add_ldflags --sysroot="$sysroot" ;; @@ -2046,10 +2054,6 @@ if test -n "$sysroot"; then add_cppflags -I"$sysinclude" add_ldflags --sysroot="$sysroot" ;; - clang) - add_cppflags -isysroot "$sysroot" - add_ldflags -isysroot "$sysroot" - ;; esac fi @@ -2305,6 +2309,7 @@ case $target_os in haiku) prefix_default="/boot/common" network_extralibs="-lnetwork" + host_libs= ;; sunos) FFSERVERLDFLAGS="" @@ -2420,7 +2425,7 @@ case $target_os in ranlib="echo ignoring ranlib" ;; os/2*) - strip="lxlite" + strip="lxlite -CS" ln_s="cp -f" add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf' @@ -2493,8 +2498,6 @@ die_license_disabled version3 libopencore_amrwb enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; } -check_deps $ARCH_EXT_LIST - disabled optimizations || check_cflags -fomit-frame-pointer enable_pic() { @@ -2671,8 +2674,9 @@ EOF elf*) enabled debug && append YASMFLAGS $yasm_debug ;; esac - check_yasm "pabsw xmm0, xmm0" && enable yasm || + check_yasm "pextrd [eax], xmm0, 1" && enable yasm || die "yasm not found, use --disable-yasm for a crippled build" + check_yasm "vpaddw xmm0, xmm0, xmm0" || disable avx fi case "$cpu" in @@ -2927,7 +2931,7 @@ enabled extra_warnings && check_cflags -Winline # add some linker flags check_ldflags -Wl,--warn-common check_ldflags -Wl,--as-needed -check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavcore -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil' +check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil' test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic echo "X{};" > $TMPV @@ -3137,7 +3141,6 @@ if enabled source_path_used; then doc libavcodec libavcodec/$arch - libavcore libavdevice libavfilter libavfilter/$arch @@ -3157,7 +3160,6 @@ if enabled source_path_used; then doc/texi2pod.pl libavcodec/Makefile libavcodec/${arch}/Makefile - libavcore/Makefile libavdevice/Makefile libavfilter/Makefile libavfilter/${arch}/Makefile @@ -3244,7 +3246,7 @@ SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD} SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD} SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD} SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD} -SAMPLES=$samples +SAMPLES=${samples:-\$(FATE_SAMPLES)} EOF get_version(){ @@ -3260,7 +3262,6 @@ get_version(){ get_version LIBSWSCALE libswscale/swscale.h get_version LIBPOSTPROC libpostproc/postprocess.h get_version LIBAVCODEC libavcodec/avcodec.h -get_version LIBAVCORE libavcore/avcore.h get_version LIBAVDEVICE libavdevice/avdevice.h get_version LIBAVFORMAT libavformat/version.h get_version LIBAVUTIL libavutil/avutil.h @@ -3388,10 +3389,9 @@ EOF } pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" -pkgconfig_generate libavcore "FFmpeg multimedia shared core utilities library" "$LIBAVCORE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION" -pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavcore = $LIBAVCORE_VERSION" +pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION" pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION" -pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavcore = $LIBAVCORE_VERSION" +pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION" pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION" diff --git a/mplayer/ffmpeg/doc/APIchanges b/mplayer/ffmpeg/doc/APIchanges index aa1221df..3a8543ed 100644 --- a/mplayer/ffmpeg/doc/APIchanges +++ b/mplayer/ffmpeg/doc/APIchanges @@ -2,7 +2,6 @@ Never assume the API of libav* to be stable unless at least 1 week has passed si the last major version increase. The last version increases were: libavcodec: ? -libavcore: 2010-07-21 libavdevice: ? libavfilter: 2009-10-18 libavformat: ? @@ -13,6 +12,67 @@ libavutil: 2009-03-08 API changes, most recent first: +2011-02-20 - e731b8d - lavf 52.102.0 - avio.h + * e731b8d - rename init_put_byte() to ffio_init_context(), deprecating the + original, and move it to a private header so it is no longer + part of our public API. Instead, use av_alloc_put_byte(). + * ae628ec - rename ByteIOContext to AVIOContext. + +2011-02-16 - 09d171b - lavf 52.101.0 - avformat.h + lavu 52.39.0 - parseutils.h + * 610219a - Add av_ prefix to dump_format(). + * f6c7375 - Replace parse_date() in lavf with av_parse_time() in lavu. + * ab0287f - Move find_info_tag from lavf to lavu and add av_prefix to it. + +2011-02-15 - lavu 52.38.0 - merge libavcore + libavcore is merged back completely into libavutil + +2011-02-10 - 55bad0c - lavc 52.113.0 - vbv_delay + Add vbv_delay field to AVCodecContext + +2011-02-14 - 24a83bd - lavf 52.100.0 - AV_DISPOSITION_CLEAN_EFFECTS + Add AV_DISPOSITION_CLEAN_EFFECTS disposition flag. + +2011-02-14 - 910b5b8 - lavfi 1.76.0 - AVFilterLink sample_aspect_ratio + Add sample_aspect_ratio field to AVFilterLink. + +2011-02-10 - 12c14cd - lavf 52.99.0 - AVStream.disposition + Add AV_DISPOSITION_HEARING_IMPAIRED and AV_DISPOSITION_VISUAL_IMPAIRED. + +2011-02-09 - 5592734 - lavc 52.112.0 - avcodec_thread_init() + Deprecate avcodec_thread_init()/avcodec_thread_free() use; instead + set thread_count before calling avcodec_open. + +2011-02-09 - 778b08a - lavc 52.111.0 - threading API + Add CODEC_CAP_FRAME_THREADS with new restrictions on get_buffer()/ + release_buffer()/draw_horiz_band() callbacks for appropriate codecs. + Add thread_type and active_thread_type fields to AVCodecContext. + +2011-02-08 - 3940caa - lavf 52.98.0 - av_probe_input_buffer + Add av_probe_input_buffer() to avformat.h for probing format from a + ByteIOContext. + +2011-02-06 - fe174fc - lavf 52.97.0 - avio.h + Add flag for non-blocking protocols: URL_FLAG_NONBLOCK + +2011-02-04 - f124b08 - lavf 52.96.0 - avformat_free_context() + Add avformat_free_context() in avformat.h. + +2011-02-03 - f5b82f4 - lavc 52.109.0 - add CODEC_ID_PRORES + Add CODEC_ID_PRORES to avcodec.h. + +2011-02-03 - fe9a3fb - lavc 52.109.0 - H.264 profile defines + Add defines for H.264 * Constrained Baseline and Intra profiles + +2011-02-02 - lavf 52.95.0 + * 50196a9 - add a new installed header version.h. + * 4efd5cf, dccbd97, 93b78d1 - add several variants of public + avio_{put,get}_str* functions. Deprecate corresponding semi-public + {put,get}_str*. + +2011-02-02 - dfd2a00 - lavu 50.37.0 - log.h + Make av_dlog public. + 2011-01-15 - r26374 - lavfi 1.74.0 - AVFilterBufferRefAudioProps Rename AVFilterBufferRefAudioProps.samples_nb to nb_samples. diff --git a/mplayer/ffmpeg/doc/TODO b/mplayer/ffmpeg/doc/TODO index 747eee4a..8ff8a6b3 100644 --- a/mplayer/ffmpeg/doc/TODO +++ b/mplayer/ffmpeg/doc/TODO @@ -69,7 +69,7 @@ unassigned TODO: (unordered) - JPEG2000 decoder & encoder - MPEG4 GMC encoding support - macroblock based pixel format (better cache locality, somewhat complex, one paper claimed it faster for high res) -- regression tests for codecs which do not have an encoder (I+P-frame bitstream in svn) +- regression tests for codecs which do not have an encoder (I+P-frame bitstream in the 'master' branch) - add support for using mplayers video filters to ffmpeg - H264 encoder - per MB ratecontrol (so VCD and such do work better) diff --git a/mplayer/ffmpeg/doc/build_system.txt b/mplayer/ffmpeg/doc/build_system.txt index b22ff848..8a200695 100644 --- a/mplayer/ffmpeg/doc/build_system.txt +++ b/mplayer/ffmpeg/doc/build_system.txt @@ -4,6 +4,8 @@ some of its obscure features and options. Options to make: make V=1 Build target with verbosity 1, instead of 1, 2 can be used too +make SAMPLES= + specify the path to the fate samples at make time Useful standard make commands: @@ -31,4 +33,5 @@ fate Setting up local fate: use the following command to get the fate test samples rsync -aL rsync://rsync.mplayerhq.hu:/samples/fate-suite/ fate/fate-suite -pass --samples= to configure +pass --samples= to configure or pass the path with the +SAMPLES variable to make diff --git a/mplayer/ffmpeg/doc/developer.texi b/mplayer/ffmpeg/doc/developer.texi index b9e246f2..acffbe67 100644 --- a/mplayer/ffmpeg/doc/developer.texi +++ b/mplayer/ffmpeg/doc/developer.texi @@ -312,7 +312,7 @@ send a reminder by email. Your patch should eventually be dealt with. If it depends on a parser or a library, did you add that dependency in configure? @item - Did you "svn add" the appropriate files before commiting? + Did you "git add" the appropriate files before committing? @end enumerate @section patch submission checklist @@ -325,7 +325,7 @@ send a reminder by email. Your patch should eventually be dealt with. @item Is the patch a unified diff? @item - Is the patch against latest FFmpeg SVN? + Is the patch against latest FFmpeg git master branch? @item Are you subscribed to ffmpeg-dev? (the list is subscribers only due to spam) @@ -388,7 +388,7 @@ send a reminder by email. Your patch should eventually be dealt with. @section Patch review process All patches posted to ffmpeg-devel will be reviewed, unless they contain a -clear note that the patch is not for SVN. +clear note that the patch is not for the git master branch. Reviews and comments will be posted as replies to the patch on the mailing list. The patch submitter then has to take care of every comment, that can be by resubmitting a changed patch or by discussion. Resubmitted diff --git a/mplayer/ffmpeg/doc/encoders.texi b/mplayer/ffmpeg/doc/encoders.texi new file mode 100644 index 00000000..cab98fb0 --- /dev/null +++ b/mplayer/ffmpeg/doc/encoders.texi @@ -0,0 +1,20 @@ +@chapter Encoders +@c man begin ENCODERS + +Encoders are configured elements in FFmpeg which allow the encoding of +multimedia streams. + +When you configure your FFmpeg build, all the supported native encoders +are enabled by default. Encoders requiring an external library must be enabled +manually via the corresponding @code{--enable-lib} option. You can list all +available encoders using the configure option @code{--list-encoders}. + +You can disable all the encoders with the configure option +@code{--disable-encoders} and selectively enable / disable single encoders +with the options @code{--enable-encoder=@var{ENCODER}} / +@code{--disable-encoder=@var{ENCODER}}. + +The option @code{-codecs} of the ff* tools will display the list of +enabled encoders. + +@c man end ENCODERS diff --git a/mplayer/ffmpeg/doc/faq.texi b/mplayer/ffmpeg/doc/faq.texi index 100adff3..b8a13b79 100644 --- a/mplayer/ffmpeg/doc/faq.texi +++ b/mplayer/ffmpeg/doc/faq.texi @@ -147,7 +147,7 @@ that match @code{*jpg} to the @file{/tmp} directory in the sequence of @file{img001.jpg}, @file{img002.jpg} and so on. @example - x=1; for i in *jpg; do counter=$(printf %03d $x); ln "$i" /tmp/img"$counter".jpg; x=$(($x+1)); done + x=1; for i in *jpg; do counter=$(printf %03d $x); ln -s "$i" /tmp/img"$counter".jpg; x=$(($x+1)); done @end example If you want to sequence them by oldest modified first, substitute @@ -423,7 +423,7 @@ read "Programming Religion" at (@url{http://www.tux.org/lkml/#s15}). The build process creates ffmpeg_g, ffplay_g, etc. which contain full debug information. Those binaries are stripped to create ffmpeg, ffplay, etc. If -you need the debug information, used the *_g versions. +you need the debug information, use the *_g versions. @section I do not like the LGPL, can I contribute code under the GPL instead? diff --git a/mplayer/ffmpeg/doc/ffmpeg.texi b/mplayer/ffmpeg/doc/ffmpeg.texi index 047444ab..f0f3b650 100644 --- a/mplayer/ffmpeg/doc/ffmpeg.texi +++ b/mplayer/ffmpeg/doc/ffmpeg.texi @@ -628,7 +628,10 @@ Just enumerate the input streams in the order you want them in the output. @var{sync_stream_id} if specified sets the input stream to sync against. @item -map_meta_data @var{outfile}[,@var{metadata}]:@var{infile}[,@var{metadata}] -Set meta data information of @var{outfile} from @var{infile}. Note that those +Deprecated, use @var{-map_metadata} instead. + +@item -map_metadata @var{outfile}[,@var{metadata}]:@var{infile}[,@var{metadata}] +Set metadata information of @var{outfile} from @var{infile}. Note that those are file indices (zero-based), not filenames. Optional @var{metadata} parameters specify, which metadata to copy - (g)lobal (i.e. metadata that applies to the whole file), per-(s)tream, per-(c)hapter or @@ -644,7 +647,7 @@ file index can be used to create a dummy mapping that just disables automatic co For example to copy metadata from the first stream of the input file to global metadata of the output file: @example -ffmpeg -i in.ogg -map_meta_data 0:0,s0 out.mp3 +ffmpeg -i in.ogg -map_metadata 0:0,s0 out.mp3 @end example @item -map_chapters @var{outfile}:@var{infile} Copy chapters from @var{infile} to @var{outfile}. If no chapter mapping is specified, @@ -978,6 +981,7 @@ file to which you want to add them. @c man end EXAMPLES @include eval.texi +@include encoders.texi @include demuxers.texi @include muxers.texi @include indevs.texi diff --git a/mplayer/ffmpeg/doc/filters.texi b/mplayer/ffmpeg/doc/filters.texi index 38428865..042ea132 100644 --- a/mplayer/ffmpeg/doc/filters.texi +++ b/mplayer/ffmpeg/doc/filters.texi @@ -657,13 +657,13 @@ Follow some examples: overlay=main_w-overlay_w-10:main_h-overlay_h-10 # insert a transparent PNG logo in the bottom left corner of the input -movie=0:png:logo.png [logo]; +movie=logo.png [logo]; [in][logo] overlay=10:main_h-overlay_h-10 [out] # insert 2 different transparent PNG logos (second logo on bottom # right corner): -movie=0:png:logo1.png [logo1]; -movie=0:png:logo2.png [logo2]; +movie=logo1.png [logo1]; +movie=logo2.png [logo2]; [in][logo1] overlay=10:H-h-10 [in+logo1]; [in+logo1][logo2] overlay=W-w-10:H-h-10 [out] @@ -1088,6 +1088,61 @@ to the pad with identifier "in". "color=red@@0.2:qcif:10 [color]; [in][color] overlay [out]" @end example +@section movie + +Read a video stream from a movie container. + +It accepts the syntax: @var{movie_name}[:@var{options}] where +@var{movie_name} is the name of the resource to read (not necessarily +a file but also a device or a stream accessed through some protocol), +and @var{options} is an optional sequence of @var{key}=@var{value} +pairs, separated by ":". + +The description of the accepted options follows. + +@table @option + +@item format_name, f +Specifies the format assumed for the movie to read, and can be either +the name of a container or an input device. If not specified the +format is guessed from @var{movie_name} or by probing. + +@item seek_point, sp +Specifies the seek point in seconds, the frames will be output +starting from this seek point, the parameter is evaluated with +@code{av_strtod} so the numerical value may be suffixed by an IS +postfix. Default value is "0". + +@item stream_index, si +Specifies the index of the video stream to read. If the value is -1, +the best suited video stream will be automatically selected. Default +value is "-1". + +@end table + +This filter allows to overlay a second video on top of main input of +a filtergraph as shown in this graph: +@example +input -----------> deltapts0 --> overlay --> output + ^ + | +movie --> scale--> deltapts1 -------+ +@end example + +Some examples follow: +@example +# skip 3.2 seconds from the start of the avi file in.avi, and overlay it +# on top of the input labelled as "in". +movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie]; +[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out] + +# read from a video4linux2 device, and overlay it on top of the input +# labelled as "in" +movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie]; +[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out] + +@end example + @section nullsrc Null video source, never return images. It is mainly useful as a diff --git a/mplayer/ffmpeg/doc/general.texi b/mplayer/ffmpeg/doc/general.texi index 950159f1..cd126f98 100644 --- a/mplayer/ffmpeg/doc/general.texi +++ b/mplayer/ffmpeg/doc/general.texi @@ -352,7 +352,6 @@ following image formats are supported: @item Bethesda VID video @tab @tab X @tab Used in some games from Bethesda Softworks. @item Bink Video @tab @tab X - @tab Support for version 'b' is missing. @item Brute Force & Ignorance @tab @tab X @tab Used in the game Flash Traffic: City of Angels. @item C93 video @tab @tab X @@ -511,6 +510,8 @@ following image formats are supported: @tab not completely working @item Wing Commander III / Xan @tab @tab X @tab Used in Wing Commander III .MVE files. +@item Wing Commander IV / Xan @tab @tab X + @tab Used in Wing Commander IV. @item Winnov WNV1 @tab @tab X @item WMV7 @tab X @tab X @item YAMAHA SMAF @tab X @tab X @@ -985,7 +986,7 @@ you should only need to add the directory where the LIB files are installed (i.e. @file{c:\msys\usr\local\bin}). This is not a typo, the LIB files are installed in the @file{bin} directory. And instead of adding the static libraries (@file{libxxx.a} files) you should add the MSVC import libraries -(@file{avcodec.lib}, @file{avformat.lib}, @file{avcore.lib}, and +(@file{avcodec.lib}, @file{avformat.lib}, and @file{avutil.lib}). Note that you should not use the GCC import libraries (@file{libxxx.dll.a} files), as these will give you undefined reference errors. There should be no need for @file{libmingwex.a}, diff --git a/mplayer/ffmpeg/doc/multithreading.txt b/mplayer/ffmpeg/doc/multithreading.txt new file mode 100644 index 00000000..a1068425 --- /dev/null +++ b/mplayer/ffmpeg/doc/multithreading.txt @@ -0,0 +1,65 @@ +FFmpeg multithreading methods +============================================== + +FFmpeg provides two methods for multithreading codecs. + +Slice threading decodes multiple parts of a frame at the same time, using +AVCodecContext execute() and execute2(). + +Frame threading decodes multiple frames at the same time. +It accepts N future frames and delays decoded pictures by N-1 frames. +The later frames are decoded in separate threads while the user is +displaying the current one. + +Restrictions on clients +============================================== + +Slice threading - +* The client's draw_horiz_band() must be thread-safe according to the comment + in avcodec.h. + +Frame threading - +* Restrictions with slice threading also apply. +* For best performance, the client should set thread_safe_callbacks if it + provides a thread-safe get_buffer() callback. +* There is one frame of delay added for every thread beyond the first one. + Clients must be able to handle this; the pkt_dts and pkt_pts fields in + AVFrame will work as usual. + +Restrictions on codec implementations +============================================== + +Slice threading - + None except that there must be something worth executing in parallel. + +Frame threading - +* Codecs can only accept entire pictures per packet. +* Codecs similar to ffv1, whose streams don't reset across frames, + will not work because their bitstreams cannot be decoded in parallel. + +* The contents of buffers must not be read before ff_thread_await_progress() + has been called on them. reget_buffer() and buffer age optimizations no longer work. +* The contents of buffers must not be written to after ff_thread_report_progress() + has been called on them. This includes draw_edges(). + +Porting codecs to frame threading +============================================== + +Find all context variables that are needed by the next frame. Move all +code changing them, as well as code calling get_buffer(), up to before +the decode process starts. Call ff_thread_finish_setup() afterwards. If +some code can't be moved, have update_thread_context() run it in the next +thread. + +If the codec allocates writable tables in its init(), add an init_thread_copy() +which re-allocates them for other threads. + +Add CODEC_CAP_FRAME_THREADS to the codec capabilities. There will be very little +speed gain at this point but it should work. + +Call ff_thread_report_progress() after some part of the current picture has decoded. +A good place to put this is where draw_horiz_band() is called - add this if it isn't +called anywhere, as it's useful too and the implementation is trivial when you're +doing this. Note that draw_edges() needs to be called before reporting progress. + +Before accessing a reference frame or its MVs, call ff_thread_await_progress(). diff --git a/mplayer/ffmpeg/doc/muxers.texi b/mplayer/ffmpeg/doc/muxers.texi index c3dcf117..e7cfc4a9 100644 --- a/mplayer/ffmpeg/doc/muxers.texi +++ b/mplayer/ffmpeg/doc/muxers.texi @@ -18,4 +18,190 @@ enabled muxers. A description of some of the currently available muxers follows. +@anchor{crc} +@section crc + +CRC (Cyclic Redundancy Check) testing format. + +This muxer computes and prints the Adler-32 CRC of all the input audio +and video frames. By default audio frames are converted to signed +16-bit raw audio and video frames to raw video before computing the +CRC. + +The output of the muxer consists of a single line of the form: +CRC=0x@var{CRC}, where @var{CRC} is a hexadecimal number 0-padded to +8 digits containing the CRC for all the decoded input frames. + +For example to compute the CRC of the input, and store it in the file +@file{out.crc}: +@example +ffmpeg -i INPUT -f crc out.crc +@end example + +You can print the CRC to stdout with the command: +@example +ffmpeg -i INPUT -f crc - +@end example + +You can select the output format of each frame with @file{ffmpeg} by +specifying the audio and video codec and format. For example to +compute the CRC of the input audio converted to PCM unsigned 8-bit +and the input video converted to MPEG-2 video, use the command: +@example +ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f crc - +@end example + +See also the @code{framecrc} muxer (@pxref{framecrc}). + +@anchor{framecrc} +@section framecrc + +Per-frame CRC (Cyclic Redundancy Check) testing format. + +This muxer computes and prints the Adler-32 CRC for each decoded audio +and video frame. By default audio frames are converted to signed +16-bit raw audio and video frames to raw video before computing the +CRC. + +The output of the muxer consists of a line for each audio and video +frame of the form: @var{stream_index}, @var{frame_dts}, +@var{frame_size}, 0x@var{CRC}, where @var{CRC} is a hexadecimal +number 0-padded to 8 digits containing the CRC of the decoded frame. + +For example to compute the CRC of each decoded frame in the input, and +store it in the file @file{out.crc}: +@example +ffmpeg -i INPUT -f framecrc out.crc +@end example + +You can print the CRC of each decoded frame to stdout with the command: +@example +ffmpeg -i INPUT -f framecrc - +@end example + +You can select the output format of each frame with @file{ffmpeg} by +specifying the audio and video codec and format. For example, to +compute the CRC of each decoded input audio frame converted to PCM +unsigned 8-bit and of each decoded input video frame converted to +MPEG-2 video, use the command: +@example +ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f framecrc - +@end example + +See also the @code{crc} muxer (@pxref{crc}). + +@section image2 + +Image file muxer. + +The image file muxer writes video frames to image files. + +The output filenames are specified by a pattern, which can be used to +produce sequentially numbered series of files. +The pattern may contain the string "%d" or "%0@var{N}d", this string +specifies the position of the characters representing a numbering in +the filenames. If the form "%0@var{N}d" is used, the string +representing the number in each filename is 0-padded to @var{N} +digits. The literal character '%' can be specified in the pattern with +the string "%%". + +If the pattern contains "%d" or "%0@var{N}d", the first filename of +the file list specified will contain the number 1, all the following +numbers will be sequential. + +The pattern may contain a suffix which is used to automatically +determine the format of the image files to write. + +For example the pattern "img-%03d.bmp" will specify a sequence of +filenames of the form @file{img-001.bmp}, @file{img-002.bmp}, ..., +@file{img-010.bmp}, etc. +The pattern "img%%-%d.jpg" will specify a sequence of filenames of the +form @file{img%-1.jpg}, @file{img%-2.jpg}, ..., @file{img%-10.jpg}, +etc. + +The following example shows how to use @file{ffmpeg} for creating a +sequence of files @file{img-001.jpeg}, @file{img-002.jpeg}, ..., +taking one image every second from the input video: +@example +ffmpeg -i in.avi -r 1 -f image2 'img-%03d.jpeg' +@end example + +Note that with @file{ffmpeg}, if the format is not specified with the +@code{-f} option and the output filename specifies an image file +format, the image2 muxer is automatically selected, so the previous +command can be written as: +@example +ffmpeg -i in.avi -r 1 'img-%03d.jpeg' +@end example + +Note also that the pattern must not necessarily contain "%d" or +"%0@var{N}d", for example to create a single image file +@file{img.jpeg} from the input video you can employ the command: +@example +ffmpeg -i in.avi -f image2 -vframes 1 img.jpeg +@end example + +@section mpegts + +MPEG transport stream muxer. + +This muxer implements ISO 13818-1 and part of ETSI EN 300 468. + +The muxer options are: + +@table @option +@item -mpegts_original_network_id @var{number} +Set the original_network_id (default 0x0001). This is unique identifier +of a network in DVB. Its main use is in the unique identification of a +service through the path Original_Network_ID, Transport_Stream_ID. +@item -mpegts_transport_stream_id @var{number} +Set the transport_stream_id (default 0x0001). This identifies a +transponder in DVB. +@item -mpegts_service_id @var{number} +Set the service_id (default 0x0001) also known as program in DVB. +@item -mpegts_pmt_start_pid @var{number} +Set the first PID for PMT (default 0x1000, max 0x1f00). +@item -mpegts_start_pid @var{number} +Set the first PID for data packets (default 0x0100, max 0x0f00). +@end table + +The recognized metadata settings in mpegts muxer are @code{service_provider} +and @code{service_name}. If they are not set the default for +@code{service_provider} is "FFmpeg" and the default for +@code{service_name} is "Service01". + +@example +ffmpeg -i file.mpg -acodec copy -vcodec copy \ + -mpegts_original_network_id 0x1122 \ + -mpegts_transport_stream_id 0x3344 \ + -mpegts_service_id 0x5566 \ + -mpegts_pmt_start_pid 0x1500 \ + -mpegts_start_pid 0x150 \ + -metadata service_provider="Some provider" \ + -metadata service_name="Some Channel" \ + -y out.ts +@end example + +@section null + +Null muxer. + +This muxer does not generate any output file, it is mainly useful for +testing or benchmarking purposes. + +For example to benchmark decoding with @file{ffmpeg} you can use the +command: +@example +ffmpeg -benchmark -i INPUT -f null out.null +@end example + +Note that the above command does not read or write the @file{out.null} +file, but specifying the output file is required by the @file{ffmpeg} +syntax. + +Alternatively you can write the command as: +@example +ffmpeg -benchmark -i INPUT -f null - +@end example + @c man end MUXERS diff --git a/mplayer/ffmpeg/doc/optimization.txt b/mplayer/ffmpeg/doc/optimization.txt index 5d512359..08954f99 100644 --- a/mplayer/ffmpeg/doc/optimization.txt +++ b/mplayer/ffmpeg/doc/optimization.txt @@ -17,8 +17,8 @@ Understanding these overoptimized functions: As many functions tend to be a bit difficult to understand because of optimizations, it can be hard to optimize them further, or write architecture-specific versions. It is recommended to look at older -revisions of the interesting files (for a web frontend try ViewVC at -http://svn.ffmpeg.org/ffmpeg/trunk/). +revisions of the interesting files (web frontends for the various FFmpeg +branches are listed at http://ffmpeg.org/download.html). Alternatively, look into the other architecture-specific versions in the x86/, ppc/, alpha/ subdirectories. Even if you don't exactly comprehend the instructions, it could help understanding the functions diff --git a/mplayer/ffmpeg/doc/soc.txt b/mplayer/ffmpeg/doc/soc.txt index 8b4a86db..79d77d1c 100644 --- a/mplayer/ffmpeg/doc/soc.txt +++ b/mplayer/ffmpeg/doc/soc.txt @@ -9,14 +9,14 @@ it's a little late for this year's soc (2006). The Goal: Our goal in respect to soc is and must be of course exactly one thing and that is to improve FFmpeg, to reach this goal, code must -* conform to the svn policy and patch submission guidelines +* conform to the development policy and patch submission guidelines * must improve FFmpeg somehow (faster, smaller, "better", more codecs supported, fewer bugs, cleaner, ...) for mentors and other developers to help students to reach that goal it is essential that changes to their codebase are publicly visible, clean and easy reviewable that again leads us to: -* use of a revision control system like svn +* use of a revision control system like git * separation of cosmetic from non-cosmetic changes (this is almost entirely ignored by mentors and students in soc 2006 which might lead to a suprise when the code will be reviewed at the end before a possible inclusion in diff --git a/mplayer/ffmpeg/ffmpeg.c b/mplayer/ffmpeg/ffmpeg.c index 691b73e1..e3dda9de 100644 --- a/mplayer/ffmpeg/ffmpeg.c +++ b/mplayer/ffmpeg/ffmpeg.c @@ -36,9 +36,9 @@ #include "libswscale/swscale.h" #include "libavcodec/opt.h" #include "libavcodec/audioconvert.h" -#include "libavcore/audioconvert.h" -#include "libavcore/parseutils.h" -#include "libavcore/samplefmt.h" +#include "libavutil/audioconvert.h" +#include "libavutil/parseutils.h" +#include "libavutil/samplefmt.h" #include "libavutil/colorspace.h" #include "libavutil/fifo.h" #include "libavutil/intreadwrite.h" @@ -505,25 +505,11 @@ static int ffmpeg_exit(int ret) /* close files */ for(i=0;ioformat->flags & AVFMT_NOFILE) && s->pb) - url_fclose(s->pb); - for(j=0;jnb_streams;j++) { - av_metadata_free(&s->streams[j]->metadata); - av_free(s->streams[j]->codec); - av_free(s->streams[j]->info); - av_free(s->streams[j]); - } - for(j=0;jnb_programs;j++) { - av_metadata_free(&s->programs[j]->metadata); - } - for(j=0;jnb_chapters;j++) { - av_metadata_free(&s->chapters[j]->metadata); - } - av_metadata_free(&s->metadata); - av_free(s); + avio_close(s->pb); + avformat_free_context(s); av_free(output_streams_for_file[i]); } for(i=0;icodec->sample_fmt) break; } - if(*p == -1) + if (*p == -1) { + av_log(NULL, AV_LOG_WARNING, + "Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n", + av_get_sample_fmt_name(st->codec->sample_fmt), + codec->name, + av_get_sample_fmt_name(codec->sample_fmts[0])); st->codec->sample_fmt = codec->sample_fmts[0]; + } } } @@ -707,11 +698,6 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename) choose_pixel_fmt(st, codec); } - if(!st->codec->thread_count) - st->codec->thread_count = 1; - if(st->codec->thread_count>1) - avcodec_thread_init(st->codec, st->codec->thread_count); - if(st->codec->flags & CODEC_FLAG_BITEXACT) nopts = 1; @@ -1547,7 +1533,8 @@ static int output_packet(AVInputStream *ist, int ist_index, decoded_data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2; /* XXX: allocate picture correctly */ avcodec_get_frame_defaults(&picture); - ist->st->codec->reordered_opaque = pkt_pts; + avpkt.pts = pkt_pts; + avpkt.dts = ist->pts; pkt_pts = AV_NOPTS_VALUE; ret = avcodec_decode_video2(ist->st->codec, @@ -1559,7 +1546,7 @@ static int output_packet(AVInputStream *ist, int ist_index, /* no picture yet */ goto discard_packet; } - ist->next_pts = ist->pts = guess_correct_pts(&ist->pts_ctx, picture.reordered_opaque, ist->pts); + ist->next_pts = ist->pts = guess_correct_pts(&ist->pts_ctx, picture.pkt_pts, picture.pkt_dts); if (ist->st->codec->time_base.num != 0) { int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; ist->next_pts += ((int64_t)AV_TIME_BASE * @@ -1990,7 +1977,7 @@ static int transcode(AVFormatContext **output_files, for(i=0;inb_streams && !(os->oformat->flags & AVFMT_NOSTREAMS)) { - dump_format(output_files[i], i, output_files[i]->filename, 1); + av_dump_format(output_files[i], i, output_files[i]->filename, 1); fprintf(stderr, "Output file #%d does not contain any stream\n", i); ret = AVERROR(EINVAL); goto fail; @@ -2041,7 +2028,7 @@ static int transcode(AVFormatContext **output_files, /* Sanity check that the stream types match */ if (ist_table[ost->source_index]->st->codec->codec_type != ost->st->codec->codec_type) { int i= ost->file_index; - dump_format(output_files[i], i, output_files[i]->filename, 1); + av_dump_format(output_files[i], i, output_files[i]->filename, 1); fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n", stream_maps[n].file_index, stream_maps[n].stream_index, ost->file_index, ost->index); @@ -2092,7 +2079,7 @@ static int transcode(AVFormatContext **output_files, } if (!found) { int i= ost->file_index; - dump_format(output_files[i], i, output_files[i]->filename, 1); + av_dump_format(output_files[i], i, output_files[i]->filename, 1); fprintf(stderr, "Could not find input stream matching output stream #%d.%d\n", ost->file_index, ost->index); ffmpeg_exit(1); @@ -2472,7 +2459,7 @@ static int transcode(AVFormatContext **output_files, /* dump the file output parameters - cannot be done before in case of stream copy */ for(i=0;ifilename, 1); + av_dump_format(output_files[i], i, output_files[i]->filename, 1); } /* dump the stream mapping */ @@ -2591,7 +2578,8 @@ static int transcode(AVFormatContext **output_files, memset(no_packet, 0, sizeof(no_packet)); if (do_pkt_dump) { - av_pkt_dump_log(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump); + av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump, + is->streams[pkt.stream_index]); } /* the following test is needed in case new streams appear dynamically in stream : we ignore them */ @@ -2692,10 +2680,7 @@ static int transcode(AVFormatContext **output_files, } } #if CONFIG_AVFILTER - if (graph) { - avfilter_graph_free(graph); - av_freep(&graph); - } + avfilter_graph_free(&graph); #endif /* finished ! */ @@ -3007,7 +2992,7 @@ static void parse_meta_type(char *arg, char *type, int *index, char **endptr) *type = 'g'; } -static void opt_map_meta_data(const char *arg) +static void opt_map_metadata(const char *arg) { AVMetaDataMap *m, *m1; char *p; @@ -3033,6 +3018,13 @@ static void opt_map_meta_data(const char *arg) metadata_chapters_autocopy = 0; } +static void opt_map_meta_data(const char *arg) +{ + fprintf(stderr, "-map_meta_data is deprecated and will be removed soon. " + "Use -map_metadata instead.\n"); + opt_map_metadata(arg); +} + static void opt_map_chapters(const char *arg) { AVChapterMap *c; @@ -3240,7 +3232,7 @@ static void opt_input_file(const char *filename) for(i=0;inb_streams;i++) { AVStream *st = ic->streams[i]; AVCodecContext *dec = st->codec; - avcodec_thread_init(dec, thread_count); + dec->thread_count = thread_count; input_codecs = grow_array(input_codecs, sizeof(*input_codecs), &nb_input_codecs, nb_input_codecs + 1); switch (dec->codec_type) { case AVMEDIA_TYPE_AUDIO: @@ -3318,7 +3310,7 @@ static void opt_input_file(const char *filename) input_files_ts_offset[nb_input_files] = input_ts_offset - (copy_ts ? 0 : timestamp); /* dump the file content */ if (verbose >= 0) - dump_format(ic, nb_input_files, filename, 0); + av_dump_format(ic, nb_input_files, filename, 0); nb_input_files++; @@ -3398,7 +3390,7 @@ static void new_video_stream(AVFormatContext *oc, int file_idx) ost->bitstream_filters = video_bitstream_filters; video_bitstream_filters= NULL; - avcodec_thread_init(st->codec, thread_count); + st->codec->thread_count= thread_count; video_enc = st->codec; @@ -3545,7 +3537,7 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx) ost->bitstream_filters = audio_bitstream_filters; audio_bitstream_filters= NULL; - avcodec_thread_init(st->codec, thread_count); + st->codec->thread_count= thread_count; audio_enc = st->codec; audio_enc->codec_type = AVMEDIA_TYPE_AUDIO; @@ -3798,7 +3790,7 @@ static void opt_output_file(const char *filename) } /* open the file */ - if ((err = url_fopen(&oc->pb, filename, URL_WRONLY)) < 0) { + if ((err = avio_open(&oc->pb, filename, URL_WRONLY)) < 0) { print_error(filename, err); ffmpeg_exit(1); } @@ -4191,7 +4183,10 @@ static const OptionDef options[] = { { "i", HAS_ARG, {(void*)opt_input_file}, "input file name", "filename" }, { "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" }, { "map", HAS_ARG | OPT_EXPERT, {(void*)opt_map}, "set input stream mapping", "file:stream[:syncfile:syncstream]" }, - { "map_meta_data", HAS_ARG | OPT_EXPERT, {(void*)opt_map_meta_data}, "set meta data information of outfile from infile", "outfile[,metadata]:infile[,metadata]" }, + { "map_meta_data", HAS_ARG | OPT_EXPERT, {(void*)opt_map_meta_data}, "DEPRECATED set meta data information of outfile from infile", + "outfile[,metadata]:infile[,metadata]" }, + { "map_metadata", HAS_ARG | OPT_EXPERT, {(void*)opt_map_metadata}, "set metadata information of outfile from infile", + "outfile[,metadata]:infile[,metadata]" }, { "map_chapters", HAS_ARG | OPT_EXPERT, {(void*)opt_map_chapters}, "set chapters mapping", "outfile:infile" }, { "t", OPT_FUNC2 | HAS_ARG, {(void*)opt_recording_time}, "record or transcode \"duration\" seconds of audio/video", "duration" }, { "fs", HAS_ARG | OPT_INT64, {(void*)&limit_filesize}, "set the limit file size in bytes", "limit_size" }, // diff --git a/mplayer/ffmpeg/ffplay.c b/mplayer/ffmpeg/ffplay.c index 840df666..e71c9c93 100644 --- a/mplayer/ffmpeg/ffplay.c +++ b/mplayer/ffmpeg/ffplay.c @@ -28,9 +28,9 @@ #include "libavutil/avstring.h" #include "libavutil/colorspace.h" #include "libavutil/pixdesc.h" -#include "libavcore/imgutils.h" -#include "libavcore/parseutils.h" -#include "libavcore/samplefmt.h" +#include "libavutil/imgutils.h" +#include "libavutil/parseutils.h" +#include "libavutil/samplefmt.h" #include "libavformat/avformat.h" #include "libavdevice/avdevice.h" #include "libswscale/swscale.h" @@ -58,6 +58,7 @@ const char program_name[] = "FFplay"; const int program_birth_year = 2003; +//#define DEBUG //#define DEBUG_SYNC #define MAX_QUEUE_SIZE (15 * 1024 * 1024) @@ -711,40 +712,6 @@ static void video_image_display(VideoState *is) if (aspect_ratio <= 0.0) aspect_ratio = 1.0; aspect_ratio *= (float)vp->width / (float)vp->height; - /* if an active format is indicated, then it overrides the - mpeg format */ -#if 0 - if (is->video_st->codec->dtg_active_format != is->dtg_active_format) { - is->dtg_active_format = is->video_st->codec->dtg_active_format; - printf("dtg_active_format=%d\n", is->dtg_active_format); - } -#endif -#if 0 - switch(is->video_st->codec->dtg_active_format) { - case FF_DTG_AFD_SAME: - default: - /* nothing to do */ - break; - case FF_DTG_AFD_4_3: - aspect_ratio = 4.0 / 3.0; - break; - case FF_DTG_AFD_16_9: - aspect_ratio = 16.0 / 9.0; - break; - case FF_DTG_AFD_14_9: - aspect_ratio = 14.0 / 9.0; - break; - case FF_DTG_AFD_4_3_SP_14_9: - aspect_ratio = 14.0 / 9.0; - break; - case FF_DTG_AFD_16_9_SP_14_9: - aspect_ratio = 14.0 / 9.0; - break; - case FF_DTG_AFD_SP_4_3: - aspect_ratio = 4.0 / 3.0; - break; - } -#endif if (is->subtitle_st) { @@ -1569,18 +1536,17 @@ static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacke return 0; } - is->video_st->codec->reordered_opaque = pkt->pts; len1 = avcodec_decode_video2(is->video_st->codec, frame, &got_picture, pkt); if (got_picture) { if (decoder_reorder_pts == -1) { - *pts = guess_correct_pts(&is->pts_ctx, frame->reordered_opaque, pkt->dts); + *pts = guess_correct_pts(&is->pts_ctx, frame->pkt_pts, frame->pkt_dts); } else if (decoder_reorder_pts) { - *pts = frame->reordered_opaque; + *pts = frame->pkt_pts; } else { - *pts = pkt->dts; + *pts = frame->pkt_dts; } if (*pts == AV_NOPTS_VALUE) { @@ -1694,6 +1660,7 @@ static int input_init(AVFilterContext *ctx, const char *args, void *opaque) codec->get_buffer = input_get_buffer; codec->release_buffer = input_release_buffer; codec->reget_buffer = input_reget_buffer; + codec->thread_safe_callbacks = 1; } priv->frame = avcodec_alloc_frame(); @@ -1782,30 +1749,20 @@ static AVFilter input_filter = { .name = NULL }}, }; -#endif /* CONFIG_AVFILTER */ - -static int video_thread(void *arg) +static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters) { - VideoState *is = arg; - AVFrame *frame= avcodec_alloc_frame(); - int64_t pts_int; - double pts; - int ret; - -#if CONFIG_AVFILTER - int64_t pos; char sws_flags_str[128]; + int ret; FFSinkContext ffsink_ctx = { .pix_fmt = PIX_FMT_YUV420P }; AVFilterContext *filt_src = NULL, *filt_out = NULL; - AVFilterGraph *graph = avfilter_graph_alloc(); snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags); graph->scale_sws_opts = av_strdup(sws_flags_str); - if (avfilter_graph_create_filter(&filt_src, &input_filter, "src", - NULL, is, graph) < 0) + if ((ret = avfilter_graph_create_filter(&filt_src, &input_filter, "src", + NULL, is, graph)) < 0) goto the_end; - if (avfilter_graph_create_filter(&filt_out, &ffsink, "out", - NULL, &ffsink_ctx, graph) < 0) + if ((ret = avfilter_graph_create_filter(&filt_out, &ffsink, "out", + NULL, &ffsink_ctx, graph)) < 0) goto the_end; if(vfilters) { @@ -1822,17 +1779,40 @@ static int video_thread(void *arg) inputs->pad_idx = 0; inputs->next = NULL; - if (avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL) < 0) + if ((ret = avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL)) < 0) goto the_end; av_freep(&vfilters); } else { - if(avfilter_link(filt_src, 0, filt_out, 0) < 0) goto the_end; + if ((ret = avfilter_link(filt_src, 0, filt_out, 0)) < 0) + goto the_end; } - if (avfilter_graph_config(graph, NULL) < 0) + if ((ret = avfilter_graph_config(graph, NULL)) < 0) goto the_end; is->out_video_filter = filt_out; +the_end: + return ret; +} + +#endif /* CONFIG_AVFILTER */ + +static int video_thread(void *arg) +{ + VideoState *is = arg; + AVFrame *frame= avcodec_alloc_frame(); + int64_t pts_int; + double pts; + int ret; + +#if CONFIG_AVFILTER + AVFilterGraph *graph = avfilter_graph_alloc(); + AVFilterContext *filt_out = NULL; + int64_t pos; + + if ((ret = configure_video_filters(graph, is, vfilters)) < 0) + goto the_end; + filt_out = is->out_video_filter; #endif for(;;) { @@ -1853,12 +1833,12 @@ static int video_thread(void *arg) } if (av_cmp_q(tb, is->video_st->time_base)) { - int64_t pts1 = pts_int; + av_unused int64_t pts1 = pts_int; pts_int = av_rescale_q(pts_int, tb, is->video_st->time_base); - av_log(NULL, AV_LOG_DEBUG, "video_thread(): " - "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n", - tb.num, tb.den, pts1, - is->video_st->time_base.num, is->video_st->time_base.den, pts_int); + av_dlog(NULL, "video_thread(): " + "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n", + tb.num, tb.den, pts1, + is->video_st->time_base.num, is->video_st->time_base.den, pts_int); } #else ret = get_video_frame(is, frame, &pts_int, &pkt); @@ -1886,8 +1866,7 @@ static int video_thread(void *arg) } the_end: #if CONFIG_AVFILTER - avfilter_graph_free(graph); - av_freep(&graph); + avfilter_graph_free(&graph); #endif av_free(frame); return 0; @@ -2247,7 +2226,7 @@ static int stream_component_open(VideoState *is, int stream_index) avctx->skip_loop_filter= skip_loop_filter; avctx->error_recognition= error_recognition; avctx->error_concealment= error_concealment; - avcodec_thread_init(avctx, thread_count); + avctx->thread_count= thread_count; set_context_opts(avctx, avcodec_opts[avctx->codec_type], 0, codec); @@ -2485,7 +2464,7 @@ static int decode_thread(void *arg) st_index[AVMEDIA_TYPE_VIDEO]), NULL, 0); if (show_status) { - dump_format(ic, 0, is->filename, 0); + av_dump_format(ic, 0, is->filename, 0); } /* open the streams */ diff --git a/mplayer/ffmpeg/ffpresets/libx264-fast.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-fast.ffpreset index cac6534e..0fc1f224 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-fast.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-fast.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=2 diff --git a/mplayer/ffmpeg/ffpresets/libx264-fast_firstpass.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-fast_firstpass.ffpreset index 65ec0112..cdcbbbf2 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-fast_firstpass.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-fast_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/mplayer/ffmpeg/ffpresets/libx264-faster.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-faster.ffpreset index a32eed3c..3156cd80 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-faster.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-faster.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=2 diff --git a/mplayer/ffmpeg/ffpresets/libx264-faster_firstpass.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-faster_firstpass.ffpreset index c777eb4e..9bcf18ae 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-faster_firstpass.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-faster_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/mplayer/ffmpeg/ffpresets/libx264-lossless_fast.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-lossless_fast.ffpreset index ea08d3c0..b7696b5b 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-lossless_fast.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-lossless_fast.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 directpred=1 flags2=+fastpskip diff --git a/mplayer/ffmpeg/ffpresets/libx264-lossless_max.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-lossless_max.ffpreset index 8c049c9c..75c387f1 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-lossless_max.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-lossless_max.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 refs=16 directpred=1 diff --git a/mplayer/ffmpeg/ffpresets/libx264-lossless_medium.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-lossless_medium.ffpreset index 558be6c9..116e3343 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-lossless_medium.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-lossless_medium.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 directpred=1 flags2=+fastpskip diff --git a/mplayer/ffmpeg/ffpresets/libx264-lossless_slow.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-lossless_slow.ffpreset index ff641cf4..0d496f6e 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-lossless_slow.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-lossless_slow.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 refs=2 directpred=1 diff --git a/mplayer/ffmpeg/ffpresets/libx264-lossless_slower.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-lossless_slower.ffpreset index 854f74b2..672e0cd6 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-lossless_slower.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-lossless_slower.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 refs=4 directpred=1 diff --git a/mplayer/ffmpeg/ffpresets/libx264-lossless_ultrafast.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-lossless_ultrafast.ffpreset index 1c429f21..a2eda65e 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-lossless_ultrafast.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-lossless_ultrafast.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 directpred=1 flags2=+fastpskip diff --git a/mplayer/ffmpeg/ffpresets/libx264-medium.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-medium.ffpreset index 039f1d60..3c90ec5d 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-medium.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-medium.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=3 diff --git a/mplayer/ffmpeg/ffpresets/libx264-medium_firstpass.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-medium_firstpass.ffpreset index e4159892..2ad0a9cc 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-medium_firstpass.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-medium_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/mplayer/ffmpeg/ffpresets/libx264-placebo.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-placebo.ffpreset index fae2222d..9f4719f7 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-placebo.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-placebo.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=16 refs=16 diff --git a/mplayer/ffmpeg/ffpresets/libx264-placebo_firstpass.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-placebo_firstpass.ffpreset index fae2222d..9f4719f7 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-placebo_firstpass.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-placebo_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=16 refs=16 diff --git a/mplayer/ffmpeg/ffpresets/libx264-slow.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-slow.ffpreset index 0f3f4d4b..dabe0ae1 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-slow.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-slow.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=5 diff --git a/mplayer/ffmpeg/ffpresets/libx264-slow_firstpass.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-slow_firstpass.ffpreset index 89e74e45..4af64dbe 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-slow_firstpass.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-slow_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/mplayer/ffmpeg/ffpresets/libx264-slower.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-slower.ffpreset index f3a412c0..239ee68c 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-slower.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-slower.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=8 diff --git a/mplayer/ffmpeg/ffpresets/libx264-slower_firstpass.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-slower_firstpass.ffpreset index aa1eb1e9..4b5b420c 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-slower_firstpass.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-slower_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/mplayer/ffmpeg/ffpresets/libx264-superfast.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-superfast.ffpreset index bcd45993..fb2ab8c4 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-superfast.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-superfast.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/mplayer/ffmpeg/ffpresets/libx264-superfast_firstpass.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-superfast_firstpass.ffpreset index ef06b1d5..55ff9a2b 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-superfast_firstpass.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-superfast_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/mplayer/ffmpeg/ffpresets/libx264-ultrafast.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-ultrafast.ffpreset index b6d20808..28dc0eb8 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-ultrafast.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-ultrafast.ffpreset @@ -11,8 +11,8 @@ sc_threshold=0 i_qfactor=0.71 b_strategy=0 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=0 refs=1 diff --git a/mplayer/ffmpeg/ffpresets/libx264-ultrafast_firstpass.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-ultrafast_firstpass.ffpreset index b6d20808..28dc0eb8 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-ultrafast_firstpass.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-ultrafast_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=0 i_qfactor=0.71 b_strategy=0 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=0 refs=1 diff --git a/mplayer/ffmpeg/ffpresets/libx264-veryfast.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-veryfast.ffpreset index 16ca594a..bfa3d8fa 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-veryfast.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-veryfast.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/mplayer/ffmpeg/ffpresets/libx264-veryfast_firstpass.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-veryfast_firstpass.ffpreset index 39eaf3e2..ac2332df 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-veryfast_firstpass.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-veryfast_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=1 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=3 refs=1 diff --git a/mplayer/ffmpeg/ffpresets/libx264-veryslow.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-veryslow.ffpreset index a0606255..e07aeb82 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-veryslow.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-veryslow.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=8 refs=16 diff --git a/mplayer/ffmpeg/ffpresets/libx264-veryslow_firstpass.ffpreset b/mplayer/ffmpeg/ffpresets/libx264-veryslow_firstpass.ffpreset index 6e7079bb..e17c04b2 100644 --- a/mplayer/ffmpeg/ffpresets/libx264-veryslow_firstpass.ffpreset +++ b/mplayer/ffmpeg/ffpresets/libx264-veryslow_firstpass.ffpreset @@ -11,8 +11,8 @@ sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 -qmin=10 -qmax=51 +qmin=0 +qmax=69 qdiff=4 bf=8 refs=1 diff --git a/mplayer/ffmpeg/ffprobe.c b/mplayer/ffmpeg/ffprobe.c index 2c99e5a6..94b1d9b2 100644 --- a/mplayer/ffmpeg/ffprobe.c +++ b/mplayer/ffmpeg/ffprobe.c @@ -277,7 +277,7 @@ static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) return err; } - dump_format(fmt_ctx, 0, filename, 0); + av_dump_format(fmt_ctx, 0, filename, 0); /* bind a decoder to each input stream */ for (i = 0; i < fmt_ctx->nb_streams; i++) { diff --git a/mplayer/ffmpeg/ffserver.c b/mplayer/ffmpeg/ffserver.c index 9a324080..e5c4ac23 100644 --- a/mplayer/ffmpeg/ffserver.c +++ b/mplayer/ffmpeg/ffserver.c @@ -36,7 +36,7 @@ #include "libavutil/avstring.h" #include "libavutil/lfg.h" #include "libavutil/random_seed.h" -#include "libavcore/parseutils.h" +#include "libavutil/parseutils.h" #include "libavcodec/opt.h" #include #include @@ -163,7 +163,7 @@ typedef struct HTTPContext { /* RTSP state specific */ uint8_t *pb_buffer; /* XXX: use that in all the code */ - ByteIOContext *pb; + AVIOContext *pb; int seq; /* RTSP sequence number */ /* RTP state specific */ @@ -692,8 +692,8 @@ static int http_server(void) second to handle timeouts */ do { ret = poll(poll_table, poll_entry - poll_table, delay); - if (ret < 0 && ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) + if (ret < 0 && ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) return -1; } while (ret < 0); @@ -916,8 +916,8 @@ static int handle_connection(HTTPContext *c) read_loop: len = recv(c->fd, c->buffer_ptr, 1, 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) return -1; } else if (len == 0) { return -1; @@ -952,8 +952,8 @@ static int handle_connection(HTTPContext *c) return 0; len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) { + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) { /* error : close connection */ av_freep(&c->pb_buffer); return -1; @@ -1022,8 +1022,8 @@ static int handle_connection(HTTPContext *c) return 0; len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) { + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) { /* error : close connection */ av_freep(&c->pb_buffer); return -1; @@ -1049,8 +1049,8 @@ static int handle_connection(HTTPContext *c) len = send(c->fd, c->packet_buffer_ptr, c->packet_buffer_end - c->packet_buffer_ptr, 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) { + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) { /* error : close connection */ av_freep(&c->packet_buffer); return -1; @@ -1854,7 +1854,7 @@ static int http_parse_request(HTTPContext *c) return 0; } -static void fmt_bytecount(ByteIOContext *pb, int64_t count) +static void fmt_bytecount(AVIOContext *pb, int64_t count) { static const char *suffix = " kMGTP"; const char *s; @@ -1871,7 +1871,7 @@ static void compute_status(HTTPContext *c) char *p; time_t ti; int i, len; - ByteIOContext *pb; + AVIOContext *pb; if (url_open_dyn_buf(&pb) < 0) { /* XXX: return an error ? */ @@ -2135,11 +2135,10 @@ static int open_input_stream(HTTPContext *c, const char *info) strcpy(input_filename, c->stream->feed->feed_filename); buf_size = FFM_PACKET_SIZE; /* compute position (absolute time) */ - if (find_info_tag(buf, sizeof(buf), "date", info)) { - stream_pos = parse_date(buf, 0); - if (stream_pos == INT64_MIN) - return -1; - } else if (find_info_tag(buf, sizeof(buf), "buffer", info)) { + if (av_find_info_tag(buf, sizeof(buf), "date", info)) { + if ((ret = av_parse_time(&stream_pos, buf, 0)) < 0) + return ret; + } else if (av_find_info_tag(buf, sizeof(buf), "buffer", info)) { int prebuffer = strtol(buf, 0, 10); stream_pos = av_gettime() - prebuffer * (int64_t)1000000; } else @@ -2148,10 +2147,9 @@ static int open_input_stream(HTTPContext *c, const char *info) strcpy(input_filename, c->stream->feed_filename); buf_size = 0; /* compute position (relative time) */ - if (find_info_tag(buf, sizeof(buf), "date", info)) { - stream_pos = parse_date(buf, 1); - if (stream_pos == INT64_MIN) - return -1; + if (av_find_info_tag(buf, sizeof(buf), "date", info)) { + if ((ret = av_parse_time(&stream_pos, buf, 1)) < 0) + return ret; } else stream_pos = 0; } @@ -2493,7 +2491,7 @@ static int http_send_data(HTTPContext *c) if (c->rtp_protocol == RTSP_LOWER_TRANSPORT_TCP) { /* RTP packets are sent inside the RTSP TCP connection */ - ByteIOContext *pb; + AVIOContext *pb; int interleaved_index, size; uint8_t header[4]; HTTPContext *rtsp_c; @@ -2516,10 +2514,10 @@ static int http_send_data(HTTPContext *c) header[1] = interleaved_index; header[2] = len >> 8; header[3] = len; - put_buffer(pb, header, 4); + avio_write(pb, header, 4); /* write RTP packet data */ c->buffer_ptr += 4; - put_buffer(pb, c->buffer_ptr, len); + avio_write(pb, c->buffer_ptr, len); size = url_close_dyn_buf(pb, &c->packet_buffer); /* prepare asynchronous TCP sending */ rtsp_c->packet_buffer_ptr = c->packet_buffer; @@ -2552,8 +2550,8 @@ static int http_send_data(HTTPContext *c) /* TCP data output */ len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) /* error : close connection */ return -1; else @@ -2626,8 +2624,8 @@ static int http_receive_data(HTTPContext *c) len = recv(c->fd, c->buffer_ptr, 1, 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) /* error : close connection */ goto fail; return 0; @@ -2653,8 +2651,8 @@ static int http_receive_data(HTTPContext *c) len = recv(c->fd, c->buffer_ptr, FFMIN(c->chunk_size, c->buffer_end - c->buffer_ptr), 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) /* error : close connection */ goto fail; } else if (len == 0) @@ -2714,7 +2712,7 @@ static int http_receive_data(HTTPContext *c) } else { /* We have a header in our hands that contains useful data */ AVFormatContext *s = NULL; - ByteIOContext *pb; + AVIOContext *pb; AVInputFormat *fmt_in; int i; @@ -3020,7 +3018,7 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url) url_fprintf(c->pb, "Content-Type: application/sdp\r\n"); url_fprintf(c->pb, "Content-Length: %d\r\n", content_length); url_fprintf(c->pb, "\r\n"); - put_buffer(c->pb, content, content_length); + avio_write(c->pb, content, content_length); av_free(content); } @@ -3201,7 +3199,7 @@ static HTTPContext *find_rtp_session_with_url(const char *url, char path1[1024]; const char *path; char buf[1024]; - int s; + int s, len; rtp_c = find_rtp_session(session_id); if (!rtp_c) @@ -3221,6 +3219,10 @@ static HTTPContext *find_rtp_session_with_url(const char *url, return rtp_c; } } + len = strlen(path); + if (len > 0 && path[len - 1] == '/' && + !strncmp(path, rtp_c->stream->filename, len - 1)) + return rtp_c; return NULL; } @@ -3487,7 +3489,7 @@ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int cop fst->priv_data = av_mallocz(sizeof(FeedData)); fst->index = stream->nb_streams; av_set_pts_info(fst, 33, 1, 90000); - fst->sample_aspect_ratio = (AVRational){0,1}; + fst->sample_aspect_ratio = codec->sample_aspect_ratio; stream->streams[stream->nb_streams++] = fst; return fst; } @@ -3762,7 +3764,7 @@ static void build_feed_streams(void) } /* only write the header of the ffm file */ - if (url_fopen(&s->pb, feed->feed_filename, URL_WRONLY) < 0) { + if (avio_open(&s->pb, feed->feed_filename, URL_WRONLY) < 0) { http_log("Could not open output feed file '%s'\n", feed->feed_filename); exit(1); @@ -3781,7 +3783,7 @@ static void build_feed_streams(void) } /* XXX: need better api */ av_freep(&s->priv_data); - url_fclose(s->pb); + avio_close(s->pb); } /* get feed size and write index */ fd = open(feed->feed_filename, O_RDONLY); diff --git a/mplayer/ffmpeg/libavcodec/Makefile b/mplayer/ffmpeg/libavcodec/Makefile index 847036f9..930affbb 100644 --- a/mplayer/ffmpeg/libavcodec/Makefile +++ b/mplayer/ffmpeg/libavcodec/Makefile @@ -1,7 +1,7 @@ include $(SUBDIR)../config.mak NAME = avcodec -FFLIBS = avcore avutil +FFLIBS = avutil HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vdpau.h xvmc.h @@ -12,6 +12,7 @@ OBJS = allcodecs.o \ bitstream_filter.o \ dsputil.o \ faanidct.o \ + fmtconvert.o \ imgconvert.o \ jrevdct.o \ opt.o \ @@ -54,8 +55,10 @@ OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \ mpeg4audio.o OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o OBJS-$(CONFIG_AC3_DECODER) += ac3dec.o ac3dec_data.o ac3.o -OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3tab.o ac3.o -OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3tab.o ac3.o +OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3tab.o ac3.o \ + ac3dsp.o +OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3tab.o ac3.o \ + ac3dsp.o OBJS-$(CONFIG_ALAC_DECODER) += alac.o OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o @@ -414,7 +417,7 @@ OBJS-$(CONFIG_WNV1_DECODER) += wnv1.o OBJS-$(CONFIG_WS_SND1_DECODER) += ws-snd1.o OBJS-$(CONFIG_XAN_DPCM_DECODER) += dpcm.o OBJS-$(CONFIG_XAN_WC3_DECODER) += xan.o -OBJS-$(CONFIG_XAN_WC4_DECODER) += xan.o +OBJS-$(CONFIG_XAN_WC4_DECODER) += xxan.o OBJS-$(CONFIG_XL_DECODER) += xl.o OBJS-$(CONFIG_XSUB_DECODER) += xsubdec.o OBJS-$(CONFIG_XSUB_ENCODER) += xsubenc.o @@ -630,7 +633,6 @@ OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += movsub_bsf.o # thread libraries OBJS-$(HAVE_PTHREADS) += pthread.o OBJS-$(HAVE_W32THREADS) += w32thread.o -OBJS-$(HAVE_GEKKOTHREADS) += gekkothread.o OBJS-$(CONFIG_MLIB) += mlib/dsputil_mlib.o \ diff --git a/mplayer/ffmpeg/libavcodec/aac.h b/mplayer/ffmpeg/libavcodec/aac.h index 714e314c..73bc4084 100644 --- a/mplayer/ffmpeg/libavcodec/aac.h +++ b/mplayer/ffmpeg/libavcodec/aac.h @@ -35,6 +35,7 @@ #include "fft.h" #include "mpeg4audio.h" #include "sbr.h" +#include "fmtconvert.h" #include @@ -42,6 +43,7 @@ #define MAX_ELEM_ID 16 #define TNS_MAX_ORDER 20 +#define MAX_LTP_LONG_SFB 40 enum RawDataBlockType { TYPE_SCE, @@ -129,6 +131,16 @@ typedef struct { #define SCALE_MAX_DIFF 60 ///< maximum scalefactor difference allowed by standard #define SCALE_DIFF_ZERO 60 ///< codebook index corresponding to zero scalefactor indices difference +/** + * Long Term Prediction + */ +typedef struct { + int8_t present; + int16_t lag; + float coef; + int8_t used[MAX_LTP_LONG_SFB]; +} LongTermPrediction; + /** * Individual Channel Stream */ @@ -138,6 +150,7 @@ typedef struct { uint8_t use_kb_window[2]; ///< If set, use Kaiser-Bessel window, otherwise use a sinus window. int num_window_groups; uint8_t group_len[8]; + LongTermPrediction ltp; const uint16_t *swb_offset; ///< table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular window const uint8_t *swb_sizes; ///< table of scalefactor band sizes for a particular window int num_swb; ///< number of scalefactor window bands @@ -205,14 +218,15 @@ typedef struct { IndividualChannelStream ics; TemporalNoiseShaping tns; Pulse pulse; - enum BandType band_type[128]; ///< band types - int band_type_run_end[120]; ///< band type run end points - float sf[120]; ///< scalefactors - int sf_idx[128]; ///< scalefactor indices (used by encoder) - uint8_t zeroes[128]; ///< band is not coded (used by encoder) - DECLARE_ALIGNED(16, float, coeffs)[1024]; ///< coefficients for IMDCT - DECLARE_ALIGNED(16, float, saved)[1024]; ///< overlap - DECLARE_ALIGNED(16, float, ret)[2048]; ///< PCM output + enum BandType band_type[128]; ///< band types + int band_type_run_end[120]; ///< band type run end points + float sf[120]; ///< scalefactors + int sf_idx[128]; ///< scalefactor indices (used by encoder) + uint8_t zeroes[128]; ///< band is not coded (used by encoder) + DECLARE_ALIGNED(16, float, coeffs)[1024]; ///< coefficients for IMDCT + DECLARE_ALIGNED(16, float, saved)[1024]; ///< overlap + DECLARE_ALIGNED(16, float, ret)[2048]; ///< PCM output + DECLARE_ALIGNED(16, int16_t, ltp_state)[3072]; ///< time signal for LTP PredictorState predictor_state[MAX_PREDICTORS]; } SingleChannelElement; @@ -267,7 +281,9 @@ typedef struct { */ FFTContext mdct; FFTContext mdct_small; + FFTContext mdct_ltp; DSPContext dsp; + FmtConvertContext fmt_conv; int random_state; /** @} */ diff --git a/mplayer/ffmpeg/libavcodec/aacdec.c b/mplayer/ffmpeg/libavcodec/aacdec.c index 21270994..81a94f2f 100644 --- a/mplayer/ffmpeg/libavcodec/aacdec.c +++ b/mplayer/ffmpeg/libavcodec/aacdec.c @@ -42,7 +42,7 @@ * Y filterbank - standard * N (code in SoC repo) filterbank - Scalable Sample Rate * Y Temporal Noise Shaping - * N (code in SoC repo) Long Term Prediction + * Y Long Term Prediction * Y intensity stereo * Y channel coupling * Y frequency domain prediction @@ -85,6 +85,7 @@ #include "get_bits.h" #include "dsputil.h" #include "fft.h" +#include "fmtconvert.h" #include "lpc.h" #include "aac.h" @@ -477,6 +478,7 @@ static int decode_audio_specific_config(AACContext *ac, switch (m4ac->object_type) { case AOT_AAC_MAIN: case AOT_AAC_LC: + case AOT_AAC_LTP: if (decode_ga_specific_config(ac, avctx, &gb, m4ac, m4ac->chan_config)) return -1; break; @@ -562,6 +564,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) ff_aac_sbr_init(); dsputil_init(&ac->dsp, avctx); + ff_fmt_convert_init(&ac->fmt_conv, avctx); ac->random_state = 0x1f2e3d4c; @@ -578,8 +581,9 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) ff_aac_scalefactor_code, sizeof(ff_aac_scalefactor_code[0]), sizeof(ff_aac_scalefactor_code[0]), 352); - ff_mdct_init(&ac->mdct, 11, 1, 1.0); - ff_mdct_init(&ac->mdct_small, 8, 1, 1.0); + ff_mdct_init(&ac->mdct, 11, 1, 1.0); + ff_mdct_init(&ac->mdct_small, 8, 1, 1.0); + ff_mdct_init(&ac->mdct_ltp, 11, 0, 1.0); // window initialization ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024); ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128); @@ -628,6 +632,20 @@ static int decode_prediction(AACContext *ac, IndividualChannelStream *ics, return 0; } +/** + * Decode Long Term Prediction data; reference: table 4.xx. + */ +static void decode_ltp(AACContext *ac, LongTermPrediction *ltp, + GetBitContext *gb, uint8_t max_sfb) +{ + int sfb; + + ltp->lag = get_bits(gb, 11); + ltp->coef = ltp_coef[get_bits(gb, 3)] * ac->sf_scale; + for (sfb = 0; sfb < FFMIN(max_sfb, MAX_LTP_LONG_SFB); sfb++) + ltp->used[sfb] = get_bits1(gb); +} + /** * Decode Individual Channel Stream info; reference: table 4.6. * @@ -682,9 +700,8 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, memset(ics, 0, sizeof(IndividualChannelStream)); return -1; } else { - av_log_missing_feature(ac->avctx, "Predictor bit set but LTP is", 1); - memset(ics, 0, sizeof(IndividualChannelStream)); - return -1; + if ((ics->ltp.present = get_bits(gb, 1))) + decode_ltp(ac, &ics->ltp, gb, ics->max_sfb); } } } @@ -1369,13 +1386,13 @@ static void apply_mid_side_stereo(AACContext *ac, ChannelElement *cpe) * [1] mask is decoded from bitstream; [2] mask is all 1s; * [3] reserved for scalable AAC */ -static void apply_intensity_stereo(ChannelElement *cpe, int ms_present) +static void apply_intensity_stereo(AACContext *ac, ChannelElement *cpe, int ms_present) { const IndividualChannelStream *ics = &cpe->ch[1].ics; SingleChannelElement *sce1 = &cpe->ch[1]; float *coef0 = cpe->ch[0].coeffs, *coef1 = cpe->ch[1].coeffs; const uint16_t *offsets = ics->swb_offset; - int g, group, i, k, idx = 0; + int g, group, i, idx = 0; int c; float scale; for (g = 0; g < ics->num_window_groups; g++) { @@ -1388,8 +1405,10 @@ static void apply_intensity_stereo(ChannelElement *cpe, int ms_present) c *= 1 - 2 * cpe->ms_mask[idx]; scale = c * sce1->sf[idx]; for (group = 0; group < ics->group_len[g]; group++) - for (k = offsets[i]; k < offsets[i + 1]; k++) - coef1[group * 128 + k] = scale * coef0[group * 128 + k]; + ac->dsp.vector_fmul_scalar(coef1 + group * 128 + offsets[i], + coef0 + group * 128 + offsets[i], + scale, + offsets[i + 1] - offsets[i]); } } else { int bt_run_end = sce1->band_type_run_end[idx]; @@ -1418,6 +1437,9 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe) i = cpe->ch[1].ics.use_kb_window[0]; cpe->ch[1].ics = cpe->ch[0].ics; cpe->ch[1].ics.use_kb_window[1] = i; + if (cpe->ch[1].ics.predictor_present && (ac->m4ac.object_type != AOT_AAC_MAIN)) + if ((cpe->ch[1].ics.ltp.present = get_bits(gb, 1))) + decode_ltp(ac, &cpe->ch[1].ics.ltp, gb, cpe->ch[1].ics.max_sfb); ms_present = get_bits(gb, 2); if (ms_present == 3) { av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n"); @@ -1439,7 +1461,7 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe) } } - apply_intensity_stereo(cpe, ms_present); + apply_intensity_stereo(ac, cpe, ms_present); return 0; } @@ -1657,6 +1679,7 @@ static void apply_tns(float coef[1024], TemporalNoiseShaping *tns, int w, filt, m, i; int bottom, top, order, start, end, size, inc; float lpc[TNS_MAX_ORDER]; + float tmp[TNS_MAX_ORDER]; for (w = 0; w < ics->num_windows; w++) { bottom = ics->num_swb; @@ -1682,14 +1705,121 @@ static void apply_tns(float coef[1024], TemporalNoiseShaping *tns, } start += w * 128; - // ar filter - for (m = 0; m < size; m++, start += inc) - for (i = 1; i <= FFMIN(m, order); i++) - coef[start] -= coef[start - i * inc] * lpc[i - 1]; + if (decode) { + // ar filter + for (m = 0; m < size; m++, start += inc) + for (i = 1; i <= FFMIN(m, order); i++) + coef[start] -= coef[start - i * inc] * lpc[i - 1]; + } else { + // ma filter + for (m = 0; m < size; m++, start += inc) { + tmp[0] = coef[start]; + for (i = 1; i <= FFMIN(m, order); i++) + coef[start] += tmp[i] * lpc[i - 1]; + for (i = order; i > 0; i--) + tmp[i] = tmp[i - 1]; + } + } } } } +/** + * Apply windowing and MDCT to obtain the spectral + * coefficient from the predicted sample by LTP. + */ +static void windowing_and_mdct_ltp(AACContext *ac, float *out, + float *in, IndividualChannelStream *ics) +{ + const float *lwindow = ics->use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024; + const float *swindow = ics->use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128; + const float *lwindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_long_1024 : ff_sine_1024; + const float *swindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128; + + if (ics->window_sequence[0] != LONG_STOP_SEQUENCE) { + ac->dsp.vector_fmul(in, in, lwindow_prev, 1024); + } else { + memset(in, 0, 448 * sizeof(float)); + ac->dsp.vector_fmul(in + 448, in + 448, swindow_prev, 128); + memcpy(in + 576, in + 576, 448 * sizeof(float)); + } + if (ics->window_sequence[0] != LONG_START_SEQUENCE) { + ac->dsp.vector_fmul_reverse(in + 1024, in + 1024, lwindow, 1024); + } else { + memcpy(in + 1024, in + 1024, 448 * sizeof(float)); + ac->dsp.vector_fmul_reverse(in + 1024 + 448, in + 1024 + 448, swindow, 128); + memset(in + 1024 + 576, 0, 448 * sizeof(float)); + } + ff_mdct_calc(&ac->mdct_ltp, out, in); +} + +/** + * Apply the long term prediction + */ +static void apply_ltp(AACContext *ac, SingleChannelElement *sce) +{ + const LongTermPrediction *ltp = &sce->ics.ltp; + const uint16_t *offsets = sce->ics.swb_offset; + int i, sfb; + + if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) { + float *predTime = sce->ret; + float *predFreq = ac->buf_mdct; + int16_t num_samples = 2048; + + if (ltp->lag < 1024) + num_samples = ltp->lag + 1024; + for (i = 0; i < num_samples; i++) + predTime[i] = sce->ltp_state[i + 2048 - ltp->lag] * ltp->coef; + memset(&predTime[i], 0, (2048 - i) * sizeof(float)); + + windowing_and_mdct_ltp(ac, predFreq, predTime, &sce->ics); + + if (sce->tns.present) + apply_tns(predFreq, &sce->tns, &sce->ics, 0); + + for (sfb = 0; sfb < FFMIN(sce->ics.max_sfb, MAX_LTP_LONG_SFB); sfb++) + if (ltp->used[sfb]) + for (i = offsets[sfb]; i < offsets[sfb + 1]; i++) + sce->coeffs[i] += predFreq[i]; + } +} + +/** + * Update the LTP buffer for next frame + */ +static void update_ltp(AACContext *ac, SingleChannelElement *sce) +{ + IndividualChannelStream *ics = &sce->ics; + float *saved = sce->saved; + float *saved_ltp = sce->coeffs; + const float *lwindow = ics->use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024; + const float *swindow = ics->use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128; + int i; + + if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { + memcpy(saved_ltp, saved, 512 * sizeof(float)); + memset(saved_ltp + 576, 0, 448 * sizeof(float)); + ac->dsp.vector_fmul_reverse(saved_ltp + 448, ac->buf_mdct + 960, &swindow[64], 64); + for (i = 0; i < 64; i++) + saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * swindow[63 - i]; + } else if (ics->window_sequence[0] == LONG_START_SEQUENCE) { + memcpy(saved_ltp, ac->buf_mdct + 512, 448 * sizeof(float)); + memset(saved_ltp + 576, 0, 448 * sizeof(float)); + ac->dsp.vector_fmul_reverse(saved_ltp + 448, ac->buf_mdct + 960, &swindow[64], 64); + for (i = 0; i < 64; i++) + saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * swindow[63 - i]; + } else { // LONG_STOP or ONLY_LONG + ac->dsp.vector_fmul_reverse(saved_ltp, ac->buf_mdct + 512, &lwindow[512], 512); + for (i = 0; i < 512; i++) + saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * lwindow[511 - i]; + } + + memcpy(sce->ltp_state, &sce->ltp_state[1024], 1024 * sizeof(int16_t)); + ac->fmt_conv.float_to_int16(&(sce->ltp_state[1024]), sce->ret, 1024); + ac->fmt_conv.float_to_int16(&(sce->ltp_state[2048]), saved_ltp, 1024); +} + /** * Conduct IMDCT and windowing. */ @@ -1721,19 +1851,19 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce) */ if ((ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE) && (ics->window_sequence[0] == ONLY_LONG_SEQUENCE || ics->window_sequence[0] == LONG_START_SEQUENCE)) { - ac->dsp.vector_fmul_window( out, saved, buf, lwindow_prev, 0, 512); + ac->dsp.vector_fmul_window( out, saved, buf, lwindow_prev, 512); } else { memcpy( out, saved, 448 * sizeof(float)); if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { - ac->dsp.vector_fmul_window(out + 448 + 0*128, saved + 448, buf + 0*128, swindow_prev, 0, 64); - ac->dsp.vector_fmul_window(out + 448 + 1*128, buf + 0*128 + 64, buf + 1*128, swindow, 0, 64); - ac->dsp.vector_fmul_window(out + 448 + 2*128, buf + 1*128 + 64, buf + 2*128, swindow, 0, 64); - ac->dsp.vector_fmul_window(out + 448 + 3*128, buf + 2*128 + 64, buf + 3*128, swindow, 0, 64); - ac->dsp.vector_fmul_window(temp, buf + 3*128 + 64, buf + 4*128, swindow, 0, 64); + ac->dsp.vector_fmul_window(out + 448 + 0*128, saved + 448, buf + 0*128, swindow_prev, 64); + ac->dsp.vector_fmul_window(out + 448 + 1*128, buf + 0*128 + 64, buf + 1*128, swindow, 64); + ac->dsp.vector_fmul_window(out + 448 + 2*128, buf + 1*128 + 64, buf + 2*128, swindow, 64); + ac->dsp.vector_fmul_window(out + 448 + 3*128, buf + 2*128 + 64, buf + 3*128, swindow, 64); + ac->dsp.vector_fmul_window(temp, buf + 3*128 + 64, buf + 4*128, swindow, 64); memcpy( out + 448 + 4*128, temp, 64 * sizeof(float)); } else { - ac->dsp.vector_fmul_window(out + 448, saved + 448, buf, swindow_prev, 0, 64); + ac->dsp.vector_fmul_window(out + 448, saved + 448, buf, swindow_prev, 64); memcpy( out + 576, buf + 64, 448 * sizeof(float)); } } @@ -1741,9 +1871,9 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce) // buffer update if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { memcpy( saved, temp + 64, 64 * sizeof(float)); - ac->dsp.vector_fmul_window(saved + 64, buf + 4*128 + 64, buf + 5*128, swindow, 0, 64); - ac->dsp.vector_fmul_window(saved + 192, buf + 5*128 + 64, buf + 6*128, swindow, 0, 64); - ac->dsp.vector_fmul_window(saved + 320, buf + 6*128 + 64, buf + 7*128, swindow, 0, 64); + ac->dsp.vector_fmul_window(saved + 64, buf + 4*128 + 64, buf + 5*128, swindow, 64); + ac->dsp.vector_fmul_window(saved + 192, buf + 5*128 + 64, buf + 6*128, swindow, 64); + ac->dsp.vector_fmul_window(saved + 320, buf + 6*128 + 64, buf + 7*128, swindow, 64); memcpy( saved + 448, buf + 7*128 + 64, 64 * sizeof(float)); } else if (ics->window_sequence[0] == LONG_START_SEQUENCE) { memcpy( saved, buf + 512, 448 * sizeof(float)); @@ -1855,6 +1985,14 @@ static void spectral_to_sample(AACContext *ac) if (che) { if (type <= TYPE_CPE) apply_channel_coupling(ac, che, type, i, BEFORE_TNS, apply_dependent_coupling); + if (ac->m4ac.object_type == AOT_AAC_LTP) { + if (che->ch[0].ics.predictor_present) { + if (che->ch[0].ics.ltp.present) + apply_ltp(ac, &che->ch[0]); + if (che->ch[1].ics.ltp.present && type == TYPE_CPE) + apply_ltp(ac, &che->ch[1]); + } + } if (che->ch[0].tns.present) apply_tns(che->ch[0].coeffs, &che->ch[0].tns, &che->ch[0].ics, 1); if (che->ch[1].tns.present) @@ -1863,8 +2001,12 @@ static void spectral_to_sample(AACContext *ac) apply_channel_coupling(ac, che, type, i, BETWEEN_TNS_AND_IMDCT, apply_dependent_coupling); if (type != TYPE_CCE || che->coup.coupling_point == AFTER_IMDCT) { imdct_and_windowing(ac, &che->ch[0]); + if (ac->m4ac.object_type == AOT_AAC_LTP) + update_ltp(ac, &che->ch[0]); if (type == TYPE_CPE) { imdct_and_windowing(ac, &che->ch[1]); + if (ac->m4ac.object_type == AOT_AAC_LTP) + update_ltp(ac, &che->ch[1]); } if (ac->m4ac.sbr > 0) { ff_sbr_apply(ac, &che->sbr, type, che->ch[0].ret, che->ch[1].ret); @@ -2032,7 +2174,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, *data_size = data_size_tmp; if (samples) - ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels); + ac->fmt_conv.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels); if (ac->output_configured) ac->output_configured = OC_LOCKED; @@ -2078,6 +2220,7 @@ static av_cold int aac_decode_close(AVCodecContext *avctx) ff_mdct_end(&ac->mdct); ff_mdct_end(&ac->mdct_small); + ff_mdct_end(&ac->mdct_ltp); return 0; } @@ -2361,7 +2504,7 @@ AVCodec ff_aac_decoder = { */ AVCodec ff_aac_latm_decoder = { .name = "aac_latm", - .type = CODEC_TYPE_AUDIO, + .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_AAC_LATM, .priv_data_size = sizeof(struct LATMContext), .init = latm_decode_init, diff --git a/mplayer/ffmpeg/libavcodec/aacdectab.h b/mplayer/ffmpeg/libavcodec/aacdectab.h index b4307f13..0bccb84c 100644 --- a/mplayer/ffmpeg/libavcodec/aacdectab.h +++ b/mplayer/ffmpeg/libavcodec/aacdectab.h @@ -30,11 +30,19 @@ #ifndef AVCODEC_AACDECTAB_H #define AVCODEC_AACDECTAB_H -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "aac.h" #include +/* @name ltp_coef + * Table of the LTP coefficient (multiplied by 2) + */ +static const float ltp_coef[8] = { + 1.141658, 1.393232, 1.626008, 1.822608, + 1.969800, 2.135788, 2.2389202, 2.739066, +}; + /* @name tns_tmp2_map * Tables of the tmp2[] arrays of LPC coefficients used for TNS. * The suffix _M_N[] indicate the values of coef_compress and coef_res diff --git a/mplayer/ffmpeg/libavcodec/aacsbr.c b/mplayer/ffmpeg/libavcodec/aacsbr.c index 9b10bf25..237d51a3 100644 --- a/mplayer/ffmpeg/libavcodec/aacsbr.c +++ b/mplayer/ffmpeg/libavcodec/aacsbr.c @@ -1134,16 +1134,12 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) * @param W array of complex-valued samples split into subbands */ static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in, float *x, - float z[320], float W[2][32][32][2], - float scale) + float z[320], float W[2][32][32][2]) { int i, k; memcpy(W[0], W[1], sizeof(W[0])); memcpy(x , x+1024, (320-32)*sizeof(x[0])); - if (scale != 1.0f) - dsp->vector_fmul_scalar(x+288, in, scale, 1024); - else - memcpy(x+288, in, 1024*sizeof(*x)); + memcpy(x+288, in, 1024*sizeof(x[0])); for (i = 0; i < 32; i++) { // numTimeSlots*RATE = 16*2 as 960 sample frames // are not supported dsp->vector_fmul_reverse(z, sbr_qmf_window_ds, x, 320); @@ -1722,7 +1718,7 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac, /* decode channel */ sbr_qmf_analysis(&ac->dsp, &sbr->mdct_ana, ch ? R : L, sbr->data[ch].analysis_filterbank_samples, (float*)sbr->qmf_filter_scratch, - sbr->data[ch].W, 1/(-1024 * ac->sf_scale)); + sbr->data[ch].W); sbr_lf_gen(ac, sbr, sbr->X_low, sbr->data[ch].W); if (sbr->start) { sbr_hf_inverse_filter(sbr->alpha0, sbr->alpha1, sbr->X_low, sbr->k[0]); diff --git a/mplayer/ffmpeg/libavcodec/ac3_parser.c b/mplayer/ffmpeg/libavcodec/ac3_parser.c index 4737d6f8..301aadcd 100644 --- a/mplayer/ffmpeg/libavcodec/ac3_parser.c +++ b/mplayer/ffmpeg/libavcodec/ac3_parser.c @@ -24,6 +24,7 @@ #include "ac3_parser.h" #include "aac_ac3_parser.h" #include "get_bits.h" +#include "libavutil/audioconvert.h" #define AC3_HEADER_SIZE 7 @@ -123,7 +124,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) } hdr->channel_layout = ff_ac3_channel_layout_tab[hdr->channel_mode]; if (hdr->lfe_on) - hdr->channel_layout |= CH_LOW_FREQUENCY; + hdr->channel_layout |= AV_CH_LOW_FREQUENCY; return 0; } diff --git a/mplayer/ffmpeg/libavcodec/ac3dec.c b/mplayer/ffmpeg/libavcodec/ac3dec.c index ab738771..5ebee190 100644 --- a/mplayer/ffmpeg/libavcodec/ac3dec.c +++ b/mplayer/ffmpeg/libavcodec/ac3dec.c @@ -193,6 +193,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) ff_mdct_init(&s->imdct_512, 9, 1, 1.0); ff_kbd_window_init(s->window, 5.0, 256); dsputil_init(&s->dsp, avctx); + ff_fmt_convert_init(&s->fmt_conv, avctx); av_lfg_init(&s->dith_state, 0); /* set scale value for float to int16 conversion */ @@ -628,13 +629,13 @@ static inline void do_imdct(AC3DecodeContext *s, int channels) for(i=0; i<128; i++) x[i] = s->transform_coeffs[ch][2*i]; ff_imdct_half(&s->imdct_256, s->tmp_output, x); - s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 0, 128); + s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 128); for(i=0; i<128; i++) x[i] = s->transform_coeffs[ch][2*i+1]; ff_imdct_half(&s->imdct_256, s->delay[ch-1], x); } else { ff_imdct_half(&s->imdct_512, s->tmp_output, s->transform_coeffs[ch]); - s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 0, 128); + s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 128); memcpy(s->delay[ch-1], s->tmp_output+128, 128*sizeof(float)); } } @@ -1255,7 +1256,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk) } else { gain *= s->dynamic_range[0]; } - s->dsp.int32_to_float_fmul_scalar(s->transform_coeffs[ch], s->fixed_coeffs[ch], gain, 256); + s->fmt_conv.int32_to_float_fmul_scalar(s->transform_coeffs[ch], s->fixed_coeffs[ch], gain, 256); } /* apply spectral extension to high frequency bins */ @@ -1407,7 +1408,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n"); err = 1; } - s->dsp.float_to_int16_interleave(out_samples, output, 256, s->out_channels); + s->fmt_conv.float_to_int16_interleave(out_samples, output, 256, s->out_channels); out_samples += 256 * s->out_channels; } *data_size = s->num_blocks * 256 * avctx->channels * sizeof (int16_t); diff --git a/mplayer/ffmpeg/libavcodec/ac3dec.h b/mplayer/ffmpeg/libavcodec/ac3dec.h index 55520cdc..147e5e59 100644 --- a/mplayer/ffmpeg/libavcodec/ac3dec.h +++ b/mplayer/ffmpeg/libavcodec/ac3dec.h @@ -55,6 +55,7 @@ #include "get_bits.h" #include "dsputil.h" #include "fft.h" +#include "fmtconvert.h" /* override ac3.h to include coupling channel */ #undef AC3_MAX_CHANNELS @@ -190,6 +191,7 @@ typedef struct { ///@defgroup opt optimization DSPContext dsp; ///< for optimization + FmtConvertContext fmt_conv; ///< optimized conversion functions float mul_bias; ///< scaling for float_to_int16 conversion ///@} diff --git a/mplayer/ffmpeg/libavcodec/ac3dsp.c b/mplayer/ffmpeg/libavcodec/ac3dsp.c new file mode 100644 index 00000000..da3a123e --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/ac3dsp.c @@ -0,0 +1,60 @@ +/* + * AC-3 DSP utils + * Copyright (c) 2011 Justin Ruggles + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avcodec.h" +#include "ac3dsp.h" + +static void ac3_exponent_min_c(uint8_t *exp, int num_reuse_blocks, int nb_coefs) +{ + int blk, i; + + if (!num_reuse_blocks) + return; + + for (i = 0; i < nb_coefs; i++) { + uint8_t min_exp = *exp; + uint8_t *exp1 = exp + 256; + for (blk = 0; blk < num_reuse_blocks; blk++) { + uint8_t next_exp = *exp1; + if (next_exp < min_exp) + min_exp = next_exp; + exp1 += 256; + } + *exp++ = min_exp; + } +} + +static int ac3_max_msb_abs_int16_c(const int16_t *src, int len) +{ + int i, v = 0; + for (i = 0; i < len; i++) + v |= abs(src[i]); + return v; +} + +av_cold void ff_ac3dsp_init(AC3DSPContext *c) +{ + c->ac3_exponent_min = ac3_exponent_min_c; + c->ac3_max_msb_abs_int16 = ac3_max_msb_abs_int16_c; + + if (HAVE_MMX) + ff_ac3dsp_init_x86(c); +} diff --git a/mplayer/ffmpeg/libavcodec/ac3dsp.h b/mplayer/ffmpeg/libavcodec/ac3dsp.h new file mode 100644 index 00000000..a4f141f2 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/ac3dsp.h @@ -0,0 +1,54 @@ +/* + * AC-3 DSP utils + * Copyright (c) 2011 Justin Ruggles + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AC3DSP_H +#define AVCODEC_AC3DSP_H + +#include + +typedef struct AC3DSPContext { + /** + * Set each encoded exponent in a block to the minimum of itself and the + * exponents in the same frequency bin of up to 5 following blocks. + * @param exp pointer to the start of the current block of exponents. + * constraints: align 16 + * @param num_reuse_blocks number of blocks that will reuse exponents from the current block. + * constraints: range 0 to 5 + * @param nb_coefs number of frequency coefficients. + */ + void (*ac3_exponent_min)(uint8_t *exp, int num_reuse_blocks, int nb_coefs); + + /** + * Calculate the maximum MSB of the absolute value of each element in an + * array of int16_t. + * @param src input array + * constraints: align 16. values must be in range [-32767,32767] + * @param len number of values in the array + * constraints: multiple of 16 greater than 0 + * @return a value with the same MSB as max(abs(src[])) + */ + int (*ac3_max_msb_abs_int16)(const int16_t *src, int len); +} AC3DSPContext; + +void ff_ac3dsp_init (AC3DSPContext *c); +void ff_ac3dsp_init_x86(AC3DSPContext *c); + +#endif /* AVCODEC_AC3DSP_H */ diff --git a/mplayer/ffmpeg/libavcodec/ac3enc.c b/mplayer/ffmpeg/libavcodec/ac3enc.c index ed7a171a..02bc403f 100644 --- a/mplayer/ffmpeg/libavcodec/ac3enc.c +++ b/mplayer/ffmpeg/libavcodec/ac3enc.c @@ -28,11 +28,12 @@ //#define DEBUG -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "libavutil/crc.h" #include "avcodec.h" #include "put_bits.h" #include "dsputil.h" +#include "ac3dsp.h" #include "ac3.h" #include "audioconvert.h" @@ -86,6 +87,7 @@ typedef struct AC3Block { typedef struct AC3EncodeContext { PutBitContext pb; ///< bitstream writer context DSPContext dsp; + AC3DSPContext ac3dsp; ///< AC-3 optimized functions AC3MDCTContext mdct; ///< MDCT context AC3Block blocks[AC3_MAX_BLOCKS]; ///< per-block info @@ -308,9 +310,9 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s) nb_coefs = FFMIN(s->nb_coefs[0], s->nb_coefs[1]); - s->blocks[0].new_rematrixing_strategy = 1; for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { block = &s->blocks[blk]; + block->new_rematrixing_strategy = !blk; for (bnd = 0; bnd < 4; bnd++) { /* calculate calculate sum of squared coeffs for one band in one block */ int start = ff_ac3_rematrix_band_tab[bnd]; @@ -335,7 +337,6 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s) /* determine if new rematrixing flags will be sent */ if (blk && - !block->new_rematrixing_strategy && block->rematrixing_flags[bnd] != block0->rematrixing_flags[bnd]) { block->new_rematrixing_strategy = 1; } @@ -434,7 +435,7 @@ static void extract_exponents(AC3EncodeContext *s) * Exponent Difference Threshold. * New exponents are sent if their SAD exceed this number. */ -#define EXP_DIFF_THRESHOLD 1000 +#define EXP_DIFF_THRESHOLD 500 /** @@ -458,7 +459,6 @@ static void compute_exp_strategy_ch(AC3EncodeContext *s, uint8_t *exp_strategy, exp_strategy[blk] = EXP_REUSE; exp += AC3_MAX_COEFS; } - emms_c(); /* now select the encoding strategy type : if exponents are often recoded, we use a coarse encoding */ @@ -498,31 +498,6 @@ static void compute_exp_strategy(AC3EncodeContext *s) } -/** - * Set each encoded exponent in a block to the minimum of itself and the - * exponents in the same frequency bin of up to 5 following blocks. - */ -static void exponent_min(uint8_t *exp, int num_reuse_blocks, int nb_coefs) -{ - int blk, i; - - if (!num_reuse_blocks) - return; - - for (i = 0; i < nb_coefs; i++) { - uint8_t min_exp = *exp; - uint8_t *exp1 = exp + AC3_MAX_COEFS; - for (blk = 0; blk < num_reuse_blocks; blk++) { - uint8_t next_exp = *exp1; - if (next_exp < min_exp) - min_exp = next_exp; - exp1 += AC3_MAX_COEFS; - } - *exp++ = min_exp; - } -} - - /** * Update the exponents so that they are the ones the decoder will decode. */ @@ -616,7 +591,7 @@ static void encode_exponents(AC3EncodeContext *s) num_reuse_blocks = blk1 - blk - 1; /* for the EXP_REUSE case we select the min of the exponents */ - exponent_min(exp, num_reuse_blocks, nb_coefs); + s->ac3dsp.ac3_exponent_min(exp, num_reuse_blocks, nb_coefs); encode_exponents_blk_ch(exp, nb_coefs, exp_strategy[blk]); @@ -704,6 +679,8 @@ static void process_exponents(AC3EncodeContext *s) encode_exponents(s); group_exponents(s); + + emms_c(); } @@ -774,7 +751,7 @@ static void bit_alloc_init(AC3EncodeContext *s) s->fast_decay_code = 1; s->slow_gain_code = 1; s->db_per_bit_code = 3; - s->floor_code = 4; + s->floor_code = 7; for (ch = 0; ch < s->channels; ch++) s->fast_gain_code[ch] = 4; @@ -1856,6 +1833,7 @@ static av_cold int ac3_encode_init(AVCodecContext *avctx) avctx->coded_frame= avcodec_alloc_frame(); dsputil_init(&s->dsp, avctx); + ff_ac3dsp_init(&s->ac3dsp); return 0; init_fail: diff --git a/mplayer/ffmpeg/libavcodec/ac3enc_fixed.c b/mplayer/ffmpeg/libavcodec/ac3enc_fixed.c index 90e148b9..3de00ee4 100644 --- a/mplayer/ffmpeg/libavcodec/ac3enc_fixed.c +++ b/mplayer/ffmpeg/libavcodec/ac3enc_fixed.c @@ -270,14 +270,9 @@ static void apply_window(DSPContext *dsp, int16_t *output, const int16_t *input, * @param n number of values in the array * @return log2(max(abs(tab[]))) */ -static int log2_tab(int16_t *tab, int n) +static int log2_tab(AC3EncodeContext *s, int16_t *src, int len) { - int i, v; - - v = 0; - for (i = 0; i < n; i++) - v |= abs(tab[i]); - + int v = s->ac3dsp.ac3_max_msb_abs_int16(src, len); return av_log2(v); } @@ -286,19 +281,15 @@ static int log2_tab(int16_t *tab, int n) * Left-shift each value in an array by a specified amount. * @param tab input array * @param n number of values in the array - * @param lshift left shift amount. a negative value means right shift. + * @param lshift left shift amount */ -static void lshift_tab(int16_t *tab, int n, int lshift) +static void lshift_tab(int16_t *tab, int n, unsigned int lshift) { int i; if (lshift > 0) { for (i = 0; i < n; i++) tab[i] <<= lshift; - } else if (lshift < 0) { - lshift = -lshift; - for (i = 0; i < n; i++) - tab[i] >>= lshift; } } @@ -312,8 +303,7 @@ static void lshift_tab(int16_t *tab, int n, int lshift) */ static int normalize_samples(AC3EncodeContext *s) { - int v = 14 - log2_tab(s->windowed_samples, AC3_WINDOW_SIZE); - v = FFMAX(0, v); + int v = 14 - log2_tab(s, s->windowed_samples, AC3_WINDOW_SIZE); lshift_tab(s->windowed_samples, AC3_WINDOW_SIZE, v); return v - 9; } diff --git a/mplayer/ffmpeg/libavcodec/ac3tab.c b/mplayer/ffmpeg/libavcodec/ac3tab.c index 7c0ebcdc..f7b03020 100644 --- a/mplayer/ffmpeg/libavcodec/ac3tab.c +++ b/mplayer/ffmpeg/libavcodec/ac3tab.c @@ -24,7 +24,7 @@ * tables taken directly from the AC-3 spec. */ -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "avcodec.h" #include "ac3tab.h" diff --git a/mplayer/ffmpeg/libavcodec/adpcm.c b/mplayer/ffmpeg/libavcodec/adpcm.c index fb5bdc7f..826c5886 100644 --- a/mplayer/ffmpeg/libavcodec/adpcm.c +++ b/mplayer/ffmpeg/libavcodec/adpcm.c @@ -1719,7 +1719,7 @@ AVCodec ff_ ## name ## _encoder = { \ NULL, \ .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ -}; +} #else #define ADPCM_ENCODER(id,name,long_name_) #endif @@ -1736,13 +1736,13 @@ AVCodec ff_ ## name ## _decoder = { \ NULL, \ adpcm_decode_frame, \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ -}; +} #else #define ADPCM_DECODER(id,name,long_name_) #endif #define ADPCM_CODEC(id,name,long_name_) \ - ADPCM_ENCODER(id,name,long_name_) ADPCM_DECODER(id,name,long_name_) + ADPCM_ENCODER(id,name,long_name_); ADPCM_DECODER(id,name,long_name_) /* Note: Do not forget to add new entries to the Makefile as well. */ ADPCM_DECODER(CODEC_ID_ADPCM_4XM, adpcm_4xm, "ADPCM 4X Movie"); diff --git a/mplayer/ffmpeg/libavcodec/allcodecs.c b/mplayer/ffmpeg/libavcodec/allcodecs.c index 04c5c6aa..108a3ab7 100644 --- a/mplayer/ffmpeg/libavcodec/allcodecs.c +++ b/mplayer/ffmpeg/libavcodec/allcodecs.c @@ -214,6 +214,7 @@ void avcodec_register_all(void) REGISTER_DECODER (WMV3_VDPAU, wmv3_vdpau); REGISTER_DECODER (WNV1, wnv1); REGISTER_DECODER (XAN_WC3, xan_wc3); + REGISTER_DECODER (XAN_WC4, xan_wc4); REGISTER_DECODER (XL, xl); REGISTER_DECODER (YOP, yop); REGISTER_ENCDEC (ZLIB, zlib); diff --git a/mplayer/ffmpeg/libavcodec/alsdec.c b/mplayer/ffmpeg/libavcodec/alsdec.c index bfc589d2..41b3f0ca 100644 --- a/mplayer/ffmpeg/libavcodec/alsdec.c +++ b/mplayer/ffmpeg/libavcodec/alsdec.c @@ -36,7 +36,7 @@ #include "bytestream.h" #include "bgmc.h" #include "dsputil.h" -#include "libavcore/samplefmt.h" +#include "libavutil/samplefmt.h" #include "libavutil/crc.h" #include diff --git a/mplayer/ffmpeg/libavcodec/amrnbdec.c b/mplayer/ffmpeg/libavcodec/amrnbdec.c index ec896c7d..2883b9c3 100644 --- a/mplayer/ffmpeg/libavcodec/amrnbdec.c +++ b/mplayer/ffmpeg/libavcodec/amrnbdec.c @@ -255,7 +255,7 @@ static void lsf2lsp_for_mode12k2(AMRContext *p, double lsp[LP_FILTER_ORDER], } if (update) - memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(float)); + memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(*lsf_r)); for (i = 0; i < LP_FILTER_ORDER; i++) lsf_q[i] = lsf_r[i] * (LSF_R_FAC / 8000.0) + lsf_no_r[i] * (1.0 / 8000.0); diff --git a/mplayer/ffmpeg/libavcodec/amrwbdec.c b/mplayer/ffmpeg/libavcodec/amrwbdec.c index 8bf02a2b..90bf1d5f 100644 --- a/mplayer/ffmpeg/libavcodec/amrwbdec.c +++ b/mplayer/ffmpeg/libavcodec/amrwbdec.c @@ -89,7 +89,7 @@ static av_cold int amrwb_decode_init(AVCodecContext *avctx) AMRWBContext *ctx = avctx->priv_data; int i; - avctx->sample_fmt = SAMPLE_FMT_FLT; + avctx->sample_fmt = AV_SAMPLE_FMT_FLT; av_lfg_init(&ctx->prng, 1); @@ -1227,11 +1227,11 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVCodec ff_amrwb_decoder = { .name = "amrwb", - .type = CODEC_TYPE_AUDIO, + .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_AMR_WB, .priv_data_size = sizeof(AMRWBContext), .init = amrwb_decode_init, .decode = amrwb_decode_frame, .long_name = NULL_IF_CONFIG_SMALL("Adaptive Multi-Rate WideBand"), - .sample_fmts = (enum AVSampleFormat[]){SAMPLE_FMT_FLT,SAMPLE_FMT_NONE}, + .sample_fmts = (enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE}, }; diff --git a/mplayer/ffmpeg/libavcodec/apedec.c b/mplayer/ffmpeg/libavcodec/apedec.c index b6d6f9d9..05498777 100644 --- a/mplayer/ffmpeg/libavcodec/apedec.c +++ b/mplayer/ffmpeg/libavcodec/apedec.c @@ -25,6 +25,7 @@ #include "dsputil.h" #include "get_bits.h" #include "bytestream.h" +#include "libavutil/audioconvert.h" /** * @file @@ -199,7 +200,7 @@ static av_cold int ape_decode_init(AVCodecContext * avctx) dsputil_init(&s->dsp, avctx); avctx->sample_fmt = AV_SAMPLE_FMT_S16; - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; return 0; } diff --git a/mplayer/ffmpeg/libavcodec/arm/Makefile b/mplayer/ffmpeg/libavcodec/arm/Makefile index 4c30e0ab..d223703c 100644 --- a/mplayer/ffmpeg/libavcodec/arm/Makefile +++ b/mplayer/ffmpeg/libavcodec/arm/Makefile @@ -2,6 +2,8 @@ OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o \ OBJS-$(CONFIG_VP5_DECODER) += arm/vp56dsp_init_arm.o OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_init_arm.o +OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_init_arm.o +ARMV6-OBJS-$(CONFIG_VP8_DECODER) += arm/vp8_armv6.o OBJS-$(CONFIG_H264DSP) += arm/h264dsp_init_arm.o OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o @@ -9,6 +11,7 @@ OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o OBJS += arm/dsputil_init_arm.o \ arm/dsputil_arm.o \ arm/fft_init_arm.o \ + arm/fmtconvert_init_arm.o \ arm/jrevdct_arm.o \ arm/mpegvideo_arm.o \ arm/simple_idct_arm.o \ @@ -21,9 +24,13 @@ OBJS-$(HAVE_ARMV5TE) += arm/dsputil_init_armv5te.o \ OBJS-$(HAVE_ARMV6) += arm/dsputil_init_armv6.o \ arm/dsputil_armv6.o \ arm/simple_idct_armv6.o \ + $(ARMV6-OBJS-yes) + +VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o \ OBJS-$(HAVE_ARMVFP) += arm/dsputil_vfp.o \ arm/dsputil_init_vfp.o \ + $(VFP-OBJS-yes) OBJS-$(HAVE_IWMMXT) += arm/dsputil_iwmmxt.o \ arm/mpegvideo_iwmmxt.o \ @@ -50,8 +57,11 @@ NEON-OBJS-$(CONFIG_VP5_DECODER) += arm/vp56dsp_neon.o \ NEON-OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_neon.o \ arm/vp3dsp_neon.o \ +NEON-OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_neon.o + OBJS-$(HAVE_NEON) += arm/dsputil_init_neon.o \ arm/dsputil_neon.o \ + arm/fmtconvert_neon.o \ arm/int_neon.o \ arm/mpegvideo_neon.o \ arm/simple_idct_neon.o \ diff --git a/mplayer/ffmpeg/libavcodec/arm/asm.S b/mplayer/ffmpeg/libavcodec/arm/asm.S index e0507834..cf73a776 100644 --- a/mplayer/ffmpeg/libavcodec/arm/asm.S +++ b/mplayer/ffmpeg/libavcodec/arm/asm.S @@ -50,6 +50,16 @@ ELF .type \name, %function \name: .endm +.macro const name, align=2 + .macro endconst +ELF .size \name, . - \name + .purgem endconst + .endm + .section .rodata + .align \align +\name: +.endm + .macro mov32 rd, val #if HAVE_ARMV6T2 movw \rd, #(\val) & 0xffff diff --git a/mplayer/ffmpeg/libavcodec/arm/dcadsp_init_arm.c b/mplayer/ffmpeg/libavcodec/arm/dcadsp_init_arm.c index 816718d4..5663cd7f 100644 --- a/mplayer/ffmpeg/libavcodec/arm/dcadsp_init_arm.c +++ b/mplayer/ffmpeg/libavcodec/arm/dcadsp_init_arm.c @@ -23,7 +23,7 @@ #include "libavcodec/dcadsp.h" void ff_dca_lfe_fir_neon(float *out, const float *in, const float *coefs, - int decifactor, float scale, float bias); + int decifactor, float scale); void av_cold ff_dcadsp_init_arm(DCADSPContext *s) { diff --git a/mplayer/ffmpeg/libavcodec/arm/dcadsp_neon.S b/mplayer/ffmpeg/libavcodec/arm/dcadsp_neon.S index 19960ab1..c3bddd3e 100644 --- a/mplayer/ffmpeg/libavcodec/arm/dcadsp_neon.S +++ b/mplayer/ffmpeg/libavcodec/arm/dcadsp_neon.S @@ -29,7 +29,7 @@ function ff_dca_lfe_fir_neon, export=1 cmp r3, #32 moveq r6, #256/32 movne r6, #256/64 -NOVFP vldr d0, [sp, #16] @ scale, bias +NOVFP vldr s0, [sp, #16] @ scale mov lr, #-16 1: vmov.f32 q2, #0.0 @ v0 @@ -51,8 +51,7 @@ NOVFP vldr d0, [sp, #16] @ scale, bias vadd.f32 d4, d4, d5 vadd.f32 d6, d6, d7 vpadd.f32 d4, d4, d6 - vdup.32 d5, d0[1] - vmla.f32 d5, d4, d0[0] + vmul.f32 d5, d4, d0[0] vst1.32 {d5[0]}, [r0,:32]! vst1.32 {d5[1]}, [r4,:32]! bne 1b diff --git a/mplayer/ffmpeg/libavcodec/arm/dsputil_init_neon.c b/mplayer/ffmpeg/libavcodec/arm/dsputil_init_neon.c index 221183ce..76ae6322 100644 --- a/mplayer/ffmpeg/libavcodec/arm/dsputil_init_neon.c +++ b/mplayer/ffmpeg/libavcodec/arm/dsputil_init_neon.c @@ -140,8 +140,7 @@ void ff_vp3_h_loop_filter_neon(uint8_t *, int, int *); void ff_vector_fmul_neon(float *dst, const float *src0, const float *src1, int len); void ff_vector_fmul_window_neon(float *dst, const float *src0, - const float *src1, const float *win, - float add_bias, int len); + const float *src1, const float *win, int len); void ff_vector_fmul_scalar_neon(float *dst, const float *src, float mul, int len); void ff_vector_fmul_sv_scalar_2_neon(float *dst, const float *src, @@ -154,8 +153,6 @@ void ff_sv_fmul_scalar_4_neon(float *dst, const float **vp, float mul, int len); void ff_butterflies_float_neon(float *v1, float *v2, int len); float ff_scalarproduct_float_neon(const float *v1, const float *v2, int len); -void ff_int32_to_float_fmul_scalar_neon(float *dst, const int *src, - float mul, int len); void ff_vector_fmul_reverse_neon(float *dst, const float *src0, const float *src1, int len); void ff_vector_fmul_add_neon(float *dst, const float *src0, const float *src1, @@ -163,8 +160,6 @@ void ff_vector_fmul_add_neon(float *dst, const float *src0, const float *src1, void ff_vector_clipf_neon(float *dst, const float *src, float min, float max, int len); -void ff_float_to_int16_neon(int16_t *, const float *, long); -void ff_float_to_int16_interleave_neon(int16_t *, const float **, long, int); void ff_vorbis_inverse_coupling_neon(float *mag, float *ang, int blocksize); @@ -309,7 +304,6 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx) c->vector_fmul_scalar = ff_vector_fmul_scalar_neon; c->butterflies_float = ff_butterflies_float_neon; c->scalarproduct_float = ff_scalarproduct_float_neon; - c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_neon; c->vector_fmul_reverse = ff_vector_fmul_reverse_neon; c->vector_fmul_add = ff_vector_fmul_add_neon; c->vector_clipf = ff_vector_clipf_neon; @@ -320,11 +314,6 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx) c->sv_fmul_scalar[0] = ff_sv_fmul_scalar_2_neon; c->sv_fmul_scalar[1] = ff_sv_fmul_scalar_4_neon; - if (!(avctx->flags & CODEC_FLAG_BITEXACT)) { - c->float_to_int16 = ff_float_to_int16_neon; - c->float_to_int16_interleave = ff_float_to_int16_interleave_neon; - } - if (CONFIG_VORBIS_DECODER) c->vorbis_inverse_coupling = ff_vorbis_inverse_coupling_neon; diff --git a/mplayer/ffmpeg/libavcodec/arm/dsputil_init_vfp.c b/mplayer/ffmpeg/libavcodec/arm/dsputil_init_vfp.c index 76ef6b41..bd523159 100644 --- a/mplayer/ffmpeg/libavcodec/arm/dsputil_init_vfp.c +++ b/mplayer/ffmpeg/libavcodec/arm/dsputil_init_vfp.c @@ -25,13 +25,9 @@ void ff_vector_fmul_vfp(float *dst, const float *src0, const float *src1, int len); void ff_vector_fmul_reverse_vfp(float *dst, const float *src0, const float *src1, int len); -void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len); void ff_dsputil_init_vfp(DSPContext* c, AVCodecContext *avctx) { c->vector_fmul = ff_vector_fmul_vfp; c->vector_fmul_reverse = ff_vector_fmul_reverse_vfp; -#if HAVE_ARMV6 - c->float_to_int16 = ff_float_to_int16_vfp; -#endif } diff --git a/mplayer/ffmpeg/libavcodec/arm/dsputil_neon.S b/mplayer/ffmpeg/libavcodec/arm/dsputil_neon.S index 42fb38de..05a91150 100644 --- a/mplayer/ffmpeg/libavcodec/arm/dsputil_neon.S +++ b/mplayer/ffmpeg/libavcodec/arm/dsputil_neon.S @@ -400,343 +400,6 @@ function ff_add_pixels_clamped_neon, export=1 bx lr endfunc -function ff_float_to_int16_neon, export=1 - subs r2, r2, #8 - vld1.64 {d0-d1}, [r1,:128]! - vcvt.s32.f32 q8, q0, #16 - vld1.64 {d2-d3}, [r1,:128]! - vcvt.s32.f32 q9, q1, #16 - beq 3f - bics ip, r2, #15 - beq 2f -1: subs ip, ip, #16 - vshrn.s32 d4, q8, #16 - vld1.64 {d0-d1}, [r1,:128]! - vcvt.s32.f32 q0, q0, #16 - vshrn.s32 d5, q9, #16 - vld1.64 {d2-d3}, [r1,:128]! - vcvt.s32.f32 q1, q1, #16 - vshrn.s32 d6, q0, #16 - vst1.64 {d4-d5}, [r0,:128]! - vshrn.s32 d7, q1, #16 - vld1.64 {d16-d17},[r1,:128]! - vcvt.s32.f32 q8, q8, #16 - vld1.64 {d18-d19},[r1,:128]! - vcvt.s32.f32 q9, q9, #16 - vst1.64 {d6-d7}, [r0,:128]! - bne 1b - ands r2, r2, #15 - beq 3f -2: vld1.64 {d0-d1}, [r1,:128]! - vshrn.s32 d4, q8, #16 - vcvt.s32.f32 q0, q0, #16 - vld1.64 {d2-d3}, [r1,:128]! - vshrn.s32 d5, q9, #16 - vcvt.s32.f32 q1, q1, #16 - vshrn.s32 d6, q0, #16 - vst1.64 {d4-d5}, [r0,:128]! - vshrn.s32 d7, q1, #16 - vst1.64 {d6-d7}, [r0,:128]! - bx lr -3: vshrn.s32 d4, q8, #16 - vshrn.s32 d5, q9, #16 - vst1.64 {d4-d5}, [r0,:128]! - bx lr -endfunc - -function ff_float_to_int16_interleave_neon, export=1 - cmp r3, #2 - ldrlt r1, [r1] - blt ff_float_to_int16_neon - bne 4f - - ldr r3, [r1] - ldr r1, [r1, #4] - - subs r2, r2, #8 - vld1.64 {d0-d1}, [r3,:128]! - vcvt.s32.f32 q8, q0, #16 - vld1.64 {d2-d3}, [r3,:128]! - vcvt.s32.f32 q9, q1, #16 - vld1.64 {d20-d21},[r1,:128]! - vcvt.s32.f32 q10, q10, #16 - vld1.64 {d22-d23},[r1,:128]! - vcvt.s32.f32 q11, q11, #16 - beq 3f - bics ip, r2, #15 - beq 2f -1: subs ip, ip, #16 - vld1.64 {d0-d1}, [r3,:128]! - vcvt.s32.f32 q0, q0, #16 - vsri.32 q10, q8, #16 - vld1.64 {d2-d3}, [r3,:128]! - vcvt.s32.f32 q1, q1, #16 - vld1.64 {d24-d25},[r1,:128]! - vcvt.s32.f32 q12, q12, #16 - vld1.64 {d26-d27},[r1,:128]! - vsri.32 q11, q9, #16 - vst1.64 {d20-d21},[r0,:128]! - vcvt.s32.f32 q13, q13, #16 - vst1.64 {d22-d23},[r0,:128]! - vsri.32 q12, q0, #16 - vld1.64 {d16-d17},[r3,:128]! - vsri.32 q13, q1, #16 - vst1.64 {d24-d25},[r0,:128]! - vcvt.s32.f32 q8, q8, #16 - vld1.64 {d18-d19},[r3,:128]! - vcvt.s32.f32 q9, q9, #16 - vld1.64 {d20-d21},[r1,:128]! - vcvt.s32.f32 q10, q10, #16 - vld1.64 {d22-d23},[r1,:128]! - vcvt.s32.f32 q11, q11, #16 - vst1.64 {d26-d27},[r0,:128]! - bne 1b - ands r2, r2, #15 - beq 3f -2: vsri.32 q10, q8, #16 - vld1.64 {d0-d1}, [r3,:128]! - vcvt.s32.f32 q0, q0, #16 - vld1.64 {d2-d3}, [r3,:128]! - vcvt.s32.f32 q1, q1, #16 - vld1.64 {d24-d25},[r1,:128]! - vcvt.s32.f32 q12, q12, #16 - vsri.32 q11, q9, #16 - vld1.64 {d26-d27},[r1,:128]! - vcvt.s32.f32 q13, q13, #16 - vst1.64 {d20-d21},[r0,:128]! - vsri.32 q12, q0, #16 - vst1.64 {d22-d23},[r0,:128]! - vsri.32 q13, q1, #16 - vst1.64 {d24-d27},[r0,:128]! - bx lr -3: vsri.32 q10, q8, #16 - vsri.32 q11, q9, #16 - vst1.64 {d20-d23},[r0,:128]! - bx lr - -4: push {r4-r8,lr} - cmp r3, #4 - lsl ip, r3, #1 - blt 4f - - @ 4 channels -5: ldmia r1!, {r4-r7} - mov lr, r2 - mov r8, r0 - vld1.64 {d16-d17},[r4,:128]! - vcvt.s32.f32 q8, q8, #16 - vld1.64 {d18-d19},[r5,:128]! - vcvt.s32.f32 q9, q9, #16 - vld1.64 {d20-d21},[r6,:128]! - vcvt.s32.f32 q10, q10, #16 - vld1.64 {d22-d23},[r7,:128]! - vcvt.s32.f32 q11, q11, #16 -6: subs lr, lr, #8 - vld1.64 {d0-d1}, [r4,:128]! - vcvt.s32.f32 q0, q0, #16 - vsri.32 q9, q8, #16 - vld1.64 {d2-d3}, [r5,:128]! - vcvt.s32.f32 q1, q1, #16 - vsri.32 q11, q10, #16 - vld1.64 {d4-d5}, [r6,:128]! - vcvt.s32.f32 q2, q2, #16 - vzip.32 d18, d22 - vld1.64 {d6-d7}, [r7,:128]! - vcvt.s32.f32 q3, q3, #16 - vzip.32 d19, d23 - vst1.64 {d18}, [r8], ip - vsri.32 q1, q0, #16 - vst1.64 {d22}, [r8], ip - vsri.32 q3, q2, #16 - vst1.64 {d19}, [r8], ip - vzip.32 d2, d6 - vst1.64 {d23}, [r8], ip - vzip.32 d3, d7 - beq 7f - vld1.64 {d16-d17},[r4,:128]! - vcvt.s32.f32 q8, q8, #16 - vst1.64 {d2}, [r8], ip - vld1.64 {d18-d19},[r5,:128]! - vcvt.s32.f32 q9, q9, #16 - vst1.64 {d6}, [r8], ip - vld1.64 {d20-d21},[r6,:128]! - vcvt.s32.f32 q10, q10, #16 - vst1.64 {d3}, [r8], ip - vld1.64 {d22-d23},[r7,:128]! - vcvt.s32.f32 q11, q11, #16 - vst1.64 {d7}, [r8], ip - b 6b -7: vst1.64 {d2}, [r8], ip - vst1.64 {d6}, [r8], ip - vst1.64 {d3}, [r8], ip - vst1.64 {d7}, [r8], ip - subs r3, r3, #4 - popeq {r4-r8,pc} - cmp r3, #4 - add r0, r0, #8 - bge 5b - - @ 2 channels -4: cmp r3, #2 - blt 4f - ldmia r1!, {r4-r5} - mov lr, r2 - mov r8, r0 - tst lr, #8 - vld1.64 {d16-d17},[r4,:128]! - vcvt.s32.f32 q8, q8, #16 - vld1.64 {d18-d19},[r5,:128]! - vcvt.s32.f32 q9, q9, #16 - vld1.64 {d20-d21},[r4,:128]! - vcvt.s32.f32 q10, q10, #16 - vld1.64 {d22-d23},[r5,:128]! - vcvt.s32.f32 q11, q11, #16 - beq 6f - subs lr, lr, #8 - beq 7f - vsri.32 d18, d16, #16 - vsri.32 d19, d17, #16 - vld1.64 {d16-d17},[r4,:128]! - vcvt.s32.f32 q8, q8, #16 - vst1.32 {d18[0]}, [r8], ip - vsri.32 d22, d20, #16 - vst1.32 {d18[1]}, [r8], ip - vsri.32 d23, d21, #16 - vst1.32 {d19[0]}, [r8], ip - vst1.32 {d19[1]}, [r8], ip - vld1.64 {d18-d19},[r5,:128]! - vcvt.s32.f32 q9, q9, #16 - vst1.32 {d22[0]}, [r8], ip - vst1.32 {d22[1]}, [r8], ip - vld1.64 {d20-d21},[r4,:128]! - vcvt.s32.f32 q10, q10, #16 - vst1.32 {d23[0]}, [r8], ip - vst1.32 {d23[1]}, [r8], ip - vld1.64 {d22-d23},[r5,:128]! - vcvt.s32.f32 q11, q11, #16 -6: subs lr, lr, #16 - vld1.64 {d0-d1}, [r4,:128]! - vcvt.s32.f32 q0, q0, #16 - vsri.32 d18, d16, #16 - vld1.64 {d2-d3}, [r5,:128]! - vcvt.s32.f32 q1, q1, #16 - vsri.32 d19, d17, #16 - vld1.64 {d4-d5}, [r4,:128]! - vcvt.s32.f32 q2, q2, #16 - vld1.64 {d6-d7}, [r5,:128]! - vcvt.s32.f32 q3, q3, #16 - vst1.32 {d18[0]}, [r8], ip - vsri.32 d22, d20, #16 - vst1.32 {d18[1]}, [r8], ip - vsri.32 d23, d21, #16 - vst1.32 {d19[0]}, [r8], ip - vsri.32 d2, d0, #16 - vst1.32 {d19[1]}, [r8], ip - vsri.32 d3, d1, #16 - vst1.32 {d22[0]}, [r8], ip - vsri.32 d6, d4, #16 - vst1.32 {d22[1]}, [r8], ip - vsri.32 d7, d5, #16 - vst1.32 {d23[0]}, [r8], ip - vst1.32 {d23[1]}, [r8], ip - beq 6f - vld1.64 {d16-d17},[r4,:128]! - vcvt.s32.f32 q8, q8, #16 - vst1.32 {d2[0]}, [r8], ip - vst1.32 {d2[1]}, [r8], ip - vld1.64 {d18-d19},[r5,:128]! - vcvt.s32.f32 q9, q9, #16 - vst1.32 {d3[0]}, [r8], ip - vst1.32 {d3[1]}, [r8], ip - vld1.64 {d20-d21},[r4,:128]! - vcvt.s32.f32 q10, q10, #16 - vst1.32 {d6[0]}, [r8], ip - vst1.32 {d6[1]}, [r8], ip - vld1.64 {d22-d23},[r5,:128]! - vcvt.s32.f32 q11, q11, #16 - vst1.32 {d7[0]}, [r8], ip - vst1.32 {d7[1]}, [r8], ip - bgt 6b -6: vst1.32 {d2[0]}, [r8], ip - vst1.32 {d2[1]}, [r8], ip - vst1.32 {d3[0]}, [r8], ip - vst1.32 {d3[1]}, [r8], ip - vst1.32 {d6[0]}, [r8], ip - vst1.32 {d6[1]}, [r8], ip - vst1.32 {d7[0]}, [r8], ip - vst1.32 {d7[1]}, [r8], ip - b 8f -7: vsri.32 d18, d16, #16 - vsri.32 d19, d17, #16 - vst1.32 {d18[0]}, [r8], ip - vsri.32 d22, d20, #16 - vst1.32 {d18[1]}, [r8], ip - vsri.32 d23, d21, #16 - vst1.32 {d19[0]}, [r8], ip - vst1.32 {d19[1]}, [r8], ip - vst1.32 {d22[0]}, [r8], ip - vst1.32 {d22[1]}, [r8], ip - vst1.32 {d23[0]}, [r8], ip - vst1.32 {d23[1]}, [r8], ip -8: subs r3, r3, #2 - add r0, r0, #4 - popeq {r4-r8,pc} - - @ 1 channel -4: ldr r4, [r1],#4 - tst r2, #8 - mov lr, r2 - mov r5, r0 - vld1.64 {d0-d1}, [r4,:128]! - vcvt.s32.f32 q0, q0, #16 - vld1.64 {d2-d3}, [r4,:128]! - vcvt.s32.f32 q1, q1, #16 - bne 8f -6: subs lr, lr, #16 - vld1.64 {d4-d5}, [r4,:128]! - vcvt.s32.f32 q2, q2, #16 - vld1.64 {d6-d7}, [r4,:128]! - vcvt.s32.f32 q3, q3, #16 - vst1.16 {d0[1]}, [r5,:16], ip - vst1.16 {d0[3]}, [r5,:16], ip - vst1.16 {d1[1]}, [r5,:16], ip - vst1.16 {d1[3]}, [r5,:16], ip - vst1.16 {d2[1]}, [r5,:16], ip - vst1.16 {d2[3]}, [r5,:16], ip - vst1.16 {d3[1]}, [r5,:16], ip - vst1.16 {d3[3]}, [r5,:16], ip - beq 7f - vld1.64 {d0-d1}, [r4,:128]! - vcvt.s32.f32 q0, q0, #16 - vld1.64 {d2-d3}, [r4,:128]! - vcvt.s32.f32 q1, q1, #16 -7: vst1.16 {d4[1]}, [r5,:16], ip - vst1.16 {d4[3]}, [r5,:16], ip - vst1.16 {d5[1]}, [r5,:16], ip - vst1.16 {d5[3]}, [r5,:16], ip - vst1.16 {d6[1]}, [r5,:16], ip - vst1.16 {d6[3]}, [r5,:16], ip - vst1.16 {d7[1]}, [r5,:16], ip - vst1.16 {d7[3]}, [r5,:16], ip - bgt 6b - pop {r4-r8,pc} -8: subs lr, lr, #8 - vst1.16 {d0[1]}, [r5,:16], ip - vst1.16 {d0[3]}, [r5,:16], ip - vst1.16 {d1[1]}, [r5,:16], ip - vst1.16 {d1[3]}, [r5,:16], ip - vst1.16 {d2[1]}, [r5,:16], ip - vst1.16 {d2[3]}, [r5,:16], ip - vst1.16 {d3[1]}, [r5,:16], ip - vst1.16 {d3[3]}, [r5,:16], ip - popeq {r4-r8,pc} - vld1.64 {d0-d1}, [r4,:128]! - vcvt.s32.f32 q0, q0, #16 - vld1.64 {d2-d3}, [r4,:128]! - vcvt.s32.f32 q1, q1, #16 - b 6b -endfunc - function ff_vector_fmul_neon, export=1 subs r3, r3, #8 vld1.64 {d0-d3}, [r1,:128]! @@ -777,11 +440,8 @@ function ff_vector_fmul_neon, export=1 endfunc function ff_vector_fmul_window_neon, export=1 -VFP vdup.32 q8, d0[0] -NOVFP vld1.32 {d16[],d17[]}, [sp,:32] push {r4,r5,lr} -VFP ldr lr, [sp, #12] -NOVFP ldr lr, [sp, #16] + ldr lr, [sp, #12] sub r2, r2, #8 sub r5, lr, #2 add r2, r2, r5, lsl #2 @@ -793,14 +453,12 @@ NOVFP ldr lr, [sp, #16] vld1.64 {d4,d5}, [r3,:128]! vld1.64 {d6,d7}, [r4,:128], r5 1: subs lr, lr, #4 - vmov q11, q8 - vmla.f32 d22, d0, d4 - vmov q10, q8 - vmla.f32 d23, d1, d5 + vmul.f32 d22, d0, d4 vrev64.32 q3, q3 - vmla.f32 d20, d0, d7 + vmul.f32 d23, d1, d5 vrev64.32 q1, q1 - vmla.f32 d21, d1, d6 + vmul.f32 d20, d0, d7 + vmul.f32 d21, d1, d6 beq 2f vmla.f32 d22, d3, d7 vld1.64 {d0,d1}, [r1,:128]! @@ -1055,34 +713,6 @@ NOVFP vmov.32 r0, d0[0] bx lr endfunc -function ff_int32_to_float_fmul_scalar_neon, export=1 -VFP vdup.32 q0, d0[0] -VFP len .req r2 -NOVFP vdup.32 q0, r2 -NOVFP len .req r3 - - vld1.32 {q1},[r1,:128]! - vcvt.f32.s32 q3, q1 - vld1.32 {q2},[r1,:128]! - vcvt.f32.s32 q8, q2 -1: subs len, len, #8 - pld [r1, #16] - vmul.f32 q9, q3, q0 - vmul.f32 q10, q8, q0 - beq 2f - vld1.32 {q1},[r1,:128]! - vcvt.f32.s32 q3, q1 - vld1.32 {q2},[r1,:128]! - vcvt.f32.s32 q8, q2 - vst1.32 {q9}, [r0,:128]! - vst1.32 {q10},[r0,:128]! - b 1b -2: vst1.32 {q9}, [r0,:128]! - vst1.32 {q10},[r0,:128]! - bx lr - .unreq len -endfunc - function ff_vector_fmul_reverse_neon, export=1 add r2, r2, r3, lsl #2 sub r2, r2, #32 diff --git a/mplayer/ffmpeg/libavcodec/arm/dsputil_vfp.S b/mplayer/ffmpeg/libavcodec/arm/dsputil_vfp.S index a65b69e2..197d5008 100644 --- a/mplayer/ffmpeg/libavcodec/arm/dsputil_vfp.S +++ b/mplayer/ffmpeg/libavcodec/arm/dsputil_vfp.S @@ -131,58 +131,3 @@ function ff_vector_fmul_reverse_vfp, export=1 vpop {d8-d15} bx lr endfunc - -#if HAVE_ARMV6 -/** - * ARM VFP optimized float to int16 conversion. - * Assume that len is a positive number and is multiple of 8, destination - * buffer is at least 4 bytes aligned (8 bytes alignment is better for - * performance), little endian byte sex - */ -@ void ff_float_to_int16_vfp(int16_t *dst, const float *src, int len) -function ff_float_to_int16_vfp, export=1 - push {r4-r8,lr} - vpush {d8-d11} - vldmia r1!, {s16-s23} - vcvt.s32.f32 s0, s16 - vcvt.s32.f32 s1, s17 - vcvt.s32.f32 s2, s18 - vcvt.s32.f32 s3, s19 - vcvt.s32.f32 s4, s20 - vcvt.s32.f32 s5, s21 - vcvt.s32.f32 s6, s22 - vcvt.s32.f32 s7, s23 -1: - subs r2, r2, #8 - vmov r3, r4, s0, s1 - vmov r5, r6, s2, s3 - vmov r7, r8, s4, s5 - vmov ip, lr, s6, s7 - vldmiagt r1!, {s16-s23} - ssat r4, #16, r4 - ssat r3, #16, r3 - ssat r6, #16, r6 - ssat r5, #16, r5 - pkhbt r3, r3, r4, lsl #16 - pkhbt r4, r5, r6, lsl #16 - vcvtgt.s32.f32 s0, s16 - vcvtgt.s32.f32 s1, s17 - vcvtgt.s32.f32 s2, s18 - vcvtgt.s32.f32 s3, s19 - vcvtgt.s32.f32 s4, s20 - vcvtgt.s32.f32 s5, s21 - vcvtgt.s32.f32 s6, s22 - vcvtgt.s32.f32 s7, s23 - ssat r8, #16, r8 - ssat r7, #16, r7 - ssat lr, #16, lr - ssat ip, #16, ip - pkhbt r5, r7, r8, lsl #16 - pkhbt r6, ip, lr, lsl #16 - stmia r0!, {r3-r6} - bgt 1b - - vpop {d8-d11} - pop {r4-r8,pc} -endfunc -#endif diff --git a/mplayer/ffmpeg/libavcodec/arm/fft_init_arm.c b/mplayer/ffmpeg/libavcodec/arm/fft_init_arm.c index bde12400..dff06895 100644 --- a/mplayer/ffmpeg/libavcodec/arm/fft_init_arm.c +++ b/mplayer/ffmpeg/libavcodec/arm/fft_init_arm.c @@ -34,7 +34,7 @@ void ff_synth_filter_float_neon(FFTContext *imdct, float *synth_buf_ptr, int *synth_buf_offset, float synth_buf2[32], const float window[512], float out[32], const float in[32], - float scale, float bias); + float scale); av_cold void ff_fft_init_arm(FFTContext *s) { @@ -44,7 +44,7 @@ av_cold void ff_fft_init_arm(FFTContext *s) s->imdct_calc = ff_imdct_calc_neon; s->imdct_half = ff_imdct_half_neon; s->mdct_calc = ff_mdct_calc_neon; - s->permutation = FF_MDCT_PERM_INTERLEAVE; + s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE; } } diff --git a/mplayer/ffmpeg/libavcodec/arm/fmtconvert_init_arm.c b/mplayer/ffmpeg/libavcodec/arm/fmtconvert_init_arm.c new file mode 100644 index 00000000..4b6e3939 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/arm/fmtconvert_init_arm.c @@ -0,0 +1,48 @@ +/* + * ARM optimized Format Conversion Utils + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include "libavcodec/avcodec.h" +#include "libavcodec/fmtconvert.h" + +void ff_int32_to_float_fmul_scalar_neon(float *dst, const int *src, + float mul, int len); + +void ff_float_to_int16_neon(int16_t *dst, const float *src, long len); +void ff_float_to_int16_interleave_neon(int16_t *, const float **, long, int); + +void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len); + +void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx) +{ + if (HAVE_ARMVFP && HAVE_ARMV6) { + c->float_to_int16 = ff_float_to_int16_vfp; + } + + if (HAVE_NEON) { + c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_neon; + + if (!(avctx->flags & CODEC_FLAG_BITEXACT)) { + c->float_to_int16 = ff_float_to_int16_neon; + c->float_to_int16_interleave = ff_float_to_int16_interleave_neon; + } + } +} diff --git a/mplayer/ffmpeg/libavcodec/arm/fmtconvert_neon.S b/mplayer/ffmpeg/libavcodec/arm/fmtconvert_neon.S new file mode 100644 index 00000000..359e57e4 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/arm/fmtconvert_neon.S @@ -0,0 +1,391 @@ +/* + * ARM NEON optimised Format Conversion Utils + * Copyright (c) 2008 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "asm.S" + + preserve8 + .text + +function ff_float_to_int16_neon, export=1 + subs r2, r2, #8 + vld1.64 {d0-d1}, [r1,:128]! + vcvt.s32.f32 q8, q0, #16 + vld1.64 {d2-d3}, [r1,:128]! + vcvt.s32.f32 q9, q1, #16 + beq 3f + bics ip, r2, #15 + beq 2f +1: subs ip, ip, #16 + vshrn.s32 d4, q8, #16 + vld1.64 {d0-d1}, [r1,:128]! + vcvt.s32.f32 q0, q0, #16 + vshrn.s32 d5, q9, #16 + vld1.64 {d2-d3}, [r1,:128]! + vcvt.s32.f32 q1, q1, #16 + vshrn.s32 d6, q0, #16 + vst1.64 {d4-d5}, [r0,:128]! + vshrn.s32 d7, q1, #16 + vld1.64 {d16-d17},[r1,:128]! + vcvt.s32.f32 q8, q8, #16 + vld1.64 {d18-d19},[r1,:128]! + vcvt.s32.f32 q9, q9, #16 + vst1.64 {d6-d7}, [r0,:128]! + bne 1b + ands r2, r2, #15 + beq 3f +2: vld1.64 {d0-d1}, [r1,:128]! + vshrn.s32 d4, q8, #16 + vcvt.s32.f32 q0, q0, #16 + vld1.64 {d2-d3}, [r1,:128]! + vshrn.s32 d5, q9, #16 + vcvt.s32.f32 q1, q1, #16 + vshrn.s32 d6, q0, #16 + vst1.64 {d4-d5}, [r0,:128]! + vshrn.s32 d7, q1, #16 + vst1.64 {d6-d7}, [r0,:128]! + bx lr +3: vshrn.s32 d4, q8, #16 + vshrn.s32 d5, q9, #16 + vst1.64 {d4-d5}, [r0,:128]! + bx lr +endfunc + +function ff_float_to_int16_interleave_neon, export=1 + cmp r3, #2 + ldrlt r1, [r1] + blt ff_float_to_int16_neon + bne 4f + + ldr r3, [r1] + ldr r1, [r1, #4] + + subs r2, r2, #8 + vld1.64 {d0-d1}, [r3,:128]! + vcvt.s32.f32 q8, q0, #16 + vld1.64 {d2-d3}, [r3,:128]! + vcvt.s32.f32 q9, q1, #16 + vld1.64 {d20-d21},[r1,:128]! + vcvt.s32.f32 q10, q10, #16 + vld1.64 {d22-d23},[r1,:128]! + vcvt.s32.f32 q11, q11, #16 + beq 3f + bics ip, r2, #15 + beq 2f +1: subs ip, ip, #16 + vld1.64 {d0-d1}, [r3,:128]! + vcvt.s32.f32 q0, q0, #16 + vsri.32 q10, q8, #16 + vld1.64 {d2-d3}, [r3,:128]! + vcvt.s32.f32 q1, q1, #16 + vld1.64 {d24-d25},[r1,:128]! + vcvt.s32.f32 q12, q12, #16 + vld1.64 {d26-d27},[r1,:128]! + vsri.32 q11, q9, #16 + vst1.64 {d20-d21},[r0,:128]! + vcvt.s32.f32 q13, q13, #16 + vst1.64 {d22-d23},[r0,:128]! + vsri.32 q12, q0, #16 + vld1.64 {d16-d17},[r3,:128]! + vsri.32 q13, q1, #16 + vst1.64 {d24-d25},[r0,:128]! + vcvt.s32.f32 q8, q8, #16 + vld1.64 {d18-d19},[r3,:128]! + vcvt.s32.f32 q9, q9, #16 + vld1.64 {d20-d21},[r1,:128]! + vcvt.s32.f32 q10, q10, #16 + vld1.64 {d22-d23},[r1,:128]! + vcvt.s32.f32 q11, q11, #16 + vst1.64 {d26-d27},[r0,:128]! + bne 1b + ands r2, r2, #15 + beq 3f +2: vsri.32 q10, q8, #16 + vld1.64 {d0-d1}, [r3,:128]! + vcvt.s32.f32 q0, q0, #16 + vld1.64 {d2-d3}, [r3,:128]! + vcvt.s32.f32 q1, q1, #16 + vld1.64 {d24-d25},[r1,:128]! + vcvt.s32.f32 q12, q12, #16 + vsri.32 q11, q9, #16 + vld1.64 {d26-d27},[r1,:128]! + vcvt.s32.f32 q13, q13, #16 + vst1.64 {d20-d21},[r0,:128]! + vsri.32 q12, q0, #16 + vst1.64 {d22-d23},[r0,:128]! + vsri.32 q13, q1, #16 + vst1.64 {d24-d27},[r0,:128]! + bx lr +3: vsri.32 q10, q8, #16 + vsri.32 q11, q9, #16 + vst1.64 {d20-d23},[r0,:128]! + bx lr + +4: push {r4-r8,lr} + cmp r3, #4 + lsl ip, r3, #1 + blt 4f + + @ 4 channels +5: ldmia r1!, {r4-r7} + mov lr, r2 + mov r8, r0 + vld1.64 {d16-d17},[r4,:128]! + vcvt.s32.f32 q8, q8, #16 + vld1.64 {d18-d19},[r5,:128]! + vcvt.s32.f32 q9, q9, #16 + vld1.64 {d20-d21},[r6,:128]! + vcvt.s32.f32 q10, q10, #16 + vld1.64 {d22-d23},[r7,:128]! + vcvt.s32.f32 q11, q11, #16 +6: subs lr, lr, #8 + vld1.64 {d0-d1}, [r4,:128]! + vcvt.s32.f32 q0, q0, #16 + vsri.32 q9, q8, #16 + vld1.64 {d2-d3}, [r5,:128]! + vcvt.s32.f32 q1, q1, #16 + vsri.32 q11, q10, #16 + vld1.64 {d4-d5}, [r6,:128]! + vcvt.s32.f32 q2, q2, #16 + vzip.32 d18, d22 + vld1.64 {d6-d7}, [r7,:128]! + vcvt.s32.f32 q3, q3, #16 + vzip.32 d19, d23 + vst1.64 {d18}, [r8], ip + vsri.32 q1, q0, #16 + vst1.64 {d22}, [r8], ip + vsri.32 q3, q2, #16 + vst1.64 {d19}, [r8], ip + vzip.32 d2, d6 + vst1.64 {d23}, [r8], ip + vzip.32 d3, d7 + beq 7f + vld1.64 {d16-d17},[r4,:128]! + vcvt.s32.f32 q8, q8, #16 + vst1.64 {d2}, [r8], ip + vld1.64 {d18-d19},[r5,:128]! + vcvt.s32.f32 q9, q9, #16 + vst1.64 {d6}, [r8], ip + vld1.64 {d20-d21},[r6,:128]! + vcvt.s32.f32 q10, q10, #16 + vst1.64 {d3}, [r8], ip + vld1.64 {d22-d23},[r7,:128]! + vcvt.s32.f32 q11, q11, #16 + vst1.64 {d7}, [r8], ip + b 6b +7: vst1.64 {d2}, [r8], ip + vst1.64 {d6}, [r8], ip + vst1.64 {d3}, [r8], ip + vst1.64 {d7}, [r8], ip + subs r3, r3, #4 + popeq {r4-r8,pc} + cmp r3, #4 + add r0, r0, #8 + bge 5b + + @ 2 channels +4: cmp r3, #2 + blt 4f + ldmia r1!, {r4-r5} + mov lr, r2 + mov r8, r0 + tst lr, #8 + vld1.64 {d16-d17},[r4,:128]! + vcvt.s32.f32 q8, q8, #16 + vld1.64 {d18-d19},[r5,:128]! + vcvt.s32.f32 q9, q9, #16 + vld1.64 {d20-d21},[r4,:128]! + vcvt.s32.f32 q10, q10, #16 + vld1.64 {d22-d23},[r5,:128]! + vcvt.s32.f32 q11, q11, #16 + beq 6f + subs lr, lr, #8 + beq 7f + vsri.32 d18, d16, #16 + vsri.32 d19, d17, #16 + vld1.64 {d16-d17},[r4,:128]! + vcvt.s32.f32 q8, q8, #16 + vst1.32 {d18[0]}, [r8], ip + vsri.32 d22, d20, #16 + vst1.32 {d18[1]}, [r8], ip + vsri.32 d23, d21, #16 + vst1.32 {d19[0]}, [r8], ip + vst1.32 {d19[1]}, [r8], ip + vld1.64 {d18-d19},[r5,:128]! + vcvt.s32.f32 q9, q9, #16 + vst1.32 {d22[0]}, [r8], ip + vst1.32 {d22[1]}, [r8], ip + vld1.64 {d20-d21},[r4,:128]! + vcvt.s32.f32 q10, q10, #16 + vst1.32 {d23[0]}, [r8], ip + vst1.32 {d23[1]}, [r8], ip + vld1.64 {d22-d23},[r5,:128]! + vcvt.s32.f32 q11, q11, #16 +6: subs lr, lr, #16 + vld1.64 {d0-d1}, [r4,:128]! + vcvt.s32.f32 q0, q0, #16 + vsri.32 d18, d16, #16 + vld1.64 {d2-d3}, [r5,:128]! + vcvt.s32.f32 q1, q1, #16 + vsri.32 d19, d17, #16 + vld1.64 {d4-d5}, [r4,:128]! + vcvt.s32.f32 q2, q2, #16 + vld1.64 {d6-d7}, [r5,:128]! + vcvt.s32.f32 q3, q3, #16 + vst1.32 {d18[0]}, [r8], ip + vsri.32 d22, d20, #16 + vst1.32 {d18[1]}, [r8], ip + vsri.32 d23, d21, #16 + vst1.32 {d19[0]}, [r8], ip + vsri.32 d2, d0, #16 + vst1.32 {d19[1]}, [r8], ip + vsri.32 d3, d1, #16 + vst1.32 {d22[0]}, [r8], ip + vsri.32 d6, d4, #16 + vst1.32 {d22[1]}, [r8], ip + vsri.32 d7, d5, #16 + vst1.32 {d23[0]}, [r8], ip + vst1.32 {d23[1]}, [r8], ip + beq 6f + vld1.64 {d16-d17},[r4,:128]! + vcvt.s32.f32 q8, q8, #16 + vst1.32 {d2[0]}, [r8], ip + vst1.32 {d2[1]}, [r8], ip + vld1.64 {d18-d19},[r5,:128]! + vcvt.s32.f32 q9, q9, #16 + vst1.32 {d3[0]}, [r8], ip + vst1.32 {d3[1]}, [r8], ip + vld1.64 {d20-d21},[r4,:128]! + vcvt.s32.f32 q10, q10, #16 + vst1.32 {d6[0]}, [r8], ip + vst1.32 {d6[1]}, [r8], ip + vld1.64 {d22-d23},[r5,:128]! + vcvt.s32.f32 q11, q11, #16 + vst1.32 {d7[0]}, [r8], ip + vst1.32 {d7[1]}, [r8], ip + bgt 6b +6: vst1.32 {d2[0]}, [r8], ip + vst1.32 {d2[1]}, [r8], ip + vst1.32 {d3[0]}, [r8], ip + vst1.32 {d3[1]}, [r8], ip + vst1.32 {d6[0]}, [r8], ip + vst1.32 {d6[1]}, [r8], ip + vst1.32 {d7[0]}, [r8], ip + vst1.32 {d7[1]}, [r8], ip + b 8f +7: vsri.32 d18, d16, #16 + vsri.32 d19, d17, #16 + vst1.32 {d18[0]}, [r8], ip + vsri.32 d22, d20, #16 + vst1.32 {d18[1]}, [r8], ip + vsri.32 d23, d21, #16 + vst1.32 {d19[0]}, [r8], ip + vst1.32 {d19[1]}, [r8], ip + vst1.32 {d22[0]}, [r8], ip + vst1.32 {d22[1]}, [r8], ip + vst1.32 {d23[0]}, [r8], ip + vst1.32 {d23[1]}, [r8], ip +8: subs r3, r3, #2 + add r0, r0, #4 + popeq {r4-r8,pc} + + @ 1 channel +4: ldr r4, [r1],#4 + tst r2, #8 + mov lr, r2 + mov r5, r0 + vld1.64 {d0-d1}, [r4,:128]! + vcvt.s32.f32 q0, q0, #16 + vld1.64 {d2-d3}, [r4,:128]! + vcvt.s32.f32 q1, q1, #16 + bne 8f +6: subs lr, lr, #16 + vld1.64 {d4-d5}, [r4,:128]! + vcvt.s32.f32 q2, q2, #16 + vld1.64 {d6-d7}, [r4,:128]! + vcvt.s32.f32 q3, q3, #16 + vst1.16 {d0[1]}, [r5,:16], ip + vst1.16 {d0[3]}, [r5,:16], ip + vst1.16 {d1[1]}, [r5,:16], ip + vst1.16 {d1[3]}, [r5,:16], ip + vst1.16 {d2[1]}, [r5,:16], ip + vst1.16 {d2[3]}, [r5,:16], ip + vst1.16 {d3[1]}, [r5,:16], ip + vst1.16 {d3[3]}, [r5,:16], ip + beq 7f + vld1.64 {d0-d1}, [r4,:128]! + vcvt.s32.f32 q0, q0, #16 + vld1.64 {d2-d3}, [r4,:128]! + vcvt.s32.f32 q1, q1, #16 +7: vst1.16 {d4[1]}, [r5,:16], ip + vst1.16 {d4[3]}, [r5,:16], ip + vst1.16 {d5[1]}, [r5,:16], ip + vst1.16 {d5[3]}, [r5,:16], ip + vst1.16 {d6[1]}, [r5,:16], ip + vst1.16 {d6[3]}, [r5,:16], ip + vst1.16 {d7[1]}, [r5,:16], ip + vst1.16 {d7[3]}, [r5,:16], ip + bgt 6b + pop {r4-r8,pc} +8: subs lr, lr, #8 + vst1.16 {d0[1]}, [r5,:16], ip + vst1.16 {d0[3]}, [r5,:16], ip + vst1.16 {d1[1]}, [r5,:16], ip + vst1.16 {d1[3]}, [r5,:16], ip + vst1.16 {d2[1]}, [r5,:16], ip + vst1.16 {d2[3]}, [r5,:16], ip + vst1.16 {d3[1]}, [r5,:16], ip + vst1.16 {d3[3]}, [r5,:16], ip + popeq {r4-r8,pc} + vld1.64 {d0-d1}, [r4,:128]! + vcvt.s32.f32 q0, q0, #16 + vld1.64 {d2-d3}, [r4,:128]! + vcvt.s32.f32 q1, q1, #16 + b 6b +endfunc + +function ff_int32_to_float_fmul_scalar_neon, export=1 +VFP vdup.32 q0, d0[0] +VFP len .req r2 +NOVFP vdup.32 q0, r2 +NOVFP len .req r3 + + vld1.32 {q1},[r1,:128]! + vcvt.f32.s32 q3, q1 + vld1.32 {q2},[r1,:128]! + vcvt.f32.s32 q8, q2 +1: subs len, len, #8 + pld [r1, #16] + vmul.f32 q9, q3, q0 + vmul.f32 q10, q8, q0 + beq 2f + vld1.32 {q1},[r1,:128]! + vcvt.f32.s32 q3, q1 + vld1.32 {q2},[r1,:128]! + vcvt.f32.s32 q8, q2 + vst1.32 {q9}, [r0,:128]! + vst1.32 {q10},[r0,:128]! + b 1b +2: vst1.32 {q9}, [r0,:128]! + vst1.32 {q10},[r0,:128]! + bx lr + .unreq len +endfunc diff --git a/mplayer/ffmpeg/libavcodec/arm/fmtconvert_vfp.S b/mplayer/ffmpeg/libavcodec/arm/fmtconvert_vfp.S new file mode 100644 index 00000000..1d19e775 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/arm/fmtconvert_vfp.S @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2008 Siarhei Siamashka + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "asm.S" + + .syntax unified + +/** + * ARM VFP optimized float to int16 conversion. + * Assume that len is a positive number and is multiple of 8, destination + * buffer is at least 4 bytes aligned (8 bytes alignment is better for + * performance), little endian byte sex + */ +@ void ff_float_to_int16_vfp(int16_t *dst, const float *src, int len) +function ff_float_to_int16_vfp, export=1 + push {r4-r8,lr} + vpush {d8-d11} + vldmia r1!, {s16-s23} + vcvt.s32.f32 s0, s16 + vcvt.s32.f32 s1, s17 + vcvt.s32.f32 s2, s18 + vcvt.s32.f32 s3, s19 + vcvt.s32.f32 s4, s20 + vcvt.s32.f32 s5, s21 + vcvt.s32.f32 s6, s22 + vcvt.s32.f32 s7, s23 +1: + subs r2, r2, #8 + vmov r3, r4, s0, s1 + vmov r5, r6, s2, s3 + vmov r7, r8, s4, s5 + vmov ip, lr, s6, s7 + vldmiagt r1!, {s16-s23} + ssat r4, #16, r4 + ssat r3, #16, r3 + ssat r6, #16, r6 + ssat r5, #16, r5 + pkhbt r3, r3, r4, lsl #16 + pkhbt r4, r5, r6, lsl #16 + vcvtgt.s32.f32 s0, s16 + vcvtgt.s32.f32 s1, s17 + vcvtgt.s32.f32 s2, s18 + vcvtgt.s32.f32 s3, s19 + vcvtgt.s32.f32 s4, s20 + vcvtgt.s32.f32 s5, s21 + vcvtgt.s32.f32 s6, s22 + vcvtgt.s32.f32 s7, s23 + ssat r8, #16, r8 + ssat r7, #16, r7 + ssat lr, #16, lr + ssat ip, #16, ip + pkhbt r5, r7, r8, lsl #16 + pkhbt r6, ip, lr, lsl #16 + stmia r0!, {r3-r6} + bgt 1b + + vpop {d8-d11} + pop {r4-r8,pc} +endfunc diff --git a/mplayer/ffmpeg/libavcodec/arm/synth_filter_neon.S b/mplayer/ffmpeg/libavcodec/arm/synth_filter_neon.S index a7c23df0..1464abe5 100644 --- a/mplayer/ffmpeg/libavcodec/arm/synth_filter_neon.S +++ b/mplayer/ffmpeg/libavcodec/arm/synth_filter_neon.S @@ -42,7 +42,7 @@ VFP vpop {d0} ldr r5, [sp, #9*4] @ window ldr r2, [sp, #10*4] @ out -NOVFP vldr d0, [sp, #12*4] @ scale, bias +NOVFP vldr s0, [sp, #12*4] @ scale add r8, r9, #12*4 mov lr, #64*4 @@ -90,10 +90,8 @@ NOVFP vldr d0, [sp, #12*4] @ scale, bias sub r11, r11, #512*4 b 2b 3: - vdup.32 q8, d0[1] - vdup.32 q9, d0[1] - vmla.f32 q8, q10, d0[0] - vmla.f32 q9, q1, d0[0] + vmul.f32 q8, q10, d0[0] + vmul.f32 q9, q1, d0[0] vst1.32 {q3}, [r3,:128] sub r3, r3, #16*4 vst1.32 {q2}, [r3,:128] diff --git a/mplayer/ffmpeg/libavcodec/arm/vp56_arith.h b/mplayer/ffmpeg/libavcodec/arm/vp56_arith.h new file mode 100644 index 00000000..9bcb466b --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/arm/vp56_arith.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2010 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_ARM_VP56_ARITH_H +#define AVCODEC_ARM_VP56_ARITH_H + +#if HAVE_ARMV6 && HAVE_INLINE_ASM + +#define vp56_rac_get_prob vp56_rac_get_prob_armv6 +static inline int vp56_rac_get_prob_armv6(VP56RangeCoder *c, int pr) +{ + unsigned shift = ff_vp56_norm_shift[c->high]; + unsigned code_word = c->code_word << shift; + unsigned high = c->high << shift; + unsigned bit; + + __asm__ volatile ("adds %3, %3, %0 \n" + "cmpcs %7, %4 \n" + "ldrcsh %2, [%4], #2 \n" + "rsb %0, %6, #256 \n" + "smlabb %0, %5, %6, %0 \n" + "rev16cs %2, %2 \n" + "orrcs %1, %1, %2, lsl %3 \n" + "subcs %3, %3, #16 \n" + "lsr %0, %0, #8 \n" + "cmp %1, %0, lsl #16 \n" + "subge %1, %1, %0, lsl #16 \n" + "subge %0, %5, %0 \n" + "movge %2, #1 \n" + "movlt %2, #0 \n" + : "=&r"(c->high), "=&r"(c->code_word), "=&r"(bit), + "+&r"(c->bits), "+&r"(c->buffer) + : "r"(high), "r"(pr), "r"(c->end - 1), + "0"(shift), "1"(code_word)); + + return bit; +} + +#define vp56_rac_get_prob_branchy vp56_rac_get_prob_branchy_armv6 +static inline int vp56_rac_get_prob_branchy_armv6(VP56RangeCoder *c, int pr) +{ + unsigned shift = ff_vp56_norm_shift[c->high]; + unsigned code_word = c->code_word << shift; + unsigned high = c->high << shift; + unsigned low; + unsigned tmp; + + __asm__ volatile ("adds %3, %3, %0 \n" + "cmpcs %7, %4 \n" + "ldrcsh %2, [%4], #2 \n" + "rsb %0, %6, #256 \n" + "smlabb %0, %5, %6, %0 \n" + "rev16cs %2, %2 \n" + "orrcs %1, %1, %2, lsl %3 \n" + "subcs %3, %3, #16 \n" + "lsr %0, %0, #8 \n" + "lsl %2, %0, #16 \n" + : "=&r"(low), "+&r"(code_word), "=&r"(tmp), + "+&r"(c->bits), "+&r"(c->buffer) + : "r"(high), "r"(pr), "r"(c->end - 1), "0"(shift)); + + if (code_word >= tmp) { + c->high = high - low; + c->code_word = code_word - tmp; + return 1; + } + + c->high = low; + c->code_word = code_word; + return 0; +} + +#endif + +#endif diff --git a/mplayer/ffmpeg/libavcore/internal.h b/mplayer/ffmpeg/libavcodec/arm/vp8.h similarity index 67% rename from mplayer/ffmpeg/libavcore/internal.h rename to mplayer/ffmpeg/libavcodec/arm/vp8.h index 3960bd39..90e7344b 100644 --- a/mplayer/ffmpeg/libavcore/internal.h +++ b/mplayer/ffmpeg/libavcodec/arm/vp8.h @@ -1,4 +1,4 @@ -/* +/** * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or @@ -16,16 +16,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCORE_INTERNAL_H -#define AVCORE_INTERNAL_H - -/** - * @file - * internal functions - */ - -#include "avcore.h" +#ifndef AVCODEC_ARM_VP8_H +#define AVCODEC_ARM_VP8_H -int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt); +#if HAVE_ARMV6 +#define decode_block_coeffs_internal ff_decode_block_coeffs_armv6 +int ff_decode_block_coeffs_armv6(VP56RangeCoder *rc, DCTELEM block[16], + uint8_t probs[8][3][NUM_DCT_TOKENS-1], + int i, uint8_t *token_prob, int16_t qmul[2]); +#endif -#endif /* AVCORE_INTERNAL_H */ +#endif diff --git a/mplayer/ffmpeg/libavcodec/arm/vp8_armv6.S b/mplayer/ffmpeg/libavcodec/arm/vp8_armv6.S new file mode 100644 index 00000000..d981db81 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/arm/vp8_armv6.S @@ -0,0 +1,220 @@ +/** + * Copyright (C) 2010 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "asm.S" + + .syntax unified + +.macro rac_get_prob h, bs, buf, cw, pr, t0, t1 + adds \bs, \bs, \t0 + lsl \cw, \cw, \t0 + lsl \t0, \h, \t0 + rsb \h, \pr, #256 + ldrhcs \t1, [\buf], #2 + smlabb \h, \t0, \pr, \h + rev16cs \t1, \t1 + orrcs \cw, \cw, \t1, lsl \bs + subcs \bs, \bs, #16 + lsr \h, \h, #8 + cmp \cw, \h, lsl #16 + subge \cw, \cw, \h, lsl #16 + subge \h, \t0, \h +.endm + +.macro rac_get_128 h, bs, buf, cw, t0, t1 + adds \bs, \bs, \t0 + lsl \cw, \cw, \t0 + lsl \t0, \h, \t0 + ldrhcs \t1, [\buf], #2 + mov \h, #128 + rev16cs \t1, \t1 + add \h, \h, \t0, lsl #7 + orrcs \cw, \cw, \t1, lsl \bs + subcs \bs, \bs, #16 + lsr \h, \h, #8 + cmp \cw, \h, lsl #16 + subge \cw, \cw, \h, lsl #16 + subge \h, \t0, \h +.endm + +function ff_decode_block_coeffs_armv6, export=1 + push {r0,r1,r4-r11,lr} + movrel lr, X(ff_vp56_norm_shift) + ldrd r4, r5, [sp, #44] @ token_prob, qmul + cmp r3, #0 + ldr r11, [r5] + ldm r0, {r5-r7} @ high, bits, buf + pkhtbne r11, r11, r11, asr #16 + ldr r8, [r0, #16] @ code_word +0: + ldrb r9, [lr, r5] + add r3, r3, #1 + ldrb r0, [r4, #1] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + blt 2f + + ldrb r9, [lr, r5] + ldrb r0, [r4, #2] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + ldrb r9, [lr, r5] + bge 3f + + add r4, r3, r3, lsl #5 + sxth r12, r11 + add r4, r2, r4 + adds r6, r6, r9 + add r4, r4, #11 + lsl r8, r8, r9 + ldrhcs r10, [r7], #2 + lsl r9, r5, r9 + mov r5, #128 + rev16cs r10, r10 + add r5, r5, r9, lsl #7 + orrcs r8, r8, r10, lsl r6 + subcs r6, r6, #16 + lsr r5, r5, #8 + cmp r8, r5, lsl #16 + movrel r10, zigzag_scan-1 + subge r8, r8, r5, lsl #16 + subge r5, r9, r5 + ldrb r10, [r10, r3] + rsbge r12, r12, #0 + cmp r3, #16 + strh r12, [r1, r10] + bge 6f +5: + ldrb r9, [lr, r5] + ldrb r0, [r4] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + pkhtb r11, r11, r11, asr #16 + bge 0b + +6: + ldr r0, [sp] + ldr r9, [r0, #12] + cmp r7, r9 + movhi r7, r9 + stm r0, {r5-r7} @ high, bits, buf + str r8, [r0, #16] @ code_word + + add sp, sp, #8 + mov r0, r3 + pop {r4-r11,pc} +2: + add r4, r3, r3, lsl #5 + cmp r3, #16 + add r4, r2, r4 + pkhtb r11, r11, r11, asr #16 + bne 0b + b 6b +3: + ldrb r0, [r4, #3] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + ldrb r9, [lr, r5] + bge 1f + + mov r12, #2 + ldrb r0, [r4, #4] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + addge r12, #1 + ldrb r9, [lr, r5] + blt 4f + ldrb r0, [r4, #5] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + addge r12, #1 + ldrb r9, [lr, r5] + b 4f +1: + ldrb r0, [r4, #6] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + ldrb r9, [lr, r5] + bge 3f + + ldrb r0, [r4, #7] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + ldrb r9, [lr, r5] + bge 2f + + mov r12, #5 + mov r0, #159 + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + addge r12, r12, #1 + ldrb r9, [lr, r5] + b 4f +2: + mov r12, #7 + mov r0, #165 + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + addge r12, r12, #2 + ldrb r9, [lr, r5] + mov r0, #145 + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + addge r12, r12, #1 + ldrb r9, [lr, r5] + b 4f +3: + ldrb r0, [r4, #8] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + addge r4, r4, #1 + ldrb r9, [lr, r5] + movge r12, #2 + movlt r12, #0 + ldrb r0, [r4, #9] + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + mov r9, #8 + addge r12, r12, #1 + movrel r4, ff_vp8_dct_cat_prob + lsl r9, r9, r12 + ldr r4, [r4, r12, lsl #2] + add r12, r9, #3 + mov r1, #0 + ldrb r0, [r4], #1 +1: + ldrb r9, [lr, r5] + lsl r1, r1, #1 + rac_get_prob r5, r6, r7, r8, r0, r9, r10 + ldrb r0, [r4], #1 + addge r1, r1, #1 + cmp r0, #0 + bne 1b + ldrb r9, [lr, r5] + add r12, r12, r1 + ldr r1, [sp, #4] +4: + add r4, r3, r3, lsl #5 + add r4, r2, r4 + add r4, r4, #22 + rac_get_128 r5, r6, r7, r8, r9, r10 + rsbge r12, r12, #0 + smulbb r12, r12, r11 + movrel r9, zigzag_scan-1 + ldrb r9, [r9, r3] + cmp r3, #16 + strh r12, [r1, r9] + bge 6b + b 5b +endfunc + + .section .rodata +zigzag_scan: + .byte 0, 2, 8, 16 + .byte 10, 4, 6, 12 + .byte 18, 24, 26, 20 + .byte 14, 22, 28, 30 diff --git a/mplayer/ffmpeg/libavcodec/arm/vp8dsp_init_arm.c b/mplayer/ffmpeg/libavcodec/arm/vp8dsp_init_arm.c new file mode 100644 index 00000000..c970ca54 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/arm/vp8dsp_init_arm.c @@ -0,0 +1,163 @@ +/** + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include "libavcodec/vp8dsp.h" + +void ff_vp8_luma_dc_wht_neon(DCTELEM block[4][4][16], DCTELEM dc[16]); +void ff_vp8_luma_dc_wht_dc_neon(DCTELEM block[4][4][16], DCTELEM dc[16]); + +void ff_vp8_idct_add_neon(uint8_t *dst, DCTELEM block[16], int stride); +void ff_vp8_idct_dc_add_neon(uint8_t *dst, DCTELEM block[16], int stride); +void ff_vp8_idct_dc_add4y_neon(uint8_t *dst, DCTELEM block[4][16], int stride); +void ff_vp8_idct_dc_add4uv_neon(uint8_t *dst, DCTELEM block[4][16], int stride); + +void ff_vp8_v_loop_filter16_neon(uint8_t *dst, int stride, + int flim_E, int flim_I, int hev_thresh); +void ff_vp8_h_loop_filter16_neon(uint8_t *dst, int stride, + int flim_E, int flim_I, int hev_thresh); +void ff_vp8_v_loop_filter8uv_neon(uint8_t *dstU, uint8_t *dstV, int stride, + int flim_E, int flim_I, int hev_thresh); +void ff_vp8_h_loop_filter8uv_neon(uint8_t *dstU, uint8_t *dstV, int stride, + int flim_E, int flim_I, int hev_thresh); + +void ff_vp8_v_loop_filter16_inner_neon(uint8_t *dst, int stride, + int flim_E, int flim_I, int hev_thresh); +void ff_vp8_h_loop_filter16_inner_neon(uint8_t *dst, int stride, + int flim_E, int flim_I, int hev_thresh); +void ff_vp8_v_loop_filter8uv_inner_neon(uint8_t *dstU, uint8_t *dstV, + int stride, int flim_E, int flim_I, + int hev_thresh); +void ff_vp8_h_loop_filter8uv_inner_neon(uint8_t *dstU, uint8_t *dstV, + int stride, int flim_E, int flim_I, + int hev_thresh); + +void ff_vp8_v_loop_filter16_simple_neon(uint8_t *dst, int stride, int flim); +void ff_vp8_h_loop_filter16_simple_neon(uint8_t *dst, int stride, int flim); + + +#define VP8_MC(n) \ + void ff_put_vp8_##n##_neon(uint8_t *dst, int dststride, \ + uint8_t *src, int srcstride, \ + int h, int x, int y) + +#define VP8_EPEL(w) \ + VP8_MC(pixels ## w); \ + VP8_MC(epel ## w ## _h4); \ + VP8_MC(epel ## w ## _h6); \ + VP8_MC(epel ## w ## _v4); \ + VP8_MC(epel ## w ## _h4v4); \ + VP8_MC(epel ## w ## _h6v4); \ + VP8_MC(epel ## w ## _v6); \ + VP8_MC(epel ## w ## _h4v6); \ + VP8_MC(epel ## w ## _h6v6) + +VP8_EPEL(16); +VP8_EPEL(8); +VP8_EPEL(4); + +VP8_MC(bilin16_h); +VP8_MC(bilin16_v); +VP8_MC(bilin16_hv); +VP8_MC(bilin8_h); +VP8_MC(bilin8_v); +VP8_MC(bilin8_hv); +VP8_MC(bilin4_h); +VP8_MC(bilin4_v); +VP8_MC(bilin4_hv); + +av_cold void ff_vp8dsp_init_arm(VP8DSPContext *dsp) +{ + if (HAVE_NEON) { + dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_neon; + dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_neon; + + dsp->vp8_idct_add = ff_vp8_idct_add_neon; + dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_neon; + dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_neon; + dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_neon; + + dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_neon; + dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_neon; + dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_neon; + dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_neon; + + dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_neon; + dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_neon; + dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_neon; + dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_neon; + + dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_neon; + dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_neon; + + dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; + dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_neon; + dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_neon; + dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_neon; + + dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; + dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_neon; + dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_neon; + dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_neon; + dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_neon; + dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_neon; + dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_neon; + dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_neon; + dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_neon; + + dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_neon; + dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_neon; + dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_neon; + dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_neon; + dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_neon; + dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_neon; + dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_neon; + dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_neon; + dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_neon; + + dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; + dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_neon; + dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_neon; + + dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; + dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_neon; + dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_neon; + + dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_neon; + dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_neon; + dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_neon; + } +} diff --git a/mplayer/ffmpeg/libavcodec/arm/vp8dsp_neon.S b/mplayer/ffmpeg/libavcodec/arm/vp8dsp_neon.S new file mode 100644 index 00000000..23330900 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/arm/vp8dsp_neon.S @@ -0,0 +1,1912 @@ +/** + * VP8 NEON optimisations + * + * Copyright (c) 2010 Rob Clark + * Copyright (c) 2011 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "asm.S" + +function ff_vp8_luma_dc_wht_neon, export=1 + vld1.16 {q0-q1}, [r1,:128] + vmov.i16 q15, #0 + + vadd.i16 d4, d0, d3 + vadd.i16 d6, d1, d2 + vst1.16 {q15}, [r1,:128]! + vsub.i16 d7, d1, d2 + vsub.i16 d5, d0, d3 + vst1.16 {q15}, [r1,:128] + vadd.i16 q0, q2, q3 + vsub.i16 q1, q2, q3 + + vmov.i16 q8, #3 + + vtrn.32 d0, d2 + vtrn.32 d1, d3 + vtrn.16 d0, d1 + vtrn.16 d2, d3 + + vadd.i16 d0, d0, d16 + + vadd.i16 d4, d0, d3 + vadd.i16 d6, d1, d2 + vsub.i16 d7, d1, d2 + vsub.i16 d5, d0, d3 + vadd.i16 q0, q2, q3 + vsub.i16 q1, q2, q3 + + vshr.s16 q0, q0, #3 + vshr.s16 q1, q1, #3 + + mov r3, #32 + vst1.16 {d0[0]}, [r0,:16], r3 + vst1.16 {d1[0]}, [r0,:16], r3 + vst1.16 {d2[0]}, [r0,:16], r3 + vst1.16 {d3[0]}, [r0,:16], r3 + vst1.16 {d0[1]}, [r0,:16], r3 + vst1.16 {d1[1]}, [r0,:16], r3 + vst1.16 {d2[1]}, [r0,:16], r3 + vst1.16 {d3[1]}, [r0,:16], r3 + vst1.16 {d0[2]}, [r0,:16], r3 + vst1.16 {d1[2]}, [r0,:16], r3 + vst1.16 {d2[2]}, [r0,:16], r3 + vst1.16 {d3[2]}, [r0,:16], r3 + vst1.16 {d0[3]}, [r0,:16], r3 + vst1.16 {d1[3]}, [r0,:16], r3 + vst1.16 {d2[3]}, [r0,:16], r3 + vst1.16 {d3[3]}, [r0,:16], r3 + + bx lr +endfunc + +function ff_vp8_luma_dc_wht_dc_neon, export=1 + ldrsh r2, [r1] + mov r3, #0 + add r2, r2, #3 + strh r3, [r1] + asr r2, r2, #3 + .rept 16 + strh r2, [r0], #32 + .endr + bx lr +endfunc + +function ff_vp8_idct_add_neon, export=1 + vld1.16 {q0-q1}, [r1,:128] + movw r3, #20091 + movt r3, #35468/2 + vdup.32 d4, r3 + + vmull.s16 q12, d1, d4[0] + vmull.s16 q13, d3, d4[0] + vqdmulh.s16 d20, d1, d4[1] + vqdmulh.s16 d23, d3, d4[1] + vshrn.s32 d21, q12, #16 + vshrn.s32 d22, q13, #16 + vadd.s16 d21, d21, d1 + vadd.s16 d22, d22, d3 + + vadd.s16 d16, d0, d2 + vsub.s16 d17, d0, d2 + vadd.s16 d18, d21, d23 + vsub.s16 d19, d20, d22 + vadd.s16 q0, q8, q9 + vsub.s16 q1, q8, q9 + + vtrn.32 d0, d3 + vtrn.32 d1, d2 + vtrn.16 d0, d1 + vtrn.16 d3, d2 + + vmov.i16 q15, #0 + vmull.s16 q12, d1, d4[0] + vst1.16 {q15}, [r1,:128]! + vmull.s16 q13, d2, d4[0] + vst1.16 {q15}, [r1,:128] + vqdmulh.s16 d21, d1, d4[1] + vqdmulh.s16 d23, d2, d4[1] + vshrn.s32 d20, q12, #16 + vshrn.s32 d22, q13, #16 + vadd.i16 d20, d20, d1 + vadd.i16 d22, d22, d2 + + vadd.i16 d16, d0, d3 + vsub.i16 d17, d0, d3 + vadd.i16 d18, d20, d23 + vld1.32 {d20[]}, [r0,:32], r2 + vsub.i16 d19, d21, d22 + vld1.32 {d22[]}, [r0,:32], r2 + vadd.s16 q0, q8, q9 + vld1.32 {d23[]}, [r0,:32], r2 + vsub.s16 q1, q8, q9 + vld1.32 {d21[]}, [r0,:32], r2 + vrshr.s16 q0, q0, #3 + vtrn.32 q10, q11 + vrshr.s16 q1, q1, #3 + + sub r0, r0, r2, lsl #2 + + vtrn.32 d0, d3 + vtrn.32 d1, d2 + vtrn.16 d0, d1 + vtrn.16 d3, d2 + + vaddw.u8 q0, q0, d20 + vaddw.u8 q1, q1, d21 + vqmovun.s16 d0, q0 + vqmovun.s16 d1, q1 + + vst1.32 {d0[0]}, [r0,:32], r2 + vst1.32 {d0[1]}, [r0,:32], r2 + vst1.32 {d1[1]}, [r0,:32], r2 + vst1.32 {d1[0]}, [r0,:32], r2 + + bx lr +endfunc + +function ff_vp8_idct_dc_add_neon, export=1 + mov r3, #0 + ldrsh r12, [r1] + strh r3, [r1] + vdup.16 q1, r12 + vrshr.s16 q1, q1, #3 + vld1.32 {d0[]}, [r0,:32], r2 + vld1.32 {d1[]}, [r0,:32], r2 + vld1.32 {d0[1]}, [r0,:32], r2 + vld1.32 {d1[1]}, [r0,:32], r2 + vaddw.u8 q2, q1, d0 + vaddw.u8 q3, q1, d1 + sub r0, r0, r2, lsl #2 + vqmovun.s16 d0, q2 + vqmovun.s16 d1, q3 + vst1.32 {d0[0]}, [r0,:32], r2 + vst1.32 {d1[0]}, [r0,:32], r2 + vst1.32 {d0[1]}, [r0,:32], r2 + vst1.32 {d1[1]}, [r0,:32], r2 + bx lr +endfunc + +function ff_vp8_idct_dc_add4uv_neon, export=1 + vmov.i16 d0, #0 + mov r3, #32 + vld1.16 {d16[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + vld1.16 {d17[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + vld1.16 {d18[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + vld1.16 {d19[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + mov r3, r0 + vrshr.s16 q8, q8, #3 @ dc >>= 3 + vld1.8 {d0}, [r0,:64], r2 + vrshr.s16 q9, q9, #3 + vld1.8 {d1}, [r0,:64], r2 + vaddw.u8 q10, q8, d0 + vld1.8 {d2}, [r0,:64], r2 + vaddw.u8 q0, q8, d1 + vld1.8 {d3}, [r0,:64], r2 + vaddw.u8 q11, q8, d2 + vld1.8 {d4}, [r0,:64], r2 + vaddw.u8 q1, q8, d3 + vld1.8 {d5}, [r0,:64], r2 + vaddw.u8 q12, q9, d4 + vld1.8 {d6}, [r0,:64], r2 + vaddw.u8 q2, q9, d5 + vld1.8 {d7}, [r0,:64], r2 + vaddw.u8 q13, q9, d6 + vqmovun.s16 d20, q10 + vaddw.u8 q3, q9, d7 + vqmovun.s16 d21, q0 + vqmovun.s16 d22, q11 + vst1.8 {d20}, [r3,:64], r2 + vqmovun.s16 d23, q1 + vst1.8 {d21}, [r3,:64], r2 + vqmovun.s16 d24, q12 + vst1.8 {d22}, [r3,:64], r2 + vqmovun.s16 d25, q2 + vst1.8 {d23}, [r3,:64], r2 + vqmovun.s16 d26, q13 + vst1.8 {d24}, [r3,:64], r2 + vqmovun.s16 d27, q3 + vst1.8 {d25}, [r3,:64], r2 + vst1.8 {d26}, [r3,:64], r2 + vst1.8 {d27}, [r3,:64], r2 + + bx lr +endfunc + +function ff_vp8_idct_dc_add4y_neon, export=1 + vmov.i16 d0, #0 + mov r3, #32 + vld1.16 {d16[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + vld1.16 {d17[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + vld1.16 {d18[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + vld1.16 {d19[]}, [r1,:16] + vst1.16 {d0[0]}, [r1,:16], r3 + vrshr.s16 q8, q8, #3 @ dc >>= 3 + vld1.8 {q0}, [r0,:128], r2 + vrshr.s16 q9, q9, #3 + vld1.8 {q1}, [r0,:128], r2 + vaddw.u8 q10, q8, d0 + vld1.8 {q2}, [r0,:128], r2 + vaddw.u8 q0, q9, d1 + vld1.8 {q3}, [r0,:128], r2 + vaddw.u8 q11, q8, d2 + vaddw.u8 q1, q9, d3 + vaddw.u8 q12, q8, d4 + vaddw.u8 q2, q9, d5 + vaddw.u8 q13, q8, d6 + vaddw.u8 q3, q9, d7 + sub r0, r0, r2, lsl #2 + vqmovun.s16 d20, q10 + vqmovun.s16 d21, q0 + vqmovun.s16 d22, q11 + vqmovun.s16 d23, q1 + vqmovun.s16 d24, q12 + vst1.8 {q10}, [r0,:128], r2 + vqmovun.s16 d25, q2 + vst1.8 {q11}, [r0,:128], r2 + vqmovun.s16 d26, q13 + vst1.8 {q12}, [r0,:128], r2 + vqmovun.s16 d27, q3 + vst1.8 {q13}, [r0,:128], r2 + + bx lr +endfunc + +@ Register layout: +@ P3..Q3 -> q0..q7 +@ flim_E -> q14 +@ flim_I -> q15 +@ hev_thresh -> r12 +@ +.macro vp8_loop_filter, inner=0, simple=0 + .if \simple + vabd.u8 q9, q3, q4 @ abs(P0-Q0) + vabd.u8 q15, q2, q5 @ abs(P1-Q1) + vqadd.u8 q9, q9, q9 @ abs(P0-Q0) * 2 + vshr.u8 q10, q15, #1 @ abs(P1-Q1) / 2 + vqadd.u8 q11, q9, q10 @ (abs(P0-Q0)*2) + (abs(P1-Q1)/2) + vmov.i8 q13, #0x80 + vcle.u8 q8, q11, q14 @ (abs(P0-Q0)*2) + (abs(P1-Q1)/2) <= flim + .else + @ calculate hev and normal_limit: + vabd.u8 q12, q2, q3 @ abs(P1-P0) + vabd.u8 q13, q5, q4 @ abs(Q1-Q0) + vabd.u8 q10, q0, q1 @ abs(P3-P2) + vabd.u8 q11, q1, q2 @ abs(P2-P1) + vcle.u8 q8, q12, q15 @ abs(P1-P0) <= flim_I + vcle.u8 q9, q13, q15 @ abs(Q1-Q0) <= flim_I + vcle.u8 q10, q10, q15 @ abs(P3-P2) <= flim_I + vcle.u8 q11, q11, q15 @ abs(P2-P1) <= flim_I + vand q8, q8, q9 + vabd.u8 q9, q7, q6 @ abs(Q3-Q2) + vand q8, q8, q11 + vabd.u8 q11, q6, q5 @ abs(Q2-Q1) + vand q8, q8, q10 + vcle.u8 q10, q9, q15 @ abs(Q3-Q2) <= flim_I + vcle.u8 q11, q11, q15 @ abs(Q2-Q1) <= flim_I + vabd.u8 q9, q3, q4 @ abs(P0-Q0) + vabd.u8 q15, q2, q5 @ abs(P1-Q1) + vand q8, q8, q10 + vqadd.u8 q9, q9, q9 @ abs(P0-Q0) * 2 + vand q8, q8, q11 + vshr.u8 q10, q15, #1 @ abs(P1-Q1) / 2 + vdup.8 q15, r12 @ hev_thresh + vqadd.u8 q11, q9, q10 @ (abs(P0-Q0)*2) + (abs(P1-Q1)/2) + vcgt.u8 q12, q12, q15 @ abs(P1-P0) > hev_thresh + vcle.u8 q11, q11, q14 @ (abs(P0-Q0)*2) + (abs(P1-Q1)/2) <= flim_E + vcgt.u8 q14, q13, q15 @ abs(Q1-Q0) > hev_thresh + vand q8, q8, q11 + vmov.i8 q13, #0x80 + vorr q9, q12, q14 + .endif + + @ at this point: + @ q8: normal_limit + @ q9: hev + + @ convert to signed value: + veor q3, q3, q13 @ PS0 = P0 ^ 0x80 + veor q4, q4, q13 @ QS0 = Q0 ^ 0x80 + + vmov.i16 q12, #3 + vsubl.s8 q10, d8, d6 @ QS0 - PS0 + vsubl.s8 q11, d9, d7 @ (widened to 16bit) + veor q2, q2, q13 @ PS1 = P1 ^ 0x80 + veor q5, q5, q13 @ QS1 = Q1 ^ 0x80 + vmul.i16 q10, q10, q12 @ w = 3 * (QS0 - PS0) + vmul.i16 q11, q11, q12 + + vqsub.s8 q12, q2, q5 @ clamp(PS1-QS1) + vmov.i8 q14, #4 + vmov.i8 q15, #3 + .if \inner + vand q12, q12, q9 @ if(hev) w += clamp(PS1-QS1) + .endif + vaddw.s8 q10, q10, d24 @ w += clamp(PS1-QS1) + vaddw.s8 q11, q11, d25 + vqmovn.s16 d20, q10 @ narrow result back into q10 + vqmovn.s16 d21, q11 + .if !\inner && !\simple + veor q1, q1, q13 @ PS2 = P2 ^ 0x80 + veor q6, q6, q13 @ QS2 = Q2 ^ 0x80 + .endif + vand q10, q10, q8 @ w &= normal_limit + + @ registers used at this point.. + @ q0 -> P3 (don't corrupt) + @ q1-q6 -> PS2-QS2 + @ q7 -> Q3 (don't corrupt) + @ q9 -> hev + @ q10 -> w + @ q13 -> #0x80 + @ q14 -> #4 + @ q15 -> #3 + @ q8, q11, q12 -> unused + + @ filter_common: is4tap==1 + @ c1 = clamp(w + 4) >> 3; + @ c2 = clamp(w + 3) >> 3; + @ Q0 = s2u(QS0 - c1); + @ P0 = s2u(PS0 + c2); + + .if \simple + vqadd.s8 q11, q10, q14 @ c1 = clamp((w&hev)+4) + vqadd.s8 q12, q10, q15 @ c2 = clamp((w&hev)+3) + vshr.s8 q11, q11, #3 @ c1 >>= 3 + vshr.s8 q12, q12, #3 @ c2 >>= 3 + vqsub.s8 q4, q4, q11 @ QS0 = clamp(QS0-c1) + vqadd.s8 q3, q3, q12 @ PS0 = clamp(PS0+c2) + veor q4, q4, q13 @ Q0 = QS0 ^ 0x80 + veor q3, q3, q13 @ P0 = PS0 ^ 0x80 + veor q5, q5, q13 @ Q1 = QS1 ^ 0x80 + veor q2, q2, q13 @ P1 = PS1 ^ 0x80 + .elseif \inner + @ the !is4tap case of filter_common, only used for inner blocks + @ c3 = ((c1&~hev) + 1) >> 1; + @ Q1 = s2u(QS1 - c3); + @ P1 = s2u(PS1 + c3); + vqadd.s8 q11, q10, q14 @ c1 = clamp((w&hev)+4) + vqadd.s8 q12, q10, q15 @ c2 = clamp((w&hev)+3) + vshr.s8 q11, q11, #3 @ c1 >>= 3 + vshr.s8 q12, q12, #3 @ c2 >>= 3 + vqsub.s8 q4, q4, q11 @ QS0 = clamp(QS0-c1) + vqadd.s8 q3, q3, q12 @ PS0 = clamp(PS0+c2) + vbic q11, q11, q9 @ c1 & ~hev + veor q4, q4, q13 @ Q0 = QS0 ^ 0x80 + vrshr.s8 q11, q11, #1 @ c3 >>= 1 + veor q3, q3, q13 @ P0 = PS0 ^ 0x80 + vqsub.s8 q5, q5, q11 @ QS1 = clamp(QS1-c3) + vqadd.s8 q2, q2, q11 @ PS1 = clamp(PS1+c3) + veor q5, q5, q13 @ Q1 = QS1 ^ 0x80 + veor q2, q2, q13 @ P1 = PS1 ^ 0x80 + .else + vand q12, q10, q9 @ w & hev + vqadd.s8 q11, q12, q14 @ c1 = clamp((w&hev)+4) + vqadd.s8 q12, q12, q15 @ c2 = clamp((w&hev)+3) + vshr.s8 q11, q11, #3 @ c1 >>= 3 + vshr.s8 q12, q12, #3 @ c2 >>= 3 + vbic q10, q10, q9 @ w &= ~hev + vqsub.s8 q4, q4, q11 @ QS0 = clamp(QS0-c1) + vqadd.s8 q3, q3, q12 @ PS0 = clamp(PS0+c2) + + @ filter_mbedge: + @ a = clamp((27*w + 63) >> 7); + @ Q0 = s2u(QS0 - a); + @ P0 = s2u(PS0 + a); + @ a = clamp((18*w + 63) >> 7); + @ Q1 = s2u(QS1 - a); + @ P1 = s2u(PS1 + a); + @ a = clamp((9*w + 63) >> 7); + @ Q2 = s2u(QS2 - a); + @ P2 = s2u(PS2 + a); + vmov.i16 q9, #63 + vshll.s8 q14, d20, #3 + vshll.s8 q15, d21, #3 + vaddw.s8 q14, q14, d20 + vaddw.s8 q15, q15, d21 + vadd.s16 q8, q9, q14 + vadd.s16 q9, q9, q15 @ 9*w + 63 + vadd.s16 q11, q8, q14 + vadd.s16 q12, q9, q15 @ 18*w + 63 + vadd.s16 q14, q11, q14 + vadd.s16 q15, q12, q15 @ 27*w + 63 + vqshrn.s16 d16, q8, #7 + vqshrn.s16 d17, q9, #7 @ clamp(( 9*w + 63)>>7) + vqshrn.s16 d22, q11, #7 + vqshrn.s16 d23, q12, #7 @ clamp((18*w + 63)>>7) + vqshrn.s16 d28, q14, #7 + vqshrn.s16 d29, q15, #7 @ clamp((27*w + 63)>>7) + vqadd.s8 q1, q1, q8 @ PS2 = clamp(PS2+a) + vqsub.s8 q6, q6, q8 @ QS2 = clamp(QS2-a) + vqadd.s8 q2, q2, q11 @ PS1 = clamp(PS1+a) + vqsub.s8 q5, q5, q11 @ QS1 = clamp(QS1-a) + vqadd.s8 q3, q3, q14 @ PS0 = clamp(PS0+a) + vqsub.s8 q4, q4, q14 @ QS0 = clamp(QS0-a) + veor q3, q3, q13 @ P0 = PS0 ^ 0x80 + veor q4, q4, q13 @ Q0 = QS0 ^ 0x80 + veor q2, q2, q13 @ P1 = PS1 ^ 0x80 + veor q5, q5, q13 @ Q1 = QS1 ^ 0x80 + veor q1, q1, q13 @ P2 = PS2 ^ 0x80 + veor q6, q6, q13 @ Q2 = QS2 ^ 0x80 + .endif +.endm + +.macro transpose8x16matrix + vtrn.32 q0, q4 + vtrn.32 q1, q5 + vtrn.32 q2, q6 + vtrn.32 q3, q7 + + vtrn.16 q0, q2 + vtrn.16 q1, q3 + vtrn.16 q4, q6 + vtrn.16 q5, q7 + + vtrn.8 q0, q1 + vtrn.8 q2, q3 + vtrn.8 q4, q5 + vtrn.8 q6, q7 +.endm + +.macro vp8_v_loop_filter16 name, inner=0, simple=0 +function ff_vp8_v_loop_filter16\name\()_neon, export=1 + vpush {q4-q7} + sub r0, r0, r1, lsl #1+!\simple + + @ Load pixels: + .if !\simple + ldr r12, [sp, #64] @ hev_thresh + vld1.8 {q0}, [r0,:128], r1 @ P3 + vld1.8 {q1}, [r0,:128], r1 @ P2 + .endif + vld1.8 {q2}, [r0,:128], r1 @ P1 + vld1.8 {q3}, [r0,:128], r1 @ P0 + vld1.8 {q4}, [r0,:128], r1 @ Q0 + vld1.8 {q5}, [r0,:128], r1 @ Q1 + .if !\simple + vld1.8 {q6}, [r0,:128], r1 @ Q2 + vld1.8 {q7}, [r0,:128] @ Q3 + vdup.8 q15, r3 @ flim_I + .endif + vdup.8 q14, r2 @ flim_E + + vp8_loop_filter inner=\inner, simple=\simple + + @ back up to P2: dst -= stride * 6 + sub r0, r0, r1, lsl #2 + .if !\simple + sub r0, r0, r1, lsl #1 + + @ Store pixels: + vst1.8 {q1}, [r0,:128], r1 @ P2 + .endif + vst1.8 {q2}, [r0,:128], r1 @ P1 + vst1.8 {q3}, [r0,:128], r1 @ P0 + vst1.8 {q4}, [r0,:128], r1 @ Q0 + vst1.8 {q5}, [r0,:128], r1 @ Q1 + .if !\simple + vst1.8 {q6}, [r0,:128] @ Q2 + .endif + + vpop {q4-q7} + bx lr +endfunc +.endm + +vp8_v_loop_filter16 +vp8_v_loop_filter16 _inner, inner=1 +vp8_v_loop_filter16 _simple, simple=1 + +.macro vp8_v_loop_filter8uv name, inner=0 +function ff_vp8_v_loop_filter8uv\name\()_neon, export=1 + vpush {q4-q7} + sub r0, r0, r2, lsl #2 + sub r1, r1, r2, lsl #2 + ldr r12, [sp, #64] @ flim_I + + @ Load pixels: + vld1.8 {d0}, [r0,:64], r2 @ P3 + vld1.8 {d1}, [r1,:64], r2 @ P3 + vld1.8 {d2}, [r0,:64], r2 @ P2 + vld1.8 {d3}, [r1,:64], r2 @ P2 + vld1.8 {d4}, [r0,:64], r2 @ P1 + vld1.8 {d5}, [r1,:64], r2 @ P1 + vld1.8 {d6}, [r0,:64], r2 @ P0 + vld1.8 {d7}, [r1,:64], r2 @ P0 + vld1.8 {d8}, [r0,:64], r2 @ Q0 + vld1.8 {d9}, [r1,:64], r2 @ Q0 + vld1.8 {d10}, [r0,:64], r2 @ Q1 + vld1.8 {d11}, [r1,:64], r2 @ Q1 + vld1.8 {d12}, [r0,:64], r2 @ Q2 + vld1.8 {d13}, [r1,:64], r2 @ Q2 + vld1.8 {d14}, [r0,:64] @ Q3 + vld1.8 {d15}, [r1,:64] @ Q3 + + vdup.8 q14, r3 @ flim_E + vdup.8 q15, r12 @ flim_I + ldr r12, [sp, #68] @ hev_thresh + + vp8_loop_filter inner=\inner + + @ back up to P2: u,v -= stride * 6 + sub r0, r0, r2, lsl #2 + sub r1, r1, r2, lsl #2 + sub r0, r0, r2, lsl #1 + sub r1, r1, r2, lsl #1 + + @ Store pixels: + vst1.8 {d2}, [r0,:64], r2 @ P2 + vst1.8 {d3}, [r1,:64], r2 @ P2 + vst1.8 {d4}, [r0,:64], r2 @ P1 + vst1.8 {d5}, [r1,:64], r2 @ P1 + vst1.8 {d6}, [r0,:64], r2 @ P0 + vst1.8 {d7}, [r1,:64], r2 @ P0 + vst1.8 {d8}, [r0,:64], r2 @ Q0 + vst1.8 {d9}, [r1,:64], r2 @ Q0 + vst1.8 {d10}, [r0,:64], r2 @ Q1 + vst1.8 {d11}, [r1,:64], r2 @ Q1 + vst1.8 {d12}, [r0,:64] @ Q2 + vst1.8 {d13}, [r1,:64] @ Q2 + + vpop {q4-q7} + bx lr +endfunc +.endm + +vp8_v_loop_filter8uv +vp8_v_loop_filter8uv _inner, inner=1 + +.macro vp8_h_loop_filter16 name, inner=0, simple=0 +function ff_vp8_h_loop_filter16\name\()_neon, export=1 + vpush {q4-q7} + sub r0, r0, #4 + .if !\simple + ldr r12, [sp, #64] @ hev_thresh + .endif + + @ Load pixels: + vld1.8 {d0}, [r0], r1 @ load first 8-line src data + vld1.8 {d2}, [r0], r1 + vld1.8 {d4}, [r0], r1 + vld1.8 {d6}, [r0], r1 + vld1.8 {d8}, [r0], r1 + vld1.8 {d10}, [r0], r1 + vld1.8 {d12}, [r0], r1 + vld1.8 {d14}, [r0], r1 + vld1.8 {d1}, [r0], r1 @ load second 8-line src data + vld1.8 {d3}, [r0], r1 + vld1.8 {d5}, [r0], r1 + vld1.8 {d7}, [r0], r1 + vld1.8 {d9}, [r0], r1 + vld1.8 {d11}, [r0], r1 + vld1.8 {d13}, [r0], r1 + vld1.8 {d15}, [r0], r1 + + transpose8x16matrix + + vdup.8 q14, r2 @ flim_E + .if !\simple + vdup.8 q15, r3 @ flim_I + .endif + + vp8_loop_filter inner=\inner, simple=\simple + + sub r0, r0, r1, lsl #4 @ backup 16 rows + + transpose8x16matrix + + @ Store pixels: + vst1.8 {d0}, [r0], r1 + vst1.8 {d2}, [r0], r1 + vst1.8 {d4}, [r0], r1 + vst1.8 {d6}, [r0], r1 + vst1.8 {d8}, [r0], r1 + vst1.8 {d10}, [r0], r1 + vst1.8 {d12}, [r0], r1 + vst1.8 {d14}, [r0], r1 + vst1.8 {d1}, [r0], r1 + vst1.8 {d3}, [r0], r1 + vst1.8 {d5}, [r0], r1 + vst1.8 {d7}, [r0], r1 + vst1.8 {d9}, [r0], r1 + vst1.8 {d11}, [r0], r1 + vst1.8 {d13}, [r0], r1 + vst1.8 {d15}, [r0] + + vpop {q4-q7} + bx lr +endfunc +.endm + +vp8_h_loop_filter16 +vp8_h_loop_filter16 _inner, inner=1 +vp8_h_loop_filter16 _simple, simple=1 + +.macro vp8_h_loop_filter8uv name, inner=0 +function ff_vp8_h_loop_filter8uv\name\()_neon, export=1 + vpush {q4-q7} + sub r0, r0, #4 + sub r1, r1, #4 + ldr r12, [sp, #64] @ flim_I + + @ Load pixels: + vld1.8 {d0}, [r0], r2 @ load u + vld1.8 {d1}, [r1], r2 @ load v + vld1.8 {d2}, [r0], r2 + vld1.8 {d3}, [r1], r2 + vld1.8 {d4}, [r0], r2 + vld1.8 {d5}, [r1], r2 + vld1.8 {d6}, [r0], r2 + vld1.8 {d7}, [r1], r2 + vld1.8 {d8}, [r0], r2 + vld1.8 {d9}, [r1], r2 + vld1.8 {d10}, [r0], r2 + vld1.8 {d11}, [r1], r2 + vld1.8 {d12}, [r0], r2 + vld1.8 {d13}, [r1], r2 + vld1.8 {d14}, [r0], r2 + vld1.8 {d15}, [r1], r2 + + transpose8x16matrix + + vdup.8 q14, r3 @ flim_E + vdup.8 q15, r12 @ flim_I + ldr r12, [sp, #68] @ hev_thresh + + vp8_loop_filter inner=\inner + + sub r0, r0, r2, lsl #3 @ backup u 8 rows + sub r1, r1, r2, lsl #3 @ backup v 8 rows + + transpose8x16matrix + + @ Store pixels: + vst1.8 {d0}, [r0], r2 + vst1.8 {d1}, [r1], r2 + vst1.8 {d2}, [r0], r2 + vst1.8 {d3}, [r1], r2 + vst1.8 {d4}, [r0], r2 + vst1.8 {d5}, [r1], r2 + vst1.8 {d6}, [r0], r2 + vst1.8 {d7}, [r1], r2 + vst1.8 {d8}, [r0], r2 + vst1.8 {d9}, [r1], r2 + vst1.8 {d10}, [r0], r2 + vst1.8 {d11}, [r1], r2 + vst1.8 {d12}, [r0], r2 + vst1.8 {d13}, [r1], r2 + vst1.8 {d14}, [r0] + vst1.8 {d15}, [r1] + + vpop {q4-q7} + bx lr +endfunc +.endm + +vp8_h_loop_filter8uv +vp8_h_loop_filter8uv _inner, inner=1 + +function ff_put_vp8_pixels16_neon, export=1 + ldr r12, [sp, #0] @ h +1: + subs r12, r12, #4 + vld1.8 {q0}, [r2], r3 + vld1.8 {q1}, [r2], r3 + vld1.8 {q2}, [r2], r3 + vld1.8 {q3}, [r2], r3 + vst1.8 {q0}, [r0,:128], r1 + vst1.8 {q1}, [r0,:128], r1 + vst1.8 {q2}, [r0,:128], r1 + vst1.8 {q3}, [r0,:128], r1 + bgt 1b + bx lr +endfunc + +function ff_put_vp8_pixels8_neon, export=1 + ldr r12, [sp, #0] @ h +1: + subs r12, r12, #4 + vld1.8 {d0}, [r2], r3 + vld1.8 {d1}, [r2], r3 + vld1.8 {d2}, [r2], r3 + vld1.8 {d3}, [r2], r3 + vst1.8 {d0}, [r0,:64], r1 + vst1.8 {d1}, [r0,:64], r1 + vst1.8 {d2}, [r0,:64], r1 + vst1.8 {d3}, [r0,:64], r1 + bgt 1b + bx lr +endfunc + +function ff_put_vp8_pixels4_neon, export=1 + ldr r12, [sp, #0] @ h + push {r4-r6,lr} +1: + subs r12, r12, #4 + ldr r4, [r2], r3 + ldr r5, [r2], r3 + ldr r6, [r2], r3 + ldr lr, [r2], r3 + str r4, [r0], r1 + str r5, [r0], r1 + str r6, [r0], r1 + str lr, [r0], r1 + bgt 1b + pop {r4-r6,pc} +endfunc + +/* 4/6-tap 8th-pel MC */ + +.macro vp8_epel8_h6 d, a, b + vext.8 d27, \a, \b, #1 + vmovl.u8 q8, \a + vext.8 d28, \a, \b, #2 + vmovl.u8 q9, d27 + vext.8 d29, \a, \b, #3 + vmovl.u8 q10, d28 + vext.8 d30, \a, \b, #4 + vmovl.u8 q11, d29 + vext.8 d31, \a, \b, #5 + vmovl.u8 q12, d30 + vmul.u16 q10, q10, d0[2] + vmovl.u8 q13, d31 + vmul.u16 q11, q11, d0[3] + vmls.u16 q10, q9, d0[1] + vmls.u16 q11, q12, d1[0] + vmla.u16 q10, q8, d0[0] + vmla.u16 q11, q13, d1[1] + vqadd.s16 q11, q10, q11 + vqrshrun.s16 \d, q11, #7 +.endm + +.macro vp8_epel16_h6 d0, d1, s0, s1, s2, q0, q1 + vext.8 q14, \q0, \q1, #3 + vext.8 q15, \q0, \q1, #4 + vmovl.u8 q11, d28 + vmovl.u8 q14, d29 + vext.8 q3, \q0, \q1, #2 + vmovl.u8 q12, d30 + vmovl.u8 q15, d31 + vext.8 q8, \q0, \q1, #1 + vmovl.u8 q10, d6 + vmovl.u8 q3, d7 + vext.8 q2, \q0, \q1, #5 + vmovl.u8 q13, d4 + vmovl.u8 q2, d5 + vmovl.u8 q9, d16 + vmovl.u8 q8, d17 + vmul.u16 q11, q11, d0[3] + vmul.u16 q10, q10, d0[2] + vmul.u16 q3, q3, d0[2] + vmul.u16 q14, q14, d0[3] + vmls.u16 q11, q12, d1[0] + vmovl.u8 q12, \s0 + vmovl.u8 q1, \s1 + vmls.u16 q10, q9, d0[1] + vmls.u16 q3, q8, d0[1] + vmls.u16 q14, q15, d1[0] + vmla.u16 q10, q12, d0[0] + vmla.u16 q11, q13, d1[1] + vmla.u16 q3, q1, d0[0] + vmla.u16 q14, q2, d1[1] + vqadd.s16 q11, q10, q11 + vqadd.s16 q14, q3, q14 + vqrshrun.s16 \d0, q11, #7 + vqrshrun.s16 \d1, q14, #7 +.endm + +.macro vp8_epel8_v6 d0, s0, s1, s2, s3, s4, s5 + vmovl.u8 q10, \s2 + vmovl.u8 q11, \s3 + vmovl.u8 q9, \s1 + vmovl.u8 q12, \s4 + vmovl.u8 q8, \s0 + vmovl.u8 q13, \s5 + vmul.u16 q10, q10, d0[2] + vmul.u16 q11, q11, d0[3] + vmls.u16 q10, q9, d0[1] + vmls.u16 q11, q12, d1[0] + vmla.u16 q10, q8, d0[0] + vmla.u16 q11, q13, d1[1] + vqadd.s16 q11, q10, q11 + vqrshrun.s16 \d0, q11, #7 +.endm + +.macro vp8_epel8_v6_y2 d0, d1, s0, s1, s2, s3, s4, s5, s6 + vmovl.u8 q10, \s0 + vmovl.u8 q11, \s3 + vmovl.u8 q14, \s6 + vmovl.u8 q9, \s1 + vmovl.u8 q12, \s4 + vmovl.u8 q8, \s2 + vmovl.u8 q13, \s5 + vmul.u16 q10, q10, d0[0] + vmul.u16 q15, q11, d0[3] + vmul.u16 q11, q11, d0[2] + vmul.u16 q14, q14, d1[1] + vmls.u16 q10, q9, d0[1] + vmls.u16 q15, q12, d1[0] + vmls.u16 q11, q8, d0[1] + vmls.u16 q14, q13, d1[0] + vmla.u16 q10, q8, d0[2] + vmla.u16 q15, q13, d1[1] + vmla.u16 q11, q9, d0[0] + vmla.u16 q14, q12, d0[3] + vqadd.s16 q15, q10, q15 + vqadd.s16 q14, q11, q14 + vqrshrun.s16 \d0, q15, #7 + vqrshrun.s16 \d1, q14, #7 +.endm + +.macro vp8_epel8_h4 d, a, b + vext.8 d28, \a, \b, #1 + vmovl.u8 q9, \a + vext.8 d29, \a, \b, #2 + vmovl.u8 q10, d28 + vext.8 d30, \a, \b, #3 + vmovl.u8 q11, d29 + vmovl.u8 q12, d30 + vmul.u16 q10, q10, d0[2] + vmul.u16 q11, q11, d0[3] + vmls.u16 q10, q9, d0[1] + vmls.u16 q11, q12, d1[0] + vqadd.s16 q11, q10, q11 + vqrshrun.s16 \d, q11, #7 +.endm + +.macro vp8_epel8_v4_y2 d0, d1, s0, s1, s2, s3, s4 + vmovl.u8 q9, \s0 + vmovl.u8 q10, \s1 + vmovl.u8 q11, \s2 + vmovl.u8 q12, \s3 + vmovl.u8 q13, \s4 + vmul.u16 q8, q10, d0[2] + vmul.u16 q14, q11, d0[3] + vmul.u16 q11, q11, d0[2] + vmul.u16 q15, q12, d0[3] + vmls.u16 q8, q9, d0[1] + vmls.u16 q14, q12, d1[0] + vmls.u16 q11, q10, d0[1] + vmls.u16 q15, q13, d1[0] + vqadd.s16 q8, q8, q14 + vqadd.s16 q11, q11, q15 + vqrshrun.s16 \d0, q8, #7 + vqrshrun.s16 \d1, q11, #7 +.endm + +function ff_put_vp8_epel16_v6_neon, export=1 + sub r2, r2, r3, lsl #1 + push {r4,lr} + vpush {d8-d15} + + ldr r4, [sp, #80] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #72] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {d2-d3}, [r2], r3 + vld1.8 {d4-d5}, [r2], r3 + vld1.8 {d6-d7}, [r2], r3 + vld1.8 {d8-d9}, [r2], r3 + vld1.8 {d10-d11},[r2], r3 + vld1.8 {d12-d13},[r2], r3 + vld1.8 {d14-d15},[r2] + sub r2, r2, r3, lsl #2 + + vp8_epel8_v6_y2 d2, d4, d2, d4, d6, d8, d10, d12, d14 + vp8_epel8_v6_y2 d3, d5, d3, d5, d7, d9, d11, d13, d15 + + vst1.8 {d2-d3}, [r0,:128], r1 + vst1.8 {d4-d5}, [r0,:128], r1 + subs r12, r12, #2 + bne 1b + + vpop {d8-d15} + pop {r4,pc} +endfunc + +function ff_put_vp8_epel16_h6_neon, export=1 + sub r2, r2, #2 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {d2-d4}, [r2], r3 + + vp8_epel16_h6 d2, d3, d2, d3, d4, q1, q2 + + vst1.8 {d2-d3}, [r0,:128], r1 + subs r12, r12, #1 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel16_h6v6_neon, export=1 + sub r2, r2, r3, lsl #1 + sub r2, r2, #2 + push {r4,lr} + vpush {d8-d9} + + @ first pass (horizontal): + ldr r4, [sp, #28] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #24] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #336+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #5 + bic lr, lr, #15 +1: + vld1.8 {d2,d3,d4}, [r2], r3 + + vp8_epel16_h6 d2, d3, d2, d3, d4, q1, q2 + + vst1.8 {d2-d3}, [lr,:128]! + subs r12, r12, #1 + bne 1b + + @ second pass (vertical): + ldr r4, [sp, #336+16+32] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #336+16+24] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d5}, [lr,:128]! + vld1.8 {d6-d9}, [lr,:128]! + vld1.8 {d28-d31},[lr,:128] + sub lr, lr, #48 + + vp8_epel8_v6 d2, d2, d4, d6, d8, d28, d30 + vp8_epel8_v6 d3, d3, d5, d7, d9, d29, d31 + + vst1.8 {d2-d3}, [r0,:128], r1 + subs r12, r12, #1 + bne 2b + + add sp, sp, #336+16 + vpop {d8-d9} + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_v6_neon, export=1 + sub r2, r2, r3, lsl #1 + push {r4,lr} + + ldr r4, [sp, #16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {d2}, [r2], r3 + vld1.8 {d3}, [r2], r3 + vld1.8 {d4}, [r2], r3 + vld1.8 {d5}, [r2], r3 + vld1.8 {d6}, [r2], r3 + vld1.8 {d7}, [r2], r3 + vld1.8 {d28}, [r2] + + sub r2, r2, r3, lsl #2 + + vp8_epel8_v6_y2 d2, d3, d2, d3, d4, d5, d6, d7, d28 + + vst1.8 {d2}, [r0,:64], r1 + vst1.8 {d3}, [r0,:64], r1 + subs r12, r12, #2 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_h6_neon, export=1 + sub r2, r2, #2 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {d2,d3}, [r2], r3 + + vp8_epel8_h6 d2, d2, d3 + + vst1.8 {d2}, [r0,:64], r1 + subs r12, r12, #1 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_h6v6_neon, export=1 + sub r2, r2, r3, lsl #1 + sub r2, r2, #2 + push {r4,lr} + + @ first pass (horizontal): + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #168+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #5 + bic lr, lr, #15 +1: + vld1.8 {d2,d3}, [r2], r3 + + vp8_epel8_h6 d2, d2, d3 + + vst1.8 {d2}, [lr,:64]! + subs r12, r12, #1 + bne 1b + + @ second pass (vertical): + ldr r4, [sp, #168+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #168+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d5}, [lr,:128]! + vld1.8 {d6-d7}, [lr,:128]! + vld1.8 {d30}, [lr,:64] + sub lr, lr, #32 + + vp8_epel8_v6_y2 d2, d3, d2, d3, d4, d5, d6, d7, d30 + + vst1.8 {d2}, [r0,:64], r1 + vst1.8 {d3}, [r0,:64], r1 + subs r12, r12, #2 + bne 2b + + add sp, sp, #168+16 + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_v4_neon, export=1 + sub r2, r2, r3 + push {r4,lr} + + ldr r4, [sp, #16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {d2}, [r2], r3 + vld1.8 {d3}, [r2], r3 + vld1.8 {d4}, [r2], r3 + vld1.8 {d5}, [r2], r3 + vld1.8 {d6}, [r2] + sub r2, r2, r3, lsl #1 + + vp8_epel8_v4_y2 d2, d3, d2, d3, d4, d5, d6 + + vst1.8 {d2}, [r0,:64], r1 + vst1.8 {d3}, [r0,:64], r1 + subs r12, r12, #2 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_h4_neon, export=1 + sub r2, r2, #1 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {d2,d3}, [r2], r3 + + vp8_epel8_h4 d2, d2, d3 + + vst1.8 {d2}, [r0,:64], r1 + subs r12, r12, #1 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_h4v4_neon, export=1 + sub r2, r2, r3 + sub r2, r2, #1 + push {r4,lr} + + @ first pass (horizontal): + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #168+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #3 + bic lr, lr, #15 +1: + vld1.8 {d2,d3}, [r2], r3 + + vp8_epel8_h4 d2, d2, d3 + + vst1.8 {d2}, [lr,:64]! + subs r12, r12, #1 + bne 1b + + @ second pass (vertical): + ldr r4, [sp, #168+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #168+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d5}, [lr,:128]! + vld1.8 {d6}, [lr,:64] + sub lr, lr, #16 + + vp8_epel8_v4_y2 d2, d3, d2, d3, d4, d5, d6 + + vst1.8 {d2}, [r0,:64], r1 + vst1.8 {d3}, [r0,:64], r1 + subs r12, r12, #2 + bne 2b + + add sp, sp, #168+16 + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_h6v4_neon, export=1 + sub r2, r2, r3 + sub r2, r2, #2 + push {r4,lr} + + @ first pass (horizontal): + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #168+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #3 + bic lr, lr, #15 +1: + vld1.8 {d2,d3}, [r2], r3 + + vp8_epel8_h6 d2, d2, d3 + + vst1.8 {d2}, [lr,:64]! + subs r12, r12, #1 + bne 1b + + @ second pass (vertical): + ldr r4, [sp, #168+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #168+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d5}, [lr,:128]! + vld1.8 {d6}, [lr,:64] + sub lr, lr, #16 + + vp8_epel8_v4_y2 d2, d3, d2, d3, d4, d5, d6 + + vst1.8 {d2}, [r0,:64], r1 + vst1.8 {d3}, [r0,:64], r1 + subs r12, r12, #2 + bne 2b + + add sp, sp, #168+16 + pop {r4,pc} +endfunc + +function ff_put_vp8_epel8_h4v6_neon, export=1 + sub r2, r2, r3, lsl #1 + sub r2, r2, #1 + push {r4,lr} + + @ first pass (horizontal): + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #168+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #5 + bic lr, lr, #15 +1: + vld1.8 {d2,d3}, [r2], r3 + + vp8_epel8_h4 d2, d2, d3 + + vst1.8 {d2}, [lr,:64]! + subs r12, r12, #1 + bne 1b + + @ second pass (vertical): + ldr r4, [sp, #168+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #168+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d5}, [lr,:128]! + vld1.8 {d6-d7}, [lr,:128]! + vld1.8 {d30}, [lr,:64] + sub lr, lr, #32 + + vp8_epel8_v6_y2 d2, d3, d2, d3, d4, d5, d6, d7, d30 + + vst1.8 {d2}, [r0,:64], r1 + vst1.8 {d3}, [r0,:64], r1 + subs r12, r12, #2 + bne 2b + + add sp, sp, #168+16 + pop {r4,pc} +endfunc + +.ltorg + +function ff_put_vp8_epel4_v6_neon, export=1 + sub r2, r2, r3, lsl #1 + push {r4,lr} + + ldr r4, [sp, #16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.32 {d2[]}, [r2], r3 + vld1.32 {d3[]}, [r2], r3 + vld1.32 {d4[]}, [r2], r3 + vld1.32 {d5[]}, [r2], r3 + vld1.32 {d6[]}, [r2], r3 + vld1.32 {d7[]}, [r2], r3 + vld1.32 {d28[]}, [r2] + sub r2, r2, r3, lsl #2 + vld1.32 {d2[1]}, [r2], r3 + vld1.32 {d3[1]}, [r2], r3 + vld1.32 {d4[1]}, [r2], r3 + vld1.32 {d5[1]}, [r2], r3 + vld1.32 {d6[1]}, [r2], r3 + vld1.32 {d7[1]}, [r2], r3 + vld1.32 {d28[1]}, [r2] + sub r2, r2, r3, lsl #2 + + vp8_epel8_v6_y2 d2, d3, d2, d3, d4, d5, d6, d7, d28 + + vst1.32 {d2[0]}, [r0,:32], r1 + vst1.32 {d3[0]}, [r0,:32], r1 + vst1.32 {d2[1]}, [r0,:32], r1 + vst1.32 {d3[1]}, [r0,:32], r1 + subs r12, r12, #4 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_h6_neon, export=1 + sub r2, r2, #2 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {q1}, [r2], r3 + vp8_epel8_h6 d2, d2, d3 + vst1.32 {d2[0]}, [r0,:32], r1 + subs r12, r12, #1 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_h6v6_neon, export=1 + sub r2, r2, r3, lsl #1 + sub r2, r2, #2 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #52+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #5 + bic lr, lr, #15 +1: + vld1.8 {q1}, [r2], r3 + vp8_epel8_h6 d2, d2, d3 + vst1.32 {d2[0]}, [lr,:32]! + subs r12, r12, #1 + bne 1b + + ldr r4, [sp, #52+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #52+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d3}, [lr,:128]! + vld1.8 {d6}, [lr,:64]! + vld1.32 {d28[]}, [lr,:32] + sub lr, lr, #16 + vld1.8 {d4-d5}, [lr]! + vld1.8 {d7}, [lr,:64]! + vld1.32 {d28[1]}, [lr,:32] + sub lr, lr, #16 + vtrn.32 q1, q2 + vtrn.32 d6, d7 + vp8_epel8_v6_y2 d2, d3, d2, d4, d3, d5, d6, d7, d28 + vst1.32 {d2[0]}, [r0,:32], r1 + vst1.32 {d3[0]}, [r0,:32], r1 + vst1.32 {d2[1]}, [r0,:32], r1 + vst1.32 {d3[1]}, [r0,:32], r1 + subs r12, r12, #4 + bne 2b + + add sp, sp, #52+16 + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_h4v6_neon, export=1 + sub r2, r2, r3, lsl #1 + sub r2, r2, #1 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #52+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #5 + bic lr, lr, #15 +1: + vld1.8 {d2}, [r2], r3 + vp8_epel8_h4 d2, d2, d2 + vst1.32 {d2[0]}, [lr,:32]! + subs r12, r12, #1 + bne 1b + + ldr r4, [sp, #52+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #52+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d3}, [lr,:128]! + vld1.8 {d6}, [lr,:64]! + vld1.32 {d28[]}, [lr,:32] + sub lr, lr, #16 + vld1.8 {d4-d5}, [lr]! + vld1.8 {d7}, [lr,:64]! + vld1.32 {d28[1]}, [lr,:32] + sub lr, lr, #16 + vtrn.32 q1, q2 + vtrn.32 d6, d7 + vp8_epel8_v6_y2 d2, d3, d2, d4, d3, d5, d6, d7, d28 + vst1.32 {d2[0]}, [r0,:32], r1 + vst1.32 {d3[0]}, [r0,:32], r1 + vst1.32 {d2[1]}, [r0,:32], r1 + vst1.32 {d3[1]}, [r0,:32], r1 + subs r12, r12, #4 + bne 2b + + add sp, sp, #52+16 + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_h6v4_neon, export=1 + sub r2, r2, r3 + sub r2, r2, #2 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #44+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #3 + bic lr, lr, #15 +1: + vld1.8 {q1}, [r2], r3 + vp8_epel8_h6 d2, d2, d3 + vst1.32 {d2[0]}, [lr,:32]! + subs r12, r12, #1 + bne 1b + + ldr r4, [sp, #44+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #44+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d3}, [lr,:128]! + vld1.32 {d6[]}, [lr,:32] + sub lr, lr, #8 + vld1.8 {d4-d5}, [lr]! + vld1.32 {d6[1]}, [lr,:32] + sub lr, lr, #8 + vtrn.32 q1, q2 + vp8_epel8_v4_y2 d2, d3, d2, d4, d3, d5, d6 + vst1.32 {d2[0]}, [r0,:32], r1 + vst1.32 {d3[0]}, [r0,:32], r1 + vst1.32 {d2[1]}, [r0,:32], r1 + vst1.32 {d3[1]}, [r0,:32], r1 + subs r12, r12, #4 + bne 2b + + add sp, sp, #44+16 + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_h4_neon, export=1 + sub r2, r2, #1 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.8 {d2}, [r2], r3 + vp8_epel8_h4 d2, d2, d2 + vst1.32 {d2[0]}, [r0,:32], r1 + subs r12, r12, #1 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_v4_neon, export=1 + sub r2, r2, r3 + push {r4,lr} + + ldr r4, [sp, #16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + vld1.16 {q0}, [r4,:128] +1: + vld1.32 {d2[]}, [r2], r3 + vld1.32 {d3[]}, [r2], r3 + vld1.32 {d4[]}, [r2], r3 + vld1.32 {d5[]}, [r2], r3 + vld1.32 {d6[]}, [r2] + sub r2, r2, r3, lsl #1 + vld1.32 {d2[1]}, [r2], r3 + vld1.32 {d3[1]}, [r2], r3 + vld1.32 {d4[1]}, [r2], r3 + vld1.32 {d5[1]}, [r2], r3 + vld1.32 {d6[1]}, [r2] + sub r2, r2, r3, lsl #1 + + vp8_epel8_v4_y2 d2, d3, d2, d3, d4, d5, d6 + + vst1.32 {d2[0]}, [r0,:32], r1 + vst1.32 {d3[0]}, [r0,:32], r1 + vst1.32 {d2[1]}, [r0,:32], r1 + vst1.32 {d3[1]}, [r0,:32], r1 + subs r12, r12, #4 + bne 1b + + pop {r4,pc} +endfunc + +function ff_put_vp8_epel4_h4v4_neon, export=1 + sub r2, r2, r3 + sub r2, r2, #1 + push {r4,lr} + + ldr r4, [sp, #12] @ mx + movrel lr, subpel_filters-16 + ldr r12, [sp, #8] @ h + add r4, lr, r4, lsl #4 + sub sp, sp, #44+16 + vld1.16 {q0}, [r4,:128] + add lr, sp, #15 + add r12, r12, #3 + bic lr, lr, #15 +1: + vld1.8 {d2}, [r2], r3 + vp8_epel8_h4 d2, d2, d3 + vst1.32 {d2[0]}, [lr,:32]! + subs r12, r12, #1 + bne 1b + + ldr r4, [sp, #44+16+16] @ my + movrel lr, subpel_filters-16 + ldr r12, [sp, #44+16+8] @ h + add r4, lr, r4, lsl #4 + add lr, sp, #15 + vld1.16 {q0}, [r4,:128] + bic lr, lr, #15 +2: + vld1.8 {d2-d3}, [lr,:128]! + vld1.32 {d6[]}, [lr,:32] + sub lr, lr, #8 + vld1.8 {d4-d5}, [lr]! + vld1.32 {d6[1]}, [lr,:32] + sub lr, lr, #8 + vtrn.32 q1, q2 + vp8_epel8_v4_y2 d2, d3, d2, d4, d3, d5, d6 + vst1.32 {d2[0]}, [r0,:32], r1 + vst1.32 {d3[0]}, [r0,:32], r1 + vst1.32 {d2[1]}, [r0,:32], r1 + vst1.32 {d3[1]}, [r0,:32], r1 + subs r12, r12, #4 + bne 2b + + add sp, sp, #44+16 + pop {r4,pc} +endfunc + +@ note: worst case sum of all 6-tap filter values * 255 is 0x7f80 so 16 bit +@ arithmatic can be used to apply filters +const subpel_filters, align=4 + .short 0, 6, 123, 12, 1, 0, 0, 0 + .short 2, 11, 108, 36, 8, 1, 0, 0 + .short 0, 9, 93, 50, 6, 0, 0, 0 + .short 3, 16, 77, 77, 16, 3, 0, 0 + .short 0, 6, 50, 93, 9, 0, 0, 0 + .short 1, 8, 36, 108, 11, 2, 0, 0 + .short 0, 1, 12, 123, 6, 0, 0, 0 +endconst + +/* Bilinear MC */ + +function ff_put_vp8_bilin16_h_neon, export=1 + ldr r3, [sp, #4] @ mx + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r12, [sp] @ h +1: + subs r12, r12, #2 + vld1.8 {d2-d4}, [r2], r1 + vext.8 q2, q1, q2, #1 + vmull.u8 q8, d2, d1 + vmlal.u8 q8, d4, d0 + vld1.8 {d18-d20},[r2], r1 + vmull.u8 q3, d3, d1 + vmlal.u8 q3, d5, d0 + vext.8 q10, q9, q10, #1 + vmull.u8 q11, d18, d1 + vmlal.u8 q11, d20, d0 + vmull.u8 q12, d19, d1 + vmlal.u8 q12, d21, d0 + vrshrn.u16 d4, q8, #3 + vrshrn.u16 d5, q3, #3 + vrshrn.u16 d6, q11, #3 + vrshrn.u16 d7, q12, #3 + vst1.8 {q2}, [r0,:128], r1 + vst1.8 {q3}, [r0,:128], r1 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin16_v_neon, export=1 + ldr r3, [sp, #8] @ my + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r12, [sp] @ h + vld1.8 {q1}, [r2], r1 +1: + subs r12, r12, #2 + vld1.8 {q2}, [r2], r1 + vmull.u8 q3, d2, d1 + vmlal.u8 q3, d4, d0 + vmull.u8 q8, d3, d1 + vmlal.u8 q8, d5, d0 + vld1.8 {q1}, [r2], r1 + vmull.u8 q9, d4, d1 + vmlal.u8 q9, d2, d0 + vmull.u8 q10, d5, d1 + vmlal.u8 q10, d3, d0 + vrshrn.u16 d4, q3, #3 + vrshrn.u16 d5, q8, #3 + vrshrn.u16 d6, q9, #3 + vrshrn.u16 d7, q10, #3 + vst1.8 {q2}, [r0,:128], r1 + vst1.8 {q3}, [r0,:128], r1 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin16_hv_neon, export=1 + ldr r3, [sp, #4] @ mx + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r3, [sp, #8] @ my + rsb r12, r3, #8 + vdup.8 d2, r3 + vdup.8 d3, r12 + ldr r12, [sp] @ h + + vld1.8 {d4-d6}, [r2], r1 + vext.8 q3, q2, q3, #1 + vmull.u8 q8, d4, d1 + vmlal.u8 q8, d6, d0 + vmull.u8 q9, d5, d1 + vmlal.u8 q9, d7, d0 + vrshrn.u16 d4, q8, #3 + vrshrn.u16 d5, q9, #3 +1: + subs r12, r12, #2 + vld1.8 {d18-d20},[r2], r1 + vext.8 q10, q9, q10, #1 + vmull.u8 q11, d18, d1 + vmlal.u8 q11, d20, d0 + vld1.8 {d26-d28},[r2], r1 + vmull.u8 q12, d19, d1 + vmlal.u8 q12, d21, d0 + vext.8 q14, q13, q14, #1 + vmull.u8 q8, d26, d1 + vmlal.u8 q8, d28, d0 + vmull.u8 q9, d27, d1 + vmlal.u8 q9, d29, d0 + vrshrn.u16 d6, q11, #3 + vrshrn.u16 d7, q12, #3 + vmull.u8 q12, d4, d3 + vmlal.u8 q12, d6, d2 + vmull.u8 q15, d5, d3 + vmlal.u8 q15, d7, d2 + vrshrn.u16 d4, q8, #3 + vrshrn.u16 d5, q9, #3 + vmull.u8 q10, d6, d3 + vmlal.u8 q10, d4, d2 + vmull.u8 q11, d7, d3 + vmlal.u8 q11, d5, d2 + vrshrn.u16 d24, q12, #3 + vrshrn.u16 d25, q15, #3 + vst1.8 {q12}, [r0,:128], r1 + vrshrn.u16 d20, q10, #3 + vrshrn.u16 d21, q11, #3 + vst1.8 {q10}, [r0,:128], r1 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin8_h_neon, export=1 + ldr r3, [sp, #4] @ mx + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r12, [sp] @ h +1: + subs r12, r12, #2 + vld1.8 {q1}, [r2], r1 + vext.8 d3, d2, d3, #1 + vmull.u8 q2, d2, d1 + vmlal.u8 q2, d3, d0 + vld1.8 {q3}, [r2], r1 + vext.8 d7, d6, d7, #1 + vmull.u8 q8, d6, d1 + vmlal.u8 q8, d7, d0 + vrshrn.u16 d4, q2, #3 + vrshrn.u16 d16, q8, #3 + vst1.8 {d4}, [r0,:64], r1 + vst1.8 {d16}, [r0,:64], r1 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin8_v_neon, export=1 + ldr r3, [sp, #8] @ my + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r12, [sp] @ h + vld1.8 {d2}, [r2], r1 +1: + subs r12, r12, #2 + vld1.8 {d3}, [r2], r1 + vmull.u8 q2, d2, d1 + vmlal.u8 q2, d3, d0 + vld1.8 {d2}, [r2], r1 + vmull.u8 q3, d3, d1 + vmlal.u8 q3, d2, d0 + vrshrn.u16 d4, q2, #3 + vrshrn.u16 d6, q3, #3 + vst1.8 {d4}, [r0,:64], r1 + vst1.8 {d6}, [r0,:64], r1 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin8_hv_neon, export=1 + ldr r3, [sp, #4] @ mx + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r3, [sp, #8] @ my + rsb r12, r3, #8 + vdup.8 d2, r3 + vdup.8 d3, r12 + ldr r12, [sp] @ h + + vld1.8 {q2}, [r2], r1 + vext.8 d5, d4, d5, #1 + vmull.u8 q9, d4, d1 + vmlal.u8 q9, d5, d0 + vrshrn.u16 d22, q9, #3 +1: + subs r12, r12, #2 + vld1.8 {q3}, [r2], r1 + vext.8 d7, d6, d7, #1 + vmull.u8 q8, d6, d1 + vmlal.u8 q8, d7, d0 + vld1.8 {q2}, [r2], r1 + vext.8 d5, d4, d5, #1 + vmull.u8 q9, d4, d1 + vmlal.u8 q9, d5, d0 + vrshrn.u16 d16, q8, #3 + vmull.u8 q10, d22, d3 + vmlal.u8 q10, d16, d2 + vrshrn.u16 d22, q9, #3 + vmull.u8 q12, d16, d3 + vmlal.u8 q12, d22, d2 + vrshrn.u16 d20, q10, #3 + vst1.8 {d20}, [r0,:64], r1 + vrshrn.u16 d23, q12, #3 + vst1.8 {d23}, [r0,:64], r1 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin4_h_neon, export=1 + ldr r3, [sp, #4] @ mx + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r12, [sp] @ h +1: + subs r12, r12, #2 + vld1.8 {d2}, [r2], r1 + vext.8 d3, d2, d3, #1 + vld1.8 {d6}, [r2], r1 + vext.8 d7, d6, d7, #1 + vtrn.32 q1, q3 + vmull.u8 q2, d2, d1 + vmlal.u8 q2, d3, d0 + vrshrn.u16 d4, q2, #3 + vst1.32 {d4[0]}, [r0,:32], r1 + vst1.32 {d4[1]}, [r0,:32], r1 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin4_v_neon, export=1 + ldr r3, [sp, #8] @ my + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r12, [sp] @ h + vld1.32 {d2[]}, [r2], r1 +1: + vld1.32 {d3[]}, [r2] + vld1.32 {d2[1]}, [r2], r1 + vld1.32 {d3[1]}, [r2], r1 + vmull.u8 q2, d2, d1 + vmlal.u8 q2, d3, d0 + vtrn.32 d3, d2 + vrshrn.u16 d4, q2, #3 + vst1.32 {d4[0]}, [r0,:32], r1 + vst1.32 {d4[1]}, [r0,:32], r1 + subs r12, r12, #2 + bgt 1b + + bx lr +endfunc + +function ff_put_vp8_bilin4_hv_neon, export=1 + ldr r3, [sp, #4] @ mx + rsb r12, r3, #8 + vdup.8 d0, r3 + vdup.8 d1, r12 + ldr r3, [sp, #8] @ my + rsb r12, r3, #8 + vdup.8 d2, r3 + vdup.8 d3, r12 + ldr r12, [sp] @ h + + vld1.8 {d4}, [r2], r1 + vext.8 d5, d4, d4, #1 + vmull.u8 q9, d4, d1 + vmlal.u8 q9, d5, d0 + vrshrn.u16 d22, q9, #3 +1: + subs r12, r12, #2 + vld1.8 {d6}, [r2], r1 + vext.8 d7, d6, d6, #1 + vld1.8 {d4}, [r2], r1 + vext.8 d5, d4, d4, #1 + vtrn.32 q3, q2 + vmull.u8 q8, d6, d1 + vmlal.u8 q8, d7, d0 + vrshrn.u16 d16, q8, #3 + vmull.u8 q10, d16, d2 + vtrn.32 d22, d16 + vmlal.u8 q10, d22, d3 + vrev64.32 d22, d16 + vrshrn.u16 d20, q10, #3 + vst1.32 {d20[0]}, [r0,:32], r1 + vst1.32 {d20[1]}, [r0,:32], r1 + bgt 1b + + bx lr +endfunc diff --git a/mplayer/ffmpeg/libavcodec/atrac1.c b/mplayer/ffmpeg/libavcodec/atrac1.c index 4de1dcea..be78445b 100644 --- a/mplayer/ffmpeg/libavcodec/atrac1.c +++ b/mplayer/ffmpeg/libavcodec/atrac1.c @@ -141,7 +141,7 @@ static int at1_imdct_block(AT1SUCtx* su, AT1Ctx *q) /* overlap and window */ q->dsp.vector_fmul_window(&q->bands[band_num][start_pos], prev_buf, - &su->spectrum[0][ref_pos + start_pos], ff_sine_32, 0, 16); + &su->spectrum[0][ref_pos + start_pos], ff_sine_32, 16); prev_buf = &su->spectrum[0][ref_pos+start_pos + 16]; start_pos += block_size; diff --git a/mplayer/ffmpeg/libavcodec/audioconvert.c b/mplayer/ffmpeg/libavcodec/audioconvert.c index b29b0306..67cacbdc 100644 --- a/mplayer/ffmpeg/libavcodec/audioconvert.c +++ b/mplayer/ffmpeg/libavcodec/audioconvert.c @@ -27,7 +27,7 @@ #include "libavutil/avstring.h" #include "libavutil/libm.h" -#include "libavcore/samplefmt.h" +#include "libavutil/samplefmt.h" #include "avcodec.h" #include "audioconvert.h" diff --git a/mplayer/ffmpeg/libavcodec/audioconvert.h b/mplayer/ffmpeg/libavcodec/audioconvert.h index be4867c2..5f38cca5 100644 --- a/mplayer/ffmpeg/libavcodec/audioconvert.h +++ b/mplayer/ffmpeg/libavcodec/audioconvert.h @@ -31,6 +31,7 @@ #include "libavutil/cpu.h" #include "avcodec.h" +#include "libavutil/audioconvert.h" #if FF_API_OLD_SAMPLE_FMT /** diff --git a/mplayer/ffmpeg/libavcodec/avcodec.h b/mplayer/ffmpeg/libavcodec/avcodec.h index 601f8ed6..3eedcf94 100644 --- a/mplayer/ffmpeg/libavcodec/avcodec.h +++ b/mplayer/ffmpeg/libavcodec/avcodec.h @@ -27,13 +27,13 @@ */ #include -#include "libavcore/samplefmt.h" +#include "libavutil/samplefmt.h" #include "libavutil/avutil.h" #include "libavutil/cpu.h" #define LIBAVCODEC_VERSION_MAJOR 52 -#define LIBAVCODEC_VERSION_MINOR 108 -#define LIBAVCODEC_VERSION_MICRO 0 +#define LIBAVCODEC_VERSION_MINOR 113 +#define LIBAVCODEC_VERSION_MICRO 2 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ @@ -260,6 +260,7 @@ enum CodecID { CODEC_ID_R10K, CODEC_ID_MXPEG, CODEC_ID_LAGARITH, + CODEC_ID_PRORES, /* various PCM "codecs" */ CODEC_ID_PCM_S16LE= 0x10000, @@ -388,6 +389,7 @@ enum CodecID { CODEC_ID_BINKAUDIO_RDFT, CODEC_ID_BINKAUDIO_DCT, CODEC_ID_AAC_LATM, + CODEC_ID_QDMC, /* subtitle codecs */ CODEC_ID_DVD_SUBTITLE= 0x17000, @@ -435,7 +437,7 @@ enum CodecID { #endif #if FF_API_OLD_AUDIOCONVERT -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" /* Audio channel masks */ #define CH_FRONT_LEFT AV_CH_FRONT_LEFT @@ -726,6 +728,10 @@ typedef struct RcOverride{ * Codec is able to deal with negative linesizes */ #define CODEC_CAP_NEG_LINESIZES 0x0800 +/** + * Codec supports frame-level multithreading. + */ +#define CODEC_CAP_FRAME_THREADS 0x1000 //The following defines may change, don't expect compatibility if you use them. #define MB_TYPE_INTRA4x4 0x0001 @@ -1025,7 +1031,20 @@ typedef struct AVPanScan{ * - decoding: Read by user.\ */\ int64_t pkt_dts;\ - +\ + /**\ + * the AVCodecContext which ff_thread_get_buffer() was last called on\ + * - encoding: Set by libavcodec.\ + * - decoding: Set by libavcodec.\ + */\ + struct AVCodecContext *owner;\ +\ + /**\ + * used by multithreading to store frame-specific info\ + * - encoding: Set by libavcodec.\ + * - decoding: Set by libavcodec.\ + */\ + void *thread_opaque;\ #define FF_QSCALE_TYPE_MPEG1 0 #define FF_QSCALE_TYPE_MPEG2 1 @@ -1237,6 +1256,10 @@ typedef struct AVCodecContext { * decoder to draw a horizontal band. It improves cache usage. Not * all codecs can do that. You must check the codec capabilities * beforehand. + * When multithreading is used, it may be called from multiple threads + * at the same time; threads might draw different parts of the same AVFrame, + * or multiple AVFrames, and there is no guarantee that slices will be drawn + * in order. * The function is also used by hardware acceleration APIs. * It is called at least once during frame decoding to pass * the data needed for hardware render. @@ -1490,6 +1513,9 @@ typedef struct AVCodecContext { * if CODEC_CAP_DR1 is not set then get_buffer() must call * avcodec_default_get_buffer() instead of providing buffers allocated by * some other means. + * If frame multithreading is used and thread_safe_callbacks is set, + * it may be called from a different thread, but not from more than one at once. + * Does not need to be reentrant. * - encoding: unused * - decoding: Set by libavcodec, user can override. */ @@ -1499,6 +1525,8 @@ typedef struct AVCodecContext { * Called to release buffers which were allocated with get_buffer. * A released buffer can be reused in get_buffer(). * pic.data[*] must be set to NULL. + * May be called from a different thread if frame multithreading is used, + * but not by more than one thread at once, so does not need to be reentrant. * - encoding: unused * - decoding: Set by libavcodec, user can override. */ @@ -1802,6 +1830,7 @@ typedef struct AVCodecContext { #define FF_DEBUG_VIS_QP 0x00002000 #define FF_DEBUG_VIS_MB_TYPE 0x00004000 #define FF_DEBUG_BUFFERS 0x00008000 +#define FF_DEBUG_THREADS 0x00010000 /** * debug @@ -2260,14 +2289,22 @@ typedef struct AVCodecContext { #define FF_PROFILE_DTS_HD_HRA 50 #define FF_PROFILE_DTS_HD_MA 60 -#define FF_PROFILE_H264_BASELINE 66 -#define FF_PROFILE_H264_MAIN 77 -#define FF_PROFILE_H264_EXTENDED 88 -#define FF_PROFILE_H264_HIGH 100 -#define FF_PROFILE_H264_HIGH_10 110 -#define FF_PROFILE_H264_HIGH_422 122 -#define FF_PROFILE_H264_HIGH_444 244 -#define FF_PROFILE_H264_CAVLC_444 44 +#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag +#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag + +#define FF_PROFILE_H264_BASELINE 66 +#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED) +#define FF_PROFILE_H264_MAIN 77 +#define FF_PROFILE_H264_EXTENDED 88 +#define FF_PROFILE_H264_HIGH 100 +#define FF_PROFILE_H264_HIGH_10 110 +#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_HIGH_422 122 +#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_HIGH_444 144 +#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 +#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_CAVLC_444 44 /** * level @@ -2817,6 +2854,52 @@ typedef struct AVCodecContext { * - encoding: unused */ AVPacket *pkt; + + /** + * Whether this is a copy of the context which had init() called on it. + * This is used by multithreading - shared tables and picture pointers + * should be freed from the original context only. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int is_copy; + + /** + * Which multithreading methods to use. + * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread, + * so clients which cannot provide future frames should not use it. + * + * - encoding: Set by user, otherwise the default is used. + * - decoding: Set by user, otherwise the default is used. + */ + int thread_type; +#define FF_THREAD_FRAME 1 //< Decode more than one frame at once +#define FF_THREAD_SLICE 2 //< Decode more than one part of a single frame at once + + /** + * Which multithreading methods are in use by the codec. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int active_thread_type; + + /** + * Set by the client if its custom get_buffer() callback can be called + * from another thread, which allows faster multithreaded decoding. + * draw_horiz_band() will be called from other threads regardless of this setting. + * Ignored if the default get_buffer() is used. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int thread_safe_callbacks; + + /** + * VBV delay coded in the last frame (in periods of a 27 MHz clock). + * Used for compliant TS muxing. + * - encoding: Set by libavcodec. + * - decoding: unused. + */ + uint64_t vbv_delay; } AVCodecContext; /** @@ -2869,6 +2952,26 @@ typedef struct AVCodec { uint8_t max_lowres; ///< maximum value for lowres supported by the decoder AVClass *priv_class; ///< AVClass for the private context const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} + + /** + * @defgroup framethreading Frame-level threading support functions. + * @{ + */ + /** + * If defined, called on thread contexts when they are created. + * If the codec allocates writable tables in init(), re-allocate them here. + * priv_data will be set to a copy of the original. + */ + int (*init_thread_copy)(AVCodecContext *); + /** + * Copy necessary context variables from a previous thread context to the current one. + * If not defined, the next thread will start automatically; otherwise, the codec + * must call ff_thread_finish_setup(). + * + * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. + */ + int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src); + /** @} */ } AVCodec; /** @@ -3119,8 +3222,9 @@ typedef struct ReSampleContext ReSampleContext; attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, int input_channels, int output_rate, int input_rate); #endif + /** - * Initialize audio resampling context + * Initialize audio resampling context. * * @param output_channels number of output channels * @param input_channels number of input channels @@ -3128,9 +3232,9 @@ attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, i * @param input_rate input sample rate * @param sample_fmt_out requested output sample format * @param sample_fmt_in input sample format - * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq + * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency * @param log2_phase_count log2 of the number of entries in the polyphase filterbank - * @param linear If 1 then the used FIR filter will be linearly interpolated + * @param linear if 1 then the used FIR filter will be linearly interpolated between the 2 closest, if 0 the closest will be used * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate * @return allocated ReSampleContext, NULL if error occured @@ -3143,6 +3247,13 @@ ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, int linear, double cutoff); int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); + +/** + * Free resample context. + * + * @param s a non-NULL pointer to a resample context previously + * created with av_audio_resample_init() + */ void audio_resample_close(ReSampleContext *s); @@ -3542,8 +3653,14 @@ int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h); enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt); +#if LIBAVCODEC_VERSION_MAJOR < 53 +/** + * @deprecated Set s->thread_count before calling avcodec_open() instead of calling this. + */ +attribute_deprecated int avcodec_thread_init(AVCodecContext *s, int thread_count); void avcodec_thread_free(AVCodecContext *s); +#endif int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); //FIXME func typedef diff --git a/mplayer/ffmpeg/libavcodec/bink.c b/mplayer/ffmpeg/libavcodec/bink.c index 64a10b71..d1985edd 100644 --- a/mplayer/ffmpeg/libavcodec/bink.c +++ b/mplayer/ffmpeg/libavcodec/bink.c @@ -1,6 +1,7 @@ /* * Bink video decoder * Copyright (c) 2009 Konstantin Shishkov + * Copyright (C) 2011 Peter Ross * * This file is part of FFmpeg. * @@ -19,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "binkdata.h" @@ -33,6 +34,35 @@ static VLC bink_trees[16]; +/** + * IDs for different data types used in old version of Bink video codec + */ +enum OldSources { + BINKB_SRC_BLOCK_TYPES = 0, ///< 8x8 block types + BINKB_SRC_COLORS, ///< pixel values used for different block types + BINKB_SRC_PATTERN, ///< 8-bit values for 2-colour pattern fill + BINKB_SRC_X_OFF, ///< X components of motion value + BINKB_SRC_Y_OFF, ///< Y components of motion value + BINKB_SRC_INTRA_DC, ///< DC values for intrablocks with DCT + BINKB_SRC_INTER_DC, ///< DC values for interblocks with DCT + BINKB_SRC_INTRA_Q, ///< quantizer values for intrablocks with DCT + BINKB_SRC_INTER_Q, ///< quantizer values for interblocks with DCT + BINKB_SRC_INTER_COEFS, ///< number of coefficients for residue blocks + + BINKB_NB_SRC +}; + +static const int binkb_bundle_sizes[BINKB_NB_SRC] = { + 4, 8, 8, 5, 5, 11, 11, 4, 4, 7 +}; + +static const int binkb_bundle_signed[BINKB_NB_SRC] = { + 0, 0, 0, 1, 1, 0, 1, 0, 0, 0 +}; + +static uint32_t binkb_intra_quant[16][64]; +static uint32_t binkb_inter_quant[16][64]; + /** * IDs for different data types used in Bink video codec */ @@ -85,7 +115,7 @@ typedef struct BinkContext { int swap_planes; ScanTable scantable; ///< permutated scantable for DCT coeffs decoding - Bundle bundle[BINK_NB_SRC]; ///< bundles for decoding all data types + Bundle bundle[BINKB_NB_SRC]; ///< bundles for decoding all data types Tree col_high[16]; ///< trees for decoding high nibble in "colours" data type int col_lastval; ///< value of last decoded high nibble in "colours" data type } BinkContext; @@ -145,7 +175,7 @@ static av_cold void init_bundles(BinkContext *c) bh = (c->avctx->height + 7) >> 3; blocks = bw * bh; - for (i = 0; i < BINK_NB_SRC; i++) { + for (i = 0; i < BINKB_NB_SRC; i++) { c->bundle[i].data = av_malloc(blocks * 64); c->bundle[i].data_end = c->bundle[i].data + blocks * 64; } @@ -159,7 +189,7 @@ static av_cold void init_bundles(BinkContext *c) static av_cold void free_bundles(BinkContext *c) { int i; - for (i = 0; i < BINK_NB_SRC; i++) + for (i = 0; i < BINKB_NB_SRC; i++) av_freep(&c->bundle[i].data); } @@ -470,7 +500,7 @@ static int read_dcs(AVCodecContext *avctx, GetBitContext *gb, Bundle *b, */ static inline int get_value(BinkContext *c, int bundle) { - int16_t ret; + int ret; if (bundle < BINK_SRC_X_OFF || bundle == BINK_SRC_RUN) return *c->bundle[bundle].cur_ptr++; @@ -481,17 +511,77 @@ static inline int get_value(BinkContext *c, int bundle) return ret; } +static void binkb_init_bundle(BinkContext *c, int bundle_num) +{ + c->bundle[bundle_num].cur_dec = + c->bundle[bundle_num].cur_ptr = c->bundle[bundle_num].data; + c->bundle[bundle_num].len = 13; +} + +static void binkb_init_bundles(BinkContext *c) +{ + int i; + for (i = 0; i < BINKB_NB_SRC; i++) + binkb_init_bundle(c, i); +} + +static int binkb_read_bundle(BinkContext *c, GetBitContext *gb, int bundle_num) +{ + const int bits = binkb_bundle_sizes[bundle_num]; + const int mask = 1 << (bits - 1); + const int issigned = binkb_bundle_signed[bundle_num]; + Bundle *b = &c->bundle[bundle_num]; + int i, len; + + CHECK_READ_VAL(gb, b, len); + if (bits <= 8) { + if (!issigned) { + for (i = 0; i < len; i++) + *b->cur_dec++ = get_bits(gb, bits); + } else { + for (i = 0; i < len; i++) + *b->cur_dec++ = get_bits(gb, bits) - mask; + } + } else { + int16_t *dst = (int16_t*)b->cur_dec; + + if (!issigned) { + for (i = 0; i < len; i++) + *dst++ = get_bits(gb, bits); + } else { + for (i = 0; i < len; i++) + *dst++ = get_bits(gb, bits) - mask; + } + b->cur_dec = (uint8_t*)dst; + } + return 0; +} + +static inline int binkb_get_value(BinkContext *c, int bundle_num) +{ + int16_t ret; + const int bits = binkb_bundle_sizes[bundle_num]; + + if (bits <= 8) { + int val = *c->bundle[bundle_num].cur_ptr++; + return binkb_bundle_signed[bundle_num] ? (int8_t)val : val; + } + ret = *(int16_t*)c->bundle[bundle_num].cur_ptr; + c->bundle[bundle_num].cur_ptr += 2; + return ret; +} + /** * Read 8x8 block of DCT coefficients. * * @param gb context for reading bits * @param block place for storing coefficients * @param scan scan order table - * @param is_intra tells what set of quantizer matrices to use + * @param quant_matrices quantization matrices * @return 0 for success, negative value in other cases */ static int read_dct_coeffs(GetBitContext *gb, DCTELEM block[64], const uint8_t *scan, - int is_intra) + const uint32_t quant_matrices[16][64], int q) { int coef_list[128]; int mode_list[128]; @@ -571,9 +661,14 @@ static int read_dct_coeffs(GetBitContext *gb, DCTELEM block[64], const uint8_t * } } - quant_idx = get_bits(gb, 4); - quant = is_intra ? bink_intra_quant[quant_idx] - : bink_inter_quant[quant_idx]; + if (q == -1) { + quant_idx = get_bits(gb, 4); + } else { + quant_idx = q; + } + + quant = quant_matrices[quant_idx]; + block[0] = (block[0] * quant[0]) >> 11; for (i = 0; i < coef_count; i++) { int idx = coef_idx[i]; @@ -673,6 +768,164 @@ static int read_residue(GetBitContext *gb, DCTELEM block[64], int masks_count) return 0; } +/** + * Copy 8x8 block from source to destination, where src and dst may be overlapped + */ +static inline void put_pixels8x8_overlapped(uint8_t *dst, uint8_t *src, int stride) +{ + uint8_t tmp[64]; + int i; + for (i = 0; i < 8; i++) + memcpy(tmp + i*8, src + i*stride, 8); + for (i = 0; i < 8; i++) + memcpy(dst + i*stride, tmp + i*8, 8); +} + +static int binkb_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, + int is_key, int is_chroma) +{ + int blk; + int i, j, bx, by; + uint8_t *dst, *ref, *ref_start, *ref_end; + int v, col[2]; + const uint8_t *scan; + int xoff, yoff; + LOCAL_ALIGNED_16(DCTELEM, block, [64]); + int coordmap[64]; + int ybias = is_key ? -15 : 0; + int qp; + + const int stride = c->pic.linesize[plane_idx]; + int bw = is_chroma ? (c->avctx->width + 15) >> 4 : (c->avctx->width + 7) >> 3; + int bh = is_chroma ? (c->avctx->height + 15) >> 4 : (c->avctx->height + 7) >> 3; + + binkb_init_bundles(c); + ref_start = c->pic.data[plane_idx]; + ref_end = c->pic.data[plane_idx] + (bh * c->pic.linesize[plane_idx] + bw) * 8; + + for (i = 0; i < 64; i++) + coordmap[i] = (i & 7) + (i >> 3) * stride; + + for (by = 0; by < bh; by++) { + for (i = 0; i < BINKB_NB_SRC; i++) { + if (binkb_read_bundle(c, gb, i) < 0) + return -1; + } + + dst = c->pic.data[plane_idx] + 8*by*stride; + for (bx = 0; bx < bw; bx++, dst += 8) { + blk = binkb_get_value(c, BINKB_SRC_BLOCK_TYPES); + switch (blk) { + case 0: + break; + case 1: + scan = bink_patterns[get_bits(gb, 4)]; + i = 0; + do { + int mode, run; + + mode = get_bits1(gb); + run = get_bits(gb, binkb_runbits[i]) + 1; + + i += run; + if (i > 64) { + av_log(c->avctx, AV_LOG_ERROR, "Run went out of bounds\n"); + return -1; + } + if (mode) { + v = binkb_get_value(c, BINKB_SRC_COLORS); + for (j = 0; j < run; j++) + dst[coordmap[*scan++]] = v; + } else { + for (j = 0; j < run; j++) + dst[coordmap[*scan++]] = binkb_get_value(c, BINKB_SRC_COLORS); + } + } while (i < 63); + if (i == 63) + dst[coordmap[*scan++]] = binkb_get_value(c, BINKB_SRC_COLORS); + break; + case 2: + c->dsp.clear_block(block); + block[0] = binkb_get_value(c, BINKB_SRC_INTRA_DC); + qp = binkb_get_value(c, BINKB_SRC_INTRA_Q); + read_dct_coeffs(gb, block, c->scantable.permutated, binkb_intra_quant, qp); + c->dsp.idct_put(dst, stride, block); + break; + case 3: + xoff = binkb_get_value(c, BINKB_SRC_X_OFF); + yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias; + ref = dst + xoff + yoff * stride; + if (ref < ref_start || ref + 8*stride > ref_end) { + av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n"); + } else if (ref + 8*stride < dst || ref >= dst + 8*stride) { + c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); + } else { + put_pixels8x8_overlapped(dst, ref, stride); + } + c->dsp.clear_block(block); + v = binkb_get_value(c, BINKB_SRC_INTER_COEFS); + read_residue(gb, block, v); + c->dsp.add_pixels8(dst, block, stride); + break; + case 4: + xoff = binkb_get_value(c, BINKB_SRC_X_OFF); + yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias; + ref = dst + xoff + yoff * stride; + if (ref < ref_start || ref + 8 * stride > ref_end) { + av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n"); + } else if (ref + 8*stride < dst || ref >= dst + 8*stride) { + c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); + } else { + put_pixels8x8_overlapped(dst, ref, stride); + } + c->dsp.clear_block(block); + block[0] = binkb_get_value(c, BINKB_SRC_INTER_DC); + qp = binkb_get_value(c, BINKB_SRC_INTER_Q); + read_dct_coeffs(gb, block, c->scantable.permutated, binkb_inter_quant, qp); + c->dsp.idct_add(dst, stride, block); + break; + case 5: + v = binkb_get_value(c, BINKB_SRC_COLORS); + c->dsp.fill_block_tab[1](dst, v, stride, 8); + break; + case 6: + for (i = 0; i < 2; i++) + col[i] = binkb_get_value(c, BINKB_SRC_COLORS); + for (i = 0; i < 8; i++) { + v = binkb_get_value(c, BINKB_SRC_PATTERN); + for (j = 0; j < 8; j++, v >>= 1) + dst[i*stride + j] = col[v & 1]; + } + break; + case 7: + xoff = binkb_get_value(c, BINKB_SRC_X_OFF); + yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias; + ref = dst + xoff + yoff * stride; + if (ref < ref_start || ref + 8 * stride > ref_end) { + av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n"); + } else if (ref + 8*stride < dst || ref >= dst + 8*stride) { + c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); + } else { + put_pixels8x8_overlapped(dst, ref, stride); + } + break; + case 8: + for (i = 0; i < 8; i++) + memcpy(dst + i*stride, c->bundle[BINKB_SRC_COLORS].cur_ptr + i*8, 8); + c->bundle[BINKB_SRC_COLORS].cur_ptr += 64; + break; + default: + av_log(c->avctx, AV_LOG_ERROR, "Unknown block type %d\n", blk); + return -1; + } + } + } + if (get_bits_count(gb) & 0x1F) //next plane data starts at 32-bit boundary + skip_bits_long(gb, 32 - (get_bits_count(gb) & 0x1F)); + + return 0; +} + static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, int is_chroma) { @@ -768,7 +1021,7 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, case INTRA_BLOCK: c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTRA_DC); - read_dct_coeffs(gb, block, c->scantable.permutated, 1); + read_dct_coeffs(gb, block, c->scantable.permutated, bink_intra_quant, -1); c->dsp.idct(block); c->dsp.put_pixels_nonclamped(block, ublock, 8); break; @@ -852,7 +1105,7 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, case INTRA_BLOCK: c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTRA_DC); - read_dct_coeffs(gb, block, c->scantable.permutated, 1); + read_dct_coeffs(gb, block, c->scantable.permutated, bink_intra_quant, -1); c->dsp.idct_put(dst, stride, block); break; case FILL_BLOCK: @@ -866,7 +1119,7 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTER_DC); - read_dct_coeffs(gb, block, c->scantable.permutated, 0); + read_dct_coeffs(gb, block, c->scantable.permutated, bink_inter_quant, -1); c->dsp.idct_add(dst, stride, block); break; case PATTERN_BLOCK: @@ -902,12 +1155,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac int plane, plane_idx; int bits_count = pkt->size << 3; - if(c->pic.data[0]) - avctx->release_buffer(avctx, &c->pic); + if (c->version > 'b') { + if(c->pic.data[0]) + avctx->release_buffer(avctx, &c->pic); - if(avctx->get_buffer(avctx, &c->pic) < 0){ - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; + if(avctx->get_buffer(avctx, &c->pic) < 0){ + av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + return -1; + } + } else { + if(avctx->reget_buffer(avctx, &c->pic) < 0){ + av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + return -1; + } } init_get_bits(&gb, pkt->data, bits_count); @@ -923,8 +1183,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac for (plane = 0; plane < 3; plane++) { plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3); - if (bink_decode_plane(c, &gb, plane_idx, !!plane) < 0) - return -1; + if (c->version > 'b') { + if (bink_decode_plane(c, &gb, plane_idx, !!plane) < 0) + return -1; + } else { + if (binkb_decode_plane(c, &gb, plane_idx, !pkt->pts, !!plane) < 0) + return -1; + } if (get_bits_count(&gb) >= bits_count) break; } @@ -933,24 +1198,67 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac *data_size = sizeof(AVFrame); *(AVFrame*)data = c->pic; - FFSWAP(AVFrame, c->pic, c->last); + if (c->version > 'b') + FFSWAP(AVFrame, c->pic, c->last); /* always report that the buffer was completely consumed */ return pkt->size; } +/** + * Caclulate quantization tables for version b + */ +static av_cold void binkb_calc_quant() +{ + uint8_t inv_bink_scan[64]; + double s[64]; + int i, j; + + for (j = 0; j < 8; j++) { + for (i = 0; i < 8; i++) { + if (j && j != 4) + if (i && i != 4) + s[j*8 + i] = cos(j * M_PI/16.0) * cos(i * M_PI/16.0) * 2.0; + else + s[j*8 + i] = cos(j * M_PI/16.0) * sqrt(2.0); + else + if (i && i != 4) + s[j*8 + i] = cos(i * M_PI/16.0) * sqrt(2.0); + else + s[j*8 + i] = 1.0; + } + } + + for (i = 0; i < 64; i++) + inv_bink_scan[bink_scan[i]] = i; + + for (j = 0; j < 16; j++) { + for (i = 0; i < 64; i++) { + int k = inv_bink_scan[i]; + if (s[i] == 1.0) { + binkb_intra_quant[j][k] = (1L << 12) * binkb_intra_seed[i] * + binkb_num[j]/binkb_den[j]; + binkb_inter_quant[j][k] = (1L << 12) * binkb_inter_seed[i] * + binkb_num[j]/binkb_den[j]; + } else { + binkb_intra_quant[j][k] = (1L << 12) * binkb_intra_seed[i] * s[i] * + binkb_num[j]/(double)binkb_den[j]; + binkb_inter_quant[j][k] = (1L << 12) * binkb_inter_seed[i] * s[i] * + binkb_num[j]/(double)binkb_den[j]; + } + } + } +} + static av_cold int decode_init(AVCodecContext *avctx) { BinkContext * const c = avctx->priv_data; static VLC_TYPE table[16 * 128][2]; + static int binkb_initialised = 0; int i; int flags; c->version = avctx->codec_tag >> 24; - if (c->version < 'c') { - av_log(avctx, AV_LOG_ERROR, "Too old version '%c'\n", c->version); - return -1; - } if (avctx->extradata_size < 4) { av_log(avctx, AV_LOG_ERROR, "Extradata missing or too short\n"); return -1; @@ -984,6 +1292,13 @@ static av_cold int decode_init(AVCodecContext *avctx) init_bundles(c); + if (c->version == 'b') { + if (!binkb_initialised) { + binkb_calc_quant(); + binkb_initialised = 1; + } + } + return 0; } diff --git a/mplayer/ffmpeg/libavcodec/binkaudio.c b/mplayer/ffmpeg/libavcodec/binkaudio.c index ae2f6c88..a00d6578 100644 --- a/mplayer/ffmpeg/libavcodec/binkaudio.c +++ b/mplayer/ffmpeg/libavcodec/binkaudio.c @@ -1,6 +1,6 @@ /* * Bink Audio decoder - * Copyright (c) 2007-2010 Peter Ross (pross@xvid.org) + * Copyright (c) 2007-2011 Peter Ross (pross@xvid.org) * Copyright (c) 2009 Daniel Verkamp (daniel@drv.nu) * * This file is part of FFmpeg. @@ -33,6 +33,8 @@ #include "get_bits.h" #include "dsputil.h" #include "fft.h" +#include "fmtconvert.h" +#include "libavutil/intfloat_readwrite.h" extern const uint16_t ff_wma_critical_freqs[25]; @@ -40,9 +42,10 @@ extern const uint16_t ff_wma_critical_freqs[25]; #define BINK_BLOCK_MAX_SIZE (MAX_CHANNELS << 11) typedef struct { - AVCodecContext *avctx; GetBitContext gb; DSPContext dsp; + FmtConvertContext fmt_conv; + int version_b; ///< Bink version 'b' int first; int channels; int frame_len; ///< transform size (samples) @@ -69,8 +72,8 @@ static av_cold int decode_init(AVCodecContext *avctx) int i; int frame_len_bits; - s->avctx = avctx; dsputil_init(&s->dsp, avctx); + ff_fmt_convert_init(&s->fmt_conv, avctx); /* determine frame length */ if (avctx->sample_rate < 22050) { @@ -80,24 +83,25 @@ static av_cold int decode_init(AVCodecContext *avctx) } else { frame_len_bits = 11; } - s->frame_len = 1 << frame_len_bits; - if (s->channels > MAX_CHANNELS) { - av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels); + if (avctx->channels > MAX_CHANNELS) { + av_log(avctx, AV_LOG_ERROR, "too many channels: %d\n", avctx->channels); return -1; } + s->version_b = avctx->codec_tag == MKTAG('B','I','K','b'); + if (avctx->codec->id == CODEC_ID_BINKAUDIO_RDFT) { // audio is already interleaved for the RDFT format variant sample_rate *= avctx->channels; - s->frame_len *= avctx->channels; s->channels = 1; - if (avctx->channels == 2) - frame_len_bits++; + if (!s->version_b) + frame_len_bits += av_log2(avctx->channels); } else { s->channels = avctx->channels; } + s->frame_len = 1 << frame_len_bits; s->overlap_len = s->frame_len / 16; s->block_size = (s->frame_len - s->overlap_len) * s->channels; sample_rate_half = (sample_rate + 1) / 2; @@ -113,10 +117,10 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); /* populate bands data */ - s->bands[0] = 1; + s->bands[0] = 2; for (i = 1; i < s->num_bands; i++) - s->bands[i] = ff_wma_critical_freqs[i - 1] * (s->frame_len / 2) / sample_rate_half; - s->bands[s->num_bands] = s->frame_len / 2; + s->bands[i] = (ff_wma_critical_freqs[i - 1] * s->frame_len / sample_rate_half) & ~1; + s->bands[s->num_bands] = s->frame_len; s->first = 1; avctx->sample_fmt = AV_SAMPLE_FMT_S16; @@ -163,9 +167,13 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct) for (ch = 0; ch < s->channels; ch++) { FFTSample *coeffs = s->coeffs_ptr[ch]; - q = 0.0f; - coeffs[0] = get_float(gb) * s->root; - coeffs[1] = get_float(gb) * s->root; + if (s->version_b) { + coeffs[0] = av_int2flt(get_bits(gb, 32)) * s->root; + coeffs[1] = av_int2flt(get_bits(gb, 32)) * s->root; + } else { + coeffs[0] = get_float(gb) * s->root; + coeffs[1] = get_float(gb) * s->root; + } for (i = 0; i < s->num_bands; i++) { /* constant is result of 0.066399999/log10(M_E) */ @@ -173,15 +181,15 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct) quant[i] = expf(FFMIN(value, 95) * 0.15289164787221953823f) * s->root; } - // find band (k) - for (k = 0; s->bands[k] < 1; k++) { - q = quant[k]; - } + k = 0; + q = quant[0]; // parse coefficients i = 2; while (i < s->frame_len) { - if (get_bits1(gb)) { + if (s->version_b) { + j = i + 16; + } else if (get_bits1(gb)) { j = i + rle_length_tab[get_bits(gb, 4)] * 8; } else { j = i + 8; @@ -193,11 +201,11 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct) if (width == 0) { memset(coeffs + i, 0, (j - i) * sizeof(*coeffs)); i = j; - while (s->bands[k] * 2 < i) + while (s->bands[k] < i) q = quant[k++]; } else { while (i < j) { - if (s->bands[k] * 2 == i) + if (s->bands[k] == i) q = quant[k++]; coeff = get_bits(gb, width); if (coeff) { @@ -222,7 +230,8 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct) ff_rdft_calc(&s->trans.rdft, coeffs); } - s->dsp.float_to_int16_interleave(out, (const float **)s->coeffs_ptr, s->frame_len, s->channels); + s->fmt_conv.float_to_int16_interleave(out, (const float **)s->coeffs_ptr, + s->frame_len, s->channels); if (!s->first) { int count = s->overlap_len * s->channels; diff --git a/mplayer/ffmpeg/libavcodec/binkdata.h b/mplayer/ffmpeg/libavcodec/binkdata.h index 1ca34a68..2c20b4a4 100644 --- a/mplayer/ffmpeg/libavcodec/binkdata.h +++ b/mplayer/ffmpeg/libavcodec/binkdata.h @@ -611,4 +611,45 @@ static const uint32_t bink_inter_quant[16][64] = { }, }; +static const uint8_t binkb_runbits[64] = { + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 4, 4, 4, 4, 4, 4, 4, 4, + 3, 3, 3, 3, 2, 2, 1, 0, +}; + +static const uint8_t binkb_intra_seed[64] = { + 16, 16, 16, 19, 16, 19, 22, 22, + 22, 22, 26, 24, 26, 22, 22, 27, + 27, 27, 26, 26, 26, 29, 29, 29, + 27, 27, 27, 26, 34, 34, 34, 29, + 29, 29, 27, 27, 37, 34, 34, 32, + 32, 29, 29, 38, 37, 35, 35, 34, + 35, 40, 40, 40, 38, 38, 48, 48, + 46, 46, 58, 56, 56, 69, 69, 83, +}; + +static const uint8_t binkb_inter_seed[64] = { + 16, 17, 17, 18, 18, 18, 19, 19, + 19, 19, 20, 20, 20, 20, 20, 21, + 21, 21, 21, 21, 21, 22, 22, 22, + 22, 22, 22, 22, 23, 23, 23, 23, + 23, 23, 23, 23, 24, 24, 24, 25, + 24, 24, 24, 25, 26, 26, 26, 26, + 25, 27, 27, 27, 27, 27, 28, 28, + 28, 28, 30, 30, 30, 31, 31, 33, +}; + +static const uint8_t binkb_num[16] = { + 1, 4, 5, 2, 7, 8, 3, 7, 4, 9, 5, 6, 7, 8, 9, 10 +}; + +static const uint8_t binkb_den[16] = { + 1, 3, 3, 1, 3, 3, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1 +}; + #endif /* AVCODEC_BINKDATA_H */ diff --git a/mplayer/ffmpeg/libavcodec/binkidct.c b/mplayer/ffmpeg/libavcodec/binkidct.c index 160926e1..ddb6cc1a 100644 --- a/mplayer/ffmpeg/libavcodec/binkidct.c +++ b/mplayer/ffmpeg/libavcodec/binkidct.c @@ -62,7 +62,7 @@ #define MUNGE_ROW(x) (((x) + 0x7F)>>8) #define IDCT_ROW(dest,src) IDCT_TRANSFORM(dest,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,MUNGE_ROW,src) -static inline void bink_idct_col(DCTELEM *dest, const DCTELEM *src) +static inline void bink_idct_col(int *dest, const DCTELEM *src) { if ((src[8]|src[16]|src[24]|src[32]|src[40]|src[48]|src[56])==0) { dest[0] = @@ -81,7 +81,7 @@ static inline void bink_idct_col(DCTELEM *dest, const DCTELEM *src) void ff_bink_idct_c(DCTELEM *block) { int i; - DCTELEM temp[64]; + int temp[64]; for (i = 0; i < 8; i++) bink_idct_col(&temp[i], &block[i]); @@ -103,7 +103,7 @@ void ff_bink_idct_add_c(uint8_t *dest, int linesize, DCTELEM *block) void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block) { int i; - DCTELEM temp[64]; + int temp[64]; for (i = 0; i < 8; i++) bink_idct_col(&temp[i], &block[i]); for (i = 0; i < 8; i++) { diff --git a/mplayer/ffmpeg/libavcodec/bmpenc.c b/mplayer/ffmpeg/libavcodec/bmpenc.c index d424662b..b8f9047c 100644 --- a/mplayer/ffmpeg/libavcodec/bmpenc.c +++ b/mplayer/ffmpeg/libavcodec/bmpenc.c @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/internal.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "bytestream.h" #include "bmp.h" diff --git a/mplayer/ffmpeg/libavcodec/cook.c b/mplayer/ffmpeg/libavcodec/cook.c index 6b705605..da31e9f5 100644 --- a/mplayer/ffmpeg/libavcodec/cook.c +++ b/mplayer/ffmpeg/libavcodec/cook.c @@ -53,6 +53,7 @@ #include "dsputil.h" #include "bytestream.h" #include "fft.h" +#include "libavutil/audioconvert.h" #include "cookdata.h" @@ -1274,7 +1275,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) if (channel_mask) avctx->channel_layout = channel_mask; else - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; #ifdef COOKDEBUG dump_cook_context(q); diff --git a/mplayer/ffmpeg/libavcodec/dca.c b/mplayer/ffmpeg/libavcodec/dca.c index fc5c0b55..14b0b2d1 100644 --- a/mplayer/ffmpeg/libavcodec/dca.c +++ b/mplayer/ffmpeg/libavcodec/dca.c @@ -29,7 +29,7 @@ #include "libavutil/common.h" #include "libavutil/intmath.h" #include "libavutil/intreadwrite.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "avcodec.h" #include "dsputil.h" #include "fft.h" @@ -40,6 +40,7 @@ #include "dca.h" #include "synth_filter.h" #include "dcadsp.h" +#include "fmtconvert.h" //#define TRACE @@ -98,6 +99,21 @@ enum DCAExtensionMask { DCA_EXT_EXSS_XLL = 0x200, ///< lossless extension in ExSS }; +/* -1 are reserved or unknown */ +static const int dca_ext_audio_descr_mask[] = { + DCA_EXT_XCH, + -1, + DCA_EXT_X96, + DCA_EXT_XCH | DCA_EXT_X96, + -1, + -1, + DCA_EXT_XXCH, + -1, +}; + +/* extensions that reside in core substream */ +#define DCA_CORE_EXTS (DCA_EXT_XCH | DCA_EXT_XXCH | DCA_EXT_X96) + /* Tables for mapping dts channel configurations to libavcodec multichannel api. * Some compromises have been made for special configurations. Most configurations * are never used so complete accuracy is not needed. @@ -105,7 +121,7 @@ enum DCAExtensionMask { * L = left, R = right, C = center, S = surround, F = front, R = rear, T = total, OV = overhead. * S -> side, when both rear and back are configured move one of them to the side channel * OV -> center back - * All 2 channel configurations -> CH_LAYOUT_STEREO + * All 2 channel configurations -> AV_CH_LAYOUT_STEREO */ static const int64_t dca_core_channel_layout[] = { @@ -116,7 +132,7 @@ static const int64_t dca_core_channel_layout[] = { AV_CH_LAYOUT_STEREO, ///< 2, LT +RT (left and right total) AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER, ///< 3, C+L+R AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER, ///< 3, L+R+S - AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER|CH_BACK_CENTER, ///< 4, C + L + R+ S + AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER|AV_CH_BACK_CENTER, ///< 4, C + L + R+ S AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, ///< 4, L + R +SL+ SR AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, ///< 5, C + L + R+ SL+SR AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER, ///< 6, CL + CR + L + R + SL + SR @@ -326,14 +342,12 @@ typedef struct { int current_subframe; int current_subsubframe; + int core_ext_mask; ///< present extensions in the core substream + /* XCh extension information */ - int xch_present; + int xch_present; ///< XCh extension present and valid int xch_base_channel; ///< index of first (only) channel containing XCH data - /* Other detected extensions in the core substream */ - int xxch_present; - int x96_present; - /* ExSS header parser */ int static_fields; ///< static fields present int mix_metadata; ///< mixing metadata present @@ -347,6 +361,7 @@ typedef struct { FFTContext imdct; SynthFilterContext synth; DCADSPContext dcadsp; + FmtConvertContext fmt_conv; } DCAContext; static const uint16_t dca_vlc_offs[] = { @@ -896,7 +911,7 @@ static void qmf_32_subbands(DCAContext * s, int chans, s->synth.synth_filter_float(&s->imdct, s->subband_fir_hist[chans], &s->hist_index[chans], s->subband_fir_noidea[chans], prCoeff, - samples_out, s->raXin, scale, 0); + samples_out, s->raXin, scale); samples_out+= 32; } @@ -929,7 +944,7 @@ static void lfe_interpolation_fir(DCAContext *s, int decimation_select, /* Interpolation */ for (deciindex = 0; deciindex < num_deci_sample; deciindex++) { s->dcadsp.lfe_fir(samples_out, samples_in, prCoeff, decifactor, - scale, 0); + scale); samples_in++; samples_out += 2 * decifactor; } @@ -1115,7 +1130,7 @@ static int dca_subsubframe(DCAContext * s, int base_channel, int block_index) block[m] = get_bitalloc(&s->gb, &dca_smpl_bitalloc[abits], sel); } - s->dsp.int32_to_float_fmul_scalar(subband_samples[k][l], + s->fmt_conv.int32_to_float_fmul_scalar(subband_samples[k][l], block, rscale, 8); } @@ -1354,7 +1369,9 @@ static int dca_exss_mask2count(int mask) */ static void dca_exss_skip_mix_coeffs(GetBitContext *gb, int channels, int out_ch) { - for (int i = 0; i < channels; i++) { + int i; + + for (i = 0; i < channels; i++) { int mix_map_mask = get_bits(gb, out_ch); int num_coeffs = av_popcount(mix_map_mask); skip_bits_long(gb, num_coeffs * 6); @@ -1504,12 +1521,9 @@ static int dca_exss_parse_asset_header(DCAContext *s) if (!(extensions_mask & DCA_EXT_CORE)) av_log(s->avctx, AV_LOG_WARNING, "DTS core detection mismatch.\n"); - if (!!(extensions_mask & DCA_EXT_XCH) != s->xch_present) - av_log(s->avctx, AV_LOG_WARNING, "DTS XCh detection mismatch.\n"); - if (!!(extensions_mask & DCA_EXT_XXCH) != s->xxch_present) - av_log(s->avctx, AV_LOG_WARNING, "DTS XXCh detection mismatch.\n"); - if (!!(extensions_mask & DCA_EXT_X96) != s->x96_present) - av_log(s->avctx, AV_LOG_WARNING, "DTS X96 detection mismatch.\n"); + if ((extensions_mask & DCA_CORE_EXTS) != s->core_ext_mask) + av_log(s->avctx, AV_LOG_WARNING, "DTS extensions detection mismatch (%d, %d)\n", + extensions_mask & DCA_CORE_EXTS, s->core_ext_mask); return 0; } @@ -1619,8 +1633,6 @@ static int dca_decode_frame(AVCodecContext * avctx, s->xch_present = 0; - s->x96_present = 0; - s->xxch_present = 0; s->dca_buffer_size = dca_convert_bitstream(buf, buf_size, s->dca_buffer, DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE); @@ -1648,11 +1660,24 @@ static int dca_decode_frame(AVCodecContext * avctx, /* record number of core channels incase less than max channels are requested */ num_core_channels = s->prim_channels; - /* extensions start at 32-bit boundaries into bitstream */ - skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); + if (s->ext_coding) + s->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr]; + else + s->core_ext_mask = 0; core_ss_end = FFMIN(s->frame_size, s->dca_buffer_size) * 8; + /* only scan for extensions if ext_descr was unknown or indicated a + * supported XCh extension */ + if (s->core_ext_mask < 0 || s->core_ext_mask & DCA_EXT_XCH) { + + /* if ext_descr was unknown, clear s->core_ext_mask so that the + * extensions scan can fill it up */ + s->core_ext_mask = FFMAX(s->core_ext_mask, 0); + + /* extensions start at 32-bit boundaries into bitstream */ + skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); + while(core_ss_end - get_bits_count(&s->gb) >= 32) { uint32_t bits = get_bits_long(&s->gb, 32); @@ -1671,7 +1696,7 @@ static int dca_decode_frame(AVCodecContext * avctx, /* skip length-to-end-of-frame field for the moment */ skip_bits(&s->gb, 10); - s->profile = FFMAX(s->profile, FF_PROFILE_DTS_ES); + s->core_ext_mask |= DCA_EXT_XCH; /* extension amode should == 1, number of channels in extension */ /* AFAIK XCh is not used for more channels */ @@ -1695,8 +1720,7 @@ static int dca_decode_frame(AVCodecContext * avctx, /* XXCh: extended channels */ /* usually found either in core or HD part in DTS-HD HRA streams, * but not in DTS-ES which contains XCh extensions instead */ - s->xxch_present = 1; - s->profile = FFMAX(s->profile, FF_PROFILE_DTS_ES); + s->core_ext_mask |= DCA_EXT_XXCH; break; case 0x1d95f262: { @@ -1709,8 +1733,7 @@ static int dca_decode_frame(AVCodecContext * avctx, av_log(avctx, AV_LOG_DEBUG, "FSIZE96 = %d bytes\n", fsize96); av_log(avctx, AV_LOG_DEBUG, "REVNO = %d\n", get_bits(&s->gb, 4)); - s->x96_present = 1; - s->profile = FFMAX(s->profile, FF_PROFILE_DTS_96_24); + s->core_ext_mask |= DCA_EXT_X96; break; } } @@ -1718,6 +1741,16 @@ static int dca_decode_frame(AVCodecContext * avctx, skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); } + } else { + /* no supported extensions, skip the rest of the core substream */ + skip_bits_long(&s->gb, core_ss_end - get_bits_count(&s->gb)); + } + + if (s->core_ext_mask & DCA_EXT_X96) + s->profile = FF_PROFILE_DTS_96_24; + else if (s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) + s->profile = FF_PROFILE_DTS_ES; + /* check for ExSS (HD part) */ if (s->dca_buffer_size - s->frame_size > 32 && get_bits_long(&s->gb, 32) == DCA_HD_MARKER) @@ -1800,7 +1833,7 @@ static int dca_decode_frame(AVCodecContext * avctx, } } - s->dsp.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels); + s->fmt_conv.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels); samples += 256 * channels; } @@ -1833,6 +1866,7 @@ static av_cold int dca_decode_init(AVCodecContext * avctx) ff_mdct_init(&s->imdct, 6, 1, 1.0); ff_synth_filter_init(&s->synth); ff_dcadsp_init(&s->dcadsp); + ff_fmt_convert_init(&s->fmt_conv, avctx); for (i = 0; i < DCA_PRIM_CHANNELS_MAX+1; i++) s->samples_chanptr[i] = s->samples + i * 256; diff --git a/mplayer/ffmpeg/libavcodec/dcadsp.c b/mplayer/ffmpeg/libavcodec/dcadsp.c index af48e3ce..dd4994d2 100644 --- a/mplayer/ffmpeg/libavcodec/dcadsp.c +++ b/mplayer/ffmpeg/libavcodec/dcadsp.c @@ -23,7 +23,7 @@ #include "dcadsp.h" static void dca_lfe_fir_c(float *out, const float *in, const float *coefs, - int decifactor, float scale, float bias) + int decifactor, float scale) { float *out2 = out + decifactor; const float *cf0 = coefs; @@ -39,8 +39,8 @@ static void dca_lfe_fir_c(float *out, const float *in, const float *coefs, v0 += s * *cf0++; v1 += s * *--cf1; } - *out++ = (v0 * scale) + bias; - *out2++ = (v1 * scale) + bias; + *out++ = v0 * scale; + *out2++ = v1 * scale; } } diff --git a/mplayer/ffmpeg/libavcodec/dcadsp.h b/mplayer/ffmpeg/libavcodec/dcadsp.h index 20020ae0..bb157f76 100644 --- a/mplayer/ffmpeg/libavcodec/dcadsp.h +++ b/mplayer/ffmpeg/libavcodec/dcadsp.h @@ -21,7 +21,7 @@ typedef struct DCADSPContext { void (*lfe_fir)(float *out, const float *in, const float *coefs, - int decifactor, float scale, float bias); + int decifactor, float scale); } DCADSPContext; void ff_dcadsp_init(DCADSPContext *s); diff --git a/mplayer/ffmpeg/libavcodec/dirac.c b/mplayer/ffmpeg/libavcodec/dirac.c index bacd1f8e..c8dc7a0f 100644 --- a/mplayer/ffmpeg/libavcodec/dirac.c +++ b/mplayer/ffmpeg/libavcodec/dirac.c @@ -25,7 +25,7 @@ * @author Marco Gerards */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "dirac.h" #include "avcodec.h" #include "golomb.h" diff --git a/mplayer/ffmpeg/libavcodec/dnxhddec.c b/mplayer/ffmpeg/libavcodec/dnxhddec.c index 58893aca..9b37d1d6 100644 --- a/mplayer/ffmpeg/libavcodec/dnxhddec.c +++ b/mplayer/ffmpeg/libavcodec/dnxhddec.c @@ -22,7 +22,7 @@ //#define TRACE //#define DEBUG -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "get_bits.h" #include "dnxhddata.h" diff --git a/mplayer/ffmpeg/libavcodec/dnxhdenc.c b/mplayer/ffmpeg/libavcodec/dnxhdenc.c index d6f8bd3c..2e8720ac 100644 --- a/mplayer/ffmpeg/libavcodec/dnxhdenc.c +++ b/mplayer/ffmpeg/libavcodec/dnxhdenc.c @@ -24,11 +24,20 @@ //#define DEBUG #define RC_VARIANCE 1 // use variance or ssd for fast rc +#include "libavutil/opt.h" #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" #include "dnxhdenc.h" +#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM + +static const AVOption options[]={ + {"nitris_compat", "encode with Avid Nitris compatibility", offsetof(DNXHDEncContext, nitris_compat), FF_OPT_TYPE_INT, 0, 0, 1, VE}, +{NULL} +}; +static const AVClass class = { "dnxhd", av_default_item_name, options, LIBAVUTIL_VERSION_INT }; + int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); #define LAMBDA_FRAC_BITS 10 @@ -146,7 +155,7 @@ static int dnxhd_init_rc(DNXHDEncContext *ctx) if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD) FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail); - ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4) * 8; + ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4 - ctx->min_padding) * 8; ctx->qscale = 1; ctx->lambda = 2<m.intra_quant_bias, 0) < 0) // XXX tune lbias/cbias return -1; + // Avid Nitris hardware decoder requires a minimum amount of padding in the coding unit payload + if (ctx->nitris_compat) + ctx->min_padding = 1600; + if (dnxhd_init_vlc(ctx) < 0) return -1; if (dnxhd_init_rc(ctx) < 0) @@ -858,4 +871,5 @@ AVCodec ff_dnxhd_encoder = { dnxhd_encode_end, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"), + .priv_class = &class, }; diff --git a/mplayer/ffmpeg/libavcodec/dnxhdenc.h b/mplayer/ffmpeg/libavcodec/dnxhdenc.h index eaf33d5c..f0b38a59 100644 --- a/mplayer/ffmpeg/libavcodec/dnxhdenc.h +++ b/mplayer/ffmpeg/libavcodec/dnxhdenc.h @@ -55,6 +55,9 @@ typedef struct DNXHDEncContext { int interlaced; int cur_field; + int nitris_compat; + unsigned min_padding; + DECLARE_ALIGNED(16, DCTELEM, blocks)[8][64]; int (*qmatrix_c) [64]; diff --git a/mplayer/ffmpeg/libavcodec/dpcm.c b/mplayer/ffmpeg/libavcodec/dpcm.c index 6053a145..ee8eb6a7 100644 --- a/mplayer/ffmpeg/libavcodec/dpcm.c +++ b/mplayer/ffmpeg/libavcodec/dpcm.c @@ -309,7 +309,7 @@ AVCodec ff_ ## name ## _decoder = { \ NULL, \ dpcm_decode_frame, \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ -}; +} DPCM_DECODER(CODEC_ID_INTERPLAY_DPCM, interplay_dpcm, "DPCM Interplay"); DPCM_DECODER(CODEC_ID_ROQ_DPCM, roq_dpcm, "DPCM id RoQ"); diff --git a/mplayer/ffmpeg/libavcodec/dpx.c b/mplayer/ffmpeg/libavcodec/dpx.c index 55ae4e72..ade4e8cb 100644 --- a/mplayer/ffmpeg/libavcodec/dpx.c +++ b/mplayer/ffmpeg/libavcodec/dpx.c @@ -20,7 +20,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "bytestream.h" #include "avcodec.h" diff --git a/mplayer/ffmpeg/libavcodec/dsputil.c b/mplayer/ffmpeg/libavcodec/dsputil.c index f604f0e7..1f7bd4cb 100644 --- a/mplayer/ffmpeg/libavcodec/dsputil.c +++ b/mplayer/ffmpeg/libavcodec/dsputil.c @@ -27,7 +27,7 @@ * DSP utils */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "simple_idct.h" @@ -437,8 +437,8 @@ static void diff_pixels_c(DCTELEM *restrict block, const uint8_t *s1, } -static void put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, - int line_size) +void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, + int line_size) { int i; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; @@ -493,9 +493,9 @@ static void put_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels } } -static void put_signed_pixels_clamped_c(const DCTELEM *block, - uint8_t *restrict pixels, - int line_size) +void ff_put_signed_pixels_clamped_c(const DCTELEM *block, + uint8_t *restrict pixels, + int line_size) { int i, j; @@ -535,8 +535,8 @@ static void put_pixels_nonclamped_c(const DCTELEM *block, uint8_t *restrict pixe } } -static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, - int line_size) +void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, + int line_size) { int i; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; @@ -1600,54 +1600,6 @@ H264_CHROMA_MC(avg_ , op_avg) #undef op_avg #undef op_put -static void put_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){ - const int A=(8-x)*(8-y); - const int B=( x)*(8-y); - const int C=(8-x)*( y); - const int D=( x)*( y); - int i; - - assert(x<8 && y<8 && x>=0 && y>=0); - - for(i=0; i> 6; - dst[1] = (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6; - dst[2] = (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6; - dst[3] = (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6; - dst[4] = (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6; - dst[5] = (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6; - dst[6] = (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6; - dst[7] = (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6; - dst+= stride; - src+= stride; - } -} - -static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){ - const int A=(8-x)*(8-y); - const int B=( x)*(8-y); - const int C=(8-x)*( y); - const int D=( x)*( y); - int i; - - assert(x<8 && y<8 && x>=0 && y>=0); - - for(i=0; i> 6)); - dst[1] = avg2(dst[1], ((A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6)); - dst[2] = avg2(dst[2], ((A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6)); - dst[3] = avg2(dst[3], ((A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6)); - dst[4] = avg2(dst[4], ((A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6)); - dst[5] = avg2(dst[5], ((A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6)); - dst[6] = avg2(dst[6], ((A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6)); - dst[7] = avg2(dst[7], ((A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6)); - dst+= stride; - src+= stride; - } -} - #define QPEL_MC(r, OPNAME, RND, OP) \ static void OPNAME ## mpeg4_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ @@ -3776,7 +3728,9 @@ static void vector_fmul_add_c(float *dst, const float *src0, const float *src1, dst[i] = src0[i] * src1[i] + src2[i]; } -void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len){ +static void vector_fmul_window_c(float *dst, const float *src0, + const float *src1, const float *win, int len) +{ int i,j; dst += len; win += len; @@ -3786,8 +3740,8 @@ void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, c float s1 = src1[j]; float wi = win[i]; float wj = win[j]; - dst[i] = s0*wj - s1*wi + add_bias; - dst[j] = s0*wi + s1*wj + add_bias; + dst[i] = s0*wj - s1*wi; + dst[j] = s0*wi + s1*wj; } } @@ -3865,12 +3819,6 @@ static float scalarproduct_float_c(const float *v1, const float *v2, int len) return p; } -static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, int len){ - int i; - for(i=0; iget_pixels = get_pixels_c; c->diff_pixels = diff_pixels_c; - c->put_pixels_clamped = put_pixels_clamped_c; - c->put_signed_pixels_clamped = put_signed_pixels_clamped_c; + c->put_pixels_clamped = ff_put_pixels_clamped_c; + c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_c; c->put_pixels_nonclamped = put_pixels_nonclamped_c; - c->add_pixels_clamped = add_pixels_clamped_c; + c->add_pixels_clamped = ff_add_pixels_clamped_c; c->add_pixels8 = add_pixels8_c; c->add_pixels4 = add_pixels4_c; c->sum_abs_dctelem = sum_abs_dctelem_c; @@ -4329,17 +4253,12 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_c; c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_c; c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_c; - c->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c; - c->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c; c->draw_edges = draw_edges_c; #if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER ff_mlp_init(c, avctx); #endif -#if CONFIG_VC1_DECODER - ff_vc1dsp_init(c,avctx); -#endif #if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER ff_intrax8dsp_init(c,avctx); #endif @@ -4434,11 +4353,8 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->vector_fmul = vector_fmul_c; c->vector_fmul_reverse = vector_fmul_reverse_c; c->vector_fmul_add = vector_fmul_add_c; - c->vector_fmul_window = ff_vector_fmul_window_c; - c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c; + c->vector_fmul_window = vector_fmul_window_c; c->vector_clipf = vector_clipf_c; - c->float_to_int16 = ff_float_to_int16_c; - c->float_to_int16_interleave = ff_float_to_int16_interleave_c; c->scalarproduct_int16 = scalarproduct_int16_c; c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c; c->scalarproduct_float = scalarproduct_float_c; diff --git a/mplayer/ffmpeg/libavcodec/dsputil.h b/mplayer/ffmpeg/libavcodec/dsputil.h index 9a1172b1..3e55d133 100644 --- a/mplayer/ffmpeg/libavcodec/dsputil.h +++ b/mplayer/ffmpeg/libavcodec/dsputil.h @@ -68,9 +68,6 @@ void ff_h264_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul); void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp); void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc); -void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, - const float *win, float add_bias, int len); - /* encoding scans */ extern const uint8_t ff_alternate_horizontal_scan[64]; extern const uint8_t ff_alternate_vertical_scan[64]; @@ -201,6 +198,10 @@ void ff_emulated_edge_mc(uint8_t *buf, const uint8_t *src, int linesize, int block_w, int block_h, int src_x, int src_y, int w, int h); +void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize); +void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize); +void ff_put_signed_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize); + /** * DSPContext. */ @@ -344,9 +345,6 @@ typedef struct DSPContext { */ h264_chroma_mc_func put_h264_chroma_pixels_tab[3]; h264_chroma_mc_func avg_h264_chroma_pixels_tab[3]; - /* This is really one func used in VC-1 decoding */ - h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3]; - h264_chroma_mc_func avg_no_rnd_vc1_chroma_pixels_tab[3]; qpel_mc_func put_h264_qpel_pixels_tab[4][16]; qpel_mc_func avg_h264_qpel_pixels_tab[4][16]; @@ -393,9 +391,8 @@ typedef struct DSPContext { /* assume len is a multiple of 8, and src arrays are 16-byte aligned */ void (*vector_fmul_add)(float *dst, const float *src0, const float *src1, const float *src2, int len); /* assume len is a multiple of 4, and arrays are 16-byte aligned */ - void (*vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len); + void (*vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, int len); /* assume len is a multiple of 8, and arrays are 16-byte aligned */ - void (*int32_to_float_fmul_scalar)(float *dst, const int *src, float mul, int len); void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */); /** * Multiply a vector of floats by a scalar float. Source and @@ -448,10 +445,6 @@ typedef struct DSPContext { */ void (*butterflies_float)(float *restrict v1, float *restrict v2, int len); - /* convert floats from [-32768.0,32767.0] without rescaling and arrays are 16byte aligned */ - void (*float_to_int16)(int16_t *dst, const float *src, long len); - void (*float_to_int16_interleave)(int16_t *dst, const float **src, long len, int channels); - /* (I)DCT */ void (*fdct)(DCTELEM *block/* align 16*/); void (*fdct248)(DCTELEM *block/* align 16*/); @@ -511,29 +504,6 @@ typedef struct DSPContext { unsigned int filter_shift, int32_t mask, int blocksize, int32_t *sample_buffer); - /* vc1 functions */ - void (*vc1_inv_trans_8x8)(DCTELEM *b); - void (*vc1_inv_trans_8x4)(uint8_t *dest, int line_size, DCTELEM *block); - void (*vc1_inv_trans_4x8)(uint8_t *dest, int line_size, DCTELEM *block); - void (*vc1_inv_trans_4x4)(uint8_t *dest, int line_size, DCTELEM *block); - void (*vc1_inv_trans_8x8_dc)(uint8_t *dest, int line_size, DCTELEM *block); - void (*vc1_inv_trans_8x4_dc)(uint8_t *dest, int line_size, DCTELEM *block); - void (*vc1_inv_trans_4x8_dc)(uint8_t *dest, int line_size, DCTELEM *block); - void (*vc1_inv_trans_4x4_dc)(uint8_t *dest, int line_size, DCTELEM *block); - void (*vc1_v_overlap)(uint8_t* src, int stride); - void (*vc1_h_overlap)(uint8_t* src, int stride); - void (*vc1_v_loop_filter4)(uint8_t *src, int stride, int pq); - void (*vc1_h_loop_filter4)(uint8_t *src, int stride, int pq); - void (*vc1_v_loop_filter8)(uint8_t *src, int stride, int pq); - void (*vc1_h_loop_filter8)(uint8_t *src, int stride, int pq); - void (*vc1_v_loop_filter16)(uint8_t *src, int stride, int pq); - void (*vc1_h_loop_filter16)(uint8_t *src, int stride, int pq); - /* put 8x8 block with bicubic interpolation and quarterpel precision - * last argument is actually round value instead of height - */ - op_pixels_func put_vc1_mspel_pixels_tab[16]; - op_pixels_func avg_vc1_mspel_pixels_tab[16]; - /* intrax8 functions */ void (*x8_spatial_compensation[12])(uint8_t *src , uint8_t *dst, int linesize); void (*x8_setup_spatial_compensation)(uint8_t *src, uint8_t *dst, int linesize, @@ -637,7 +607,6 @@ void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx); void ff_dsputil_init_dwt(DSPContext *c); void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx); void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx); -void ff_vc1dsp_init(DSPContext* c, AVCodecContext *avctx); void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx); void ff_mlp_init(DSPContext* c, AVCodecContext *avctx); void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx); diff --git a/mplayer/ffmpeg/libavcodec/dvbsub.c b/mplayer/ffmpeg/libavcodec/dvbsub.c index c2a12986..ed128234 100644 --- a/mplayer/ffmpeg/libavcodec/dvbsub.c +++ b/mplayer/ffmpeg/libavcodec/dvbsub.c @@ -223,7 +223,7 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s, else page_state = 2; /* mode change */ /* page_version = 0 + page_state */ - *q++ = s->object_version | (page_state << 2) | 3; + *q++ = (s->object_version << 4) | (page_state << 2) | 3; for (region_id = 0; region_id < h->num_rects; region_id++) { *q++ = region_id; diff --git a/mplayer/ffmpeg/libavcodec/dvbsubdec.c b/mplayer/ffmpeg/libavcodec/dvbsubdec.c index 0f1e0046..45737136 100644 --- a/mplayer/ffmpeg/libavcodec/dvbsubdec.c +++ b/mplayer/ffmpeg/libavcodec/dvbsubdec.c @@ -332,9 +332,7 @@ static void delete_state(DVBSubContext *ctx) ctx->region_list = region->next; delete_region_display_list(ctx, region); - if (region->pbuf) - av_free(region->pbuf); - + av_free(region->pbuf); av_free(region); } @@ -794,7 +792,7 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis map_table = NULL; x_pos += dvbsub_read_2bit_string(pbuf + (y_pos * region->width) + x_pos, - region->width - x_pos, &buf, buf_size, + region->width - x_pos, &buf, buf_end - buf, non_mod, map_table); break; case 0x11: @@ -809,7 +807,7 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis map_table = NULL; x_pos += dvbsub_read_4bit_string(pbuf + (y_pos * region->width) + x_pos, - region->width - x_pos, &buf, buf_size, + region->width - x_pos, &buf, buf_end - buf, non_mod, map_table); break; case 0x12: @@ -819,7 +817,7 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis } x_pos += dvbsub_read_8bit_string(pbuf + (y_pos * region->width) + x_pos, - region->width - x_pos, &buf, buf_size, + region->width - x_pos, &buf, buf_end - buf, non_mod, NULL); break; @@ -1032,8 +1030,7 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx, buf += 2; if (region->width * region->height != region->buf_size) { - if (region->pbuf) - av_free(region->pbuf); + av_free(region->pbuf); region->buf_size = region->width * region->height; @@ -1426,13 +1423,15 @@ static int dvbsub_decode(AVCodecContext *avctx, #endif - if (buf_size <= 2) + if (buf_size <= 6 || *buf != 0x0f) { + av_dlog(avctx, "incomplete or broken packet"); return -1; + } p = buf; p_end = buf + buf_size; - while (p < p_end && *p == 0x0f) { + while (p_end - p >= 6 && *p == 0x0f) { p += 1; segment_type = *p++; page_id = AV_RB16(p); @@ -1440,6 +1439,11 @@ static int dvbsub_decode(AVCodecContext *avctx, segment_length = AV_RB16(p); p += 2; + if (p_end - p < segment_length) { + av_dlog(avctx, "incomplete or broken packet"); + return -1; + } + if (page_id == ctx->composition_id || page_id == ctx->ancillary_id || ctx->composition_id == -1 || ctx->ancillary_id == -1) { switch (segment_type) { @@ -1470,12 +1474,7 @@ static int dvbsub_decode(AVCodecContext *avctx, p += segment_length; } - if (p != p_end) { - av_dlog(avctx, "Junk at end of packet\n"); - return -1; - } - - return buf_size; + return p - buf; } diff --git a/mplayer/ffmpeg/libavcodec/dxva2_internal.h b/mplayer/ffmpeg/libavcodec/dxva2_internal.h index a9be7a07..23d4d875 100644 --- a/mplayer/ffmpeg/libavcodec/dxva2_internal.h +++ b/mplayer/ffmpeg/libavcodec/dxva2_internal.h @@ -23,6 +23,8 @@ #ifndef AVCODEC_DXVA_INTERNAL_H #define AVCODEC_DXVA_INTERNAL_H +#define _WIN32_WINNT 0x0600 +#define COBJMACROS #include "dxva2.h" #include "avcodec.h" #include "mpegvideo.h" diff --git a/mplayer/ffmpeg/libavcodec/eacmv.c b/mplayer/ffmpeg/libavcodec/eacmv.c index 6770cd19..7f6c2a45 100644 --- a/mplayer/ffmpeg/libavcodec/eacmv.c +++ b/mplayer/ffmpeg/libavcodec/eacmv.c @@ -29,7 +29,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" typedef struct CmvContext { diff --git a/mplayer/ffmpeg/libavcodec/eamad.c b/mplayer/ffmpeg/libavcodec/eamad.c index 1dd3b797..d4881ab8 100644 --- a/mplayer/ffmpeg/libavcodec/eamad.c +++ b/mplayer/ffmpeg/libavcodec/eamad.c @@ -34,7 +34,7 @@ #include "aandcttab.h" #include "mpeg12.h" #include "mpeg12data.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #define EA_PREAMBLE_SIZE 8 #define MADk_TAG MKTAG('M', 'A', 'D', 'k') /* MAD i-frame */ diff --git a/mplayer/ffmpeg/libavcodec/eatgv.c b/mplayer/ffmpeg/libavcodec/eatgv.c index 075405a9..9ad08347 100644 --- a/mplayer/ffmpeg/libavcodec/eatgv.c +++ b/mplayer/ffmpeg/libavcodec/eatgv.c @@ -32,7 +32,7 @@ #define ALT_BITSTREAM_READER_LE #include "get_bits.h" #include "libavutil/lzo.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #define EA_PREAMBLE_SIZE 8 #define kVGT_TAG MKTAG('k', 'V', 'G', 'T') diff --git a/mplayer/ffmpeg/libavcodec/fft.c b/mplayer/ffmpeg/libavcodec/fft.c index e560b562..9e0cb769 100644 --- a/mplayer/ffmpeg/libavcodec/fft.c +++ b/mplayer/ffmpeg/libavcodec/fft.c @@ -97,6 +97,7 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) if (!s->tmp_buf) goto fail; s->inverse = inverse; + s->fft_permutation = FF_FFT_PERM_DEFAULT; s->fft_permute = ff_fft_permute_c; s->fft_calc = ff_fft_calc_c; @@ -114,8 +115,12 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) for(j=4; j<=nbits; j++) { ff_init_ff_cos_tabs(j); } - for(i=0; irevtab[-split_radix_permutation(i, n, s->inverse) & (n-1)] = i; + for(i=0; ifft_permutation == FF_FFT_PERM_SWAP_LSBS) + j = (j&~3) | ((j>>1)&1) | ((j<<1)&2); + s->revtab[-split_radix_permutation(i, n, s->inverse) & (n-1)] = j; + } return 0; fail: diff --git a/mplayer/ffmpeg/libavcodec/fft.h b/mplayer/ffmpeg/libavcodec/fft.h index a398d92d..1f7e9dfb 100644 --- a/mplayer/ffmpeg/libavcodec/fft.h +++ b/mplayer/ffmpeg/libavcodec/fft.h @@ -44,7 +44,10 @@ struct FFTContext { void (*imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input); void (*imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input); void (*mdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input); - int permutation; + int fft_permutation; +#define FF_FFT_PERM_DEFAULT 0 +#define FF_FFT_PERM_SWAP_LSBS 1 + int mdct_permutation; #define FF_MDCT_PERM_NONE 0 #define FF_MDCT_PERM_INTERLEAVE 1 }; diff --git a/mplayer/ffmpeg/libavcodec/flashsv.c b/mplayer/ffmpeg/libavcodec/flashsv.c index 08748c65..f5ffca08 100644 --- a/mplayer/ffmpeg/libavcodec/flashsv.c +++ b/mplayer/ffmpeg/libavcodec/flashsv.c @@ -133,8 +133,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, /* the block size could change between frames, make sure the buffer * is large enough, if not, get a larger one */ if(s->block_size < s->block_width*s->block_height) { - if (s->tmpblock != NULL) - av_free(s->tmpblock); + av_free(s->tmpblock); if ((s->tmpblock = av_malloc(3*s->block_width*s->block_height)) == NULL) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return -1; @@ -243,8 +242,7 @@ static av_cold int flashsv_decode_end(AVCodecContext *avctx) avctx->release_buffer(avctx, &s->frame); /* free the tmpblock */ - if (s->tmpblock != NULL) - av_free(s->tmpblock); + av_free(s->tmpblock); return 0; } diff --git a/mplayer/ffmpeg/libavcodec/flvdec.c b/mplayer/ffmpeg/libavcodec/flvdec.c index b1a75781..cf4dfe43 100644 --- a/mplayer/ffmpeg/libavcodec/flvdec.c +++ b/mplayer/ffmpeg/libavcodec/flvdec.c @@ -20,7 +20,7 @@ #include "mpegvideo.h" #include "h263.h" #include "flv.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last){ int is11 = get_bits1(gb); diff --git a/mplayer/ffmpeg/libavcodec/fmtconvert.c b/mplayer/ffmpeg/libavcodec/fmtconvert.c new file mode 100644 index 00000000..e26b8997 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/fmtconvert.c @@ -0,0 +1,68 @@ +/* + * Format Conversion Utils + * Copyright (c) 2000, 2001 Fabrice Bellard + * Copyright (c) 2002-2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avcodec.h" +#include "fmtconvert.h" + +static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, int len){ + int i; + for(i=0; iint32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c; + c->float_to_int16 = float_to_int16_c; + c->float_to_int16_interleave = float_to_int16_interleave_c; + + if (ARCH_ARM) ff_fmt_convert_init_arm(c, avctx); + if (ARCH_PPC) ff_fmt_convert_init_ppc(c, avctx); + if (HAVE_MMX) ff_fmt_convert_init_x86(c, avctx); +} diff --git a/mplayer/ffmpeg/libavcodec/fmtconvert.h b/mplayer/ffmpeg/libavcodec/fmtconvert.h new file mode 100644 index 00000000..f2ee261f --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/fmtconvert.h @@ -0,0 +1,79 @@ +/* + * Format Conversion Utils + * Copyright (c) 2000, 2001 Fabrice Bellard + * Copyright (c) 2002-2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_FMTCONVERT_H +#define AVCODEC_FMTCONVERT_H + +#include "avcodec.h" + +typedef struct FmtConvertContext { + /** + * Convert an array of int32_t to float and multiply by a float value. + * @param dst destination array of float. + * constraints: 16-byte aligned + * @param src source array of int32_t. + * constraints: 16-byte aligned + * @param len number of elements to convert. + * constraints: multiple of 8 + */ + void (*int32_to_float_fmul_scalar)(float *dst, const int *src, float mul, int len); + + /** + * Convert an array of float to an array of int16_t. + * + * Convert floats from in the range [-32768.0,32767.0] to ints + * without rescaling + * + * @param dst destination array of int16_t. + * constraints: 16-byte aligned + * @param src source array of float. + * constraints: 16-byte aligned + * @param len number of elements to convert. + * constraints: multiple of 8 + */ + void (*float_to_int16)(int16_t *dst, const float *src, long len); + + /** + * Convert multiple arrays of float to an interleaved array of int16_t. + * + * Convert floats from in the range [-32768.0,32767.0] to ints + * without rescaling + * + * @param dst destination array of interleaved int16_t. + * constraints: 16-byte aligned + * @param src source array of float arrays, one for each channel. + * constraints: 16-byte aligned + * @param len number of elements to convert. + * constraints: multiple of 8 + * @param channels number of channels + */ + void (*float_to_int16_interleave)(int16_t *dst, const float **src, + long len, int channels); +} FmtConvertContext; + +void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx); + +void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx); +void ff_fmt_convert_init_ppc(FmtConvertContext *c, AVCodecContext *avctx); +void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx); + +#endif /* AVCODEC_FMTCONVERT_H */ diff --git a/mplayer/ffmpeg/libavcodec/gekkothread.c b/mplayer/ffmpeg/libavcodec/gekkothread.c deleted file mode 100644 index d328643a..00000000 --- a/mplayer/ffmpeg/libavcodec/gekkothread.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2009 rodries - * - */ - -#include "avcodec.h" - -#include -#include -//#include "mp_msg.h" - -typedef struct ThreadContext{ - AVCodecContext *avctx; - lwp_t thread; - sem_t work_sem; - sem_t done_sem; - int (*func)(AVCodecContext *c, void *arg); - void *arg; - int ret; -}ThreadContext; - - -static void * thread_func(void *v) -{ - ThreadContext *c= v; - - while(1) - { - //mp_msg(MSGT_VO, MSGL_ERR,"thread_func Lock work_sem %i\n",c->work_sem); - LWP_SemWait(c->work_sem); - //mp_msg(MSGT_VO, MSGL_ERR,"thread_func pass Lock work_sem %i, exec\n",c->work_sem); - if(c->func) - c->ret= c->func(c->avctx, c->arg); - else - { - return NULL; - } - //mp_msg(MSGT_VO, MSGL_ERR,"thread_func UnLock done_sem %i\n",c->thread); - LWP_SemPost(c->done_sem); - } - return NULL; -} - -/** - * Free what has been allocated by avcodec_thread_init(). - * Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running. - */ -void avcodec_thread_free(AVCodecContext *s) -{ - ThreadContext *c= s->thread_opaque; - int i; - - for(i=0; ithread_count; i++) - { - c[i].func= NULL; - LWP_SemPost(c[i].work_sem); - LWP_JoinThread(c[i].thread, NULL); - LWP_SemDestroy(c[i].work_sem); - LWP_SemDestroy(c[i].done_sem); - } - av_freep(&s->thread_opaque); -} - -int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){ - ThreadContext *c= s->thread_opaque; - int i; - - - assert(s == c->avctx); - assert(count <= s->thread_count); - - /* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */ - - for(i=0; ithread_count = thread_count; - - assert(!s->thread_opaque); - c= av_mallocz(sizeof(ThreadContext)*thread_count); - s->thread_opaque= c; - - for(i=0; iexecute= avcodec_thread_execute; -//mp_msg(MSGT_VO, MSGL_ERR,"threads ok\n");sleep(8); - return 0; -fail: -//mp_msg(MSGT_VO, MSGL_ERR,"error threads\n");sleep(4); - avcodec_thread_free(s); - return -1; -} diff --git a/mplayer/ffmpeg/libavcodec/gifdec.c b/mplayer/ffmpeg/libavcodec/gifdec.c index 7be284cb..39d0db9c 100644 --- a/mplayer/ffmpeg/libavcodec/gifdec.c +++ b/mplayer/ffmpeg/libavcodec/gifdec.c @@ -22,7 +22,7 @@ //#define DEBUG -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "bytestream.h" #include "lzw.h" diff --git a/mplayer/ffmpeg/libavcodec/h264.c b/mplayer/ffmpeg/libavcodec/h264.c index 2a3357b0..5ebf929e 100644 --- a/mplayer/ffmpeg/libavcodec/h264.c +++ b/mplayer/ffmpeg/libavcodec/h264.c @@ -25,7 +25,7 @@ * @author Michael Niedermayer */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "internal.h" #include "dsputil.h" #include "avcodec.h" @@ -1677,6 +1677,33 @@ static void clone_slice(H264Context *dst, H264Context *src) memcpy(dst->dequant8_coeff, src->dequant8_coeff, sizeof(src->dequant8_coeff)); } +/** + * computes profile from profile_idc and constraint_set?_flags + * + * @param sps SPS + * + * @return profile as defined by FF_PROFILE_H264_* + */ +int ff_h264_get_profile(SPS *sps) +{ + int profile = sps->profile_idc; + + switch(sps->profile_idc) { + case FF_PROFILE_H264_BASELINE: + // constraint_set1_flag set to 1 + profile |= (sps->constraint_set_flags & 1<<1) ? FF_PROFILE_H264_CONSTRAINED : 0; + break; + case FF_PROFILE_H264_HIGH_10: + case FF_PROFILE_H264_HIGH_422: + case FF_PROFILE_H264_HIGH_444_PREDICTIVE: + // constraint_set3_flag set to 1 + profile |= (sps->constraint_set_flags & 1<<3) ? FF_PROFILE_H264_INTRA : 0; + break; + } + + return profile; +} + /** * decodes a slice header. * This will also call MPV_common_init() and frame_start() as needed. @@ -1756,7 +1783,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ } h->sps = *h0->sps_buffers[h->pps.sps_id]; - s->avctx->profile = h->sps.profile_idc; + s->avctx->profile = ff_h264_get_profile(&h->sps); s->avctx->level = h->sps.level_idc; s->avctx->refs = h->sps.ref_frame_count; @@ -3359,6 +3386,22 @@ av_cold int ff_h264_decode_end(AVCodecContext *avctx) return 0; } +static const AVProfile profiles[] = { + { FF_PROFILE_H264_BASELINE, "Baseline" }, + { FF_PROFILE_H264_CONSTRAINED_BASELINE, "Constrained Baseline" }, + { FF_PROFILE_H264_MAIN, "Main" }, + { FF_PROFILE_H264_EXTENDED, "Extended" }, + { FF_PROFILE_H264_HIGH, "High" }, + { FF_PROFILE_H264_HIGH_10, "High 10" }, + { FF_PROFILE_H264_HIGH_10_INTRA, "High 10 Intra" }, + { FF_PROFILE_H264_HIGH_422, "High 4:2:2" }, + { FF_PROFILE_H264_HIGH_422_INTRA, "High 4:2:2 Intra" }, + { FF_PROFILE_H264_HIGH_444, "High 4:4:4" }, + { FF_PROFILE_H264_HIGH_444_PREDICTIVE, "High 4:4:4 Predictive" }, + { FF_PROFILE_H264_HIGH_444_INTRA, "High 4:4:4 Intra" }, + { FF_PROFILE_H264_CAVLC_444, "CAVLC 4:4:4" }, + { FF_PROFILE_UNKNOWN }, +}; AVCodec ff_h264_decoder = { "h264", @@ -3372,6 +3415,7 @@ AVCodec ff_h264_decoder = { /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY, .flush= flush_dpb, .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), + .profiles = NULL_IF_CONFIG_SMALL(profiles), }; #if CONFIG_H264_VDPAU_DECODER @@ -3388,5 +3432,6 @@ AVCodec ff_h264_vdpau_decoder = { .flush= flush_dpb, .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)"), .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_H264, PIX_FMT_NONE}, + .profiles = NULL_IF_CONFIG_SMALL(profiles), }; #endif diff --git a/mplayer/ffmpeg/libavcodec/h264.h b/mplayer/ffmpeg/libavcodec/h264.h index f4f9b257..b4039684 100644 --- a/mplayer/ffmpeg/libavcodec/h264.h +++ b/mplayer/ffmpeg/libavcodec/h264.h @@ -209,6 +209,7 @@ typedef struct SPS{ int bit_depth_luma; ///< bit_depth_luma_minus8 + 8 int bit_depth_chroma; ///< bit_depth_chroma_minus8 + 8 int residual_color_transform_flag; ///< residual_colour_transform_flag + int constraint_set_flags; ///< constraint_set[0-3]_flag }SPS; /** @@ -611,6 +612,11 @@ int ff_h264_decode_sei(H264Context *h); */ int ff_h264_decode_seq_parameter_set(H264Context *h); +/** + * compute profile from sps + */ +int ff_h264_get_profile(SPS *sps); + /** * Decode PPS */ diff --git a/mplayer/ffmpeg/libavcodec/h264_parser.c b/mplayer/ffmpeg/libavcodec/h264_parser.c index 51760dcf..c5728e26 100644 --- a/mplayer/ffmpeg/libavcodec/h264_parser.c +++ b/mplayer/ffmpeg/libavcodec/h264_parser.c @@ -187,7 +187,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, h->sps = *h->sps_buffers[h->pps.sps_id]; h->frame_num = get_bits(&h->s.gb, h->sps.log2_max_frame_num); - avctx->profile = h->sps.profile_idc; + avctx->profile = ff_h264_get_profile(&h->sps); avctx->level = h->sps.level_idc; if(h->sps.frame_mbs_only_flag){ diff --git a/mplayer/ffmpeg/libavcodec/h264_ps.c b/mplayer/ffmpeg/libavcodec/h264_ps.c index 876bcb2a..469d3d8b 100644 --- a/mplayer/ffmpeg/libavcodec/h264_ps.c +++ b/mplayer/ffmpeg/libavcodec/h264_ps.c @@ -25,7 +25,7 @@ * @author Michael Niedermayer */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "internal.h" #include "dsputil.h" #include "avcodec.h" @@ -267,16 +267,16 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_s int ff_h264_decode_seq_parameter_set(H264Context *h){ MpegEncContext * const s = &h->s; - int profile_idc, level_idc; + int profile_idc, level_idc, constraint_set_flags = 0; unsigned int sps_id; int i; SPS *sps; profile_idc= get_bits(&s->gb, 8); - get_bits1(&s->gb); //constraint_set0_flag - get_bits1(&s->gb); //constraint_set1_flag - get_bits1(&s->gb); //constraint_set2_flag - get_bits1(&s->gb); //constraint_set3_flag + constraint_set_flags |= get_bits1(&s->gb) << 0; //constraint_set0_flag + constraint_set_flags |= get_bits1(&s->gb) << 1; //constraint_set1_flag + constraint_set_flags |= get_bits1(&s->gb) << 2; //constraint_set2_flag + constraint_set_flags |= get_bits1(&s->gb) << 3; //constraint_set3_flag get_bits(&s->gb, 4); // reserved level_idc= get_bits(&s->gb, 8); sps_id= get_ue_golomb_31(&s->gb); @@ -291,6 +291,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){ sps->time_offset_length = 24; sps->profile_idc= profile_idc; + sps->constraint_set_flags = constraint_set_flags; sps->level_idc= level_idc; memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4)); diff --git a/mplayer/ffmpeg/libavcodec/h264dsp.c b/mplayer/ffmpeg/libavcodec/h264dsp.c index e7792cdb..fc4f0298 100644 --- a/mplayer/ffmpeg/libavcodec/h264dsp.c +++ b/mplayer/ffmpeg/libavcodec/h264dsp.c @@ -316,6 +316,6 @@ void ff_h264dsp_init(H264DSPContext *c) c->h264_loop_filter_strength= NULL; if (ARCH_ARM) ff_h264dsp_init_arm(c); - if (HAVE_ALTIVEC || HAVE_PAIRED) ff_h264dsp_init_ppc(c); + if (ARCH_PPC) ff_h264dsp_init_ppc(c); if (HAVE_MMX) ff_h264dsp_init_x86(c); } diff --git a/mplayer/ffmpeg/libavcodec/h264pred.c b/mplayer/ffmpeg/libavcodec/h264pred.c index 0a194a50..3c691adb 100644 --- a/mplayer/ffmpeg/libavcodec/h264pred.c +++ b/mplayer/ffmpeg/libavcodec/h264pred.c @@ -1363,7 +1363,7 @@ void ff_h264_pred_init(H264PredContext *h, int codec_id){ h->pred16x16_add[VERT_PRED8x8]= pred16x16_vertical_add_c; h->pred16x16_add[ HOR_PRED8x8]= pred16x16_horizontal_add_c; - if (ARCH_ARM) ff_h264_pred_init_arm(h, codec_id); + if (ARCH_ARM) ff_h264_pred_init_arm(h, codec_id); if (HAVE_PAIRED) ff_h264_pred_init_ppc(h, codec_id); - if (HAVE_MMX) ff_h264_pred_init_x86(h, codec_id); + if (HAVE_MMX) ff_h264_pred_init_x86(h, codec_id); } diff --git a/mplayer/ffmpeg/libavcodec/huffyuv.c b/mplayer/ffmpeg/libavcodec/huffyuv.c index 2eb5864c..f81a042c 100644 --- a/mplayer/ffmpeg/libavcodec/huffyuv.c +++ b/mplayer/ffmpeg/libavcodec/huffyuv.c @@ -32,6 +32,7 @@ #include "get_bits.h" #include "put_bits.h" #include "dsputil.h" +#include "thread.h" #define VLC_BITS 11 @@ -527,6 +528,28 @@ s->bgr32=1; return 0; } + +static av_cold int decode_init_thread_copy(AVCodecContext *avctx) +{ + HYuvContext *s = avctx->priv_data; + int i; + + avctx->coded_frame= &s->picture; + alloc_temp(s); + + for (i = 0; i < 6; i++) + s->vlc[i].table = NULL; + + if(s->version==2){ + if(read_huffman_tables(s, ((uint8_t*)avctx->extradata)+4, avctx->extradata_size) < 0) + return -1; + }else{ + if(read_old_huffman_tables(s) < 0) + return -1; + } + + return 0; +} #endif /* CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER */ #if CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER @@ -950,10 +973,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac s->dsp.bswap_buf((uint32_t*)s->bitstream_buffer, (const uint32_t*)buf, buf_size/4); if(p->data[0]) - avctx->release_buffer(avctx, p); + ff_thread_release_buffer(avctx, p); p->reference= 0; - if(avctx->get_buffer(avctx, p) < 0){ + if(ff_thread_get_buffer(avctx, p) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } @@ -1425,8 +1448,9 @@ AVCodec ff_huffyuv_decoder = { NULL, decode_end, decode_frame, - CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND, + CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS, NULL, + .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy), .long_name = NULL_IF_CONFIG_SMALL("Huffyuv / HuffYUV"), }; #endif @@ -1441,8 +1465,9 @@ AVCodec ff_ffvhuff_decoder = { NULL, decode_end, decode_frame, - CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND, + CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS, NULL, + .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy), .long_name = NULL_IF_CONFIG_SMALL("Huffyuv FFmpeg variant"), }; #endif diff --git a/mplayer/ffmpeg/libavcodec/iff.c b/mplayer/ffmpeg/libavcodec/iff.c index 18ad7004..e64ce1ee 100644 --- a/mplayer/ffmpeg/libavcodec/iff.c +++ b/mplayer/ffmpeg/libavcodec/iff.c @@ -25,7 +25,7 @@ * IFF PBM/ILBM bitmap decoder */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "bytestream.h" #include "avcodec.h" #include "get_bits.h" diff --git a/mplayer/ffmpeg/libavcodec/imc.c b/mplayer/ffmpeg/libavcodec/imc.c index 4d7fbd1d..4cbb287a 100644 --- a/mplayer/ffmpeg/libavcodec/imc.c +++ b/mplayer/ffmpeg/libavcodec/imc.c @@ -40,6 +40,7 @@ #include "get_bits.h" #include "dsputil.h" #include "fft.h" +#include "libavutil/audioconvert.h" #include "imcdata.h" @@ -157,7 +158,7 @@ static av_cold int imc_decode_init(AVCodecContext * avctx) ff_fft_init(&q->fft, 7, 1); dsputil_init(&q->dsp, avctx); avctx->sample_fmt = AV_SAMPLE_FMT_FLT; - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; return 0; } diff --git a/mplayer/ffmpeg/libavcodec/imgconvert.c b/mplayer/ffmpeg/libavcodec/imgconvert.c index 143e5711..df85ca95 100644 --- a/mplayer/ffmpeg/libavcodec/imgconvert.c +++ b/mplayer/ffmpeg/libavcodec/imgconvert.c @@ -36,8 +36,7 @@ #include "imgconvert.h" #include "libavutil/colorspace.h" #include "libavutil/pixdesc.h" -#include "libavcore/imgutils.h" -#include "libavcore/internal.h" +#include "libavutil/imgutils.h" #if ARCH_PPC #include "ppc/deinterlace.h" diff --git a/mplayer/ffmpeg/libavcodec/indeo3.c b/mplayer/ffmpeg/libavcodec/indeo3.c index 5c4cd056..c9d85736 100644 --- a/mplayer/ffmpeg/libavcodec/indeo3.c +++ b/mplayer/ffmpeg/libavcodec/indeo3.c @@ -23,7 +23,7 @@ #include #include -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "bytestream.h" diff --git a/mplayer/ffmpeg/libavcodec/ivi_dsp.c b/mplayer/ffmpeg/libavcodec/ivi_dsp.c index ccaffd45..913fdc31 100644 --- a/mplayer/ffmpeg/libavcodec/ivi_dsp.c +++ b/mplayer/ffmpeg/libavcodec/ivi_dsp.c @@ -461,7 +461,7 @@ void ff_ivi_mc_ ## size ##x## size ## suffix (int16_t *buf, const int16_t *ref_b #define OP_PUT(a, b) (a) = (b) #define OP_ADD(a, b) (a) += (b) -IVI_MC_TEMPLATE(8, _no_delta, OP_PUT); -IVI_MC_TEMPLATE(8, _delta, OP_ADD); -IVI_MC_TEMPLATE(4, _no_delta, OP_PUT); -IVI_MC_TEMPLATE(4, _delta, OP_ADD); +IVI_MC_TEMPLATE(8, _no_delta, OP_PUT) +IVI_MC_TEMPLATE(8, _delta, OP_ADD) +IVI_MC_TEMPLATE(4, _no_delta, OP_PUT) +IVI_MC_TEMPLATE(4, _delta, OP_ADD) diff --git a/mplayer/ffmpeg/libavcodec/kgv1dec.c b/mplayer/ffmpeg/libavcodec/kgv1dec.c index efc477f3..2f6a80c2 100644 --- a/mplayer/ffmpeg/libavcodec/kgv1dec.c +++ b/mplayer/ffmpeg/libavcodec/kgv1dec.c @@ -25,7 +25,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" typedef struct { diff --git a/mplayer/ffmpeg/libavcodec/lagarith.c b/mplayer/ffmpeg/libavcodec/lagarith.c index 89580dc1..d53cd05c 100644 --- a/mplayer/ffmpeg/libavcodec/lagarith.c +++ b/mplayer/ffmpeg/libavcodec/lagarith.c @@ -510,7 +510,7 @@ static av_cold int lag_decode_end(AVCodecContext *avctx) AVCodec ff_lagarith_decoder = { "lagarith", - CODEC_TYPE_VIDEO, + AVMEDIA_TYPE_VIDEO, CODEC_ID_LAGARITH, sizeof(LagarithContext), lag_decode_init, diff --git a/mplayer/ffmpeg/libavcodec/libdiracdec.c b/mplayer/ffmpeg/libavcodec/libdiracdec.c index 520ec3f0..fb6ff45f 100644 --- a/mplayer/ffmpeg/libavcodec/libdiracdec.c +++ b/mplayer/ffmpeg/libavcodec/libdiracdec.c @@ -28,7 +28,7 @@ * (http://dirac.sourceforge.net/specification.html). */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "libdirac.h" #undef NDEBUG diff --git a/mplayer/ffmpeg/libavcodec/libopenjpeg.c b/mplayer/ffmpeg/libavcodec/libopenjpeg.c index 0a9ded89..1f8530c7 100644 --- a/mplayer/ffmpeg/libavcodec/libopenjpeg.c +++ b/mplayer/ffmpeg/libavcodec/libopenjpeg.c @@ -24,7 +24,7 @@ * JPEG 2000 decoder using libopenjpeg */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "libavutil/intreadwrite.h" #define OPJ_STATIC diff --git a/mplayer/ffmpeg/libavcodec/libschroedingerdec.c b/mplayer/ffmpeg/libavcodec/libschroedingerdec.c index e733d9e3..7603f7e1 100644 --- a/mplayer/ffmpeg/libavcodec/libschroedingerdec.c +++ b/mplayer/ffmpeg/libavcodec/libschroedingerdec.c @@ -27,7 +27,7 @@ * (http://dirac.sourceforge.net/specification.html). */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "libdirac_libschro.h" #include "libschroedinger.h" diff --git a/mplayer/ffmpeg/libavcodec/libvpxdec.c b/mplayer/ffmpeg/libavcodec/libvpxdec.c index f912322c..29b8eec4 100644 --- a/mplayer/ffmpeg/libavcodec/libvpxdec.c +++ b/mplayer/ffmpeg/libavcodec/libvpxdec.c @@ -27,7 +27,7 @@ #include #include -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" typedef struct VP8DecoderContext { diff --git a/mplayer/ffmpeg/libavcodec/libx264.c b/mplayer/ffmpeg/libavcodec/libx264.c index 84ecb2ae..185287c1 100644 --- a/mplayer/ffmpeg/libavcodec/libx264.c +++ b/mplayer/ffmpeg/libavcodec/libx264.c @@ -277,12 +277,11 @@ static av_cold int X264_init(AVCodecContext *avctx) if (avctx->level > 0) x4->params.i_level_idc = avctx->level; - if ((avctx->rc_buffer_size != 0) && + if (avctx->rc_buffer_size && avctx->rc_initial_buffer_occupancy && (avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) { x4->params.rc.f_vbv_buffer_init = (float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size; - } else - x4->params.rc.f_vbv_buffer_init = 0.9; + } x4->params.rc.b_mb_tree = !!(avctx->flags2 & CODEC_FLAG2_MBTREE); x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor); diff --git a/mplayer/ffmpeg/libavcodec/libxvidff.c b/mplayer/ffmpeg/libavcodec/libxvidff.c index d95ddee8..9008b848 100644 --- a/mplayer/ffmpeg/libavcodec/libxvidff.c +++ b/mplayer/ffmpeg/libavcodec/libxvidff.c @@ -527,18 +527,14 @@ static av_cold int xvid_encode_close(AVCodecContext *avctx) { xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL); - if( avctx->extradata != NULL ) - av_freep(&avctx->extradata); + av_freep(&avctx->extradata); if( x->twopassbuffer != NULL ) { av_free(x->twopassbuffer); av_free(x->old_twopassbuffer); } - if( x->twopassfile != NULL ) - av_free(x->twopassfile); - if( x->intra_matrix != NULL ) - av_free(x->intra_matrix); - if( x->inter_matrix != NULL ) - av_free(x->inter_matrix); + av_free(x->twopassfile); + av_free(x->intra_matrix); + av_free(x->inter_matrix); return 0; } diff --git a/mplayer/ffmpeg/libavcodec/mdct.c b/mplayer/ffmpeg/libavcodec/mdct.c index c511188d..31e2216d 100644 --- a/mplayer/ffmpeg/libavcodec/mdct.c +++ b/mplayer/ffmpeg/libavcodec/mdct.c @@ -71,7 +71,7 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale) s->mdct_bits = nbits; s->mdct_size = n; n4 = n >> 2; - s->permutation = FF_MDCT_PERM_NONE; + s->mdct_permutation = FF_MDCT_PERM_NONE; if (ff_fft_init(s, s->mdct_bits - 2, inverse) < 0) goto fail; @@ -80,7 +80,7 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale) if (!s->tcos) goto fail; - switch (s->permutation) { + switch (s->mdct_permutation) { case FF_MDCT_PERM_NONE: s->tsin = s->tcos + n4; tstep = 1; @@ -202,7 +202,7 @@ void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input) /* pre rotation */ for(i=0;i -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "mjpeg.h" @@ -1547,7 +1547,7 @@ AVCodec ff_mjpeg_decoder = { ff_mjpeg_decode_frame, CODEC_CAP_DR1, NULL, - .max_lowres = 4, + .max_lowres = 3, .long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"), }; diff --git a/mplayer/ffmpeg/libavcodec/mpc7.c b/mplayer/ffmpeg/libavcodec/mpc7.c index a77648f7..04657e5f 100644 --- a/mplayer/ffmpeg/libavcodec/mpc7.c +++ b/mplayer/ffmpeg/libavcodec/mpc7.c @@ -30,6 +30,7 @@ #include "get_bits.h" #include "dsputil.h" #include "mpegaudio.h" +#include "libavutil/audioconvert.h" #include "mpc.h" #include "mpc7data.h" @@ -86,7 +87,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx) c->frames_to_skip = 0; avctx->sample_fmt = AV_SAMPLE_FMT_S16; - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; if(vlc_initialized) return 0; av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n"); diff --git a/mplayer/ffmpeg/libavcodec/mpc8.c b/mplayer/ffmpeg/libavcodec/mpc8.c index 327a0c02..cf65ffe9 100644 --- a/mplayer/ffmpeg/libavcodec/mpc8.c +++ b/mplayer/ffmpeg/libavcodec/mpc8.c @@ -30,6 +30,7 @@ #include "get_bits.h" #include "dsputil.h" #include "mpegaudio.h" +#include "libavutil/audioconvert.h" #include "mpc.h" #include "mpcdata.h" @@ -135,7 +136,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx) c->frames = 1 << (get_bits(&gb, 3) * 2); avctx->sample_fmt = AV_SAMPLE_FMT_S16; - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; if(vlc_initialized) return 0; av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n"); diff --git a/mplayer/ffmpeg/libavcodec/mpeg4audio.h b/mplayer/ffmpeg/libavcodec/mpeg4audio.h index b9418507..174624e1 100644 --- a/mplayer/ffmpeg/libavcodec/mpeg4audio.h +++ b/mplayer/ffmpeg/libavcodec/mpeg4audio.h @@ -57,7 +57,7 @@ enum AudioObjectType { AOT_AAC_MAIN, ///< Y Main AOT_AAC_LC, ///< Y Low Complexity AOT_AAC_SSR, ///< N (code in SoC repo) Scalable Sample Rate - AOT_AAC_LTP, ///< N (code in SoC repo) Long Term Prediction + AOT_AAC_LTP, ///< Y Long Term Prediction AOT_SBR, ///< Y Spectral Band Replication AOT_AAC_SCALABLE, ///< N Scalable AOT_TWINVQ, ///< N Twin Vector Quantizer diff --git a/mplayer/ffmpeg/libavcodec/mpeg4data.h b/mplayer/ffmpeg/libavcodec/mpeg4data.h index bef5f880..1f4e578c 100644 --- a/mplayer/ffmpeg/libavcodec/mpeg4data.h +++ b/mplayer/ffmpeg/libavcodec/mpeg4data.h @@ -115,7 +115,7 @@ RLTable ff_mpeg4_rl_intra = { }; /* Note this is identical to the intra rvlc except that it is reordered. */ -const uint16_t inter_rvlc[170][2]={ +static const uint16_t inter_rvlc[170][2]={ {0x0006, 3},{0x0001, 4},{0x0004, 5},{0x001C, 7}, {0x003C, 8},{0x003D, 8},{0x007C, 9},{0x00FC, 10}, {0x00FD, 10},{0x01FC, 11},{0x01FD, 11},{0x03FC, 12}, @@ -219,7 +219,7 @@ RLTable rvlc_rl_inter = { inter_rvlc_level, }; -const uint16_t intra_rvlc[170][2]={ +static const uint16_t intra_rvlc[170][2]={ {0x0006, 3},{0x0007, 3},{0x000A, 4},{0x0009, 5}, {0x0014, 6},{0x0015, 6},{0x0034, 7},{0x0074, 8}, {0x0075, 8},{0x00DD, 9},{0x00EC, 9},{0x01EC, 10}, diff --git a/mplayer/ffmpeg/libavcodec/mpeg4video.h b/mplayer/ffmpeg/libavcodec/mpeg4video.h index aab32364..96db3668 100644 --- a/mplayer/ffmpeg/libavcodec/mpeg4video.h +++ b/mplayer/ffmpeg/libavcodec/mpeg4video.h @@ -66,10 +66,7 @@ extern const uint16_t ff_mpeg4_intra_vlc[103][2]; extern RLTable ff_mpeg4_rl_intra; /* Note this is identical to the intra rvlc except that it is reordered. */ -extern const uint16_t inter_rvlc[170][2]; extern RLTable rvlc_rl_inter; - -extern const uint16_t intra_rvlc[170][2]; extern RLTable rvlc_rl_intra; extern const uint16_t sprite_trajectory_tab[15][2]; diff --git a/mplayer/ffmpeg/libavcodec/mpeg4videodec.c b/mplayer/ffmpeg/libavcodec/mpeg4videodec.c index 5303da38..617dcb9f 100644 --- a/mplayer/ffmpeg/libavcodec/mpeg4videodec.c +++ b/mplayer/ffmpeg/libavcodec/mpeg4videodec.c @@ -1494,16 +1494,17 @@ static int mpeg4_decode_mb(MpegEncContext *s, static int mpeg4_decode_gop_header(MpegEncContext * s, GetBitContext *gb){ int hours, minutes, seconds; - - hours= get_bits(gb, 5); - minutes= get_bits(gb, 6); - skip_bits1(gb); - seconds= get_bits(gb, 6); - - s->time_base= seconds + 60*(minutes + 60*hours); - - skip_bits1(gb); - skip_bits1(gb); + unsigned time_code = show_bits(gb, 18); + + if (time_code & 0x40) { /* marker_bit */ + hours = time_code >> 13; + minutes = time_code >> 7 & 0x3f; + seconds = time_code & 0x3f; + s->time_base = seconds + 60*(minutes + 60*hours); + skip_bits(gb, 20); /* time_code, closed_gov, broken_link */ + } else { + av_log(s->avctx, AV_LOG_WARNING, "GOP header missing marker_bit\n"); + } return 0; } @@ -2071,7 +2072,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){ /* detect buggy encoders which don't set the low_delay flag (divx4/xvid/opendivx)*/ // note we cannot detect divx5 without b-frames easily (although it's buggy too) if(s->vo_type==0 && s->vol_control_parameters==0 && s->divx_version==-1 && s->picture_number==0){ - av_log(s->avctx, AV_LOG_ERROR, "looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n"); + av_log(s->avctx, AV_LOG_WARNING, "looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n"); s->low_delay=1; } @@ -2110,7 +2111,7 @@ int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb) for(;;) { if(get_bits_count(gb) >= gb->size_in_bits){ if(gb->size_in_bits==8 && (s->divx_version>=0 || s->xvid_build>=0)){ - av_log(s->avctx, AV_LOG_ERROR, "frame skip %d\n", gb->size_in_bits); + av_log(s->avctx, AV_LOG_WARNING, "frame skip %d\n", gb->size_in_bits); return FRAME_SKIPPED; //divx bug }else return -1; //end of stream diff --git a/mplayer/ffmpeg/libavcodec/mpegaudiodec.c b/mplayer/ffmpeg/libavcodec/mpegaudiodec.c index 0cd0b688..aa31e46a 100644 --- a/mplayer/ffmpeg/libavcodec/mpegaudiodec.c +++ b/mplayer/ffmpeg/libavcodec/mpegaudiodec.c @@ -2054,6 +2054,7 @@ static int decode_frame(AVCodecContext * avctx, } /* update codec info */ avctx->channels = s->nb_channels; + avctx->channel_layout = s->nb_channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; if (!avctx->bit_rate) avctx->bit_rate = s->bit_rate; avctx->sub_id = s->layer; @@ -2227,8 +2228,7 @@ static av_cold int decode_close_mp3on4(AVCodecContext * avctx) int i; for (i = 0; i < s->frames; i++) - if (s->mp3decctx[i]) - av_free(s->mp3decctx[i]); + av_free(s->mp3decctx[i]); return 0; } diff --git a/mplayer/ffmpeg/libavcodec/mpegvideo.c b/mplayer/ffmpeg/libavcodec/mpegvideo.c index c8706bcf..efb03659 100644 --- a/mplayer/ffmpeg/libavcodec/mpegvideo.c +++ b/mplayer/ffmpeg/libavcodec/mpegvideo.c @@ -28,7 +28,7 @@ */ #include "libavutil/intmath.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "internal.h" diff --git a/mplayer/ffmpeg/libavcodec/mpegvideo_enc.c b/mplayer/ffmpeg/libavcodec/mpegvideo_enc.c index 6167a9b2..a7f16080 100644 --- a/mplayer/ffmpeg/libavcodec/mpegvideo_enc.c +++ b/mplayer/ffmpeg/libavcodec/mpegvideo_enc.c @@ -1381,6 +1381,7 @@ int MPV_encode_picture(AVCodecContext *avctx, s->vbv_delay_ptr[1] = vbv_delay>>5; s->vbv_delay_ptr[2] &= 0x07; s->vbv_delay_ptr[2] |= vbv_delay<<3; + avctx->vbv_delay = vbv_delay*300; } s->total_bits += s->frame_bits; avctx->frame_bits = s->frame_bits; diff --git a/mplayer/ffmpeg/libavcodec/nellymoserdec.c b/mplayer/ffmpeg/libavcodec/nellymoserdec.c index 8b13a5d8..fd8568d5 100644 --- a/mplayer/ffmpeg/libavcodec/nellymoserdec.c +++ b/mplayer/ffmpeg/libavcodec/nellymoserdec.c @@ -34,10 +34,11 @@ #include "nellymoser.h" #include "libavutil/lfg.h" #include "libavutil/random_seed.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "avcodec.h" #include "dsputil.h" #include "fft.h" +#include "fmtconvert.h" #define ALT_BITSTREAM_READER_LE #include "get_bits.h" @@ -52,6 +53,7 @@ typedef struct NellyMoserDecodeContext { float scale_bias; DSPContext dsp; FFTContext imdct_ctx; + FmtConvertContext fmt_conv; DECLARE_ALIGNED(16, float,imdct_out)[NELLY_BUF_LEN * 2]; } NellyMoserDecodeContext; @@ -134,6 +136,7 @@ static av_cold int decode_init(AVCodecContext * avctx) { ff_mdct_init(&s->imdct_ctx, 8, 1, 1.0); dsputil_init(&s->dsp, avctx); + ff_fmt_convert_init(&s->fmt_conv, avctx); s->scale_bias = 1.0/(1*8); @@ -175,7 +178,7 @@ static int decode_tag(AVCodecContext * avctx, for (i=0 ; ifloat_buf); - s->dsp.float_to_int16(&samples[i*NELLY_SAMPLES], s->float_buf, NELLY_SAMPLES); + s->fmt_conv.float_to_int16(&samples[i*NELLY_SAMPLES], s->float_buf, NELLY_SAMPLES); *data_size += NELLY_SAMPLES*sizeof(int16_t); } diff --git a/mplayer/ffmpeg/libavcodec/nuv.c b/mplayer/ffmpeg/libavcodec/nuv.c index d53d4578..84ee6af9 100644 --- a/mplayer/ffmpeg/libavcodec/nuv.c +++ b/mplayer/ffmpeg/libavcodec/nuv.c @@ -23,7 +23,7 @@ #include "libavutil/bswap.h" #include "libavutil/lzo.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "rtjpeg.h" diff --git a/mplayer/ffmpeg/libavcodec/options.c b/mplayer/ffmpeg/libavcodec/options.c index 369ee5d3..e4bc8a62 100644 --- a/mplayer/ffmpeg/libavcodec/options.c +++ b/mplayer/ffmpeg/libavcodec/options.c @@ -117,8 +117,8 @@ static const AVOption options[]={ {"delay", NULL, OFFSET(delay), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"qcomp", "video quantizer scale compression (VBR)", OFFSET(qcompress), FF_OPT_TYPE_FLOAT, 0.5, -FLT_MAX, FLT_MAX, V|E}, {"qblur", "video quantizer scale blur (VBR)", OFFSET(qblur), FF_OPT_TYPE_FLOAT, 0.5, 0, FLT_MAX, V|E}, -{"qmin", "min video quantizer scale (VBR)", OFFSET(qmin), FF_OPT_TYPE_INT, 2, 0, 63, V|E}, -{"qmax", "max video quantizer scale (VBR)", OFFSET(qmax), FF_OPT_TYPE_INT, 31, 0, 63, V|E}, +{"qmin", "min video quantizer scale (VBR)", OFFSET(qmin), FF_OPT_TYPE_INT, 2, 0, 69, V|E}, +{"qmax", "max video quantizer scale (VBR)", OFFSET(qmax), FF_OPT_TYPE_INT, 31, 0, 69, V|E}, {"qdiff", "max difference between the quantizer scale (VBR)", OFFSET(max_qdiff), FF_OPT_TYPE_INT, 3, INT_MIN, INT_MAX, V|E}, {"bf", "use 'frames' B frames", OFFSET(max_b_frames), FF_OPT_TYPE_INT, DEFAULT, 0, FF_MAX_B_FRAMES, V|E}, {"b_qfactor", "qp factor between p and b frames", OFFSET(b_quant_factor), FF_OPT_TYPE_FLOAT, 1.25, -FLT_MAX, FLT_MAX, V|E}, @@ -250,6 +250,7 @@ static const AVOption options[]={ {"vis_qp", "visualize quantization parameter (QP), lower QP are tinted greener", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_QP, INT_MIN, INT_MAX, V|D, "debug"}, {"vis_mb_type", "visualize block types", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MB_TYPE, INT_MIN, INT_MAX, V|D, "debug"}, {"buffers", "picture buffer allocations", 0, FF_OPT_TYPE_CONST, FF_DEBUG_BUFFERS, INT_MIN, INT_MAX, V|D, "debug"}, +{"thread_ops", "threading operations", 0, FF_OPT_TYPE_CONST, FF_DEBUG_THREADS, INT_MIN, INT_MAX, V|D, "debug"}, {"vismv", "visualize motion vectors (MVs)", OFFSET(debug_mv), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|D, "debug_mv"}, {"pf", "forward predicted MVs of P-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_P_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"}, {"bf", "forward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"}, @@ -431,6 +432,10 @@ static const AVOption options[]={ {"cholesky", NULL, 0, FF_OPT_TYPE_CONST, AV_LPC_TYPE_CHOLESKY, INT_MIN, INT_MAX, A|E, "lpc_type"}, {"lpc_passes", "number of passes to use for Cholesky factorization during LPC analysis", OFFSET(lpc_passes), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E}, {"slices", "number of slices, used in parallelized decoding", OFFSET(slices), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|E}, +{"thread_type", "select multithreading type", OFFSET(thread_type), FF_OPT_TYPE_INT, FF_THREAD_SLICE|FF_THREAD_FRAME, 0, INT_MAX, V|E|D, "thread_type"}, +{"slice", NULL, 0, FF_OPT_TYPE_CONST, FF_THREAD_SLICE, INT_MIN, INT_MAX, V|E|D, "thread_type"}, +{"frame", NULL, 0, FF_OPT_TYPE_CONST, FF_THREAD_FRAME, INT_MIN, INT_MAX, V|E|D, "thread_type"}, +{"vbv_delay", "initial buffer fill time in periods of 27Mhz clock", 0, FF_OPT_TYPE_INT64, 0, 0, INT64_MAX}, {NULL}, }; diff --git a/mplayer/ffmpeg/libavcodec/pcm-mpeg.c b/mplayer/ffmpeg/libavcodec/pcm-mpeg.c index 189b2b56..03050750 100644 --- a/mplayer/ffmpeg/libavcodec/pcm-mpeg.c +++ b/mplayer/ffmpeg/libavcodec/pcm-mpeg.c @@ -24,7 +24,7 @@ * PCM codecs for encodings found in MPEG streams (DVD/Blu-ray) */ -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" #include "avcodec.h" #include "bytestream.h" diff --git a/mplayer/ffmpeg/libavcodec/pcm.c b/mplayer/ffmpeg/libavcodec/pcm.c index 0785a9d2..cdc11f80 100644 --- a/mplayer/ffmpeg/libavcodec/pcm.c +++ b/mplayer/ffmpeg/libavcodec/pcm.c @@ -482,7 +482,7 @@ AVCodec ff_ ## name_ ## _encoder = { \ .close = pcm_encode_close, \ .sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ -}; +} #else #define PCM_ENCODER(id,sample_fmt_,name,long_name_) #endif @@ -498,13 +498,13 @@ AVCodec ff_ ## name_ ## _decoder = { \ .decode = pcm_decode_frame, \ .sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ -}; +} #else #define PCM_DECODER(id,sample_fmt_,name,long_name_) #endif #define PCM_CODEC(id, sample_fmt_, name, long_name_) \ - PCM_ENCODER(id,sample_fmt_,name,long_name_) PCM_DECODER(id,sample_fmt_,name,long_name_) + PCM_ENCODER(id,sample_fmt_,name,long_name_); PCM_DECODER(id,sample_fmt_,name,long_name_) /* Note: Do not forget to add new entries to the Makefile as well. */ PCM_CODEC (CODEC_ID_PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law"); diff --git a/mplayer/ffmpeg/libavcodec/pcx.c b/mplayer/ffmpeg/libavcodec/pcx.c index cafade2d..d47417e3 100644 --- a/mplayer/ffmpeg/libavcodec/pcx.c +++ b/mplayer/ffmpeg/libavcodec/pcx.c @@ -22,7 +22,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "bytestream.h" #include "get_bits.h" diff --git a/mplayer/ffmpeg/libavcodec/pgssubdec.c b/mplayer/ffmpeg/libavcodec/pgssubdec.c index 1ed47578..b7fe5609 100644 --- a/mplayer/ffmpeg/libavcodec/pgssubdec.c +++ b/mplayer/ffmpeg/libavcodec/pgssubdec.c @@ -28,7 +28,7 @@ #include "dsputil.h" #include "bytestream.h" #include "libavutil/colorspace.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" //#define DEBUG_PACKET_CONTENTS diff --git a/mplayer/ffmpeg/libavcodec/pictordec.c b/mplayer/ffmpeg/libavcodec/pictordec.c index 59885ae3..f1b36070 100644 --- a/mplayer/ffmpeg/libavcodec/pictordec.c +++ b/mplayer/ffmpeg/libavcodec/pictordec.c @@ -24,7 +24,7 @@ * Pictor/PC Paint decoder */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "bytestream.h" #include "cga_data.h" diff --git a/mplayer/ffmpeg/libavcodec/pngdec.c b/mplayer/ffmpeg/libavcodec/pngdec.c index 4bc5c370..2f9b343e 100644 --- a/mplayer/ffmpeg/libavcodec/pngdec.c +++ b/mplayer/ffmpeg/libavcodec/pngdec.c @@ -18,7 +18,7 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "bytestream.h" #include "png.h" diff --git a/mplayer/ffmpeg/libavcodec/pnm.c b/mplayer/ffmpeg/libavcodec/pnm.c index c104e234..2cbbdf60 100644 --- a/mplayer/ffmpeg/libavcodec/pnm.c +++ b/mplayer/ffmpeg/libavcodec/pnm.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "pnm.h" diff --git a/mplayer/ffmpeg/libavcodec/ppc/Makefile b/mplayer/ffmpeg/libavcodec/ppc/Makefile index b34910de..1ecae994 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/Makefile +++ b/mplayer/ffmpeg/libavcodec/ppc/Makefile @@ -21,6 +21,7 @@ ALTIVEC-OBJS-$(CONFIG_FFT) += ppc/fft_altivec.o \ OBJS-$(HAVE_ALTIVEC) += ppc/dsputil_altivec.o \ ppc/fdct_altivec.o \ ppc/float_altivec.o \ + ppc/fmtconvert_altivec.o \ ppc/gmc_altivec.o \ ppc/idct_altivec.o \ ppc/int_altivec.o \ @@ -37,4 +38,5 @@ PAIRED-OBJS-$(CONFIG_RDFT) += ppc/rdft_paired.o OBJS-$(HAVE_PAIRED) += ppc/dsputil_paired.o \ ppc/float_paired.o \ + ppc/fmtconvert_paired.o \ $(PAIRED-OBJS-yes) diff --git a/mplayer/ffmpeg/libavcodec/ppc/deinterlace.h b/mplayer/ffmpeg/libavcodec/ppc/deinterlace.h index 29f44087..3cec10d2 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/deinterlace.h +++ b/mplayer/ffmpeg/libavcodec/ppc/deinterlace.h @@ -4,7 +4,7 @@ * MPlayer CE is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * MPlayer CE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/mplayer/ffmpeg/libavcodec/ppc/dsputil_altivec.h b/mplayer/ffmpeg/libavcodec/ppc/dsputil_altivec.h index cd44f602..4147eec8 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/dsputil_altivec.h +++ b/mplayer/ffmpeg/libavcodec/ppc/dsputil_altivec.h @@ -43,7 +43,6 @@ void ff_vp3_idct_add_altivec(uint8_t *dest, int line_size, DCTELEM *block); void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx); void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx); -void vc1dsp_init_altivec(DSPContext* c, AVCodecContext *avctx); void float_init_altivec(DSPContext* c, AVCodecContext *avctx); void int_init_altivec(DSPContext* c, AVCodecContext *avctx); diff --git a/mplayer/ffmpeg/libavcodec/ppc/dsputil_paired.c b/mplayer/ffmpeg/libavcodec/ppc/dsputil_paired.c index 2e69c81f..e6fd5c06 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/dsputil_paired.c +++ b/mplayer/ffmpeg/libavcodec/ppc/dsputil_paired.c @@ -4,7 +4,7 @@ * MPlayer CE is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * MPlayer CE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -185,7 +185,7 @@ static void ac3_downmix_paired(float (*samples)[256], float (*matrix)[2], int ou paired_stx(result[1], i, samples[1]); } } else if (out_ch == 1) { - for(i=0; igmc1 = gmc1_altivec; @@ -300,8 +298,5 @@ void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) if (CONFIG_H264_DECODER) dsputil_h264_init_ppc(c, avctx); - - if (CONFIG_VC1_DECODER) - vc1dsp_init_paired(c, avctx); #endif /* HAVE_PAIRED */ } diff --git a/mplayer/ffmpeg/libavcodec/ppc/fft_paired.c b/mplayer/ffmpeg/libavcodec/ppc/fft_paired.c index 0bead577..63420fa1 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/fft_paired.c +++ b/mplayer/ffmpeg/libavcodec/ppc/fft_paired.c @@ -4,7 +4,7 @@ * MPlayer CE is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * MPlayer CE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/mplayer/ffmpeg/libavcodec/ppc/float_altivec.c b/mplayer/ffmpeg/libavcodec/ppc/float_altivec.c index 188e03ea..ba97cbfd 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/float_altivec.c +++ b/mplayer/ffmpeg/libavcodec/ppc/float_altivec.c @@ -90,13 +90,9 @@ static void vector_fmul_add_altivec(float *dst, const float *src0, } } -static void vector_fmul_window_altivec(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len) +static void vector_fmul_window_altivec(float *dst, const float *src0, const float *src1, const float *win, int len) { - union { - vector float v; - float s[4]; - } vadd; - vector float vadd_bias, zero, t0, t1, s0, s1, wi, wj; + vector float zero, t0, t1, s0, s1, wi, wj; const vector unsigned char reverse = vcprm(3,2,1,0); int i,j; @@ -104,8 +100,6 @@ static void vector_fmul_window_altivec(float *dst, const float *src0, const floa win += len; src0+= len; - vadd.s[0] = add_bias; - vadd_bias = vec_splat(vadd.v, 0); zero = (vector float)vec_splat_u32(0); for(i=-len*4, j=len*4-16; i<0; i+=16, j-=16) { @@ -117,9 +111,9 @@ static void vector_fmul_window_altivec(float *dst, const float *src0, const floa s1 = vec_perm(s1, s1, reverse); wj = vec_perm(wj, wj, reverse); - t0 = vec_madd(s0, wj, vadd_bias); + t0 = vec_madd(s0, wj, zero); t0 = vec_nmsub(s1, wi, t0); - t1 = vec_madd(s0, wi, vadd_bias); + t1 = vec_madd(s0, wi, zero); t1 = vec_madd(s1, wj, t1); t1 = vec_perm(t1, t1, reverse); @@ -128,124 +122,12 @@ static void vector_fmul_window_altivec(float *dst, const float *src0, const floa } } -static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float mul, int len) -{ - union { - vector float v; - float s[4]; - } mul_u; - int i; - vector float src1, src2, dst1, dst2, mul_v, zero; - - zero = (vector float)vec_splat_u32(0); - mul_u.s[0] = mul; - mul_v = vec_splat(mul_u.v, 0); - - for(i=0; ivector_fmul = vector_fmul_altivec; c->vector_fmul_reverse = vector_fmul_reverse_altivec; c->vector_fmul_add = vector_fmul_add_altivec; - c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_altivec; if(!(avctx->flags & CODEC_FLAG_BITEXACT)) { c->vector_fmul_window = vector_fmul_window_altivec; - c->float_to_int16 = float_to_int16_altivec; - c->float_to_int16_interleave = float_to_int16_interleave_altivec; } } diff --git a/mplayer/ffmpeg/libavcodec/ppc/float_paired.c b/mplayer/ffmpeg/libavcodec/ppc/float_paired.c index c5d8f3a9..37bd930e 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/float_paired.c +++ b/mplayer/ffmpeg/libavcodec/ppc/float_paired.c @@ -4,7 +4,7 @@ * MPlayer CE is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * MPlayer CE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -66,10 +66,9 @@ static void vector_fmul_add_paired(float *dst, const float *src0, const float *s } } -static void vector_fmul_window_paired(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len) +static void vector_fmul_window_paired(float *dst, const float *src0, const float *src1, const float *win, int len) { vector float pair[2], window[2]; - vector float bias = {add_bias,add_bias}; vector float result; dst += len; @@ -85,78 +84,17 @@ static void vector_fmul_window_paired(float *dst, const float *src0, const float window[1] = paired_lx(j, win); window[1] = paired_merge10(window[1], window[1]); - result = paired_madd(pair[0], window[1], bias); - result = ps_nmsub(pair[1], window[0], result); + result = paired_mul(pair[1], window[0]); + result = paired_msub(pair[0], window[1], result); paired_stx(result, i, dst); - result = paired_madd(pair[1], window[1], bias); + result = paired_mul(pair[1], window[1]); result = paired_madd(pair[0], window[0], result); result = paired_merge10(result, result); paired_stx(result, j, dst); } } -static void int32_to_float_fmul_scalar_paired(float *dst, const int *src, float mul, int len) -{ - vector float pair; - - for (int i=0; i>1); i++) { - vector float pair = psq_lu(8,src,0,0); - psq_stu(pair,4,dst,0,7); - } -} - -static void float_to_int16_interleave_paired(int16_t *dst, const float **src, long len, int channels) -{ - vector float pair[2]; - vector float result; - - int i, c; - if (channels > 2) { - dst -= 2; - for (i=0; ivector_fmul_reverse = vector_fmul_reverse_paired; c->vector_fmul_add = vector_fmul_add_paired; c->vector_fmul_window = vector_fmul_window_paired; - c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_paired; - c->float_to_int16 = float_to_int16_paired; - c->float_to_int16_interleave = float_to_int16_interleave_paired; c->butterflies_float = butterflies_float_paired; c->scalarproduct_float = scalarproduct_float_paired; c->vector_fmul_scalar = vector_fmul_scalar_paired; diff --git a/mplayer/ffmpeg/libavcodec/ppc/fmtconvert_altivec.c b/mplayer/ffmpeg/libavcodec/ppc/fmtconvert_altivec.c new file mode 100644 index 00000000..e5287c96 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/ppc/fmtconvert_altivec.c @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2006 Luca Barbato + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/fmtconvert.h" + +#include "dsputil_altivec.h" +#include "util_altivec.h" + +static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float mul, int len) +{ + union { + vector float v; + float s[4]; + } mul_u; + int i; + vector float src1, src2, dst1, dst2, mul_v, zero; + + zero = (vector float)vec_splat_u32(0); + mul_u.s[0] = mul; + mul_v = vec_splat(mul_u.v, 0); + + for(i=0; iint32_to_float_fmul_scalar = int32_to_float_fmul_scalar_altivec; + if(!(avctx->flags & CODEC_FLAG_BITEXACT)) { + c->float_to_int16 = float_to_int16_altivec; + c->float_to_int16_interleave = float_to_int16_interleave_altivec; + } +} diff --git a/mplayer/ffmpeg/libavcodec/ppc/fmtconvert_paired.c b/mplayer/ffmpeg/libavcodec/ppc/fmtconvert_paired.c new file mode 100644 index 00000000..451fc778 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/ppc/fmtconvert_paired.c @@ -0,0 +1,89 @@ +/* + * This file is part of MPlayer CE. + * + * MPlayer CE is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * MPlayer CE 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with MPlayer CE; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/fmtconvert.h" +#include "dsputil_paired.h" +#include "libavutil/ppc/paired.h" + +static void int32_to_float_fmul_scalar_paired(float *dst, const int *src, float mul, int len) +{ + vector float pair; + + for (int i=0; i>1); i++) { + vector float pair = psq_lu(8,src,0,0); + psq_stu(pair,4,dst,0,7); + } +} + +static void float_to_int16_interleave_paired(int16_t *dst, const float **src, long len, int channels) +{ + vector float pair[2]; + vector float result; + + int i, c; + if (channels > 2) { + dst -= 2; + for (i=0; iint32_to_float_fmul_scalar = int32_to_float_fmul_scalar_paired; + c->float_to_int16 = float_to_int16_paired; + c->float_to_int16_interleave = float_to_int16_interleave_paired; +} diff --git a/mplayer/ffmpeg/libavcodec/ppc/h264_altivec.c b/mplayer/ffmpeg/libavcodec/ppc/h264_altivec.c index aee2bc2d..ef95de1b 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/h264_altivec.c +++ b/mplayer/ffmpeg/libavcodec/ppc/h264_altivec.c @@ -32,7 +32,6 @@ #define OP_U8_ALTIVEC PUT_OP_U8_ALTIVEC #define PREFIX_h264_chroma_mc8_altivec put_h264_chroma_mc8_altivec -#define PREFIX_no_rnd_vc1_chroma_mc8_altivec put_no_rnd_vc1_chroma_mc8_altivec #define PREFIX_h264_chroma_mc8_num altivec_put_h264_chroma_mc8_num #define PREFIX_h264_qpel16_h_lowpass_altivec put_h264_qpel16_h_lowpass_altivec #define PREFIX_h264_qpel16_h_lowpass_num altivec_put_h264_qpel16_h_lowpass_num @@ -43,7 +42,6 @@ #include "h264_template_altivec.c" #undef OP_U8_ALTIVEC #undef PREFIX_h264_chroma_mc8_altivec -#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec #undef PREFIX_h264_chroma_mc8_num #undef PREFIX_h264_qpel16_h_lowpass_altivec #undef PREFIX_h264_qpel16_h_lowpass_num @@ -54,7 +52,6 @@ #define OP_U8_ALTIVEC AVG_OP_U8_ALTIVEC #define PREFIX_h264_chroma_mc8_altivec avg_h264_chroma_mc8_altivec -#define PREFIX_no_rnd_vc1_chroma_mc8_altivec avg_no_rnd_vc1_chroma_mc8_altivec #define PREFIX_h264_chroma_mc8_num altivec_avg_h264_chroma_mc8_num #define PREFIX_h264_qpel16_h_lowpass_altivec avg_h264_qpel16_h_lowpass_altivec #define PREFIX_h264_qpel16_h_lowpass_num altivec_avg_h264_qpel16_h_lowpass_num @@ -65,7 +62,6 @@ #include "h264_template_altivec.c" #undef OP_U8_ALTIVEC #undef PREFIX_h264_chroma_mc8_altivec -#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec #undef PREFIX_h264_chroma_mc8_num #undef PREFIX_h264_qpel16_h_lowpass_altivec #undef PREFIX_h264_qpel16_h_lowpass_num @@ -973,8 +969,6 @@ void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx) { if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) { c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_altivec; c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_altivec; - c->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec; - c->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec; #define dspfunc(PFX, IDX, NUM) \ c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_altivec; \ diff --git a/mplayer/ffmpeg/libavcodec/ppc/h264_template_altivec.c b/mplayer/ffmpeg/libavcodec/ppc/h264_template_altivec.c index 8cf39c8b..29e4d40d 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/h264_template_altivec.c +++ b/mplayer/ffmpeg/libavcodec/ppc/h264_template_altivec.c @@ -75,6 +75,7 @@ #define noop(a) a #define add28(a) vec_add(v28ss, a) +#ifdef PREFIX_h264_chroma_mc8_altivec static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) { DECLARE_ALIGNED(16, signed int, ABCD)[4] = @@ -201,8 +202,10 @@ static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, } } } +#endif /* this code assume that stride % 16 == 0 */ +#ifdef PREFIX_no_rnd_vc1_chroma_mc8_altivec static void PREFIX_no_rnd_vc1_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) { DECLARE_ALIGNED(16, signed int, ABCD)[4] = {((8 - x) * (8 - y)), @@ -284,12 +287,14 @@ static void PREFIX_no_rnd_vc1_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, i } } } +#endif #undef noop #undef add28 #undef CHROMA_MC8_ALTIVEC_CORE /* this code assume stride % 16 == 0 */ +#ifdef PREFIX_h264_qpel16_h_lowpass_altivec static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) { register int i; @@ -427,8 +432,10 @@ static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, i dst += dstStride; } } +#endif /* this code assume stride % 16 == 0 */ +#ifdef PREFIX_h264_qpel16_v_lowpass_altivec static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) { register int i; @@ -533,8 +540,10 @@ static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, i dst += dstStride; } } +#endif /* this code assume stride % 16 == 0 *and* tmp is properly aligned */ +#ifdef PREFIX_h264_qpel16_hv_lowpass_altivec static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp, uint8_t * src, int dstStride, int tmpStride, int srcStride) { register int i; LOAD_ZERO; @@ -765,3 +774,4 @@ static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp, dst += dstStride; } } +#endif diff --git a/mplayer/ffmpeg/libavcodec/ppc/h264dsp_paired.c b/mplayer/ffmpeg/libavcodec/ppc/h264dsp_paired.c index 813f4837..4b19a1c6 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/h264dsp_paired.c +++ b/mplayer/ffmpeg/libavcodec/ppc/h264dsp_paired.c @@ -4,7 +4,7 @@ * MPlayer CE is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * MPlayer CE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -460,7 +460,7 @@ static void avg_h264_chroma_mc8_paired(uint8_t *dst, uint8_t *src, int stride, i } } -static void put_no_rnd_vc1_chroma_mc8_paired(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y) +void ff_put_vc1_chroma_mc8_paired_nornd(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y) { const vector float zero = {0.0,0.0}; const float offset = 0.4375; @@ -581,7 +581,7 @@ static void put_no_rnd_vc1_chroma_mc8_paired(uint8_t *dst, uint8_t *src, int str } } -static void avg_no_rnd_vc1_chroma_mc8_paired(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y) +void ff_avg_vc1_chroma_mc8_paired_nornd(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y) { const vector float zero = {0.0,0.0}; const float offset = 0.4375; @@ -1212,8 +1212,6 @@ void dsputil_h264_init_ppc(DSPContext *c, AVCodecContext *avctx) c->put_h264_chroma_pixels_tab[1] = put_h264_chroma_mc4_paired; c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_paired; c->avg_h264_chroma_pixels_tab[1] = avg_h264_chroma_mc4_paired; - c->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_paired; - c->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_paired; } void ff_h264dsp_init_ppc(H264DSPContext *c) @@ -1223,8 +1221,8 @@ void ff_h264dsp_init_ppc(H264DSPContext *c) c->h264_idct_add16 = ff_h264_idct_add16_paired; c->h264_idct_add16intra = ff_h264_idct_add16intra_paired; c->h264_idct_dc_add = ff_h264_idct_dc_add_paired; - c->h264_idct8_dc_add = ff_h264_idct8_dc_add_paired; //c->h264_idct8_add = ff_h264_idct8_add_paired; + c->h264_idct8_dc_add = ff_h264_idct8_dc_add_paired; c->h264_idct8_add4 = ff_h264_idct8_add4_paired; c->weight_h264_pixels_tab[0] = weight_h264_pixels16x16_paired; diff --git a/mplayer/ffmpeg/libavcodec/ppc/h264pred_paired.c b/mplayer/ffmpeg/libavcodec/ppc/h264pred_paired.c index 3cdf7d63..3ab4f633 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/h264pred_paired.c +++ b/mplayer/ffmpeg/libavcodec/ppc/h264pred_paired.c @@ -4,7 +4,7 @@ * MPlayer CE is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * MPlayer CE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/mplayer/ffmpeg/libavcodec/ppc/mdct_paired.c b/mplayer/ffmpeg/libavcodec/ppc/mdct_paired.c index 81bbb7a1..b6c26ab3 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/mdct_paired.c +++ b/mplayer/ffmpeg/libavcodec/ppc/mdct_paired.c @@ -4,7 +4,7 @@ * MPlayer CE is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * MPlayer CE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/mplayer/ffmpeg/libavcodec/ppc/rdft_paired.c b/mplayer/ffmpeg/libavcodec/ppc/rdft_paired.c index e0db835c..bbd6b618 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/rdft_paired.c +++ b/mplayer/ffmpeg/libavcodec/ppc/rdft_paired.c @@ -4,7 +4,7 @@ * MPlayer CE is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * MPlayer CE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/mplayer/ffmpeg/libavcodec/ppc/vc1dsp_altivec.c b/mplayer/ffmpeg/libavcodec/ppc/vc1dsp_altivec.c index a2f55f2d..05edb53b 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/vc1dsp_altivec.c +++ b/mplayer/ffmpeg/libavcodec/ppc/vc1dsp_altivec.c @@ -20,6 +20,7 @@ */ #include "libavcodec/dsputil.h" +#include "libavcodec/vc1dsp.h" #include "util_altivec.h" #include "dsputil_altivec.h" @@ -129,7 +130,8 @@ do { \ /** Do inverse transform on 8x8 block */ -static void vc1_inv_trans_8x8_altivec(DCTELEM block[64]) +static void vc1_inv_trans_8x8_altivec(DCTELEM block[64], + int sign, int rangered) { vector signed short src0, src1, src2, src3, src4, src5, src6, src7; vector signed int s0, s1, s2, s3, s4, s5, s6, s7; @@ -143,7 +145,9 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64]) const vector unsigned int vec_2 = vec_splat_u32(2); const vector signed int vec_1s = vec_splat_s32(1); const vector unsigned int vec_1 = vec_splat_u32(1); - + const vector unsigned short rangered_shift = vec_splat_u16(1); + const vector signed short signed_bias = vec_sl(vec_splat_s16(4), + vec_splat_u16(4)); src0 = vec_ld( 0, block); src1 = vec_ld( 16, block); @@ -154,7 +158,6 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64]) src6 = vec_ld( 96, block); src7 = vec_ld(112, block); - TRANSPOSE8(src0, src1, src2, src3, src4, src5, src6, src7); s0 = vec_unpackl(src0); s1 = vec_unpackl(src1); s2 = vec_unpackl(src2); @@ -214,6 +217,27 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64]) src6 = vec_pack(sE, s6); src7 = vec_pack(sF, s7); + if (rangered) { + if (!sign) { + src0 = vec_sub(src0, signed_bias); + src1 = vec_sub(src1, signed_bias); + src2 = vec_sub(src2, signed_bias); + src3 = vec_sub(src3, signed_bias); + src4 = vec_sub(src4, signed_bias); + src5 = vec_sub(src5, signed_bias); + src6 = vec_sub(src6, signed_bias); + src7 = vec_sub(src7, signed_bias); + } + src0 = vec_sl(src0, rangered_shift); + src1 = vec_sl(src1, rangered_shift); + src2 = vec_sl(src2, rangered_shift); + src3 = vec_sl(src3, rangered_shift); + src4 = vec_sl(src4, rangered_shift); + src5 = vec_sl(src5, rangered_shift); + src6 = vec_sl(src6, rangered_shift); + src7 = vec_sl(src7, rangered_shift); + } + vec_st(src0, 0, block); vec_st(src1, 16, block); vec_st(src2, 32, block); @@ -224,6 +248,36 @@ static void vc1_inv_trans_8x8_altivec(DCTELEM block[64]) vec_st(src7,112, block); } +static void vc1_inv_trans_8x8_add_altivec(uint8_t *dest, int stride, DCTELEM *b) +{ + vc1_inv_trans_8x8_altivec(b, 0, 0); + ff_add_pixels_clamped_c(b, dest, stride); +} + +static void vc1_inv_trans_8x8_put_signed_altivec(uint8_t *dest, int stride, DCTELEM *b) +{ + vc1_inv_trans_8x8_altivec(b, 1, 0); + ff_put_signed_pixels_clamped_c(b, dest, stride); +} + +static void vc1_inv_trans_8x8_put_signed_rangered_altivec(uint8_t *dest, int stride, DCTELEM *b) +{ + vc1_inv_trans_8x8_altivec(b, 1, 1); + ff_put_signed_pixels_clamped_c(b, dest, stride); +} + +static void vc1_inv_trans_8x8_put_altivec(uint8_t *dest, int stride, DCTELEM *b) +{ + vc1_inv_trans_8x8_altivec(b, 0, 0); + ff_put_pixels_clamped_c(b, dest, stride); +} + +static void vc1_inv_trans_8x8_put_rangered_altivec(uint8_t *dest, int stride, DCTELEM *b) +{ + vc1_inv_trans_8x8_altivec(b, 0, 1); + ff_put_pixels_clamped_c(b, dest, stride); +} + /** Do inverse transform on 8x4 part of block */ static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block) @@ -322,8 +376,32 @@ static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block) ADD (dest, src3, perm1) } +#define PUT_OP_U8_ALTIVEC(d, s, dst) d = s +#define AVG_OP_U8_ALTIVEC(d, s, dst) d = vec_avg(dst, s) + +#define OP_U8_ALTIVEC PUT_OP_U8_ALTIVEC +#define PREFIX_no_rnd_vc1_chroma_mc8_altivec put_no_rnd_vc1_chroma_mc8_altivec +#include "h264_template_altivec.c" +#undef OP_U8_ALTIVEC +#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec + +#define OP_U8_ALTIVEC AVG_OP_U8_ALTIVEC +#define PREFIX_no_rnd_vc1_chroma_mc8_altivec avg_no_rnd_vc1_chroma_mc8_altivec +#include "h264_template_altivec.c" +#undef OP_U8_ALTIVEC +#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec + +void ff_vc1dsp_init_altivec(VC1DSPContext* dsp) +{ + if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) + return; -void vc1dsp_init_altivec(DSPContext* dsp, AVCodecContext *avctx) { - dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_altivec; + dsp->vc1_inv_trans_8x8_add = vc1_inv_trans_8x8_add_altivec; + dsp->vc1_inv_trans_8x8_put_signed[0] = vc1_inv_trans_8x8_put_signed_altivec; + dsp->vc1_inv_trans_8x8_put_signed[1] = vc1_inv_trans_8x8_put_signed_rangered_altivec; + dsp->vc1_inv_trans_8x8_put[0] = vc1_inv_trans_8x8_put_altivec; + dsp->vc1_inv_trans_8x8_put[1] = vc1_inv_trans_8x8_put_rangered_altivec; dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_altivec; + dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec; } diff --git a/mplayer/ffmpeg/libavcodec/ppc/vc1dsp_paired.c b/mplayer/ffmpeg/libavcodec/ppc/vc1dsp_paired.c index 433a24f1..81bb243c 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/vc1dsp_paired.c +++ b/mplayer/ffmpeg/libavcodec/ppc/vc1dsp_paired.c @@ -4,7 +4,7 @@ * MPlayer CE is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * MPlayer CE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,9 +17,13 @@ */ #include "libavcodec/dsputil.h" +#include "libavcodec/vc1dsp.h" #include "dsputil_paired.h" #include "libavutil/ppc/paired.h" +void ff_put_vc1_chroma_mc8_paired_nornd(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); +void ff_avg_vc1_chroma_mc8_paired_nornd(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); + static void vc1_inv_trans_8x8_dc_paired(uint8_t *dest, int linesize, DCTELEM *block) { const float half = 0.5; @@ -130,10 +134,13 @@ static void vc1_inv_trans_4x4_dc_paired(uint8_t *dest, int linesize, DCTELEM *bl } } -void vc1dsp_init_paired(DSPContext *dsp, AVCodecContext *avctx) +void ff_vc1dsp_init_paired(VC1DSPContext *dsp) { dsp->vc1_inv_trans_8x8_dc = vc1_inv_trans_8x8_dc_paired; dsp->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_paired; dsp->vc1_inv_trans_4x8_dc = vc1_inv_trans_4x8_dc_paired; dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_paired; + + dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_paired_nornd; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_paired_nornd; } diff --git a/mplayer/ffmpeg/libavcodec/ppc/vp8dsp_altivec.c b/mplayer/ffmpeg/libavcodec/ppc/vp8dsp_altivec.c index 8096c4a5..8bb60aae 100644 --- a/mplayer/ffmpeg/libavcodec/ppc/vp8dsp_altivec.c +++ b/mplayer/ffmpeg/libavcodec/ppc/vp8dsp_altivec.c @@ -56,8 +56,8 @@ static const vec_s8 h_subpel_filters_outer[3] = vec_s8 filter_outerl = vec_sld(filter_outerh, filter_outerh, 2) #define FILTER_H(dstv, off) \ - a = vec_ld((off)-2, src); \ - b = vec_ld((off)-2+15, src); \ + a = vec_ld((off)-is6tap-1, src); \ + b = vec_ld((off)-is6tap-1+15, src); \ \ pixh = vec_perm(a, b, permh##off); \ pixl = vec_perm(a, b, perml##off); \ @@ -86,13 +86,15 @@ void put_vp8_epel_h_altivec_core(uint8_t *dst, int dst_stride, vec_s16 f16h, f16l; vec_s32 filth, filtl; - vec_u8 perm_inner = { 1,2,3,4, 2,3,4,5, 3,4,5,6, 4,5,6,7 }; + vec_u8 perm_inner6 = { 1,2,3,4, 2,3,4,5, 3,4,5,6, 4,5,6,7 }; + vec_u8 perm_inner4 = { 0,1,2,3, 1,2,3,4, 2,3,4,5, 3,4,5,6 }; + vec_u8 perm_inner = is6tap ? perm_inner6 : perm_inner4; vec_u8 perm_outer = { 4,9, 0,5, 5,10, 1,6, 6,11, 2,7, 7,12, 3,8 }; vec_s32 c64 = vec_sl(vec_splat_s32(1), vec_splat_u32(6)); vec_u16 c7 = vec_splat_u16(7); - align_vec0 = vec_lvsl( -2, src); - align_vec8 = vec_lvsl(8-2, src); + align_vec0 = vec_lvsl( -is6tap-1, src); + align_vec8 = vec_lvsl(8-is6tap-1, src); permh0 = vec_perm(align_vec0, align_vec0, perm_inner); permh8 = vec_perm(align_vec8, align_vec8, perm_inner); @@ -239,8 +241,13 @@ void put_vp8_epel ## WIDTH ## _v ## TAPS ## _altivec(uint8_t *dst, int dst_strid static void put_vp8_epel ## WIDTH ## _h ## HTAPS ## v ## VTAPS ## _altivec(uint8_t *dst, int stride, uint8_t *src, int s, int h, int mx, int my) \ { \ DECLARE_ALIGNED(16, uint8_t, tmp)[(2*WIDTH+5)*16]; \ - put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16, src-2*stride, stride, h+5, mx, my); \ - put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, stride, tmp+2*16, 16, h, mx, my); \ + if (VTAPS == 6) { \ + put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16, src-2*stride, stride, h+5, mx, my); \ + put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, stride, tmp+2*16, 16, h, mx, my); \ + } else { \ + put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16, src-stride, stride, h+4, mx, my); \ + put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, stride, tmp+16, 16, h, mx, my); \ + } \ } EPEL_FUNCS(16,6) diff --git a/mplayer/ffmpeg/libavcodec/pthread.c b/mplayer/ffmpeg/libavcodec/pthread.c index 1628b21a..658dbacb 100644 --- a/mplayer/ffmpeg/libavcodec/pthread.c +++ b/mplayer/ffmpeg/libavcodec/pthread.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2004 Roman Shaposhnik + * Copyright (c) 2008 Alexander Strange (astrange@ithinksw.com) * * Many thanks to Steven M. Schultz for providing clever ideas and * to Michael Niedermayer for writing initial @@ -21,9 +22,17 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + +/** + * @file + * Multithreading support functions + * @see doc/multithreading.txt + */ + #include #include "avcodec.h" +#include "thread.h" typedef int (action_func)(AVCodecContext *c, void *arg); typedef int (action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr); @@ -45,6 +54,78 @@ typedef struct ThreadContext { int done; } ThreadContext; +/// Max number of frame buffers that can be allocated when using frame threads. +#define MAX_BUFFERS 32 + +/** + * Context used by codec threads and stored in their AVCodecContext thread_opaque. + */ +typedef struct PerThreadContext { + struct FrameThreadContext *parent; + + pthread_t thread; + pthread_cond_t input_cond; ///< Used to wait for a new packet from the main thread. + pthread_cond_t progress_cond; ///< Used by child threads to wait for progress to change. + pthread_cond_t output_cond; ///< Used by the main thread to wait for frames to finish. + + pthread_mutex_t mutex; ///< Mutex used to protect the contents of the PerThreadContext. + pthread_mutex_t progress_mutex; ///< Mutex used to protect frame progress values and progress_cond. + + AVCodecContext *avctx; ///< Context used to decode packets passed to this thread. + + AVPacket avpkt; ///< Input packet (for decoding) or output (for encoding). + int allocated_buf_size; ///< Size allocated for avpkt.data + + AVFrame frame; ///< Output frame (for decoding) or input (for encoding). + int got_frame; ///< The output of got_picture_ptr from the last avcodec_decode_video() call. + int result; ///< The result of the last codec decode/encode() call. + + enum { + STATE_INPUT_READY, ///< Set when the thread is awaiting a packet. + STATE_SETTING_UP, ///< Set before the codec has called ff_thread_finish_setup(). + STATE_GET_BUFFER, /**< + * Set when the codec calls get_buffer(). + * State is returned to STATE_SETTING_UP afterwards. + */ + STATE_SETUP_FINISHED ///< Set after the codec has called ff_thread_finish_setup(). + } state; + + /** + * Array of frames passed to ff_thread_release_buffer(). + * Frames are released after all threads referencing them are finished. + */ + AVFrame released_buffers[MAX_BUFFERS]; + int num_released_buffers; + + /** + * Array of progress values used by ff_thread_get_buffer(). + */ + int progress[MAX_BUFFERS][2]; + uint8_t progress_used[MAX_BUFFERS]; + + AVFrame *requested_frame; ///< AVFrame the codec passed to get_buffer() +} PerThreadContext; + +/** + * Context stored in the client AVCodecContext thread_opaque. + */ +typedef struct FrameThreadContext { + PerThreadContext *threads; ///< The contexts for each thread. + PerThreadContext *prev_thread; ///< The last thread submit_packet() was called on. + + pthread_mutex_t buffer_mutex; ///< Mutex used to protect get/release_buffer(). + + int next_decoding; ///< The next context to submit a packet to. + int next_finished; ///< The next context to return output from. + + int delaying; /**< + * Set for the first N packets, where N is the number of threads. + * While it is set, ff_thread_en/decode_frame won't return any results. + */ + + int die; ///< Set when threads should exit. +} FrameThreadContext; + static void* attribute_align_arg worker(void *v) { AVCodecContext *avctx = v; @@ -84,7 +165,7 @@ static av_always_inline void avcodec_thread_park_workers(ThreadContext *c, int t pthread_mutex_unlock(&c->current_job_lock); } -void avcodec_thread_free(AVCodecContext *avctx) +static void thread_free(AVCodecContext *avctx) { ThreadContext *c = avctx->thread_opaque; int i; @@ -109,6 +190,9 @@ static int avcodec_thread_execute(AVCodecContext *avctx, action_func* func, void ThreadContext *c= avctx->thread_opaque; int dummy_ret; + if (!(avctx->active_thread_type&FF_THREAD_SLICE) || avctx->thread_count <= 1) + return avcodec_default_execute(avctx, func, arg, ret, job_count, job_size); + if (job_count <= 0) return 0; @@ -140,12 +224,11 @@ static int avcodec_thread_execute2(AVCodecContext *avctx, action_func2* func2, v return avcodec_thread_execute(avctx, NULL, arg, ret, job_count, 0); } -int avcodec_thread_init(AVCodecContext *avctx, int thread_count) +static int thread_init(AVCodecContext *avctx) { int i; ThreadContext *c; - - avctx->thread_count = thread_count; + int thread_count = avctx->thread_count; if (thread_count <= 1) return 0; @@ -173,7 +256,7 @@ int avcodec_thread_init(AVCodecContext *avctx, int thread_count) if(pthread_create(&c->workers[i], NULL, worker, avctx)) { avctx->thread_count = i; pthread_mutex_unlock(&c->current_job_lock); - avcodec_thread_free(avctx); + ff_thread_free(avctx); return -1; } } @@ -184,3 +267,642 @@ int avcodec_thread_init(AVCodecContext *avctx, int thread_count) avctx->execute2 = avcodec_thread_execute2; return 0; } + +/** + * Codec worker thread. + * + * Automatically calls ff_thread_finish_setup() if the codec does + * not provide an update_thread_context method, or if the codec returns + * before calling it. + */ +static attribute_align_arg void *frame_worker_thread(void *arg) +{ + PerThreadContext *p = arg; + FrameThreadContext *fctx = p->parent; + AVCodecContext *avctx = p->avctx; + AVCodec *codec = avctx->codec; + + while (1) { + if (p->state == STATE_INPUT_READY && !fctx->die) { + pthread_mutex_lock(&p->mutex); + while (p->state == STATE_INPUT_READY && !fctx->die) + pthread_cond_wait(&p->input_cond, &p->mutex); + pthread_mutex_unlock(&p->mutex); + } + + if (fctx->die) break; + + if (!codec->update_thread_context && avctx->thread_safe_callbacks) + ff_thread_finish_setup(avctx); + + pthread_mutex_lock(&p->mutex); + avcodec_get_frame_defaults(&p->frame); + p->got_frame = 0; + p->result = codec->decode(avctx, &p->frame, &p->got_frame, &p->avpkt); + + if (p->state == STATE_SETTING_UP) ff_thread_finish_setup(avctx); + + p->state = STATE_INPUT_READY; + + pthread_mutex_lock(&p->progress_mutex); + pthread_cond_signal(&p->output_cond); + pthread_mutex_unlock(&p->progress_mutex); + + pthread_mutex_unlock(&p->mutex); + } + + return NULL; +} + +/** + * Updates the next thread's AVCodecContext with values from the reference thread's context. + * + * @param dst The destination context. + * @param src The source context. + * @param for_user 0 if the destination is a codec thread, 1 if the destination is the user's thread + */ +static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src, int for_user) +{ + int err = 0; + + if (dst != src) { + dst->sub_id = src->sub_id; + dst->time_base = src->time_base; + dst->width = src->width; + dst->height = src->height; + dst->pix_fmt = src->pix_fmt; + + dst->has_b_frames = src->has_b_frames; + dst->idct_algo = src->idct_algo; + dst->slice_count = src->slice_count; + + dst->bits_per_coded_sample = src->bits_per_coded_sample; + dst->sample_aspect_ratio = src->sample_aspect_ratio; + dst->dtg_active_format = src->dtg_active_format; + + dst->profile = src->profile; + dst->level = src->level; + + dst->bits_per_raw_sample = src->bits_per_raw_sample; + dst->ticks_per_frame = src->ticks_per_frame; + dst->color_primaries = src->color_primaries; + + dst->color_trc = src->color_trc; + dst->colorspace = src->colorspace; + dst->color_range = src->color_range; + dst->chroma_sample_location = src->chroma_sample_location; + } + + if (for_user) { + dst->coded_frame = src->coded_frame; + dst->has_b_frames += src->thread_count - 1; + } else { + if (dst->codec->update_thread_context) + err = dst->codec->update_thread_context(dst, src); + } + + return err; +} + +/** + * Update the next thread's AVCodecContext with values set by the user. + * + * @param dst The destination context. + * @param src The source context. + */ +static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src) +{ +#define copy_fields(s, e) memcpy(&dst->s, &src->s, (char*)&dst->e - (char*)&dst->s); + dst->flags = src->flags; + + dst->draw_horiz_band= src->draw_horiz_band; + dst->get_buffer = src->get_buffer; + dst->release_buffer = src->release_buffer; + + dst->opaque = src->opaque; + dst->hurry_up = src->hurry_up; + dst->dsp_mask = src->dsp_mask; + dst->debug = src->debug; + dst->debug_mv = src->debug_mv; + + dst->slice_flags = src->slice_flags; + dst->flags2 = src->flags2; + + copy_fields(skip_loop_filter, bidir_refine); + + dst->frame_number = src->frame_number; + dst->reordered_opaque = src->reordered_opaque; +#undef copy_fields +} + +static void free_progress(AVFrame *f) +{ + PerThreadContext *p = f->owner->thread_opaque; + int *progress = f->thread_opaque; + + p->progress_used[(progress - p->progress[0]) / 2] = 0; +} + +/// Releases the buffers that this decoding thread was the last user of. +static void release_delayed_buffers(PerThreadContext *p) +{ + FrameThreadContext *fctx = p->parent; + + while (p->num_released_buffers > 0) { + AVFrame *f = &p->released_buffers[--p->num_released_buffers]; + + pthread_mutex_lock(&fctx->buffer_mutex); + free_progress(f); + f->thread_opaque = NULL; + + f->owner->release_buffer(f->owner, f); + pthread_mutex_unlock(&fctx->buffer_mutex); + } +} + +static int submit_packet(PerThreadContext *p, AVPacket *avpkt) +{ + FrameThreadContext *fctx = p->parent; + PerThreadContext *prev_thread = fctx->prev_thread; + AVCodec *codec = p->avctx->codec; + uint8_t *buf = p->avpkt.data; + + if (!avpkt->size && !(codec->capabilities & CODEC_CAP_DELAY)) return 0; + + pthread_mutex_lock(&p->mutex); + + release_delayed_buffers(p); + + if (prev_thread) { + int err; + if (prev_thread->state == STATE_SETTING_UP) { + pthread_mutex_lock(&prev_thread->progress_mutex); + while (prev_thread->state == STATE_SETTING_UP) + pthread_cond_wait(&prev_thread->progress_cond, &prev_thread->progress_mutex); + pthread_mutex_unlock(&prev_thread->progress_mutex); + } + + err = update_context_from_thread(p->avctx, prev_thread->avctx, 0); + if (err) { + pthread_mutex_unlock(&p->mutex); + return err; + } + } + + av_fast_malloc(&buf, &p->allocated_buf_size, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); + p->avpkt = *avpkt; + p->avpkt.data = buf; + memcpy(buf, avpkt->data, avpkt->size); + memset(buf + avpkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + + p->state = STATE_SETTING_UP; + pthread_cond_signal(&p->input_cond); + pthread_mutex_unlock(&p->mutex); + + /* + * If the client doesn't have a thread-safe get_buffer(), + * then decoding threads call back to the main thread, + * and it calls back to the client here. + */ + + if (!p->avctx->thread_safe_callbacks && + p->avctx->get_buffer != avcodec_default_get_buffer) { + while (p->state != STATE_SETUP_FINISHED && p->state != STATE_INPUT_READY) { + pthread_mutex_lock(&p->progress_mutex); + while (p->state == STATE_SETTING_UP) + pthread_cond_wait(&p->progress_cond, &p->progress_mutex); + + if (p->state == STATE_GET_BUFFER) { + p->result = p->avctx->get_buffer(p->avctx, p->requested_frame); + p->state = STATE_SETTING_UP; + pthread_cond_signal(&p->progress_cond); + } + pthread_mutex_unlock(&p->progress_mutex); + } + } + + fctx->prev_thread = p; + + return 0; +} + +int ff_thread_decode_frame(AVCodecContext *avctx, + AVFrame *picture, int *got_picture_ptr, + AVPacket *avpkt) +{ + FrameThreadContext *fctx = avctx->thread_opaque; + int finished = fctx->next_finished; + PerThreadContext *p; + int err; + + /* + * Submit a packet to the next decoding thread. + */ + + p = &fctx->threads[fctx->next_decoding]; + update_context_from_user(p->avctx, avctx); + err = submit_packet(p, avpkt); + if (err) return err; + + fctx->next_decoding++; + + /* + * If we're still receiving the initial packets, don't return a frame. + */ + + if (fctx->delaying && avpkt->size) { + if (fctx->next_decoding >= (avctx->thread_count-1)) fctx->delaying = 0; + + *got_picture_ptr=0; + return 0; + } + + /* + * Return the next available frame from the oldest thread. + * If we're at the end of the stream, then we have to skip threads that + * didn't output a frame, because we don't want to accidentally signal + * EOF (avpkt->size == 0 && *got_picture_ptr == 0). + */ + + do { + p = &fctx->threads[finished++]; + + if (p->state != STATE_INPUT_READY) { + pthread_mutex_lock(&p->progress_mutex); + while (p->state != STATE_INPUT_READY) + pthread_cond_wait(&p->output_cond, &p->progress_mutex); + pthread_mutex_unlock(&p->progress_mutex); + } + + *picture = p->frame; + *got_picture_ptr = p->got_frame; + picture->pkt_dts = p->avpkt.dts; + + /* + * A later call with avkpt->size == 0 may loop over all threads, + * including this one, searching for a frame to return before being + * stopped by the "finished != fctx->next_finished" condition. + * Make sure we don't mistakenly return the same frame again. + */ + p->got_frame = 0; + + if (finished >= avctx->thread_count) finished = 0; + } while (!avpkt->size && !*got_picture_ptr && finished != fctx->next_finished); + + update_context_from_thread(avctx, p->avctx, 1); + + if (fctx->next_decoding >= avctx->thread_count) fctx->next_decoding = 0; + + fctx->next_finished = finished; + + return p->result; +} + +void ff_thread_report_progress(AVFrame *f, int n, int field) +{ + PerThreadContext *p; + int *progress = f->thread_opaque; + + if (!progress || progress[field] >= n) return; + + p = f->owner->thread_opaque; + + if (f->owner->debug&FF_DEBUG_THREADS) + av_log(f->owner, AV_LOG_DEBUG, "%p finished %d field %d\n", progress, n, field); + + pthread_mutex_lock(&p->progress_mutex); + progress[field] = n; + pthread_cond_broadcast(&p->progress_cond); + pthread_mutex_unlock(&p->progress_mutex); +} + +void ff_thread_await_progress(AVFrame *f, int n, int field) +{ + PerThreadContext *p; + int *progress = f->thread_opaque; + + if (!progress || progress[field] >= n) return; + + p = f->owner->thread_opaque; + + if (f->owner->debug&FF_DEBUG_THREADS) + av_log(f->owner, AV_LOG_DEBUG, "thread awaiting %d field %d from %p\n", n, field, progress); + + pthread_mutex_lock(&p->progress_mutex); + while (progress[field] < n) + pthread_cond_wait(&p->progress_cond, &p->progress_mutex); + pthread_mutex_unlock(&p->progress_mutex); +} + +void ff_thread_finish_setup(AVCodecContext *avctx) { + PerThreadContext *p = avctx->thread_opaque; + + if (!(avctx->active_thread_type&FF_THREAD_FRAME)) return; + + pthread_mutex_lock(&p->progress_mutex); + p->state = STATE_SETUP_FINISHED; + pthread_cond_broadcast(&p->progress_cond); + pthread_mutex_unlock(&p->progress_mutex); +} + +/// Waits for all threads to finish. +static void park_frame_worker_threads(FrameThreadContext *fctx, int thread_count) +{ + int i; + + for (i = 0; i < thread_count; i++) { + PerThreadContext *p = &fctx->threads[i]; + + if (p->state != STATE_INPUT_READY) { + pthread_mutex_lock(&p->progress_mutex); + while (p->state != STATE_INPUT_READY) + pthread_cond_wait(&p->output_cond, &p->progress_mutex); + pthread_mutex_unlock(&p->progress_mutex); + } + } +} + +static void frame_thread_free(AVCodecContext *avctx, int thread_count) +{ + FrameThreadContext *fctx = avctx->thread_opaque; + AVCodec *codec = avctx->codec; + int i; + + park_frame_worker_threads(fctx, thread_count); + + if (fctx->prev_thread) + update_context_from_thread(fctx->threads->avctx, fctx->prev_thread->avctx, 0); + + fctx->die = 1; + + for (i = 0; i < thread_count; i++) { + PerThreadContext *p = &fctx->threads[i]; + + pthread_mutex_lock(&p->mutex); + pthread_cond_signal(&p->input_cond); + pthread_mutex_unlock(&p->mutex); + + pthread_join(p->thread, NULL); + + if (codec->close) + codec->close(p->avctx); + + avctx->codec = NULL; + + release_delayed_buffers(p); + } + + for (i = 0; i < thread_count; i++) { + PerThreadContext *p = &fctx->threads[i]; + + avcodec_default_free_buffers(p->avctx); + + pthread_mutex_destroy(&p->mutex); + pthread_mutex_destroy(&p->progress_mutex); + pthread_cond_destroy(&p->input_cond); + pthread_cond_destroy(&p->progress_cond); + pthread_cond_destroy(&p->output_cond); + av_freep(&p->avpkt.data); + + if (i) + av_freep(&p->avctx->priv_data); + + av_freep(&p->avctx); + } + + av_freep(&fctx->threads); + pthread_mutex_destroy(&fctx->buffer_mutex); + av_freep(&avctx->thread_opaque); +} + +static int frame_thread_init(AVCodecContext *avctx) +{ + int thread_count = avctx->thread_count; + AVCodec *codec = avctx->codec; + AVCodecContext *src = avctx; + FrameThreadContext *fctx; + int i, err = 0; + + if (thread_count <= 1) { + avctx->active_thread_type = 0; + return 0; + } + + avctx->thread_opaque = fctx = av_mallocz(sizeof(FrameThreadContext)); + + fctx->threads = av_mallocz(sizeof(PerThreadContext) * thread_count); + pthread_mutex_init(&fctx->buffer_mutex, NULL); + fctx->delaying = 1; + + for (i = 0; i < thread_count; i++) { + AVCodecContext *copy = av_malloc(sizeof(AVCodecContext)); + PerThreadContext *p = &fctx->threads[i]; + + pthread_mutex_init(&p->mutex, NULL); + pthread_mutex_init(&p->progress_mutex, NULL); + pthread_cond_init(&p->input_cond, NULL); + pthread_cond_init(&p->progress_cond, NULL); + pthread_cond_init(&p->output_cond, NULL); + + p->parent = fctx; + p->avctx = copy; + + *copy = *src; + copy->thread_opaque = p; + copy->pkt = &p->avpkt; + + if (!i) { + src = copy; + + if (codec->init) + err = codec->init(copy); + + update_context_from_thread(avctx, copy, 1); + } else { + copy->is_copy = 1; + copy->priv_data = av_malloc(codec->priv_data_size); + memcpy(copy->priv_data, src->priv_data, codec->priv_data_size); + + if (codec->init_thread_copy) + err = codec->init_thread_copy(copy); + } + + if (err) goto error; + + pthread_create(&p->thread, NULL, frame_worker_thread, p); + } + + return 0; + +error: + frame_thread_free(avctx, i+1); + + return err; +} + +void ff_thread_flush(AVCodecContext *avctx) +{ + FrameThreadContext *fctx = avctx->thread_opaque; + + if (!avctx->thread_opaque) return; + + park_frame_worker_threads(fctx, avctx->thread_count); + + if (fctx->prev_thread) + update_context_from_thread(fctx->threads->avctx, fctx->prev_thread->avctx, 0); + + fctx->next_decoding = fctx->next_finished = 0; + fctx->delaying = 1; + fctx->prev_thread = NULL; +} + +static int *allocate_progress(PerThreadContext *p) +{ + int i; + + for (i = 0; i < MAX_BUFFERS; i++) + if (!p->progress_used[i]) break; + + if (i == MAX_BUFFERS) { + av_log(p->avctx, AV_LOG_ERROR, "allocate_progress() overflow\n"); + return NULL; + } + + p->progress_used[i] = 1; + + return p->progress[i]; +} + +int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f) +{ + PerThreadContext *p = avctx->thread_opaque; + int *progress, err; + + f->owner = avctx; + + if (!(avctx->active_thread_type&FF_THREAD_FRAME)) { + f->thread_opaque = NULL; + return avctx->get_buffer(avctx, f); + } + + if (p->state != STATE_SETTING_UP && + (avctx->codec->update_thread_context || !avctx->thread_safe_callbacks)) { + av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); + return -1; + } + + pthread_mutex_lock(&p->parent->buffer_mutex); + f->thread_opaque = progress = allocate_progress(p); + + if (!progress) { + pthread_mutex_unlock(&p->parent->buffer_mutex); + return -1; + } + + progress[0] = + progress[1] = -1; + + if (avctx->thread_safe_callbacks || + avctx->get_buffer == avcodec_default_get_buffer) { + err = avctx->get_buffer(avctx, f); + } else { + p->requested_frame = f; + p->state = STATE_GET_BUFFER; + pthread_mutex_lock(&p->progress_mutex); + pthread_cond_signal(&p->progress_cond); + + while (p->state != STATE_SETTING_UP) + pthread_cond_wait(&p->progress_cond, &p->progress_mutex); + + err = p->result; + + pthread_mutex_unlock(&p->progress_mutex); + + if (!avctx->codec->update_thread_context) + ff_thread_finish_setup(avctx); + } + + pthread_mutex_unlock(&p->parent->buffer_mutex); + + /* + * Buffer age is difficult to keep track of between + * multiple threads, and the optimizations it allows + * are not worth the effort. It is disabled for now. + */ + f->age = INT_MAX; + + return err; +} + +void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f) +{ + PerThreadContext *p = avctx->thread_opaque; + + if (!(avctx->active_thread_type&FF_THREAD_FRAME)) { + avctx->release_buffer(avctx, f); + return; + } + + if (p->num_released_buffers >= MAX_BUFFERS) { + av_log(p->avctx, AV_LOG_ERROR, "too many thread_release_buffer calls!\n"); + return; + } + + if(avctx->debug & FF_DEBUG_BUFFERS) + av_log(avctx, AV_LOG_DEBUG, "thread_release_buffer called on pic %p, %d buffers used\n", + f, f->owner->internal_buffer_count); + + p->released_buffers[p->num_released_buffers++] = *f; + memset(f->data, 0, sizeof(f->data)); +} + +/** + * Set the threading algorithms used. + * + * Threading requires more than one thread. + * Frame threading requires entire frames to be passed to the codec, + * and introduces extra decoding delay, so is incompatible with low_delay. + * + * @param avctx The context. + */ +static void validate_thread_parameters(AVCodecContext *avctx) +{ + int frame_threading_supported = (avctx->codec->capabilities & CODEC_CAP_FRAME_THREADS) + && !(avctx->flags & CODEC_FLAG_TRUNCATED) + && !(avctx->flags & CODEC_FLAG_LOW_DELAY) + && !(avctx->flags2 & CODEC_FLAG2_CHUNKS); + if (avctx->thread_count == 1) { + avctx->active_thread_type = 0; + } else if (frame_threading_supported && (avctx->thread_type & FF_THREAD_FRAME)) { + avctx->active_thread_type = FF_THREAD_FRAME; + } else { + avctx->active_thread_type = FF_THREAD_SLICE; + } +} + +int ff_thread_init(AVCodecContext *avctx, int thread_count) +{ + if (avctx->thread_opaque) { + av_log(avctx, AV_LOG_ERROR, "avcodec_thread_init is ignored after avcodec_open\n"); + return -1; + } + + if (avctx->codec) { + validate_thread_parameters(avctx); + + if (avctx->active_thread_type&FF_THREAD_SLICE) + return thread_init(avctx); + else if (avctx->active_thread_type&FF_THREAD_FRAME) + return frame_thread_init(avctx); + } + + return 0; +} + +void ff_thread_free(AVCodecContext *avctx) +{ + if (avctx->active_thread_type&FF_THREAD_FRAME) + frame_thread_free(avctx, avctx->thread_count); + else + thread_free(avctx); +} diff --git a/mplayer/ffmpeg/libavcodec/ptx.c b/mplayer/ffmpeg/libavcodec/ptx.c index 86b06b4a..28df0b6f 100644 --- a/mplayer/ffmpeg/libavcodec/ptx.c +++ b/mplayer/ffmpeg/libavcodec/ptx.c @@ -20,7 +20,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" typedef struct PTXContext { diff --git a/mplayer/ffmpeg/libavcodec/qtrleenc.c b/mplayer/ffmpeg/libavcodec/qtrleenc.c index 78149e5e..8815736e 100644 --- a/mplayer/ffmpeg/libavcodec/qtrleenc.c +++ b/mplayer/ffmpeg/libavcodec/qtrleenc.c @@ -22,7 +22,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "bytestream.h" diff --git a/mplayer/ffmpeg/libavcodec/rawdec.c b/mplayer/ffmpeg/libavcodec/rawdec.c index 29cc5e44..baffceb5 100644 --- a/mplayer/ffmpeg/libavcodec/rawdec.c +++ b/mplayer/ffmpeg/libavcodec/rawdec.c @@ -28,8 +28,7 @@ #include "imgconvert.h" #include "raw.h" #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" -#include "libavcore/internal.h" +#include "libavutil/imgutils.h" typedef struct RawVideoContext { uint32_t palette[AVPALETTE_COUNT]; diff --git a/mplayer/ffmpeg/libavcodec/resample.c b/mplayer/ffmpeg/libavcodec/resample.c index 27283152..45fba69f 100644 --- a/mplayer/ffmpeg/libavcodec/resample.c +++ b/mplayer/ffmpeg/libavcodec/resample.c @@ -27,7 +27,7 @@ #include "avcodec.h" #include "audioconvert.h" #include "libavutil/opt.h" -#include "libavcore/samplefmt.h" +#include "libavutil/samplefmt.h" struct AVResampleContext; diff --git a/mplayer/ffmpeg/libavcodec/rv10.c b/mplayer/ffmpeg/libavcodec/rv10.c index f47540d8..e6e9afaf 100644 --- a/mplayer/ffmpeg/libavcodec/rv10.c +++ b/mplayer/ffmpeg/libavcodec/rv10.c @@ -25,7 +25,7 @@ * RV10/RV20 decoder */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" diff --git a/mplayer/ffmpeg/libavcodec/rv40.c b/mplayer/ffmpeg/libavcodec/rv40.c index acebeb7d..5d4aafc0 100644 --- a/mplayer/ffmpeg/libavcodec/rv40.c +++ b/mplayer/ffmpeg/libavcodec/rv40.c @@ -24,7 +24,7 @@ * RV40 decoder */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" diff --git a/mplayer/ffmpeg/libavcodec/sgidec.c b/mplayer/ffmpeg/libavcodec/sgidec.c index ac2adfe7..96af5c6f 100644 --- a/mplayer/ffmpeg/libavcodec/sgidec.c +++ b/mplayer/ffmpeg/libavcodec/sgidec.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "bytestream.h" #include "sgi.h" diff --git a/mplayer/ffmpeg/libavcodec/smacker.c b/mplayer/ffmpeg/libavcodec/smacker.c index 2fcc3351..e3f00b84 100644 --- a/mplayer/ffmpeg/libavcodec/smacker.c +++ b/mplayer/ffmpeg/libavcodec/smacker.c @@ -32,6 +32,7 @@ #include #include "avcodec.h" +#include "libavutil/audioconvert.h" #define ALT_BITSTREAM_READER_LE #include "get_bits.h" @@ -554,7 +555,7 @@ static av_cold int decode_end(AVCodecContext *avctx) static av_cold int smka_decode_init(AVCodecContext *avctx) { - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; avctx->sample_fmt = avctx->bits_per_coded_sample == 8 ? AV_SAMPLE_FMT_U8 : AV_SAMPLE_FMT_S16; return 0; } @@ -677,12 +678,9 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, for(i = 0; i < 4; i++) { if(vlc[i].table) free_vlc(&vlc[i]); - if(h[i].bits) - av_free(h[i].bits); - if(h[i].lengths) - av_free(h[i].lengths); - if(h[i].values) - av_free(h[i].values); + av_free(h[i].bits); + av_free(h[i].lengths); + av_free(h[i].values); } *data_size = unp_size; diff --git a/mplayer/ffmpeg/libavcodec/srtdec.c b/mplayer/ffmpeg/libavcodec/srtdec.c index 30fdc12f..af03cc4d 100644 --- a/mplayer/ffmpeg/libavcodec/srtdec.c +++ b/mplayer/ffmpeg/libavcodec/srtdec.c @@ -20,7 +20,7 @@ */ #include "libavutil/avstring.h" -#include "libavcore/parseutils.h" +#include "libavutil/parseutils.h" #include "avcodec.h" #include "ass.h" diff --git a/mplayer/ffmpeg/libavcodec/sunrast.c b/mplayer/ffmpeg/libavcodec/sunrast.c index 76b65b35..73e4b5b9 100644 --- a/mplayer/ffmpeg/libavcodec/sunrast.c +++ b/mplayer/ffmpeg/libavcodec/sunrast.c @@ -20,7 +20,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #define RT_OLD 0 diff --git a/mplayer/ffmpeg/libavcodec/synth_filter.c b/mplayer/ffmpeg/libavcodec/synth_filter.c index a0ae364d..4af496d3 100644 --- a/mplayer/ffmpeg/libavcodec/synth_filter.c +++ b/mplayer/ffmpeg/libavcodec/synth_filter.c @@ -24,7 +24,7 @@ static void synth_filter_float(FFTContext *imdct, float *synth_buf_ptr, int *synth_buf_offset, float synth_buf2[32], const float window[512], - float out[32], const float in[32], float scale, float bias) + float out[32], const float in[32], float scale) { float *synth_buf= synth_buf_ptr + *synth_buf_offset; int i, j; @@ -48,8 +48,8 @@ static void synth_filter_float(FFTContext *imdct, c += window[i + j + 32]*( synth_buf[16 + i + j - 512]); d += window[i + j + 48]*( synth_buf[31 - i + j - 512]); } - out[i ] = a*scale + bias; - out[i + 16] = b*scale + bias; + out[i ] = a*scale; + out[i + 16] = b*scale; synth_buf2[i ] = c; synth_buf2[i + 16] = d; } diff --git a/mplayer/ffmpeg/libavcodec/synth_filter.h b/mplayer/ffmpeg/libavcodec/synth_filter.h index d6209d5d..33edcc43 100644 --- a/mplayer/ffmpeg/libavcodec/synth_filter.h +++ b/mplayer/ffmpeg/libavcodec/synth_filter.h @@ -28,7 +28,7 @@ typedef struct SynthFilterContext { float *synth_buf_ptr, int *synth_buf_offset, float synth_buf2[32], const float window[512], float out[32], const float in[32], - float scale, float bias); + float scale); } SynthFilterContext; void ff_synth_filter_init(SynthFilterContext *c); diff --git a/mplayer/ffmpeg/libavcodec/targa.c b/mplayer/ffmpeg/libavcodec/targa.c index e6e1ca6f..3c220f40 100644 --- a/mplayer/ffmpeg/libavcodec/targa.c +++ b/mplayer/ffmpeg/libavcodec/targa.c @@ -20,7 +20,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "targa.h" @@ -33,22 +33,35 @@ typedef struct TargaContext { int compression_type; } TargaContext; -static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, const uint8_t *src, uint8_t *dst, int w, int h, int stride, int bpp) +#define CHECK_BUFFER_SIZE(buf, buf_end, needed, where) \ + if(needed > buf_end - buf){ \ + av_log(avctx, AV_LOG_ERROR, "Problem: unexpected end of data while reading " where "\n"); \ + return -1; \ + } \ + +static int targa_decode_rle(AVCodecContext *avctx, TargaContext *s, const uint8_t *src, int src_size, uint8_t *dst, int w, int h, int stride, int bpp) { int i, x, y; int depth = (bpp + 1) >> 3; int type, count; int diff; + const uint8_t *src_end = src + src_size; diff = stride - w * depth; x = y = 0; while(y < h){ + CHECK_BUFFER_SIZE(src, src_end, 1, "image type"); type = *src++; count = (type & 0x7F) + 1; type &= 0x80; if((x + count > w) && (x + count + 1 > (h - y) * w)){ av_log(avctx, AV_LOG_ERROR, "Packet went out of bounds: position (%i,%i) size %i\n", x, y, count); - return; + return -1; + } + if(type){ + CHECK_BUFFER_SIZE(src, src_end, depth, "image data"); + }else{ + CHECK_BUFFER_SIZE(src, src_end, count * depth, "image data"); } for(i = 0; i < count; i++){ switch(depth){ @@ -81,6 +94,7 @@ static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, const uint8 if(type) src += depth; } + return src_size; } static int decode_frame(AVCodecContext *avctx, @@ -88,7 +102,7 @@ static int decode_frame(AVCodecContext *avctx, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; + const uint8_t *buf_end = avpkt->data + avpkt->size; TargaContext * const s = avctx->priv_data; AVFrame *picture = data; AVFrame * const p= (AVFrame*)&s->picture; @@ -98,6 +112,7 @@ static int decode_frame(AVCodecContext *avctx, int first_clr, colors, csize; /* parse image header */ + CHECK_BUFFER_SIZE(buf, buf_end, 18, "header"); idlen = *buf++; pal = *buf++; compr = *buf++; @@ -111,6 +126,7 @@ static int decode_frame(AVCodecContext *avctx, bpp = *buf++; flags = *buf++; //skip identifier if any + CHECK_BUFFER_SIZE(buf, buf_end, idlen, "identifiers"); buf += idlen; s->bpp = bpp; s->width = w; @@ -163,6 +179,7 @@ static int decode_frame(AVCodecContext *avctx, } } if(colors){ + size_t pal_size; if((colors + first_clr) > 256){ av_log(avctx, AV_LOG_ERROR, "Incorrect palette: %i colors with offset %i\n", colors, first_clr); return -1; @@ -171,8 +188,10 @@ static int decode_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "Palette entry size %i bits is not supported\n", csize); return -1; } + pal_size = colors * ((csize + 1) >> 3); + CHECK_BUFFER_SIZE(buf, buf_end, pal_size, "color table"); if(avctx->pix_fmt != PIX_FMT_PAL8)//should not occur but skip palette anyway - buf += colors * ((csize + 1) >> 3); + buf += pal_size; else{ int r, g, b, t; int32_t *pal = ((int32_t*)p->data[1]) + first_clr; @@ -188,9 +207,14 @@ static int decode_frame(AVCodecContext *avctx, if((compr & (~TGA_RLE)) == TGA_NODATA) memset(p->data[0], 0, p->linesize[0] * s->height); else{ - if(compr & TGA_RLE) - targa_decode_rle(avctx, s, buf, dst, avctx->width, avctx->height, stride, bpp); - else{ + if(compr & TGA_RLE){ + int res = targa_decode_rle(avctx, s, buf, buf_end - buf, dst, avctx->width, avctx->height, stride, bpp); + if (res < 0) + return -1; + buf += res; + }else{ + size_t img_size = s->width * ((s->bpp + 1) >> 3); + CHECK_BUFFER_SIZE(buf, buf_end, img_size, "image data"); for(y = 0; y < s->height; y++){ #if HAVE_BIGENDIAN if((s->bpp + 1) >> 3 == 2){ @@ -203,10 +227,10 @@ static int decode_frame(AVCodecContext *avctx, dst32[x] = AV_RL32(buf + x * 4); }else #endif - memcpy(dst, buf, s->width * ((s->bpp + 1) >> 3)); + memcpy(dst, buf, img_size); dst += stride; - buf += s->width * ((s->bpp + 1) >> 3); + buf += img_size; } } } @@ -214,7 +238,7 @@ static int decode_frame(AVCodecContext *avctx, *picture= *(AVFrame*)&s->picture; *data_size = sizeof(AVPicture); - return buf_size; + return avpkt->size; } static av_cold int targa_init(AVCodecContext *avctx){ diff --git a/mplayer/ffmpeg/libavcodec/thread.h b/mplayer/ffmpeg/libavcodec/thread.h new file mode 100644 index 00000000..485f4ec1 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/thread.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2008 Alexander Strange + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Multithreading support functions + * @author Alexander Strange + */ + +#ifndef AVCODEC_THREAD_H +#define AVCODEC_THREAD_H + +#include "config.h" +#include "avcodec.h" + +/** + * Waits for decoding threads to finish and resets internal + * state. Called by avcodec_flush_buffers(). + * + * @param avctx The context. + */ +void ff_thread_flush(AVCodecContext *avctx); + +/** + * Submits a new frame to a decoding thread. + * Returns the next available frame in picture. *got_picture_ptr + * will be 0 if none is available. + * + * Parameters are the same as avcodec_decode_video2(). + */ +int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture, + int *got_picture_ptr, AVPacket *avpkt); + +/** + * If the codec defines update_thread_context(), call this + * when they are ready for the next thread to start decoding + * the next frame. After calling it, do not change any variables + * read by the update_thread_context() method, or call ff_thread_get_buffer(). + * + * @param avctx The context. + */ +void ff_thread_finish_setup(AVCodecContext *avctx); + +/** + * Notifies later decoding threads when part of their reference picture + * is ready. + * Call this when some part of the picture is finished decoding. + * Later calls with lower values of progress have no effect. + * + * @param f The picture being decoded. + * @param progress Value, in arbitrary units, of how much of the picture has decoded. + * @param field The field being decoded, for field-picture codecs. + * 0 for top field or frame pictures, 1 for bottom field. + */ +void ff_thread_report_progress(AVFrame *f, int progress, int field); + +/** + * Waits for earlier decoding threads to finish reference pictures + * Call this before accessing some part of a picture, with a given + * value for progress, and it will return after the responsible decoding + * thread calls ff_thread_report_progress() with the same or + * higher value for progress. + * + * @param f The picture being referenced. + * @param progress Value, in arbitrary units, to wait for. + * @param field The field being referenced, for field-picture codecs. + * 0 for top field or frame pictures, 1 for bottom field. + */ +void ff_thread_await_progress(AVFrame *f, int progress, int field); + +/** + * Wrapper around get_buffer() for frame-multithreaded codecs. + * Call this function instead of avctx->get_buffer(f). + * Cannot be called after the codec has called ff_thread_finish_setup(). + * + * @param avctx The current context. + * @param f The frame to write into. + */ +int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f); + +/** + * Wrapper around release_buffer() frame-for multithreaded codecs. + * Call this function instead of avctx->release_buffer(f). + * The AVFrame will be copied and the actual release_buffer() call + * will be performed later. The contents of data pointed to by the + * AVFrame should not be changed until ff_thread_get_buffer() is called + * on it. + * + * @param avctx The current context. + * @param f The picture being released. + */ +void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f); + +int ff_thread_init(AVCodecContext *s, int thread_count); +void ff_thread_free(AVCodecContext *s); + +#endif /* AVCODEC_THREAD_H */ diff --git a/mplayer/ffmpeg/libavcodec/tiff.c b/mplayer/ffmpeg/libavcodec/tiff.c index b012baa9..8295a4b4 100644 --- a/mplayer/ffmpeg/libavcodec/tiff.c +++ b/mplayer/ffmpeg/libavcodec/tiff.c @@ -33,7 +33,7 @@ #include "faxcompr.h" #include "libavutil/common.h" #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" typedef struct TiffContext { AVCodecContext *avctx; diff --git a/mplayer/ffmpeg/libavcodec/truemotion1.c b/mplayer/ffmpeg/libavcodec/truemotion1.c index 448da84c..c7d414a6 100644 --- a/mplayer/ffmpeg/libavcodec/truemotion1.c +++ b/mplayer/ffmpeg/libavcodec/truemotion1.c @@ -35,7 +35,7 @@ #include "avcodec.h" #include "dsputil.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "truemotion1data.h" diff --git a/mplayer/ffmpeg/libavcodec/truemotion2.c b/mplayer/ffmpeg/libavcodec/truemotion2.c index d20ee94b..86454ec2 100644 --- a/mplayer/ffmpeg/libavcodec/truemotion2.c +++ b/mplayer/ffmpeg/libavcodec/truemotion2.c @@ -185,8 +185,7 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code) static void tm2_free_codes(TM2Codes *code) { - if(code->recode) - av_free(code->recode); + av_free(code->recode); if(code->vlc.table) free_vlc(&code->vlc); } @@ -859,13 +858,10 @@ static av_cold int decode_end(AVCodecContext *avctx){ AVFrame *pic = &l->pic; int i; - if(l->last) - av_free(l->last); - if(l->clast) - av_free(l->clast); + av_free(l->last); + av_free(l->clast); for(i = 0; i < TM2_NUM_STREAMS; i++) - if(l->tokens[i]) - av_free(l->tokens[i]); + av_free(l->tokens[i]); if(l->Y1){ av_free(l->Y1); av_free(l->U1); diff --git a/mplayer/ffmpeg/libavcodec/tta.c b/mplayer/ffmpeg/libavcodec/tta.c index 936dff23..eb4d71ff 100644 --- a/mplayer/ffmpeg/libavcodec/tta.c +++ b/mplayer/ffmpeg/libavcodec/tta.c @@ -449,8 +449,7 @@ static int tta_decode_frame(AVCodecContext *avctx, static av_cold int tta_decode_close(AVCodecContext *avctx) { TTAContext *s = avctx->priv_data; - if (s->decode_buffer) - av_free(s->decode_buffer); + av_free(s->decode_buffer); av_freep(&s->ch_ctx); return 0; diff --git a/mplayer/ffmpeg/libavcodec/twinvq.c b/mplayer/ffmpeg/libavcodec/twinvq.c index 8334e83d..bd43104e 100644 --- a/mplayer/ffmpeg/libavcodec/twinvq.c +++ b/mplayer/ffmpeg/libavcodec/twinvq.c @@ -646,7 +646,6 @@ static void imdct_and_window(TwinContext *tctx, enum FrameType ftype, int wtype, prev_buf + (bsize-wsize)/2, buf1 + bsize*j, ff_sine_windows[av_log2(wsize)], - 0.0, wsize/2); out2 += wsize; diff --git a/mplayer/ffmpeg/libavcodec/txd.c b/mplayer/ffmpeg/libavcodec/txd.c index b394e1f5..da1f5c1e 100644 --- a/mplayer/ffmpeg/libavcodec/txd.c +++ b/mplayer/ffmpeg/libavcodec/txd.c @@ -22,7 +22,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "s3tc.h" diff --git a/mplayer/ffmpeg/libavcodec/utils.c b/mplayer/ffmpeg/libavcodec/utils.c index 53a06743..03fa7bae 100644 --- a/mplayer/ffmpeg/libavcodec/utils.c +++ b/mplayer/ffmpeg/libavcodec/utils.c @@ -29,14 +29,14 @@ #include "libavutil/integer.h" #include "libavutil/crc.h" #include "libavutil/pixdesc.h" -#include "libavcore/audioconvert.h" -#include "libavcore/imgutils.h" -#include "libavcore/internal.h" -#include "libavcore/samplefmt.h" +#include "libavutil/audioconvert.h" +#include "libavutil/imgutils.h" +#include "libavutil/samplefmt.h" #include "avcodec.h" #include "dsputil.h" #include "libavutil/opt.h" #include "imgconvert.h" +#include "thread.h" #include "audioconvert.h" #include "internal.h" #include @@ -261,6 +261,11 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ (*picture_number)++; if(buf->base[0] && (buf->width != w || buf->height != h || buf->pix_fmt != s->pix_fmt)){ + if(s->active_thread_type&FF_THREAD_FRAME) { + av_log_missing_feature(s, "Width/height changing with frame threads is", 0); + return -1; + } + for(i=0; i<4; i++){ av_freep(&buf->base[i]); buf->data[i]= NULL; @@ -396,6 +401,8 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){ /* If internal buffer type return the same buffer */ if(pic->type == FF_BUFFER_TYPE_INTERNAL) { + if(s->pkt) pic->pkt_pts= s->pkt->pts; + else pic->pkt_pts= AV_NOPTS_VALUE; pic->reordered_opaque= s->reordered_opaque; return 0; } @@ -530,13 +537,31 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) goto free_and_end; } avctx->frame_number = 0; + + if (HAVE_THREADS && !avctx->thread_opaque) { + ret = ff_thread_init(avctx, avctx->thread_count); + if (ret < 0) { + goto free_and_end; + } + } + if (avctx->codec->max_lowres < avctx->lowres) { av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", avctx->codec->max_lowres); goto free_and_end; } + if (avctx->codec->sample_fmts && avctx->codec->encode) { + int i; + for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) + if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) + break; + if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { + av_log(avctx, AV_LOG_ERROR, "Specified sample_fmt is not supported.\n"); + goto free_and_end; + } + } - if(avctx->codec->init){ + if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){ ret = avctx->codec->init(avctx); if (ret < 0) { goto free_and_end; @@ -634,14 +659,18 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi avctx->pkt = avpkt; - if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size){ - ret = avctx->codec->decode(avctx, picture, got_picture_ptr, - avpkt); + if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type&FF_THREAD_FRAME)){ + if (HAVE_PTHREADS && avctx->active_thread_type&FF_THREAD_FRAME) + ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr, + avpkt); + else { + ret = avctx->codec->decode(avctx, picture, got_picture_ptr, + avpkt); + picture->pkt_dts= avpkt->dts; + } emms_c(); //needed to avoid an emms_c() call before every return; - picture->pkt_dts= avpkt->dts; - if (*got_picture_ptr) avctx->frame_number++; }else @@ -757,7 +786,7 @@ av_cold int avcodec_close(AVCodecContext *avctx) } if (HAVE_THREADS && avctx->thread_opaque) - avcodec_thread_free(avctx); + ff_thread_free(avctx); if (avctx->codec && avctx->codec->close) avctx->codec->close(avctx); avcodec_default_free_buffers(avctx); @@ -766,6 +795,7 @@ av_cold int avcodec_close(AVCodecContext *avctx) if(avctx->codec && avctx->codec->encode) av_freep(&avctx->extradata); avctx->codec = NULL; + avctx->active_thread_type = 0; entangled_thread_counter--; /* Release any user-supplied mutex. */ @@ -1027,6 +1057,8 @@ void avcodec_init(void) void avcodec_flush_buffers(AVCodecContext *avctx) { + if(HAVE_PTHREADS && avctx->active_thread_type&FF_THREAD_FRAME) + ff_thread_flush(avctx); if(avctx->codec->flush) avctx->codec->flush(avctx); } @@ -1115,7 +1147,7 @@ int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt) { #endif #if !HAVE_THREADS -int avcodec_thread_init(AVCodecContext *s, int thread_count){ +int ff_thread_init(AVCodecContext *s, int thread_count){ s->thread_count = thread_count; return -1; } @@ -1136,7 +1168,7 @@ unsigned int av_xiphlacing(unsigned char *s, unsigned int v) } #if LIBAVCODEC_VERSION_MAJOR < 53 -#include "libavcore/parseutils.h" +#include "libavutil/parseutils.h" int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str) { @@ -1227,3 +1259,46 @@ unsigned int ff_toupper4(unsigned int x) + (toupper((x>>16)&0xFF)<<16) + (toupper((x>>24)&0xFF)<<24); } + +#if !HAVE_PTHREADS + +int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f) +{ + f->owner = avctx; + return avctx->get_buffer(avctx, f); +} + +void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f) +{ + f->owner->release_buffer(f->owner, f); +} + +void ff_thread_finish_setup(AVCodecContext *avctx) +{ +} + +void ff_thread_report_progress(AVFrame *f, int progress, int field) +{ +} + +void ff_thread_await_progress(AVFrame *f, int progress, int field) +{ +} + +#endif + +#if LIBAVCODEC_VERSION_MAJOR < 53 + +int avcodec_thread_init(AVCodecContext *s, int thread_count) +{ + return ff_thread_init(s, thread_count); +} + +void avcodec_thread_free(AVCodecContext *s) +{ +#if HAVE_THREADS + ff_thread_free(s); +#endif +} + +#endif diff --git a/mplayer/ffmpeg/libavcodec/vc1.c b/mplayer/ffmpeg/libavcodec/vc1.c index 86904cbf..27cd0108 100644 --- a/mplayer/ffmpeg/libavcodec/vc1.c +++ b/mplayer/ffmpeg/libavcodec/vc1.c @@ -280,6 +280,28 @@ static int vop_dquant_decoding(VC1Context *v) static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb); +static void simple_idct_put_rangered(uint8_t *dest, int line_size, DCTELEM *block) +{ + int i; + ff_simple_idct(block); + for (i = 0; i < 64; i++) block[i] = (block[i] - 64) << 1; + ff_put_pixels_clamped_c(block, dest, line_size); +} + +static void simple_idct_put_signed(uint8_t *dest, int line_size, DCTELEM *block) +{ + ff_simple_idct(block); + ff_put_signed_pixels_clamped_c(block, dest, line_size); +} + +static void simple_idct_put_signed_rangered(uint8_t *dest, int line_size, DCTELEM *block) +{ + int i; + ff_simple_idct(block); + for (i = 0; i < 64; i++) block[i] <<= 1; + ff_put_signed_pixels_clamped_c(block, dest, line_size); +} + /** * Decode Simple/Main Profiles sequence header * @see Figure 7-8, p16-17 @@ -293,7 +315,7 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte v->profile = get_bits(gb, 2); if (v->profile == PROFILE_COMPLEX) { - av_log(avctx, AV_LOG_ERROR, "WMV3 Complex Profile is not fully supported\n"); + av_log(avctx, AV_LOG_WARNING, "WMV3 Complex Profile is not fully supported\n"); } if (v->profile == PROFILE_ADVANCED) @@ -337,14 +359,18 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte v->res_fasttx = get_bits1(gb); if (!v->res_fasttx) { - v->s.dsp.vc1_inv_trans_8x8 = ff_simple_idct; - v->s.dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add; - v->s.dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add; - v->s.dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add; - v->s.dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add; - v->s.dsp.vc1_inv_trans_8x4_dc = ff_simple_idct84_add; - v->s.dsp.vc1_inv_trans_4x8_dc = ff_simple_idct48_add; - v->s.dsp.vc1_inv_trans_4x4_dc = ff_simple_idct44_add; + v->vc1dsp.vc1_inv_trans_8x8_add = ff_simple_idct_add; + v->vc1dsp.vc1_inv_trans_8x8_put[0] = ff_simple_idct_put; + v->vc1dsp.vc1_inv_trans_8x8_put[1] = simple_idct_put_rangered; + v->vc1dsp.vc1_inv_trans_8x8_put_signed[0] = simple_idct_put_signed; + v->vc1dsp.vc1_inv_trans_8x8_put_signed[1] = simple_idct_put_signed_rangered; + v->vc1dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add; + v->vc1dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add; + v->vc1dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add; + v->vc1dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add; + v->vc1dsp.vc1_inv_trans_8x4_dc = ff_simple_idct84_add; + v->vc1dsp.vc1_inv_trans_4x8_dc = ff_simple_idct48_add; + v->vc1dsp.vc1_inv_trans_4x4_dc = ff_simple_idct44_add; } v->fastuvmc = get_bits1(gb); //common diff --git a/mplayer/ffmpeg/libavcodec/vc1.h b/mplayer/ffmpeg/libavcodec/vc1.h index e5a9cbae..d826c5a8 100644 --- a/mplayer/ffmpeg/libavcodec/vc1.h +++ b/mplayer/ffmpeg/libavcodec/vc1.h @@ -26,6 +26,7 @@ #include "avcodec.h" #include "mpegvideo.h" #include "intrax8.h" +#include "vc1dsp.h" /** Markers used in VC-1 AP frame data */ //@{ @@ -155,6 +156,7 @@ enum COTypes { typedef struct VC1Context{ MpegEncContext s; IntraX8Context x8; + VC1DSPContext vc1dsp; int bits; @@ -215,6 +217,7 @@ typedef struct VC1Context{ int k_y; ///< Number of bits for MVs (depends on MV range) int range_x, range_y; ///< MV range uint8_t pq, altpq; ///< Current/alternate frame quantizer scale + uint8_t zz_8x8[4][64];///< Zigzag table for TT_8x8, permuted for IDCT const uint8_t* zz_8x4;///< Zigzag scan table for TT_8x4 coding mode const uint8_t* zz_4x8;///< Zigzag scan table for TT_4x8 coding mode /** pquant parameters */ diff --git a/mplayer/ffmpeg/libavcodec/vc1dec.c b/mplayer/ffmpeg/libavcodec/vc1dec.c index 3bd2cce2..b27b6d01 100644 --- a/mplayer/ffmpeg/libavcodec/vc1dec.c +++ b/mplayer/ffmpeg/libavcodec/vc1dec.c @@ -160,62 +160,30 @@ enum Imode { /** @} */ //Bitplane group -static void vc1_loop_filter_iblk(MpegEncContext *s, int pq) +static void vc1_loop_filter_iblk(VC1Context *v, int pq) { + MpegEncContext *s = &v->s; int j; if (!s->first_slice_line) { - s->dsp.vc1_v_loop_filter16(s->dest[0], s->linesize, pq); + v->vc1dsp.vc1_v_loop_filter16(s->dest[0], s->linesize, pq); if (s->mb_x) - s->dsp.vc1_h_loop_filter16(s->dest[0] - 16*s->linesize, s->linesize, pq); - s->dsp.vc1_h_loop_filter16(s->dest[0] - 16*s->linesize+8, s->linesize, pq); + v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16*s->linesize, s->linesize, pq); + v->vc1dsp.vc1_h_loop_filter16(s->dest[0] - 16*s->linesize+8, s->linesize, pq); for(j = 0; j < 2; j++){ - s->dsp.vc1_v_loop_filter8(s->dest[j+1], s->uvlinesize, pq); + v->vc1dsp.vc1_v_loop_filter8(s->dest[j+1], s->uvlinesize, pq); if (s->mb_x) - s->dsp.vc1_h_loop_filter8(s->dest[j+1]-8*s->uvlinesize, s->uvlinesize, pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[j+1]-8*s->uvlinesize, s->uvlinesize, pq); } } - s->dsp.vc1_v_loop_filter16(s->dest[0] + 8*s->linesize, s->linesize, pq); + v->vc1dsp.vc1_v_loop_filter16(s->dest[0] + 8*s->linesize, s->linesize, pq); if (s->mb_y == s->mb_height-1) { if (s->mb_x) { - s->dsp.vc1_h_loop_filter16(s->dest[0], s->linesize, pq); - s->dsp.vc1_h_loop_filter8(s->dest[1], s->uvlinesize, pq); - s->dsp.vc1_h_loop_filter8(s->dest[2], s->uvlinesize, pq); + v->vc1dsp.vc1_h_loop_filter16(s->dest[0], s->linesize, pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[1], s->uvlinesize, pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[2], s->uvlinesize, pq); } - s->dsp.vc1_h_loop_filter16(s->dest[0] + 8, s->linesize, pq); - } -} - -/** Put block onto picture - */ -static void vc1_put_block(VC1Context *v, DCTELEM block[6][64]) -{ - uint8_t *Y; - int ys, us, vs; - DSPContext *dsp = &v->s.dsp; - - if(v->rangeredfrm) { - int i, j, k; - for(k = 0; k < 6; k++) - for(j = 0; j < 8; j++) - for(i = 0; i < 8; i++) - block[k][i + j*8] = ((block[k][i + j*8] - 128) << 1) + 128; - - } - ys = v->s.current_picture.linesize[0]; - us = v->s.current_picture.linesize[1]; - vs = v->s.current_picture.linesize[2]; - Y = v->s.dest[0]; - - dsp->put_pixels_clamped(block[0], Y, ys); - dsp->put_pixels_clamped(block[1], Y + 8, ys); - Y += ys * 8; - dsp->put_pixels_clamped(block[2], Y, ys); - dsp->put_pixels_clamped(block[3], Y + 8, ys); - - if(!(v->s.flags & CODEC_FLAG_GRAY)) { - dsp->put_pixels_clamped(block[4], v->s.dest[1], us); - dsp->put_pixels_clamped(block[5], v->s.dest[2], vs); + v->vc1dsp.vc1_h_loop_filter16(s->dest[0] + 8, s->linesize, pq); } } @@ -342,11 +310,11 @@ static void vc1_mc_1mv(VC1Context *v, int dir) if(s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); - dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd); - dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd); + v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd); + v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd); srcY += s->linesize * 8; - dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize , srcY , s->linesize, v->rnd); - dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); + v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize , srcY , s->linesize, v->rnd); + v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); } else { // hpel mc - always used for luma dxy = (my & 2) | ((mx & 2) >> 1); @@ -364,8 +332,8 @@ static void vc1_mc_1mv(VC1Context *v, int dir) dsp->put_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); dsp->put_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); }else{ - dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); - dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); + v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); + v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); } } @@ -433,7 +401,7 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n) if(s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); - dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, v->rnd); + v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, v->rnd); } else { // hpel mc - always used for luma dxy = (my & 2) | ((mx & 2) >> 1); if(!v->rnd) @@ -583,8 +551,8 @@ static void vc1_mc_4mv_chroma(VC1Context *v) dsp->put_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); dsp->put_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); }else{ - dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); - dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); + v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); + v->vc1dsp.put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); } } @@ -906,11 +874,11 @@ static void vc1_interp_mc(VC1Context *v) if(s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); - dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd); - dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd); + v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd); + v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd); srcY += s->linesize * 8; - dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize , srcY , s->linesize, v->rnd); - dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); + v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize , srcY , s->linesize, v->rnd); + v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); } else { // hpel mc dxy = (my & 2) | ((mx & 2) >> 1); @@ -928,8 +896,8 @@ static void vc1_interp_mc(VC1Context *v) dsp->avg_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); dsp->avg_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); }else{ - dsp->avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); - dsp->avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); + v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy); + v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy); } } @@ -1375,7 +1343,7 @@ static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, int *value, if (index != vc1_ac_sizes[codingset] - 1) { run = vc1_index_decode_table[codingset][index][0]; level = vc1_index_decode_table[codingset][index][1]; - lst = index >= vc1_last_decode_table[codingset]; + lst = index >= vc1_last_decode_table[codingset] || get_bits_left(gb) < 0; if(get_bits1(gb)) level = -level; } else { @@ -1499,11 +1467,11 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded if(v->s.ac_pred) { if(!dc_pred_dir) - zz_table = wmv1_scantable[2]; + zz_table = v->zz_8x8[2]; else - zz_table = wmv1_scantable[3]; + zz_table = v->zz_8x8[3]; } else - zz_table = wmv1_scantable[1]; + zz_table = v->zz_8x8[1]; ac_val = s->ac_val[0][0] + s->block_index[n] * 16; ac_val2 = ac_val; @@ -1524,16 +1492,16 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded if(s->ac_pred) { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k << 3] += ac_val[k]; + block[k] += ac_val[k]; } else { //top for(k = 1; k < 8; k++) - block[k] += ac_val[k + 8]; + block[k << 3] += ac_val[k + 8]; } } /* save AC coeffs for further prediction */ for(k = 1; k < 8; k++) { - ac_val2[k] = block[k << 3]; - ac_val2[k + 8] = block[k]; + ac_val2[k] = block[k]; + ac_val2[k + 8] = block[k << 3]; } /* scale AC coeffs */ @@ -1570,15 +1538,15 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded if(s->ac_pred) { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) { - block[k << 3] = ac_val[k] * scale; - if(!v->pquantizer && block[k << 3]) - block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq; + block[k] = ac_val[k] * scale; + if(!v->pquantizer && block[k]) + block[k] += (block[k] < 0) ? -v->pq : v->pq; } } else { //top for(k = 1; k < 8; k++) { - block[k] = ac_val[k + 8] * scale; - if(!v->pquantizer && block[k]) - block[k] += (block[k] < 0) ? -v->pq : v->pq; + block[k << 3] = ac_val[k + 8] * scale; + if(!v->pquantizer && block[k << 3]) + block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq; } } i = 63; @@ -1682,11 +1650,11 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c if(v->s.ac_pred) { if(!dc_pred_dir) - zz_table = wmv1_scantable[2]; + zz_table = v->zz_8x8[2]; else - zz_table = wmv1_scantable[3]; + zz_table = v->zz_8x8[3]; } else - zz_table = wmv1_scantable[1]; + zz_table = v->zz_8x8[1]; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); @@ -1705,25 +1673,25 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k << 3] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; + block[k] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } else { //top for(k = 1; k < 8; k++) - block[k] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; + block[k << 3] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } else { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k << 3] += ac_val[k]; + block[k] += ac_val[k]; } else { //top for(k = 1; k < 8; k++) - block[k] += ac_val[k + 8]; + block[k << 3] += ac_val[k + 8]; } } } /* save AC coeffs for further prediction */ for(k = 1; k < 8; k++) { - ac_val2[k] = block[k << 3]; - ac_val2[k + 8] = block[k]; + ac_val2[k] = block[k]; + ac_val2[k + 8] = block[k << 3]; } /* scale AC coeffs */ @@ -1765,15 +1733,15 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c if(use_pred) { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) { - block[k << 3] = ac_val2[k] * scale; - if(!v->pquantizer && block[k << 3]) - block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; + block[k] = ac_val2[k] * scale; + if(!v->pquantizer && block[k]) + block[k] += (block[k] < 0) ? -mquant : mquant; } } else { //top for(k = 1; k < 8; k++) { - block[k] = ac_val2[k + 8] * scale; - if(!v->pquantizer && block[k]) - block[k] += (block[k] < 0) ? -mquant : mquant; + block[k << 3] = ac_val2[k + 8] * scale; + if(!v->pquantizer && block[k << 3]) + block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; } } i = 63; @@ -1884,17 +1852,14 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c if(coded) { int last = 0, skip, value; - const uint8_t *zz_table; int k; - zz_table = wmv1_scantable[0]; - while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); i += skip; if(i > 63) break; - block[zz_table[i++]] = value; + block[v->zz_8x8[0][i++]] = value; } /* apply AC prediction if needed */ @@ -1906,25 +1871,25 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k << 3] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; + block[k] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } else { //top for(k = 1; k < 8; k++) - block[k] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; + block[k << 3] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } else { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k << 3] += ac_val[k]; + block[k] += ac_val[k]; } else { //top for(k = 1; k < 8; k++) - block[k] += ac_val[k + 8]; + block[k << 3] += ac_val[k + 8]; } } } /* save AC coeffs for further prediction */ for(k = 1; k < 8; k++) { - ac_val2[k] = block[k << 3]; - ac_val2[k + 8] = block[k]; + ac_val2[k] = block[k]; + ac_val2[k + 8] = block[k << 3]; } /* scale AC coeffs */ @@ -1966,15 +1931,15 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c if(use_pred) { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) { - block[k << 3] = ac_val2[k] * scale; - if(!v->pquantizer && block[k << 3]) - block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; + block[k] = ac_val2[k] * scale; + if(!v->pquantizer && block[k]) + block[k] += (block[k] < 0) ? -mquant : mquant; } } else { //top for(k = 1; k < 8; k++) { - block[k] = ac_val2[k + 8] * scale; - if(!v->pquantizer && block[k]) - block[k] += (block[k] < 0) ? -mquant : mquant; + block[k << 3] = ac_val2[k + 8] * scale; + if(!v->pquantizer && block[k << 3]) + block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; } } i = 63; @@ -2035,22 +2000,21 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan i += skip; if(i > 63) break; - idx = wmv1_scantable[0][i++]; + idx = v->zz_8x8[0][i++]; block[idx] = value * scale; if(!v->pquantizer) block[idx] += (block[idx] < 0) ? -mquant : mquant; } if(!skip_block){ if(i==1) - s->dsp.vc1_inv_trans_8x8_dc(dst, linesize, block); + v->vc1dsp.vc1_inv_trans_8x8_dc(dst, linesize, block); else{ - s->dsp.vc1_inv_trans_8x8(block); - s->dsp.add_pixels_clamped(block, dst, linesize); + v->vc1dsp.vc1_inv_trans_8x8_add(dst, linesize, block); } if(apply_filter && cbp_top & 0xC) - s->dsp.vc1_v_loop_filter8(dst, linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter8(dst, linesize, v->pq); if(apply_filter && cbp_left & 0xA) - s->dsp.vc1_h_loop_filter8(dst, linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter8(dst, linesize, v->pq); } break; case TT_4X4: @@ -2071,13 +2035,13 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan } if(!(subblkpat & (1 << (3 - j))) && !skip_block){ if(i==1) - s->dsp.vc1_inv_trans_4x4_dc(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off); + v->vc1dsp.vc1_inv_trans_4x4_dc(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off); else - s->dsp.vc1_inv_trans_4x4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off); + v->vc1dsp.vc1_inv_trans_4x4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off); if(apply_filter && (j&2 ? pat & (1<<(j-2)) : (cbp_top & (1 << (j + 2))))) - s->dsp.vc1_v_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq); if(apply_filter && (j&1 ? pat & (1<<(j-1)) : (cbp_left & (1 << (j + 1))))) - s->dsp.vc1_h_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq); } } break; @@ -2099,13 +2063,13 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan } if(!(subblkpat & (1 << (1 - j))) && !skip_block){ if(i==1) - s->dsp.vc1_inv_trans_8x4_dc(dst + j*4*linesize, linesize, block + off); + v->vc1dsp.vc1_inv_trans_8x4_dc(dst + j*4*linesize, linesize, block + off); else - s->dsp.vc1_inv_trans_8x4(dst + j*4*linesize, linesize, block + off); + v->vc1dsp.vc1_inv_trans_8x4(dst + j*4*linesize, linesize, block + off); if(apply_filter && j ? pat & 0x3 : (cbp_top & 0xC)) - s->dsp.vc1_v_loop_filter8(dst + j*4*linesize, linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter8(dst + j*4*linesize, linesize, v->pq); if(apply_filter && cbp_left & (2 << j)) - s->dsp.vc1_h_loop_filter4(dst + j*4*linesize, linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter4(dst + j*4*linesize, linesize, v->pq); } } break; @@ -2127,13 +2091,13 @@ static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquan } if(!(subblkpat & (1 << (1 - j))) && !skip_block){ if(i==1) - s->dsp.vc1_inv_trans_4x8_dc(dst + j*4, linesize, block + off); + v->vc1dsp.vc1_inv_trans_4x8_dc(dst + j*4, linesize, block + off); else - s->dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off); + v->vc1dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off); if(apply_filter && cbp_top & (2 << j)) - s->dsp.vc1_v_loop_filter4(dst + j*4, linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter4(dst + j*4, linesize, v->pq); if(apply_filter && j ? pat & 0x5 : (cbp_left & 0xA)) - s->dsp.vc1_h_loop_filter8(dst + j*4, linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter8(dst + j*4, linesize, v->pq); } } break; @@ -2152,7 +2116,7 @@ static int vc1_decode_p_mb(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; - int i, j; + int i; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp; /* cbp decoding stuff */ int mqdiff, mquant; /* MB quantization */ @@ -2184,6 +2148,8 @@ static int vc1_decode_p_mb(VC1Context *v) { if (!skipped) { + vc1_idct_func idct8x8_fn; + GET_MVDATA(dmv_x, dmv_y); if (s->mb_intra) { @@ -2218,6 +2184,7 @@ static int vc1_decode_p_mb(VC1Context *v) VC1_TTMB_VLC_BITS, 2); if(!s->mb_intra) vc1_mc_1mv(v, 0); dst_idx = 0; + idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm]; for (i=0; i<6; i++) { s->dc_val[0][s->block_index[i]] = 0; @@ -2235,14 +2202,14 @@ static int vc1_decode_p_mb(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; - s->dsp.vc1_inv_trans_8x8(s->block[i]); - if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; - s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); + idct8x8_fn(s->dest[dst_idx] + off, + i & 4 ? s->uvlinesize : s->linesize, + s->block[i]); if(v->pq >= 9 && v->overlap) { if(v->c_avail) - s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); if(v->a_avail) - s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); } if(apply_loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){ int left_cbp, top_cbp; @@ -2254,9 +2221,9 @@ static int vc1_decode_p_mb(VC1Context *v) top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4)); } if(left_cbp & 0xC) - s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); if(top_cbp & 0xA) - s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); } block_cbp |= 0xF << (i << 2); } else if(val) { @@ -2271,9 +2238,9 @@ static int vc1_decode_p_mb(VC1Context *v) top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4)); } if(left_cbp & 0xC) - s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); if(top_cbp & 0xA) - s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); } pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), filter, left_cbp, top_cbp); block_cbp |= pat << (i << 2); @@ -2302,6 +2269,7 @@ static int vc1_decode_p_mb(VC1Context *v) { int intra_count = 0, coded_inter = 0; int is_intra[6], is_coded[6]; + vc1_idct_func idct8x8_fn; /* Get CBPCY */ cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); for (i=0; i<6; i++) @@ -2351,6 +2319,7 @@ static int vc1_decode_p_mb(VC1Context *v) } if (!v->ttmbf && coded_inter) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); + idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm]; for (i=0; i<6; i++) { dst_idx += i >> 2; @@ -2366,14 +2335,14 @@ static int vc1_decode_p_mb(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; - s->dsp.vc1_inv_trans_8x8(s->block[i]); - if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; - s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize); + idct8x8_fn(s->dest[dst_idx] + off, + (i&4)?s->uvlinesize:s->linesize, + s->block[i]); if(v->pq >= 9 && v->overlap) { if(v->c_avail) - s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); if(v->a_avail) - s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); } if(v->s.loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){ int left_cbp, top_cbp; @@ -2385,9 +2354,9 @@ static int vc1_decode_p_mb(VC1Context *v) top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4)); } if(left_cbp & 0xC) - s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); if(top_cbp & 0xA) - s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); } block_cbp |= 0xF << (i << 2); } else if(is_coded[i]) { @@ -2402,9 +2371,9 @@ static int vc1_decode_p_mb(VC1Context *v) top_cbp = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4)); } if(left_cbp & 0xC) - s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); if(top_cbp & 0xA) - s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); + v->vc1dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq); } pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), filter, left_cbp, top_cbp); block_cbp |= pat << (i << 2); @@ -2444,7 +2413,7 @@ static void vc1_decode_b_mb(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; - int i, j; + int i; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp = 0; /* cbp decoding stuff */ int mqdiff, mquant; /* MB quantization */ @@ -2457,6 +2426,7 @@ static void vc1_decode_b_mb(VC1Context *v) int skipped, direct; int dmv_x[2], dmv_y[2]; int bmvtype = BMV_TYPE_BACKWARD; + vc1_idct_func idct8x8_fn; mquant = v->pq; /* Loosy initialization */ s->mb_intra = 0; @@ -2554,6 +2524,7 @@ static void vc1_decode_b_mb(VC1Context *v) } } dst_idx = 0; + idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm]; for (i=0; i<6; i++) { s->dc_val[0][s->block_index[i]] = 0; @@ -2571,9 +2542,9 @@ static void vc1_decode_b_mb(VC1Context *v) vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; - s->dsp.vc1_inv_trans_8x8(s->block[i]); - if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; - s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); + idct8x8_fn(s->dest[dst_idx] + off, + i & 4 ? s->uvlinesize : s->linesize, + s->block[i]); } else if(val) { vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), 0, 0, 0); if(!v->ttmbf && ttmb < 8) ttmb = -1; @@ -2586,11 +2557,12 @@ static void vc1_decode_b_mb(VC1Context *v) */ static void vc1_decode_i_blocks(VC1Context *v) { - int k, j; + int k; MpegEncContext *s = &v->s; int cbp, val; uint8_t *coded_val; int mb_pos; + vc1_idct_func idct8x8_fn; /* select codingmode used for VLC tables selection */ switch(v->y_ac_table_index){ @@ -2625,11 +2597,22 @@ static void vc1_decode_i_blocks(VC1Context *v) s->mb_x = s->mb_y = 0; s->mb_intra = 1; s->first_slice_line = 1; + if(v->pq >= 9 && v->overlap) { + idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[!!v->rangeredfrm]; + } else + idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put[!!v->rangeredfrm]; for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); for(; s->mb_x < s->mb_width; s->mb_x++) { + uint8_t *dst[6]; ff_update_block_index(s); + dst[0] = s->dest[0]; + dst[1] = dst[0] + 8; + dst[2] = s->dest[0] + s->linesize * 8; + dst[3] = dst[2] + 8; + dst[4] = s->dest[1]; + dst[5] = s->dest[2]; s->dsp.clear_blocks(s->block[0]); mb_pos = s->mb_x + s->mb_y * s->mb_width; s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; @@ -2653,36 +2636,35 @@ static void vc1_decode_i_blocks(VC1Context *v) vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2); - s->dsp.vc1_inv_trans_8x8(s->block[k]); - if(v->pq >= 9 && v->overlap) { - for(j = 0; j < 64; j++) s->block[k][j] += 128; - } + if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; + idct8x8_fn(dst[k], + k & 4 ? s->uvlinesize : s->linesize, + s->block[k]); } - vc1_put_block(v, s->block); if(v->pq >= 9 && v->overlap) { if(s->mb_x) { - s->dsp.vc1_h_overlap(s->dest[0], s->linesize); - s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { - s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); - s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); + v->vc1dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); + v->vc1dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); } } - s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); - s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); if(!s->first_slice_line) { - s->dsp.vc1_v_overlap(s->dest[0], s->linesize); - s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0], s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { - s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); - s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); + v->vc1dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); + v->vc1dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); } } - s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); - s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); } - if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq); + if(v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq); if(get_bits_count(&s->gb) > v->bits) { ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); @@ -2706,7 +2688,7 @@ static void vc1_decode_i_blocks(VC1Context *v) */ static void vc1_decode_i_blocks_adv(VC1Context *v) { - int k, j; + int k; MpegEncContext *s = &v->s; int cbp, val; uint8_t *coded_val; @@ -2715,6 +2697,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) int mqdiff; int overlap; GetBitContext *gb = &s->gb; + vc1_idct_func idct8x8_fn; /* select codingmode used for VLC tables selection */ switch(v->y_ac_table_index){ @@ -2745,11 +2728,19 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) s->mb_x = s->mb_y = 0; s->mb_intra = 1; s->first_slice_line = 1; + idct8x8_fn = v->vc1dsp.vc1_inv_trans_8x8_put_signed[0]; for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); for(;s->mb_x < s->mb_width; s->mb_x++) { + uint8_t *dst[6]; ff_update_block_index(s); + dst[0] = s->dest[0]; + dst[1] = dst[0] + 8; + dst[2] = s->dest[0] + s->linesize * 8; + dst[3] = dst[2] + 8; + dst[4] = s->dest[1]; + dst[5] = s->dest[2]; s->dsp.clear_blocks(s->block[0]); mb_pos = s->mb_x + s->mb_y * s->mb_stride; s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; @@ -2793,34 +2784,35 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) vc1_decode_i_block_adv(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant); - s->dsp.vc1_inv_trans_8x8(s->block[k]); - for(j = 0; j < 64; j++) s->block[k][j] += 128; + if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; + idct8x8_fn(dst[k], + k & 4 ? s->uvlinesize : s->linesize, + s->block[k]); } - vc1_put_block(v, s->block); if(overlap) { if(s->mb_x) { - s->dsp.vc1_h_overlap(s->dest[0], s->linesize); - s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0], s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { - s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); - s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); + v->vc1dsp.vc1_h_overlap(s->dest[1], s->uvlinesize); + v->vc1dsp.vc1_h_overlap(s->dest[2], s->uvlinesize); } } - s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); - s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize); + v->vc1dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); if(!s->first_slice_line) { - s->dsp.vc1_v_overlap(s->dest[0], s->linesize); - s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0], s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize); if(!(s->flags & CODEC_FLAG_GRAY)) { - s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); - s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); + v->vc1dsp.vc1_v_overlap(s->dest[1], s->uvlinesize); + v->vc1dsp.vc1_v_overlap(s->dest[2], s->uvlinesize); } } - s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); - s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize); + v->vc1dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize); } - if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq); + if(v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq); if(get_bits_count(&s->gb) > v->bits) { ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); @@ -2932,7 +2924,7 @@ static void vc1_decode_b_blocks(VC1Context *v) av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y); return; } - if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq); + if(v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq); } if (!v->s.loop_filter) ff_draw_horiz_band(s, s->mb_y * 16, 16); @@ -3007,6 +2999,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; GetBitContext gb; + int i; if (!avctx->extradata_size || !avctx->extradata) return -1; if (!(avctx->flags & CODEC_FLAG_GRAY)) @@ -3025,6 +3018,14 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) if(ff_msmpeg4_decode_init(avctx) < 0) return -1; if (vc1_init_common(v) < 0) return -1; + ff_vc1dsp_init(&v->vc1dsp); + for (i = 0; i < 64; i++) { +#define transpose(x) ((x>>3) | ((x&7)<<3)) + v->zz_8x8[0][i] = transpose(wmv1_scantable[0][i]); + v->zz_8x8[1][i] = transpose(wmv1_scantable[1][i]); + v->zz_8x8[2][i] = transpose(wmv1_scantable[2][i]); + v->zz_8x8[3][i] = transpose(wmv1_scantable[3][i]); + } avctx->coded_width = avctx->width; avctx->coded_height = avctx->height; @@ -3148,7 +3149,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, const uint8_t *buf_start = buf; /* no supplementary picture */ - if (buf_size == 0) { + if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) { /* special case for last picture */ if (s->low_delay==0 && s->next_picture_ptr) { *pict= *(AVFrame*)s->next_picture_ptr; diff --git a/mplayer/ffmpeg/libavcodec/vc1dsp.c b/mplayer/ffmpeg/libavcodec/vc1dsp.c index aab16947..2ab312ab 100644 --- a/mplayer/ffmpeg/libavcodec/vc1dsp.c +++ b/mplayer/ffmpeg/libavcodec/vc1dsp.c @@ -25,7 +25,7 @@ * */ -#include "dsputil.h" +#include "vc1dsp.h" /** Apply overlap transform to horizontal edge @@ -199,29 +199,29 @@ static void vc1_inv_trans_8x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block) } } -static void vc1_inv_trans_8x8_c(DCTELEM block[64]) +static av_always_inline void vc1_inv_trans_8x8_c(DCTELEM block[64], int shl, int sub) { int i; register int t1,t2,t3,t4,t5,t6,t7,t8; - DCTELEM *src, *dst; + DCTELEM *src, *dst, temp[64]; src = block; - dst = block; + dst = temp; for(i = 0; i < 8; i++){ - t1 = 12 * (src[0] + src[4]) + 4; - t2 = 12 * (src[0] - src[4]) + 4; - t3 = 16 * src[2] + 6 * src[6]; - t4 = 6 * src[2] - 16 * src[6]; + t1 = 12 * (src[ 0] + src[32]) + 4; + t2 = 12 * (src[ 0] - src[32]) + 4; + t3 = 16 * src[16] + 6 * src[48]; + t4 = 6 * src[16] - 16 * src[48]; t5 = t1 + t3; t6 = t2 + t4; t7 = t2 - t4; t8 = t1 - t3; - t1 = 16 * src[1] + 15 * src[3] + 9 * src[5] + 4 * src[7]; - t2 = 15 * src[1] - 4 * src[3] - 16 * src[5] - 9 * src[7]; - t3 = 9 * src[1] - 16 * src[3] + 4 * src[5] + 15 * src[7]; - t4 = 4 * src[1] - 9 * src[3] + 15 * src[5] - 16 * src[7]; + t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56]; + t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56]; + t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56]; + t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56]; dst[0] = (t5 + t1) >> 3; dst[1] = (t6 + t2) >> 3; @@ -232,11 +232,11 @@ static void vc1_inv_trans_8x8_c(DCTELEM block[64]) dst[6] = (t6 - t2) >> 3; dst[7] = (t5 - t1) >> 3; - src += 8; + src += 1; dst += 8; } - src = block; + src = temp; dst = block; for(i = 0; i < 8; i++){ t1 = 12 * (src[ 0] + src[32]) + 64; @@ -254,20 +254,50 @@ static void vc1_inv_trans_8x8_c(DCTELEM block[64]) t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56]; t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56]; - dst[ 0] = (t5 + t1) >> 7; - dst[ 8] = (t6 + t2) >> 7; - dst[16] = (t7 + t3) >> 7; - dst[24] = (t8 + t4) >> 7; - dst[32] = (t8 - t4 + 1) >> 7; - dst[40] = (t7 - t3 + 1) >> 7; - dst[48] = (t6 - t2 + 1) >> 7; - dst[56] = (t5 - t1 + 1) >> 7; + dst[ 0] = (((t5 + t1 ) >> 7) - sub) << shl; + dst[ 8] = (((t6 + t2 ) >> 7) - sub) << shl; + dst[16] = (((t7 + t3 ) >> 7) - sub) << shl; + dst[24] = (((t8 + t4 ) >> 7) - sub) << shl; + dst[32] = (((t8 - t4 + 1) >> 7) - sub) << shl; + dst[40] = (((t7 - t3 + 1) >> 7) - sub) << shl; + dst[48] = (((t6 - t2 + 1) >> 7) - sub) << shl; + dst[56] = (((t5 - t1 + 1) >> 7) - sub) << shl; src++; dst++; } } +static void vc1_inv_trans_8x8_add_c(uint8_t *dest, int linesize, DCTELEM *block) +{ + vc1_inv_trans_8x8_c(block, 0, 0); + ff_add_pixels_clamped_c(block, dest, linesize); +} + +static void vc1_inv_trans_8x8_put_signed_c(uint8_t *dest, int linesize, DCTELEM *block) +{ + vc1_inv_trans_8x8_c(block, 0, 0); + ff_put_signed_pixels_clamped_c(block, dest, linesize); +} + +static void vc1_inv_trans_8x8_put_signed_rangered_c(uint8_t *dest, int linesize, DCTELEM *block) +{ + vc1_inv_trans_8x8_c(block, 1, 0); + ff_put_signed_pixels_clamped_c(block, dest, linesize); +} + +static void vc1_inv_trans_8x8_put_c(uint8_t *dest, int linesize, DCTELEM *block) +{ + vc1_inv_trans_8x8_c(block, 0, 0); + ff_put_pixels_clamped_c(block, dest, linesize); +} + +static void vc1_inv_trans_8x8_put_rangered_c(uint8_t *dest, int linesize, DCTELEM *block) +{ + vc1_inv_trans_8x8_c(block, 1, 64); + ff_put_pixels_clamped_c(block, dest, linesize); +} + /** Do inverse transform on 8x4 part of block */ static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block) @@ -612,8 +642,61 @@ PUT_VC1_MSPEL(1, 3) PUT_VC1_MSPEL(2, 3) PUT_VC1_MSPEL(3, 3) -av_cold void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx) { - dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c; +static void put_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){ + const int A=(8-x)*(8-y); + const int B=( x)*(8-y); + const int C=(8-x)*( y); + const int D=( x)*( y); + int i; + + assert(x<8 && y<8 && x>=0 && y>=0); + + for(i=0; i> 6; + dst[1] = (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6; + dst[2] = (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6; + dst[3] = (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6; + dst[4] = (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6; + dst[5] = (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6; + dst[6] = (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6; + dst[7] = (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6; + dst+= stride; + src+= stride; + } +} + +#define avg2(a,b) ((a+b+1)>>1) +static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){ + const int A=(8-x)*(8-y); + const int B=( x)*(8-y); + const int C=(8-x)*( y); + const int D=( x)*( y); + int i; + + assert(x<8 && y<8 && x>=0 && y>=0); + + for(i=0; i> 6)); + dst[1] = avg2(dst[1], ((A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6)); + dst[2] = avg2(dst[2], ((A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6)); + dst[3] = avg2(dst[3], ((A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6)); + dst[4] = avg2(dst[4], ((A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6)); + dst[5] = avg2(dst[5], ((A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6)); + dst[6] = avg2(dst[6], ((A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6)); + dst[7] = avg2(dst[7], ((A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6)); + dst+= stride; + src+= stride; + } +} + +av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) { + dsp->vc1_inv_trans_8x8_add = vc1_inv_trans_8x8_add_c; + dsp->vc1_inv_trans_8x8_put_signed[0] = vc1_inv_trans_8x8_put_signed_c; + dsp->vc1_inv_trans_8x8_put_signed[1] = vc1_inv_trans_8x8_put_signed_rangered_c; + dsp->vc1_inv_trans_8x8_put[0] = vc1_inv_trans_8x8_put_c; + dsp->vc1_inv_trans_8x8_put[1] = vc1_inv_trans_8x8_put_rangered_c; dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c; dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c; dsp->vc1_inv_trans_4x4 = vc1_inv_trans_4x4_c; @@ -663,4 +746,14 @@ av_cold void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx) { dsp->avg_vc1_mspel_pixels_tab[13] = avg_vc1_mspel_mc13_c; dsp->avg_vc1_mspel_pixels_tab[14] = avg_vc1_mspel_mc23_c; dsp->avg_vc1_mspel_pixels_tab[15] = avg_vc1_mspel_mc33_c; + + dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c; + + if (HAVE_ALTIVEC) + ff_vc1dsp_init_altivec(dsp); + if (HAVE_PAIRED) + ff_vc1dsp_init_paired(dsp); + if (HAVE_MMX) + ff_vc1dsp_init_mmx(dsp); } diff --git a/mplayer/ffmpeg/libavcodec/vc1dsp.h b/mplayer/ffmpeg/libavcodec/vc1dsp.h new file mode 100644 index 00000000..4d255e06 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/vc1dsp.h @@ -0,0 +1,72 @@ +/* + * VC-1 and WMV3 decoder - DSP functions + * Copyright (c) 2006 Konstantin Shishkov + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * VC-1 and WMV3 decoder + * + */ + +#ifndef AVCODEC_VC1DSP_H +#define AVCODEC_VC1DSP_H + +#include "dsputil.h" + +typedef void (*vc1_idct_func)(uint8_t *dest, int line_size, DCTELEM *block); + +typedef struct VC1DSPContext { + /* vc1 functions */ + vc1_idct_func vc1_inv_trans_8x8_add; + vc1_idct_func vc1_inv_trans_8x8_put_signed[2]; + vc1_idct_func vc1_inv_trans_8x8_put[2]; + void (*vc1_inv_trans_8x4)(uint8_t *dest, int line_size, DCTELEM *block); + void (*vc1_inv_trans_4x8)(uint8_t *dest, int line_size, DCTELEM *block); + void (*vc1_inv_trans_4x4)(uint8_t *dest, int line_size, DCTELEM *block); + void (*vc1_inv_trans_8x8_dc)(uint8_t *dest, int line_size, DCTELEM *block); + void (*vc1_inv_trans_8x4_dc)(uint8_t *dest, int line_size, DCTELEM *block); + void (*vc1_inv_trans_4x8_dc)(uint8_t *dest, int line_size, DCTELEM *block); + void (*vc1_inv_trans_4x4_dc)(uint8_t *dest, int line_size, DCTELEM *block); + void (*vc1_v_overlap)(uint8_t* src, int stride); + void (*vc1_h_overlap)(uint8_t* src, int stride); + void (*vc1_v_loop_filter4)(uint8_t *src, int stride, int pq); + void (*vc1_h_loop_filter4)(uint8_t *src, int stride, int pq); + void (*vc1_v_loop_filter8)(uint8_t *src, int stride, int pq); + void (*vc1_h_loop_filter8)(uint8_t *src, int stride, int pq); + void (*vc1_v_loop_filter16)(uint8_t *src, int stride, int pq); + void (*vc1_h_loop_filter16)(uint8_t *src, int stride, int pq); + + /* put 8x8 block with bicubic interpolation and quarterpel precision + * last argument is actually round value instead of height + */ + op_pixels_func put_vc1_mspel_pixels_tab[16]; + op_pixels_func avg_vc1_mspel_pixels_tab[16]; + + /* This is really one func used in VC-1 decoding */ + h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3]; + h264_chroma_mc_func avg_no_rnd_vc1_chroma_pixels_tab[3]; +} VC1DSPContext; + +void ff_vc1dsp_init(VC1DSPContext* c); +void ff_vc1dsp_init_altivec(VC1DSPContext* c); +void ff_vc1dsp_init_paired(VC1DSPContext* c); +void ff_vc1dsp_init_mmx(VC1DSPContext* dsp); + +#endif /* AVCODEC_VC1DSP_H */ diff --git a/mplayer/ffmpeg/libavcodec/vmdav.c b/mplayer/ffmpeg/libavcodec/vmdav.c index e396c0bc..86e36837 100644 --- a/mplayer/ffmpeg/libavcodec/vmdav.c +++ b/mplayer/ffmpeg/libavcodec/vmdav.c @@ -414,11 +414,13 @@ static av_cold int vmdvideo_decode_end(AVCodecContext *avctx) * Audio Decoder */ +#define BLOCK_TYPE_AUDIO 1 +#define BLOCK_TYPE_INITIAL 2 +#define BLOCK_TYPE_SILENCE 3 + typedef struct VmdAudioContext { AVCodecContext *avctx; - int channels; - int bits; - int block_align; + int out_bps; int predictors[2]; } VmdAudioContext; @@ -443,13 +445,16 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx) VmdAudioContext *s = avctx->priv_data; s->avctx = avctx; - s->channels = avctx->channels; - s->bits = avctx->bits_per_coded_sample; - s->block_align = avctx->block_align; - avctx->sample_fmt = AV_SAMPLE_FMT_S16; + if (avctx->bits_per_coded_sample == 16) + avctx->sample_fmt = AV_SAMPLE_FMT_S16; + else + avctx->sample_fmt = AV_SAMPLE_FMT_U8; + s->out_bps = av_get_bits_per_sample_fmt(avctx->sample_fmt) >> 3; - av_log(s->avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, block align = %d, sample rate = %d\n", - s->channels, s->bits, s->block_align, avctx->sample_rate); + av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, " + "block align = %d, sample rate = %d\n", + avctx->channels, avctx->bits_per_coded_sample, avctx->block_align, + avctx->sample_rate); return 0; } @@ -473,49 +478,22 @@ static void vmdaudio_decode_audio(VmdAudioContext *s, unsigned char *data, } static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, - const uint8_t *buf, int silence, int data_size) + const uint8_t *buf, int silent_chunks, int data_size) { - int bytes_decoded = 0; - int i; + int silent_size = s->avctx->block_align * silent_chunks * s->out_bps; -// if (silence) -// av_log(s->avctx, AV_LOG_INFO, "silent block!\n"); - if (s->channels == 2) { - - /* stereo handling */ - if (silence) { - memset(data, 0, data_size * 2); - } else { - if (s->bits == 16) - vmdaudio_decode_audio(s, data, buf, data_size, 1); - else { - /* copy the data but convert it to signed */ - for (i = 0; i < data_size; i++){ - *data++ = buf[i] + 0x80; - *data++ = buf[i] + 0x80; - } - } - } - } else { - bytes_decoded = data_size * 2; - - /* mono handling */ - if (silence) { - memset(data, 0, data_size * 2); - } else { - if (s->bits == 16) { - vmdaudio_decode_audio(s, data, buf, data_size, 0); - } else { - /* copy the data but convert it to signed */ - for (i = 0; i < data_size; i++){ - *data++ = buf[i] + 0x80; - *data++ = buf[i] + 0x80; - } - } - } + if (silent_chunks) { + memset(data, s->out_bps == 2 ? 0x00 : 0x80, silent_size); + data += silent_size; + } + if (s->avctx->bits_per_coded_sample == 16) + vmdaudio_decode_audio(s, data, buf, data_size, s->avctx->channels == 2); + else { + /* just copy the data */ + memcpy(data, buf, data_size); } - return data_size * 2; + return silent_size + data_size * s->out_bps; } static int vmdaudio_decode_frame(AVCodecContext *avctx, @@ -525,39 +503,41 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; VmdAudioContext *s = avctx->priv_data; + int block_type, silent_chunks; unsigned char *output_samples = (unsigned char *)data; - /* point to the start of the encoded data */ - const unsigned char *p = buf + 16; - - if (buf_size < 16) + if (buf_size < 16) { + av_log(avctx, AV_LOG_WARNING, "skipping small junk packet\n"); + *data_size = 0; return buf_size; + } - if (buf[6] == 1) { - /* the chunk contains audio */ - *data_size = vmdaudio_loadsound(s, output_samples, p, 0, buf_size - 16); - } else if (buf[6] == 2) { - /* initial chunk, may contain audio and silence */ - uint32_t flags = AV_RB32(p); - int raw_block_size = s->block_align * s->bits / 8; - int silent_chunks; - if(flags == 0xFFFFFFFF) - silent_chunks = 32; - else - silent_chunks = av_log2(flags + 1); - if(*data_size < (s->block_align*silent_chunks + buf_size - 20) * 2) - return -1; - *data_size = 0; - memset(output_samples, 0, raw_block_size * silent_chunks); - output_samples += raw_block_size * silent_chunks; - *data_size = raw_block_size * silent_chunks; - *data_size += vmdaudio_loadsound(s, output_samples, p + 4, 0, buf_size - 20); - } else if (buf[6] == 3) { - /* silent chunk */ - *data_size = vmdaudio_loadsound(s, output_samples, p, 1, 0); + block_type = buf[6]; + if (block_type < BLOCK_TYPE_AUDIO || block_type > BLOCK_TYPE_SILENCE) { + av_log(avctx, AV_LOG_ERROR, "unknown block type: %d\n", block_type); + return AVERROR(EINVAL); + } + buf += 16; + buf_size -= 16; + + silent_chunks = 0; + if (block_type == BLOCK_TYPE_INITIAL) { + uint32_t flags = AV_RB32(buf); + silent_chunks = av_popcount(flags); + buf += 4; + buf_size -= 4; + } else if (block_type == BLOCK_TYPE_SILENCE) { + silent_chunks = 1; + buf_size = 0; // should already be zero but set it just to be sure } - return buf_size; + /* ensure output buffer is large enough */ + if (*data_size < (avctx->block_align*silent_chunks + buf_size) * s->out_bps) + return -1; + + *data_size = vmdaudio_loadsound(s, output_samples, buf, silent_chunks, buf_size); + + return avpkt->size; } diff --git a/mplayer/ffmpeg/libavcodec/vorbis_data.c b/mplayer/ffmpeg/libavcodec/vorbis_data.c index 24c9921f..8fa62416 100644 --- a/mplayer/ffmpeg/libavcodec/vorbis_data.c +++ b/mplayer/ffmpeg/libavcodec/vorbis_data.c @@ -20,6 +20,7 @@ #include "dsputil.h" #include "vorbis.h" +#include "libavutil/audioconvert.h" const uint8_t ff_vorbis_channel_layout_offsets[8][8] = { { 0 }, @@ -44,14 +45,14 @@ const uint8_t ff_vorbis_encoding_channel_layout_offsets[8][8] = { }; const int64_t ff_vorbis_channel_layouts[9] = { - CH_LAYOUT_MONO, - CH_LAYOUT_STEREO, - CH_LAYOUT_SURROUND, - CH_LAYOUT_QUAD, - CH_LAYOUT_5POINT0_BACK, - CH_LAYOUT_5POINT1_BACK, - CH_LAYOUT_5POINT1|CH_BACK_CENTER, - CH_LAYOUT_7POINT1, + AV_CH_LAYOUT_MONO, + AV_CH_LAYOUT_STEREO, + AV_CH_LAYOUT_SURROUND, + AV_CH_LAYOUT_QUAD, + AV_CH_LAYOUT_5POINT0_BACK, + AV_CH_LAYOUT_5POINT1_BACK, + AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER, + AV_CH_LAYOUT_7POINT1, 0 }; diff --git a/mplayer/ffmpeg/libavcodec/vorbis_dec.c b/mplayer/ffmpeg/libavcodec/vorbis_dec.c index 69b784c6..deaae757 100644 --- a/mplayer/ffmpeg/libavcodec/vorbis_dec.c +++ b/mplayer/ffmpeg/libavcodec/vorbis_dec.c @@ -31,6 +31,7 @@ #include "get_bits.h" #include "dsputil.h" #include "fft.h" +#include "fmtconvert.h" #include "vorbis.h" #include "xiph.h" @@ -127,6 +128,7 @@ typedef struct vorbis_context_s { AVCodecContext *avccontext; GetBitContext gb; DSPContext dsp; + FmtConvertContext fmt_conv; FFTContext mdct[2]; uint_fast8_t first_frame; @@ -566,9 +568,9 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) /* zero would result in a div by zero later * * 2^0 - 1 == 0 */ if (floor_setup->data.t0.amplitude_bits == 0) { - av_log(vc->avccontext, AV_LOG_ERROR, - "Floor 0 amplitude bits is 0.\n"); - return -1; + av_log(vc->avccontext, AV_LOG_ERROR, + "Floor 0 amplitude bits is 0.\n"); + return -1; } floor_setup->data.t0.amplitude_offset = get_bits(gb, 8); floor_setup->data.t0.num_books = get_bits(gb, 4) + 1; @@ -592,37 +594,34 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) create_map(vc, i); - /* allocate mem for lsp coefficients */ - { - /* codebook dim is for padding if codebook dim doesn't * - * divide order+1 then we need to read more data */ - floor_setup->data.t0.lsp = - av_malloc((floor_setup->data.t0.order+1 + max_codebook_dim) - * sizeof(float)); - if (!floor_setup->data.t0.lsp) - return -1; - } + /* codebook dim is for padding if codebook dim doesn't * + * divide order+1 then we need to read more data */ + floor_setup->data.t0.lsp = + av_malloc((floor_setup->data.t0.order+1 + max_codebook_dim) + * sizeof(float)); + if (!floor_setup->data.t0.lsp) + return -1; #ifdef V_DEBUG /* debug output parsed headers */ AV_DEBUG("floor0 order: %u\n", floor_setup->data.t0.order); AV_DEBUG("floor0 rate: %u\n", floor_setup->data.t0.rate); AV_DEBUG("floor0 bark map size: %u\n", - floor_setup->data.t0.bark_map_size); + floor_setup->data.t0.bark_map_size); AV_DEBUG("floor0 amplitude bits: %u\n", - floor_setup->data.t0.amplitude_bits); + floor_setup->data.t0.amplitude_bits); AV_DEBUG("floor0 amplitude offset: %u\n", - floor_setup->data.t0.amplitude_offset); + floor_setup->data.t0.amplitude_offset); AV_DEBUG("floor0 number of books: %u\n", - floor_setup->data.t0.num_books); + floor_setup->data.t0.num_books); AV_DEBUG("floor0 book list pointer: %p\n", - floor_setup->data.t0.book_list); + floor_setup->data.t0.book_list); { - int idx; - for (idx = 0; idx < floor_setup->data.t0.num_books; ++idx) { - AV_DEBUG(" Book %d: %u\n", - idx+1, - floor_setup->data.t0.book_list[idx]); - } + int idx; + for (idx = 0; idx < floor_setup->data.t0.num_books; ++idx) { + AV_DEBUG(" Book %d: %u\n", + idx+1, + floor_setup->data.t0.book_list[idx]); + } } #endif } else { @@ -800,12 +799,12 @@ static void create_map(vorbis_context *vc, uint_fast8_t floor_number) vf->map_size[blockflag] = n; } -# ifdef V_DEBUG +#ifdef V_DEBUG for (idx = 0; idx <= n; ++idx) { AV_DEBUG("floor0 map: map at pos %d is %d\n", idx, map[idx]); } -# endif +#endif } static int vorbis_parse_setup_hdr_modes(vorbis_context *vc) @@ -961,6 +960,7 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext) vc->avccontext = avccontext; dsputil_init(&vc->dsp, avccontext); + ff_fmt_convert_init(&vc->fmt_conv, avccontext); vc->scale_bias = 32768.0f; @@ -1037,7 +1037,6 @@ static int vorbis_floor0_decode(vorbis_context *vc, av_log(vc->avccontext, AV_LOG_ERROR, "floor0 dec: booknumber too high!\n"); book_idx = 0; - //FIXME: look above } AV_DEBUG("floor0 dec: booknumber: %u\n", book_idx); codebook = vc->codebooks[vf->book_list[book_idx]]; @@ -1107,11 +1106,9 @@ static int vorbis_floor0_decode(vorbis_context *vc, } /* calculate linear floor value */ - { - q = exp((((amplitude*vf->amplitude_offset) / - (((1 << vf->amplitude_bits) - 1) * sqrt(p + q))) - - vf->amplitude_offset) * .11512925f); - } + q = exp((((amplitude*vf->amplitude_offset) / + (((1 << vf->amplitude_bits) - 1) * sqrt(p + q))) + - vf->amplitude_offset) * .11512925f); /* fill vector */ do { @@ -1575,13 +1572,13 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) const float *win = vc->win[blockflag & previous_window]; if (blockflag == previous_window) { - vc->dsp.vector_fmul_window(ret, saved, buf, win, 0, blocksize / 4); + vc->dsp.vector_fmul_window(ret, saved, buf, win, blocksize / 4); } else if (blockflag > previous_window) { - vc->dsp.vector_fmul_window(ret, saved, buf, win, 0, bs0 / 4); + vc->dsp.vector_fmul_window(ret, saved, buf, win, bs0 / 4); memcpy(ret+bs0/2, buf+bs0/4, ((bs1-bs0)/4) * sizeof(float)); } else { memcpy(ret, saved, ((bs1 - bs0) / 4) * sizeof(float)); - vc->dsp.vector_fmul_window(ret + (bs1 - bs0) / 4, saved + (bs1 - bs0) / 4, buf, win, 0, bs0 / 4); + vc->dsp.vector_fmul_window(ret + (bs1 - bs0) / 4, saved + (bs1 - bs0) / 4, buf, win, bs0 / 4); } memcpy(saved, buf + blocksize / 4, blocksize / 4 * sizeof(float)); } @@ -1636,7 +1633,8 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, len * ff_vorbis_channel_layout_offsets[vc->audio_channels - 1][i]; } - vc->dsp.float_to_int16_interleave(data, channel_ptrs, len, vc->audio_channels); + vc->fmt_conv.float_to_int16_interleave(data, channel_ptrs, len, + vc->audio_channels); *data_size = len * 2 * vc->audio_channels; return buf_size ; diff --git a/mplayer/ffmpeg/libavcodec/vp3.c b/mplayer/ffmpeg/libavcodec/vp3.c index 06f55f6d..97e5d643 100644 --- a/mplayer/ffmpeg/libavcodec/vp3.c +++ b/mplayer/ffmpeg/libavcodec/vp3.c @@ -33,13 +33,14 @@ #include #include -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "dsputil.h" #include "get_bits.h" #include "vp3data.h" #include "xiph.h" +#include "thread.h" #define FRAGMENT_PIXELS 8 @@ -236,8 +237,7 @@ typedef struct Vp3DecodeContext { * is coded. */ unsigned char *macroblock_coding; - uint8_t edge_emu_buffer[9*2048]; //FIXME dynamic alloc - int8_t qscale_table[2048]; //FIXME dynamic alloc (width+15)/16 + uint8_t *edge_emu_buffer; /* Huffman decode */ int hti; @@ -324,8 +324,6 @@ static void init_dequantizer(Vp3DecodeContext *s, int qpi) s->qmat[qpi][inter][plane][0] = s->qmat[0][inter][plane][0]; } } - - memset(s->qscale_table, (FFMAX(s->qmat[0][0][0][1], s->qmat[0][0][1][1])+8)/16, 512); //FIXME finetune } /* @@ -1318,6 +1316,15 @@ static void vp3_draw_horiz_band(Vp3DecodeContext *s, int y) int h, cy; int offset[4]; + if (HAVE_PTHREADS && s->avctx->active_thread_type&FF_THREAD_FRAME) { + int y_flipped = s->flipped_image ? s->avctx->height-y : y; + + // At the end of the frame, report INT_MAX instead of the height of the frame. + // This makes the other threads' ff_thread_await_progress() calls cheaper, because + // they don't have to clip their values. + ff_thread_report_progress(&s->current_frame, y_flipped==s->avctx->height ? INT_MAX : y_flipped-1, 0); + } + if(s->avctx->draw_horiz_band==NULL) return; @@ -1339,13 +1346,35 @@ static void vp3_draw_horiz_band(Vp3DecodeContext *s, int y) s->avctx->draw_horiz_band(s->avctx, &s->current_frame, offset, y, 3, h); } +/** + * Wait for the reference frame of the current fragment. + * The progress value is in luma pixel rows. + */ +static void await_reference_row(Vp3DecodeContext *s, Vp3Fragment *fragment, int motion_y, int y) +{ + AVFrame *ref_frame; + int ref_row; + int border = motion_y&1; + + if (fragment->coding_method == MODE_USING_GOLDEN || + fragment->coding_method == MODE_GOLDEN_MV) + ref_frame = &s->golden_frame; + else + ref_frame = &s->last_frame; + + ref_row = y + (motion_y>>1); + ref_row = FFMAX(FFABS(ref_row), ref_row + 8 + border); + + ff_thread_await_progress(ref_frame, ref_row, 0); +} + /* * Perform the final rendering for a particular slice of data. * The slice number ranges from 0..(c_superblock_height - 1). */ static void render_slice(Vp3DecodeContext *s, int slice) { - int x, y, i, j; + int x, y, i, j, fragment; LOCAL_ALIGNED_16(DCTELEM, block, [64]); int motion_x = 0xdeadbeef, motion_y = 0xdeadbeef; int motion_halfpel_index; @@ -1371,15 +1400,12 @@ static void render_slice(Vp3DecodeContext *s, int slice) int fragment_width = s->fragment_width[!!plane]; int fragment_height = s->fragment_height[!!plane]; int fragment_start = s->fragment_start[plane]; + int do_await = !plane && HAVE_PTHREADS && (s->avctx->active_thread_type&FF_THREAD_FRAME); if (!s->flipped_image) stride = -stride; if (CONFIG_GRAY && plane && (s->avctx->flags & CODEC_FLAG_GRAY)) continue; - - if(FFABS(stride) > 2048) - return; //various tables are fixed size - /* for each superblock row in the slice (both of them)... */ for (; sb_y < slice_height; sb_y++) { @@ -1390,8 +1416,9 @@ static void render_slice(Vp3DecodeContext *s, int slice) for (j = 0; j < 16; j++) { x = 4*sb_x + hilbert_offset[j][0]; y = 4*sb_y + hilbert_offset[j][1]; + fragment = y*fragment_width + x; - i = fragment_start + y*fragment_width + x; + i = fragment_start + fragment; // bounds check if (x >= fragment_width || y >= fragment_height) @@ -1399,6 +1426,9 @@ static void render_slice(Vp3DecodeContext *s, int slice) first_pixel = 8*y*stride + 8*x; + if (do_await && s->all_fragments[i].coding_method != MODE_INTRA) + await_reference_row(s, &s->all_fragments[i], motion_val[fragment][1], (16*y) >> s->chroma_y_shift); + /* transform if this block was coded */ if (s->all_fragments[i].coding_method != MODE_COPY) { if ((s->all_fragments[i].coding_method == MODE_USING_GOLDEN) || @@ -1415,8 +1445,8 @@ static void render_slice(Vp3DecodeContext *s, int slice) if ((s->all_fragments[i].coding_method > MODE_INTRA) && (s->all_fragments[i].coding_method != MODE_USING_GOLDEN)) { int src_x, src_y; - motion_x = motion_val[y*fragment_width + x][0]; - motion_y = motion_val[y*fragment_width + x][1]; + motion_x = motion_val[fragment][0]; + motion_y = motion_val[fragment][1]; src_x= (motion_x>>1) + 8*x; src_y= (motion_y>>1) + 8*y; @@ -1429,8 +1459,7 @@ static void render_slice(Vp3DecodeContext *s, int slice) if(src_x<0 || src_y<0 || src_x + 9 >= plane_width || src_y + 9 >= plane_height){ uint8_t *temp= s->edge_emu_buffer; - if(stride<0) temp -= 9*stride; - else temp += 9*stride; + if(stride<0) temp -= 8*stride; s->dsp.emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height); motion_source= temp; @@ -1510,6 +1539,38 @@ static void render_slice(Vp3DecodeContext *s, int slice) vp3_draw_horiz_band(s, FFMIN((32 << s->chroma_y_shift) * (slice + 1) -16, s->height-16)); } +/// Allocate tables for per-frame data in Vp3DecodeContext +static av_cold int allocate_tables(AVCodecContext *avctx) +{ + Vp3DecodeContext *s = avctx->priv_data; + int y_fragment_count, c_fragment_count; + + y_fragment_count = s->fragment_width[0] * s->fragment_height[0]; + c_fragment_count = s->fragment_width[1] * s->fragment_height[1]; + + s->superblock_coding = av_malloc(s->superblock_count); + s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment)); + s->coded_fragment_list[0] = av_malloc(s->fragment_count * sizeof(int)); + s->dct_tokens_base = av_malloc(64*s->fragment_count * sizeof(*s->dct_tokens_base)); + s->motion_val[0] = av_malloc(y_fragment_count * sizeof(*s->motion_val[0])); + s->motion_val[1] = av_malloc(c_fragment_count * sizeof(*s->motion_val[1])); + + /* work out the block mapping tables */ + s->superblock_fragments = av_malloc(s->superblock_count * 16 * sizeof(int)); + s->macroblock_coding = av_malloc(s->macroblock_count + 1); + + if (!s->superblock_coding || !s->all_fragments || !s->dct_tokens_base || + !s->coded_fragment_list[0] || !s->superblock_fragments || !s->macroblock_coding || + !s->motion_val[0] || !s->motion_val[1]) { + vp3_decode_end(avctx); + return -1; + } + + init_block_mapping(s); + + return 0; +} + /* * This is the ffmpeg/libavcodec API init function. */ @@ -1559,7 +1620,6 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) s->superblock_count = s->y_superblock_count + (s->c_superblock_count * 2); s->u_superblock_start = s->y_superblock_count; s->v_superblock_start = s->u_superblock_start + s->c_superblock_count; - s->superblock_coding = av_malloc(s->superblock_count); s->macroblock_width = (s->width + 15) / 16; s->macroblock_height = (s->height + 15) / 16; @@ -1577,18 +1637,6 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) s->fragment_start[1] = y_fragment_count; s->fragment_start[2] = y_fragment_count + c_fragment_count; - s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment)); - s->coded_fragment_list[0] = av_malloc(s->fragment_count * sizeof(int)); - s->dct_tokens_base = av_malloc(64*s->fragment_count * sizeof(*s->dct_tokens_base)); - s->motion_val[0] = av_malloc(y_fragment_count * sizeof(*s->motion_val[0])); - s->motion_val[1] = av_malloc(c_fragment_count * sizeof(*s->motion_val[1])); - - if (!s->superblock_coding || !s->all_fragments || !s->dct_tokens_base || - !s->coded_fragment_list[0] || !s->motion_val[0] || !s->motion_val[1]) { - vp3_decode_end(avctx); - return -1; - } - if (!s->theora_tables) { for (i = 0; i < 64; i++) { @@ -1688,28 +1736,92 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) &motion_vector_vlc_table[0][1], 2, 1, &motion_vector_vlc_table[0][0], 2, 1, 0); - /* work out the block mapping tables */ - s->superblock_fragments = av_malloc(s->superblock_count * 16 * sizeof(int)); - s->macroblock_coding = av_malloc(s->macroblock_count + 1); - if (!s->superblock_fragments || !s->macroblock_coding) { - vp3_decode_end(avctx); - return -1; - } - init_block_mapping(s); - for (i = 0; i < 3; i++) { s->current_frame.data[i] = NULL; s->last_frame.data[i] = NULL; s->golden_frame.data[i] = NULL; } - return 0; + return allocate_tables(avctx); vlc_fail: av_log(avctx, AV_LOG_FATAL, "Invalid huffman table\n"); return -1; } +/// Release and shuffle frames after decode finishes +static void update_frames(AVCodecContext *avctx) +{ + Vp3DecodeContext *s = avctx->priv_data; + + /* release the last frame, if it is allocated and if it is not the + * golden frame */ + if (s->last_frame.data[0] && s->last_frame.type != FF_BUFFER_TYPE_COPY) + ff_thread_release_buffer(avctx, &s->last_frame); + + /* shuffle frames (last = current) */ + s->last_frame= s->current_frame; + + if (s->keyframe) { + if (s->golden_frame.data[0]) + ff_thread_release_buffer(avctx, &s->golden_frame); + s->golden_frame = s->current_frame; + s->last_frame.type = FF_BUFFER_TYPE_COPY; + } + + s->current_frame.data[0]= NULL; /* ensure that we catch any access to this released frame */ +} + +static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *src) +{ + Vp3DecodeContext *s = dst->priv_data, *s1 = src->priv_data; + int qps_changed = 0, i, err; + + if (!s1->current_frame.data[0] + ||s->width != s1->width + ||s->height!= s1->height) + return -1; + + if (s != s1) { + // init tables if the first frame hasn't been decoded + if (!s->current_frame.data[0]) { + int y_fragment_count, c_fragment_count; + s->avctx = dst; + err = allocate_tables(dst); + if (err) + return err; + y_fragment_count = s->fragment_width[0] * s->fragment_height[0]; + c_fragment_count = s->fragment_width[1] * s->fragment_height[1]; + memcpy(s->motion_val[0], s1->motion_val[0], y_fragment_count * sizeof(*s->motion_val[0])); + memcpy(s->motion_val[1], s1->motion_val[1], c_fragment_count * sizeof(*s->motion_val[1])); + } + +#define copy_fields(to, from, start_field, end_field) memcpy(&to->start_field, &from->start_field, (char*)&to->end_field - (char*)&to->start_field) + + // copy previous frame data + copy_fields(s, s1, golden_frame, dsp); + + // copy qscale data if necessary + for (i = 0; i < 3; i++) { + if (s->qps[i] != s1->qps[1]) { + qps_changed = 1; + memcpy(&s->qmat[i], &s1->qmat[i], sizeof(s->qmat[i])); + } + } + + if (s->qps[0] != s1->qps[0]) + memcpy(&s->bounding_values_array, &s1->bounding_values_array, sizeof(s->bounding_values_array)); + + if (qps_changed) + copy_fields(s, s1, qps, superblock_count); +#undef copy_fields + } + + update_frames(dst); + + return 0; +} + /* * This is the ffmpeg/libavcodec API frame decode function. */ @@ -1765,11 +1877,14 @@ static int vp3_decode_frame(AVCodecContext *avctx, s->current_frame.reference = 3; s->current_frame.pict_type = s->keyframe ? FF_I_TYPE : FF_P_TYPE; - if (avctx->get_buffer(avctx, &s->current_frame) < 0) { + if (ff_thread_get_buffer(avctx, &s->current_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); goto error; } + if (!s->edge_emu_buffer) + s->edge_emu_buffer = av_malloc(9*FFABS(s->current_frame.linesize[0])); + if (s->keyframe) { if (!s->theora) { @@ -1794,19 +1909,18 @@ static int vp3_decode_frame(AVCodecContext *avctx, s->golden_frame.reference = 3; s->golden_frame.pict_type = FF_I_TYPE; - if (avctx->get_buffer(avctx, &s->golden_frame) < 0) { + if (ff_thread_get_buffer(avctx, &s->golden_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); goto error; } s->last_frame = s->golden_frame; s->last_frame.type = FF_BUFFER_TYPE_COPY; + ff_thread_report_progress(&s->last_frame, INT_MAX, 0); } } - s->current_frame.qscale_table= s->qscale_table; //FIXME allocate individual tables per AVFrame - s->current_frame.qstride= 0; - memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment)); + ff_thread_finish_setup(avctx); if (unpack_superblocks(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n"); @@ -1851,28 +1965,17 @@ static int vp3_decode_frame(AVCodecContext *avctx, *data_size=sizeof(AVFrame); *(AVFrame*)data= s->current_frame; - /* release the last frame, if it is allocated and if it is not the - * golden frame */ - if (s->last_frame.data[0] && s->last_frame.type != FF_BUFFER_TYPE_COPY) - avctx->release_buffer(avctx, &s->last_frame); - - /* shuffle frames (last = current) */ - s->last_frame= s->current_frame; - - if (s->keyframe) { - if (s->golden_frame.data[0]) - avctx->release_buffer(avctx, &s->golden_frame); - s->golden_frame = s->current_frame; - s->last_frame.type = FF_BUFFER_TYPE_COPY; - } - - s->current_frame.data[0]= NULL; /* ensure that we catch any access to this released frame */ + if (!HAVE_PTHREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME)) + update_frames(avctx); return buf_size; error: - if (s->current_frame.data[0]) + ff_thread_report_progress(&s->current_frame, INT_MAX, 0); + + if (!HAVE_PTHREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME)) avctx->release_buffer(avctx, &s->current_frame); + return -1; } @@ -1884,6 +1987,9 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx) Vp3DecodeContext *s = avctx->priv_data; int i; + if (avctx->is_copy && !s->current_frame.data[0]) + return 0; + av_free(s->superblock_coding); av_free(s->all_fragments); av_free(s->coded_fragment_list[0]); @@ -1892,6 +1998,9 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx) av_free(s->macroblock_coding); av_free(s->motion_val[0]); av_free(s->motion_val[1]); + av_free(s->edge_emu_buffer); + + if (avctx->is_copy) return 0; for (i = 0; i < 16; i++) { free_vlc(&s->dc_vlc[i]); @@ -1908,9 +2017,9 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx) /* release all frames */ if (s->golden_frame.data[0]) - avctx->release_buffer(avctx, &s->golden_frame); + ff_thread_release_buffer(avctx, &s->golden_frame); if (s->last_frame.data[0] && s->last_frame.type != FF_BUFFER_TYPE_COPY) - avctx->release_buffer(avctx, &s->last_frame); + ff_thread_release_buffer(avctx, &s->last_frame); /* no need to release the current_frame since it will always be pointing * to the same frame as either the golden or last frame */ @@ -2221,9 +2330,10 @@ AVCodec ff_theora_decoder = { NULL, vp3_decode_end, vp3_decode_frame, - CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND, + CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS, NULL, .long_name = NULL_IF_CONFIG_SMALL("Theora"), + .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context) }; #endif @@ -2236,7 +2346,8 @@ AVCodec ff_vp3_decoder = { NULL, vp3_decode_end, vp3_decode_frame, - CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND, + CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS, NULL, .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"), + .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context) }; diff --git a/mplayer/ffmpeg/libavcodec/vp56.h b/mplayer/ffmpeg/libavcodec/vp56.h index da6b1b64..d1735e56 100644 --- a/mplayer/ffmpeg/libavcodec/vp56.h +++ b/mplayer/ffmpeg/libavcodec/vp56.h @@ -201,7 +201,9 @@ static av_always_inline unsigned int vp56_rac_renorm(VP56RangeCoder *c) return code_word; } -#if ARCH_X86 +#if ARCH_ARM +#include "arm/vp56_arith.h" +#elif ARCH_X86 #include "x86/vp56_arith.h" #endif @@ -221,6 +223,7 @@ static av_always_inline int vp56_rac_get_prob(VP56RangeCoder *c, uint8_t prob) } #endif +#ifndef vp56_rac_get_prob_branchy // branchy variant, to be used where there's a branch based on the bit decoded static av_always_inline int vp56_rac_get_prob_branchy(VP56RangeCoder *c, int prob) { @@ -238,6 +241,7 @@ static av_always_inline int vp56_rac_get_prob_branchy(VP56RangeCoder *c, int pro c->code_word = code_word; return 0; } +#endif static av_always_inline int vp56_rac_get(VP56RangeCoder *c) { diff --git a/mplayer/ffmpeg/libavcodec/vp8.c b/mplayer/ffmpeg/libavcodec/vp8.c index ef4e270f..f71a7b77 100644 --- a/mplayer/ffmpeg/libavcodec/vp8.c +++ b/mplayer/ffmpeg/libavcodec/vp8.c @@ -22,183 +22,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" -#include "vp56.h" +#include "vp8.h" #include "vp8data.h" -#include "vp8dsp.h" -#include "h264pred.h" #include "rectangle.h" -typedef struct { - uint8_t filter_level; - uint8_t inner_limit; - uint8_t inner_filter; -} VP8FilterStrength; - -typedef struct { - uint8_t skip; - // todo: make it possible to check for at least (i4x4 or split_mv) - // in one op. are others needed? - uint8_t mode; - uint8_t ref_frame; - uint8_t partitioning; - VP56mv mv; - VP56mv bmv[16]; -} VP8Macroblock; - -typedef struct { - AVCodecContext *avctx; - DSPContext dsp; - VP8DSPContext vp8dsp; - H264PredContext hpc; - vp8_mc_func put_pixels_tab[3][3][3]; - AVFrame frames[4]; - AVFrame *framep[4]; - uint8_t *edge_emu_buffer; - VP56RangeCoder c; ///< header context, includes mb modes and motion vectors - int profile; - - int mb_width; /* number of horizontal MB */ - int mb_height; /* number of vertical MB */ - int linesize; - int uvlinesize; - - int keyframe; - int invisible; - int update_last; ///< update VP56_FRAME_PREVIOUS with the current one - int update_golden; ///< VP56_FRAME_NONE if not updated, or which frame to copy if so - int update_altref; - int deblock_filter; - - /** - * If this flag is not set, all the probability updates - * are discarded after this frame is decoded. - */ - int update_probabilities; - - /** - * All coefficients are contained in separate arith coding contexts. - * There can be 1, 2, 4, or 8 of these after the header context. - */ - int num_coeff_partitions; - VP56RangeCoder coeff_partition[8]; - - VP8Macroblock *macroblocks; - VP8Macroblock *macroblocks_base; - VP8FilterStrength *filter_strength; - - uint8_t *intra4x4_pred_mode_top; - uint8_t intra4x4_pred_mode_left[4]; - uint8_t *segmentation_map; - - /** - * Cache of the top row needed for intra prediction - * 16 for luma, 8 for each chroma plane - */ - uint8_t (*top_border)[16+8+8]; - - /** - * For coeff decode, we need to know whether the above block had non-zero - * coefficients. This means for each macroblock, we need data for 4 luma - * blocks, 2 u blocks, 2 v blocks, and the luma dc block, for a total of 9 - * per macroblock. We keep the last row in top_nnz. - */ - uint8_t (*top_nnz)[9]; - DECLARE_ALIGNED(8, uint8_t, left_nnz)[9]; - - /** - * This is the index plus one of the last non-zero coeff - * for each of the blocks in the current macroblock. - * So, 0 -> no coeffs - * 1 -> dc-only (special transform) - * 2+-> full transform - */ - DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4]; - DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16]; - DECLARE_ALIGNED(16, DCTELEM, block_dc)[16]; - uint8_t intra4x4_pred_mode_mb[16]; - - int chroma_pred_mode; ///< 8x8c pred mode of the current macroblock - int segment; ///< segment of the current macroblock - - int mbskip_enabled; - int sign_bias[4]; ///< one state [0, 1] per ref frame type - int ref_count[3]; - - /** - * Base parameters for segmentation, i.e. per-macroblock parameters. - * These must be kept unchanged even if segmentation is not used for - * a frame, since the values persist between interframes. - */ - struct { - int enabled; - int absolute_vals; - int update_map; - int8_t base_quant[4]; - int8_t filter_level[4]; ///< base loop filter level - } segmentation; - - /** - * Macroblocks can have one of 4 different quants in a frame when - * segmentation is enabled. - * If segmentation is disabled, only the first segment's values are used. - */ - struct { - // [0] - DC qmul [1] - AC qmul - int16_t luma_qmul[2]; - int16_t luma_dc_qmul[2]; ///< luma dc-only block quant - int16_t chroma_qmul[2]; - } qmat[4]; - - struct { - int simple; - int level; - int sharpness; - } filter; - - struct { - int enabled; ///< whether each mb can have a different strength based on mode/ref - - /** - * filter strength adjustment for the following macroblock modes: - * [0] - i4x4 - * [1] - zero mv - * [2] - inter modes except for zero or split mv - * [3] - split mv - * i16x16 modes never have any adjustment - */ - int8_t mode[4]; - - /** - * filter strength adjustment for macroblocks that reference: - * [0] - intra / VP56_FRAME_CURRENT - * [1] - VP56_FRAME_PREVIOUS - * [2] - VP56_FRAME_GOLDEN - * [3] - altref / VP56_FRAME_GOLDEN2 - */ - int8_t ref[4]; - } lf_delta; - - /** - * These are all of the updatable probabilities for binary decisions. - * They are only implictly reset on keyframes, making it quite likely - * for an interframe to desync if a prior frame's header was corrupt - * or missing outright! - */ - struct { - uint8_t segmentid[3]; - uint8_t mbskip; - uint8_t intra; - uint8_t last; - uint8_t golden; - uint8_t pred16x16[4]; - uint8_t pred8x8c[3]; - /* Padded to allow overreads */ - uint8_t token[4][17][3][NUM_DCT_TOKENS-1]; - uint8_t mvc[2][19]; - } prob[2]; -} VP8Context; +#if ARCH_ARM +# include "arm/vp8.h" +#endif static void vp8_decode_flush(AVCodecContext *avctx) { @@ -278,7 +110,7 @@ static void update_lf_deltas(VP8Context *s) for (i = 0; i < 4; i++) s->lf_delta.ref[i] = vp8_rac_get_sint(c, 6); - for (i = 0; i < 4; i++) + for (i = MODE_I4x4; i <= VP8_MVMODE_SPLIT; i++) s->lf_delta.mode[i] = vp8_rac_get_sint(c, 6); } @@ -517,76 +349,10 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size) return 0; } -static av_always_inline -void clamp_mv(VP8Context *s, VP56mv *dst, const VP56mv *src, int mb_x, int mb_y) +static av_always_inline void clamp_mv(VP8Context *s, VP56mv *dst, const VP56mv *src) { -#define MARGIN (16 << 2) - dst->x = av_clip(src->x, -((mb_x << 6) + MARGIN), - ((s->mb_width - 1 - mb_x) << 6) + MARGIN); - dst->y = av_clip(src->y, -((mb_y << 6) + MARGIN), - ((s->mb_height - 1 - mb_y) << 6) + MARGIN); -} - -static av_always_inline -void find_near_mvs(VP8Context *s, VP8Macroblock *mb, - VP56mv near[2], VP56mv *best, uint8_t cnt[4]) -{ - VP8Macroblock *mb_edge[3] = { mb + 2 /* top */, - mb - 1 /* left */, - mb + 1 /* top-left */ }; - enum { EDGE_TOP, EDGE_LEFT, EDGE_TOPLEFT }; - VP56mv near_mv[4] = {{ 0 }}; - enum { CNT_ZERO, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV }; - int idx = CNT_ZERO; - int best_idx = CNT_ZERO; - int cur_sign_bias = s->sign_bias[mb->ref_frame]; - int *sign_bias = s->sign_bias; - - /* Process MB on top, left and top-left */ - #define MV_EDGE_CHECK(n)\ - {\ - VP8Macroblock *edge = mb_edge[n];\ - int edge_ref = edge->ref_frame;\ - if (edge_ref != VP56_FRAME_CURRENT) {\ - uint32_t mv = AV_RN32A(&edge->mv);\ - if (mv) {\ - if (cur_sign_bias != sign_bias[edge_ref]) {\ - /* SWAR negate of the values in mv. */\ - mv = ~mv;\ - mv = ((mv&0x7fff7fff) + 0x00010001) ^ (mv&0x80008000);\ - }\ - if (!n || mv != AV_RN32A(&near_mv[idx]))\ - AV_WN32A(&near_mv[++idx], mv);\ - cnt[idx] += 1 + (n != 2);\ - } else\ - cnt[CNT_ZERO] += 1 + (n != 2);\ - }\ - } - MV_EDGE_CHECK(0) - MV_EDGE_CHECK(1) - MV_EDGE_CHECK(2) - - /* If we have three distinct MVs, merge first and last if they're the same */ - if (cnt[CNT_SPLITMV] && AV_RN32A(&near_mv[1+EDGE_TOP]) == AV_RN32A(&near_mv[1+EDGE_TOPLEFT])) - cnt[CNT_NEAREST] += 1; - - cnt[CNT_SPLITMV] = ((mb_edge[EDGE_LEFT]->mode == VP8_MVMODE_SPLIT) + - (mb_edge[EDGE_TOP]->mode == VP8_MVMODE_SPLIT)) * 2 + - (mb_edge[EDGE_TOPLEFT]->mode == VP8_MVMODE_SPLIT); - - /* Swap near and nearest if necessary */ - if (cnt[CNT_NEAR] > cnt[CNT_NEAREST]) { - FFSWAP(uint8_t, cnt[CNT_NEAREST], cnt[CNT_NEAR]); - FFSWAP( VP56mv, near_mv[CNT_NEAREST], near_mv[CNT_NEAR]); - } - - /* Choose the best mv out of 0,0 and the nearest mv */ - if (cnt[CNT_NEAREST] >= cnt[CNT_ZERO]) - best_idx = CNT_NEAREST; - - mb->mv = near_mv[best_idx]; - near[0] = near_mv[CNT_NEAREST]; - near[1] = near_mv[CNT_NEAR]; + dst->x = av_clip(src->x, s->mv_min.x, s->mv_max.x); + dst->y = av_clip(src->y, s->mv_min.y, s->mv_max.y); } /** @@ -698,6 +464,95 @@ int decode_splitmvs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb) return num; } +static av_always_inline +void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y) +{ + VP8Macroblock *mb_edge[3] = { mb + 2 /* top */, + mb - 1 /* left */, + mb + 1 /* top-left */ }; + enum { CNT_ZERO, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV }; + enum { EDGE_TOP, EDGE_LEFT, EDGE_TOPLEFT }; + int idx = CNT_ZERO; + int cur_sign_bias = s->sign_bias[mb->ref_frame]; + int *sign_bias = s->sign_bias; + VP56mv near_mv[4]; + uint8_t cnt[4] = { 0 }; + VP56RangeCoder *c = &s->c; + + AV_ZERO32(&near_mv[0]); + AV_ZERO32(&near_mv[1]); + + /* Process MB on top, left and top-left */ + #define MV_EDGE_CHECK(n)\ + {\ + VP8Macroblock *edge = mb_edge[n];\ + int edge_ref = edge->ref_frame;\ + if (edge_ref != VP56_FRAME_CURRENT) {\ + uint32_t mv = AV_RN32A(&edge->mv);\ + if (mv) {\ + if (cur_sign_bias != sign_bias[edge_ref]) {\ + /* SWAR negate of the values in mv. */\ + mv = ~mv;\ + mv = ((mv&0x7fff7fff) + 0x00010001) ^ (mv&0x80008000);\ + }\ + if (!n || mv != AV_RN32A(&near_mv[idx]))\ + AV_WN32A(&near_mv[++idx], mv);\ + cnt[idx] += 1 + (n != 2);\ + } else\ + cnt[CNT_ZERO] += 1 + (n != 2);\ + }\ + } + + MV_EDGE_CHECK(0) + MV_EDGE_CHECK(1) + MV_EDGE_CHECK(2) + + mb->partitioning = VP8_SPLITMVMODE_NONE; + if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_ZERO]][0])) { + mb->mode = VP8_MVMODE_MV; + + /* If we have three distinct MVs, merge first and last if they're the same */ + if (cnt[CNT_SPLITMV] && AV_RN32A(&near_mv[1+EDGE_TOP]) == AV_RN32A(&near_mv[1+EDGE_TOPLEFT])) + cnt[CNT_NEAREST] += 1; + + /* Swap near and nearest if necessary */ + if (cnt[CNT_NEAR] > cnt[CNT_NEAREST]) { + FFSWAP(uint8_t, cnt[CNT_NEAREST], cnt[CNT_NEAR]); + FFSWAP( VP56mv, near_mv[CNT_NEAREST], near_mv[CNT_NEAR]); + } + + if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_NEAREST]][1])) { + if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_NEAR]][2])) { + + /* Choose the best mv out of 0,0 and the nearest mv */ + clamp_mv(s, &mb->mv, &near_mv[CNT_ZERO + (cnt[CNT_NEAREST] >= cnt[CNT_ZERO])]); + cnt[CNT_SPLITMV] = ((mb_edge[EDGE_LEFT]->mode == VP8_MVMODE_SPLIT) + + (mb_edge[EDGE_TOP]->mode == VP8_MVMODE_SPLIT)) * 2 + + (mb_edge[EDGE_TOPLEFT]->mode == VP8_MVMODE_SPLIT); + + if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_SPLITMV]][3])) { + mb->mode = VP8_MVMODE_SPLIT; + mb->mv = mb->bmv[decode_splitmvs(s, c, mb) - 1]; + } else { + mb->mv.y += read_mv_component(c, s->prob->mvc[0]); + mb->mv.x += read_mv_component(c, s->prob->mvc[1]); + mb->bmv[0] = mb->mv; + } + } else { + clamp_mv(s, &mb->mv, &near_mv[CNT_NEAR]); + mb->bmv[0] = mb->mv; + } + } else { + clamp_mv(s, &mb->mv, &near_mv[CNT_NEAREST]); + mb->bmv[0] = mb->mv; + } + } else { + mb->mode = VP8_MVMODE_ZERO; + AV_ZERO32(&mb->mv); + mb->bmv[0] = mb->mv; + } +} + static av_always_inline void decode_intra4x4_modes(VP8Context *s, VP56RangeCoder *c, int mb_x, int keyframe) @@ -748,9 +603,6 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_ s->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, vp8_pred8x8c_prob_intra); mb->ref_frame = VP56_FRAME_CURRENT; } else if (vp56_rac_get_prob_branchy(c, s->prob->intra)) { - VP56mv near[2], best; - uint8_t cnt[4] = { 0 }; - // inter MB, 16.2 if (vp56_rac_get_prob_branchy(c, s->prob->last)) mb->ref_frame = vp56_rac_get_prob(c, s->prob->golden) ? @@ -760,36 +612,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_ s->ref_count[mb->ref_frame-1]++; // motion vectors, 16.3 - find_near_mvs(s, mb, near, &best, cnt); - if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[0]][0])) { - if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[1]][1])) { - if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[2]][2])) { - if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[3]][3])) { - mb->mode = VP8_MVMODE_SPLIT; - clamp_mv(s, &mb->mv, &mb->mv, mb_x, mb_y); - mb->mv = mb->bmv[decode_splitmvs(s, c, mb) - 1]; - } else { - mb->mode = VP8_MVMODE_NEW; - clamp_mv(s, &mb->mv, &mb->mv, mb_x, mb_y); - mb->mv.y += read_mv_component(c, s->prob->mvc[0]); - mb->mv.x += read_mv_component(c, s->prob->mvc[1]); - } - } else { - mb->mode = VP8_MVMODE_NEAR; - clamp_mv(s, &mb->mv, &near[1], mb_x, mb_y); - } - } else { - mb->mode = VP8_MVMODE_NEAREST; - clamp_mv(s, &mb->mv, &near[0], mb_x, mb_y); - } - } else { - mb->mode = VP8_MVMODE_ZERO; - AV_ZERO32(&mb->mv); - } - if (mb->mode != VP8_MVMODE_SPLIT) { - mb->partitioning = VP8_SPLITMVMODE_NONE; - mb->bmv[0] = mb->mv; - } + decode_mvs(s, mb, mb_x, mb_y); } else { // intra MB, 16.1 mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_inter, s->prob->pred16x16); @@ -804,6 +627,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_ } } +#ifndef decode_block_coeffs_internal /** * @param c arithmetic bitstream reader context * @param block destination for block coefficients @@ -857,7 +681,7 @@ static int decode_block_coeffs_internal(VP56RangeCoder *c, DCTELEM block[16], int b = vp56_rac_get_prob(c, token_prob[9+a]); int cat = (a<<1) + b; coeff = 3 + (8<filter.simple, 0); } +static const uint8_t subpel_idx[3][8] = { + { 0, 1, 2, 1, 2, 1, 2, 1 }, // nr. of left extra pixels, + // also function pointer index + { 0, 3, 5, 3, 5, 3, 5, 3 }, // nr. of extra pixels required + { 0, 2, 3, 2, 3, 2, 3, 2 }, // nr. of right extra pixels +}; + /** * Generic MC function. * @@ -1211,32 +1043,26 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, * @param mc_func motion compensation function pointers (bilinear or sixtap MC) */ static av_always_inline -void vp8_mc(VP8Context *s, int luma, - uint8_t *dst, uint8_t *src, const VP56mv *mv, - int x_off, int y_off, int block_w, int block_h, - int width, int height, int linesize, - vp8_mc_func mc_func[3][3]) +void vp8_mc_luma(VP8Context *s, uint8_t *dst, uint8_t *src, const VP56mv *mv, + int x_off, int y_off, int block_w, int block_h, + int width, int height, int linesize, + vp8_mc_func mc_func[3][3]) { if (AV_RN32A(mv)) { - static const uint8_t idx[3][8] = { - { 0, 1, 2, 1, 2, 1, 2, 1 }, // nr. of left extra pixels, - // also function pointer index - { 0, 3, 5, 3, 5, 3, 5, 3 }, // nr. of extra pixels required - { 0, 2, 3, 2, 3, 2, 3, 2 }, // nr. of right extra pixels - }; - int mx = (mv->x << luma)&7, mx_idx = idx[0][mx]; - int my = (mv->y << luma)&7, my_idx = idx[0][my]; - x_off += mv->x >> (3 - luma); - y_off += mv->y >> (3 - luma); + int mx = (mv->x << 1)&7, mx_idx = subpel_idx[0][mx]; + int my = (mv->y << 1)&7, my_idx = subpel_idx[0][my]; + + x_off += mv->x >> 2; + y_off += mv->y >> 2; // edge emulation src += y_off * linesize + x_off; - if (x_off < mx_idx || x_off >= width - block_w - idx[2][mx] || - y_off < my_idx || y_off >= height - block_h - idx[2][my]) { + if (x_off < mx_idx || x_off >= width - block_w - subpel_idx[2][mx] || + y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) { s->dsp.emulated_edge_mc(s->edge_emu_buffer, src - my_idx * linesize - mx_idx, linesize, - block_w + idx[1][mx], block_h + idx[1][my], - x_off - mx_idx, y_off - my_idx, width, height); + block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my], + x_off - mx_idx, y_off - my_idx, width, height); src = s->edge_emu_buffer + mx_idx + linesize * my_idx; } mc_func[my_idx][mx_idx](dst, linesize, src, linesize, block_h, mx, my); @@ -1244,6 +1070,45 @@ void vp8_mc(VP8Context *s, int luma, mc_func[0][0](dst, linesize, src + y_off * linesize + x_off, linesize, block_h, 0, 0); } +static av_always_inline +void vp8_mc_chroma(VP8Context *s, uint8_t *dst1, uint8_t *dst2, uint8_t *src1, + uint8_t *src2, const VP56mv *mv, int x_off, int y_off, + int block_w, int block_h, int width, int height, int linesize, + vp8_mc_func mc_func[3][3]) +{ + if (AV_RN32A(mv)) { + int mx = mv->x&7, mx_idx = subpel_idx[0][mx]; + int my = mv->y&7, my_idx = subpel_idx[0][my]; + + x_off += mv->x >> 3; + y_off += mv->y >> 3; + + // edge emulation + src1 += y_off * linesize + x_off; + src2 += y_off * linesize + x_off; + if (x_off < mx_idx || x_off >= width - block_w - subpel_idx[2][mx] || + y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) { + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src1 - my_idx * linesize - mx_idx, linesize, + block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my], + x_off - mx_idx, y_off - my_idx, width, height); + src1 = s->edge_emu_buffer + mx_idx + linesize * my_idx; + mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my); + + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src2 - my_idx * linesize - mx_idx, linesize, + block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my], + x_off - mx_idx, y_off - my_idx, width, height); + src2 = s->edge_emu_buffer + mx_idx + linesize * my_idx; + mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my); + } else { + mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my); + mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my); + } + } else { + mc_func[0][0](dst1, linesize, src1 + y_off * linesize + x_off, linesize, block_h, 0, 0); + mc_func[0][0](dst2, linesize, src2 + y_off * linesize + x_off, linesize, block_h, 0, 0); + } +} + static av_always_inline void vp8_mc_part(VP8Context *s, uint8_t *dst[3], AVFrame *ref_frame, int x_off, int y_off, @@ -1254,10 +1119,10 @@ void vp8_mc_part(VP8Context *s, uint8_t *dst[3], VP56mv uvmv = *mv; /* Y */ - vp8_mc(s, 1, dst[0] + by_off * s->linesize + bx_off, - ref_frame->data[0], mv, x_off + bx_off, y_off + by_off, - block_w, block_h, width, height, s->linesize, - s->put_pixels_tab[block_w == 8]); + vp8_mc_luma(s, dst[0] + by_off * s->linesize + bx_off, + ref_frame->data[0], mv, x_off + bx_off, y_off + by_off, + block_w, block_h, width, height, s->linesize, + s->put_pixels_tab[block_w == 8]); /* U/V */ if (s->profile == 3) { @@ -1268,14 +1133,11 @@ void vp8_mc_part(VP8Context *s, uint8_t *dst[3], bx_off >>= 1; by_off >>= 1; width >>= 1; height >>= 1; block_w >>= 1; block_h >>= 1; - vp8_mc(s, 0, dst[1] + by_off * s->uvlinesize + bx_off, - ref_frame->data[1], &uvmv, x_off + bx_off, y_off + by_off, - block_w, block_h, width, height, s->uvlinesize, - s->put_pixels_tab[1 + (block_w == 4)]); - vp8_mc(s, 0, dst[2] + by_off * s->uvlinesize + bx_off, - ref_frame->data[2], &uvmv, x_off + bx_off, y_off + by_off, - block_w, block_h, width, height, s->uvlinesize, - s->put_pixels_tab[1 + (block_w == 4)]); + vp8_mc_chroma(s, dst[1] + by_off * s->uvlinesize + bx_off, + dst[2] + by_off * s->uvlinesize + bx_off, ref_frame->data[1], + ref_frame->data[2], &uvmv, x_off + bx_off, y_off + by_off, + block_w, block_h, width, height, s->uvlinesize, + s->put_pixels_tab[1 + (block_w == 4)]); } /* Fetch pixels for estimated mv 4 macroblocks ahead. @@ -1307,10 +1169,11 @@ void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, AVFrame *ref = s->framep[mb->ref_frame]; VP56mv *bmv = mb->bmv; - if (mb->mode < VP8_MVMODE_SPLIT) { + switch (mb->partitioning) { + case VP8_SPLITMVMODE_NONE: vp8_mc_part(s, dst, ref, x_off, y_off, 0, 0, 16, 16, width, height, &mb->mv); - } else switch (mb->partitioning) { + break; case VP8_SPLITMVMODE_4x4: { int x, y; VP56mv uvmv; @@ -1318,11 +1181,11 @@ void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, /* Y */ for (y = 0; y < 4; y++) { for (x = 0; x < 4; x++) { - vp8_mc(s, 1, dst[0] + 4*y*s->linesize + x*4, - ref->data[0], &bmv[4*y + x], - 4*x + x_off, 4*y + y_off, 4, 4, - width, height, s->linesize, - s->put_pixels_tab[2]); + vp8_mc_luma(s, dst[0] + 4*y*s->linesize + x*4, + ref->data[0], &bmv[4*y + x], + 4*x + x_off, 4*y + y_off, 4, 4, + width, height, s->linesize, + s->put_pixels_tab[2]); } } @@ -1344,16 +1207,12 @@ void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, uvmv.x &= ~7; uvmv.y &= ~7; } - vp8_mc(s, 0, dst[1] + 4*y*s->uvlinesize + x*4, - ref->data[1], &uvmv, - 4*x + x_off, 4*y + y_off, 4, 4, - width, height, s->uvlinesize, - s->put_pixels_tab[2]); - vp8_mc(s, 0, dst[2] + 4*y*s->uvlinesize + x*4, - ref->data[2], &uvmv, - 4*x + x_off, 4*y + y_off, 4, 4, - width, height, s->uvlinesize, - s->put_pixels_tab[2]); + vp8_mc_chroma(s, dst[1] + 4*y*s->uvlinesize + x*4, + dst[2] + 4*y*s->uvlinesize + x*4, + ref->data[1], ref->data[2], &uvmv, + 4*x + x_off, 4*y + y_off, 4, 4, + width, height, s->uvlinesize, + s->put_pixels_tab[2]); } } break; @@ -1390,17 +1249,17 @@ static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblo if (mb->mode != MODE_I4x4) { uint8_t *y_dst = dst[0]; for (y = 0; y < 4; y++) { - uint32_t nnz4 = AV_RN32A(s->non_zero_count_cache[y]); + uint32_t nnz4 = AV_RL32(s->non_zero_count_cache[y]); if (nnz4) { if (nnz4&~0x01010101) { for (x = 0; x < 4; x++) { - int nnz = s->non_zero_count_cache[y][x]; - if (nnz) { - if (nnz == 1) - s->vp8dsp.vp8_idct_dc_add(y_dst+4*x, s->block[y][x], s->linesize); - else - s->vp8dsp.vp8_idct_add(y_dst+4*x, s->block[y][x], s->linesize); - } + if ((uint8_t)nnz4 == 1) + s->vp8dsp.vp8_idct_dc_add(y_dst+4*x, s->block[y][x], s->linesize); + else if((uint8_t)nnz4 > 1) + s->vp8dsp.vp8_idct_add(y_dst+4*x, s->block[y][x], s->linesize); + nnz4 >>= 8; + if (!nnz4) + break; } } else { s->vp8dsp.vp8_idct_dc_add4y(y_dst, s->block[y], s->linesize); @@ -1411,19 +1270,19 @@ static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblo } for (ch = 0; ch < 2; ch++) { - uint32_t nnz4 = AV_RN32A(s->non_zero_count_cache[4+ch]); + uint32_t nnz4 = AV_RL32(s->non_zero_count_cache[4+ch]); if (nnz4) { uint8_t *ch_dst = dst[1+ch]; if (nnz4&~0x01010101) { for (y = 0; y < 2; y++) { for (x = 0; x < 2; x++) { - int nnz = s->non_zero_count_cache[4+ch][(y<<1)+x]; - if (nnz) { - if (nnz == 1) - s->vp8dsp.vp8_idct_dc_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize); - else - s->vp8dsp.vp8_idct_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize); - } + if ((uint8_t)nnz4 == 1) + s->vp8dsp.vp8_idct_dc_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize); + else if((uint8_t)nnz4 > 1) + s->vp8dsp.vp8_idct_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize); + nnz4 >>= 8; + if (!nnz4) + break; } ch_dst += 4*s->uvlinesize; } @@ -1447,24 +1306,16 @@ static av_always_inline void filter_level_for_mb(VP8Context *s, VP8Macroblock *m if (s->lf_delta.enabled) { filter_level += s->lf_delta.ref[mb->ref_frame]; - - if (mb->ref_frame == VP56_FRAME_CURRENT) { - if (mb->mode == MODE_I4x4) - filter_level += s->lf_delta.mode[0]; - } else { - if (mb->mode == VP8_MVMODE_ZERO) - filter_level += s->lf_delta.mode[1]; - else if (mb->mode == VP8_MVMODE_SPLIT) - filter_level += s->lf_delta.mode[3]; - else - filter_level += s->lf_delta.mode[2]; - } + filter_level += s->lf_delta.mode[mb->mode]; } - filter_level = av_clip(filter_level, 0, 63); + +/* Like av_clip for inputs 0 and max, where max is equal to (2^n-1) */ +#define POW2CLIP(x,max) (((x) & ~max) ? (-(x))>>31 & max : (x)); + filter_level = POW2CLIP(filter_level, 63); interior_limit = filter_level; if (s->filter.sharpness) { - interior_limit >>= s->filter.sharpness > 4 ? 2 : 1; + interior_limit >>= (s->filter.sharpness + 3) >> 2; interior_limit = FFMIN(interior_limit, 9 - s->filter.sharpness); } interior_limit = FFMAX(interior_limit, 1); @@ -1482,23 +1333,24 @@ static av_always_inline void filter_mb(VP8Context *s, uint8_t *dst[3], VP8Filter int inner_filter = f->inner_filter; int linesize = s->linesize; int uvlinesize = s->uvlinesize; + static const uint8_t hev_thresh_lut[2][64] = { + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2 } + }; if (!filter_level) return; - mbedge_lim = 2*(filter_level+2) + inner_limit; - bedge_lim = 2* filter_level + inner_limit; - hev_thresh = filter_level >= 15; + bedge_lim = 2*filter_level + inner_limit; + mbedge_lim = bedge_lim + 4; - if (s->keyframe) { - if (filter_level >= 40) - hev_thresh = 2; - } else { - if (filter_level >= 40) - hev_thresh = 3; - else if (filter_level >= 20) - hev_thresh = 2; - } + hev_thresh = hev_thresh_lut[s->keyframe][filter_level]; if (mb_x) { s->vp8dsp.vp8_h_loop_filter16y(dst[0], linesize, @@ -1554,8 +1406,8 @@ static av_always_inline void filter_mb_simple(VP8Context *s, uint8_t *dst, VP8Fi if (!filter_level) return; - mbedge_lim = 2*(filter_level+2) + inner_limit; - bedge_lim = 2* filter_level + inner_limit; + bedge_lim = 2*filter_level + inner_limit; + mbedge_lim = bedge_lim + 4; if (mb_x) s->vp8dsp.vp8_h_loop_filter_simple(dst, linesize, mbedge_lim); @@ -1677,6 +1529,10 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size, if (s->keyframe) memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width*4); + #define MARGIN (16 << 2) + s->mv_min.y = -MARGIN; + s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; + for (mb_y = 0; mb_y < s->mb_height; mb_y++) { VP56RangeCoder *c = &s->coeff_partition[mb_y & (s->num_coeff_partitions-1)]; VP8Macroblock *mb = s->macroblocks + (s->mb_height - mb_y - 1)*2; @@ -1700,6 +1556,9 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size, s->top_border[0][15] = s->top_border[0][23] = s->top_border[0][31] = 129; } + s->mv_min.x = -MARGIN; + s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN; + for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) { /* Prefetch the current frame, 4 MBs ahead */ s->dsp.prefetch(dst[0] + (mb_x&3)*4*s->linesize + 64, s->linesize, 4); @@ -1740,6 +1599,8 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size, dst[0] += 16; dst[1] += 8; dst[2] += 8; + s->mv_min.x -= 64; + s->mv_max.x -= 64; } if (s->deblock_filter) { if (s->filter.simple) @@ -1747,6 +1608,8 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size, else filter_mb_row(s, mb_y); } + s->mv_min.y -= 64; + s->mv_max.y -= 64; } skip_decode: diff --git a/mplayer/ffmpeg/libavcodec/vp8.h b/mplayer/ffmpeg/libavcodec/vp8.h new file mode 100644 index 00000000..d3b8705e --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/vp8.h @@ -0,0 +1,242 @@ +/** + * VP8 compatible video decoder + * + * Copyright (C) 2010 David Conrad + * Copyright (C) 2010 Ronald S. Bultje + * Copyright (C) 2010 Jason Garrett-Glaser + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VP8_H +#define AVCODEC_VP8_H + +#include "vp56.h" +#include "vp56data.h" +#include "vp8dsp.h" +#include "h264pred.h" + +#define VP8_MAX_QUANT 127 + +enum dct_token { + DCT_0, + DCT_1, + DCT_2, + DCT_3, + DCT_4, + DCT_CAT1, + DCT_CAT2, + DCT_CAT3, + DCT_CAT4, + DCT_CAT5, + DCT_CAT6, + DCT_EOB, + + NUM_DCT_TOKENS +}; + +// used to signal 4x4 intra pred in luma MBs +#define MODE_I4x4 4 + +enum inter_mvmode { + VP8_MVMODE_ZERO = MODE_I4x4 + 1, + VP8_MVMODE_MV, + VP8_MVMODE_SPLIT +}; + +enum inter_splitmvmode { + VP8_SPLITMVMODE_16x8 = 0, ///< 2 16x8 blocks (vertical) + VP8_SPLITMVMODE_8x16, ///< 2 8x16 blocks (horizontal) + VP8_SPLITMVMODE_8x8, ///< 2x2 blocks of 8x8px each + VP8_SPLITMVMODE_4x4, ///< 4x4 blocks of 4x4px each + VP8_SPLITMVMODE_NONE, ///< (only used in prediction) no split MVs +}; + +typedef struct { + uint8_t filter_level; + uint8_t inner_limit; + uint8_t inner_filter; +} VP8FilterStrength; + +typedef struct { + uint8_t skip; + // todo: make it possible to check for at least (i4x4 or split_mv) + // in one op. are others needed? + uint8_t mode; + uint8_t ref_frame; + uint8_t partitioning; + VP56mv mv; + VP56mv bmv[16]; +} VP8Macroblock; + +typedef struct { + AVCodecContext *avctx; + DSPContext dsp; + VP8DSPContext vp8dsp; + H264PredContext hpc; + vp8_mc_func put_pixels_tab[3][3][3]; + AVFrame frames[4]; + AVFrame *framep[4]; + uint8_t *edge_emu_buffer; + VP56RangeCoder c; ///< header context, includes mb modes and motion vectors + int profile; + + int mb_width; /* number of horizontal MB */ + int mb_height; /* number of vertical MB */ + int linesize; + int uvlinesize; + + int keyframe; + int invisible; + int update_last; ///< update VP56_FRAME_PREVIOUS with the current one + int update_golden; ///< VP56_FRAME_NONE if not updated, or which frame to copy if so + int update_altref; + int deblock_filter; + + /** + * If this flag is not set, all the probability updates + * are discarded after this frame is decoded. + */ + int update_probabilities; + + /** + * All coefficients are contained in separate arith coding contexts. + * There can be 1, 2, 4, or 8 of these after the header context. + */ + int num_coeff_partitions; + VP56RangeCoder coeff_partition[8]; + + VP8Macroblock *macroblocks; + VP8Macroblock *macroblocks_base; + VP8FilterStrength *filter_strength; + + uint8_t *intra4x4_pred_mode_top; + uint8_t intra4x4_pred_mode_left[4]; + uint8_t *segmentation_map; + + /** + * Cache of the top row needed for intra prediction + * 16 for luma, 8 for each chroma plane + */ + uint8_t (*top_border)[16+8+8]; + + /** + * For coeff decode, we need to know whether the above block had non-zero + * coefficients. This means for each macroblock, we need data for 4 luma + * blocks, 2 u blocks, 2 v blocks, and the luma dc block, for a total of 9 + * per macroblock. We keep the last row in top_nnz. + */ + uint8_t (*top_nnz)[9]; + DECLARE_ALIGNED(8, uint8_t, left_nnz)[9]; + + /** + * This is the index plus one of the last non-zero coeff + * for each of the blocks in the current macroblock. + * So, 0 -> no coeffs + * 1 -> dc-only (special transform) + * 2+-> full transform + */ + DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4]; + DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16]; + DECLARE_ALIGNED(16, DCTELEM, block_dc)[16]; + uint8_t intra4x4_pred_mode_mb[16]; + + int chroma_pred_mode; ///< 8x8c pred mode of the current macroblock + int segment; ///< segment of the current macroblock + VP56mv mv_min; + VP56mv mv_max; + + int mbskip_enabled; + int sign_bias[4]; ///< one state [0, 1] per ref frame type + int ref_count[3]; + + /** + * Base parameters for segmentation, i.e. per-macroblock parameters. + * These must be kept unchanged even if segmentation is not used for + * a frame, since the values persist between interframes. + */ + struct { + int enabled; + int absolute_vals; + int update_map; + int8_t base_quant[4]; + int8_t filter_level[4]; ///< base loop filter level + } segmentation; + + /** + * Macroblocks can have one of 4 different quants in a frame when + * segmentation is enabled. + * If segmentation is disabled, only the first segment's values are used. + */ + struct { + // [0] - DC qmul [1] - AC qmul + int16_t luma_qmul[2]; + int16_t luma_dc_qmul[2]; ///< luma dc-only block quant + int16_t chroma_qmul[2]; + } qmat[4]; + + struct { + int simple; + int level; + int sharpness; + } filter; + + struct { + int enabled; ///< whether each mb can have a different strength based on mode/ref + + /** + * filter strength adjustment for the following macroblock modes: + * [0-3] - i16x16 (always zero) + * [4] - i4x4 + * [5] - zero mv + * [6] - inter modes except for zero or split mv + * [7] - split mv + * i16x16 modes never have any adjustment + */ + int8_t mode[VP8_MVMODE_SPLIT+1]; + + /** + * filter strength adjustment for macroblocks that reference: + * [0] - intra / VP56_FRAME_CURRENT + * [1] - VP56_FRAME_PREVIOUS + * [2] - VP56_FRAME_GOLDEN + * [3] - altref / VP56_FRAME_GOLDEN2 + */ + int8_t ref[4]; + } lf_delta; + + /** + * These are all of the updatable probabilities for binary decisions. + * They are only implictly reset on keyframes, making it quite likely + * for an interframe to desync if a prior frame's header was corrupt + * or missing outright! + */ + struct { + uint8_t segmentid[3]; + uint8_t mbskip; + uint8_t intra; + uint8_t last; + uint8_t golden; + uint8_t pred16x16[4]; + uint8_t pred8x8c[3]; + /* Padded to allow overreads */ + uint8_t token[4][17][3][NUM_DCT_TOKENS-1]; + uint8_t mvc[2][19]; + } prob[2]; +} VP8Context; + +#endif diff --git a/mplayer/ffmpeg/libavcodec/vp8data.h b/mplayer/ffmpeg/libavcodec/vp8data.h index 775472e8..af9b0d91 100644 --- a/mplayer/ffmpeg/libavcodec/vp8data.h +++ b/mplayer/ffmpeg/libavcodec/vp8data.h @@ -21,48 +21,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -// TODO: move these #define and enum to a better header... - -#define VP8_MAX_QUANT 127 - -enum dct_token { - DCT_0, - DCT_1, - DCT_2, - DCT_3, - DCT_4, - DCT_CAT1, - DCT_CAT2, - DCT_CAT3, - DCT_CAT4, - DCT_CAT5, - DCT_CAT6, - DCT_EOB, - - NUM_DCT_TOKENS -}; +#ifndef AVCODEC_VP8DATA_H +#define AVCODEC_VP8DATA_H +#include "vp8.h" #include "h264pred.h" -// used to signal 4x4 intra pred in luma MBs -#define MODE_I4x4 4 - -enum inter_mvmode { - VP8_MVMODE_NEAREST = MODE_I4x4 + 1, - VP8_MVMODE_NEAR, - VP8_MVMODE_ZERO, - VP8_MVMODE_NEW, - VP8_MVMODE_SPLIT -}; - -enum inter_splitmvmode { - VP8_SPLITMVMODE_16x8 = 0, ///< 2 16x8 blocks (vertical) - VP8_SPLITMVMODE_8x16, ///< 2 8x16 blocks (horizontal) - VP8_SPLITMVMODE_8x8, ///< 2x2 blocks of 8x8px each - VP8_SPLITMVMODE_4x4, ///< 4x4 blocks of 4x4px each - VP8_SPLITMVMODE_NONE, ///< (only used in prediction) no split MVs -}; - static const uint8_t vp8_pred4x4_mode[] = { [DC_PRED8x8] = DC_PRED, @@ -315,7 +279,7 @@ static const uint8_t vp8_dct_cat5_prob[] = { 180, 157, 141, 134, 130, 0 }; static const uint8_t vp8_dct_cat6_prob[] = { 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0 }; // only used for cat3 and above; cat 1 and 2 are referenced directly -static const uint8_t * const vp8_dct_cat_prob[] = +const uint8_t * const ff_vp8_dct_cat_prob[] = { vp8_dct_cat3_prob, vp8_dct_cat4_prob, @@ -720,3 +684,5 @@ static const uint8_t vp8_mv_default_prob[2][19] = { 204, 170, 119, 235, 140, 230, 228, 128, 130, 130, 74, 148, 180, 203, 236, 254, 254 } }; + +#endif diff --git a/mplayer/ffmpeg/libavcodec/vp8dsp.c b/mplayer/ffmpeg/libavcodec/vp8dsp.c index 30699cec..4391a7eb 100644 --- a/mplayer/ffmpeg/libavcodec/vp8dsp.c +++ b/mplayer/ffmpeg/libavcodec/vp8dsp.c @@ -523,4 +523,6 @@ av_cold void ff_vp8dsp_init(VP8DSPContext *dsp) ff_vp8dsp_init_x86(dsp); if (HAVE_ALTIVEC) ff_vp8dsp_init_altivec(dsp); + if (ARCH_ARM) + ff_vp8dsp_init_arm(dsp); } diff --git a/mplayer/ffmpeg/libavcodec/vp8dsp.h b/mplayer/ffmpeg/libavcodec/vp8dsp.h index ee5c7ec0..e8757ab7 100644 --- a/mplayer/ffmpeg/libavcodec/vp8dsp.h +++ b/mplayer/ffmpeg/libavcodec/vp8dsp.h @@ -79,5 +79,6 @@ void ff_put_vp8_pixels4_c(uint8_t *dst, uint8_t *src, int stride, int h, int x, void ff_vp8dsp_init(VP8DSPContext *c); void ff_vp8dsp_init_x86(VP8DSPContext *c); void ff_vp8dsp_init_altivec(VP8DSPContext *c); +void ff_vp8dsp_init_arm(VP8DSPContext *c); #endif /* AVCODEC_VP8DSP_H */ diff --git a/mplayer/ffmpeg/libavcodec/vqavideo.c b/mplayer/ffmpeg/libavcodec/vqavideo.c index c3b5ba65..f0ecda62 100644 --- a/mplayer/ffmpeg/libavcodec/vqavideo.c +++ b/mplayer/ffmpeg/libavcodec/vqavideo.c @@ -68,7 +68,7 @@ #include #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #define PALETTE_COUNT 256 diff --git a/mplayer/ffmpeg/libavcodec/w32thread.c b/mplayer/ffmpeg/libavcodec/w32thread.c index f7a14306..f2b8f5b3 100644 --- a/mplayer/ffmpeg/libavcodec/w32thread.c +++ b/mplayer/ffmpeg/libavcodec/w32thread.c @@ -20,6 +20,7 @@ //#define DEBUG #include "avcodec.h" +#include "thread.h" #define WIN32_LEAN_AND_MEAN #include @@ -69,10 +70,10 @@ static unsigned WINAPI attribute_align_arg thread_func(void *v){ } /** - * Free what has been allocated by avcodec_thread_init(). + * Free what has been allocated by ff_thread_init(). * Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running. */ -void avcodec_thread_free(AVCodecContext *s){ +void ff_thread_free(AVCodecContext *s){ ThreadContext *c= s->thread_opaque; int i; @@ -124,12 +125,18 @@ static int avcodec_thread_execute2(AVCodecContext *s, int (*func)(AVCodecContext avcodec_thread_execute(s, NULL, arg, ret, count, 0); } -int avcodec_thread_init(AVCodecContext *s, int thread_count){ +int ff_thread_init(AVCodecContext *s, int thread_count){ int i; ThreadContext *c; uint32_t threadid; + if(!(s->thread_type & FF_THREAD_SLICE)){ + av_log(s, AV_LOG_WARNING, "The requested thread algorithm is not supported with this thread library.\n"); + return 0; + } + s->thread_count= thread_count; + s->active_thread_type= FF_THREAD_SLICE; if (thread_count <= 1) return 0; @@ -163,6 +170,6 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count){ return 0; fail: - avcodec_thread_free(s); + ff_thread_free(s); return -1; } diff --git a/mplayer/ffmpeg/libavcodec/wavpack.c b/mplayer/ffmpeg/libavcodec/wavpack.c index e9698146..d5102320 100644 --- a/mplayer/ffmpeg/libavcodec/wavpack.c +++ b/mplayer/ffmpeg/libavcodec/wavpack.c @@ -22,6 +22,7 @@ #include "avcodec.h" #include "get_bits.h" #include "unary.h" +#include "libavutil/audioconvert.h" /** * @file @@ -706,7 +707,7 @@ static av_cold int wavpack_decode_init(AVCodecContext *avctx) else avctx->sample_fmt = AV_SAMPLE_FMT_S32; if(avctx->channels <= 2 && !avctx->channel_layout) - avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; s->multichannel = avctx->channels > 2; /* lavf demuxer does not provide extradata, Matroska stores 0x403 diff --git a/mplayer/ffmpeg/libavcodec/wma.c b/mplayer/ffmpeg/libavcodec/wma.c index e0b9b683..a7eacb8c 100644 --- a/mplayer/ffmpeg/libavcodec/wma.c +++ b/mplayer/ffmpeg/libavcodec/wma.c @@ -126,6 +126,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2) s->block_align = avctx->block_align; dsputil_init(&s->dsp, avctx); + ff_fmt_convert_init(&s->fmt_conv, avctx); if (avctx->codec->id == CODEC_ID_WMAV1) { s->version = 1; diff --git a/mplayer/ffmpeg/libavcodec/wma.h b/mplayer/ffmpeg/libavcodec/wma.h index 11274ad9..a51b3e83 100644 --- a/mplayer/ffmpeg/libavcodec/wma.h +++ b/mplayer/ffmpeg/libavcodec/wma.h @@ -26,6 +26,7 @@ #include "put_bits.h" #include "dsputil.h" #include "fft.h" +#include "fmtconvert.h" /* size of blocks */ #define BLOCK_MIN_BITS 7 @@ -134,6 +135,7 @@ typedef struct WMACodecContext { float lsp_pow_m_table1[(1 << LSP_POW_BITS)]; float lsp_pow_m_table2[(1 << LSP_POW_BITS)]; DSPContext dsp; + FmtConvertContext fmt_conv; #ifdef TRACE int frame_count; diff --git a/mplayer/ffmpeg/libavcodec/wmadec.c b/mplayer/ffmpeg/libavcodec/wmadec.c index d85d80d5..83f8dea8 100644 --- a/mplayer/ffmpeg/libavcodec/wmadec.c +++ b/mplayer/ffmpeg/libavcodec/wmadec.c @@ -791,7 +791,7 @@ static int wma_decode_frame(WMACodecContext *s, int16_t *samples) incr = s->nb_channels; for (ch = 0; ch < MAX_CHANNELS; ch++) output[ch] = s->frame_out[ch]; - s->dsp.float_to_int16_interleave(samples, output, n, incr); + s->fmt_conv.float_to_int16_interleave(samples, output, n, incr); for (ch = 0; ch < incr; ch++) { /* prepare for next block */ memmove(&s->frame_out[ch][0], &s->frame_out[ch][n], n * sizeof(float)); diff --git a/mplayer/ffmpeg/libavcodec/wmaprodec.c b/mplayer/ffmpeg/libavcodec/wmaprodec.c index bb1cd311..d248ae4a 100644 --- a/mplayer/ffmpeg/libavcodec/wmaprodec.c +++ b/mplayer/ffmpeg/libavcodec/wmaprodec.c @@ -1031,7 +1031,7 @@ static void wmapro_window(WMAProDecodeCtx *s) winlen >>= 1; s->dsp.vector_fmul_window(start, start, start + winlen, - window, 0, winlen); + window, winlen); s->channel[c].prev_block_len = s->subframe_len; } diff --git a/mplayer/ffmpeg/libavcodec/x86/Makefile b/mplayer/ffmpeg/libavcodec/x86/Makefile index 943edcb0..1b58fa12 100644 --- a/mplayer/ffmpeg/libavcodec/x86/Makefile +++ b/mplayer/ffmpeg/libavcodec/x86/Makefile @@ -17,6 +17,10 @@ MMX-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o YASM-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_yasm.o +MMX-OBJS-$(CONFIG_AC3_ENCODER) += x86/ac3dsp_mmx.o +MMX-OBJS-$(CONFIG_AC3_FIXED_ENCODER) += x86/ac3dsp_mmx.o +YASM-OBJS-$(CONFIG_AC3_ENCODER) += x86/ac3dsp.o +YASM-OBJS-$(CONFIG_AC3_FIXED_ENCODER) += x86/ac3dsp.o MMX-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp_mmx.o MMX-OBJS-$(CONFIG_MP1FLOAT_DECODER) += x86/mpegaudiodec_mmx.o MMX-OBJS-$(CONFIG_MP2FLOAT_DECODER) += x86/mpegaudiodec_mmx.o @@ -39,6 +43,7 @@ YASM-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp.o MMX-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp-init.o MMX-OBJS-$(HAVE_YASM) += x86/dsputil_yasm.o \ x86/deinterlace.o \ + x86/fmtconvert.o \ x86/h264_chromamc.o \ $(YASM-OBJS-yes) @@ -47,6 +52,7 @@ MMX-OBJS-$(CONFIG_FFT) += x86/fft.o OBJS-$(HAVE_MMX) += x86/dnxhd_mmx.o \ x86/dsputil_mmx.o \ x86/fdct_mmx.o \ + x86/fmtconvert_mmx.o \ x86/idct_mmx_xvid.o \ x86/idct_sse2_xvid.o \ x86/motion_est_mmx.o \ diff --git a/mplayer/ffmpeg/libavcodec/x86/ac3dsp.asm b/mplayer/ffmpeg/libavcodec/x86/ac3dsp.asm new file mode 100644 index 00000000..b1eeca9c --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/x86/ac3dsp.asm @@ -0,0 +1,135 @@ +;***************************************************************************** +;* x86-optimized AC-3 DSP utils +;* Copyright (c) 2011 Justin Ruggles +;* +;* This file is part of FFmpeg. +;* +;* FFmpeg is free software; you can redistribute it and/or +;* modify it under the terms of the GNU Lesser General Public +;* License as published by the Free Software Foundation; either +;* version 2.1 of the License, or (at your option) any later version. +;* +;* FFmpeg 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 +;* Lesser General Public License for more details. +;* +;* You should have received a copy of the GNU Lesser General Public +;* License along with FFmpeg; if not, write to the Free Software +;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;****************************************************************************** + +%include "x86inc.asm" +%include "x86util.asm" + +SECTION .text + +;----------------------------------------------------------------------------- +; void ff_ac3_exponent_min(uint8_t *exp, int num_reuse_blocks, int nb_coefs) +;----------------------------------------------------------------------------- + +%macro AC3_EXPONENT_MIN 1 +cglobal ac3_exponent_min_%1, 3,4,2, exp, reuse_blks, expn, offset + shl reuse_blksq, 8 + jz .end + LOOP_ALIGN +.nextexp: + mov offsetq, reuse_blksq + mova m0, [expq+offsetq] + sub offsetq, 256 + LOOP_ALIGN +.nextblk: + PMINUB m0, [expq+offsetq], m1 + sub offsetq, 256 + jae .nextblk + mova [expq], m0 + add expq, mmsize + sub expnq, mmsize + jg .nextexp +.end: + REP_RET +%endmacro + +%define PMINUB PMINUB_MMX +%define LOOP_ALIGN +INIT_MMX +AC3_EXPONENT_MIN mmx +%ifdef HAVE_MMX2 +%define PMINUB PMINUB_MMXEXT +%define LOOP_ALIGN ALIGN 16 +AC3_EXPONENT_MIN mmxext +%endif +%ifdef HAVE_SSE +INIT_XMM +AC3_EXPONENT_MIN sse2 +%endif +%undef PMINUB +%undef LOOP_ALIGN + +;----------------------------------------------------------------------------- +; int ff_ac3_max_msb_abs_int16(const int16_t *src, int len) +; +; This function uses 2 different methods to calculate a valid result. +; 1) logical 'or' of abs of each element +; This is used for ssse3 because of the pabsw instruction. +; It is also used for mmx because of the lack of min/max instructions. +; 2) calculate min/max for the array, then or(abs(min),abs(max)) +; This is used for mmxext and sse2 because they have pminsw/pmaxsw. +;----------------------------------------------------------------------------- + +%macro AC3_MAX_MSB_ABS_INT16 2 +cglobal ac3_max_msb_abs_int16_%1, 2,2,5, src, len + pxor m2, m2 + pxor m3, m3 +.loop: +%ifidn %2, min_max + mova m0, [srcq] + mova m1, [srcq+mmsize] + pminsw m2, m0 + pminsw m2, m1 + pmaxsw m3, m0 + pmaxsw m3, m1 +%else ; or_abs +%ifidn %1, mmx + mova m0, [srcq] + mova m1, [srcq+mmsize] + ABS2 m0, m1, m3, m4 +%else ; ssse3 + ; using memory args is faster for ssse3 + pabsw m0, [srcq] + pabsw m1, [srcq+mmsize] +%endif + por m2, m0 + por m2, m1 +%endif + add srcq, mmsize*2 + sub lend, mmsize + ja .loop +%ifidn %2, min_max + ABS2 m2, m3, m0, m1 + por m2, m3 +%endif +%ifidn mmsize, 16 + movhlps m0, m2 + por m2, m0 +%endif + PSHUFLW m0, m2, 0xe + por m2, m0 + PSHUFLW m0, m2, 0x1 + por m2, m0 + movd eax, m2 + and eax, 0xFFFF + RET +%endmacro + +INIT_MMX +%define ABS2 ABS2_MMX +%define PSHUFLW pshufw +AC3_MAX_MSB_ABS_INT16 mmx, or_abs +%define ABS2 ABS2_MMX2 +AC3_MAX_MSB_ABS_INT16 mmxext, min_max +INIT_XMM +%define PSHUFLW pshuflw +AC3_MAX_MSB_ABS_INT16 sse2, min_max +%define ABS2 ABS2_SSSE3 +AC3_MAX_MSB_ABS_INT16 ssse3, or_abs diff --git a/mplayer/ffmpeg/libavcodec/x86/ac3dsp_mmx.c b/mplayer/ffmpeg/libavcodec/x86/ac3dsp_mmx.c new file mode 100644 index 00000000..d8af59ce --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/x86/ac3dsp_mmx.c @@ -0,0 +1,56 @@ +/* + * x86-optimized AC-3 DSP utils + * Copyright (c) 2011 Justin Ruggles + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/x86_cpu.h" +#include "dsputil_mmx.h" +#include "libavcodec/ac3dsp.h" + +extern void ff_ac3_exponent_min_mmx (uint8_t *exp, int num_reuse_blocks, int nb_coefs); +extern void ff_ac3_exponent_min_mmxext(uint8_t *exp, int num_reuse_blocks, int nb_coefs); +extern void ff_ac3_exponent_min_sse2 (uint8_t *exp, int num_reuse_blocks, int nb_coefs); + +extern int ff_ac3_max_msb_abs_int16_mmx (const int16_t *src, int len); +extern int ff_ac3_max_msb_abs_int16_mmxext(const int16_t *src, int len); +extern int ff_ac3_max_msb_abs_int16_sse2 (const int16_t *src, int len); +extern int ff_ac3_max_msb_abs_int16_ssse3 (const int16_t *src, int len); + +av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c) +{ + int mm_flags = av_get_cpu_flags(); + +#if HAVE_YASM + if (mm_flags & AV_CPU_FLAG_MMX) { + c->ac3_exponent_min = ff_ac3_exponent_min_mmx; + c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx; + } + if (mm_flags & AV_CPU_FLAG_MMX2 && HAVE_MMX2) { + c->ac3_exponent_min = ff_ac3_exponent_min_mmxext; + c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmxext; + } + if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) { + c->ac3_exponent_min = ff_ac3_exponent_min_sse2; + c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2; + } + if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) { + c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3; + } +#endif +} diff --git a/mplayer/ffmpeg/libavcodec/x86/dsputil_mmx.c b/mplayer/ffmpeg/libavcodec/x86/dsputil_mmx.c index 5ddfecae..a5b0b3ae 100644 --- a/mplayer/ffmpeg/libavcodec/x86/dsputil_mmx.c +++ b/mplayer/ffmpeg/libavcodec/x86/dsputil_mmx.c @@ -286,9 +286,6 @@ void ff_put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_s :"memory"); } -DECLARE_ASM_CONST(8, uint8_t, ff_vector128)[8] = - { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; - #define put_signed_pixels_clamped_mmx_half(off) \ "movq "#off"(%2), %%mm1 \n\t"\ "movq 16+"#off"(%2), %%mm2 \n\t"\ @@ -313,7 +310,7 @@ void ff_put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int x86_reg line_skip3; __asm__ volatile ( - "movq "MANGLE(ff_vector128)", %%mm0 \n\t" + "movq "MANGLE(ff_pb_80)", %%mm0 \n\t" "lea (%3, %3, 2), %1 \n\t" put_signed_pixels_clamped_mmx_half(0) "lea (%0, %3, 4), %0 \n\t" @@ -1664,8 +1661,80 @@ QPEL_2TAP(avg_, 8, 3dnow) static void just_return(void) { return; } #endif -static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, - int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height){ +#if HAVE_YASM +typedef void emu_edge_core_func (uint8_t *buf, const uint8_t *src, + x86_reg linesize, x86_reg start_y, + x86_reg end_y, x86_reg block_h, + x86_reg start_x, x86_reg end_x, + x86_reg block_w); +extern emu_edge_core_func ff_emu_edge_core_mmx; +extern emu_edge_core_func ff_emu_edge_core_sse; + +static av_always_inline +void emulated_edge_mc(uint8_t *buf, const uint8_t *src, int linesize, + int block_w, int block_h, + int src_x, int src_y, int w, int h, + emu_edge_core_func *core_fn) +{ + int start_y, start_x, end_y, end_x, src_y_add=0; + + if(src_y>= h){ + src_y_add = h-1-src_y; + src_y=h-1; + }else if(src_y<=-block_h){ + src_y_add = 1-block_h-src_y; + src_y=1-block_h; + } + if(src_x>= w){ + src+= (w-1-src_x); + src_x=w-1; + }else if(src_x<=-block_w){ + src+= (1-block_w-src_x); + src_x=1-block_w; + } + + start_y= FFMAX(0, -src_y); + start_x= FFMAX(0, -src_x); + end_y= FFMIN(block_h, h-src_y); + end_x= FFMIN(block_w, w-src_x); + assert(start_x < end_x && block_w > 0); + assert(start_y < end_y && block_h > 0); + + // fill in the to-be-copied part plus all above/below + src += (src_y_add+start_y)*linesize + start_x; + buf += start_x; + core_fn(buf, src, linesize, start_y, end_y, block_h, start_x, end_x, block_w); +} + +#if ARCH_X86_32 +static av_noinline +void emulated_edge_mc_mmx(uint8_t *buf, const uint8_t *src, int linesize, + int block_w, int block_h, + int src_x, int src_y, int w, int h) +{ + emulated_edge_mc(buf, src, linesize, block_w, block_h, src_x, src_y, + w, h, &ff_emu_edge_core_mmx); +} +#endif +static av_noinline +void emulated_edge_mc_sse(uint8_t *buf, const uint8_t *src, int linesize, + int block_w, int block_h, + int src_x, int src_y, int w, int h) +{ + emulated_edge_mc(buf, src, linesize, block_w, block_h, src_x, src_y, + w, h, &ff_emu_edge_core_sse); +} +#endif /* HAVE_YASM */ + +typedef void emulated_edge_mc_func (uint8_t *dst, const uint8_t *src, + int linesize, int block_w, int block_h, + int src_x, int src_y, int w, int h); + +static av_always_inline +void gmc(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, + int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height, + emulated_edge_mc_func *emu_edge_fn) +{ const int w = 8; const int ix = ox>>(16+shift); const int iy = oy>>(16+shift); @@ -1701,7 +1770,7 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int o if( (unsigned)ix >= width-w || (unsigned)iy >= height-h ) { - ff_emulated_edge_mc(edge_buf, src, stride, w+1, h+1, ix, iy, width, height); + emu_edge_fn(edge_buf, src, stride, w+1, h+1, ix, iy, width, height); src = edge_buf; } @@ -1782,6 +1851,30 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int o } } +#if HAVE_YASM +#if ARCH_X86_32 +static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, + int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height) +{ + gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, + width, height, &emulated_edge_mc_mmx); +} +#endif +static void gmc_sse(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, + int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height) +{ + gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, + width, height, &emulated_edge_mc_sse); +} +#else +static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, + int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height) +{ + gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, + width, height, &ff_emulated_edge_mc); +} +#endif + #define PREFETCH(name, op) \ static void name(void *mem, int stride, int h){\ const uint8_t *p= mem;\ @@ -1798,20 +1891,14 @@ PREFETCH(prefetch_3dnow, prefetch) void ff_put_h264_chroma_mc8_mmx_rnd (uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); -void ff_put_vc1_chroma_mc8_mmx_nornd (uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); void ff_put_rv40_chroma_mc8_mmx (uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); void ff_avg_h264_chroma_mc8_mmx2_rnd (uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); -void ff_avg_vc1_chroma_mc8_mmx2_nornd (uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); void ff_avg_rv40_chroma_mc8_mmx2 (uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); void ff_avg_h264_chroma_mc8_3dnow_rnd (uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); -void ff_avg_vc1_chroma_mc8_3dnow_nornd(uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); void ff_avg_rv40_chroma_mc8_3dnow (uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); @@ -1835,15 +1922,11 @@ void ff_avg_h264_chroma_mc2_mmx2 (uint8_t *dst, uint8_t *src, void ff_put_h264_chroma_mc8_ssse3_rnd (uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); -void ff_put_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); void ff_put_h264_chroma_mc4_ssse3 (uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); void ff_avg_h264_chroma_mc8_ssse3_rnd (uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); -void ff_avg_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); void ff_avg_h264_chroma_mc4_ssse3 (uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); @@ -2190,120 +2273,68 @@ static void vector_fmul_add_sse(float *dst, const float *src0, const float *src1 ); } -static void vector_fmul_window_3dnow2(float *dst, const float *src0, const float *src1, - const float *win, float add_bias, int len){ -#if HAVE_6REGS - if(add_bias == 0){ - x86_reg i = -len*4; - x86_reg j = len*4-8; - __asm__ volatile( - "1: \n" - "pswapd (%5,%1), %%mm1 \n" - "movq (%5,%0), %%mm0 \n" - "pswapd (%4,%1), %%mm5 \n" - "movq (%3,%0), %%mm4 \n" - "movq %%mm0, %%mm2 \n" - "movq %%mm1, %%mm3 \n" - "pfmul %%mm4, %%mm2 \n" // src0[len+i]*win[len+i] - "pfmul %%mm5, %%mm3 \n" // src1[ j]*win[len+j] - "pfmul %%mm4, %%mm1 \n" // src0[len+i]*win[len+j] - "pfmul %%mm5, %%mm0 \n" // src1[ j]*win[len+i] - "pfadd %%mm3, %%mm2 \n" - "pfsub %%mm0, %%mm1 \n" - "pswapd %%mm2, %%mm2 \n" - "movq %%mm1, (%2,%0) \n" - "movq %%mm2, (%2,%1) \n" - "sub $8, %1 \n" - "add $8, %0 \n" - "jl 1b \n" - "femms \n" - :"+r"(i), "+r"(j) - :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len) - ); - }else -#endif - ff_vector_fmul_window_c(dst, src0, src1, win, add_bias, len); -} - -static void vector_fmul_window_sse(float *dst, const float *src0, const float *src1, - const float *win, float add_bias, int len){ #if HAVE_6REGS - if(add_bias == 0){ - x86_reg i = -len*4; - x86_reg j = len*4-16; - __asm__ volatile( - "1: \n" - "movaps (%5,%1), %%xmm1 \n" - "movaps (%5,%0), %%xmm0 \n" - "movaps (%4,%1), %%xmm5 \n" - "movaps (%3,%0), %%xmm4 \n" - "shufps $0x1b, %%xmm1, %%xmm1 \n" - "shufps $0x1b, %%xmm5, %%xmm5 \n" - "movaps %%xmm0, %%xmm2 \n" - "movaps %%xmm1, %%xmm3 \n" - "mulps %%xmm4, %%xmm2 \n" // src0[len+i]*win[len+i] - "mulps %%xmm5, %%xmm3 \n" // src1[ j]*win[len+j] - "mulps %%xmm4, %%xmm1 \n" // src0[len+i]*win[len+j] - "mulps %%xmm5, %%xmm0 \n" // src1[ j]*win[len+i] - "addps %%xmm3, %%xmm2 \n" - "subps %%xmm0, %%xmm1 \n" - "shufps $0x1b, %%xmm2, %%xmm2 \n" - "movaps %%xmm1, (%2,%0) \n" - "movaps %%xmm2, (%2,%1) \n" - "sub $16, %1 \n" - "add $16, %0 \n" - "jl 1b \n" - :"+r"(i), "+r"(j) - :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len) - ); - }else -#endif - ff_vector_fmul_window_c(dst, src0, src1, win, add_bias, len); -} - -static void int32_to_float_fmul_scalar_sse(float *dst, const int *src, float mul, int len) -{ - x86_reg i = -4*len; +static void vector_fmul_window_3dnow2(float *dst, const float *src0, const float *src1, + const float *win, int len){ + x86_reg i = -len*4; + x86_reg j = len*4-8; __asm__ volatile( - "movss %3, %%xmm4 \n" - "shufps $0, %%xmm4, %%xmm4 \n" "1: \n" - "cvtpi2ps (%2,%0), %%xmm0 \n" - "cvtpi2ps 8(%2,%0), %%xmm1 \n" - "cvtpi2ps 16(%2,%0), %%xmm2 \n" - "cvtpi2ps 24(%2,%0), %%xmm3 \n" - "movlhps %%xmm1, %%xmm0 \n" - "movlhps %%xmm3, %%xmm2 \n" - "mulps %%xmm4, %%xmm0 \n" - "mulps %%xmm4, %%xmm2 \n" - "movaps %%xmm0, (%1,%0) \n" - "movaps %%xmm2, 16(%1,%0) \n" - "add $32, %0 \n" + "pswapd (%5,%1), %%mm1 \n" + "movq (%5,%0), %%mm0 \n" + "pswapd (%4,%1), %%mm5 \n" + "movq (%3,%0), %%mm4 \n" + "movq %%mm0, %%mm2 \n" + "movq %%mm1, %%mm3 \n" + "pfmul %%mm4, %%mm2 \n" // src0[len+i]*win[len+i] + "pfmul %%mm5, %%mm3 \n" // src1[ j]*win[len+j] + "pfmul %%mm4, %%mm1 \n" // src0[len+i]*win[len+j] + "pfmul %%mm5, %%mm0 \n" // src1[ j]*win[len+i] + "pfadd %%mm3, %%mm2 \n" + "pfsub %%mm0, %%mm1 \n" + "pswapd %%mm2, %%mm2 \n" + "movq %%mm1, (%2,%0) \n" + "movq %%mm2, (%2,%1) \n" + "sub $8, %1 \n" + "add $8, %0 \n" "jl 1b \n" - :"+r"(i) - :"r"(dst+len), "r"(src+len), "m"(mul) + "femms \n" + :"+r"(i), "+r"(j) + :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len) ); } -static void int32_to_float_fmul_scalar_sse2(float *dst, const int *src, float mul, int len) -{ - x86_reg i = -4*len; +static void vector_fmul_window_sse(float *dst, const float *src0, const float *src1, + const float *win, int len){ + x86_reg i = -len*4; + x86_reg j = len*4-16; __asm__ volatile( - "movss %3, %%xmm4 \n" - "shufps $0, %%xmm4, %%xmm4 \n" "1: \n" - "cvtdq2ps (%2,%0), %%xmm0 \n" - "cvtdq2ps 16(%2,%0), %%xmm1 \n" - "mulps %%xmm4, %%xmm0 \n" - "mulps %%xmm4, %%xmm1 \n" - "movaps %%xmm0, (%1,%0) \n" - "movaps %%xmm1, 16(%1,%0) \n" - "add $32, %0 \n" + "movaps (%5,%1), %%xmm1 \n" + "movaps (%5,%0), %%xmm0 \n" + "movaps (%4,%1), %%xmm5 \n" + "movaps (%3,%0), %%xmm4 \n" + "shufps $0x1b, %%xmm1, %%xmm1 \n" + "shufps $0x1b, %%xmm5, %%xmm5 \n" + "movaps %%xmm0, %%xmm2 \n" + "movaps %%xmm1, %%xmm3 \n" + "mulps %%xmm4, %%xmm2 \n" // src0[len+i]*win[len+i] + "mulps %%xmm5, %%xmm3 \n" // src1[ j]*win[len+j] + "mulps %%xmm4, %%xmm1 \n" // src0[len+i]*win[len+j] + "mulps %%xmm5, %%xmm0 \n" // src1[ j]*win[len+i] + "addps %%xmm3, %%xmm2 \n" + "subps %%xmm0, %%xmm1 \n" + "shufps $0x1b, %%xmm2, %%xmm2 \n" + "movaps %%xmm1, (%2,%0) \n" + "movaps %%xmm2, (%2,%1) \n" + "sub $16, %1 \n" + "add $16, %0 \n" "jl 1b \n" - :"+r"(i) - :"r"(dst+len), "r"(src+len), "m"(mul) + :"+r"(i), "+r"(j) + :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len) ); } +#endif /* HAVE_6REGS */ static void vector_clipf_sse(float *dst, const float *src, float min, float max, int len) @@ -2339,70 +2370,6 @@ static void vector_clipf_sse(float *dst, const float *src, float min, float max, ); } -static void float_to_int16_3dnow(int16_t *dst, const float *src, long len){ - x86_reg reglen = len; - // not bit-exact: pf2id uses different rounding than C and SSE - __asm__ volatile( - "add %0 , %0 \n\t" - "lea (%2,%0,2) , %2 \n\t" - "add %0 , %1 \n\t" - "neg %0 \n\t" - "1: \n\t" - "pf2id (%2,%0,2) , %%mm0 \n\t" - "pf2id 8(%2,%0,2) , %%mm1 \n\t" - "pf2id 16(%2,%0,2) , %%mm2 \n\t" - "pf2id 24(%2,%0,2) , %%mm3 \n\t" - "packssdw %%mm1 , %%mm0 \n\t" - "packssdw %%mm3 , %%mm2 \n\t" - "movq %%mm0 , (%1,%0) \n\t" - "movq %%mm2 , 8(%1,%0) \n\t" - "add $16 , %0 \n\t" - " js 1b \n\t" - "femms \n\t" - :"+r"(reglen), "+r"(dst), "+r"(src) - ); -} -static void float_to_int16_sse(int16_t *dst, const float *src, long len){ - x86_reg reglen = len; - __asm__ volatile( - "add %0 , %0 \n\t" - "lea (%2,%0,2) , %2 \n\t" - "add %0 , %1 \n\t" - "neg %0 \n\t" - "1: \n\t" - "cvtps2pi (%2,%0,2) , %%mm0 \n\t" - "cvtps2pi 8(%2,%0,2) , %%mm1 \n\t" - "cvtps2pi 16(%2,%0,2) , %%mm2 \n\t" - "cvtps2pi 24(%2,%0,2) , %%mm3 \n\t" - "packssdw %%mm1 , %%mm0 \n\t" - "packssdw %%mm3 , %%mm2 \n\t" - "movq %%mm0 , (%1,%0) \n\t" - "movq %%mm2 , 8(%1,%0) \n\t" - "add $16 , %0 \n\t" - " js 1b \n\t" - "emms \n\t" - :"+r"(reglen), "+r"(dst), "+r"(src) - ); -} - -static void float_to_int16_sse2(int16_t *dst, const float *src, long len){ - x86_reg reglen = len; - __asm__ volatile( - "add %0 , %0 \n\t" - "lea (%2,%0,2) , %2 \n\t" - "add %0 , %1 \n\t" - "neg %0 \n\t" - "1: \n\t" - "cvtps2dq (%2,%0,2) , %%xmm0 \n\t" - "cvtps2dq 16(%2,%0,2) , %%xmm1 \n\t" - "packssdw %%xmm1 , %%xmm0 \n\t" - "movdqa %%xmm0 , (%1,%0) \n\t" - "add $16 , %0 \n\t" - " js 1b \n\t" - :"+r"(reglen), "+r"(dst), "+r"(src) - ); -} - void ff_vp3_idct_mmx(int16_t *input_data); void ff_vp3_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block); void ff_vp3_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block); @@ -2416,9 +2383,6 @@ void ff_vp3_idct_sse2(int16_t *input_data); void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block); void ff_vp3_idct_add_sse2(uint8_t *dest, int line_size, DCTELEM *block); -void ff_float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len); -void ff_float_to_int16_interleave6_3dnow(int16_t *dst, const float **src, int len); -void ff_float_to_int16_interleave6_3dn2(int16_t *dst, const float **src, int len); int32_t ff_scalarproduct_int16_mmx2(const int16_t *v1, const int16_t *v2, int order, int shift); int32_t ff_scalarproduct_int16_sse2(const int16_t *v1, const int16_t *v2, int order, int shift); int32_t ff_scalarproduct_and_madd_int16_mmx2(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul); @@ -2428,102 +2392,6 @@ void ff_add_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *top, const int ff_add_hfyu_left_prediction_ssse3(uint8_t *dst, const uint8_t *src, int w, int left); int ff_add_hfyu_left_prediction_sse4(uint8_t *dst, const uint8_t *src, int w, int left); -#if !HAVE_YASM -#define ff_float_to_int16_interleave6_sse(a,b,c) float_to_int16_interleave_misc_sse(a,b,c,6) -#define ff_float_to_int16_interleave6_3dnow(a,b,c) float_to_int16_interleave_misc_3dnow(a,b,c,6) -#define ff_float_to_int16_interleave6_3dn2(a,b,c) float_to_int16_interleave_misc_3dnow(a,b,c,6) -#endif -#define ff_float_to_int16_interleave6_sse2 ff_float_to_int16_interleave6_sse - -#define FLOAT_TO_INT16_INTERLEAVE(cpu, body) \ -/* gcc pessimizes register allocation if this is in the same function as float_to_int16_interleave_sse2*/\ -static av_noinline void float_to_int16_interleave_misc_##cpu(int16_t *dst, const float **src, long len, int channels){\ - DECLARE_ALIGNED(16, int16_t, tmp)[len];\ - int i,j,c;\ - for(c=0; cgmc= gmc_mmx; +#endif +#if ARCH_X86_32 && HAVE_YASM + c->emulated_edge_mc = emulated_edge_mc_mmx; +#endif c->add_bytes= add_bytes_mmx; c->add_bytes_l2= add_bytes_l2_mmx; @@ -2649,7 +2522,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) #if HAVE_YASM c->put_h264_chroma_pixels_tab[0]= ff_put_h264_chroma_mc8_mmx_rnd; c->put_h264_chroma_pixels_tab[1]= ff_put_h264_chroma_mc4_mmx; - c->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_mmx_nornd; c->put_rv40_chroma_pixels_tab[0]= ff_put_rv40_chroma_mc8_mmx; c->put_rv40_chroma_pixels_tab[1]= ff_put_rv40_chroma_mc4_mmx; @@ -2736,8 +2608,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->avg_rv40_chroma_pixels_tab[0]= ff_avg_rv40_chroma_mc8_mmx2; c->avg_rv40_chroma_pixels_tab[1]= ff_avg_rv40_chroma_mc4_mmx2; - c->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_mmx2_nornd; - c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_mmx2_rnd; c->avg_h264_chroma_pixels_tab[1]= ff_avg_h264_chroma_mc4_mmx2; c->avg_h264_chroma_pixels_tab[2]= ff_avg_h264_chroma_mc2_mmx2; @@ -2750,9 +2620,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov; #endif - if (CONFIG_VC1_DECODER) - ff_vc1dsp_init_mmx(c, avctx); - c->add_png_paeth_prediction= add_png_paeth_prediction_mmx2; } else if (mm_flags & AV_CPU_FLAG_3DNOW) { c->prefetch = prefetch_3dnow; @@ -2809,8 +2676,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_3dnow_rnd; c->avg_h264_chroma_pixels_tab[1]= ff_avg_h264_chroma_mc4_3dnow; - c->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_3dnow_nornd; - c->avg_rv40_chroma_pixels_tab[0]= ff_avg_rv40_chroma_mc8_3dnow; c->avg_rv40_chroma_pixels_tab[1]= ff_avg_rv40_chroma_mc4_3dnow; #endif @@ -2859,8 +2724,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) H264_QPEL_FUNCS(3, 3, ssse3); c->add_png_paeth_prediction= add_png_paeth_prediction_ssse3; #if HAVE_YASM - c->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_ssse3_nornd; - c->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_ssse3_nornd; c->put_h264_chroma_pixels_tab[0]= ff_put_h264_chroma_mc8_ssse3_rnd; c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_ssse3_rnd; c->put_h264_chroma_pixels_tab[1]= ff_put_h264_chroma_mc4_ssse3; @@ -2875,17 +2738,12 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) if(mm_flags & AV_CPU_FLAG_3DNOW){ c->vorbis_inverse_coupling = vorbis_inverse_coupling_3dnow; c->vector_fmul = vector_fmul_3dnow; - if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ - c->float_to_int16 = float_to_int16_3dnow; - c->float_to_int16_interleave = float_to_int16_interleave_3dnow; - } } if(mm_flags & AV_CPU_FLAG_3DNOWEXT){ c->vector_fmul_reverse = vector_fmul_reverse_3dnow2; +#if HAVE_6REGS c->vector_fmul_window = vector_fmul_window_3dnow2; - if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ - c->float_to_int16_interleave = float_to_int16_interleave_3dn2; - } +#endif } if(mm_flags & AV_CPU_FLAG_MMX2){ #if HAVE_YASM @@ -2899,11 +2757,10 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->vector_fmul = vector_fmul_sse; c->vector_fmul_reverse = vector_fmul_reverse_sse; c->vector_fmul_add = vector_fmul_add_sse; +#if HAVE_6REGS c->vector_fmul_window = vector_fmul_window_sse; - c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse; +#endif c->vector_clipf = vector_clipf_sse; - c->float_to_int16 = float_to_int16_sse; - c->float_to_int16_interleave = float_to_int16_interleave_sse; #if HAVE_YASM c->scalarproduct_float = ff_scalarproduct_float_sse; #endif @@ -2911,12 +2768,12 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) if(mm_flags & AV_CPU_FLAG_3DNOW) c->vector_fmul_add = vector_fmul_add_3dnow; // faster than sse if(mm_flags & AV_CPU_FLAG_SSE2){ - c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse2; - c->float_to_int16 = float_to_int16_sse2; - c->float_to_int16_interleave = float_to_int16_interleave_sse2; #if HAVE_YASM c->scalarproduct_int16 = ff_scalarproduct_int16_sse2; c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_sse2; + + c->emulated_edge_mc = emulated_edge_mc_sse; + c->gmc= gmc_sse; #endif } if((mm_flags & AV_CPU_FLAG_SSSE3) && !(mm_flags & (AV_CPU_FLAG_SSE42|AV_CPU_FLAG_3DNOW)) && HAVE_YASM) // cachesplit diff --git a/mplayer/ffmpeg/libavcodec/x86/dsputil_mmx.h b/mplayer/ffmpeg/libavcodec/x86/dsputil_mmx.h index a095e1ef..59a96136 100644 --- a/mplayer/ffmpeg/libavcodec/x86/dsputil_mmx.h +++ b/mplayer/ffmpeg/libavcodec/x86/dsputil_mmx.h @@ -196,7 +196,6 @@ void ff_avg_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); void ff_put_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); void ff_avg_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); -void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx); void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd); void ff_avg_vc1_mspel_mc00_mmx2(uint8_t *dst, const uint8_t *src, int stride, int rnd); diff --git a/mplayer/ffmpeg/libavcodec/x86/dsputil_yasm.asm b/mplayer/ffmpeg/libavcodec/x86/dsputil_yasm.asm index bda04727..53884a6b 100644 --- a/mplayer/ffmpeg/libavcodec/x86/dsputil_yasm.asm +++ b/mplayer/ffmpeg/libavcodec/x86/dsputil_yasm.asm @@ -30,75 +30,6 @@ pb_zz11zz55zz99zzdd: db -1,-1,1,1,-1,-1,5,5,-1,-1,9,9,-1,-1,13,13 section .text align=16 -%macro PSWAPD_SSE 2 - pshufw %1, %2, 0x4e -%endmacro -%macro PSWAPD_3DN1 2 - movq %1, %2 - psrlq %1, 32 - punpckldq %1, %2 -%endmacro - -%macro FLOAT_TO_INT16_INTERLEAVE6 1 -; void float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len) -cglobal float_to_int16_interleave6_%1, 2,7,0, dst, src, src1, src2, src3, src4, src5 -%ifdef ARCH_X86_64 - %define lend r10d - mov lend, r2d -%else - %define lend dword r2m -%endif - mov src1q, [srcq+1*gprsize] - mov src2q, [srcq+2*gprsize] - mov src3q, [srcq+3*gprsize] - mov src4q, [srcq+4*gprsize] - mov src5q, [srcq+5*gprsize] - mov srcq, [srcq] - sub src1q, srcq - sub src2q, srcq - sub src3q, srcq - sub src4q, srcq - sub src5q, srcq -.loop: - cvtps2pi mm0, [srcq] - cvtps2pi mm1, [srcq+src1q] - cvtps2pi mm2, [srcq+src2q] - cvtps2pi mm3, [srcq+src3q] - cvtps2pi mm4, [srcq+src4q] - cvtps2pi mm5, [srcq+src5q] - packssdw mm0, mm3 - packssdw mm1, mm4 - packssdw mm2, mm5 - pswapd mm3, mm0 - punpcklwd mm0, mm1 - punpckhwd mm1, mm2 - punpcklwd mm2, mm3 - pswapd mm3, mm0 - punpckldq mm0, mm2 - punpckhdq mm2, mm1 - punpckldq mm1, mm3 - movq [dstq ], mm0 - movq [dstq+16], mm2 - movq [dstq+ 8], mm1 - add srcq, 8 - add dstq, 24 - sub lend, 2 - jg .loop - emms - RET -%endmacro ; FLOAT_TO_INT16_INTERLEAVE6 - -%define pswapd PSWAPD_SSE -FLOAT_TO_INT16_INTERLEAVE6 sse -%define cvtps2pi pf2id -%define pswapd PSWAPD_3DN1 -FLOAT_TO_INT16_INTERLEAVE6 3dnow -%undef pswapd -FLOAT_TO_INT16_INTERLEAVE6 3dn2 -%undef cvtps2pi - - - %macro SCALARPRODUCT 1 ; int scalarproduct_int16(int16_t *v1, int16_t *v2, int order, int shift) cglobal scalarproduct_int16_%1, 3,3,4, v1, v2, order, shift @@ -421,3 +352,573 @@ cglobal scalarproduct_float_sse, 3,3,2, v1, v2, offset fld dword r0m %endif RET + +; extern void ff_emu_edge_core(uint8_t *buf, const uint8_t *src, x86_reg linesize, +; x86_reg start_y, x86_reg end_y, x86_reg block_h, +; x86_reg start_x, x86_reg end_x, x86_reg block_w); +; +; The actual function itself is below. It basically wraps a very simple +; w = end_x - start_x +; if (w) { +; if (w > 22) { +; jump to the slow loop functions +; } else { +; jump to the fast loop functions +; } +; } +; +; ... and then the same for left/right extend also. See below for loop +; function implementations. Fast are fixed-width, slow is variable-width + +%macro EMU_EDGE_FUNC 1 +%ifdef ARCH_X86_64 +%define w_reg r10 +cglobal emu_edge_core_%1, 6, 7, 1 + mov r11, r5 ; save block_h +%else +%define w_reg r6 +cglobal emu_edge_core_%1, 2, 7, 0 + mov r4, r4m ; end_y + mov r5, r5m ; block_h +%endif + + ; start with vertical extend (top/bottom) and body pixel copy + mov w_reg, r7m + sub w_reg, r6m ; w = start_x - end_x + sub r5, r4 +%ifdef ARCH_X86_64 + sub r4, r3 +%else + sub r4, dword r3m +%endif + cmp w_reg, 22 + jg .slow_v_extend_loop +%ifdef ARCH_X86_32 + mov r2, r2m ; linesize +%endif + sal w_reg, 7 ; w * 128 +%ifdef PIC + lea rax, [.emuedge_v_extend_1 - (.emuedge_v_extend_2 - .emuedge_v_extend_1)] + add w_reg, rax +%else + lea w_reg, [.emuedge_v_extend_1 - (.emuedge_v_extend_2 - .emuedge_v_extend_1)+w_reg] +%endif + call w_reg ; fast top extend, body copy and bottom extend +.v_extend_end: + + ; horizontal extend (left/right) + mov w_reg, r6m ; start_x + sub r0, w_reg +%ifdef ARCH_X86_64 + mov r3, r0 ; backup of buf+block_h*linesize + mov r5, r11 +%else + mov r0m, r0 ; backup of buf+block_h*linesize + mov r5, r5m +%endif + test w_reg, w_reg + jz .right_extend + cmp w_reg, 22 + jg .slow_left_extend_loop + mov r1, w_reg + dec w_reg + ; FIXME we can do a if size == 1 here if that makes any speed difference, test me + sar w_reg, 1 + sal w_reg, 6 + ; r0=buf+block_h*linesize,r10(64)/r6(32)=start_x offset for funcs + ; r6(rax)/r3(ebx)=val,r2=linesize,r1=start_x,r5=block_h +%ifdef PIC + lea rax, [.emuedge_extend_left_2] + add w_reg, rax +%else + lea w_reg, [.emuedge_extend_left_2+w_reg] +%endif + call w_reg + + ; now r3(64)/r0(32)=buf,r2=linesize,r11/r5=block_h,r6/r3=val, r10/r6=end_x, r1=block_w +.right_extend: +%ifdef ARCH_X86_32 + mov r0, r0m + mov r5, r5m +%endif + mov w_reg, r7m ; end_x + mov r1, r8m ; block_w + mov r4, r1 + sub r1, w_reg + jz .h_extend_end ; if (end_x == block_w) goto h_extend_end + cmp r1, 22 + jg .slow_right_extend_loop + dec r1 + ; FIXME we can do a if size == 1 here if that makes any speed difference, test me + sar r1, 1 + sal r1, 6 +%ifdef PIC + lea rax, [.emuedge_extend_right_2] + add r1, rax +%else + lea r1, [.emuedge_extend_right_2+r1] +%endif + call r1 +.h_extend_end: + RET + +%ifdef ARCH_X86_64 +%define vall al +%define valh ah +%define valw ax +%define valw2 r10w +%define valw3 r3w +%ifdef WIN64 +%define valw4 r4w +%else ; unix64 +%define valw4 r3w +%endif +%define vald eax +%else +%define vall bl +%define valh bh +%define valw bx +%define valw2 r6w +%define valw3 valw2 +%define valw4 valw3 +%define vald ebx +%define stack_offset 0x14 +%endif + +%endmacro + +; macro to read/write a horizontal number of pixels (%2) to/from registers +; on x86-64, - fills xmm0-15 for consecutive sets of 16 pixels +; - if (%2 & 15 == 8) fills the last 8 bytes into rax +; - else if (%2 & 8) fills 8 bytes into mm0 +; - if (%2 & 7 == 4) fills the last 4 bytes into rax +; - else if (%2 & 4) fills 4 bytes into mm0-1 +; - if (%2 & 3 == 3) fills 2 bytes into r10/r3, and 1 into eax +; (note that we're using r3 for body/bottom because it's a shorter +; opcode, and then the loop fits in 128 bytes) +; - else fills remaining bytes into rax +; on x86-32, - fills mm0-7 for consecutive sets of 8 pixels +; - if (%2 & 7 == 4) fills 4 bytes into ebx +; - else if (%2 & 4) fills 4 bytes into mm0-7 +; - if (%2 & 3 == 3) fills 2 bytes into r6, and 1 into ebx +; - else fills remaining bytes into ebx +; writing data out is in the same way +%macro READ_NUM_BYTES 3 +%assign %%src_off 0 ; offset in source buffer +%assign %%smidx 0 ; mmx register idx +%assign %%sxidx 0 ; xmm register idx + +%ifnidn %3, mmx +%rep %2/16 + movdqu xmm %+ %%sxidx, [r1+%%src_off] +%assign %%src_off %%src_off+16 +%assign %%sxidx %%sxidx+1 +%endrep ; %2/16 +%endif ; !mmx + +%ifdef ARCH_X86_64 +%if (%2-%%src_off) == 8 + mov rax, [r1+%%src_off] +%assign %%src_off %%src_off+8 +%endif ; (%2-%%src_off) == 8 +%endif ; x86-64 + +%rep (%2-%%src_off)/8 + movq mm %+ %%smidx, [r1+%%src_off] +%assign %%src_off %%src_off+8 +%assign %%smidx %%smidx+1 +%endrep ; (%2-%%dst_off)/8 + +%if (%2-%%src_off) == 4 + mov vald, [r1+%%src_off] +%elif (%2-%%src_off) & 4 + movd mm %+ %%smidx, [r1+%%src_off] +%assign %%src_off %%src_off+4 +%endif ; (%2-%%src_off) ==/& 4 + +%if (%2-%%src_off) == 1 + mov vall, [r1+%%src_off] +%elif (%2-%%src_off) == 2 + mov valw, [r1+%%src_off] +%elif (%2-%%src_off) == 3 +%ifidn %1, top + mov valw2, [r1+%%src_off] +%elifidn %1, body + mov valw3, [r1+%%src_off] +%elifidn %1, bottom + mov valw4, [r1+%%src_off] +%endif ; %1 ==/!= top + mov vall, [r1+%%src_off+2] +%endif ; (%2-%%src_off) == 1/2/3 +%endmacro ; READ_NUM_BYTES + +%macro WRITE_NUM_BYTES 3 +%assign %%dst_off 0 ; offset in destination buffer +%assign %%dmidx 0 ; mmx register idx +%assign %%dxidx 0 ; xmm register idx + +%ifnidn %3, mmx +%rep %2/16 + movdqu [r0+%%dst_off], xmm %+ %%dxidx +%assign %%dst_off %%dst_off+16 +%assign %%dxidx %%dxidx+1 +%endrep ; %2/16 +%endif + +%ifdef ARCH_X86_64 +%if (%2-%%dst_off) == 8 + mov [r0+%%dst_off], rax +%assign %%dst_off %%dst_off+8 +%endif ; (%2-%%dst_off) == 8 +%endif ; x86-64 + +%rep (%2-%%dst_off)/8 + movq [r0+%%dst_off], mm %+ %%dmidx +%assign %%dst_off %%dst_off+8 +%assign %%dmidx %%dmidx+1 +%endrep ; (%2-%%dst_off)/8 + +%if (%2-%%dst_off) == 4 + mov [r0+%%dst_off], vald +%elif (%2-%%dst_off) & 4 + movd [r0+%%dst_off], mm %+ %%dmidx +%assign %%dst_off %%dst_off+4 +%endif ; (%2-%%dst_off) ==/& 4 + +%if (%2-%%dst_off) == 1 + mov [r0+%%dst_off], vall +%elif (%2-%%dst_off) == 2 + mov [r0+%%dst_off], valw +%elif (%2-%%dst_off) == 3 +%ifidn %1, top + mov [r0+%%dst_off], valw2 +%elifidn %1, body + mov [r0+%%dst_off], valw3 +%elifidn %1, bottom + mov [r0+%%dst_off], valw4 +%endif ; %1 ==/!= top + mov [r0+%%dst_off+2], vall +%endif ; (%2-%%dst_off) == 1/2/3 +%endmacro ; WRITE_NUM_BYTES + +; vertical top/bottom extend and body copy fast loops +; these are function pointers to set-width line copy functions, i.e. +; they read a fixed number of pixels into set registers, and write +; those out into the destination buffer +; r0=buf,r1=src,r2=linesize,r3(64)/r3m(32)=start_x,r4=end_y,r5=block_h +; r6(eax/64)/r3(ebx/32)=val_reg +%macro VERTICAL_EXTEND 1 +%assign %%n 1 +%rep 22 +ALIGN 128 +.emuedge_v_extend_ %+ %%n: + ; extend pixels above body +%ifdef ARCH_X86_64 + test r3 , r3 ; if (!start_y) + jz .emuedge_copy_body_ %+ %%n %+ _loop ; goto body +%else ; ARCH_X86_32 + cmp dword r3m, 0 + je .emuedge_copy_body_ %+ %%n %+ _loop +%endif ; ARCH_X86_64/32 + READ_NUM_BYTES top, %%n, %1 ; read bytes +.emuedge_extend_top_ %+ %%n %+ _loop: ; do { + WRITE_NUM_BYTES top, %%n, %1 ; write bytes + add r0 , r2 ; dst += linesize +%ifdef ARCH_X86_64 + dec r3d +%else ; ARCH_X86_32 + dec dword r3m +%endif ; ARCH_X86_64/32 + jnz .emuedge_extend_top_ %+ %%n %+ _loop ; } while (--start_y) + + ; copy body pixels +.emuedge_copy_body_ %+ %%n %+ _loop: ; do { + READ_NUM_BYTES body, %%n, %1 ; read bytes + WRITE_NUM_BYTES body, %%n, %1 ; write bytes + add r0 , r2 ; dst += linesize + add r1 , r2 ; src += linesize + dec r4d + jnz .emuedge_copy_body_ %+ %%n %+ _loop ; } while (--end_y) + + ; copy bottom pixels + test r5 , r5 ; if (!block_h) + jz .emuedge_v_extend_end_ %+ %%n ; goto end + sub r1 , r2 ; src -= linesize + READ_NUM_BYTES bottom, %%n, %1 ; read bytes +.emuedge_extend_bottom_ %+ %%n %+ _loop: ; do { + WRITE_NUM_BYTES bottom, %%n, %1 ; write bytes + add r0 , r2 ; dst += linesize + dec r5d + jnz .emuedge_extend_bottom_ %+ %%n %+ _loop ; } while (--block_h) + +.emuedge_v_extend_end_ %+ %%n: +%ifdef ARCH_X86_64 + ret +%else ; ARCH_X86_32 + rep ret +%endif ; ARCH_X86_64/32 +%assign %%n %%n+1 +%endrep +%endmacro VERTICAL_EXTEND + +; left/right (horizontal) fast extend functions +; these are essentially identical to the vertical extend ones above, +; just left/right separated because number of pixels to extend is +; obviously not the same on both sides. +; for reading, pixels are placed in eax (x86-64) or ebx (x86-64) in the +; lowest two bytes of the register (so val*0x0101), and are splatted +; into each byte of mm0 as well if n_pixels >= 8 + +%macro READ_V_PIXEL 3 + mov vall, %2 + mov valh, vall +%if %1 >= 8 + movd mm0, vald +%ifidn %3, mmx + punpcklwd mm0, mm0 + punpckldq mm0, mm0 +%else ; !mmx + pshufw mm0, mm0, 0 +%endif ; mmx +%endif ; %1 >= 8 +%endmacro + +%macro WRITE_V_PIXEL 2 +%assign %%dst_off 0 +%rep %1/8 + movq [%2+%%dst_off], mm0 +%assign %%dst_off %%dst_off+8 +%endrep +%if %1 & 4 +%if %1 >= 8 + movd [%2+%%dst_off], mm0 +%else ; %1 < 8 + mov [%2+%%dst_off] , valw + mov [%2+%%dst_off+2], valw +%endif ; %1 >=/< 8 +%assign %%dst_off %%dst_off+4 +%endif ; %1 & 4 +%if %1&2 + mov [%2+%%dst_off], valw +%endif ; %1 & 2 +%endmacro + +; r0=buf+block_h*linesize, r1=start_x, r2=linesize, r5=block_h, r6/r3=val +%macro LEFT_EXTEND 1 +%assign %%n 2 +%rep 11 +ALIGN 64 +.emuedge_extend_left_ %+ %%n: ; do { + sub r0, r2 ; dst -= linesize + READ_V_PIXEL %%n, [r0+r1], %1 ; read pixels + WRITE_V_PIXEL %%n, r0 ; write pixels + dec r5 + jnz .emuedge_extend_left_ %+ %%n ; } while (--block_h) +%ifdef ARCH_X86_64 + ret +%else ; ARCH_X86_32 + rep ret +%endif ; ARCH_X86_64/32 +%assign %%n %%n+2 +%endrep +%endmacro ; LEFT_EXTEND + +; r3/r0=buf+block_h*linesize, r2=linesize, r11/r5=block_h, r0/r6=end_x, r6/r3=val +%macro RIGHT_EXTEND 1 +%assign %%n 2 +%rep 11 +ALIGN 64 +.emuedge_extend_right_ %+ %%n: ; do { +%ifdef ARCH_X86_64 + sub r3, r2 ; dst -= linesize + READ_V_PIXEL %%n, [r3+w_reg-1], %1 ; read pixels + WRITE_V_PIXEL %%n, r3+r4-%%n ; write pixels + dec r11 +%else ; ARCH_X86_32 + sub r0, r2 ; dst -= linesize + READ_V_PIXEL %%n, [r0+w_reg-1], %1 ; read pixels + WRITE_V_PIXEL %%n, r0+r4-%%n ; write pixels + dec r5 +%endif ; ARCH_X86_64/32 + jnz .emuedge_extend_right_ %+ %%n ; } while (--block_h) +%ifdef ARCH_X86_64 + ret +%else ; ARCH_X86_32 + rep ret +%endif ; ARCH_X86_64/32 +%assign %%n %%n+2 +%endrep + +%ifdef ARCH_X86_32 +%define stack_offset 0x10 +%endif +%endmacro ; RIGHT_EXTEND + +; below follow the "slow" copy/extend functions, these act on a non-fixed +; width specified in a register, and run a loop to copy the full amount +; of bytes. They are optimized for copying of large amounts of pixels per +; line, so they unconditionally splat data into mm registers to copy 8 +; bytes per loop iteration. It could be considered to use xmm for x86-64 +; also, but I haven't optimized this as much (i.e. FIXME) +%macro V_COPY_NPX 4-5 +%if %0 == 4 + test w_reg, %4 + jz .%1_skip_%4_px +%else ; %0 == 5 +.%1_%4_px_loop: +%endif + %3 %2, [r1+cnt_reg] + %3 [r0+cnt_reg], %2 + add cnt_reg, %4 +%if %0 == 5 + sub w_reg, %4 + test w_reg, %5 + jnz .%1_%4_px_loop +%endif +.%1_skip_%4_px: +%endmacro + +%macro V_COPY_ROW 3 +%ifidn %1, bottom + sub r1, linesize +%endif +.%1_copy_loop: + xor cnt_reg, cnt_reg +%ifidn %3, mmx +%define linesize r2m + V_COPY_NPX %1, mm0, movq, 8, 0xFFFFFFF8 +%else ; !mmx + V_COPY_NPX %1, xmm0, movdqu, 16, 0xFFFFFFF0 +%ifdef ARCH_X86_64 +%define linesize r2 + V_COPY_NPX %1, rax , mov, 8 +%else ; ARCH_X86_32 +%define linesize r2m + V_COPY_NPX %1, mm0, movq, 8 +%endif ; ARCH_X86_64/32 +%endif ; mmx + V_COPY_NPX %1, vald, mov, 4 + V_COPY_NPX %1, valw, mov, 2 + V_COPY_NPX %1, vall, mov, 1 + mov w_reg, cnt_reg +%ifidn %1, body + add r1, linesize +%endif + add r0, linesize + dec %2 + jnz .%1_copy_loop +%endmacro + +%macro SLOW_V_EXTEND 1 +.slow_v_extend_loop: +; r0=buf,r1=src,r2(64)/r2m(32)=linesize,r3(64)/r3m(32)=start_x,r4=end_y,r5=block_h +; r11(64)/r3(later-64)/r2(32)=cnt_reg,r6(64)/r3(32)=val_reg,r10(64)/r6(32)=w=end_x-start_x +%ifdef ARCH_X86_64 + push r11 ; save old value of block_h + test r3, r3 +%define cnt_reg r11 + jz .do_body_copy ; if (!start_y) goto do_body_copy + V_COPY_ROW top, r3, %1 +%else + cmp dword r3m, 0 +%define cnt_reg r2 + je .do_body_copy ; if (!start_y) goto do_body_copy + V_COPY_ROW top, dword r3m, %1 +%endif + +.do_body_copy: + V_COPY_ROW body, r4, %1 + +%ifdef ARCH_X86_64 + pop r11 ; restore old value of block_h +%define cnt_reg r3 +%endif + test r5, r5 +%ifdef ARCH_X86_64 + jz .v_extend_end +%else + jz .skip_bottom_extend +%endif + V_COPY_ROW bottom, r5, %1 +%ifdef ARCH_X86_32 +.skip_bottom_extend: + mov r2, r2m +%endif + jmp .v_extend_end +%endmacro + +%macro SLOW_LEFT_EXTEND 1 +.slow_left_extend_loop: +; r0=buf+block_h*linesize,r2=linesize,r6(64)/r3(32)=val,r5=block_h,r4=cntr,r10/r6=start_x + mov r4, 8 + sub r0, linesize + READ_V_PIXEL 8, [r0+w_reg], %1 +.left_extend_8px_loop: + movq [r0+r4-8], mm0 + add r4, 8 + cmp r4, w_reg + jle .left_extend_8px_loop + sub r4, 8 + cmp r4, w_reg + jge .left_extend_loop_end +.left_extend_2px_loop: + mov [r0+r4], valw + add r4, 2 + cmp r4, w_reg + jl .left_extend_2px_loop +.left_extend_loop_end: + dec r5 + jnz .slow_left_extend_loop +%ifdef ARCH_X86_32 + mov r2, r2m +%endif + jmp .right_extend +%endmacro + +%macro SLOW_RIGHT_EXTEND 1 +.slow_right_extend_loop: +; r3(64)/r0(32)=buf+block_h*linesize,r2=linesize,r4=block_w,r11(64)/r5(32)=block_h, +; r10(64)/r6(32)=end_x,r6/r3=val,r1=cntr +%ifdef ARCH_X86_64 +%define buf_reg r3 +%define bh_reg r11 +%else +%define buf_reg r0 +%define bh_reg r5 +%endif + lea r1, [r4-8] + sub buf_reg, linesize + READ_V_PIXEL 8, [buf_reg+w_reg-1], %1 +.right_extend_8px_loop: + movq [buf_reg+r1], mm0 + sub r1, 8 + cmp r1, w_reg + jge .right_extend_8px_loop + add r1, 8 + cmp r1, w_reg + je .right_extend_loop_end +.right_extend_2px_loop: + sub r1, 2 + mov [buf_reg+r1], valw + cmp r1, w_reg + jg .right_extend_2px_loop +.right_extend_loop_end: + dec bh_reg + jnz .slow_right_extend_loop + jmp .h_extend_end +%endmacro + +%macro emu_edge 1 +EMU_EDGE_FUNC %1 +VERTICAL_EXTEND %1 +LEFT_EXTEND %1 +RIGHT_EXTEND %1 +SLOW_V_EXTEND %1 +SLOW_LEFT_EXTEND %1 +SLOW_RIGHT_EXTEND %1 +%endmacro + +emu_edge sse +%ifdef ARCH_X86_32 +emu_edge mmx +%endif diff --git a/mplayer/ffmpeg/libavcodec/x86/fft.c b/mplayer/ffmpeg/libavcodec/x86/fft.c index 771b1e66..5ca341d5 100644 --- a/mplayer/ffmpeg/libavcodec/x86/fft.c +++ b/mplayer/ffmpeg/libavcodec/x86/fft.c @@ -30,6 +30,7 @@ av_cold void ff_fft_init_mmx(FFTContext *s) s->imdct_half = ff_imdct_half_sse; s->fft_permute = ff_fft_permute_sse; s->fft_calc = ff_fft_calc_sse; + s->fft_permutation = FF_FFT_PERM_SWAP_LSBS; } else if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) { /* 3DNowEx for K7 */ s->imdct_calc = ff_imdct_calc_3dn2; diff --git a/mplayer/ffmpeg/libavcodec/x86/fft_mmx.asm b/mplayer/ffmpeg/libavcodec/x86/fft_mmx.asm index 1dcd6291..68e20df3 100644 --- a/mplayer/ffmpeg/libavcodec/x86/fft_mmx.asm +++ b/mplayer/ffmpeg/libavcodec/x86/fft_mmx.asm @@ -51,6 +51,7 @@ SECTION_RODATA %define M_SQRT1_2 0.70710678118654752440 ps_root2: times 4 dd M_SQRT1_2 ps_root2mppm: dd -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2 +ps_p1p1m1p1: dd 0, 0, 1<<31, 0 ps_m1p1: dd 1<<31, 0 %assign i 16 @@ -95,54 +96,51 @@ section .text align=16 SWAP %3, %6 %endmacro -; in: %1={r0,i0,r1,i1} %2={r2,i2,r3,i3} +; in: %1={r0,i0,r2,i2} %2={r1,i1,r3,i3} ; out: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3} %macro T4_SSE 3 mova %3, %1 - shufps %1, %2, 0x64 ; {r0,i0,r3,i2} - shufps %3, %2, 0xce ; {r1,i1,r2,i3} + addps %1, %2 ; {t1,t2,t6,t5} + subps %3, %2 ; {t3,t4,-t8,t7} + xorps %3, [ps_p1p1m1p1] mova %2, %1 - addps %1, %3 ; {t1,t2,t6,t5} - subps %2, %3 ; {t3,t4,t8,t7} + shufps %1, %3, 0x44 ; {t1,t2,t3,t4} + shufps %2, %3, 0xbe ; {t6,t5,t7,t8} mova %3, %1 - shufps %1, %2, 0x44 ; {t1,t2,t3,t4} - shufps %3, %2, 0xbe ; {t6,t5,t7,t8} + addps %1, %2 ; {r0,i0,r1,i1} + subps %3, %2 ; {r2,i2,r3,i3} mova %2, %1 - addps %1, %3 ; {r0,i0,r1,i1} - subps %2, %3 ; {r2,i2,r3,i3} - mova %3, %1 - shufps %1, %2, 0x88 ; {r0,r1,r2,r3} - shufps %3, %2, 0xdd ; {i0,i1,i2,i3} - SWAP %2, %3 + shufps %1, %3, 0x88 ; {r0,r1,r2,r3} + shufps %2, %3, 0xdd ; {i0,i1,i2,i3} %endmacro -%macro T8_SSE 6 ; r0,i0,r1,i1,t0,t1 - mova %5, %3 - shufps %3, %4, 0x44 ; {r4,i4,r6,i6} - shufps %5, %4, 0xee ; {r5,i5,r7,i7} +; in: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3} %3={r4,i4,r6,i6} %4={r5,i5,r7,i7} +; out: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3} %1={r4,r5,r6,r7} %2={i4,i5,i6,i7} +%macro T8_SSE 6 mova %6, %3 - subps %3, %5 ; {r5,i5,r7,i7} - addps %6, %5 ; {t1,t2,t3,t4} - mova %5, %3 - shufps %5, %5, 0xb1 ; {i5,r5,i7,r7} + subps %3, %4 ; {r5,i5,r7,i7} + addps %6, %4 ; {t1,t2,t3,t4} + mova %4, %3 + shufps %4, %4, 0xb1 ; {i5,r5,i7,r7} mulps %3, [ps_root2mppm] ; {-r5,i5,r7,-i7} - mulps %5, [ps_root2] - addps %3, %5 ; {t8,t7,ta,t9} - mova %5, %6 + mulps %4, [ps_root2] + addps %3, %4 ; {t8,t7,ta,t9} + mova %4, %6 shufps %6, %3, 0x36 ; {t3,t2,t9,t8} - shufps %5, %3, 0x9c ; {t1,t4,t7,ta} + shufps %4, %3, 0x9c ; {t1,t4,t7,ta} mova %3, %6 - addps %6, %5 ; {t1,t2,t9,ta} - subps %3, %5 ; {t6,t5,tc,tb} - mova %5, %6 + addps %6, %4 ; {t1,t2,t9,ta} + subps %3, %4 ; {t6,t5,tc,tb} + mova %4, %6 shufps %6, %3, 0xd8 ; {t1,t9,t5,tb} - shufps %5, %3, 0x8d ; {t2,ta,t6,tc} + shufps %4, %3, 0x8d ; {t2,ta,t6,tc} mova %3, %1 - mova %4, %2 + mova %5, %2 addps %1, %6 ; {r0,r1,r2,r3} - addps %2, %5 ; {i0,i1,i2,i3} + addps %2, %4 ; {i0,i1,i2,i3} subps %3, %6 ; {r4,r5,r6,r7} - subps %4, %5 ; {i4,i5,i6,i7} + subps %5, %4 ; {i4,i5,i6,i7} + SWAP %4, %5 %endmacro ; scheduled for cpu-bound sizes diff --git a/mplayer/ffmpeg/libavcodec/x86/fft_sse.c b/mplayer/ffmpeg/libavcodec/x86/fft_sse.c index 9f02816d..0d151bc4 100644 --- a/mplayer/ffmpeg/libavcodec/x86/fft_sse.c +++ b/mplayer/ffmpeg/libavcodec/x86/fft_sse.c @@ -23,7 +23,7 @@ #include "libavcodec/dsputil.h" #include "fft.h" -DECLARE_ALIGNED(16, static const int, m1m1m1m1)[4] = +DECLARE_ASM_CONST(16, int, ff_m1m1m1m1)[4] = { 1 << 31, 1 << 31, 1 << 31, 1 << 31 }; void ff_fft_dispatch_sse(FFTComplex *z, int nbits); @@ -82,7 +82,7 @@ void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input) j = -n; k = n-16; __asm__ volatile( - "movaps %4, %%xmm7 \n" + "movaps "MANGLE(ff_m1m1m1m1)", %%xmm7 \n" "1: \n" "movaps (%2,%1), %%xmm0 \n" "movaps (%3,%0), %%xmm1 \n" @@ -95,8 +95,7 @@ void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input) "add $16, %0 \n" "jl 1b \n" :"+r"(j), "+r"(k) - :"r"(output+n4), "r"(output+n4*3), - "m"(*m1m1m1m1) + :"r"(output+n4), "r"(output+n4*3) XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm7") ); } diff --git a/mplayer/ffmpeg/libavcodec/x86/fmtconvert.asm b/mplayer/ffmpeg/libavcodec/x86/fmtconvert.asm new file mode 100644 index 00000000..6c744fc5 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/x86/fmtconvert.asm @@ -0,0 +1,91 @@ +;****************************************************************************** +;* x86 optimized Format Conversion Utils +;* Copyright (c) 2008 Loren Merritt +;* +;* This file is part of FFmpeg. +;* +;* FFmpeg is free software; you can redistribute it and/or +;* modify it under the terms of the GNU Lesser General Public +;* License as published by the Free Software Foundation; either +;* version 2.1 of the License, or (at your option) any later version. +;* +;* FFmpeg 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 +;* Lesser General Public License for more details. +;* +;* You should have received a copy of the GNU Lesser General Public +;* License along with FFmpeg; if not, write to the Free Software +;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;****************************************************************************** + +%include "x86inc.asm" + +section .text align=16 + +%macro PSWAPD_SSE 2 + pshufw %1, %2, 0x4e +%endmacro +%macro PSWAPD_3DN1 2 + movq %1, %2 + psrlq %1, 32 + punpckldq %1, %2 +%endmacro + +%macro FLOAT_TO_INT16_INTERLEAVE6 1 +; void float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len) +cglobal float_to_int16_interleave6_%1, 2,7,0, dst, src, src1, src2, src3, src4, src5 +%ifdef ARCH_X86_64 + %define lend r10d + mov lend, r2d +%else + %define lend dword r2m +%endif + mov src1q, [srcq+1*gprsize] + mov src2q, [srcq+2*gprsize] + mov src3q, [srcq+3*gprsize] + mov src4q, [srcq+4*gprsize] + mov src5q, [srcq+5*gprsize] + mov srcq, [srcq] + sub src1q, srcq + sub src2q, srcq + sub src3q, srcq + sub src4q, srcq + sub src5q, srcq +.loop: + cvtps2pi mm0, [srcq] + cvtps2pi mm1, [srcq+src1q] + cvtps2pi mm2, [srcq+src2q] + cvtps2pi mm3, [srcq+src3q] + cvtps2pi mm4, [srcq+src4q] + cvtps2pi mm5, [srcq+src5q] + packssdw mm0, mm3 + packssdw mm1, mm4 + packssdw mm2, mm5 + pswapd mm3, mm0 + punpcklwd mm0, mm1 + punpckhwd mm1, mm2 + punpcklwd mm2, mm3 + pswapd mm3, mm0 + punpckldq mm0, mm2 + punpckhdq mm2, mm1 + punpckldq mm1, mm3 + movq [dstq ], mm0 + movq [dstq+16], mm2 + movq [dstq+ 8], mm1 + add srcq, 8 + add dstq, 24 + sub lend, 2 + jg .loop + emms + RET +%endmacro ; FLOAT_TO_INT16_INTERLEAVE6 + +%define pswapd PSWAPD_SSE +FLOAT_TO_INT16_INTERLEAVE6 sse +%define cvtps2pi pf2id +%define pswapd PSWAPD_3DN1 +FLOAT_TO_INT16_INTERLEAVE6 3dnow +%undef pswapd +FLOAT_TO_INT16_INTERLEAVE6 3dn2 +%undef cvtps2pi diff --git a/mplayer/ffmpeg/libavcodec/x86/fmtconvert_mmx.c b/mplayer/ffmpeg/libavcodec/x86/fmtconvert_mmx.c new file mode 100644 index 00000000..ea41f730 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/x86/fmtconvert_mmx.c @@ -0,0 +1,266 @@ +/* + * Format Conversion Utils + * Copyright (c) 2000, 2001 Fabrice Bellard + * Copyright (c) 2002-2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * MMX optimization by Nick Kurshev + */ + +#include "libavutil/cpu.h" +#include "libavutil/x86_cpu.h" +#include "libavcodec/fmtconvert.h" + +static void int32_to_float_fmul_scalar_sse(float *dst, const int *src, float mul, int len) +{ + x86_reg i = -4*len; + __asm__ volatile( + "movss %3, %%xmm4 \n" + "shufps $0, %%xmm4, %%xmm4 \n" + "1: \n" + "cvtpi2ps (%2,%0), %%xmm0 \n" + "cvtpi2ps 8(%2,%0), %%xmm1 \n" + "cvtpi2ps 16(%2,%0), %%xmm2 \n" + "cvtpi2ps 24(%2,%0), %%xmm3 \n" + "movlhps %%xmm1, %%xmm0 \n" + "movlhps %%xmm3, %%xmm2 \n" + "mulps %%xmm4, %%xmm0 \n" + "mulps %%xmm4, %%xmm2 \n" + "movaps %%xmm0, (%1,%0) \n" + "movaps %%xmm2, 16(%1,%0) \n" + "add $32, %0 \n" + "jl 1b \n" + :"+r"(i) + :"r"(dst+len), "r"(src+len), "m"(mul) + ); +} + +static void int32_to_float_fmul_scalar_sse2(float *dst, const int *src, float mul, int len) +{ + x86_reg i = -4*len; + __asm__ volatile( + "movss %3, %%xmm4 \n" + "shufps $0, %%xmm4, %%xmm4 \n" + "1: \n" + "cvtdq2ps (%2,%0), %%xmm0 \n" + "cvtdq2ps 16(%2,%0), %%xmm1 \n" + "mulps %%xmm4, %%xmm0 \n" + "mulps %%xmm4, %%xmm1 \n" + "movaps %%xmm0, (%1,%0) \n" + "movaps %%xmm1, 16(%1,%0) \n" + "add $32, %0 \n" + "jl 1b \n" + :"+r"(i) + :"r"(dst+len), "r"(src+len), "m"(mul) + ); +} + +static void float_to_int16_3dnow(int16_t *dst, const float *src, long len){ + x86_reg reglen = len; + // not bit-exact: pf2id uses different rounding than C and SSE + __asm__ volatile( + "add %0 , %0 \n\t" + "lea (%2,%0,2) , %2 \n\t" + "add %0 , %1 \n\t" + "neg %0 \n\t" + "1: \n\t" + "pf2id (%2,%0,2) , %%mm0 \n\t" + "pf2id 8(%2,%0,2) , %%mm1 \n\t" + "pf2id 16(%2,%0,2) , %%mm2 \n\t" + "pf2id 24(%2,%0,2) , %%mm3 \n\t" + "packssdw %%mm1 , %%mm0 \n\t" + "packssdw %%mm3 , %%mm2 \n\t" + "movq %%mm0 , (%1,%0) \n\t" + "movq %%mm2 , 8(%1,%0) \n\t" + "add $16 , %0 \n\t" + " js 1b \n\t" + "femms \n\t" + :"+r"(reglen), "+r"(dst), "+r"(src) + ); +} + +static void float_to_int16_sse(int16_t *dst, const float *src, long len){ + x86_reg reglen = len; + __asm__ volatile( + "add %0 , %0 \n\t" + "lea (%2,%0,2) , %2 \n\t" + "add %0 , %1 \n\t" + "neg %0 \n\t" + "1: \n\t" + "cvtps2pi (%2,%0,2) , %%mm0 \n\t" + "cvtps2pi 8(%2,%0,2) , %%mm1 \n\t" + "cvtps2pi 16(%2,%0,2) , %%mm2 \n\t" + "cvtps2pi 24(%2,%0,2) , %%mm3 \n\t" + "packssdw %%mm1 , %%mm0 \n\t" + "packssdw %%mm3 , %%mm2 \n\t" + "movq %%mm0 , (%1,%0) \n\t" + "movq %%mm2 , 8(%1,%0) \n\t" + "add $16 , %0 \n\t" + " js 1b \n\t" + "emms \n\t" + :"+r"(reglen), "+r"(dst), "+r"(src) + ); +} + +static void float_to_int16_sse2(int16_t *dst, const float *src, long len){ + x86_reg reglen = len; + __asm__ volatile( + "add %0 , %0 \n\t" + "lea (%2,%0,2) , %2 \n\t" + "add %0 , %1 \n\t" + "neg %0 \n\t" + "1: \n\t" + "cvtps2dq (%2,%0,2) , %%xmm0 \n\t" + "cvtps2dq 16(%2,%0,2) , %%xmm1 \n\t" + "packssdw %%xmm1 , %%xmm0 \n\t" + "movdqa %%xmm0 , (%1,%0) \n\t" + "add $16 , %0 \n\t" + " js 1b \n\t" + :"+r"(reglen), "+r"(dst), "+r"(src) + ); +} + +void ff_float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len); +void ff_float_to_int16_interleave6_3dnow(int16_t *dst, const float **src, int len); +void ff_float_to_int16_interleave6_3dn2(int16_t *dst, const float **src, int len); + +#if !HAVE_YASM +#define ff_float_to_int16_interleave6_sse(a,b,c) float_to_int16_interleave_misc_sse(a,b,c,6) +#define ff_float_to_int16_interleave6_3dnow(a,b,c) float_to_int16_interleave_misc_3dnow(a,b,c,6) +#define ff_float_to_int16_interleave6_3dn2(a,b,c) float_to_int16_interleave_misc_3dnow(a,b,c,6) +#endif +#define ff_float_to_int16_interleave6_sse2 ff_float_to_int16_interleave6_sse + +#define FLOAT_TO_INT16_INTERLEAVE(cpu, body) \ +/* gcc pessimizes register allocation if this is in the same function as float_to_int16_interleave_sse2*/\ +static av_noinline void float_to_int16_interleave_misc_##cpu(int16_t *dst, const float **src, long len, int channels){\ + DECLARE_ALIGNED(16, int16_t, tmp)[len];\ + int i,j,c;\ + for(c=0; cflags & CODEC_FLAG_BITEXACT)){ + c->float_to_int16 = float_to_int16_3dnow; + c->float_to_int16_interleave = float_to_int16_interleave_3dnow; + } + } + if(mm_flags & AV_CPU_FLAG_3DNOWEXT){ + if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ + c->float_to_int16_interleave = float_to_int16_interleave_3dn2; + } + } + if(mm_flags & AV_CPU_FLAG_SSE){ + c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse; + c->float_to_int16 = float_to_int16_sse; + c->float_to_int16_interleave = float_to_int16_interleave_sse; + } + if(mm_flags & AV_CPU_FLAG_SSE2){ + c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse2; + c->float_to_int16 = float_to_int16_sse2; + c->float_to_int16_interleave = float_to_int16_interleave_sse2; + } + } +} diff --git a/mplayer/ffmpeg/libavcodec/x86/vc1dsp_mmx.c b/mplayer/ffmpeg/libavcodec/x86/vc1dsp_mmx.c index 04b4abaa..a525aeee 100644 --- a/mplayer/ffmpeg/libavcodec/x86/vc1dsp_mmx.c +++ b/mplayer/ffmpeg/libavcodec/x86/vc1dsp_mmx.c @@ -28,6 +28,7 @@ #include "libavutil/x86_cpu.h" #include "libavcodec/dsputil.h" #include "dsputil_mmx.h" +#include "libavcodec/vc1dsp.h" #define OP_PUT(S,D) #define OP_AVG(S,D) "pavgb " #S ", " #D " \n\t" @@ -712,30 +713,45 @@ static void vc1_h_loop_filter16_sse4(uint8_t *src, int stride, int pq) ff_vc1_h_loop_filter8_sse4(src, stride, pq); ff_vc1_h_loop_filter8_sse4(src+8*stride, stride, pq); } + #endif -void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) { +void ff_put_vc1_chroma_mc8_mmx_nornd (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_vc1_chroma_mc8_mmx2_nornd (uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_vc1_chroma_mc8_3dnow_nornd(uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_put_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); +void ff_avg_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst, uint8_t *src, + int stride, int h, int x, int y); + +void ff_vc1dsp_init_mmx(VC1DSPContext *dsp) +{ int mm_flags = av_get_cpu_flags(); - dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_mmx; - dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx; - dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx; - dsp->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_mmx; - - dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_mmx; - dsp->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_mmx; - dsp->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_mmx; - dsp->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_mmx; - - dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_mmx; - dsp->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_mmx; - dsp->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_mmx; - dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_mmx; - - dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_mmx; - dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx; - dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx; - dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx; + if (mm_flags & AV_CPU_FLAG_MMX) { + dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_mmx; + dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx; + dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx; + dsp->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_mmx; + + dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_mmx; + dsp->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_mmx; + dsp->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_mmx; + dsp->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_mmx; + + dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_mmx; + dsp->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_mmx; + dsp->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_mmx; + dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_mmx; + + dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_mmx; + dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx; + dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx; + dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx; + } if (mm_flags & AV_CPU_FLAG_MMX2){ dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_mmx2; @@ -775,11 +791,16 @@ void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) { #if HAVE_YASM if (mm_flags & AV_CPU_FLAG_MMX) { ASSIGN_LF(mmx); + dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_mmx_nornd; } return; if (mm_flags & AV_CPU_FLAG_MMX2) { ASSIGN_LF(mmx2); + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_mmx2_nornd; + } else if (mm_flags & AV_CPU_FLAG_3DNOW) { + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_3dnow_nornd; } + if (mm_flags & AV_CPU_FLAG_SSE2) { dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_sse2; dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse2; @@ -788,6 +809,8 @@ void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) { } if (mm_flags & AV_CPU_FLAG_SSSE3) { ASSIGN_LF(ssse3); + dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_ssse3_nornd; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_ssse3_nornd; } if (mm_flags & AV_CPU_FLAG_SSE4) { dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse4; diff --git a/mplayer/ffmpeg/libavcodec/x86/x86util.asm b/mplayer/ffmpeg/libavcodec/x86/x86util.asm index 7cabc70b..b28a6198 100644 --- a/mplayer/ffmpeg/libavcodec/x86/x86util.asm +++ b/mplayer/ffmpeg/libavcodec/x86/x86util.asm @@ -434,3 +434,13 @@ movh [%7], %3 movh [%7+%8], %4 %endmacro + +%macro PMINUB_MMX 3 ; dst, src, tmp + mova %3, %1 + psubusb %3, %2 + psubb %1, %3 +%endmacro + +%macro PMINUB_MMXEXT 3 ; dst, src, ignored + pminub %1, %2 +%endmacro diff --git a/mplayer/ffmpeg/libavcodec/xan.c b/mplayer/ffmpeg/libavcodec/xan.c index 0ae84a69..52033163 100644 --- a/mplayer/ffmpeg/libavcodec/xan.c +++ b/mplayer/ffmpeg/libavcodec/xan.c @@ -358,9 +358,6 @@ static void xan_wc3_decode_frame(XanContext *s) { } } -static void xan_wc4_decode_frame(XanContext *s) { -} - #if RUNTIME_GAMMA static inline unsigned mul(unsigned a, unsigned b) { @@ -515,23 +512,12 @@ static int xan_decode_frame(AVCodecContext *avctx, if (!s->frame_size) s->frame_size = s->current_frame.linesize[0] * s->avctx->height; - if (avctx->codec->id == CODEC_ID_XAN_WC3) { - memcpy(s->current_frame.data[1], s->palettes + s->cur_palette * AVPALETTE_COUNT, AVPALETTE_SIZE); - } else { - AVPaletteControl *palette_control = avctx->palctrl; - palette_control->palette_changed = 0; - memcpy(s->current_frame.data[1], palette_control->palette, - AVPALETTE_SIZE); - s->current_frame.palette_has_changed = 1; - } + memcpy(s->current_frame.data[1], s->palettes + s->cur_palette * AVPALETTE_COUNT, AVPALETTE_SIZE); s->buf = buf; s->size = buf_size; - if (avctx->codec->id == CODEC_ID_XAN_WC3) - xan_wc3_decode_frame(s); - else if (avctx->codec->id == CODEC_ID_XAN_WC4) - xan_wc4_decode_frame(s); + xan_wc3_decode_frame(s); /* release the last frame if it is allocated */ if (s->last_frame.data[0]) @@ -577,17 +563,3 @@ AVCodec ff_xan_wc3_decoder = { .long_name = NULL_IF_CONFIG_SMALL("Wing Commander III / Xan"), }; -/* -AVCodec ff_xan_wc4_decoder = { - "xan_wc4", - AVMEDIA_TYPE_VIDEO, - CODEC_ID_XAN_WC4, - sizeof(XanContext), - xan_decode_init, - NULL, - xan_decode_end, - xan_decode_frame, - CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"), -}; -*/ diff --git a/mplayer/ffmpeg/libavcodec/xsubdec.c b/mplayer/ffmpeg/libavcodec/xsubdec.c index 872b227d..d24588b8 100644 --- a/mplayer/ffmpeg/libavcodec/xsubdec.c +++ b/mplayer/ffmpeg/libavcodec/xsubdec.c @@ -18,7 +18,7 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "get_bits.h" #include "bytestream.h" diff --git a/mplayer/ffmpeg/libavcodec/xxan.c b/mplayer/ffmpeg/libavcodec/xxan.c new file mode 100644 index 00000000..10ec53f4 --- /dev/null +++ b/mplayer/ffmpeg/libavcodec/xxan.c @@ -0,0 +1,429 @@ +/* + * Wing Commander/Xan Video Decoder + * Copyright (C) 2011 Konstantin Shishkov + * based on work by Mike Melanson + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avcodec.h" +#include "libavutil/intreadwrite.h" +#include "bytestream.h" +#define ALT_BITSTREAM_READER_LE +#include "get_bits.h" +// for av_memcpy_backptr +#include "libavutil/lzo.h" + +typedef struct XanContext { + AVCodecContext *avctx; + AVFrame pic; + + uint8_t *y_buffer; + uint8_t *scratch_buffer; + int buffer_size; +} XanContext; + +static av_cold int xan_decode_init(AVCodecContext *avctx) +{ + XanContext *s = avctx->priv_data; + + s->avctx = avctx; + + avctx->pix_fmt = PIX_FMT_YUV420P; + + s->buffer_size = avctx->width * avctx->height; + s->y_buffer = av_malloc(s->buffer_size); + if (!s->y_buffer) + return AVERROR(ENOMEM); + s->scratch_buffer = av_malloc(s->buffer_size + 130); + if (!s->scratch_buffer) { + av_freep(&s->y_buffer); + return AVERROR(ENOMEM); + } + + return 0; +} + +static int xan_unpack_luma(const uint8_t *src, const int src_size, + uint8_t *dst, const int dst_size) +{ + int tree_size, eof; + const uint8_t *tree; + int bits, mask; + int tree_root, node; + const uint8_t *dst_end = dst + dst_size; + const uint8_t *src_end = src + src_size; + + tree_size = *src++; + eof = *src++; + tree = src - eof * 2 - 2; + tree_root = eof + tree_size; + src += tree_size * 2; + + node = tree_root; + bits = *src++; + mask = 0x80; + for (;;) { + int bit = !!(bits & mask); + mask >>= 1; + node = tree[node*2 + bit]; + if (node == eof) + break; + if (node < eof) { + *dst++ = node; + if (dst > dst_end) + break; + node = tree_root; + } + if (!mask) { + bits = *src++; + if (src > src_end) + break; + mask = 0x80; + } + } + return dst != dst_end; +} + +/* almost the same as in xan_wc3 decoder */ +static int xan_unpack(uint8_t *dest, const int dest_len, + const uint8_t *src, const int src_len) +{ + uint8_t opcode; + int size; + uint8_t *orig_dest = dest; + const uint8_t *src_end = src + src_len; + const uint8_t *dest_end = dest + dest_len; + + while (dest < dest_end) { + opcode = *src++; + + if (opcode < 0xe0) { + int size2, back; + if ((opcode & 0x80) == 0) { + size = opcode & 3; + back = ((opcode & 0x60) << 3) + *src++ + 1; + size2 = ((opcode & 0x1c) >> 2) + 3; + } else if ((opcode & 0x40) == 0) { + size = *src >> 6; + back = (bytestream_get_be16(&src) & 0x3fff) + 1; + size2 = (opcode & 0x3f) + 4; + } else { + size = opcode & 3; + back = ((opcode & 0x10) << 12) + bytestream_get_be16(&src) + 1; + size2 = ((opcode & 0x0c) << 6) + *src++ + 5; + if (size + size2 > dest_end - dest) + break; + } + if (src + size > src_end || dest + size + size2 > dest_end) + return -1; + bytestream_get_buffer(&src, dest, size); + dest += size; + av_memcpy_backptr(dest, back, size2); + dest += size2; + } else { + int finish = opcode >= 0xfc; + + size = finish ? opcode & 3 : ((opcode & 0x1f) << 2) + 4; + if (src + size > src_end || dest + size > dest_end) + return -1; + bytestream_get_buffer(&src, dest, size); + dest += size; + if (finish) + break; + } + } + return dest - orig_dest; +} + +static int xan_decode_chroma(AVCodecContext *avctx, AVPacket *avpkt) +{ + const uint8_t *buf = avpkt->data; + XanContext *s = avctx->priv_data; + uint8_t *U, *V; + unsigned chroma_off; + int val, uval, vval; + int i, j; + const uint8_t *src, *src_end; + const uint8_t *table; + int mode, offset, dec_size; + + chroma_off = AV_RL32(buf + 4); + if (!chroma_off) + return 0; + if (chroma_off + 10 >= avpkt->size) { + av_log(avctx, AV_LOG_ERROR, "Invalid chroma block position\n"); + return -1; + } + src = avpkt->data + 4 + chroma_off; + table = src + 2; + mode = bytestream_get_le16(&src); + offset = bytestream_get_le16(&src) * 2; + + if (src - avpkt->data >= avpkt->size - offset) { + av_log(avctx, AV_LOG_ERROR, "Invalid chroma block offset\n"); + return -1; + } + + memset(s->scratch_buffer, 0, s->buffer_size); + dec_size = xan_unpack(s->scratch_buffer, s->buffer_size, src + offset, + avpkt->size - offset - (src - avpkt->data)); + if (dec_size < 0) { + av_log(avctx, AV_LOG_ERROR, "Chroma unpacking failed\n"); + return -1; + } + + U = s->pic.data[1]; + V = s->pic.data[2]; + src = s->scratch_buffer; + src_end = src + dec_size; + if (mode) { + for (j = 0; j < avctx->height >> 1; j++) { + for (i = 0; i < avctx->width >> 1; i++) { + val = *src++; + if (val) { + val = AV_RL16(table + (val << 1)); + uval = (val >> 3) & 0xF8; + vval = (val >> 8) & 0xF8; + U[i] = uval | (uval >> 5); + V[i] = vval | (vval >> 5); + } + if (src == src_end) + return 0; + } + U += s->pic.linesize[1]; + V += s->pic.linesize[2]; + } + } else { + uint8_t *U2 = U + s->pic.linesize[1]; + uint8_t *V2 = V + s->pic.linesize[2]; + + for (j = 0; j < avctx->height >> 2; j++) { + for (i = 0; i < avctx->width >> 1; i += 2) { + val = *src++; + if (val) { + val = AV_RL16(table + (val << 1)); + uval = (val >> 3) & 0xF8; + vval = (val >> 8) & 0xF8; + U[i] = U[i+1] = U2[i] = U2[i+1] = uval | (uval >> 5); + V[i] = V[i+1] = V2[i] = V2[i+1] = vval | (vval >> 5); + } + } + U += s->pic.linesize[1] * 2; + V += s->pic.linesize[2] * 2; + U2 += s->pic.linesize[1] * 2; + V2 += s->pic.linesize[2] * 2; + } + } + + return 0; +} + +static int xan_decode_frame_type0(AVCodecContext *avctx, AVPacket *avpkt) +{ + const uint8_t *buf = avpkt->data; + XanContext *s = avctx->priv_data; + uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer; + unsigned chroma_off, corr_off; + int cur, last, size; + int i, j; + int ret; + + corr_off = AV_RL32(buf + 8); + chroma_off = AV_RL32(buf + 4); + + if ((ret = xan_decode_chroma(avctx, avpkt)) != 0) + return ret; + + size = avpkt->size - 4; + if (corr_off >= avpkt->size) { + av_log(avctx, AV_LOG_WARNING, "Ignoring invalid correction block position\n"); + corr_off = 0; + } + if (corr_off) + size = corr_off; + if (chroma_off) + size = FFMIN(size, chroma_off); + ret = xan_unpack_luma(buf + 12, size, src, s->buffer_size >> 1); + if (ret) { + av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n"); + return ret; + } + + ybuf = s->y_buffer; + last = *src++; + ybuf[0] = last << 1; + for (j = 1; j < avctx->width - 1; j += 2) { + cur = (last + *src++) & 0x1F; + ybuf[j] = last + cur; + ybuf[j+1] = cur << 1; + last = cur; + } + ybuf[j] = last << 1; + prev_buf = ybuf; + ybuf += avctx->width; + + for (i = 1; i < avctx->height; i++) { + last = ((prev_buf[0] >> 1) + *src++) & 0x1F; + ybuf[0] = last << 1; + for (j = 1; j < avctx->width - 1; j += 2) { + cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F; + ybuf[j] = last + cur; + ybuf[j+1] = cur << 1; + last = cur; + } + ybuf[j] = last << 1; + prev_buf = ybuf; + ybuf += avctx->width; + } + + if (corr_off) { + int corr_end, dec_size; + + corr_end = avpkt->size; + if (chroma_off > corr_off) + corr_end = chroma_off; + dec_size = xan_unpack(s->scratch_buffer, s->buffer_size, + avpkt->data + 8 + corr_off, + corr_end - corr_off); + if (dec_size < 0) + dec_size = 0; + for (i = 0; i < dec_size; i++) + s->y_buffer[i*2+1] = (s->y_buffer[i*2+1] + (s->scratch_buffer[i] << 1)) & 0x3F; + } + + src = s->y_buffer; + ybuf = s->pic.data[0]; + for (j = 0; j < avctx->height; j++) { + for (i = 0; i < avctx->width; i++) + ybuf[i] = (src[i] << 2) | (src[i] >> 3); + src += avctx->width; + ybuf += s->pic.linesize[0]; + } + + return 0; +} + +static int xan_decode_frame_type1(AVCodecContext *avctx, AVPacket *avpkt) +{ + const uint8_t *buf = avpkt->data; + XanContext *s = avctx->priv_data; + uint8_t *ybuf, *src = s->scratch_buffer; + int cur, last; + int i, j; + int ret; + + if ((ret = xan_decode_chroma(avctx, avpkt)) != 0) + return ret; + + ret = xan_unpack_luma(buf + 16, avpkt->size - 16, src, + s->buffer_size >> 1); + if (ret) { + av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n"); + return ret; + } + + ybuf = s->y_buffer; + for (i = 0; i < avctx->height; i++) { + last = (ybuf[0] + (*src++ << 1)) & 0x3F; + ybuf[0] = last; + for (j = 1; j < avctx->width - 1; j += 2) { + cur = (ybuf[j + 1] + (*src++ << 1)) & 0x3F; + ybuf[j] = (last + cur) >> 1; + ybuf[j+1] = cur; + last = cur; + } + ybuf[j] = last; + ybuf += avctx->width; + } + + src = s->y_buffer; + ybuf = s->pic.data[0]; + for (j = 0; j < avctx->height; j++) { + for (i = 0; i < avctx->width; i++) + ybuf[i] = (src[i] << 2) | (src[i] >> 3); + src += avctx->width; + ybuf += s->pic.linesize[0]; + } + + return 0; +} + +static int xan_decode_frame(AVCodecContext *avctx, + void *data, int *data_size, + AVPacket *avpkt) +{ + XanContext *s = avctx->priv_data; + int ftype; + int ret; + + s->pic.reference = 1; + s->pic.buffer_hints = FF_BUFFER_HINTS_VALID | + FF_BUFFER_HINTS_PRESERVE | + FF_BUFFER_HINTS_REUSABLE; + if ((ret = avctx->reget_buffer(avctx, &s->pic))) { + av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + return ret; + } + + ftype = AV_RL32(avpkt->data); + switch (ftype) { + case 0: + ret = xan_decode_frame_type0(avctx, avpkt); + break; + case 1: + ret = xan_decode_frame_type1(avctx, avpkt); + break; + default: + av_log(avctx, AV_LOG_ERROR, "Unknown frame type %d\n", ftype); + return -1; + } + if (ret) + return ret; + + *data_size = sizeof(AVFrame); + *(AVFrame*)data = s->pic; + + return avpkt->size; +} + +static av_cold int xan_decode_end(AVCodecContext *avctx) +{ + XanContext *s = avctx->priv_data; + + if (s->pic.data[0]) + avctx->release_buffer(avctx, &s->pic); + + av_freep(&s->y_buffer); + av_freep(&s->scratch_buffer); + + return 0; +} + +AVCodec ff_xan_wc4_decoder = { + "xan_wc4", + AVMEDIA_TYPE_VIDEO, + CODEC_ID_XAN_WC4, + sizeof(XanContext), + xan_decode_init, + NULL, + xan_decode_end, + xan_decode_frame, + CODEC_CAP_DR1, + .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"), +}; + diff --git a/mplayer/ffmpeg/libavcodec/yop.c b/mplayer/ffmpeg/libavcodec/yop.c index 6a75e74b..a117e2d7 100644 --- a/mplayer/ffmpeg/libavcodec/yop.c +++ b/mplayer/ffmpeg/libavcodec/yop.c @@ -24,7 +24,7 @@ */ #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avcodec.h" #include "get_bits.h" diff --git a/mplayer/ffmpeg/libavcore/Makefile b/mplayer/ffmpeg/libavcore/Makefile deleted file mode 100644 index f2e82970..00000000 --- a/mplayer/ffmpeg/libavcore/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include $(SUBDIR)../config.mak - -NAME = avcore -FFLIBS = avutil - -HEADERS = \ - audioconvert.h \ - avcore.h \ - imgutils.h \ - parseutils.h \ - samplefmt.h \ - -OBJS = \ - audioconvert.o \ - imgutils.o \ - parseutils.o \ - samplefmt.o \ - utils.o \ - -include $(SUBDIR)../subdir.mak diff --git a/mplayer/ffmpeg/libavcore/avcore.h b/mplayer/ffmpeg/libavcore/avcore.h deleted file mode 100644 index 9b02c3b5..00000000 --- a/mplayer/ffmpeg/libavcore/avcore.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCORE_AVCORE_H -#define AVCORE_AVCORE_H - -/** - * @file - * shared media utilities for the libav* libraries - */ - -#include "libavutil/avutil.h" - -#define LIBAVCORE_VERSION_MAJOR 0 -#define LIBAVCORE_VERSION_MINOR 16 -#define LIBAVCORE_VERSION_MICRO 1 - -#define LIBAVCORE_VERSION_INT AV_VERSION_INT(LIBAVCORE_VERSION_MAJOR, \ - LIBAVCORE_VERSION_MINOR, \ - LIBAVCORE_VERSION_MICRO) -#define LIBAVCORE_VERSION AV_VERSION(LIBAVCORE_VERSION_MAJOR, \ - LIBAVCORE_VERSION_MINOR, \ - LIBAVCORE_VERSION_MICRO) -#define LIBAVCORE_BUILD LIBAVCORE_VERSION_INT - -#define LIBAVCORE_IDENT "Lavcore" AV_STRINGIFY(LIBAVCORE_VERSION) - -/** - * Return the LIBAVCORE_VERSION_INT constant. - */ -unsigned avcore_version(void); - -/** - * Return the libavcore build-time configuration. - */ -const char *avcore_configuration(void); - -/** - * Return the libavcore license. - */ -const char *avcore_license(void); - -#define AV_NOPTS_VALUE INT64_C(0x8000000000000000) -#define AV_TIME_BASE 1000000 -#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} - -/** - * Those FF_API_* defines are not part of public API. - * They may change, break or disappear at any time. - */ -#ifndef FF_API_OLD_IMAGE_NAMES -#define FF_API_OLD_IMAGE_NAMES (LIBAVCORE_VERSION_MAJOR < 1) -#endif - -#endif /* AVCORE_AVCORE_H */ diff --git a/mplayer/ffmpeg/libavcore/libavcore.v b/mplayer/ffmpeg/libavcore/libavcore.v deleted file mode 100644 index dc84cc49..00000000 --- a/mplayer/ffmpeg/libavcore/libavcore.v +++ /dev/null @@ -1,4 +0,0 @@ -LIBAVCORE_$MAJOR { - global: av_*; ff_*; avcore*; - local: *; -}; diff --git a/mplayer/ffmpeg/libavcore/utils.c b/mplayer/ffmpeg/libavcore/utils.c deleted file mode 100644 index 8350a9bc..00000000 --- a/mplayer/ffmpeg/libavcore/utils.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "avcore.h" - -/** - * @file - * various utility functions - */ - -unsigned avcore_version(void) -{ - return LIBAVCORE_VERSION_INT; -} - -const char *avcore_configuration(void) -{ - return FFMPEG_CONFIGURATION; -} - -const char *avcore_license(void) -{ -#define LICENSE_PREFIX "libavcore license: " - return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1; -} diff --git a/mplayer/ffmpeg/libavdevice/Makefile b/mplayer/ffmpeg/libavdevice/Makefile index 1c0630b3..be28f4a0 100644 --- a/mplayer/ffmpeg/libavdevice/Makefile +++ b/mplayer/ffmpeg/libavdevice/Makefile @@ -1,7 +1,7 @@ include $(SUBDIR)../config.mak NAME = avdevice -FFLIBS = avformat avcodec avcore avutil +FFLIBS = avformat avcodec avutil HEADERS = avdevice.h diff --git a/mplayer/ffmpeg/libavdevice/v4l.c b/mplayer/ffmpeg/libavdevice/v4l.c index c107684b..9a155f9d 100644 --- a/mplayer/ffmpeg/libavdevice/v4l.c +++ b/mplayer/ffmpeg/libavdevice/v4l.c @@ -22,7 +22,7 @@ #undef __STRICT_ANSI__ //workaround due to broken kernel headers #include "config.h" #include "libavutil/rational.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "libavformat/avformat.h" #include "libavcodec/dsputil.h" #include diff --git a/mplayer/ffmpeg/libavdevice/v4l2.c b/mplayer/ffmpeg/libavdevice/v4l2.c index 993e2adc..1f1a4bcf 100644 --- a/mplayer/ffmpeg/libavdevice/v4l2.c +++ b/mplayer/ffmpeg/libavdevice/v4l2.c @@ -43,7 +43,7 @@ #endif #include #include -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" static const int desired_video_buffers = 256; diff --git a/mplayer/ffmpeg/libavfilter/Makefile b/mplayer/ffmpeg/libavfilter/Makefile index fdb181e0..bbd82023 100644 --- a/mplayer/ffmpeg/libavfilter/Makefile +++ b/mplayer/ffmpeg/libavfilter/Makefile @@ -1,7 +1,8 @@ include $(SUBDIR)../config.mak NAME = avfilter -FFLIBS = avcore avutil +FFLIBS = avutil +FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec FFLIBS-$(CONFIG_SCALE_FILTER) += swscale HEADERS = avfilter.h avfiltergraph.h @@ -10,6 +11,7 @@ OBJS = allfilters.o \ avfilter.o \ avfiltergraph.o \ defaults.o \ + drawutils.o \ formats.o \ graphparser.o \ @@ -48,8 +50,9 @@ OBJS-$(CONFIG_VFLIP_FILTER) += vf_vflip.o OBJS-$(CONFIG_YADIF_FILTER) += vf_yadif.o OBJS-$(CONFIG_BUFFER_FILTER) += vsrc_buffer.o -OBJS-$(CONFIG_COLOR_FILTER) += vf_pad.o +OBJS-$(CONFIG_COLOR_FILTER) += vsrc_color.o OBJS-$(CONFIG_FREI0R_SRC_FILTER) += vf_frei0r.o +OBJS-$(CONFIG_MOVIE_FILTER) += vsrc_movie.o OBJS-$(CONFIG_NULLSRC_FILTER) += vsrc_nullsrc.o OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o diff --git a/mplayer/ffmpeg/libavfilter/allfilters.c b/mplayer/ffmpeg/libavfilter/allfilters.c index 1dffb804..cb29c2f1 100644 --- a/mplayer/ffmpeg/libavfilter/allfilters.c +++ b/mplayer/ffmpeg/libavfilter/allfilters.c @@ -71,6 +71,7 @@ void avfilter_register_all(void) REGISTER_FILTER (BUFFER, buffer, vsrc); REGISTER_FILTER (COLOR, color, vsrc); REGISTER_FILTER (FREI0R, frei0r_src, vsrc); + REGISTER_FILTER (MOVIE, movie, vsrc); REGISTER_FILTER (NULLSRC, nullsrc, vsrc); REGISTER_FILTER (NULLSINK, nullsink, vsink); diff --git a/mplayer/ffmpeg/libavfilter/asrc_anullsrc.c b/mplayer/ffmpeg/libavfilter/asrc_anullsrc.c index 306e0a3d..4f49c3f1 100644 --- a/mplayer/ffmpeg/libavfilter/asrc_anullsrc.c +++ b/mplayer/ffmpeg/libavfilter/asrc_anullsrc.c @@ -22,7 +22,7 @@ */ #include "avfilter.h" -#include "libavcore/audioconvert.h" +#include "libavutil/audioconvert.h" typedef struct { int64_t channel_layout; diff --git a/mplayer/ffmpeg/libavfilter/avfilter.c b/mplayer/ffmpeg/libavfilter/avfilter.c index 3d8d08ac..039e04bf 100644 --- a/mplayer/ffmpeg/libavfilter/avfilter.c +++ b/mplayer/ffmpeg/libavfilter/avfilter.c @@ -23,8 +23,8 @@ #include "libavutil/pixdesc.h" #include "libavutil/rational.h" -#include "libavcore/audioconvert.h" -#include "libavcore/imgutils.h" +#include "libavutil/audioconvert.h" +#include "libavutil/imgutils.h" #include "avfilter.h" #include "internal.h" @@ -194,6 +194,16 @@ int avfilter_config_links(AVFilterContext *filter) link->time_base = link->src && link->src->input_count ? link->src->inputs[0]->time_base : AV_TIME_BASE_Q; + if (link->sample_aspect_ratio.num == 0 && link->sample_aspect_ratio.den == 0) + link->sample_aspect_ratio = link->src->input_count ? + link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1}; + + if (link->sample_rate == 0 && link->src && link->src->input_count) + link->sample_rate = link->src->inputs[0]->sample_rate; + + if (link->channel_layout == 0 && link->src && link->src->input_count) + link->channel_layout = link->src->inputs[0]->channel_layout; + if ((config_link = link->dstpad->config_props)) if ((ret = config_link(link)) < 0) return ret; @@ -217,24 +227,24 @@ static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) return buf; } -static void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end) +static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) { av_unused char buf[16]; - dprintf(ctx, + av_dlog(ctx, "ref[%p buf:%p refcount:%d perms:%s data:%p linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64, ref, ref->buf, ref->buf->refcount, ff_get_ref_perms_string(buf, sizeof(buf), ref->perms), ref->data[0], ref->linesize[0], ref->linesize[1], ref->linesize[2], ref->linesize[3], ref->pts, ref->pos); if (ref->video) { - dprintf(ctx, " a:%d/%d s:%dx%d i:%c", + av_dlog(ctx, " a:%d/%d s:%dx%d i:%c", ref->video->pixel_aspect.num, ref->video->pixel_aspect.den, ref->video->w, ref->video->h, !ref->video->interlaced ? 'P' : /* Progressive */ ref->video->top_field_first ? 'T' : 'B'); /* Top / Bottom */ } if (ref->audio) { - dprintf(ctx, " cl:%"PRId64"d sn:%d s:%d sr:%d p:%d", + av_dlog(ctx, " cl:%"PRId64"d sn:%d s:%d sr:%d p:%d", ref->audio->channel_layout, ref->audio->nb_samples, ref->audio->size, @@ -242,13 +252,13 @@ static void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end) ref->audio->planar); } - dprintf(ctx, "]%s", end ? "\n" : ""); + av_dlog(ctx, "]%s", end ? "\n" : ""); } -static void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) +static void ff_dlog_link(void *ctx, AVFilterLink *link, int end) { if (link->type == AVMEDIA_TYPE_VIDEO) { - dprintf(ctx, + av_dlog(ctx, "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s", link, link->w, link->h, av_pix_fmt_descriptors[link->format].name, @@ -259,7 +269,7 @@ static void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) char buf[128]; av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout); - dprintf(ctx, + av_dlog(ctx, "link[%p r:%"PRId64" cl:%s fmt:%-16s %-16s->%-16s]%s", link, link->sample_rate, buf, av_get_sample_fmt_name(link->format), @@ -269,15 +279,15 @@ static void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) } } -#define FF_DPRINTF_START(ctx, func) dprintf(NULL, "%-16s: ", #func) +#define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func) AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { AVFilterBufferRef *ret = NULL; av_unused char buf[16]; - FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); - dprintf(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h); + FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); + av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h); if (link->dstpad->get_video_buffer) ret = link->dstpad->get_video_buffer(link, perms, w, h); @@ -288,7 +298,7 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int if (ret) ret->type = AVMEDIA_TYPE_VIDEO; - FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); ff_dprintf_ref(NULL, ret, 1); + FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1); return ret; } @@ -353,7 +363,7 @@ AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, int avfilter_request_frame(AVFilterLink *link) { - FF_DPRINTF_START(NULL, request_frame); ff_dprintf_link(NULL, link, 1); + FF_DPRINTF_START(NULL, request_frame); ff_dlog_link(NULL, link, 1); if (link->srcpad->request_frame) return link->srcpad->request_frame(link); @@ -388,7 +398,7 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) AVFilterPad *dst = link->dstpad; int perms = picref->perms; - FF_DPRINTF_START(NULL, start_frame); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " "); ff_dprintf_ref(NULL, picref, 1); + FF_DPRINTF_START(NULL, start_frame); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " "); ff_dlog_ref(NULL, picref, 1); if (!(start_frame = dst->start_frame)) start_frame = avfilter_default_start_frame; @@ -435,7 +445,7 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) int i, j, vsub; void (*draw_slice)(AVFilterLink *, int, int, int); - FF_DPRINTF_START(NULL, draw_slice); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir); + FF_DPRINTF_START(NULL, draw_slice); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir); /* copy the slice if needed for permission reasons */ if (link->src_buf) { @@ -475,6 +485,8 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) void (*filter_samples)(AVFilterLink *, AVFilterBufferRef *); AVFilterPad *dst = link->dstpad; + FF_DPRINTF_START(NULL, filter_samples); ff_dlog_link(NULL, link, 1); + if (!(filter_samples = dst->filter_samples)) filter_samples = avfilter_default_filter_samples; diff --git a/mplayer/ffmpeg/libavfilter/avfilter.h b/mplayer/ffmpeg/libavfilter/avfilter.h index ad8b1e51..935214da 100644 --- a/mplayer/ffmpeg/libavfilter/avfilter.h +++ b/mplayer/ffmpeg/libavfilter/avfilter.h @@ -23,11 +23,10 @@ #define AVFILTER_AVFILTER_H #include "libavutil/avutil.h" -#include "libavcore/avcore.h" -#include "libavcore/samplefmt.h" +#include "libavutil/samplefmt.h" #define LIBAVFILTER_VERSION_MAJOR 1 -#define LIBAVFILTER_VERSION_MINOR 74 +#define LIBAVFILTER_VERSION_MINOR 76 #define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ @@ -580,11 +579,12 @@ struct AVFilterLink { enum AVMediaType type; ///< filter media type - /* These two parameters apply only to video */ + /* These parameters apply only to video */ int w; ///< agreed upon image width int h; ///< agreed upon image height + AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio /* These two parameters apply only to audio */ - int64_t channel_layout; ///< channel layout of current buffer (see libavcore/audioconvert.h) + int64_t channel_layout; ///< channel layout of current buffer (see libavutil/audioconvert.h) int64_t sample_rate; ///< samples per second int format; ///< agreed upon media format diff --git a/mplayer/ffmpeg/libavfilter/avfiltergraph.c b/mplayer/ffmpeg/libavfilter/avfiltergraph.c index a62fe2f7..bdf22b3d 100644 --- a/mplayer/ffmpeg/libavfilter/avfiltergraph.c +++ b/mplayer/ffmpeg/libavfilter/avfiltergraph.c @@ -32,14 +32,15 @@ AVFilterGraph *avfilter_graph_alloc(void) return av_mallocz(sizeof(AVFilterGraph)); } -void avfilter_graph_free(AVFilterGraph *graph) +void avfilter_graph_free(AVFilterGraph **graph) { - if (!graph) + if (!*graph) return; - for (; graph->filter_count > 0; graph->filter_count --) - avfilter_free(graph->filters[graph->filter_count - 1]); - av_freep(&graph->scale_sws_opts); - av_freep(&graph->filters); + for (; (*graph)->filter_count > 0; (*graph)->filter_count--) + avfilter_free((*graph)->filters[(*graph)->filter_count - 1]); + av_freep(&(*graph)->scale_sws_opts); + av_freep(&(*graph)->filters); + av_freep(graph); } int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter) diff --git a/mplayer/ffmpeg/libavfilter/avfiltergraph.h b/mplayer/ffmpeg/libavfilter/avfiltergraph.h index 1b0d242d..0140af08 100644 --- a/mplayer/ffmpeg/libavfilter/avfiltergraph.h +++ b/mplayer/ffmpeg/libavfilter/avfiltergraph.h @@ -79,9 +79,10 @@ int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt, int avfilter_graph_config(AVFilterGraph *graphctx, AVClass *log_ctx); /** - * Free a graph and destroy its links, graph may be NULL. + * Free a graph, destroy its links, and set *graph to NULL. + * If *graph is NULL, do nothing. */ -void avfilter_graph_free(AVFilterGraph *graph); +void avfilter_graph_free(AVFilterGraph **graph); /** * A linked-list of the inputs/outputs of the filter chain. diff --git a/mplayer/ffmpeg/libavfilter/defaults.c b/mplayer/ffmpeg/libavfilter/defaults.c index 98339b6f..1da26304 100644 --- a/mplayer/ffmpeg/libavfilter/defaults.c +++ b/mplayer/ffmpeg/libavfilter/defaults.c @@ -19,9 +19,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcore/audioconvert.h" -#include "libavcore/imgutils.h" -#include "libavcore/samplefmt.h" +#include "libavutil/audioconvert.h" +#include "libavutil/imgutils.h" +#include "libavutil/samplefmt.h" #include "avfilter.h" #include "internal.h" @@ -126,7 +126,7 @@ AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int per return ref; fail: - if (ref && ref->audio) + if (ref) av_free(ref->audio); av_free(ref); av_free(samples); diff --git a/mplayer/ffmpeg/libavfilter/drawutils.c b/mplayer/ffmpeg/libavfilter/drawutils.c new file mode 100644 index 00000000..dd9ceff1 --- /dev/null +++ b/mplayer/ffmpeg/libavfilter/drawutils.c @@ -0,0 +1,117 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/avutil.h" +#include "libavutil/colorspace.h" +#include "libavutil/pixdesc.h" +#include "drawutils.h" + +enum { RED = 0, GREEN, BLUE, ALPHA }; + +int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t dst_color[4], + enum PixelFormat pix_fmt, uint8_t rgba_color[4], + int *is_packed_rgba, uint8_t rgba_map_ptr[4]) +{ + uint8_t rgba_map[4] = {0}; + int i; + const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt]; + int hsub = pix_desc->log2_chroma_w; + + *is_packed_rgba = 1; + switch (pix_fmt) { + case PIX_FMT_ARGB: rgba_map[ALPHA] = 0; rgba_map[RED ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break; + case PIX_FMT_ABGR: rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED ] = 3; break; + case PIX_FMT_RGBA: + case PIX_FMT_RGB24: rgba_map[RED ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break; + case PIX_FMT_BGRA: + case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED ] = 2; rgba_map[ALPHA] = 3; break; + default: + *is_packed_rgba = 0; + } + + if (*is_packed_rgba) { + pixel_step[0] = (av_get_bits_per_pixel(pix_desc))>>3; + for (i = 0; i < 4; i++) + dst_color[rgba_map[i]] = rgba_color[i]; + + line[0] = av_malloc(w * pixel_step[0]); + for (i = 0; i < w; i++) + memcpy(line[0] + i * pixel_step[0], dst_color, pixel_step[0]); + if (rgba_map_ptr) + memcpy(rgba_map_ptr, rgba_map, sizeof(rgba_map[0]) * 4); + } else { + int plane; + + dst_color[0] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]); + dst_color[1] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0); + dst_color[2] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0); + dst_color[3] = rgba_color[3]; + + for (plane = 0; plane < 4; plane++) { + int line_size; + int hsub1 = (plane == 1 || plane == 2) ? hsub : 0; + + pixel_step[plane] = 1; + line_size = (w >> hsub1) * pixel_step[plane]; + line[plane] = av_malloc(line_size); + memset(line[plane], dst_color[plane], line_size); + } + } + + return 0; +} + +void ff_draw_rectangle(uint8_t *dst[4], int dst_linesize[4], + uint8_t *src[4], int pixelstep[4], + int hsub, int vsub, int x, int y, int w, int h) +{ + int i, plane; + uint8_t *p; + + for (plane = 0; plane < 4 && dst[plane]; plane++) { + int hsub1 = plane == 1 || plane == 2 ? hsub : 0; + int vsub1 = plane == 1 || plane == 2 ? vsub : 0; + + p = dst[plane] + (y >> vsub1) * dst_linesize[plane]; + for (i = 0; i < (h >> vsub1); i++) { + memcpy(p + (x >> hsub1) * pixelstep[plane], + src[plane], (w >> hsub1) * pixelstep[plane]); + p += dst_linesize[plane]; + } + } +} + +void ff_copy_rectangle(uint8_t *dst[4], int dst_linesize[4], + uint8_t *src[4], int src_linesize[4], int pixelstep[4], + int hsub, int vsub, int x, int y, int y2, int w, int h) +{ + int i, plane; + uint8_t *p; + + for (plane = 0; plane < 4 && dst[plane]; plane++) { + int hsub1 = plane == 1 || plane == 2 ? hsub : 0; + int vsub1 = plane == 1 || plane == 2 ? vsub : 0; + + p = dst[plane] + (y >> vsub1) * dst_linesize[plane]; + for (i = 0; i < (h >> vsub1); i++) { + memcpy(p + (x >> hsub1) * pixelstep[plane], + src[plane] + src_linesize[plane]*(i+(y2>>vsub1)), (w >> hsub1) * pixelstep[plane]); + p += dst_linesize[plane]; + } + } +} diff --git a/mplayer/ffmpeg/libavfilter/drawutils.h b/mplayer/ffmpeg/libavfilter/drawutils.h new file mode 100644 index 00000000..e8386605 --- /dev/null +++ b/mplayer/ffmpeg/libavfilter/drawutils.h @@ -0,0 +1,43 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_DRAWUTILS_H +#define AVFILTER_DRAWUTILS_H + +/** + * @file + * misc drawing utilities + */ + +#include +#include "libavutil/pixfmt.h" + +int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, + uint8_t dst_color[4], + enum PixelFormat pix_fmt, uint8_t rgba_color[4], + int *is_packed_rgba, uint8_t rgba_map[4]); + +void ff_draw_rectangle(uint8_t *dst[4], int dst_linesize[4], + uint8_t *src[4], int pixelstep[4], + int hsub, int vsub, int x, int y, int w, int h); + +void ff_copy_rectangle(uint8_t *dst[4], int dst_linesize[4], + uint8_t *src[4], int src_linesize[4], int pixelstep[4], + int hsub, int vsub, int x, int y, int y2, int w, int h); + +#endif /* AVFILTER_DRAWUTILS_H */ diff --git a/mplayer/ffmpeg/libavfilter/graphparser.c b/mplayer/ffmpeg/libavfilter/graphparser.c index 7151e4fe..47179e5e 100644 --- a/mplayer/ffmpeg/libavfilter/graphparser.c +++ b/mplayer/ffmpeg/libavfilter/graphparser.c @@ -393,7 +393,9 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, return 0; fail: - avfilter_graph_free(graph); + for (; graph->filter_count > 0; graph->filter_count--) + avfilter_free(graph->filters[graph->filter_count - 1]); + av_freep(&graph->filters); free_inout(open_inputs); free_inout(open_outputs); free_inout(curr_inputs); diff --git a/mplayer/ffmpeg/libavfilter/vf_aspect.c b/mplayer/ffmpeg/libavfilter/vf_aspect.c index 6f86bf29..95bfb666 100644 --- a/mplayer/ffmpeg/libavfilter/vf_aspect.c +++ b/mplayer/ffmpeg/libavfilter/vf_aspect.c @@ -82,6 +82,9 @@ static int setdar_config_props(AVFilterLink *inlink) av_log(inlink->dst, AV_LOG_INFO, "w:%d h:%d -> dar:%d/%d par:%d/%d\n", inlink->w, inlink->h, dar.num, dar.den, aspect->aspect.num, aspect->aspect.den); + + inlink->sample_aspect_ratio = aspect->aspect; + return 0; } @@ -108,6 +111,16 @@ AVFilter avfilter_vf_setdar = { #endif /* CONFIG_SETDAR_FILTER */ #if CONFIG_SETSAR_FILTER +/* for setdar filter, convert from frame aspect ratio to pixel aspect ratio */ +static int setsar_config_props(AVFilterLink *inlink) +{ + AspectContext *aspect = inlink->dst->priv; + + inlink->sample_aspect_ratio = aspect->aspect; + + return 0; +} + AVFilter avfilter_vf_setsar = { .name = "setsar", .description = NULL_IF_CONFIG_SMALL("Set the pixel sample aspect ratio."), @@ -118,6 +131,7 @@ AVFilter avfilter_vf_setsar = { .inputs = (AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .config_props = setsar_config_props, .get_video_buffer = avfilter_null_get_video_buffer, .start_frame = start_frame, .end_frame = avfilter_null_end_frame }, diff --git a/mplayer/ffmpeg/libavfilter/vf_crop.c b/mplayer/ffmpeg/libavfilter/vf_crop.c index e768fbb5..e02c24fe 100644 --- a/mplayer/ffmpeg/libavfilter/vf_crop.c +++ b/mplayer/ffmpeg/libavfilter/vf_crop.c @@ -29,7 +29,7 @@ #include "libavutil/eval.h" #include "libavutil/avstring.h" #include "libavutil/libm.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" static const char *var_names[] = { "E", diff --git a/mplayer/ffmpeg/libavfilter/vf_cropdetect.c b/mplayer/ffmpeg/libavfilter/vf_cropdetect.c index 62c68640..000c8bb2 100644 --- a/mplayer/ffmpeg/libavfilter/vf_cropdetect.c +++ b/mplayer/ffmpeg/libavfilter/vf_cropdetect.c @@ -23,7 +23,7 @@ * Ported from MPlayer libmpcodecs/vf_cropdetect.c. */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avfilter.h" typedef struct { diff --git a/mplayer/ffmpeg/libavfilter/vf_drawbox.c b/mplayer/ffmpeg/libavfilter/vf_drawbox.c index 40d5e16e..37850729 100644 --- a/mplayer/ffmpeg/libavfilter/vf_drawbox.c +++ b/mplayer/ffmpeg/libavfilter/vf_drawbox.c @@ -26,7 +26,7 @@ #include "libavutil/colorspace.h" #include "libavutil/pixdesc.h" -#include "libavcore/parseutils.h" +#include "libavutil/parseutils.h" #include "avfilter.h" enum { Y, U, V, A }; diff --git a/mplayer/ffmpeg/libavfilter/vf_frei0r.c b/mplayer/ffmpeg/libavfilter/vf_frei0r.c index 03d4f28f..adccccb9 100644 --- a/mplayer/ffmpeg/libavfilter/vf_frei0r.c +++ b/mplayer/ffmpeg/libavfilter/vf_frei0r.c @@ -27,8 +27,8 @@ #include #include #include "libavutil/avstring.h" -#include "libavcore/imgutils.h" -#include "libavcore/parseutils.h" +#include "libavutil/imgutils.h" +#include "libavutil/parseutils.h" #include "avfilter.h" typedef f0r_instance_t (*f0r_construct_f)(unsigned int width, unsigned int height); diff --git a/mplayer/ffmpeg/libavfilter/vf_gradfun.c b/mplayer/ffmpeg/libavfilter/vf_gradfun.c index 3a400a04..83ed3d79 100644 --- a/mplayer/ffmpeg/libavfilter/vf_gradfun.c +++ b/mplayer/ffmpeg/libavfilter/vf_gradfun.c @@ -32,7 +32,7 @@ * Dither it back to 8bit. */ -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "libavutil/cpu.h" #include "libavutil/pixdesc.h" #include "avfilter.h" diff --git a/mplayer/ffmpeg/libavfilter/vf_hflip.c b/mplayer/ffmpeg/libavfilter/vf_hflip.c index 4deb14a5..5250695f 100644 --- a/mplayer/ffmpeg/libavfilter/vf_hflip.c +++ b/mplayer/ffmpeg/libavfilter/vf_hflip.c @@ -27,7 +27,7 @@ #include "avfilter.h" #include "libavutil/pixdesc.h" #include "libavutil/intreadwrite.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" typedef struct { int max_step[4]; ///< max pixel step for each plane, expressed as a number of bytes diff --git a/mplayer/ffmpeg/libavfilter/vf_overlay.c b/mplayer/ffmpeg/libavfilter/vf_overlay.c index a170e817..0eb24b96 100644 --- a/mplayer/ffmpeg/libavfilter/vf_overlay.c +++ b/mplayer/ffmpeg/libavfilter/vf_overlay.c @@ -29,7 +29,7 @@ #include "libavutil/eval.h" #include "libavutil/avstring.h" #include "libavutil/pixdesc.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "internal.h" static const char *var_names[] = { diff --git a/mplayer/ffmpeg/libavfilter/vf_pad.c b/mplayer/ffmpeg/libavfilter/vf_pad.c index 467db5bf..492b08eb 100644 --- a/mplayer/ffmpeg/libavfilter/vf_pad.c +++ b/mplayer/ffmpeg/libavfilter/vf_pad.c @@ -28,96 +28,9 @@ #include "libavutil/pixdesc.h" #include "libavutil/colorspace.h" #include "libavutil/avassert.h" -#include "libavcore/imgutils.h" -#include "libavcore/parseutils.h" - -enum { RED = 0, GREEN, BLUE, ALPHA }; - -static int fill_line_with_color(uint8_t *line[4], int line_step[4], int w, uint8_t color[4], - enum PixelFormat pix_fmt, uint8_t rgba_color[4], int *is_packed_rgba) -{ - uint8_t rgba_map[4] = {0}; - int i; - const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt]; - int hsub = pix_desc->log2_chroma_w; - - *is_packed_rgba = 1; - switch (pix_fmt) { - case PIX_FMT_ARGB: rgba_map[ALPHA] = 0; rgba_map[RED ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break; - case PIX_FMT_ABGR: rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED ] = 3; break; - case PIX_FMT_RGBA: - case PIX_FMT_RGB24: rgba_map[RED ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break; - case PIX_FMT_BGRA: - case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED ] = 2; rgba_map[ALPHA] = 3; break; - default: - *is_packed_rgba = 0; - } - - if (*is_packed_rgba) { - line_step[0] = (av_get_bits_per_pixel(pix_desc))>>3; - for (i = 0; i < 4; i++) - color[rgba_map[i]] = rgba_color[i]; - - line[0] = av_malloc(w * line_step[0]); - for (i = 0; i < w; i++) - memcpy(line[0] + i * line_step[0], color, line_step[0]); - } else { - int plane; - - color[RED ] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]); - color[GREEN] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0); - color[BLUE ] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0); - color[ALPHA] = rgba_color[3]; - - for (plane = 0; plane < 4; plane++) { - int line_size; - int hsub1 = (plane == 1 || plane == 2) ? hsub : 0; - - line_step[plane] = 1; - line_size = (w >> hsub1) * line_step[plane]; - line[plane] = av_malloc(line_size); - memset(line[plane], color[plane], line_size); - } - } - - return 0; -} - -static void draw_rectangle(AVFilterBufferRef *outpic, uint8_t *line[4], int line_step[4], - int hsub, int vsub, int x, int y, int w, int h) -{ - int i, plane; - uint8_t *p; - - for (plane = 0; plane < 4 && outpic->data[plane]; plane++) { - int hsub1 = plane == 1 || plane == 2 ? hsub : 0; - int vsub1 = plane == 1 || plane == 2 ? vsub : 0; - - p = outpic->data[plane] + (y >> vsub1) * outpic->linesize[plane]; - for (i = 0; i < (h >> vsub1); i++) { - memcpy(p + (x >> hsub1) * line_step[plane], line[plane], (w >> hsub1) * line_step[plane]); - p += outpic->linesize[plane]; - } - } -} - -static void copy_rectangle(AVFilterBufferRef *outpic,uint8_t *line[4], int line_step[4], int linesize[4], - int hsub, int vsub, int x, int y, int y2, int w, int h) -{ - int i, plane; - uint8_t *p; - - for (plane = 0; plane < 4 && outpic->data[plane]; plane++) { - int hsub1 = plane == 1 || plane == 2 ? hsub : 0; - int vsub1 = plane == 1 || plane == 2 ? vsub : 0; - - p = outpic->data[plane] + (y >> vsub1) * outpic->linesize[plane]; - for (i = 0; i < (h >> vsub1); i++) { - memcpy(p + (x >> hsub1) * line_step[plane], line[plane] + linesize[plane]*(i+(y2>>vsub1)), (w >> hsub1) * line_step[plane]); - p += outpic->linesize[plane]; - } - } -} +#include "libavutil/imgutils.h" +#include "libavutil/parseutils.h" +#include "drawutils.h" static int query_formats(AVFilterContext *ctx) { @@ -140,8 +53,6 @@ static int query_formats(AVFilterContext *ctx) return 0; } -#if CONFIG_PAD_FILTER - typedef struct { int w, h; ///< output dimensions, a value of 0 will result in the input size int x, y; ///< offsets of the input area with respect to the padded area @@ -210,8 +121,8 @@ static int config_input(AVFilterLink *inlink) pad->in_h = inlink->h & ~((1 << pad->vsub) - 1); memcpy(rgba_color, pad->color, sizeof(rgba_color)); - fill_line_with_color(pad->line, pad->line_step, pad->w, pad->color, - inlink->format, rgba_color, &is_packed_rgba); + ff_fill_line_with_color(pad->line, pad->line_step, pad->w, pad->color, + inlink->format, rgba_color, &is_packed_rgba, NULL); av_log(ctx, AV_LOG_INFO, "w:%d h:%d -> w:%d h:%d x:%d y:%d color:0x%02X%02X%02X%02X[%s]\n", inlink->w, inlink->h, pad->w, pad->h, pad->x, pad->y, @@ -351,9 +262,10 @@ static void draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, } if (bar_h) { - draw_rectangle(link->dst->outputs[0]->out_buf, - pad->line, pad->line_step, pad->hsub, pad->vsub, - 0, bar_y, pad->w, bar_h); + ff_draw_rectangle(link->dst->outputs[0]->out_buf->data, + link->dst->outputs[0]->out_buf->linesize, + pad->line, pad->line_step, pad->hsub, pad->vsub, + 0, bar_y, pad->w, bar_h); avfilter_draw_slice(link->dst->outputs[0], bar_y, bar_h, slice_dir); } } @@ -374,18 +286,20 @@ static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir) draw_send_bar_slice(link, y, h, slice_dir, 1); /* left border */ - draw_rectangle(outpic, pad->line, pad->line_step, pad->hsub, pad->vsub, - 0, y, pad->x, h); + ff_draw_rectangle(outpic->data, outpic->linesize, pad->line, pad->line_step, + pad->hsub, pad->vsub, 0, y, pad->x, h); if(pad->needs_copy){ - copy_rectangle(outpic, - inpic->data, pad->line_step, inpic->linesize, pad->hsub, pad->vsub, - pad->x, y, y-pad->y, inpic->video->w, h); + ff_copy_rectangle(outpic->data, outpic->linesize, + inpic->data, inpic->linesize, pad->line_step, + pad->hsub, pad->vsub, + pad->x, y, y-pad->y, inpic->video->w, h); } /* right border */ - draw_rectangle(outpic, pad->line, pad->line_step, pad->hsub, pad->vsub, - pad->x + pad->in_w, y, pad->w - pad->x - pad->in_w, h); + ff_draw_rectangle(outpic->data, outpic->linesize, + pad->line, pad->line_step, pad->hsub, pad->vsub, + pad->x + pad->in_w, y, pad->w - pad->x - pad->in_w, h); avfilter_draw_slice(link->dst->outputs[0], y, h, slice_dir); draw_send_bar_slice(link, y, h, slice_dir, -1); @@ -414,129 +328,3 @@ AVFilter avfilter_vf_pad = { .config_props = config_output, }, { .name = NULL}}, }; - -#endif /* CONFIG_PAD_FILTER */ - -#if CONFIG_COLOR_FILTER - -typedef struct { - int w, h; - uint8_t color[4]; - AVRational time_base; - uint8_t *line[4]; - int line_step[4]; - int hsub, vsub; ///< chroma subsampling values - uint64_t pts; -} ColorContext; - -static av_cold int color_init(AVFilterContext *ctx, const char *args, void *opaque) -{ - ColorContext *color = ctx->priv; - char color_string[128] = "black"; - char frame_size [128] = "320x240"; - char frame_rate [128] = "25"; - AVRational frame_rate_q; - int ret; - - if (args) - sscanf(args, "%127[^:]:%127[^:]:%127s", color_string, frame_size, frame_rate); - - if (av_parse_video_size(&color->w, &color->h, frame_size) < 0) { - av_log(ctx, AV_LOG_ERROR, "Invalid frame size: %s\n", frame_size); - return AVERROR(EINVAL); - } - - if (av_parse_video_rate(&frame_rate_q, frame_rate) < 0 || - frame_rate_q.den <= 0 || frame_rate_q.num <= 0) { - av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: %s\n", frame_rate); - return AVERROR(EINVAL); - } - color->time_base.num = frame_rate_q.den; - color->time_base.den = frame_rate_q.num; - - if ((ret = av_parse_color(color->color, color_string, -1, ctx)) < 0) - return ret; - - return 0; -} - -static av_cold void color_uninit(AVFilterContext *ctx) -{ - ColorContext *color = ctx->priv; - int i; - - for (i = 0; i < 4; i++) { - av_freep(&color->line[i]); - color->line_step[i] = 0; - } -} - -static int color_config_props(AVFilterLink *inlink) -{ - AVFilterContext *ctx = inlink->src; - ColorContext *color = ctx->priv; - uint8_t rgba_color[4]; - int is_packed_rgba; - const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format]; - - color->hsub = pix_desc->log2_chroma_w; - color->vsub = pix_desc->log2_chroma_h; - - color->w &= ~((1 << color->hsub) - 1); - color->h &= ~((1 << color->vsub) - 1); - if (av_image_check_size(color->w, color->h, 0, ctx) < 0) - return AVERROR(EINVAL); - - memcpy(rgba_color, color->color, sizeof(rgba_color)); - fill_line_with_color(color->line, color->line_step, color->w, color->color, - inlink->format, rgba_color, &is_packed_rgba); - - av_log(ctx, AV_LOG_INFO, "w:%d h:%d r:%d/%d color:0x%02x%02x%02x%02x[%s]\n", - color->w, color->h, color->time_base.den, color->time_base.num, - color->color[0], color->color[1], color->color[2], color->color[3], - is_packed_rgba ? "rgba" : "yuva"); - inlink->w = color->w; - inlink->h = color->h; - - return 0; -} - -static int color_request_frame(AVFilterLink *link) -{ - ColorContext *color = link->src->priv; - AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h); - picref->video->pixel_aspect = (AVRational) {1, 1}; - picref->pts = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q); - picref->pos = 0; - - avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0)); - draw_rectangle(picref, - color->line, color->line_step, color->hsub, color->vsub, - 0, 0, color->w, color->h); - avfilter_draw_slice(link, 0, color->h, 1); - avfilter_end_frame(link); - avfilter_unref_buffer(picref); - - return 0; -} - -AVFilter avfilter_vsrc_color = { - .name = "color", - .description = NULL_IF_CONFIG_SMALL("Provide an uniformly colored input, syntax is: [color[:size[:rate]]]"), - - .priv_size = sizeof(ColorContext), - .init = color_init, - .uninit = color_uninit, - - .query_formats = query_formats, - - .inputs = (AVFilterPad[]) {{ .name = NULL}}, - - .outputs = (AVFilterPad[]) {{ .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .request_frame = color_request_frame, - .config_props = color_config_props }, - { .name = NULL}}, -}; - -#endif /* CONFIG_COLOR_FILTER */ diff --git a/mplayer/ffmpeg/libavfilter/vf_transpose.c b/mplayer/ffmpeg/libavfilter/vf_transpose.c index 970c3812..ed91aaad 100644 --- a/mplayer/ffmpeg/libavfilter/vf_transpose.c +++ b/mplayer/ffmpeg/libavfilter/vf_transpose.c @@ -27,7 +27,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/pixdesc.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "avfilter.h" typedef struct { @@ -102,6 +102,11 @@ static int config_props_output(AVFilterLink *outlink) outlink->w = inlink->h; outlink->h = inlink->w; + if (inlink->sample_aspect_ratio.num){ + outlink->sample_aspect_ratio = av_div_q((AVRational){1,1}, inlink->sample_aspect_ratio); + } else + outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; + av_log(ctx, AV_LOG_INFO, "w:%d h:%d dir:%d -> w:%d h:%d rotation:%s vflip:%d\n", inlink->w, inlink->h, trans->dir, outlink->w, outlink->h, trans->dir == 1 || trans->dir == 3 ? "clockwise" : "counterclockwise", diff --git a/mplayer/ffmpeg/libavfilter/vsrc_buffer.c b/mplayer/ffmpeg/libavfilter/vsrc_buffer.c index 74d9bf62..3c48a71c 100644 --- a/mplayer/ffmpeg/libavfilter/vsrc_buffer.c +++ b/mplayer/ffmpeg/libavfilter/vsrc_buffer.c @@ -25,7 +25,7 @@ #include "avfilter.h" #include "vsrc_buffer.h" -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" typedef struct { int64_t pts; diff --git a/mplayer/ffmpeg/libavfilter/vsrc_color.c b/mplayer/ffmpeg/libavfilter/vsrc_color.c new file mode 100644 index 00000000..3fab260a --- /dev/null +++ b/mplayer/ffmpeg/libavfilter/vsrc_color.c @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2010 Stefano Sabatini + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avfilter.h" +#include "libavutil/pixdesc.h" +#include "libavutil/colorspace.h" +#include "libavutil/imgutils.h" +#include "libavutil/parseutils.h" +#include "drawutils.h" + +typedef struct { + int w, h; + uint8_t color[4]; + AVRational time_base; + uint8_t *line[4]; + int line_step[4]; + int hsub, vsub; ///< chroma subsampling values + uint64_t pts; +} ColorContext; + +static av_cold int color_init(AVFilterContext *ctx, const char *args, void *opaque) +{ + ColorContext *color = ctx->priv; + char color_string[128] = "black"; + char frame_size [128] = "320x240"; + char frame_rate [128] = "25"; + AVRational frame_rate_q; + int ret; + + if (args) + sscanf(args, "%127[^:]:%127[^:]:%127s", color_string, frame_size, frame_rate); + + if (av_parse_video_size(&color->w, &color->h, frame_size) < 0) { + av_log(ctx, AV_LOG_ERROR, "Invalid frame size: %s\n", frame_size); + return AVERROR(EINVAL); + } + + if (av_parse_video_rate(&frame_rate_q, frame_rate) < 0 || + frame_rate_q.den <= 0 || frame_rate_q.num <= 0) { + av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: %s\n", frame_rate); + return AVERROR(EINVAL); + } + color->time_base.num = frame_rate_q.den; + color->time_base.den = frame_rate_q.num; + + if ((ret = av_parse_color(color->color, color_string, -1, ctx)) < 0) + return ret; + + return 0; +} + +static av_cold void color_uninit(AVFilterContext *ctx) +{ + ColorContext *color = ctx->priv; + int i; + + for (i = 0; i < 4; i++) { + av_freep(&color->line[i]); + color->line_step[i] = 0; + } +} + +static int query_formats(AVFilterContext *ctx) +{ + static const enum PixelFormat pix_fmts[] = { + PIX_FMT_ARGB, PIX_FMT_RGBA, + PIX_FMT_ABGR, PIX_FMT_BGRA, + PIX_FMT_RGB24, PIX_FMT_BGR24, + + PIX_FMT_YUV444P, PIX_FMT_YUV422P, + PIX_FMT_YUV420P, PIX_FMT_YUV411P, + PIX_FMT_YUV410P, PIX_FMT_YUV440P, + PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, + PIX_FMT_YUVJ420P, PIX_FMT_YUVJ440P, + PIX_FMT_YUVA420P, + + PIX_FMT_NONE + }; + + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +static int color_config_props(AVFilterLink *inlink) +{ + AVFilterContext *ctx = inlink->src; + ColorContext *color = ctx->priv; + uint8_t rgba_color[4]; + int is_packed_rgba; + const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format]; + + color->hsub = pix_desc->log2_chroma_w; + color->vsub = pix_desc->log2_chroma_h; + + color->w &= ~((1 << color->hsub) - 1); + color->h &= ~((1 << color->vsub) - 1); + if (av_image_check_size(color->w, color->h, 0, ctx) < 0) + return AVERROR(EINVAL); + + memcpy(rgba_color, color->color, sizeof(rgba_color)); + ff_fill_line_with_color(color->line, color->line_step, color->w, color->color, + inlink->format, rgba_color, &is_packed_rgba, NULL); + + av_log(ctx, AV_LOG_INFO, "w:%d h:%d r:%d/%d color:0x%02x%02x%02x%02x[%s]\n", + color->w, color->h, color->time_base.den, color->time_base.num, + color->color[0], color->color[1], color->color[2], color->color[3], + is_packed_rgba ? "rgba" : "yuva"); + inlink->w = color->w; + inlink->h = color->h; + + return 0; +} + +static int color_request_frame(AVFilterLink *link) +{ + ColorContext *color = link->src->priv; + AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h); + picref->video->pixel_aspect = (AVRational) {1, 1}; + picref->pts = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q); + picref->pos = 0; + + avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0)); + ff_draw_rectangle(picref->data, picref->linesize, + color->line, color->line_step, color->hsub, color->vsub, + 0, 0, color->w, color->h); + avfilter_draw_slice(link, 0, color->h, 1); + avfilter_end_frame(link); + avfilter_unref_buffer(picref); + + return 0; +} + +AVFilter avfilter_vsrc_color = { + .name = "color", + .description = NULL_IF_CONFIG_SMALL("Provide an uniformly colored input, syntax is: [color[:size[:rate]]]"), + + .priv_size = sizeof(ColorContext), + .init = color_init, + .uninit = color_uninit, + + .query_formats = query_formats, + + .inputs = (AVFilterPad[]) {{ .name = NULL}}, + + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .request_frame = color_request_frame, + .config_props = color_config_props }, + { .name = NULL}}, +}; diff --git a/mplayer/ffmpeg/libavfilter/vsrc_movie.c b/mplayer/ffmpeg/libavfilter/vsrc_movie.c new file mode 100644 index 00000000..fac30f9a --- /dev/null +++ b/mplayer/ffmpeg/libavfilter/vsrc_movie.c @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2010 Stefano Sabatini + * Copyright (c) 2008 Victor Paesa + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * movie video source + * + * @todo use direct rendering (no allocation of a new frame) + * @todo support a PTS correction mechanism + * @todo support more than one output stream + */ + +/* #define DEBUG */ + +#include +#include "libavutil/avstring.h" +#include "libavutil/opt.h" +#include "libavutil/imgutils.h" +#include "libavformat/avformat.h" +#include "avfilter.h" + +typedef struct { + const AVClass *class; + int64_t seek_point; ///< seekpoint in microseconds + double seek_point_d; + char *format_name; + char *file_name; + int stream_index; + + AVFormatContext *format_ctx; + AVCodecContext *codec_ctx; + int is_done; + AVFrame *frame; ///< video frame to store the decoded images in + + int w, h; + AVFilterBufferRef *picref; +} MovieContext; + +#define OFFSET(x) offsetof(MovieContext, x) + +static const AVOption movie_options[]= { +{"format_name", "set format name", OFFSET(format_name), FF_OPT_TYPE_STRING, 0, CHAR_MIN, CHAR_MAX }, +{"f", "set format name", OFFSET(format_name), FF_OPT_TYPE_STRING, 0, CHAR_MIN, CHAR_MAX }, +{"stream_index", "set stream index", OFFSET(stream_index), FF_OPT_TYPE_INT, -1, -1, INT_MAX }, +{"si", "set stream index", OFFSET(stream_index), FF_OPT_TYPE_INT, -1, -1, INT_MAX }, +{"seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), FF_OPT_TYPE_DOUBLE, 0, 0, (INT64_MAX-1) / 1000000 }, +{"sp", "set seekpoint (seconds)", OFFSET(seek_point_d), FF_OPT_TYPE_DOUBLE, 0, 0, (INT64_MAX-1) / 1000000 }, +{NULL}, +}; + +static const char *movie_get_name(void *ctx) +{ + return "movie"; +} + +static const AVClass movie_class = { + "MovieContext", + movie_get_name, + movie_options +}; + +static int movie_init(AVFilterContext *ctx) +{ + MovieContext *movie = ctx->priv; + AVInputFormat *iformat = NULL; + AVCodec *codec; + int ret; + int64_t timestamp; + + av_register_all(); + + // Try to find the movie format (container) + iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL; + + movie->format_ctx = NULL; + if ((ret = av_open_input_file(&movie->format_ctx, movie->file_name, iformat, 0, NULL)) < 0) { + av_log(ctx, AV_LOG_ERROR, + "Failed to av_open_input_file '%s'\n", movie->file_name); + return ret; + } + if ((ret = av_find_stream_info(movie->format_ctx)) < 0) + av_log(ctx, AV_LOG_WARNING, "Failed to find stream info\n"); + + // if seeking requested, we execute it + if (movie->seek_point > 0) { + timestamp = movie->seek_point; + // add the stream start time, should it exist + if (movie->format_ctx->start_time != AV_NOPTS_VALUE) { + if (timestamp > INT64_MAX - movie->format_ctx->start_time) { + av_log(ctx, AV_LOG_ERROR, + "%s: seek value overflow with start_time:%"PRId64" seek_point:%"PRId64"\n", + movie->file_name, movie->format_ctx->start_time, movie->seek_point); + return AVERROR(EINVAL); + } + timestamp += movie->format_ctx->start_time; + } + if ((ret = av_seek_frame(movie->format_ctx, -1, timestamp, AVSEEK_FLAG_BACKWARD)) < 0) { + av_log(ctx, AV_LOG_ERROR, "%s: could not seek to position %"PRId64"\n", + movie->file_name, timestamp); + return ret; + } + } + + /* select the video stream */ + if ((ret = av_find_best_stream(movie->format_ctx, AVMEDIA_TYPE_VIDEO, + movie->stream_index, -1, NULL, 0)) < 0) { + av_log(ctx, AV_LOG_ERROR, "No video stream with index '%d' found\n", + movie->stream_index); + return ret; + } + movie->stream_index = ret; + movie->codec_ctx = movie->format_ctx->streams[movie->stream_index]->codec; + + /* + * So now we've got a pointer to the so-called codec context for our video + * stream, but we still have to find the actual codec and open it. + */ + codec = avcodec_find_decoder(movie->codec_ctx->codec_id); + if (!codec) { + av_log(ctx, AV_LOG_ERROR, "Failed to find any codec\n"); + return AVERROR(EINVAL); + } + + if ((ret = avcodec_open(movie->codec_ctx, codec)) < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n"); + return ret; + } + + if (!(movie->frame = avcodec_alloc_frame()) ) { + av_log(ctx, AV_LOG_ERROR, "Failed to alloc frame\n"); + return AVERROR(ENOMEM); + } + + movie->w = movie->codec_ctx->width; + movie->h = movie->codec_ctx->height; + + av_log(ctx, AV_LOG_INFO, "seek_point:%lld format_name:%s file_name:%s stream_index:%d\n", + movie->seek_point, movie->format_name, movie->file_name, + movie->stream_index); + + return 0; +} + +static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) +{ + MovieContext *movie = ctx->priv; + int ret; + movie->class = &movie_class; + av_opt_set_defaults2(movie, 0, 0); + + if (args) + movie->file_name = av_get_token(&args, ":"); + if (!movie->file_name || !*movie->file_name) { + av_log(ctx, AV_LOG_ERROR, "No filename provided!\n"); + return AVERROR(EINVAL); + } + + if (*args++ == ':' && (ret = av_set_options_string(movie, args, "=", ":")) < 0) { + av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); + return ret; + } + + movie->seek_point = movie->seek_point_d * 1000000 + 0.5; + + return movie_init(ctx); +} + +static av_cold void uninit(AVFilterContext *ctx) +{ + MovieContext *movie = ctx->priv; + + av_free(movie->file_name); + av_free(movie->format_name); + if (movie->codec_ctx) + avcodec_close(movie->codec_ctx); + if (movie->format_ctx) + av_close_input_file(movie->format_ctx); + avfilter_unref_buffer(movie->picref); + av_freep(&movie->frame); +} + +static int query_formats(AVFilterContext *ctx) +{ + MovieContext *movie = ctx->priv; + enum PixelFormat pix_fmts[] = { movie->codec_ctx->pix_fmt, PIX_FMT_NONE }; + + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +static int config_output_props(AVFilterLink *outlink) +{ + MovieContext *movie = outlink->src->priv; + + outlink->w = movie->w; + outlink->h = movie->h; + outlink->time_base = movie->format_ctx->streams[movie->stream_index]->time_base; + + return 0; +} + +static int movie_get_frame(AVFilterLink *outlink) +{ + MovieContext *movie = outlink->src->priv; + AVPacket pkt; + int ret, frame_decoded; + AVStream *st = movie->format_ctx->streams[movie->stream_index]; + + if (movie->is_done == 1) + return 0; + + while ((ret = av_read_frame(movie->format_ctx, &pkt)) >= 0) { + // Is this a packet from the video stream? + if (pkt.stream_index == movie->stream_index) { + movie->codec_ctx->reordered_opaque = pkt.pos; + avcodec_decode_video2(movie->codec_ctx, movie->frame, &frame_decoded, &pkt); + + if (frame_decoded) { + /* FIXME: avoid the memcpy */ + movie->picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE | AV_PERM_PRESERVE | + AV_PERM_REUSE2, outlink->w, outlink->h); + av_image_copy(movie->picref->data, movie->picref->linesize, + movie->frame->data, movie->frame->linesize, + movie->picref->format, outlink->w, outlink->h); + + /* FIXME: use a PTS correction mechanism as that in + * ffplay.c when some API will be available for that */ + /* use pkt_dts if pkt_pts is not available */ + movie->picref->pts = movie->frame->pkt_pts == AV_NOPTS_VALUE ? + movie->frame->pkt_dts : movie->frame->pkt_pts; + + movie->picref->pos = movie->frame->reordered_opaque; + movie->picref->video->pixel_aspect = st->sample_aspect_ratio.num ? + st->sample_aspect_ratio : movie->codec_ctx->sample_aspect_ratio; + movie->picref->video->interlaced = movie->frame->interlaced_frame; + movie->picref->video->top_field_first = movie->frame->top_field_first; + av_dlog(outlink->src, + "movie_get_frame(): file:'%s' pts:%"PRId64" time:%lf pos:%"PRId64" aspect:%d/%d\n", + movie->file_name, movie->picref->pts, + (double)movie->picref->pts * av_q2d(st->time_base), + movie->picref->pos, + movie->picref->video->pixel_aspect.num, movie->picref->video->pixel_aspect.den); + // We got it. Free the packet since we are returning + av_free_packet(&pkt); + + return 0; + } + } + // Free the packet that was allocated by av_read_frame + av_free_packet(&pkt); + } + + // On multi-frame source we should stop the mixing process when + // the movie source does not have more frames + if (ret == AVERROR_EOF) + movie->is_done = 1; + return ret; +} + +static int request_frame(AVFilterLink *outlink) +{ + AVFilterBufferRef *outpicref; + MovieContext *movie = outlink->src->priv; + int ret; + + if (movie->is_done) + return AVERROR_EOF; + if ((ret = movie_get_frame(outlink)) < 0) + return ret; + + outpicref = avfilter_ref_buffer(movie->picref, ~0); + avfilter_start_frame(outlink, outpicref); + avfilter_draw_slice(outlink, 0, outlink->h, 1); + avfilter_end_frame(outlink); + + return 0; +} + +AVFilter avfilter_vsrc_movie = { + .name = "movie", + .description = NULL_IF_CONFIG_SMALL("Read from a movie source."), + .priv_size = sizeof(MovieContext), + .init = init, + .uninit = uninit, + .query_formats = query_formats, + + .inputs = (AVFilterPad[]) {{ .name = NULL }}, + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .request_frame = request_frame, + .config_props = config_output_props, }, + { .name = NULL}}, +}; diff --git a/mplayer/ffmpeg/libavfilter/vsrc_nullsrc.c b/mplayer/ffmpeg/libavfilter/vsrc_nullsrc.c index 1cd06e13..487aa500 100644 --- a/mplayer/ffmpeg/libavfilter/vsrc_nullsrc.c +++ b/mplayer/ffmpeg/libavfilter/vsrc_nullsrc.c @@ -23,7 +23,7 @@ #include "libavutil/avstring.h" #include "libavutil/eval.h" -#include "libavcore/parseutils.h" +#include "libavutil/parseutils.h" #include "avfilter.h" static const char *var_names[] = { diff --git a/mplayer/ffmpeg/libavformat/4xm.c b/mplayer/ffmpeg/libavformat/4xm.c index 6f737e34..2757e892 100644 --- a/mplayer/ffmpeg/libavformat/4xm.c +++ b/mplayer/ffmpeg/libavformat/4xm.c @@ -54,11 +54,11 @@ #define strk_SIZE 0x28 #define GET_LIST_HEADER() \ - fourcc_tag = get_le32(pb); \ - size = get_le32(pb); \ + fourcc_tag = avio_rl32(pb); \ + size = avio_rl32(pb); \ if (fourcc_tag != LIST_TAG) \ return AVERROR_INVALIDDATA; \ - fourcc_tag = get_le32(pb); + fourcc_tag = avio_rl32(pb); typedef struct AudioTrack { int sample_rate; @@ -92,7 +92,7 @@ static int fourxm_probe(AVProbeData *p) static int fourxm_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int fourcc_tag; unsigned int size; int header_size; @@ -106,7 +106,7 @@ static int fourxm_read_header(AVFormatContext *s, fourxm->fps = 1.0; /* skip the first 3 32-bit numbers */ - url_fseek(pb, 12, SEEK_CUR); + avio_seek(pb, 12, SEEK_CUR); /* check for LIST-HEAD */ GET_LIST_HEADER(); @@ -118,7 +118,7 @@ static int fourxm_read_header(AVFormatContext *s, header = av_malloc(header_size); if (!header) return AVERROR(ENOMEM); - if (get_buffer(pb, header, header_size) != header_size){ + if (avio_read(pb, header, header_size) != header_size){ av_free(header); return AVERROR(EIO); } @@ -244,7 +244,7 @@ static int fourxm_read_packet(AVFormatContext *s, AVPacket *pkt) { FourxmDemuxContext *fourxm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int fourcc_tag; unsigned int size, out_size; int ret = 0; @@ -255,7 +255,7 @@ static int fourxm_read_packet(AVFormatContext *s, while (!packet_read) { - if ((ret = get_buffer(s->pb, header, 8)) < 0) + if ((ret = avio_read(s->pb, header, 8)) < 0) return ret; fourcc_tag = AV_RL32(&header[0]); size = AV_RL32(&header[4]); @@ -268,7 +268,7 @@ static int fourxm_read_packet(AVFormatContext *s, fourxm->video_pts ++; /* skip the LIST-* tag and move on to the next fourcc */ - get_le32(pb); + avio_rl32(pb); break; case ifrm_TAG: @@ -285,7 +285,7 @@ static int fourxm_read_packet(AVFormatContext *s, pkt->pts = fourxm->video_pts; pkt->pos = url_ftell(s->pb); memcpy(pkt->data, header, 8); - ret = get_buffer(s->pb, &pkt->data[8], size); + ret = avio_read(s->pb, &pkt->data[8], size); if (ret < 0){ av_free_packet(pkt); @@ -294,8 +294,8 @@ static int fourxm_read_packet(AVFormatContext *s, break; case snd__TAG: - track_number = get_le32(pb); - out_size= get_le32(pb); + track_number = avio_rl32(pb); + out_size= avio_rl32(pb); size-=8; if (track_number < fourxm->track_count && fourxm->tracks[track_number].channels>0) { @@ -322,12 +322,12 @@ static int fourxm_read_packet(AVFormatContext *s, fourxm->tracks[track_number].audio_pts += audio_frame_count; } else { - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); } break; default: - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); break; } } diff --git a/mplayer/ffmpeg/libavformat/Makefile b/mplayer/ffmpeg/libavformat/Makefile index 8f583e04..f319031c 100644 --- a/mplayer/ffmpeg/libavformat/Makefile +++ b/mplayer/ffmpeg/libavformat/Makefile @@ -1,7 +1,7 @@ include $(SUBDIR)../config.mak NAME = avformat -FFLIBS = avcodec avcore avutil +FFLIBS = avcodec avutil HEADERS = avformat.h avio.h version.h @@ -128,7 +128,8 @@ OBJS-$(CONFIG_MM_DEMUXER) += mm.o OBJS-$(CONFIG_MMF_DEMUXER) += mmf.o pcm.o OBJS-$(CONFIG_MMF_MUXER) += mmf.o riff.o OBJS-$(CONFIG_MOV_DEMUXER) += mov.o riff.o isom.o -OBJS-$(CONFIG_MOV_MUXER) += movenc.o riff.o isom.o avc.o movenchint.o +OBJS-$(CONFIG_MOV_MUXER) += movenc.o riff.o isom.o avc.o \ + movenchint.o rtpenc_chain.o OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o OBJS-$(CONFIG_MP3_DEMUXER) += mp3dec.o OBJS-$(CONFIG_MP3_MUXER) += mp3enc.o diff --git a/mplayer/ffmpeg/libavformat/a64.c b/mplayer/ffmpeg/libavformat/a64.c index 46441b23..17dcd96b 100644 --- a/mplayer/ffmpeg/libavformat/a64.c +++ b/mplayer/ffmpeg/libavformat/a64.c @@ -57,7 +57,7 @@ static int a64_write_header(struct AVFormatContext *s) return AVERROR(EINVAL); break; } - put_buffer(s->pb, header, 2); + avio_write(s->pb, header, 2); c->prev_pkt.size = 0; c->prev_frame_count = 0; return 0; @@ -110,18 +110,18 @@ static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt) for(i = 0; i < num_frames; i++) { if(pkt->data) { /* if available, put newest charset chunk into buffer */ - put_buffer(s->pb, pkt->data + ch_chunksize * i, ch_chunksize); + avio_write(s->pb, pkt->data + ch_chunksize * i, ch_chunksize); } else { /* a bit ugly, but is there an alternative to put many zeros? */ - for(j = 0; j < ch_chunksize; j++) put_byte(s->pb, 0); + for(j = 0; j < ch_chunksize; j++) avio_w8(s->pb, 0); } if(c->prev_pkt.data) { /* put frame (screen + colram) from last packet into buffer */ - put_buffer(s->pb, c->prev_pkt.data + charset_size + frame_size * i, frame_size); + avio_write(s->pb, c->prev_pkt.data + charset_size + frame_size * i, frame_size); } else { /* a bit ugly, but is there an alternative to put many zeros? */ - for(j = 0; j < frame_size; j++) put_byte(s->pb, 0); + for(j = 0; j < frame_size; j++) avio_w8(s->pb, 0); } } @@ -145,7 +145,7 @@ static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt) default: /* Write things as is. Nice for self-contained frames from non-multicolor modes or if played * directly from ram and not from a streaming device (rrnet/mmc) */ - if(pkt) put_buffer(s->pb, pkt->data, pkt->size); + if(pkt) avio_write(s->pb, pkt->data, pkt->size); break; } diff --git a/mplayer/ffmpeg/libavformat/adtsenc.c b/mplayer/ffmpeg/libavformat/adtsenc.c index f309c896..1f5453db 100644 --- a/mplayer/ffmpeg/libavformat/adtsenc.c +++ b/mplayer/ffmpeg/libavformat/adtsenc.c @@ -118,20 +118,20 @@ int ff_adts_write_frame_header(ADTSContext *ctx, static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) { ADTSContext *adts = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint8_t buf[ADTS_HEADER_SIZE]; if (!pkt->size) return 0; if (adts->write_adts) { ff_adts_write_frame_header(adts, buf, pkt->size, adts->pce_size); - put_buffer(pb, buf, ADTS_HEADER_SIZE); + avio_write(pb, buf, ADTS_HEADER_SIZE); if (adts->pce_size) { - put_buffer(pb, adts->pce_data, adts->pce_size); + avio_write(pb, adts->pce_data, adts->pce_size); adts->pce_size = 0; } } - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); put_flush_packet(pb); return 0; diff --git a/mplayer/ffmpeg/libavformat/aea.c b/mplayer/ffmpeg/libavformat/aea.c index 6816506e..60b2d38f 100644 --- a/mplayer/ffmpeg/libavformat/aea.c +++ b/mplayer/ffmpeg/libavformat/aea.c @@ -23,6 +23,7 @@ #include "avformat.h" #include "pcm.h" #include "libavutil/intreadwrite.h" +#include "libavutil/audioconvert.h" #define AT1_SU_SIZE 212 @@ -61,9 +62,9 @@ static int aea_read_header(AVFormatContext *s, return AVERROR(ENOMEM); /* Parse the amount of channels and skip to pos 2048(0x800) */ - url_fskip(s->pb, 264); - st->codec->channels = get_byte(s->pb); - url_fskip(s->pb, 1783); + avio_seek(s->pb, 264, SEEK_CUR); + st->codec->channels = avio_r8(s->pb); + avio_seek(s->pb, 1783, SEEK_CUR); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -76,7 +77,7 @@ static int aea_read_header(AVFormatContext *s, return -1; } - st->codec->channel_layout = (st->codec->channels == 1) ? CH_LAYOUT_MONO : CH_LAYOUT_STEREO; + st->codec->channel_layout = (st->codec->channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; st->codec->block_align = AT1_SU_SIZE * st->codec->channels; return 0; diff --git a/mplayer/ffmpeg/libavformat/aiffdec.c b/mplayer/ffmpeg/libavformat/aiffdec.c index b8410237..849793a1 100644 --- a/mplayer/ffmpeg/libavformat/aiffdec.c +++ b/mplayer/ffmpeg/libavformat/aiffdec.c @@ -47,15 +47,15 @@ static enum CodecID aiff_codec_get_id(int bps) } /* returns the size of the found tag */ -static int get_tag(ByteIOContext *pb, uint32_t * tag) +static int get_tag(AVIOContext *pb, uint32_t * tag) { int size; if (url_feof(pb)) return AVERROR(EIO); - *tag = get_le32(pb); - size = get_be32(pb); + *tag = avio_rl32(pb); + size = avio_rb32(pb); if (size < 0) size = 0x7fffffff; @@ -70,11 +70,11 @@ static void get_meta(AVFormatContext *s, const char *key, int size) int res; if (!str) { - url_fskip(s->pb, size); + avio_seek(s->pb, size, SEEK_CUR); return; } - res = get_buffer(s->pb, str, size); + res = avio_read(s->pb, str, size); if (res < 0) return; @@ -83,7 +83,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size) } /* Returns the number of sound data frames or negative on error */ -static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec, +static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec, int size, unsigned version) { AVExtFloat ext; @@ -93,18 +93,18 @@ static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec, if (size & 1) size++; codec->codec_type = AVMEDIA_TYPE_AUDIO; - codec->channels = get_be16(pb); - num_frames = get_be32(pb); - codec->bits_per_coded_sample = get_be16(pb); + codec->channels = avio_rb16(pb); + num_frames = avio_rb32(pb); + codec->bits_per_coded_sample = avio_rb16(pb); - get_buffer(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */ + avio_read(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */ sample_rate = av_ext2dbl(ext); /* 80 bits BE IEEE extended float */ codec->sample_rate = sample_rate; size -= 18; /* Got an AIFF-C? */ if (version == AIFF_C_VERSION1) { - codec->codec_tag = get_le32(pb); + codec->codec_tag = avio_rl32(pb); codec->codec_id = ff_codec_get_id(ff_codec_aiff_tags, codec->codec_tag); switch (codec->codec_id) { @@ -152,7 +152,7 @@ static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec, /* Chunk is over */ if (size) - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); return num_frames; } @@ -177,7 +177,7 @@ static int aiff_read_header(AVFormatContext *s, int64_t offset = 0; uint32_t tag; unsigned version = AIFF_C_VERSION1; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream * st; AIFFInputContext *aiff = s->priv_data; @@ -187,7 +187,7 @@ static int aiff_read_header(AVFormatContext *s, return AVERROR_INVALIDDATA; /* AIFF data type */ - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag == MKTAG('A', 'I', 'F', 'F')) /* Got an AIFF file */ version = AIFF; else if (tag != MKTAG('A', 'I', 'F', 'C')) /* An AIFF-C file then */ @@ -217,7 +217,7 @@ static int aiff_read_header(AVFormatContext *s, goto got_sound; break; case MKTAG('F', 'V', 'E', 'R'): /* Version chunk */ - version = get_be32(pb); + version = avio_rb32(pb); break; case MKTAG('N', 'A', 'M', 'E'): /* Sample name chunk */ get_meta(s, "title" , size); @@ -233,8 +233,8 @@ static int aiff_read_header(AVFormatContext *s, break; case MKTAG('S', 'S', 'N', 'D'): /* Sampled sound chunk */ aiff->data_end = url_ftell(pb) + size; - offset = get_be32(pb); /* Offset of sound data */ - get_be32(pb); /* BlockSize... don't care */ + offset = avio_rb32(pb); /* Offset of sound data */ + avio_rb32(pb); /* BlockSize... don't care */ offset += url_ftell(pb); /* Compute absolute data offset */ if (st->codec->block_align) /* Assume COMM already parsed */ goto got_sound; @@ -242,7 +242,7 @@ static int aiff_read_header(AVFormatContext *s, av_log(s, AV_LOG_ERROR, "file is not seekable\n"); return -1; } - url_fskip(pb, size - 8); + avio_seek(pb, size - 8, SEEK_CUR); break; case MKTAG('w', 'a', 'v', 'e'): if ((uint64_t)size > (1<<30)) @@ -251,12 +251,12 @@ static int aiff_read_header(AVFormatContext *s, if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = size; - get_buffer(pb, st->codec->extradata, size); + avio_read(pb, st->codec->extradata, size); break; default: /* Jump */ if (size & 1) /* Always even aligned */ size++; - url_fskip (pb, size); + avio_seek(pb, size, SEEK_CUR); } } @@ -276,7 +276,7 @@ static int aiff_read_header(AVFormatContext *s, st->nb_frames * st->codec->frame_size : st->nb_frames; /* Position the stream at the first block */ - url_fseek(pb, offset, SEEK_SET); + avio_seek(pb, offset, SEEK_SET); return 0; } diff --git a/mplayer/ffmpeg/libavformat/aiffenc.c b/mplayer/ffmpeg/libavformat/aiffenc.c index 6e473907..150f36bd 100644 --- a/mplayer/ffmpeg/libavformat/aiffenc.c +++ b/mplayer/ffmpeg/libavformat/aiffenc.c @@ -21,6 +21,7 @@ #include "avformat.h" #include "aiff.h" +#include "avio_internal.h" typedef struct { int64_t form; @@ -31,7 +32,7 @@ typedef struct { static int aiff_write_header(AVFormatContext *s) { AIFFOutputContext *aiff = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; AVExtFloat sample_rate; int aifc = 0; @@ -43,10 +44,10 @@ static int aiff_write_header(AVFormatContext *s) aifc = 1; /* FORM AIFF header */ - put_tag(pb, "FORM"); + ffio_wfourcc(pb, "FORM"); aiff->form = url_ftell(pb); - put_be32(pb, 0); /* file length */ - put_tag(pb, aifc ? "AIFC" : "AIFF"); + avio_wb32(pb, 0); /* file length */ + ffio_wfourcc(pb, aifc ? "AIFC" : "AIFF"); if (aifc) { // compressed audio enc->bits_per_coded_sample = 16; @@ -55,18 +56,18 @@ static int aiff_write_header(AVFormatContext *s) return -1; } /* Version chunk */ - put_tag(pb, "FVER"); - put_be32(pb, 4); - put_be32(pb, 0xA2805140); + ffio_wfourcc(pb, "FVER"); + avio_wb32(pb, 4); + avio_wb32(pb, 0xA2805140); } /* Common chunk */ - put_tag(pb, "COMM"); - put_be32(pb, aifc ? 24 : 18); /* size */ - put_be16(pb, enc->channels); /* Number of channels */ + ffio_wfourcc(pb, "COMM"); + avio_wb32(pb, aifc ? 24 : 18); /* size */ + avio_wb16(pb, enc->channels); /* Number of channels */ aiff->frames = url_ftell(pb); - put_be32(pb, 0); /* Number of frames */ + avio_wb32(pb, 0); /* Number of frames */ if (!enc->bits_per_coded_sample) enc->bits_per_coded_sample = av_get_bits_per_sample(enc->codec_id); @@ -77,22 +78,22 @@ static int aiff_write_header(AVFormatContext *s) if (!enc->block_align) enc->block_align = (enc->bits_per_coded_sample * enc->channels) >> 3; - put_be16(pb, enc->bits_per_coded_sample); /* Sample size */ + avio_wb16(pb, enc->bits_per_coded_sample); /* Sample size */ sample_rate = av_dbl2ext((double)enc->sample_rate); - put_buffer(pb, (uint8_t*)&sample_rate, sizeof(sample_rate)); + avio_write(pb, (uint8_t*)&sample_rate, sizeof(sample_rate)); if (aifc) { - put_le32(pb, enc->codec_tag); - put_be16(pb, 0); + avio_wl32(pb, enc->codec_tag); + avio_wb16(pb, 0); } /* Sound data chunk */ - put_tag(pb, "SSND"); + ffio_wfourcc(pb, "SSND"); aiff->ssnd = url_ftell(pb); /* Sound chunk size */ - put_be32(pb, 0); /* Sound samples data size */ - put_be32(pb, 0); /* Data offset */ - put_be32(pb, 0); /* Block-size (block align) */ + avio_wb32(pb, 0); /* Sound samples data size */ + avio_wb32(pb, 0); /* Data offset */ + avio_wb32(pb, 0); /* Block-size (block align) */ av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate); @@ -104,14 +105,14 @@ static int aiff_write_header(AVFormatContext *s) static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; - put_buffer(pb, pkt->data, pkt->size); + AVIOContext *pb = s->pb; + avio_write(pb, pkt->data, pkt->size); return 0; } static int aiff_write_trailer(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AIFFOutputContext *aiff = s->priv_data; AVCodecContext *enc = s->streams[0]->codec; @@ -119,25 +120,25 @@ static int aiff_write_trailer(AVFormatContext *s) int64_t file_size, end_size; end_size = file_size = url_ftell(pb); if (file_size & 1) { - put_byte(pb, 0); + avio_w8(pb, 0); end_size++; } if (!url_is_streamed(s->pb)) { /* File length */ - url_fseek(pb, aiff->form, SEEK_SET); - put_be32(pb, file_size - aiff->form - 4); + avio_seek(pb, aiff->form, SEEK_SET); + avio_wb32(pb, file_size - aiff->form - 4); /* Number of sample frames */ - url_fseek(pb, aiff->frames, SEEK_SET); - put_be32(pb, (file_size-aiff->ssnd-12)/enc->block_align); + avio_seek(pb, aiff->frames, SEEK_SET); + avio_wb32(pb, (file_size-aiff->ssnd-12)/enc->block_align); /* Sound Data chunk size */ - url_fseek(pb, aiff->ssnd, SEEK_SET); - put_be32(pb, file_size - aiff->ssnd - 4); + avio_seek(pb, aiff->ssnd, SEEK_SET); + avio_wb32(pb, file_size - aiff->ssnd - 4); /* return to the end */ - url_fseek(pb, end_size, SEEK_SET); + avio_seek(pb, end_size, SEEK_SET); put_flush_packet(pb); } diff --git a/mplayer/ffmpeg/libavformat/amr.c b/mplayer/ffmpeg/libavformat/amr.c index 11bb4e51..fd43283a 100644 --- a/mplayer/ffmpeg/libavformat/amr.c +++ b/mplayer/ffmpeg/libavformat/amr.c @@ -33,18 +33,18 @@ static const char AMRWB_header [] = "#!AMR-WB\n"; #if CONFIG_AMR_MUXER static int amr_write_header(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; s->priv_data = NULL; if (enc->codec_id == CODEC_ID_AMR_NB) { - put_tag(pb, AMR_header); /* magic number */ + avio_write(pb, AMR_header, sizeof(AMR_header) - 1); /* magic number */ } else if(enc->codec_id == CODEC_ID_AMR_WB) { - put_tag(pb, AMRWB_header); /* magic number */ + avio_write(pb, AMRWB_header, sizeof(AMRWB_header) - 1); /* magic number */ } else { @@ -56,7 +56,7 @@ static int amr_write_header(AVFormatContext *s) static int amr_write_packet(AVFormatContext *s, AVPacket *pkt) { - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, pkt->data, pkt->size); put_flush_packet(s->pb); return 0; } @@ -78,11 +78,11 @@ static int amr_probe(AVProbeData *p) static int amr_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; uint8_t header[9]; - get_buffer(pb, header, 6); + avio_read(pb, header, 6); st = av_new_stream(s, 0); if (!st) @@ -91,7 +91,7 @@ static int amr_read_header(AVFormatContext *s, } if(memcmp(header,AMR_header,6)!=0) { - get_buffer(pb, header+6, 3); + avio_read(pb, header+6, 3); if(memcmp(header,AMRWB_header,9)!=0) { return -1; @@ -128,7 +128,7 @@ static int amr_read_packet(AVFormatContext *s, } //FIXME this is wrong, this should rather be in a AVParset - toc=get_byte(s->pb); + toc=avio_r8(s->pb); mode = (toc >> 3) & 0x0F; if (enc->codec_id == CODEC_ID_AMR_NB) @@ -157,7 +157,7 @@ static int amr_read_packet(AVFormatContext *s, pkt->pos= url_ftell(s->pb); pkt->data[0]=toc; pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320; - read = get_buffer(s->pb, pkt->data+1, size-1); + read = avio_read(s->pb, pkt->data+1, size-1); if (read != size-1) { diff --git a/mplayer/ffmpeg/libavformat/anm.c b/mplayer/ffmpeg/libavformat/anm.c index dbe1b688..060cc9a0 100644 --- a/mplayer/ffmpeg/libavformat/anm.c +++ b/mplayer/ffmpeg/libavformat/anm.c @@ -79,21 +79,21 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { AnmDemuxContext *anm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; int i, ret; - url_fskip(pb, 4); /* magic number */ - if (get_le16(pb) != MAX_PAGES) { + avio_seek(pb, 4, SEEK_CUR); /* magic number */ + if (avio_rl16(pb) != MAX_PAGES) { av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n"); return AVERROR_INVALIDDATA; } - anm->nb_pages = get_le16(pb); - anm->nb_records = get_le32(pb); - url_fskip(pb, 2); /* max records per page */ - anm->page_table_offset = get_le16(pb); - if (get_le32(pb) != ANIM_TAG) + anm->nb_pages = avio_rl16(pb); + anm->nb_records = avio_rl32(pb); + avio_seek(pb, 2, SEEK_CUR); /* max records per page */ + anm->page_table_offset = avio_rl16(pb); + if (avio_rl32(pb) != ANIM_TAG) return AVERROR_INVALIDDATA; /* video stream */ @@ -103,33 +103,33 @@ static int read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_ANM; st->codec->codec_tag = 0; /* no fourcc */ - st->codec->width = get_le16(pb); - st->codec->height = get_le16(pb); - if (get_byte(pb) != 0) + st->codec->width = avio_rl16(pb); + st->codec->height = avio_rl16(pb); + if (avio_r8(pb) != 0) goto invalid; - url_fskip(pb, 1); /* frame rate multiplier info */ + avio_seek(pb, 1, SEEK_CUR); /* frame rate multiplier info */ /* ignore last delta record (used for looping) */ - if (get_byte(pb)) /* has_last_delta */ + if (avio_r8(pb)) /* has_last_delta */ anm->nb_records = FFMAX(anm->nb_records - 1, 0); - url_fskip(pb, 1); /* last_delta_valid */ + avio_seek(pb, 1, SEEK_CUR); /* last_delta_valid */ - if (get_byte(pb) != 0) + if (avio_r8(pb) != 0) goto invalid; - if (get_byte(pb) != 1) + if (avio_r8(pb) != 1) goto invalid; - url_fskip(pb, 1); /* other recs per frame */ + avio_seek(pb, 1, SEEK_CUR); /* other recs per frame */ - if (get_byte(pb) != 1) + if (avio_r8(pb) != 1) goto invalid; - url_fskip(pb, 32); /* record_types */ - st->nb_frames = get_le32(pb); - av_set_pts_info(st, 64, 1, get_le16(pb)); - url_fskip(pb, 58); + avio_seek(pb, 32, SEEK_CUR); /* record_types */ + st->nb_frames = avio_rl32(pb); + av_set_pts_info(st, 64, 1, avio_rl16(pb)); + avio_seek(pb, 58, SEEK_CUR); /* color cycling and palette data */ st->codec->extradata_size = 16*8 + 4*256; @@ -138,20 +138,20 @@ static int read_header(AVFormatContext *s, ret = AVERROR(ENOMEM); goto close_and_return; } - ret = get_buffer(pb, st->codec->extradata, st->codec->extradata_size); + ret = avio_read(pb, st->codec->extradata, st->codec->extradata_size); if (ret < 0) goto close_and_return; /* read page table */ - ret = url_fseek(pb, anm->page_table_offset, SEEK_SET); + ret = avio_seek(pb, anm->page_table_offset, SEEK_SET); if (ret < 0) goto close_and_return; for (i = 0; i < MAX_PAGES; i++) { Page *p = &anm->pt[i]; - p->base_record = get_le16(pb); - p->nb_records = get_le16(pb); - p->size = get_le16(pb); + p->base_record = avio_rl16(pb); + p->nb_records = avio_rl16(pb); + p->size = avio_rl16(pb); } /* find page of first frame */ @@ -177,7 +177,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) { AnmDemuxContext *anm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; Page *p; int tmp, record_size; @@ -192,8 +192,8 @@ static int read_packet(AVFormatContext *s, /* parse page header */ if (anm->record < 0) { - url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SEEK_SET); - url_fskip(pb, 8 + 2*p->nb_records); + avio_seek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SEEK_SET); + avio_seek(pb, 8 + 2*p->nb_records, SEEK_CUR); anm->record = 0; } @@ -209,10 +209,10 @@ static int read_packet(AVFormatContext *s, /* fetch record size */ tmp = url_ftell(pb); - url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) + + avio_seek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) + 8 + anm->record * 2, SEEK_SET); - record_size = get_le16(pb); - url_fseek(pb, tmp, SEEK_SET); + record_size = avio_rl16(pb); + avio_seek(pb, tmp, SEEK_SET); /* fetch record */ pkt->size = av_get_packet(s->pb, pkt, record_size); diff --git a/mplayer/ffmpeg/libavformat/apc.c b/mplayer/ffmpeg/libavformat/apc.c index 942a4cf3..bf93fc15 100644 --- a/mplayer/ffmpeg/libavformat/apc.c +++ b/mplayer/ffmpeg/libavformat/apc.c @@ -32,12 +32,12 @@ static int apc_probe(AVProbeData *p) static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; - get_le32(pb); /* CRYO */ - get_le32(pb); /* _APC */ - get_le32(pb); /* 1.20 */ + avio_rl32(pb); /* CRYO */ + avio_rl32(pb); /* _APC */ + avio_rl32(pb); /* 1.20 */ st = av_new_stream(s, 0); if (!st) @@ -46,8 +46,8 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS; - get_le32(pb); /* number of samples */ - st->codec->sample_rate = get_le32(pb); + avio_rl32(pb); /* number of samples */ + st->codec->sample_rate = avio_rl32(pb); st->codec->extradata_size = 2 * 4; st->codec->extradata = av_malloc(st->codec->extradata_size + @@ -56,10 +56,10 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR(ENOMEM); /* initial predictor values for adpcm decoder */ - get_buffer(pb, st->codec->extradata, 2 * 4); + avio_read(pb, st->codec->extradata, 2 * 4); st->codec->channels = 1; - if (get_le32(pb)) + if (avio_rl32(pb)) st->codec->channels = 2; st->codec->bits_per_coded_sample = 4; diff --git a/mplayer/ffmpeg/libavformat/ape.c b/mplayer/ffmpeg/libavformat/ape.c index 327e1a9b..2de47ef4 100644 --- a/mplayer/ffmpeg/libavformat/ape.c +++ b/mplayer/ffmpeg/libavformat/ape.c @@ -151,7 +151,7 @@ static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx) static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; APEContext *ape = s->priv_data; AVStream *st; uint32_t tag; @@ -162,11 +162,11 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) /* TODO: Skip any leading junk such as id3v2 tags */ ape->junklength = 0; - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag != MKTAG('M', 'A', 'C', ' ')) return -1; - ape->fileversion = get_le16(pb); + ape->fileversion = avio_rl16(pb); if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) { av_log(s, AV_LOG_ERROR, "Unsupported file version - %d.%02d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10); @@ -174,50 +174,50 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) } if (ape->fileversion >= 3980) { - ape->padding1 = get_le16(pb); - ape->descriptorlength = get_le32(pb); - ape->headerlength = get_le32(pb); - ape->seektablelength = get_le32(pb); - ape->wavheaderlength = get_le32(pb); - ape->audiodatalength = get_le32(pb); - ape->audiodatalength_high = get_le32(pb); - ape->wavtaillength = get_le32(pb); - get_buffer(pb, ape->md5, 16); + ape->padding1 = avio_rl16(pb); + ape->descriptorlength = avio_rl32(pb); + ape->headerlength = avio_rl32(pb); + ape->seektablelength = avio_rl32(pb); + ape->wavheaderlength = avio_rl32(pb); + ape->audiodatalength = avio_rl32(pb); + ape->audiodatalength_high = avio_rl32(pb); + ape->wavtaillength = avio_rl32(pb); + avio_read(pb, ape->md5, 16); /* Skip any unknown bytes at the end of the descriptor. This is for future compatibility */ if (ape->descriptorlength > 52) - url_fseek(pb, ape->descriptorlength - 52, SEEK_CUR); + avio_seek(pb, ape->descriptorlength - 52, SEEK_CUR); /* Read header data */ - ape->compressiontype = get_le16(pb); - ape->formatflags = get_le16(pb); - ape->blocksperframe = get_le32(pb); - ape->finalframeblocks = get_le32(pb); - ape->totalframes = get_le32(pb); - ape->bps = get_le16(pb); - ape->channels = get_le16(pb); - ape->samplerate = get_le32(pb); + ape->compressiontype = avio_rl16(pb); + ape->formatflags = avio_rl16(pb); + ape->blocksperframe = avio_rl32(pb); + ape->finalframeblocks = avio_rl32(pb); + ape->totalframes = avio_rl32(pb); + ape->bps = avio_rl16(pb); + ape->channels = avio_rl16(pb); + ape->samplerate = avio_rl32(pb); } else { ape->descriptorlength = 0; ape->headerlength = 32; - ape->compressiontype = get_le16(pb); - ape->formatflags = get_le16(pb); - ape->channels = get_le16(pb); - ape->samplerate = get_le32(pb); - ape->wavheaderlength = get_le32(pb); - ape->wavtaillength = get_le32(pb); - ape->totalframes = get_le32(pb); - ape->finalframeblocks = get_le32(pb); + ape->compressiontype = avio_rl16(pb); + ape->formatflags = avio_rl16(pb); + ape->channels = avio_rl16(pb); + ape->samplerate = avio_rl32(pb); + ape->wavheaderlength = avio_rl32(pb); + ape->wavtaillength = avio_rl32(pb); + ape->totalframes = avio_rl32(pb); + ape->finalframeblocks = avio_rl32(pb); if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) { - url_fseek(pb, 4, SEEK_CUR); /* Skip the peak level */ + avio_seek(pb, 4, SEEK_CUR); /* Skip the peak level */ ape->headerlength += 4; } if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) { - ape->seektablelength = get_le32(pb); + ape->seektablelength = avio_rl32(pb); ape->headerlength += 4; ape->seektablelength *= sizeof(int32_t); } else @@ -239,7 +239,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) /* Skip any stored wav header */ if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER)) - url_fskip(pb, ape->wavheaderlength); + avio_seek(pb, ape->wavheaderlength, SEEK_CUR); } if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){ @@ -260,7 +260,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) if (ape->seektablelength > 0) { ape->seektable = av_malloc(ape->seektablelength); for (i = 0; i < ape->seektablelength / sizeof(uint32_t); i++) - ape->seektable[i] = get_le32(pb); + ape->seektable[i] = avio_rl32(pb); } ape->frames[0].pos = ape->firstframe; @@ -289,7 +289,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) /* try to read APE tags */ if (!url_is_streamed(pb)) { ff_ape_parse_tag(s); - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); } av_log(s, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10, ape->compressiontype); @@ -342,7 +342,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) if (ape->currentframe > ape->totalframes) return AVERROR(EIO); - url_fseek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET); + avio_seek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET); /* Calculate how many blocks there are in this frame */ if (ape->currentframe == (ape->totalframes - 1)) @@ -355,7 +355,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) AV_WL32(pkt->data , nblocks); AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip); - ret = get_buffer(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size); + ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size); pkt->pts = ape->frames[ape->currentframe].pts; pkt->stream_index = 0; diff --git a/mplayer/ffmpeg/libavformat/apetag.c b/mplayer/ffmpeg/libavformat/apetag.c index d30c1322..c3c57717 100644 --- a/mplayer/ffmpeg/libavformat/apetag.c +++ b/mplayer/ffmpeg/libavformat/apetag.c @@ -33,15 +33,15 @@ static int ape_tag_read_field(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint8_t key[1024], *value; uint32_t size, flags; int i, c; - size = get_le32(pb); /* field size */ - flags = get_le32(pb); /* field flags */ + size = avio_rl32(pb); /* field size */ + flags = avio_rl32(pb); /* field flags */ for (i = 0; i < sizeof(key) - 1; i++) { - c = get_byte(pb); + c = avio_r8(pb); if (c < 0x20 || c > 0x7E) break; else @@ -57,7 +57,7 @@ static int ape_tag_read_field(AVFormatContext *s) value = av_malloc(size+1); if (!value) return AVERROR(ENOMEM); - get_buffer(pb, value, size); + avio_read(pb, value, size); value[size] = 0; av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL); return 0; @@ -65,7 +65,7 @@ static int ape_tag_read_field(AVFormatContext *s) void ff_ape_parse_tag(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int file_size = url_fsize(pb); uint32_t val, fields, tag_bytes; uint8_t buf[8]; @@ -74,38 +74,38 @@ void ff_ape_parse_tag(AVFormatContext *s) if (file_size < APE_TAG_FOOTER_BYTES) return; - url_fseek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET); + avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET); - get_buffer(pb, buf, 8); /* APETAGEX */ + avio_read(pb, buf, 8); /* APETAGEX */ if (strncmp(buf, "APETAGEX", 8)) { return; } - val = get_le32(pb); /* APE tag version */ + val = avio_rl32(pb); /* APE tag version */ if (val > APE_TAG_VERSION) { av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION); return; } - tag_bytes = get_le32(pb); /* tag size */ + tag_bytes = avio_rl32(pb); /* tag size */ if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) { av_log(s, AV_LOG_ERROR, "Tag size is way too big\n"); return; } - fields = get_le32(pb); /* number of fields */ + fields = avio_rl32(pb); /* number of fields */ if (fields > 65536) { av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields); return; } - val = get_le32(pb); /* flags */ + val = avio_rl32(pb); /* flags */ if (val & APE_TAG_FLAG_IS_HEADER) { av_log(s, AV_LOG_ERROR, "APE Tag is a header\n"); return; } - url_fseek(pb, file_size - tag_bytes, SEEK_SET); + avio_seek(pb, file_size - tag_bytes, SEEK_SET); for (i=0; i 0 && isspace(buf[len - 1])) @@ -90,6 +90,20 @@ static void make_absolute_url(char *buf, int size, const char *base, const char *rel) { char *sep; + /* Absolute path, relative to the current server */ + if (base && strstr(base, "://") && rel[0] == '/') { + if (base != buf) + av_strlcpy(buf, base, size); + sep = strstr(buf, "://"); + if (sep) { + sep += 3; + sep = strchr(sep, '/'); + if (sep) + *sep = '\0'; + } + av_strlcat(buf, rel, size); + return; + } /* If rel actually is an absolute url, just copy it */ if (!base || strstr(rel, "://") || rel[0] == '/') { av_strlcpy(buf, rel, size); @@ -140,7 +154,7 @@ static void free_variant_list(AppleHTTPContext *c) free_segment_list(var); av_free_packet(&var->pkt); if (var->pb) - url_fclose(var->pb); + avio_close(var->pb); if (var->ctx) { var->ctx->pb = NULL; av_close_input_file(var->ctx); @@ -188,7 +202,7 @@ static void handle_variant_args(struct variant_info *info, const char *key, } static int parse_playlist(AppleHTTPContext *c, const char *url, - struct variant *var, ByteIOContext *in) + struct variant *var, AVIOContext *in) { int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0; char line[1024]; @@ -197,7 +211,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url, if (!in) { close_in = 1; - if ((ret = url_fopen(&in, url, URL_RDONLY)) < 0) + if ((ret = avio_open(&in, url, URL_RDONLY)) < 0) return ret; } @@ -270,7 +284,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url, fail: if (close_in) - url_fclose(in); + avio_close(in); return ret; } @@ -324,7 +338,7 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) ret = av_open_input_file(&v->ctx, v->segments[0]->url, NULL, 0, NULL); if (ret < 0) goto fail; - url_fclose(v->ctx->pb); + avio_close(v->ctx->pb); v->ctx->pb = NULL; v->stream_offset = stream_offset; /* Create new AVStreams for each stream in this variant */ @@ -364,7 +378,7 @@ static int open_variant(AppleHTTPContext *c, struct variant *var, int skip) } if (c->cur_seq_no - var->start_seq_no >= var->n_segments) return c->finished ? AVERROR_EOF : 0; - ret = url_fopen(&var->pb, + ret = avio_open(&var->pb, var->segments[c->cur_seq_no - var->start_seq_no]->url, URL_RDONLY); if (ret < 0) @@ -421,7 +435,7 @@ static int applehttp_read_packet(AVFormatContext *s, AVPacket *pkt) "Closing variant stream %d, no longer needed\n", i); av_free_packet(&var->pkt); reset_packet(&var->pkt); - url_fclose(var->pb); + avio_close(var->pb); var->pb = NULL; changed = 1; } else if (!var->pb && var->needed) { @@ -470,7 +484,7 @@ static int applehttp_read_packet(AVFormatContext *s, AVPacket *pkt) for (i = 0; i < c->n_variants; i++) { struct variant *var = c->variants[i]; if (var->pb) { - url_fclose(var->pb); + avio_close(var->pb); var->pb = NULL; } } @@ -544,7 +558,7 @@ static int applehttp_read_seek(AVFormatContext *s, int stream_index, for (i = 0; i < c->n_variants; i++) { struct variant *var = c->variants[i]; if (var->pb) { - url_fclose(var->pb); + avio_close(var->pb); var->pb = NULL; } av_free_packet(&var->pkt); diff --git a/mplayer/ffmpeg/libavformat/asf.c b/mplayer/ffmpeg/libavformat/asf.c index e6659923..1f6af18b 100644 --- a/mplayer/ffmpeg/libavformat/asf.c +++ b/mplayer/ffmpeg/libavformat/asf.c @@ -153,6 +153,8 @@ const AVMetadataConv ff_asf_metadata_conv[] = { { "WM/Tool" , "encoder" }, { "WM/TrackNumber" , "track" }, { "WM/Track" , "track" }, + { "WM/MediaStationCallSign", "service_provider" }, + { "WM/MediaStationName", "service_name" }, // { "Year" , "date" }, TODO: conversion year<->date { 0 } }; diff --git a/mplayer/ffmpeg/libavformat/asf.h b/mplayer/ffmpeg/libavformat/asf.h index f336c43f..94c93d2c 100644 --- a/mplayer/ffmpeg/libavformat/asf.h +++ b/mplayer/ffmpeg/libavformat/asf.h @@ -79,64 +79,6 @@ typedef struct { uint16_t packet_count; } ASFIndex; - -typedef struct { - uint32_t seqno; - int is_streamed; - int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID - ASFStream streams[128]; ///< it's max number and it's not that big - uint32_t stream_bitrates[128]; ///< max number of streams, bitrate for each (for streaming) - char stream_languages[128][6]; ///< max number of streams, language for each (RFC1766, e.g. en-US) - /* non streamed additonnal info */ - uint64_t nb_packets; ///< how many packets are there in the file, invalid if broadcasting - int64_t duration; ///< in 100ns units - /* packet filling */ - unsigned char multi_payloads_present; - int packet_size_left; - int packet_timestamp_start; - int packet_timestamp_end; - unsigned int packet_nb_payloads; - int packet_nb_frames; - uint8_t packet_buf[PACKET_SIZE]; - ByteIOContext pb; - /* only for reading */ - uint64_t data_offset; ///< beginning of the first data packet - uint64_t data_object_offset; ///< data object offset (excl. GUID & size) - uint64_t data_object_size; ///< size of the data object - int index_read; - - ASFMainHeader hdr; - - int packet_flags; - int packet_property; - int packet_timestamp; - int packet_segsizetype; - int packet_segments; - int packet_seq; - int packet_replic_size; - int packet_key_frame; - int packet_padsize; - unsigned int packet_frag_offset; - unsigned int packet_frag_size; - int64_t packet_frag_timestamp; - int packet_multi_size; - int packet_obj_size; - int packet_time_delta; - int packet_time_start; - int64_t packet_pos; - - int stream_index; - - - int64_t last_indexed_pts; - ASFIndex* index_ptr; - uint32_t nb_index_count; - uint32_t nb_index_memory_alloc; - uint16_t maximum_packet; - - ASFStream* asf_st; ///< currently decoded stream -} ASFContext; - extern const ff_asf_guid ff_asf_header; extern const ff_asf_guid ff_asf_file_header; extern const ff_asf_guid ff_asf_stream_header; @@ -230,7 +172,12 @@ extern const AVMetadataConv ff_asf_metadata_conv[]; #define ASF_PL_FLAG_KEY_FRAME 0x80 //1000 0000 extern AVInputFormat ff_asf_demuxer; -int ff_guidcmp(const void *g1, const void *g2); -void ff_get_guid(ByteIOContext *s, ff_asf_guid *g); + +static av_always_inline int ff_guidcmp(const void *g1, const void *g2) +{ + return memcmp(g1, g2, sizeof(ff_asf_guid)); +} + +void ff_get_guid(AVIOContext *s, ff_asf_guid *g); #endif /* AVFORMAT_ASF_H */ diff --git a/mplayer/ffmpeg/libavformat/asfdec.c b/mplayer/ffmpeg/libavformat/asfdec.c index 35e892c4..85761a3f 100644 --- a/mplayer/ffmpeg/libavformat/asfdec.c +++ b/mplayer/ffmpeg/libavformat/asfdec.c @@ -32,6 +32,46 @@ void ff_mms_set_stream_selection(URLContext *h, AVFormatContext *format); +typedef struct { + int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID + ASFStream streams[128]; ///< it's max number and it's not that big + uint32_t stream_bitrates[128]; ///< max number of streams, bitrate for each (for streaming) + AVRational dar[128]; + char stream_languages[128][6]; ///< max number of streams, language for each (RFC1766, e.g. en-US) + /* non streamed additonnal info */ + /* packet filling */ + int packet_size_left; + /* only for reading */ + uint64_t data_offset; ///< beginning of the first data packet + uint64_t data_object_offset; ///< data object offset (excl. GUID & size) + uint64_t data_object_size; ///< size of the data object + int index_read; + + ASFMainHeader hdr; + + int packet_flags; + int packet_property; + int packet_timestamp; + int packet_segsizetype; + int packet_segments; + int packet_seq; + int packet_replic_size; + int packet_key_frame; + int packet_padsize; + unsigned int packet_frag_offset; + unsigned int packet_frag_size; + int64_t packet_frag_timestamp; + int packet_multi_size; + int packet_obj_size; + int packet_time_delta; + int packet_time_start; + int64_t packet_pos; + + int stream_index; + + ASFStream* asf_st; ///< currently decoded stream +} ASFContext; + #undef NDEBUG #include @@ -49,11 +89,6 @@ static const ff_asf_guid stream_bitrate_guid = { /* (http://get.to/sdp) */ /**********************************/ /* decoding */ -int ff_guidcmp(const void *g1, const void *g2) -{ - return memcmp(g1, g2, sizeof(ff_asf_guid)); -} - #ifdef DEBUG #define PRINT_IF_GUID(g,cmp) \ if (!ff_guidcmp(g, &cmp)) \ @@ -97,10 +132,10 @@ static void print_guid(const ff_asf_guid *g) #define print_guid(g) #endif -void ff_get_guid(ByteIOContext *s, ff_asf_guid *g) +void ff_get_guid(AVIOContext *s, ff_asf_guid *g) { assert(sizeof(*g) == 16); - get_buffer(s, *g, sizeof(*g)); + avio_read(s, *g, sizeof(*g)); } static int asf_probe(AVProbeData *pd) @@ -112,12 +147,12 @@ static int asf_probe(AVProbeData *pd) return 0; } -static int get_value(ByteIOContext *pb, int type){ +static int get_value(AVIOContext *pb, int type){ switch(type){ - case 2: return get_le32(pb); - case 3: return get_le32(pb); - case 4: return get_le64(pb); - case 5: return get_le16(pb); + case 2: return avio_rl32(pb); + case 3: return avio_rl32(pb); + case 4: return avio_rl64(pb); + case 5: return avio_rl16(pb); default:return INT_MIN; } } @@ -143,40 +178,426 @@ static void get_tag(AVFormatContext *s, const char *key, int type, int len) av_log(s, AV_LOG_DEBUG, "Unsupported value type %d in tag %s.\n", type, key); goto finish; } - av_metadata_set2(&s->metadata, key, value, 0); + if (*value) + av_metadata_set2(&s->metadata, key, value, 0); finish: av_freep(&value); - url_fseek(s->pb, off + len, SEEK_SET); + avio_seek(s->pb, off + len, SEEK_SET); } -static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) +static int asf_read_file_properties(AVFormatContext *s, int64_t size) { ASFContext *asf = s->priv_data; - ff_asf_guid g; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; + + ff_get_guid(pb, &asf->hdr.guid); + asf->hdr.file_size = avio_rl64(pb); + asf->hdr.create_time = avio_rl64(pb); + avio_rl64(pb); /* number of packets */ + asf->hdr.play_time = avio_rl64(pb); + asf->hdr.send_time = avio_rl64(pb); + asf->hdr.preroll = avio_rl32(pb); + asf->hdr.ignore = avio_rl32(pb); + asf->hdr.flags = avio_rl32(pb); + asf->hdr.min_pktsize = avio_rl32(pb); + asf->hdr.max_pktsize = avio_rl32(pb); + asf->hdr.max_bitrate = avio_rl32(pb); + s->packet_size = asf->hdr.max_pktsize; + + return 0; +} + +static int asf_read_stream_properties(AVFormatContext *s, int64_t size) +{ + ASFContext *asf = s->priv_data; + AVIOContext *pb = s->pb; AVStream *st; ASFStream *asf_st; - int size, i; - int64_t gsize; - AVRational dar[128]; - uint32_t bitrate[128]; + ff_asf_guid g; + enum AVMediaType type; + int type_specific_size, sizeX; + uint64_t total_size; + unsigned int tag1; + int64_t pos1, pos2, start_time; + int test_for_ext_stream_audio, is_dvr_ms_audio=0; + + if (s->nb_streams == ASF_MAX_STREAMS) { + av_log(s, AV_LOG_ERROR, "too many streams\n"); + return AVERROR(EINVAL); + } + + pos1 = url_ftell(pb); + + st = av_new_stream(s, 0); + if (!st) + return AVERROR(ENOMEM); + av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */ + asf_st = av_mallocz(sizeof(ASFStream)); + if (!asf_st) + return AVERROR(ENOMEM); + st->priv_data = asf_st; + start_time = asf->hdr.preroll; + + asf_st->stream_language_index = 128; // invalid stream index means no language info + + if(!(asf->hdr.flags & 0x01)) { // if we aren't streaming... + st->duration = asf->hdr.play_time / + (10000000 / 1000) - start_time; + } + ff_get_guid(pb, &g); + + test_for_ext_stream_audio = 0; + if (!ff_guidcmp(&g, &ff_asf_audio_stream)) { + type = AVMEDIA_TYPE_AUDIO; + } else if (!ff_guidcmp(&g, &ff_asf_video_stream)) { + type = AVMEDIA_TYPE_VIDEO; + } else if (!ff_guidcmp(&g, &ff_asf_jfif_media)) { + type = AVMEDIA_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_MJPEG; + } else if (!ff_guidcmp(&g, &ff_asf_command_stream)) { + type = AVMEDIA_TYPE_DATA; + } else if (!ff_guidcmp(&g, &ff_asf_ext_stream_embed_stream_header)) { + test_for_ext_stream_audio = 1; + type = AVMEDIA_TYPE_UNKNOWN; + } else { + return -1; + } + ff_get_guid(pb, &g); + total_size = avio_rl64(pb); + type_specific_size = avio_rl32(pb); + avio_rl32(pb); + st->id = avio_rl16(pb) & 0x7f; /* stream id */ + // mapping of asf ID to AV stream ID; + asf->asfid2avid[st->id] = s->nb_streams - 1; + + avio_rl32(pb); + + if (test_for_ext_stream_audio) { + ff_get_guid(pb, &g); + if (!ff_guidcmp(&g, &ff_asf_ext_stream_audio_stream)) { + type = AVMEDIA_TYPE_AUDIO; + is_dvr_ms_audio=1; + ff_get_guid(pb, &g); + avio_rl32(pb); + avio_rl32(pb); + avio_rl32(pb); + ff_get_guid(pb, &g); + avio_rl32(pb); + } + } + + st->codec->codec_type = type; + if (type == AVMEDIA_TYPE_AUDIO) { + ff_get_wav_header(pb, st->codec, type_specific_size); + if (is_dvr_ms_audio) { + // codec_id and codec_tag are unreliable in dvr_ms + // files. Set them later by probing stream. + st->codec->codec_id = CODEC_ID_PROBE; + st->codec->codec_tag = 0; + } + if (st->codec->codec_id == CODEC_ID_AAC) { + st->need_parsing = AVSTREAM_PARSE_NONE; + } else { + st->need_parsing = AVSTREAM_PARSE_FULL; + } + /* We have to init the frame size at some point .... */ + pos2 = url_ftell(pb); + if (size >= (pos2 + 8 - pos1 + 24)) { + asf_st->ds_span = avio_r8(pb); + asf_st->ds_packet_size = avio_rl16(pb); + asf_st->ds_chunk_size = avio_rl16(pb); + avio_rl16(pb); //ds_data_size + avio_r8(pb); //ds_silence_data + } + //printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n", + // asf_st->ds_packet_size, asf_st->ds_chunk_size, + // asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data); + if (asf_st->ds_span > 1) { + if (!asf_st->ds_chunk_size + || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1) + || asf_st->ds_packet_size % asf_st->ds_chunk_size) + asf_st->ds_span = 0; // disable descrambling + } + switch (st->codec->codec_id) { + case CODEC_ID_MP3: + st->codec->frame_size = MPA_FRAME_SIZE; + break; + case CODEC_ID_PCM_S16LE: + case CODEC_ID_PCM_S16BE: + case CODEC_ID_PCM_U16LE: + case CODEC_ID_PCM_U16BE: + case CODEC_ID_PCM_S8: + case CODEC_ID_PCM_U8: + case CODEC_ID_PCM_ALAW: + case CODEC_ID_PCM_MULAW: + st->codec->frame_size = 1; + break; + default: + /* This is probably wrong, but it prevents a crash later */ + st->codec->frame_size = 1; + break; + } + } else if (type == AVMEDIA_TYPE_VIDEO && + size - (url_ftell(pb) - pos1 + 24) >= 51) { + avio_rl32(pb); + avio_rl32(pb); + avio_r8(pb); + avio_rl16(pb); /* size */ + sizeX= avio_rl32(pb); /* size */ + st->codec->width = avio_rl32(pb); + st->codec->height = avio_rl32(pb); + /* not available for asf */ + avio_rl16(pb); /* panes */ + st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */ + tag1 = avio_rl32(pb); + avio_seek(pb, 20, SEEK_CUR); + // av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); + if (sizeX > 40) { + st->codec->extradata_size = sizeX - 40; + st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + avio_read(pb, st->codec->extradata, st->codec->extradata_size); + } + + /* Extract palette from extradata if bpp <= 8 */ + /* This code assumes that extradata contains only palette */ + /* This is true for all paletted codecs implemented in ffmpeg */ + if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { + int av_unused i; + st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); +#if HAVE_BIGENDIAN + for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) + st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); +#else + memcpy(st->codec->palctrl->palette, st->codec->extradata, + FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); +#endif + st->codec->palctrl->palette_changed = 1; + } + + st->codec->codec_tag = tag1; + st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1); + if(tag1 == MKTAG('D', 'V', 'R', ' ')){ + st->need_parsing = AVSTREAM_PARSE_FULL; + // issue658 containse wrong w/h and MS even puts a fake seq header with wrong w/h in extradata while a correct one is in te stream. maximum lameness + st->codec->width = + st->codec->height = 0; + av_freep(&st->codec->extradata); + st->codec->extradata_size=0; + } + if(st->codec->codec_id == CODEC_ID_H264) + st->need_parsing = AVSTREAM_PARSE_FULL_ONCE; + } + pos2 = url_ftell(pb); + avio_seek(pb, size - (pos2 - pos1 + 24), SEEK_CUR); + + return 0; +} + +static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size) +{ + ASFContext *asf = s->priv_data; + AVIOContext *pb = s->pb; + ff_asf_guid g; + int ext_len, payload_ext_ct, stream_ct, i; + uint32_t ext_d, leak_rate, stream_num; + unsigned int stream_languageid_index; + + avio_rl64(pb); // starttime + avio_rl64(pb); // endtime + leak_rate = avio_rl32(pb); // leak-datarate + avio_rl32(pb); // bucket-datasize + avio_rl32(pb); // init-bucket-fullness + avio_rl32(pb); // alt-leak-datarate + avio_rl32(pb); // alt-bucket-datasize + avio_rl32(pb); // alt-init-bucket-fullness + avio_rl32(pb); // max-object-size + avio_rl32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved) + stream_num = avio_rl16(pb); // stream-num + + stream_languageid_index = avio_rl16(pb); // stream-language-id-index + if (stream_num < 128) + asf->streams[stream_num].stream_language_index = stream_languageid_index; + + avio_rl64(pb); // avg frametime in 100ns units + stream_ct = avio_rl16(pb); //stream-name-count + payload_ext_ct = avio_rl16(pb); //payload-extension-system-count + + if (stream_num < 128) + asf->stream_bitrates[stream_num] = leak_rate; + + for (i=0; ipb; + int len1, len2, len3, len4, len5; + + len1 = avio_rl16(pb); + len2 = avio_rl16(pb); + len3 = avio_rl16(pb); + len4 = avio_rl16(pb); + len5 = avio_rl16(pb); + get_tag(s, "title" , 0, len1); + get_tag(s, "author" , 0, len2); + get_tag(s, "copyright", 0, len3); + get_tag(s, "comment" , 0, len4); + avio_seek(pb, len5, SEEK_CUR); + + return 0; +} + +static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size) +{ + AVIOContext *pb = s->pb; + ASFContext *asf = s->priv_data; + int desc_count, i, ret; + + desc_count = avio_rl16(pb); + for(i=0;idar[0].num= get_value(s->pb, value_type); + } else if(!strcmp(name, "AspectRatioY")){ + asf->dar[0].den= get_value(s->pb, value_type); + } else + get_tag(s, name, value_type, value_len); + } + + return 0; +} - memset(dar, 0, sizeof(dar)); - memset(bitrate, 0, sizeof(bitrate)); +static int asf_read_language_list(AVFormatContext *s, int64_t size) +{ + AVIOContext *pb = s->pb; + ASFContext *asf = s->priv_data; + int j, ret; + int stream_count = avio_rl16(pb); + for(j = 0; j < stream_count; j++) { + char lang[6]; + unsigned int lang_len = avio_r8(pb); + if ((ret = avio_get_str16le(pb, lang_len, lang, sizeof(lang))) < lang_len) + avio_seek(pb, lang_len - ret, SEEK_CUR); + if (j < 128) + av_strlcpy(asf->stream_languages[j], lang, sizeof(*asf->stream_languages)); + } + + return 0; +} + +static int asf_read_metadata(AVFormatContext *s, int64_t size) +{ + AVIOContext *pb = s->pb; + ASFContext *asf = s->priv_data; + int n, stream_num, name_len, value_len, value_type, value_num; + int ret, i; + n = avio_rl16(pb); + + for(i=0;i\n", i, stream_num, name_len, value_type, value_len, name); + value_num= avio_rl16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere + avio_seek(pb, value_len - 2, SEEK_CUR); + + if(stream_num<128){ + if (!strcmp(name, "AspectRatioX")) asf->dar[stream_num].num= value_num; + else if(!strcmp(name, "AspectRatioY")) asf->dar[stream_num].den= value_num; + } + } + + return 0; +} + +static int asf_read_marker(AVFormatContext *s, int64_t size) +{ + AVIOContext *pb = s->pb; + int i, count, name_len, ret; + char name[1024]; + + avio_rl64(pb); // reserved 16 bytes + avio_rl64(pb); // ... + count = avio_rl32(pb); // markers count + avio_rl16(pb); // reserved 2 bytes + name_len = avio_rl16(pb); // name length + for(i=0;ipriv_data; + ff_asf_guid g; + AVIOContext *pb = s->pb; + int i; + int64_t gsize; ff_get_guid(pb, &g); if (ff_guidcmp(&g, &ff_asf_header)) return -1; - get_le64(pb); - get_le32(pb); - get_byte(pb); - get_byte(pb); + avio_rl64(pb); + avio_rl32(pb); + avio_r8(pb); + avio_r8(pb); memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid)); for(;;) { uint64_t gpos= url_ftell(pb); - int ret; ff_get_guid(pb, &g); - gsize = get_le64(pb); + gsize = avio_rl64(pb); av_dlog(s, "%08"PRIx64": ", gpos); print_guid(&g); av_dlog(s, " size=0x%"PRIx64"\n", gsize); @@ -193,326 +614,19 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (gsize < 24) return -1; if (!ff_guidcmp(&g, &ff_asf_file_header)) { - ff_get_guid(pb, &asf->hdr.guid); - asf->hdr.file_size = get_le64(pb); - asf->hdr.create_time = get_le64(pb); - asf->nb_packets = get_le64(pb); - asf->hdr.play_time = get_le64(pb); - asf->hdr.send_time = get_le64(pb); - asf->hdr.preroll = get_le32(pb); - asf->hdr.ignore = get_le32(pb); - asf->hdr.flags = get_le32(pb); - asf->hdr.min_pktsize = get_le32(pb); - asf->hdr.max_pktsize = get_le32(pb); - asf->hdr.max_bitrate = get_le32(pb); - s->packet_size = asf->hdr.max_pktsize; + asf_read_file_properties(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_stream_header)) { - enum AVMediaType type; - int type_specific_size, sizeX; - uint64_t total_size; - unsigned int tag1; - int64_t pos1, pos2, start_time; - int test_for_ext_stream_audio, is_dvr_ms_audio=0; - - if (s->nb_streams == ASF_MAX_STREAMS) { - av_log(s, AV_LOG_ERROR, "too many streams\n"); - return AVERROR(EINVAL); - } - - pos1 = url_ftell(pb); - - st = av_new_stream(s, 0); - if (!st) - return AVERROR(ENOMEM); - av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */ - asf_st = av_mallocz(sizeof(ASFStream)); - if (!asf_st) - return AVERROR(ENOMEM); - st->priv_data = asf_st; - start_time = asf->hdr.preroll; - - asf_st->stream_language_index = 128; // invalid stream index means no language info - - if(!(asf->hdr.flags & 0x01)) { // if we aren't streaming... - st->duration = asf->hdr.play_time / - (10000000 / 1000) - start_time; - } - ff_get_guid(pb, &g); - - test_for_ext_stream_audio = 0; - if (!ff_guidcmp(&g, &ff_asf_audio_stream)) { - type = AVMEDIA_TYPE_AUDIO; - } else if (!ff_guidcmp(&g, &ff_asf_video_stream)) { - type = AVMEDIA_TYPE_VIDEO; - } else if (!ff_guidcmp(&g, &ff_asf_jfif_media)) { - type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = CODEC_ID_MJPEG; - } else if (!ff_guidcmp(&g, &ff_asf_command_stream)) { - type = AVMEDIA_TYPE_DATA; - } else if (!ff_guidcmp(&g, &ff_asf_ext_stream_embed_stream_header)) { - test_for_ext_stream_audio = 1; - type = AVMEDIA_TYPE_UNKNOWN; - } else { - return -1; - } - ff_get_guid(pb, &g); - total_size = get_le64(pb); - type_specific_size = get_le32(pb); - get_le32(pb); - st->id = get_le16(pb) & 0x7f; /* stream id */ - // mapping of asf ID to AV stream ID; - asf->asfid2avid[st->id] = s->nb_streams - 1; - - get_le32(pb); - - if (test_for_ext_stream_audio) { - ff_get_guid(pb, &g); - if (!ff_guidcmp(&g, &ff_asf_ext_stream_audio_stream)) { - type = AVMEDIA_TYPE_AUDIO; - is_dvr_ms_audio=1; - ff_get_guid(pb, &g); - get_le32(pb); - get_le32(pb); - get_le32(pb); - ff_get_guid(pb, &g); - get_le32(pb); - } - } - - st->codec->codec_type = type; - if (type == AVMEDIA_TYPE_AUDIO) { - ff_get_wav_header(pb, st->codec, type_specific_size); - if (is_dvr_ms_audio) { - // codec_id and codec_tag are unreliable in dvr_ms - // files. Set them later by probing stream. - st->codec->codec_id = CODEC_ID_PROBE; - st->codec->codec_tag = 0; - } - if (st->codec->codec_id == CODEC_ID_AAC) { - st->need_parsing = AVSTREAM_PARSE_NONE; - } else { - st->need_parsing = AVSTREAM_PARSE_FULL; - } - /* We have to init the frame size at some point .... */ - pos2 = url_ftell(pb); - if (gsize >= (pos2 + 8 - pos1 + 24)) { - asf_st->ds_span = get_byte(pb); - asf_st->ds_packet_size = get_le16(pb); - asf_st->ds_chunk_size = get_le16(pb); - get_le16(pb); //ds_data_size - get_byte(pb); //ds_silence_data - } - //printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n", - // asf_st->ds_packet_size, asf_st->ds_chunk_size, - // asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data); - if (asf_st->ds_span > 1) { - if (!asf_st->ds_chunk_size - || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1) - || asf_st->ds_packet_size % asf_st->ds_chunk_size) - asf_st->ds_span = 0; // disable descrambling - } - switch (st->codec->codec_id) { - case CODEC_ID_MP3: - st->codec->frame_size = MPA_FRAME_SIZE; - break; - case CODEC_ID_PCM_S16LE: - case CODEC_ID_PCM_S16BE: - case CODEC_ID_PCM_U16LE: - case CODEC_ID_PCM_U16BE: - case CODEC_ID_PCM_S8: - case CODEC_ID_PCM_U8: - case CODEC_ID_PCM_ALAW: - case CODEC_ID_PCM_MULAW: - st->codec->frame_size = 1; - break; - default: - /* This is probably wrong, but it prevents a crash later */ - st->codec->frame_size = 1; - break; - } - } else if (type == AVMEDIA_TYPE_VIDEO && - gsize - (url_ftell(pb) - pos1 + 24) >= 51) { - get_le32(pb); - get_le32(pb); - get_byte(pb); - size = get_le16(pb); /* size */ - sizeX= get_le32(pb); /* size */ - st->codec->width = get_le32(pb); - st->codec->height = get_le32(pb); - /* not available for asf */ - get_le16(pb); /* panes */ - st->codec->bits_per_coded_sample = get_le16(pb); /* depth */ - tag1 = get_le32(pb); - url_fskip(pb, 20); -// av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); - size= sizeX; - if (size > 40) { - st->codec->extradata_size = size - 40; - st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(pb, st->codec->extradata, st->codec->extradata_size); - } - - /* Extract palette from extradata if bpp <= 8 */ - /* This code assumes that extradata contains only palette */ - /* This is true for all paletted codecs implemented in ffmpeg */ - if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { - st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); -#if HAVE_BIGENDIAN - for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) - st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); -#else - memcpy(st->codec->palctrl->palette, st->codec->extradata, - FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); -#endif - st->codec->palctrl->palette_changed = 1; - } - - st->codec->codec_tag = tag1; - st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1); - if(tag1 == MKTAG('D', 'V', 'R', ' ')){ - st->need_parsing = AVSTREAM_PARSE_FULL; - // issue658 containse wrong w/h and MS even puts a fake seq header with wrong w/h in extradata while a correct one is in te stream. maximum lameness - st->codec->width = - st->codec->height = 0; - av_freep(&st->codec->extradata); - st->codec->extradata_size=0; - } - if(st->codec->codec_id == CODEC_ID_H264) - st->need_parsing = AVSTREAM_PARSE_FULL_ONCE; - } - pos2 = url_ftell(pb); - url_fskip(pb, gsize - (pos2 - pos1 + 24)); + asf_read_stream_properties(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_comment_header)) { - int len1, len2, len3, len4, len5; - - len1 = get_le16(pb); - len2 = get_le16(pb); - len3 = get_le16(pb); - len4 = get_le16(pb); - len5 = get_le16(pb); - get_tag(s, "title" , 0, len1); - get_tag(s, "author" , 0, len2); - get_tag(s, "copyright", 0, len3); - get_tag(s, "comment" , 0, len4); - url_fskip(pb, len5); - } else if (!ff_guidcmp(&g, &stream_bitrate_guid)) { - int stream_count = get_le16(pb); - int j; - -// av_log(s, AV_LOG_ERROR, "stream bitrate properties\n"); -// av_log(s, AV_LOG_ERROR, "streams %d\n", streams); - for(j = 0; j < stream_count; j++) { - int flags, bitrate, stream_id; - - flags= get_le16(pb); - bitrate= get_le32(pb); - stream_id= (flags & 0x7f); -// av_log(s, AV_LOG_ERROR, "flags: 0x%x stream id %d, bitrate %d\n", flags, stream_id, bitrate); - asf->stream_bitrates[stream_id]= bitrate; - } + asf_read_content_desc(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_language_guid)) { - int j; - int stream_count = get_le16(pb); - for(j = 0; j < stream_count; j++) { - char lang[6]; - unsigned int lang_len = get_byte(pb); - if ((ret = avio_get_str16le(pb, lang_len, lang, sizeof(lang))) < lang_len) - url_fskip(pb, lang_len - ret); - if (j < 128) - av_strlcpy(asf->stream_languages[j], lang, sizeof(*asf->stream_languages)); - } + asf_read_language_list(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_extended_content_header)) { - int desc_count, i; - - desc_count = get_le16(pb); - for(i=0;ipb, value_type); - } else if(!strcmp(name, "AspectRatioY")){ - dar[0].den= get_value(s->pb, value_type); - } else - get_tag(s, name, value_type, value_len); - } + asf_read_ext_content_desc(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_metadata_header)) { - int n, stream_num, name_len, value_len, value_type, value_num; - n = get_le16(pb); - - for(i=0;i\n", i, stream_num, name_len, value_type, value_len, name); - value_num= get_le16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere - url_fskip(pb, value_len - 2); - - if(stream_num<128){ - if (!strcmp(name, "AspectRatioX")) dar[stream_num].num= value_num; - else if(!strcmp(name, "AspectRatioY")) dar[stream_num].den= value_num; - } - } + asf_read_metadata(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_ext_stream_header)) { - int ext_len, payload_ext_ct, stream_ct; - uint32_t ext_d, leak_rate, stream_num; - unsigned int stream_languageid_index; - - get_le64(pb); // starttime - get_le64(pb); // endtime - leak_rate = get_le32(pb); // leak-datarate - get_le32(pb); // bucket-datasize - get_le32(pb); // init-bucket-fullness - get_le32(pb); // alt-leak-datarate - get_le32(pb); // alt-bucket-datasize - get_le32(pb); // alt-init-bucket-fullness - get_le32(pb); // max-object-size - get_le32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved) - stream_num = get_le16(pb); // stream-num - - stream_languageid_index = get_le16(pb); // stream-language-id-index - if (stream_num < 128) - asf->streams[stream_num].stream_language_index = stream_languageid_index; - - get_le64(pb); // avg frametime in 100ns units - stream_ct = get_le16(pb); //stream-name-count - payload_ext_ct = get_le16(pb); //payload-extension-system-count - - if (stream_num < 128) - bitrate[stream_num] = leak_rate; - - for (i=0; idata_offset = url_ftell(pb); @@ -582,15 +671,15 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) if(stream_num>=0){ AVStream *st = s->streams[stream_num]; if (!st->codec->bit_rate) - st->codec->bit_rate = bitrate[i]; - if (dar[i].num > 0 && dar[i].den > 0){ + st->codec->bit_rate = asf->stream_bitrates[i]; + if (asf->dar[i].num > 0 && asf->dar[i].den > 0){ av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den, - dar[i].num, dar[i].den, INT_MAX); - } else if ((dar[0].num > 0) && (dar[0].den > 0) && (st->codec->codec_type==AVMEDIA_TYPE_VIDEO)) // Use ASF container value if the stream doesn't AR set. + asf->dar[i].num, asf->dar[i].den, INT_MAX); + } else if ((asf->dar[0].num > 0) && (asf->dar[0].den > 0) && (st->codec->codec_type==AVMEDIA_TYPE_VIDEO)) // Use ASF container value if the stream doesn't AR set. av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den, - dar[0].num, dar[0].den, INT_MAX); + asf->dar[0].num, asf->dar[0].den, INT_MAX); //av_log(s, AV_LOG_INFO, "i=%d, st->codec->codec_type:%d, dar %d:%d sar=%d:%d\n", i, st->codec->codec_type, dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); @@ -615,9 +704,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) #define DO_2BITS(bits, var, defval) \ switch (bits & 3) \ { \ - case 3: var = get_le32(pb); rsize += 4; break; \ - case 2: var = get_le16(pb); rsize += 2; break; \ - case 1: var = get_byte(pb); rsize++; break; \ + case 3: var = avio_rl32(pb); rsize += 4; break; \ + case 2: var = avio_rl16(pb); rsize += 2; break; \ + case 1: var = avio_r8(pb); rsize++; break; \ default: var = defval; break; \ } @@ -627,7 +716,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) * @param pb context to read data from * @return 0 on success, <0 on error */ -static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb) +static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) { ASFContext *asf = s->priv_data; uint32_t packet_length, padsize; @@ -642,7 +731,7 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb) c=d=e=-1; while(off-- > 0){ c=d; d=e; - e= get_byte(pb); + e= avio_r8(pb); if(c == 0x82 && !d && !e) break; } @@ -665,11 +754,11 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb) av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n"); return -1; } - c= get_byte(pb); - d= get_byte(pb); + c= avio_r8(pb); + d= avio_r8(pb); rsize+=3; }else{ - url_fseek(pb, -1, SEEK_CUR); //FIXME + avio_seek(pb, -1, SEEK_CUR); //FIXME } asf->packet_flags = c; @@ -689,12 +778,12 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb) return -1; } - asf->packet_timestamp = get_le32(pb); - get_le16(pb); /* duration */ + asf->packet_timestamp = avio_rl32(pb); + avio_rl16(pb); /* duration */ // rsize has at least 11 bytes which have to be present if (asf->packet_flags & 0x01) { - asf->packet_segsizetype = get_byte(pb); rsize++; + asf->packet_segsizetype = avio_r8(pb); rsize++; asf->packet_segments = asf->packet_segsizetype & 0x3f; } else { asf->packet_segments = 1; @@ -712,10 +801,10 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb) * * @return <0 if error */ -static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){ +static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ ASFContext *asf = s->priv_data; int rsize = 1; - int num = get_byte(pb); + int num = avio_r8(pb); int64_t ts0, ts1; asf->packet_segments--; @@ -727,26 +816,26 @@ static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){ DO_2BITS(asf->packet_property, asf->packet_replic_size, 0); //printf("key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, //asf->packet_frag_offset, asf->packet_replic_size); if (asf->packet_replic_size >= 8) { - asf->packet_obj_size = get_le32(pb); + asf->packet_obj_size = avio_rl32(pb); if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){ av_log(s, AV_LOG_ERROR, "packet_obj_size invalid\n"); return -1; } - asf->packet_frag_timestamp = get_le32(pb); // timestamp + asf->packet_frag_timestamp = avio_rl32(pb); // timestamp if(asf->packet_replic_size >= 8+38+4){ // for(i=0; ipacket_replic_size-8; i++) -// av_log(s, AV_LOG_DEBUG, "%02X ",get_byte(pb)); +// av_log(s, AV_LOG_DEBUG, "%02X ",avio_r8(pb)); // av_log(s, AV_LOG_DEBUG, "\n"); - url_fskip(pb, 10); - ts0= get_le64(pb); - ts1= get_le64(pb); - url_fskip(pb, 12); - get_le32(pb); - url_fskip(pb, asf->packet_replic_size - 8 - 38 - 4); + avio_seek(pb, 10, SEEK_CUR); + ts0= avio_rl64(pb); + ts1= avio_rl64(pb); + avio_seek(pb, 12, SEEK_CUR); + avio_rl32(pb); + avio_seek(pb, asf->packet_replic_size - 8 - 38 - 4, SEEK_CUR); if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000; else asf->packet_frag_timestamp= AV_NOPTS_VALUE; }else - url_fskip(pb, asf->packet_replic_size - 8); + avio_seek(pb, asf->packet_replic_size - 8, SEEK_CUR); rsize += asf->packet_replic_size; // FIXME - check validity } else if (asf->packet_replic_size==1){ // multipacket - frag_offset is beginning timestamp @@ -754,7 +843,7 @@ static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){ asf->packet_frag_offset = 0; asf->packet_frag_timestamp = asf->packet_timestamp; - asf->packet_time_delta = get_byte(pb); + asf->packet_time_delta = avio_r8(pb); rsize++; }else if(asf->packet_replic_size!=0){ av_log(s, AV_LOG_ERROR, "unexpected packet_replic_size of %d\n", asf->packet_replic_size); @@ -791,7 +880,7 @@ static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){ * @return 0 if data was stored in pkt, <0 on error or 1 if more ASF * packets need to be loaded (through asf_get_packet()) */ -static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt) +static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) { ASFContext *asf = s->priv_data; ASFStream *asf_st = 0; @@ -806,7 +895,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket * //printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb)); assert(ret>=0); /* fail safe */ - url_fskip(pb, ret); + avio_seek(pb, ret, SEEK_CUR); asf->packet_pos= url_ftell(pb); if (asf->data_object_size != (uint64_t)-1 && @@ -825,7 +914,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket * ) { asf->packet_time_start = 0; /* unhandled packet (should not happen) */ - url_fskip(pb, asf->packet_frag_size); + avio_seek(pb, asf->packet_frag_size, SEEK_CUR); asf->packet_size_left -= asf->packet_frag_size; if(asf->stream_index < 0) av_log(s, AV_LOG_ERROR, "ff asf skip %d (unknown stream)\n", asf->packet_frag_size); @@ -839,13 +928,13 @@ static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket * // frag_offset is here used as the beginning timestamp asf->packet_frag_timestamp = asf->packet_time_start; asf->packet_time_start += asf->packet_time_delta; - asf->packet_obj_size = asf->packet_frag_size = get_byte(pb); + asf->packet_obj_size = asf->packet_frag_size = avio_r8(pb); asf->packet_size_left--; asf->packet_multi_size--; if (asf->packet_multi_size < asf->packet_obj_size) { asf->packet_time_start = 0; - url_fskip(pb, asf->packet_multi_size); + avio_seek(pb, asf->packet_multi_size, SEEK_CUR); asf->packet_size_left -= asf->packet_multi_size; continue; } @@ -899,7 +988,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket * continue; } - ret = get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset, + ret = avio_read(pb, asf_st->pkt.data + asf->packet_frag_offset, asf->packet_frag_size); if (ret != asf->packet_frag_size) { if (ret < 0 || asf->packet_frag_offset + ret == 0) @@ -1001,7 +1090,6 @@ static void asf_reset_header(AVFormatContext *s) ASFStream *asf_st; int i; - asf->packet_nb_frames = 0; asf->packet_size_left = 0; asf->packet_segments = 0; asf->packet_flags = 0; @@ -1058,7 +1146,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos, if (s->packet_size > 0) pos= (pos+s->packet_size-1-s->data_offset)/s->packet_size*s->packet_size+ s->data_offset; *ppos= pos; - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); //printf("asf_read_pts\n"); asf_reset_header(s); @@ -1100,34 +1188,34 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) int64_t current_pos= url_ftell(s->pb); int i; - url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET); + avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET); ff_get_guid(s->pb, &g); /* the data object can be followed by other top-level objects, skip them until the simple index object is reached */ while (ff_guidcmp(&g, &index_guid)) { - int64_t gsize= get_le64(s->pb); + int64_t gsize= avio_rl64(s->pb); if (gsize < 24 || url_feof(s->pb)) { - url_fseek(s->pb, current_pos, SEEK_SET); + avio_seek(s->pb, current_pos, SEEK_SET); return; } - url_fseek(s->pb, gsize-24, SEEK_CUR); + avio_seek(s->pb, gsize-24, SEEK_CUR); ff_get_guid(s->pb, &g); } { int64_t itime, last_pos=-1; int pct, ict; - int64_t av_unused gsize= get_le64(s->pb); + int64_t av_unused gsize= avio_rl64(s->pb); ff_get_guid(s->pb, &g); - itime=get_le64(s->pb); - pct=get_le32(s->pb); - ict=get_le32(s->pb); + itime=avio_rl64(s->pb); + pct=avio_rl32(s->pb); + ict=avio_rl32(s->pb); av_log(s, AV_LOG_DEBUG, "itime:0x%"PRIx64", pct:%d, ict:%d\n",itime,pct,ict); for (i=0;ipb); - int pktct =get_le16(s->pb); + int pktnum=avio_rl32(s->pb); + int pktct =avio_rl16(s->pb); int64_t pos = s->data_offset + s->packet_size*(int64_t)pktnum; int64_t index_pts= av_rescale(itime, i, 10000); @@ -1139,7 +1227,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) } asf->index_read= 1; } - url_fseek(s->pb, current_pos, SEEK_SET); + avio_seek(s->pb, current_pos, SEEK_SET); } static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags) @@ -1177,7 +1265,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int // various attempts to find key frame have failed so far // asf_reset_header(s); - // url_fseek(s->pb, pos, SEEK_SET); + // avio_seek(s->pb, pos, SEEK_SET); // key_pos = pos; // for(i=0;i<16;i++){ // pos = url_ftell(s->pb); @@ -1198,7 +1286,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int /* do the seek */ av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos); - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); } asf_reset_header(s); return 0; diff --git a/mplayer/ffmpeg/libavformat/asfenc.c b/mplayer/ffmpeg/libavformat/asfenc.c index b8f86356..267f9b3d 100644 --- a/mplayer/ffmpeg/libavformat/asfenc.c +++ b/mplayer/ffmpeg/libavformat/asfenc.c @@ -22,6 +22,7 @@ #include "metadata.h" #include "riff.h" #include "asf.h" +#include "avio_internal.h" #undef NDEBUG #include @@ -188,6 +189,31 @@ 2*PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS \ ) +typedef struct { + uint32_t seqno; + int is_streamed; + ASFStream streams[128]; ///< it's max number and it's not that big + /* non streamed additonnal info */ + uint64_t nb_packets; ///< how many packets are there in the file, invalid if broadcasting + int64_t duration; ///< in 100ns units + /* packet filling */ + unsigned char multi_payloads_present; + int packet_size_left; + int packet_timestamp_start; + int packet_timestamp_end; + unsigned int packet_nb_payloads; + uint8_t packet_buf[PACKET_SIZE]; + AVIOContext pb; + /* only for reading */ + uint64_t data_offset; ///< beginning of the first data packet + + int64_t last_indexed_pts; + ASFIndex* index_ptr; + uint32_t nb_index_count; + uint32_t nb_index_memory_alloc; + uint16_t maximum_packet; +} ASFContext; + static const AVCodecTag codec_asf_bmp_tags[] = { { CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') }, { CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') }, @@ -197,61 +223,61 @@ static const AVCodecTag codec_asf_bmp_tags[] = { #define PREROLL_TIME 3100 -static void put_guid(ByteIOContext *s, const ff_asf_guid *g) +static void put_guid(AVIOContext *s, const ff_asf_guid *g) { assert(sizeof(*g) == 16); - put_buffer(s, *g, sizeof(*g)); + avio_write(s, *g, sizeof(*g)); } -static void put_str16(ByteIOContext *s, const char *tag) +static void put_str16(AVIOContext *s, const char *tag) { int len; uint8_t *pb; - ByteIOContext *dyn_buf; + AVIOContext *dyn_buf; if (url_open_dyn_buf(&dyn_buf) < 0) return; avio_put_str16le(dyn_buf, tag); len = url_close_dyn_buf(dyn_buf, &pb); - put_le16(s, len); - put_buffer(s, pb, len); + avio_wl16(s, len); + avio_write(s, pb, len); av_freep(&pb); } -static int64_t put_header(ByteIOContext *pb, const ff_asf_guid *g) +static int64_t put_header(AVIOContext *pb, const ff_asf_guid *g) { int64_t pos; pos = url_ftell(pb); put_guid(pb, g); - put_le64(pb, 24); + avio_wl64(pb, 24); return pos; } /* update header size */ -static void end_header(ByteIOContext *pb, int64_t pos) +static void end_header(AVIOContext *pb, int64_t pos) { int64_t pos1; pos1 = url_ftell(pb); - url_fseek(pb, pos + 16, SEEK_SET); - put_le64(pb, pos1 - pos); - url_fseek(pb, pos1, SEEK_SET); + avio_seek(pb, pos + 16, SEEK_SET); + avio_wl64(pb, pos1 - pos); + avio_seek(pb, pos1, SEEK_SET); } /* write an asf chunk (only used in streaming case) */ static void put_chunk(AVFormatContext *s, int type, int payload_length, int flags) { ASFContext *asf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int length; length = payload_length + 8; - put_le16(pb, type); - put_le16(pb, length); //size - put_le32(pb, asf->seqno);//sequence number - put_le16(pb, flags); /* unknown bytes */ - put_le16(pb, length); //size_confirm + avio_wl16(pb, type); + avio_wl16(pb, length); //size + avio_wl32(pb, asf->seqno);//sequence number + avio_wl16(pb, flags); /* unknown bytes */ + avio_wl16(pb, length); //size_confirm asf->seqno++; } @@ -269,7 +295,7 @@ static int64_t unix_to_file_time(int ti) static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data_chunk_size) { ASFContext *asf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVMetadataTag *tags[5]; int header_size, n, extra_size, extra_size2, wav_extra_size, file_time; int has_title; @@ -305,40 +331,40 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data } put_guid(pb, &ff_asf_header); - put_le64(pb, -1); /* header length, will be patched after */ - put_le32(pb, 3 + has_title + !!metadata_count + s->nb_streams); /* number of chunks in header */ - put_byte(pb, 1); /* ??? */ - put_byte(pb, 2); /* ??? */ + avio_wl64(pb, -1); /* header length, will be patched after */ + avio_wl32(pb, 3 + has_title + !!metadata_count + s->nb_streams); /* number of chunks in header */ + avio_w8(pb, 1); /* ??? */ + avio_w8(pb, 2); /* ??? */ /* file header */ header_offset = url_ftell(pb); hpos = put_header(pb, &ff_asf_file_header); put_guid(pb, &ff_asf_my_guid); - put_le64(pb, file_size); + avio_wl64(pb, file_size); file_time = 0; - put_le64(pb, unix_to_file_time(file_time)); - put_le64(pb, asf->nb_packets); /* number of packets */ - put_le64(pb, duration); /* end time stamp (in 100ns units) */ - put_le64(pb, asf->duration); /* duration (in 100ns units) */ - put_le64(pb, PREROLL_TIME); /* start time stamp */ - put_le32(pb, (asf->is_streamed || url_is_streamed(pb)) ? 3 : 2); /* ??? */ - put_le32(pb, s->packet_size); /* packet size */ - put_le32(pb, s->packet_size); /* packet size */ - put_le32(pb, bit_rate); /* Nominal data rate in bps */ + avio_wl64(pb, unix_to_file_time(file_time)); + avio_wl64(pb, asf->nb_packets); /* number of packets */ + avio_wl64(pb, duration); /* end time stamp (in 100ns units) */ + avio_wl64(pb, asf->duration); /* duration (in 100ns units) */ + avio_wl64(pb, PREROLL_TIME); /* start time stamp */ + avio_wl32(pb, (asf->is_streamed || url_is_streamed(pb)) ? 3 : 2); /* ??? */ + avio_wl32(pb, s->packet_size); /* packet size */ + avio_wl32(pb, s->packet_size); /* packet size */ + avio_wl32(pb, bit_rate); /* Nominal data rate in bps */ end_header(pb, hpos); /* unknown headers */ hpos = put_header(pb, &ff_asf_head1_guid); put_guid(pb, &ff_asf_head2_guid); - put_le32(pb, 6); - put_le16(pb, 0); + avio_wl32(pb, 6); + avio_wl16(pb, 0); end_header(pb, hpos); /* title and other infos */ if (has_title) { int len; uint8_t *buf; - ByteIOContext *dyn_buf; + AVIOContext *dyn_buf; if (url_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); @@ -347,20 +373,20 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data for (n = 0; n < FF_ARRAY_ELEMS(tags); n++) { len = tags[n] ? avio_put_str16le(dyn_buf, tags[n]->value) : 0; - put_le16(pb, len); + avio_wl16(pb, len); } len = url_close_dyn_buf(dyn_buf, &buf); - put_buffer(pb, buf, len); + avio_write(pb, buf, len); av_freep(&buf); end_header(pb, hpos); } if (metadata_count) { AVMetadataTag *tag = NULL; hpos = put_header(pb, &ff_asf_extended_content_header); - put_le16(pb, metadata_count); + avio_wl16(pb, metadata_count); while ((tag = av_metadata_get(s->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) { put_str16(pb, tag->key); - put_le16(pb, 0); + avio_wl16(pb, 0); put_str16(pb, tag->value); } end_header(pb, hpos); @@ -398,45 +424,45 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data put_guid(pb, &ff_asf_video_stream); put_guid(pb, &ff_asf_video_conceal_none); } - put_le64(pb, 0); /* ??? */ + avio_wl64(pb, 0); /* ??? */ es_pos = url_ftell(pb); - put_le32(pb, extra_size); /* wav header len */ - put_le32(pb, extra_size2); /* additional data len */ - put_le16(pb, n + 1); /* stream number */ - put_le32(pb, 0); /* ??? */ + avio_wl32(pb, extra_size); /* wav header len */ + avio_wl32(pb, extra_size2); /* additional data len */ + avio_wl16(pb, n + 1); /* stream number */ + avio_wl32(pb, 0); /* ??? */ if (enc->codec_type == AVMEDIA_TYPE_AUDIO) { /* WAVEFORMATEX header */ int wavsize = ff_put_wav_header(pb, enc); if ((enc->codec_id != CODEC_ID_MP3) && (enc->codec_id != CODEC_ID_MP2) && (enc->codec_id != CODEC_ID_ADPCM_IMA_WAV) && (enc->extradata_size==0)) { wavsize += 2; - put_le16(pb, 0); + avio_wl16(pb, 0); } if (wavsize < 0) return -1; if (wavsize != extra_size) { cur_pos = url_ftell(pb); - url_fseek(pb, es_pos, SEEK_SET); - put_le32(pb, wavsize); /* wav header len */ - url_fseek(pb, cur_pos, SEEK_SET); + avio_seek(pb, es_pos, SEEK_SET); + avio_wl32(pb, wavsize); /* wav header len */ + avio_seek(pb, cur_pos, SEEK_SET); } /* ERROR Correction */ - put_byte(pb, 0x01); + avio_w8(pb, 0x01); if(enc->codec_id == CODEC_ID_ADPCM_G726 || !enc->block_align){ - put_le16(pb, 0x0190); - put_le16(pb, 0x0190); + avio_wl16(pb, 0x0190); + avio_wl16(pb, 0x0190); }else{ - put_le16(pb, enc->block_align); - put_le16(pb, enc->block_align); + avio_wl16(pb, enc->block_align); + avio_wl16(pb, enc->block_align); } - put_le16(pb, 0x01); - put_byte(pb, 0x00); + avio_wl16(pb, 0x01); + avio_w8(pb, 0x00); } else { - put_le32(pb, enc->width); - put_le32(pb, enc->height); - put_byte(pb, 2); /* ??? */ - put_le16(pb, 40 + enc->extradata_size); /* size */ + avio_wl32(pb, enc->width); + avio_wl32(pb, enc->height); + avio_w8(pb, 2); /* ??? */ + avio_wl16(pb, 40 + enc->extradata_size); /* size */ /* BITMAPINFOHEADER header */ ff_put_bmp_header(pb, enc, ff_codec_bmp_tags, 1); @@ -448,23 +474,23 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data hpos = put_header(pb, &ff_asf_codec_comment_header); put_guid(pb, &ff_asf_codec_comment1_header); - put_le32(pb, s->nb_streams); + avio_wl32(pb, s->nb_streams); for(n=0;nnb_streams;n++) { AVCodec *p; const char *desc; int len; uint8_t *buf; - ByteIOContext *dyn_buf; + AVIOContext *dyn_buf; enc = s->streams[n]->codec; p = avcodec_find_encoder(enc->codec_id); if(enc->codec_type == AVMEDIA_TYPE_AUDIO) - put_le16(pb, 2); + avio_wl16(pb, 2); else if(enc->codec_type == AVMEDIA_TYPE_VIDEO) - put_le16(pb, 1); + avio_wl16(pb, 1); else - put_le16(pb, -1); + avio_wl16(pb, -1); if(enc->codec_id == CODEC_ID_WMAV2) desc = "Windows Media Audio V8"; @@ -476,21 +502,21 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data avio_put_str16le(dyn_buf, desc); len = url_close_dyn_buf(dyn_buf, &buf); - put_le16(pb, len / 2); // "number of characters" = length in bytes / 2 + avio_wl16(pb, len / 2); // "number of characters" = length in bytes / 2 - put_buffer(pb, buf, len); + avio_write(pb, buf, len); av_freep(&buf); - put_le16(pb, 0); /* no parameters */ + avio_wl16(pb, 0); /* no parameters */ /* id */ if (enc->codec_type == AVMEDIA_TYPE_AUDIO) { - put_le16(pb, 2); - put_le16(pb, enc->codec_tag); + avio_wl16(pb, 2); + avio_wl16(pb, enc->codec_tag); } else { - put_le16(pb, 4); - put_le32(pb, enc->codec_tag); + avio_wl16(pb, 4); + avio_wl32(pb, enc->codec_tag); } if(!enc->codec_tag) return -1; @@ -504,26 +530,26 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data if (asf->is_streamed) { header_size += 8 + 30 + 50; - url_fseek(pb, header_offset - 10 - 30, SEEK_SET); - put_le16(pb, header_size); - url_fseek(pb, header_offset - 2 - 30, SEEK_SET); - put_le16(pb, header_size); + avio_seek(pb, header_offset - 10 - 30, SEEK_SET); + avio_wl16(pb, header_size); + avio_seek(pb, header_offset - 2 - 30, SEEK_SET); + avio_wl16(pb, header_size); header_size -= 8 + 30 + 50; } header_size += 24 + 6; - url_fseek(pb, header_offset - 14, SEEK_SET); - put_le64(pb, header_size); - url_fseek(pb, cur_pos, SEEK_SET); + avio_seek(pb, header_offset - 14, SEEK_SET); + avio_wl64(pb, header_size); + avio_seek(pb, cur_pos, SEEK_SET); /* movie chunk, followed by packets of packet_size */ asf->data_offset = cur_pos; put_guid(pb, &ff_asf_data_header); - put_le64(pb, data_chunk_size); + avio_wl64(pb, data_chunk_size); put_guid(pb, &ff_asf_my_guid); - put_le64(pb, asf->nb_packets); /* nb packets */ - put_byte(pb, 1); /* ??? */ - put_byte(pb, 1); /* ??? */ + avio_wl64(pb, asf->nb_packets); /* nb packets */ + avio_w8(pb, 1); /* ??? */ + avio_w8(pb, 1); /* ??? */ return 0; } @@ -553,7 +579,7 @@ static int asf_write_header(AVFormatContext *s) asf->packet_nb_payloads = 0; asf->packet_timestamp_start = -1; asf->packet_timestamp_end = -1; - init_put_byte(&asf->pb, asf->packet_buf, s->packet_size, 1, + ffio_init_context(&asf->pb, asf->packet_buf, s->packet_size, 1, NULL, NULL, NULL, NULL); return 0; @@ -577,7 +603,7 @@ static int put_payload_parsing_info( ) { ASFContext *asf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ppi_size, i; int64_t start= url_ftell(pb); @@ -588,9 +614,9 @@ static int put_payload_parsing_info( padsize--; assert(padsize>=0); - put_byte(pb, ASF_PACKET_ERROR_CORRECTION_FLAGS); + avio_w8(pb, ASF_PACKET_ERROR_CORRECTION_FLAGS); for (i = 0; i < ASF_PACKET_ERROR_CORRECTION_DATA_SIZE; i++){ - put_byte(pb, 0x0); + avio_w8(pb, 0x0); } if (asf->multi_payloads_present) @@ -602,19 +628,19 @@ static int put_payload_parsing_info( else iLengthTypeFlags |= ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_WORD; } - put_byte(pb, iLengthTypeFlags); + avio_w8(pb, iLengthTypeFlags); - put_byte(pb, ASF_PPI_PROPERTY_FLAGS); + avio_w8(pb, ASF_PPI_PROPERTY_FLAGS); if (iLengthTypeFlags & ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_WORD) - put_le16(pb, padsize - 2); + avio_wl16(pb, padsize - 2); if (iLengthTypeFlags & ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_BYTE) - put_byte(pb, padsize - 1); + avio_w8(pb, padsize - 1); - put_le32(pb, sendtime); - put_le16(pb, duration); + avio_wl32(pb, sendtime); + avio_wl16(pb, duration); if (asf->multi_payloads_present) - put_byte(pb, nb_payloads | ASF_PAYLOAD_FLAGS); + avio_w8(pb, nb_payloads | ASF_PAYLOAD_FLAGS); ppi_size = url_ftell(pb) - start; @@ -644,14 +670,14 @@ static void flush_packet(AVFormatContext *s) assert(packet_hdr_size <= asf->packet_size_left); memset(asf->packet_buf + packet_filled_size, 0, asf->packet_size_left); - put_buffer(s->pb, asf->packet_buf, s->packet_size - packet_hdr_size); + avio_write(s->pb, asf->packet_buf, s->packet_size - packet_hdr_size); put_flush_packet(s->pb); asf->nb_packets++; asf->packet_nb_payloads = 0; asf->packet_timestamp_start = -1; asf->packet_timestamp_end = -1; - init_put_byte(&asf->pb, asf->packet_buf, s->packet_size, 1, + ffio_init_context(&asf->pb, asf->packet_buf, s->packet_size, 1, NULL, NULL, NULL, NULL); } @@ -666,29 +692,29 @@ static void put_payload_header( ) { ASFContext *asf = s->priv_data; - ByteIOContext *pb = &asf->pb; + AVIOContext *pb = &asf->pb; int val; val = stream->num; if (flags & AV_PKT_FLAG_KEY) val |= ASF_PL_FLAG_KEY_FRAME; - put_byte(pb, val); + avio_w8(pb, val); - put_byte(pb, stream->seq); //Media object number - put_le32(pb, m_obj_offset); //Offset Into Media Object + avio_w8(pb, stream->seq); //Media object number + avio_wl32(pb, m_obj_offset); //Offset Into Media Object // Replicated Data shall be at least 8 bytes long. // The first 4 bytes of data shall contain the // Size of the Media Object that the payload belongs to. // The next 4 bytes of data shall contain the // Presentation Time for the media object that the payload belongs to. - put_byte(pb, ASF_PAYLOAD_REPLICATED_DATA_LENGTH); + avio_w8(pb, ASF_PAYLOAD_REPLICATED_DATA_LENGTH); - put_le32(pb, m_obj_size); //Replicated Data - Media Object Size - put_le32(pb, presentation_time);//Replicated Data - Presentation Time + avio_wl32(pb, m_obj_size); //Replicated Data - Media Object Size + avio_wl32(pb, presentation_time);//Replicated Data - Presentation Time if (asf->multi_payloads_present){ - put_le16(pb, payload_len); //payload length + avio_wl16(pb, payload_len); //payload length } } @@ -736,7 +762,7 @@ static void put_frame( payload_len = frag_len1 - 2; //additional byte need to put padding length put_payload_header(s, stream, timestamp+PREROLL_TIME, m_obj_size, m_obj_offset, payload_len, flags); - put_buffer(&asf->pb, buf, payload_len); + avio_write(&asf->pb, buf, payload_len); if (asf->multi_payloads_present) asf->packet_size_left -= (payload_len + PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS); @@ -807,18 +833,18 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt) // static int asf_write_index(AVFormatContext *s, ASFIndex *index, uint16_t max, uint32_t count) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i; put_guid(pb, &ff_asf_simple_index_header); - put_le64(pb, 24 + 16 + 8 + 4 + 4 + (4 + 2)*count); + avio_wl64(pb, 24 + 16 + 8 + 4 + 4 + (4 + 2)*count); put_guid(pb, &ff_asf_my_guid); - put_le64(pb, ASF_INDEXED_INTERVAL); - put_le32(pb, max); - put_le32(pb, count); + avio_wl64(pb, ASF_INDEXED_INTERVAL); + avio_wl32(pb, max); + avio_wl32(pb, count); for(i=0; ipb); - url_fseek(s->pb, 0, SEEK_SET); + avio_seek(s->pb, 0, SEEK_SET); asf_write_header1(s, file_size, data_size - asf->data_offset); } diff --git a/mplayer/ffmpeg/libavformat/assdec.c b/mplayer/ffmpeg/libavformat/assdec.c index 86f03390..e04d92ae 100644 --- a/mplayer/ffmpeg/libavformat/assdec.c +++ b/mplayer/ffmpeg/libavformat/assdec.c @@ -76,7 +76,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { int i, len, header_remaining; ASSContext *ass = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; int allocated[2]={0}; uint8_t *p, **dst[2]={0}; diff --git a/mplayer/ffmpeg/libavformat/assenc.c b/mplayer/ffmpeg/libavformat/assenc.c index fdd53060..9abe3027 100644 --- a/mplayer/ffmpeg/libavformat/assenc.c +++ b/mplayer/ffmpeg/libavformat/assenc.c @@ -42,7 +42,7 @@ static int write_header(AVFormatContext *s) if(!end) end= avctx->extradata + avctx->extradata_size; else end++; - put_buffer(s->pb, p, end-p); + avio_write(s->pb, p, end-p); ass->extra_index += end-p; if(last && !memcmp(last, "[Events]", 8)) @@ -57,7 +57,7 @@ static int write_header(AVFormatContext *s) static int write_packet(AVFormatContext *s, AVPacket *pkt) { - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, pkt->data, pkt->size); put_flush_packet(s->pb); @@ -69,7 +69,7 @@ static int write_trailer(AVFormatContext *s) ASSContext *ass = s->priv_data; AVCodecContext *avctx= s->streams[0]->codec; - put_buffer(s->pb, avctx->extradata + ass->extra_index, + avio_write(s->pb, avctx->extradata + ass->extra_index, avctx->extradata_size - ass->extra_index); put_flush_packet(s->pb); diff --git a/mplayer/ffmpeg/libavformat/au.c b/mplayer/ffmpeg/libavformat/au.c index e18022dd..16b33e78 100644 --- a/mplayer/ffmpeg/libavformat/au.c +++ b/mplayer/ffmpeg/libavformat/au.c @@ -28,6 +28,7 @@ */ #include "avformat.h" +#include "avio_internal.h" #include "pcm.h" #include "riff.h" @@ -49,22 +50,22 @@ static const AVCodecTag codec_au_tags[] = { #if CONFIG_AU_MUXER /* AUDIO_FILE header */ -static int put_au_header(ByteIOContext *pb, AVCodecContext *enc) +static int put_au_header(AVIOContext *pb, AVCodecContext *enc) { if(!enc->codec_tag) return -1; - put_tag(pb, ".snd"); /* magic number */ - put_be32(pb, 24); /* header size */ - put_be32(pb, AU_UNKNOWN_SIZE); /* data size */ - put_be32(pb, (uint32_t)enc->codec_tag); /* codec ID */ - put_be32(pb, enc->sample_rate); - put_be32(pb, (uint32_t)enc->channels); + ffio_wfourcc(pb, ".snd"); /* magic number */ + avio_wb32(pb, 24); /* header size */ + avio_wb32(pb, AU_UNKNOWN_SIZE); /* data size */ + avio_wb32(pb, (uint32_t)enc->codec_tag); /* codec ID */ + avio_wb32(pb, enc->sample_rate); + avio_wb32(pb, (uint32_t)enc->channels); return 0; } static int au_write_header(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; s->priv_data = NULL; @@ -80,23 +81,23 @@ static int au_write_header(AVFormatContext *s) static int au_write_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; - put_buffer(pb, pkt->data, pkt->size); + AVIOContext *pb = s->pb; + avio_write(pb, pkt->data, pkt->size); return 0; } static int au_write_trailer(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t file_size; if (!url_is_streamed(s->pb)) { /* update file size */ file_size = url_ftell(pb); - url_fseek(pb, 8, SEEK_SET); - put_be32(pb, (uint32_t)(file_size - 24)); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, 8, SEEK_SET); + avio_wb32(pb, (uint32_t)(file_size - 24)); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); } @@ -121,21 +122,21 @@ static int au_read_header(AVFormatContext *s, { int size; unsigned int tag; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int id, channels, rate; enum CodecID codec; AVStream *st; /* check ".snd" header */ - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag != MKTAG('.', 's', 'n', 'd')) return -1; - size = get_be32(pb); /* header size */ - get_be32(pb); /* data size */ + size = avio_rb32(pb); /* header size */ + avio_rb32(pb); /* data size */ - id = get_be32(pb); - rate = get_be32(pb); - channels = get_be32(pb); + id = avio_rb32(pb); + rate = avio_rb32(pb); + channels = avio_rb32(pb); codec = ff_codec_get_id(codec_au_tags, id); @@ -146,7 +147,7 @@ static int au_read_header(AVFormatContext *s, if (size >= 24) { /* skip unused data */ - url_fseek(pb, size - 24, SEEK_CUR); + avio_seek(pb, size - 24, SEEK_CUR); } /* now we are ready: build format streams */ diff --git a/mplayer/ffmpeg/libavformat/avc.c b/mplayer/ffmpeg/libavformat/avc.c index 7c991961..a39343b1 100644 --- a/mplayer/ffmpeg/libavformat/avc.c +++ b/mplayer/ffmpeg/libavformat/avc.c @@ -67,7 +67,7 @@ const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end){ return out; } -int ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size) +int ff_avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size) { const uint8_t *p = buf_in; const uint8_t *end = p + size; @@ -78,8 +78,8 @@ int ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size) while (nal_start < end) { while(!*(nal_start++)); nal_end = ff_avc_find_startcode(nal_start, end); - put_be32(pb, nal_end - nal_start); - put_buffer(pb, nal_start, nal_end - nal_start); + avio_wb32(pb, nal_end - nal_start); + avio_write(pb, nal_start, nal_end - nal_start); size += 4 + nal_end - nal_start; nal_start = nal_end; } @@ -88,7 +88,7 @@ int ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size) int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size) { - ByteIOContext *pb; + AVIOContext *pb; int ret = url_open_dyn_buf(&pb); if(ret < 0) return ret; @@ -100,7 +100,7 @@ int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size) return 0; } -int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len) +int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) { if (len > 6) { /* check for h264 start code */ @@ -134,21 +134,21 @@ int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len) assert(sps); assert(pps); - put_byte(pb, 1); /* version */ - put_byte(pb, sps[1]); /* profile */ - put_byte(pb, sps[2]); /* profile compat */ - put_byte(pb, sps[3]); /* level */ - put_byte(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */ - put_byte(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */ - - put_be16(pb, sps_size); - put_buffer(pb, sps, sps_size); - put_byte(pb, 1); /* number of pps */ - put_be16(pb, pps_size); - put_buffer(pb, pps, pps_size); + avio_w8(pb, 1); /* version */ + avio_w8(pb, sps[1]); /* profile */ + avio_w8(pb, sps[2]); /* profile compat */ + avio_w8(pb, sps[3]); /* level */ + avio_w8(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */ + avio_w8(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */ + + avio_wb16(pb, sps_size); + avio_write(pb, sps, sps_size); + avio_w8(pb, 1); /* number of pps */ + avio_wb16(pb, pps_size); + avio_write(pb, pps, pps_size); av_free(start); } else { - put_buffer(pb, data, len); + avio_write(pb, data, len); } } return 0; diff --git a/mplayer/ffmpeg/libavformat/avc.h b/mplayer/ffmpeg/libavformat/avc.h index 2deb77df..46e5e37a 100644 --- a/mplayer/ffmpeg/libavformat/avc.h +++ b/mplayer/ffmpeg/libavformat/avc.h @@ -25,9 +25,9 @@ #include #include "avio.h" -int ff_avc_parse_nal_units(ByteIOContext *s, const uint8_t *buf, int size); +int ff_avc_parse_nal_units(AVIOContext *s, const uint8_t *buf, int size); int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size); -int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len); +int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len); const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end); #endif /* AVFORMAT_AVC_H */ diff --git a/mplayer/ffmpeg/libavformat/avformat.h b/mplayer/ffmpeg/libavformat/avformat.h index f9f9be5b..f5afde84 100644 --- a/mplayer/ffmpeg/libavformat/avformat.h +++ b/mplayer/ffmpeg/libavformat/avformat.h @@ -193,7 +193,7 @@ void av_metadata_free(AVMetadata **m); * @param size desired payload size * @return >0 (read size) if OK, AVERROR_xxx otherwise */ -int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size); +int av_get_packet(AVIOContext *s, AVPacket *pkt, int size); /** @@ -209,7 +209,7 @@ int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size); * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data * will not be lost even if an error occurs. */ -int av_append_packet(ByteIOContext *s, AVPacket *pkt, int size); +int av_append_packet(AVIOContext *s, AVPacket *pkt, int size); /*************************************************/ /* fractional numbers for exact pts handling */ @@ -261,7 +261,7 @@ typedef struct AVFormatParameters { #endif } AVFormatParameters; -//! Demuxer will use url_fopen, no opened file should be provided by the caller. +//! Demuxer will use avio_open, no opened file should be provided by the caller. #define AVFMT_NOFILE 0x0001 #define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ #define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ @@ -472,6 +472,9 @@ typedef struct AVIndexEntry { * even when user did not explicitly ask for subtitles. */ #define AV_DISPOSITION_FORCED 0x0040 +#define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */ +#define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */ +#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */ /** * Stream structure. @@ -507,6 +510,8 @@ typedef struct AVStream { * This is the fundamental unit of time (in seconds) in terms * of which frame timestamps are represented. For fixed-fps content, * time base should be 1/framerate and timestamp increments should be 1. + * decoding: set by libavformat + * encoding: set by libavformat in av_write_header */ AVRational time_base; int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ @@ -683,7 +688,7 @@ typedef struct AVFormatContext { struct AVInputFormat *iformat; struct AVOutputFormat *oformat; void *priv_data; - ByteIOContext *pb; + AVIOContext *pb; unsigned int nb_streams; #if FF_API_MAX_STREAMS AVStream *streams[MAX_STREAMS]; @@ -750,7 +755,9 @@ typedef struct AVFormatContext { /* av_seek_frame() support */ int64_t data_offset; /**< offset of the first packet */ - int index_built; +#if FF_API_INDEX_BUILT + attribute_deprecated int index_built; +#endif int mux_rate; unsigned int packet_size; @@ -942,7 +949,7 @@ enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, * @param buf buffer * @param size buffer size * - * @see av_hex_dump_log, av_pkt_dump, av_pkt_dump_log + * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 */ void av_hex_dump(FILE *f, uint8_t *buf, int size); @@ -956,7 +963,7 @@ void av_hex_dump(FILE *f, uint8_t *buf, int size); * @param buf buffer * @param size buffer size * - * @see av_hex_dump, av_pkt_dump, av_pkt_dump_log + * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 */ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); @@ -966,8 +973,11 @@ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); * @param f The file stream pointer where the dump should be sent to. * @param pkt packet to dump * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to */ -void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); +void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); + +attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); /** * Send a nice dump of a packet to the log. @@ -978,8 +988,13 @@ void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); * higher importance. * @param pkt packet to dump * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to */ -void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload); +void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, + AVStream *st); + +attribute_deprecated void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, + int dump_payload); /** * Initialize libavformat and register all the muxers, demuxers and @@ -1038,12 +1053,31 @@ AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); */ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max); +/** + * Probe a bytestream to determine the input format. Each time a probe returns + * with a score that is too low, the probe buffer size is increased and another + * attempt is made. When the maximum probe size is reached, the input format + * with the highest score is returned. + * + * @param pb the bytestream to probe + * @param fmt the input format is put here + * @param filename the filename of the stream + * @param logctx the log context + * @param offset the offset within the bytestream to probe from + * @param max_probe_size the maximum probe buffer size (zero for default) + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, + const char *filename, void *logctx, + unsigned int offset, unsigned int max_probe_size); + /** * Allocate all the structures needed to read an input stream. * This does not open the needed codecs for decoding the stream[s]. */ int av_open_input_stream(AVFormatContext **ic_ptr, - ByteIOContext *pb, const char *filename, + AVIOContext *pb, const char *filename, AVInputFormat *fmt, AVFormatParameters *ap); /** @@ -1072,8 +1106,8 @@ attribute_deprecated AVFormatContext *av_alloc_format_context(void); /** * Allocate an AVFormatContext. - * Can be freed with av_free() but do not forget to free everything you - * explicitly allocated as well! + * avformat_free_context() can be used to free the context and everything + * allocated by the framework within it. */ AVFormatContext *avformat_alloc_context(void); @@ -1229,6 +1263,12 @@ void av_close_input_stream(AVFormatContext *s); */ void av_close_input_file(AVFormatContext *s); +/** + * Free an AVFormatContext and all its streams. + * @param s context to free + */ +void avformat_free_context(AVFormatContext *s); + /** * Add a new stream to a media file. * @@ -1243,23 +1283,8 @@ AVStream *av_new_stream(AVFormatContext *s, int id); AVProgram *av_new_program(AVFormatContext *s, int id); /** - * Add a new chapter. - * This function is NOT part of the public API - * and should ONLY be used by demuxers. - * - * @param s media file handle - * @param id unique ID for this chapter - * @param start chapter start time in time_base units - * @param end chapter end time in time_base units - * @param title chapter title - * - * @return AVChapter or NULL on error - */ -AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, - int64_t start, int64_t end, const char *title); - -/** - * Set the pts for a given stream. + * Set the pts for a given stream. If the new values would be invalid + * (<= 0), it leaves the AVStream unchanged. * * @param s stream * @param pts_wrap_bits number of bits effectively used by the pts @@ -1287,15 +1312,6 @@ int av_find_default_stream_index(AVFormatContext *s); */ int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); -/** - * Ensure the index uses less memory than the maximum specified in - * AVFormatContext.max_index_size by discarding entries if it grows - * too large. - * This function is not part of the public API and should only be called - * by demuxers. - */ -void ff_reduce_index(AVFormatContext *s, int stream_index); - /** * Add an index entry into a sorted list. Update the entry if the list * already contains it. @@ -1374,6 +1390,8 @@ void av_url_split(char *proto, int proto_size, /** * Allocate the stream private data and write the stream header to an * output media file. + * @note: this sets stream time-bases, if possible to stream->codec->time_base + * but for some formats it might also be some other time base * * @param s media file handle * @return 0 if OK, AVERROR_xxx on error @@ -1440,10 +1458,17 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, */ int av_write_trailer(AVFormatContext *s); -void dump_format(AVFormatContext *ic, - int index, - const char *url, - int is_output); +#if FF_API_DUMP_FORMAT +attribute_deprecated void dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output); +#endif + +void av_dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output); #if FF_API_PARSE_FRAME_PARAM /** @@ -1461,34 +1486,17 @@ attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base, const char *arg); #endif +#if FF_API_PARSE_DATE /** * Parse datestr and return a corresponding number of microseconds. + * * @param datestr String representing a date or a duration. - * - If a date the syntax is: - * @code - * now|{[{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z|z]} - * @endcode - * If the value is "now" it takes the current time. - * Time is local time unless Z is appended, in which case it is - * interpreted as UTC. - * If the year-month-day part is not specified it takes the current - * year-month-day. - * @return the number of microseconds since 1st of January, 1970 up to - * the time of the parsed date or INT64_MIN if datestr cannot be - * successfully parsed. - * - If a duration the syntax is: - * @code - * [-]HH[:MM[:SS[.m...]]] - * [-]S+[.m...] - * @endcode - * @return the number of microseconds contained in a time interval - * with the specified duration or INT64_MIN if datestr cannot be - * successfully parsed. - * @param duration Flag which tells how to interpret datestr, if - * not zero datestr is interpreted as a duration, otherwise as a - * date. + * See av_parse_time() for the syntax of the provided string. + * @deprecated in favor of av_parse_time() */ +attribute_deprecated int64_t parse_date(const char *datestr, int duration); +#endif /** * Get the current time in microseconds. @@ -1501,13 +1509,12 @@ int64_t ffm_read_write_index(int fd); int ffm_write_write_index(int fd, int64_t pos); void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size); +#if FF_API_FIND_INFO_TAG /** - * Attempt to find a specific tag in a URL. - * - * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. - * Return 1 if found. + * @deprecated use av_find_info_tag in libavutil instead. */ -int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); +attribute_deprecated int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); +#endif /** * Return in 'buf' the path with '%d' replaced by a number. diff --git a/mplayer/ffmpeg/libavformat/avi.h b/mplayer/ffmpeg/libavformat/avi.h index f345c147..b4e55197 100644 --- a/mplayer/ffmpeg/libavformat/avi.h +++ b/mplayer/ffmpeg/libavformat/avi.h @@ -32,6 +32,7 @@ #define AVI_MAX_RIFF_SIZE 0x40000000LL #define AVI_MASTER_INDEX_SIZE 256 +#define AVI_MAX_STREAM_COUNT 100 /* index flags */ #define AVIIF_INDEX 0x10 diff --git a/mplayer/ffmpeg/libavformat/avidec.c b/mplayer/ffmpeg/libavformat/avidec.c index 747d3ee6..6c4a930b 100644 --- a/mplayer/ffmpeg/libavformat/avidec.c +++ b/mplayer/ffmpeg/libavformat/avidec.c @@ -27,7 +27,6 @@ #endif #include "libavutil/intreadwrite.h" #include "libavutil/bswap.h" -#include "libavcodec/bytestream.h" #include "avformat.h" #include "avi.h" #include "dv.h" @@ -103,17 +102,17 @@ static inline int get_duration(AVIStream *ast, int len){ return 1; } -static int get_riff(AVFormatContext *s, ByteIOContext *pb) +static int get_riff(AVFormatContext *s, AVIOContext *pb) { AVIContext *avi = s->priv_data; char header[8]; int i; /* check RIFF header */ - get_buffer(pb, header, 4); - avi->riff_end = get_le32(pb); /* RIFF chunk size */ + avio_read(pb, header, 4); + avi->riff_end = avio_rl32(pb); /* RIFF chunk size */ avi->riff_end += url_ftell(pb); /* RIFF chunk end */ - get_buffer(pb, header+4, 4); + avio_read(pb, header+4, 4); for(i=0; avi_headers[i][0]; i++) if(!memcmp(header, avi_headers[i], 8)) @@ -129,13 +128,13 @@ static int get_riff(AVFormatContext *s, ByteIOContext *pb) static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; - int longs_pre_entry= get_le16(pb); - int index_sub_type = get_byte(pb); - int index_type = get_byte(pb); - int entries_in_use = get_le32(pb); - int chunk_id = get_le32(pb); - int64_t base = get_le64(pb); + AVIOContext *pb = s->pb; + int longs_pre_entry= avio_rl16(pb); + int index_sub_type = avio_r8(pb); + int index_type = avio_r8(pb); + int entries_in_use = avio_rl32(pb); + int chunk_id = avio_rl32(pb); + int64_t base = avio_rl64(pb); int stream_id= 10*((chunk_id&0xFF) - '0') + (((chunk_id>>8)&0xFF) - '0'); AVStream *st; AVIStream *ast; @@ -156,7 +155,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ if(index_sub_type) return -1; - get_le32(pb); + avio_rl32(pb); if(index_type && longs_pre_entry != 2) return -1; @@ -173,8 +172,8 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ for(i=0; i= 0; len &= 0x7FFFFFFF; @@ -194,9 +193,9 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ }else{ int64_t offset, pos; int duration; - offset = get_le64(pb); - get_le32(pb); /* size */ - duration = get_le32(pb); + offset = avio_rl64(pb); + avio_rl32(pb); /* size */ + duration = avio_rl32(pb); if(url_feof(pb)) return -1; @@ -208,13 +207,13 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ return -1; } - url_fseek(pb, offset+8, SEEK_SET); + avio_seek(pb, offset+8, SEEK_SET); avi->odml_depth++; read_braindead_odml_indx(s, frame_num); avi->odml_depth--; frame_num += duration; - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } } avi->index_loaded=1; @@ -249,7 +248,7 @@ static void clean_index(AVFormatContext *s){ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; char key[5] = {0}, *value; size += (size & 1); @@ -259,7 +258,7 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t value = av_malloc(size+1); if (!value) return -1; - get_buffer(pb, value, size); + avio_read(pb, value, size); value[size]=0; AV_WL32(key, tag); @@ -271,8 +270,8 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t static void avi_read_info(AVFormatContext *s, uint64_t end) { while (url_ftell(s->pb) < end) { - uint32_t tag = get_le32(s->pb); - uint32_t size = get_le32(s->pb); + uint32_t tag = avio_rl32(s->pb); + uint32_t size = avio_rl32(s->pb); avi_read_tag(s, NULL, tag, size); } } @@ -302,17 +301,17 @@ static void avi_metadata_creation_time(AVMetadata **metadata, char *date) static void avi_read_nikon(AVFormatContext *s, uint64_t end) { while (url_ftell(s->pb) < end) { - uint32_t tag = get_le32(s->pb); - uint32_t size = get_le32(s->pb); + uint32_t tag = avio_rl32(s->pb); + uint32_t size = avio_rl32(s->pb); switch (tag) { case MKTAG('n', 'c', 't', 'g'): { /* Nikon Tags */ uint64_t tag_end = url_ftell(s->pb) + size; while (url_ftell(s->pb) < tag_end) { - uint16_t tag = get_le16(s->pb); - uint16_t size = get_le16(s->pb); + uint16_t tag = avio_rl16(s->pb); + uint16_t size = avio_rl16(s->pb); const char *name = NULL; char buffer[64] = {0}; - size -= get_buffer(s->pb, buffer, + size -= avio_read(s->pb, buffer, FFMIN(size, sizeof(buffer)-1)); switch (tag) { case 0x03: name = "maker"; break; @@ -324,12 +323,12 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end) } if (name) av_metadata_set2(&s->metadata, name, buffer, 0); - url_fskip(s->pb, size); + avio_seek(s->pb, size, SEEK_CUR); } break; } default: - url_fskip(s->pb, size); + avio_seek(s->pb, size, SEEK_CUR); break; } } @@ -338,7 +337,7 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end) static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int tag, tag1, handler; int codec_type, stream_index, frame_period, bit_rate; unsigned int size; @@ -365,8 +364,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) for(;;) { if (url_feof(pb)) goto fail; - tag = get_le32(pb); - size = get_le32(pb); + tag = avio_rl32(pb); + size = avio_rl32(pb); print_tag("tag", tag, size); @@ -374,7 +373,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) case MKTAG('L', 'I', 'S', 'T'): list_end = url_ftell(pb) + size; /* Ignored, except at start of video packets. */ - tag1 = get_le32(pb); + tag1 = avio_rl32(pb); print_tag("list", tag1, 0); @@ -394,41 +393,41 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) case MKTAG('I', 'D', 'I', 'T'): { unsigned char date[64] = {0}; size += (size & 1); - size -= get_buffer(pb, date, FFMIN(size, sizeof(date)-1)); - url_fskip(pb, size); + size -= avio_read(pb, date, FFMIN(size, sizeof(date)-1)); + avio_seek(pb, size, SEEK_CUR); avi_metadata_creation_time(&s->metadata, date); break; } case MKTAG('d', 'm', 'l', 'h'): avi->is_odml = 1; - url_fskip(pb, size + (size & 1)); + avio_seek(pb, size + (size & 1), SEEK_CUR); break; case MKTAG('a', 'm', 'v', 'h'): amv_file_format=1; case MKTAG('a', 'v', 'i', 'h'): /* AVI header */ /* using frame_period is bad idea */ - frame_period = get_le32(pb); - bit_rate = get_le32(pb) * 8; - get_le32(pb); - avi->non_interleaved |= get_le32(pb) & AVIF_MUSTUSEINDEX; - - url_fskip(pb, 2 * 4); - get_le32(pb); - get_le32(pb); - avih_width=get_le32(pb); - avih_height=get_le32(pb); - - url_fskip(pb, size - 10 * 4); + frame_period = avio_rl32(pb); + bit_rate = avio_rl32(pb) * 8; + avio_rl32(pb); + avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX; + + avio_seek(pb, 2 * 4, SEEK_CUR); + avio_rl32(pb); + avio_rl32(pb); + avih_width=avio_rl32(pb); + avih_height=avio_rl32(pb); + + avio_seek(pb, size - 10 * 4, SEEK_CUR); break; case MKTAG('s', 't', 'r', 'h'): /* stream header */ - tag1 = get_le32(pb); - handler = get_le32(pb); /* codec tag */ + tag1 = avio_rl32(pb); + handler = avio_rl32(pb); /* codec tag */ if(tag1 == MKTAG('p', 'a', 'd', 's')){ - url_fskip(pb, size - 8); + avio_seek(pb, size - 8, SEEK_CUR); break; }else{ stream_index++; @@ -472,12 +471,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) goto fail; } s->streams[0]->priv_data = ast; - url_fskip(pb, 3 * 4); - ast->scale = get_le32(pb); - ast->rate = get_le32(pb); - url_fskip(pb, 4); /* start time */ + avio_seek(pb, 3 * 4, SEEK_CUR); + ast->scale = avio_rl32(pb); + ast->rate = avio_rl32(pb); + avio_seek(pb, 4, SEEK_CUR); /* start time */ - dv_dur = get_le32(pb); + dv_dur = avio_rl32(pb); if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) { dv_dur *= AV_TIME_BASE; s->duration = av_rescale(dv_dur, ast->scale, ast->rate); @@ -488,19 +487,19 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) */ stream_index = s->nb_streams - 1; - url_fskip(pb, size - 9*4); + avio_seek(pb, size - 9*4, SEEK_CUR); break; } assert(stream_index < s->nb_streams); st->codec->stream_codec_tag= handler; - get_le32(pb); /* flags */ - get_le16(pb); /* priority */ - get_le16(pb); /* language */ - get_le32(pb); /* initial frame */ - ast->scale = get_le32(pb); - ast->rate = get_le32(pb); + avio_rl32(pb); /* flags */ + avio_rl16(pb); /* priority */ + avio_rl16(pb); /* language */ + avio_rl32(pb); /* initial frame */ + ast->scale = avio_rl32(pb); + ast->rate = avio_rl32(pb); if(!(ast->scale && ast->rate)){ av_log(s, AV_LOG_WARNING, "scale/rate is %u/%u which is invalid. (This file has been generated by broken software.)\n", ast->scale, ast->rate); if(frame_period){ @@ -513,13 +512,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } av_set_pts_info(st, 64, ast->scale, ast->rate); - ast->cum_len=get_le32(pb); /* start */ - st->nb_frames = get_le32(pb); + ast->cum_len=avio_rl32(pb); /* start */ + st->nb_frames = avio_rl32(pb); st->start_time = 0; - get_le32(pb); /* buffer size */ - get_le32(pb); /* quality */ - ast->sample_size = get_le32(pb); /* sample ssize */ + avio_rl32(pb); /* buffer size */ + avio_rl32(pb); /* quality */ + ast->sample_size = avio_rl32(pb); /* sample ssize */ ast->cum_len *= FFMAX(1, ast->sample_size); // av_log(s, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size); @@ -545,12 +544,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if(ast->sample_size == 0) st->duration = st->nb_frames; ast->frame_offset= ast->cum_len; - url_fskip(pb, size - 12 * 4); + avio_seek(pb, size - 12 * 4, SEEK_CUR); break; case MKTAG('s', 't', 'r', 'f'): /* stream header */ if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) { - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); } else { uint64_t cur_pos = url_ftell(pb); if (cur_pos < list_end) @@ -563,7 +562,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->height=avih_height; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_AMV; - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } tag1 = ff_get_bmp_header(pb, st); @@ -582,11 +581,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->extradata_size= 0; return AVERROR(ENOMEM); } - get_buffer(pb, st->codec->extradata, st->codec->extradata_size); + avio_read(pb, st->codec->extradata, st->codec->extradata_size); } if(st->codec->extradata_size & 1) //FIXME check if the encoder really did this correctly - get_byte(pb); + avio_r8(pb); /* Extract palette from extradata if bpp <= 8. */ /* This code assumes that extradata contains only palette. */ @@ -623,7 +622,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } st->codec->height= FFABS(st->codec->height); -// url_fskip(pb, size - 5 * 4); +// avio_seek(pb, size - 5 * 4, SEEK_CUR); break; case AVMEDIA_TYPE_AUDIO: ff_get_wav_header(pb, st->codec, size); @@ -633,7 +632,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ast->sample_size= st->codec->block_align; } if (size&1) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */ - url_fskip(pb, 1); + avio_seek(pb, 1, SEEK_CUR); /* Force parsing as several audio frames can be in * one packet and timestamps refer to packet start. */ st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; @@ -661,7 +660,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->codec_type = AVMEDIA_TYPE_DATA; st->codec->codec_id= CODEC_ID_NONE; st->codec->codec_tag= 0; - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } } @@ -671,24 +670,24 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if(!url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX)){ read_braindead_odml_indx(s, 0); } - url_fseek(pb, i+size, SEEK_SET); + avio_seek(pb, i+size, SEEK_SET); break; case MKTAG('v', 'p', 'r', 'p'): if(stream_index < (unsigned)s->nb_streams && size > 9*4){ AVRational active, active_aspect; st = s->streams[stream_index]; - get_le32(pb); - get_le32(pb); - get_le32(pb); - get_le32(pb); - get_le32(pb); - - active_aspect.den= get_le16(pb); - active_aspect.num= get_le16(pb); - active.num = get_le32(pb); - active.den = get_le32(pb); - get_le32(pb); //nbFieldsPerFrame + avio_rl32(pb); + avio_rl32(pb); + avio_rl32(pb); + avio_rl32(pb); + avio_rl32(pb); + + active_aspect.den= avio_rl16(pb); + active_aspect.num= avio_rl16(pb); + active.num = avio_rl32(pb); + active.den = avio_rl32(pb); + avio_rl32(pb); //nbFieldsPerFrame if(active_aspect.num && active_aspect.den && active.num && active.den){ st->sample_aspect_ratio= av_div_q(active_aspect, active); @@ -696,7 +695,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } size -= 9*4; } - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); break; case MKTAG('s', 't', 'r', 'n'): if(s->nb_streams){ @@ -713,7 +712,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } /* skip tag */ size += (size & 1); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } } @@ -750,39 +749,32 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) static int read_gab2_sub(AVStream *st, AVPacket *pkt) { if (!strcmp(pkt->data, "GAB2") && AV_RL16(pkt->data+5) == 2) { - uint8_t desc[256], *d = desc; - uint8_t *end, *ptr = pkt->data+7; - unsigned int size, desc_len = bytestream_get_le32(&ptr); - int score = AVPROBE_SCORE_MAX / 2; + uint8_t desc[256]; + int score = AVPROBE_SCORE_MAX / 2, ret; AVIStream *ast = st->priv_data; AVInputFormat *sub_demuxer; AVRational time_base; - ByteIOContext *pb; + AVIOContext *pb = avio_alloc_context( pkt->data + 7, + pkt->size - 7, + 0, NULL, NULL, NULL, NULL); AVProbeData pd; + unsigned int desc_len = avio_rl32(pb); - if (desc_len > FFMAX(pkt->size-17, 0)) - return 0; + if (desc_len > pb->buf_end - pb->buf_ptr) + goto error; - end = ptr + desc_len; - while (ptr < end-1) { - uint8_t tmp; - uint32_t ch; - GET_UTF16(ch, ptr < end-1 ? bytestream_get_le16(&ptr) : 0, break;); - PUT_UTF8(ch, tmp, if(d-desc < sizeof(desc)-1) *d++ = tmp;); - } - *d = 0; + ret = avio_get_str16le(pb, desc_len, desc, sizeof(desc)); + avio_seek(pb, desc_len - ret, SEEK_CUR); if (*desc) av_metadata_set2(&st->metadata, "title", desc, 0); - ptr = end + 2; - size = bytestream_get_le32(&ptr); - size = FFMIN(size, pkt->size+pkt->data-ptr); + avio_rl16(pb); /* flags? */ + avio_rl32(pb); /* data size */ - pd = (AVProbeData) { .buf = ptr, .buf_size = size }; + pd = (AVProbeData) { .buf = pb->buf_ptr, .buf_size = pb->buf_end - pb->buf_ptr }; if (!(sub_demuxer = av_probe_input_format2(&pd, 1, &score))) - return 0; + goto error; - pb = av_alloc_put_byte(ptr, size, 0, NULL, NULL, NULL, NULL); if (!av_open_input_stream(&ast->sub_ctx, pb, "", sub_demuxer, NULL)) { av_read_packet(ast->sub_ctx, &ast->sub_pkt); *st->codec = *ast->sub_ctx->streams[0]->codec; @@ -793,6 +785,8 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) { ast->sub_buffer = pkt->data; memset(pkt, 0, sizeof(*pkt)); return 1; +error: + av_freep(&pb); } return 0; } @@ -842,7 +836,7 @@ static int get_stream_idx(int *d){ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) { AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int n, d[8]; unsigned int size; int64_t i, sync; @@ -900,7 +894,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) if(i>=0){ int64_t pos= best_st->index_entries[i].pos; pos += best_ast->packet_size - best_ast->remaining; - url_fseek(s->pb, pos + 8, SEEK_SET); + avio_seek(s->pb, pos + 8, SEEK_SET); // av_log(s, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos); assert(best_ast->remaining <= best_ast->packet_size); @@ -1002,7 +996,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) for(j=0; j<7; j++) d[j]= d[j+1]; - d[7]= get_byte(pb); + d[7]= avio_r8(pb); size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24); @@ -1016,14 +1010,14 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) //parse JUNK ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){ - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); //av_log(s, AV_LOG_DEBUG, "SKIP\n"); goto resync; } //parse stray LIST if(d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T'){ - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); goto resync; } @@ -1034,7 +1028,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) //detect ##ix chunk and skip if(d[2] == 'i' && d[3] == 'x' && n < s->nb_streams){ - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); goto resync; } @@ -1068,18 +1062,18 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) /*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering || st->discard >= AVDISCARD_ALL){ ast->frame_offset += get_duration(ast, size); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); goto resync; } if (d[2] == 'p' && d[3] == 'c' && size<=4*256+4) { - int k = get_byte(pb); - int last = (k + get_byte(pb) - 1) & 0xFF; + int k = avio_r8(pb); + int last = (k + avio_r8(pb) - 1) & 0xFF; - get_le16(pb); //flags + avio_rl16(pb); //flags for (; k <= last; k++) - ast->pal[k] = get_be32(pb)>>8;// b + (g << 8) + (r << 16); + ast->pal[k] = avio_rb32(pb)>>8;// b + (g << 8) + (r << 16); ast->has_pal= 1; goto resync; } else if( ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) || @@ -1118,7 +1112,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) static int avi_read_idx1(AVFormatContext *s, int size) { AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int nb_index_entries, i; AVStream *st; AVIStream *ast; @@ -1131,10 +1125,10 @@ static int avi_read_idx1(AVFormatContext *s, int size) /* Read the entries and sort them in each stream component. */ for(i = 0; i < nb_index_entries; i++) { - tag = get_le32(pb); - flags = get_le32(pb); - pos = get_le32(pb); - len = get_le32(pb); + tag = avio_rl32(pb); + flags = avio_rl32(pb); + pos = avio_rl32(pb); + len = avio_rl32(pb); #if defined(DEBUG_SEEK) av_log(s, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/", i, tag, flags, pos, len); @@ -1182,8 +1176,8 @@ static int guess_ni_flag(AVFormatContext *s){ if(n >= 2){ int64_t pos= st->index_entries[0].pos; - url_fseek(s->pb, pos + 4, SEEK_SET); - size= get_le32(s->pb); + avio_seek(s->pb, pos + 4, SEEK_SET); + size= avio_rl32(s->pb); if(pos + size > st->index_entries[1].pos) last_start= INT64_MAX; } @@ -1193,19 +1187,19 @@ static int guess_ni_flag(AVFormatContext *s){ if(st->index_entries[n-1].pos < first_end) first_end= st->index_entries[n-1].pos; } - url_fseek(s->pb, oldpos, SEEK_SET); + avio_seek(s->pb, oldpos, SEEK_SET); return last_start > first_end; } static int avi_load_index(AVFormatContext *s) { AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint32_t tag, size; int64_t pos= url_ftell(pb); int ret = -1; - if (url_fseek(pb, avi->movi_end, SEEK_SET) < 0) + if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0) goto the_end; // maybe truncated file #ifdef DEBUG_SEEK printf("movi_end=0x%"PRIx64"\n", avi->movi_end); @@ -1213,8 +1207,8 @@ static int avi_load_index(AVFormatContext *s) for(;;) { if (url_feof(pb)) break; - tag = get_le32(pb); - size = get_le32(pb); + tag = avio_rl32(pb); + size = avio_rl32(pb); #ifdef DEBUG_SEEK printf("tag=%c%c%c%c size=0x%x\n", tag & 0xff, @@ -1233,13 +1227,13 @@ static int avi_load_index(AVFormatContext *s) default: skip: size += (size & 1); - if (url_fseek(pb, size, SEEK_CUR) < 0) + if (avio_seek(pb, size, SEEK_CUR) < 0) goto the_end; // something is wrong here break; } } the_end: - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); return ret; } @@ -1290,7 +1284,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp /* DV demux so it can synthesize correct timestamps. */ dv_offset_reset(avi->dv_demux, timestamp); - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); avi->stream_index= -1; return 0; } @@ -1332,7 +1326,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp } /* do the seek */ - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); avi->stream_index= -1; return 0; } @@ -1356,8 +1350,7 @@ static int avi_read_close(AVFormatContext *s) } } - if (avi->dv_demux) - av_free(avi->dv_demux); + av_free(avi->dv_demux); return 0; } diff --git a/mplayer/ffmpeg/libavformat/avienc.c b/mplayer/ffmpeg/libavformat/avienc.c index 33976570..5aab1925 100644 --- a/mplayer/ffmpeg/libavformat/avienc.c +++ b/mplayer/ffmpeg/libavformat/avienc.c @@ -20,6 +20,7 @@ */ #include "avformat.h" #include "avi.h" +#include "avio_internal.h" #include "riff.h" #include "libavutil/intreadwrite.h" @@ -63,7 +64,7 @@ static inline AVIIentry* avi_get_ientry(AVIIndex* idx, int ent_id) return &idx->cluster[cl][id]; } -static int64_t avi_start_new_riff(AVFormatContext *s, ByteIOContext *pb, +static int64_t avi_start_new_riff(AVFormatContext *s, AVIOContext *pb, const char* riff_tag, const char* list_tag) { AVIContext *avi= s->priv_data; @@ -77,16 +78,16 @@ static int64_t avi_start_new_riff(AVFormatContext *s, ByteIOContext *pb, } avi->riff_start = ff_start_tag(pb, "RIFF"); - put_tag(pb, riff_tag); + ffio_wfourcc(pb, riff_tag); loff = ff_start_tag(pb, "LIST"); - put_tag(pb, list_tag); + ffio_wfourcc(pb, list_tag); return loff; } static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type) { - tag[0] = '0'; - tag[1] = '0' + index; + tag[0] = '0' + index/10; + tag[1] = '0' + index%10; if (type == AVMEDIA_TYPE_VIDEO) { tag[2] = 'd'; tag[3] = 'c'; @@ -102,22 +103,22 @@ static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type) return tag; } -static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *str) +static void avi_write_info_tag(AVIOContext *pb, const char *tag, const char *str) { int len = strlen(str); if (len > 0) { len++; - put_tag(pb, tag); - put_le32(pb, len); + ffio_wfourcc(pb, tag); + avio_wl32(pb, len); avio_put_str(pb, str); if (len & 1) - put_byte(pb, 0); + avio_w8(pb, 0); } } static int avi_write_counters(AVFormatContext* s, int riff_id) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVIContext *avi = s->priv_data; int n, au_byterate, au_ssize, au_scale, nb_frames = 0; int64_t file_size; @@ -129,22 +130,22 @@ static int avi_write_counters(AVFormatContext* s, int riff_id) assert(avist->frames_hdr_strm); stream = s->streams[n]->codec; - url_fseek(pb, avist->frames_hdr_strm, SEEK_SET); + avio_seek(pb, avist->frames_hdr_strm, SEEK_SET); ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale); if(au_ssize == 0) { - put_le32(pb, avist->packet_count); + avio_wl32(pb, avist->packet_count); } else { - put_le32(pb, avist->audio_strm_length / au_ssize); + avio_wl32(pb, avist->audio_strm_length / au_ssize); } if(stream->codec_type == AVMEDIA_TYPE_VIDEO) nb_frames = FFMAX(nb_frames, avist->packet_count); } if(riff_id == 1) { assert(avi->frames_hdr_all); - url_fseek(pb, avi->frames_hdr_all, SEEK_SET); - put_le32(pb, nb_frames); + avio_seek(pb, avi->frames_hdr_all, SEEK_SET); + avio_wl32(pb, nb_frames); } - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); return 0; } @@ -152,12 +153,18 @@ static int avi_write_counters(AVFormatContext* s, int riff_id) static int avi_write_header(AVFormatContext *s) { AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale; AVCodecContext *stream, *video_enc; int64_t list1, list2, strh, strf; AVMetadataTag *t = NULL; + if (s->nb_streams > AVI_MAX_STREAM_COUNT) { + av_log(s, AV_LOG_ERROR, "AVI does not support >%d streams\n", + AVI_MAX_STREAM_COUNT); + return -1; + } + for(n=0;nnb_streams;n++) { s->streams[n]->priv_data= av_mallocz(sizeof(AVIStream)); if(!s->streams[n]->priv_data) @@ -169,8 +176,8 @@ static int avi_write_header(AVFormatContext *s) list1 = avi_start_new_riff(s, pb, "AVI ", "hdrl"); /* avi header */ - put_tag(pb, "avih"); - put_le32(pb, 14 * 4); + ffio_wfourcc(pb, "avih"); + avio_wl32(pb, 14 * 4); bitrate = 0; video_enc = NULL; @@ -184,38 +191,38 @@ static int avi_write_header(AVFormatContext *s) nb_frames = 0; if(video_enc){ - put_le32(pb, (uint32_t)(INT64_C(1000000) * video_enc->time_base.num / video_enc->time_base.den)); + avio_wl32(pb, (uint32_t)(INT64_C(1000000) * video_enc->time_base.num / video_enc->time_base.den)); } else { - put_le32(pb, 0); + avio_wl32(pb, 0); } - put_le32(pb, bitrate / 8); /* XXX: not quite exact */ - put_le32(pb, 0); /* padding */ + avio_wl32(pb, bitrate / 8); /* XXX: not quite exact */ + avio_wl32(pb, 0); /* padding */ if (url_is_streamed(pb)) - put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */ + avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */ else - put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */ + avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */ avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */ - put_le32(pb, nb_frames); /* nb frames, filled later */ - put_le32(pb, 0); /* initial frame */ - put_le32(pb, s->nb_streams); /* nb streams */ - put_le32(pb, 1024 * 1024); /* suggested buffer size */ + avio_wl32(pb, nb_frames); /* nb frames, filled later */ + avio_wl32(pb, 0); /* initial frame */ + avio_wl32(pb, s->nb_streams); /* nb streams */ + avio_wl32(pb, 1024 * 1024); /* suggested buffer size */ if(video_enc){ - put_le32(pb, video_enc->width); - put_le32(pb, video_enc->height); + avio_wl32(pb, video_enc->width); + avio_wl32(pb, video_enc->height); } else { - put_le32(pb, 0); - put_le32(pb, 0); + avio_wl32(pb, 0); + avio_wl32(pb, 0); } - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ /* stream list */ for(i=0;istreams[i]->priv_data; list2 = ff_start_tag(pb, "LIST"); - put_tag(pb, "strl"); + ffio_wfourcc(pb, "strl"); stream = s->streams[i]->codec; @@ -229,46 +236,46 @@ static int avi_write_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "Subtitle streams other than DivX XSUB are not supported by the AVI muxer.\n"); return AVERROR_PATCHWELCOME; } - case AVMEDIA_TYPE_VIDEO: put_tag(pb, "vids"); break; - case AVMEDIA_TYPE_AUDIO: put_tag(pb, "auds"); break; -// case AVMEDIA_TYPE_TEXT : put_tag(pb, "txts"); break; - case AVMEDIA_TYPE_DATA : put_tag(pb, "dats"); break; + case AVMEDIA_TYPE_VIDEO: ffio_wfourcc(pb, "vids"); break; + case AVMEDIA_TYPE_AUDIO: ffio_wfourcc(pb, "auds"); break; +// case AVMEDIA_TYPE_TEXT : ffio_wfourcc(pb, "txts"); break; + case AVMEDIA_TYPE_DATA : ffio_wfourcc(pb, "dats"); break; } if(stream->codec_type == AVMEDIA_TYPE_VIDEO || stream->codec_id == CODEC_ID_XSUB) - put_le32(pb, stream->codec_tag); + avio_wl32(pb, stream->codec_tag); else - put_le32(pb, 1); - put_le32(pb, 0); /* flags */ - put_le16(pb, 0); /* priority */ - put_le16(pb, 0); /* language */ - put_le32(pb, 0); /* initial frame */ + avio_wl32(pb, 1); + avio_wl32(pb, 0); /* flags */ + avio_wl16(pb, 0); /* priority */ + avio_wl16(pb, 0); /* language */ + avio_wl32(pb, 0); /* initial frame */ ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale); - put_le32(pb, au_scale); /* scale */ - put_le32(pb, au_byterate); /* rate */ + avio_wl32(pb, au_scale); /* scale */ + avio_wl32(pb, au_byterate); /* rate */ av_set_pts_info(s->streams[i], 64, au_scale, au_byterate); - put_le32(pb, 0); /* start */ + avio_wl32(pb, 0); /* start */ avist->frames_hdr_strm = url_ftell(pb); /* remember this offset to fill later */ if (url_is_streamed(pb)) - put_le32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */ + avio_wl32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */ else - put_le32(pb, 0); /* length, XXX: filled later */ + avio_wl32(pb, 0); /* length, XXX: filled later */ /* suggested buffer size */ //FIXME set at the end to largest chunk if(stream->codec_type == AVMEDIA_TYPE_VIDEO) - put_le32(pb, 1024 * 1024); + avio_wl32(pb, 1024 * 1024); else if(stream->codec_type == AVMEDIA_TYPE_AUDIO) - put_le32(pb, 12 * 1024); + avio_wl32(pb, 12 * 1024); else - put_le32(pb, 0); - put_le32(pb, -1); /* quality */ - put_le32(pb, au_ssize); /* sample size */ - put_le32(pb, 0); - put_le16(pb, stream->width); - put_le16(pb, stream->height); + avio_wl32(pb, 0); + avio_wl32(pb, -1); /* quality */ + avio_wl32(pb, au_ssize); /* sample size */ + avio_wl32(pb, 0); + avio_wl16(pb, stream->width); + avio_wl16(pb, stream->height); ff_end_tag(pb, strh); if(stream->codec_type != AVMEDIA_TYPE_DATA){ @@ -307,16 +314,16 @@ static int avi_write_header(AVFormatContext *s) */ avist->indexes.entry = avist->indexes.ents_allocated = 0; avist->indexes.indx_start = ff_start_tag(pb, "JUNK"); - put_le16(pb, 4); /* wLongsPerEntry */ - put_byte(pb, 0); /* bIndexSubType (0 == frame index) */ - put_byte(pb, 0); /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */ - put_le32(pb, 0); /* nEntriesInUse (will fill out later on) */ - put_tag(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type)); + avio_wl16(pb, 4); /* wLongsPerEntry */ + avio_w8(pb, 0); /* bIndexSubType (0 == frame index) */ + avio_w8(pb, 0); /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */ + avio_wl32(pb, 0); /* nEntriesInUse (will fill out later on) */ + ffio_wfourcc(pb, avi_stream2fourcc(tag, i, stream->codec_type)); /* dwChunkId */ - put_le64(pb, 0); /* dwReserved[3] - put_le32(pb, 0); Must be 0. */ + avio_wl64(pb, 0); /* dwReserved[3] + avio_wl32(pb, 0); Must be 0. */ for (j=0; j < AVI_MASTER_INDEX_SIZE * 2; j++) - put_le64(pb, 0); + avio_wl64(pb, 0); ff_end_tag(pb, avist->indexes.indx_start); } @@ -329,26 +336,26 @@ static int avi_write_header(AVFormatContext *s) int num, den; av_reduce(&num, &den, dar.num, dar.den, 0xFFFF); - put_le32(pb, 0); //video format = unknown - put_le32(pb, 0); //video standard= unknown - put_le32(pb, lrintf(1.0/av_q2d(stream->time_base))); - put_le32(pb, stream->width ); - put_le32(pb, stream->height); - put_le16(pb, den); - put_le16(pb, num); - put_le32(pb, stream->width ); - put_le32(pb, stream->height); - put_le32(pb, 1); //progressive FIXME - - put_le32(pb, stream->height); - put_le32(pb, stream->width ); - put_le32(pb, stream->height); - put_le32(pb, stream->width ); - put_le32(pb, 0); - put_le32(pb, 0); - - put_le32(pb, 0); - put_le32(pb, 0); + avio_wl32(pb, 0); //video format = unknown + avio_wl32(pb, 0); //video standard= unknown + avio_wl32(pb, lrintf(1.0/av_q2d(stream->time_base))); + avio_wl32(pb, stream->width ); + avio_wl32(pb, stream->height); + avio_wl16(pb, den); + avio_wl16(pb, num); + avio_wl32(pb, stream->width ); + avio_wl32(pb, stream->height); + avio_wl32(pb, 1); //progressive FIXME + + avio_wl32(pb, stream->height); + avio_wl32(pb, stream->width ); + avio_wl32(pb, stream->height); + avio_wl32(pb, stream->width ); + avio_wl32(pb, 0); + avio_wl32(pb, 0); + + avio_wl32(pb, 0); + avio_wl32(pb, 0); ff_end_tag(pb, vprp); } @@ -358,18 +365,18 @@ static int avi_write_header(AVFormatContext *s) if (!url_is_streamed(pb)) { /* AVI could become an OpenDML one, if it grows beyond 2Gb range */ avi->odml_list = ff_start_tag(pb, "JUNK"); - put_tag(pb, "odml"); - put_tag(pb, "dmlh"); - put_le32(pb, 248); + ffio_wfourcc(pb, "odml"); + ffio_wfourcc(pb, "dmlh"); + avio_wl32(pb, 248); for (i = 0; i < 248; i+= 4) - put_le32(pb, 0); + avio_wl32(pb, 0); ff_end_tag(pb, avi->odml_list); } ff_end_tag(pb, list1); list2 = ff_start_tag(pb, "LIST"); - put_tag(pb, "INFO"); + ffio_wfourcc(pb, "INFO"); ff_metadata_conv(&s->metadata, ff_avi_metadata_conv, NULL); for (i = 0; *ff_avi_tags[i]; i++) { if ((t = av_metadata_get(s->metadata, ff_avi_tags[i], NULL, AV_METADATA_MATCH_CASE))) @@ -380,11 +387,11 @@ static int avi_write_header(AVFormatContext *s) /* some padding for easier tag editing */ list2 = ff_start_tag(pb, "JUNK"); for (i = 0; i < 1016; i += 4) - put_le32(pb, 0); + avio_wl32(pb, 0); ff_end_tag(pb, list2); avi->movi_list = ff_start_tag(pb, "LIST"); - put_tag(pb, "movi"); + ffio_wfourcc(pb, "movi"); put_flush_packet(pb); @@ -393,7 +400,7 @@ static int avi_write_header(AVFormatContext *s) static int avi_write_ix(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVIContext *avi = s->priv_data; char tag[5]; char ix_tag[] = "ix00"; @@ -408,50 +415,50 @@ static int avi_write_ix(AVFormatContext *s) AVIStream *avist= s->streams[i]->priv_data; int64_t ix, pos; - avi_stream2fourcc(&tag[0], i, s->streams[i]->codec->codec_type); + avi_stream2fourcc(tag, i, s->streams[i]->codec->codec_type); ix_tag[3] = '0' + i; /* Writing AVI OpenDML leaf index chunk */ ix = url_ftell(pb); - put_tag(pb, &ix_tag[0]); /* ix?? */ - put_le32(pb, avist->indexes.entry * 8 + 24); + ffio_wfourcc(pb, ix_tag); /* ix?? */ + avio_wl32(pb, avist->indexes.entry * 8 + 24); /* chunk size */ - put_le16(pb, 2); /* wLongsPerEntry */ - put_byte(pb, 0); /* bIndexSubType (0 == frame index) */ - put_byte(pb, 1); /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */ - put_le32(pb, avist->indexes.entry); + avio_wl16(pb, 2); /* wLongsPerEntry */ + avio_w8(pb, 0); /* bIndexSubType (0 == frame index) */ + avio_w8(pb, 1); /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */ + avio_wl32(pb, avist->indexes.entry); /* nEntriesInUse */ - put_tag(pb, &tag[0]); /* dwChunkId */ - put_le64(pb, avi->movi_list);/* qwBaseOffset */ - put_le32(pb, 0); /* dwReserved_3 (must be 0) */ + ffio_wfourcc(pb, tag); /* dwChunkId */ + avio_wl64(pb, avi->movi_list);/* qwBaseOffset */ + avio_wl32(pb, 0); /* dwReserved_3 (must be 0) */ for (j=0; jindexes.entry; j++) { AVIIentry* ie = avi_get_ientry(&avist->indexes, j); - put_le32(pb, ie->pos + 8); - put_le32(pb, ((uint32_t)ie->len & ~0x80000000) | + avio_wl32(pb, ie->pos + 8); + avio_wl32(pb, ((uint32_t)ie->len & ~0x80000000) | (ie->flags & 0x10 ? 0 : 0x80000000)); } put_flush_packet(pb); pos = url_ftell(pb); /* Updating one entry in the AVI OpenDML master index */ - url_fseek(pb, avist->indexes.indx_start - 8, SEEK_SET); - put_tag(pb, "indx"); /* enabling this entry */ - url_fskip(pb, 8); - put_le32(pb, avi->riff_id); /* nEntriesInUse */ - url_fskip(pb, 16*avi->riff_id); - put_le64(pb, ix); /* qwOffset */ - put_le32(pb, pos - ix); /* dwSize */ - put_le32(pb, avist->indexes.entry); /* dwDuration */ - - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET); + ffio_wfourcc(pb, "indx"); /* enabling this entry */ + avio_seek(pb, 8, SEEK_CUR); + avio_wl32(pb, avi->riff_id); /* nEntriesInUse */ + avio_seek(pb, 16*avi->riff_id, SEEK_CUR); + avio_wl64(pb, ix); /* qwOffset */ + avio_wl32(pb, pos - ix); /* dwSize */ + avio_wl32(pb, avist->indexes.entry); /* dwDuration */ + + avio_seek(pb, pos, SEEK_SET); } return 0; } static int avi_write_idx1(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVIContext *avi = s->priv_data; int64_t idx_chunk; int i; @@ -484,12 +491,12 @@ static int avi_write_idx1(AVFormatContext *s) } if (!empty) { avist= s->streams[stream_id]->priv_data; - avi_stream2fourcc(&tag[0], stream_id, + avi_stream2fourcc(tag, stream_id, s->streams[stream_id]->codec->codec_type); - put_tag(pb, &tag[0]); - put_le32(pb, ie->flags); - put_le32(pb, ie->pos); - put_le32(pb, ie->len); + ffio_wfourcc(pb, tag); + avio_wl32(pb, ie->flags); + avio_wl32(pb, ie->pos); + avio_wl32(pb, ie->len); avist->entry++; } } while (!empty); @@ -503,7 +510,7 @@ static int avi_write_idx1(AVFormatContext *s) static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) { AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned char tag[5]; unsigned int flags=0; const int stream_index= pkt->stream_index; @@ -538,7 +545,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) avi->movi_list = avi_start_new_riff(s, pb, "AVIX", "movi"); } - avi_stream2fourcc(&tag[0], stream_index, enc->codec_type); + avi_stream2fourcc(tag, stream_index, enc->codec_type); if(pkt->flags&AV_PKT_FLAG_KEY) flags = 0x10; if (enc->codec_type == AVMEDIA_TYPE_AUDIO) { @@ -565,11 +572,11 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) idx->entry++; } - put_buffer(pb, tag, 4); - put_le32(pb, size); - put_buffer(pb, pkt->data, size); + avio_write(pb, tag, 4); + avio_wl32(pb, size); + avio_write(pb, pkt->data, size); if (size & 1) - put_byte(pb, 0); + avio_w8(pb, 0); put_flush_packet(pb); return 0; @@ -578,7 +585,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) static int avi_write_trailer(AVFormatContext *s) { AVIContext *avi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int res = 0; int i, j, n, nb_frames; int64_t file_size; @@ -594,9 +601,9 @@ static int avi_write_trailer(AVFormatContext *s) ff_end_tag(pb, avi->riff_start); file_size = url_ftell(pb); - url_fseek(pb, avi->odml_list - 8, SEEK_SET); - put_tag(pb, "LIST"); /* Making this AVI OpenDML one */ - url_fskip(pb, 16); + avio_seek(pb, avi->odml_list - 8, SEEK_SET); + ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */ + avio_seek(pb, 16, SEEK_CUR); for (n=nb_frames=0;nnb_streams;n++) { AVCodecContext *stream = s->streams[n]->codec; @@ -611,8 +618,8 @@ static int avi_write_trailer(AVFormatContext *s) } } } - put_le32(pb, nb_frames); - url_fseek(pb, file_size, SEEK_SET); + avio_wl32(pb, nb_frames); + avio_seek(pb, file_size, SEEK_SET); avi_write_counters(s, avi->riff_id); } diff --git a/mplayer/ffmpeg/libavformat/avio.c b/mplayer/ffmpeg/libavformat/avio.c index 9a4d7355..a19ec37c 100644 --- a/mplayer/ffmpeg/libavformat/avio.c +++ b/mplayer/ffmpeg/libavformat/avio.c @@ -206,24 +206,21 @@ int url_open(URLContext **puc, const char *filename, int flags) return ret; } -int url_read(URLContext *h, unsigned char *buf, int size) -{ - int ret; - if (h->flags & URL_WRONLY) - return AVERROR(EIO); - ret = h->prot->url_read(h, buf, size); - return ret; -} - -static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int size, +static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int size, int size_min, int (*transfer_func)(URLContext *h, unsigned char *buf, int size)) { int ret, len; int fast_retries = 5; len = 0; - while (len < size) { + while (len < size_min) { + if (url_interrupt_cb()) + return AVERROR(EINTR); ret = transfer_func(h, buf+len, size-len); + if (ret == AVERROR(EINTR)) + continue; + if (h->flags & URL_FLAG_NONBLOCK) + return ret; if (ret == AVERROR(EAGAIN)) { ret = 0; if (fast_retries) @@ -239,9 +236,18 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int return len; } +int url_read(URLContext *h, unsigned char *buf, int size) +{ + if (h->flags & URL_WRONLY) + return AVERROR(EIO); + return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read); +} + int url_read_complete(URLContext *h, unsigned char *buf, int size) { - return retry_transfer_wrapper(h, buf, size, url_read); + if (h->flags & URL_WRONLY) + return AVERROR(EIO); + return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read); } int url_write(URLContext *h, const unsigned char *buf, int size) @@ -252,7 +258,7 @@ int url_write(URLContext *h, const unsigned char *buf, int size) if (h->max_packet_size && size > h->max_packet_size) return AVERROR(EIO); - return retry_transfer_wrapper(h, buf, size, h->prot->url_write); + return retry_transfer_wrapper(h, buf, size, size, h->prot->url_write); } int64_t url_seek(URLContext *h, int64_t pos, int whence) diff --git a/mplayer/ffmpeg/libavformat/avio.h b/mplayer/ffmpeg/libavformat/avio.h index a606f7cb..cc46ad79 100644 --- a/mplayer/ffmpeg/libavformat/avio.h +++ b/mplayer/ffmpeg/libavformat/avio.h @@ -63,9 +63,32 @@ typedef struct URLPollEntry { int revents; } URLPollEntry; -#define URL_RDONLY 0 -#define URL_WRONLY 1 -#define URL_RDWR 2 +/** + * @defgroup open_modes URL open modes + * The flags argument to url_open and cosins must be one of the following + * constants, optionally ORed with other flags. + * @{ + */ +#define URL_RDONLY 0 /**< read-only */ +#define URL_WRONLY 1 /**< write-only */ +#define URL_RDWR 2 /**< read-write */ +/** + * @} + */ + +/** + * Use non-blocking mode. + * If this flag is set, operations on the context will return + * AVERROR(EAGAIN) if they can not be performed immediately. + * If this flag is not set, operations on the context will never return + * AVERROR(EAGAIN). + * Note that this flag does not affect the opening/connecting of the + * context. Connecting a protocol will always block if necessary (e.g. on + * network protocols) but never hang (e.g. on busy devices). + * Warning: non-blocking protocols is work-in-progress; this flag may be + * silently ignored. + */ +#define URL_FLAG_NONBLOCK 4 typedef int URLInterruptCB(void); @@ -128,7 +151,6 @@ int url_read(URLContext *h, unsigned char *buf, int size); /** * Read as many bytes as possible (up to size), calling the * read function multiple times if necessary. - * Will also retry if the read function returns AVERROR(EAGAIN). * This makes special short-read handling in applications * unnecessary, if the return value is < size then it is * certain there was either an error or the end of file was reached. @@ -312,7 +334,7 @@ int av_register_protocol2(URLProtocol *protocol, int size); * New fields can be added to the end with minor version bumps. * Removal, reordering and changes to existing fields require a major * version bump. - * sizeof(ByteIOContext) must not be used outside libav*. + * sizeof(AVIOContext) must not be used outside libav*. */ typedef struct { unsigned char *buffer; @@ -335,9 +357,12 @@ typedef struct { int (*read_pause)(void *opaque, int pause); int64_t (*read_seek)(void *opaque, int stream_index, int64_t timestamp, int flags); -} ByteIOContext; +} AVIOContext; -int init_put_byte(ByteIOContext *s, +#if FF_API_OLD_AVIO +typedef attribute_deprecated AVIOContext ByteIOContext; + +attribute_deprecated int init_put_byte(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, @@ -345,7 +370,7 @@ int init_put_byte(ByteIOContext *s, int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(void *opaque, int64_t offset, int whence)); -ByteIOContext *av_alloc_put_byte( +attribute_deprecated AVIOContext *av_alloc_put_byte( unsigned char *buffer, int buffer_size, int write_flag, @@ -354,111 +379,151 @@ ByteIOContext *av_alloc_put_byte( int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(void *opaque, int64_t offset, int whence)); -void put_byte(ByteIOContext *s, int b); -void put_nbyte(ByteIOContext *s, int b, int count); -void put_buffer(ByteIOContext *s, const unsigned char *buf, int size); -void put_le64(ByteIOContext *s, uint64_t val); -void put_be64(ByteIOContext *s, uint64_t val); -void put_le32(ByteIOContext *s, unsigned int val); -void put_be32(ByteIOContext *s, unsigned int val); -void put_le24(ByteIOContext *s, unsigned int val); -void put_be24(ByteIOContext *s, unsigned int val); -void put_le16(ByteIOContext *s, unsigned int val); -void put_be16(ByteIOContext *s, unsigned int val); -void put_tag(ByteIOContext *s, const char *tag); +/** + * @defgroup old_avio_funcs Old put_/get_*() functions + * @deprecated use the avio_ -prefixed functions instead. + * @{ + */ +attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size); +attribute_deprecated int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size); +attribute_deprecated int get_byte(AVIOContext *s); +attribute_deprecated unsigned int get_le16(AVIOContext *s); +attribute_deprecated unsigned int get_le24(AVIOContext *s); +attribute_deprecated unsigned int get_le32(AVIOContext *s); +attribute_deprecated uint64_t get_le64(AVIOContext *s); +attribute_deprecated unsigned int get_be16(AVIOContext *s); +attribute_deprecated unsigned int get_be24(AVIOContext *s); +attribute_deprecated unsigned int get_be32(AVIOContext *s); +attribute_deprecated uint64_t get_be64(AVIOContext *s); + +attribute_deprecated void put_byte(AVIOContext *s, int b); +attribute_deprecated void put_nbyte(AVIOContext *s, int b, int count); +attribute_deprecated void put_buffer(AVIOContext *s, const unsigned char *buf, int size); +attribute_deprecated void put_le64(AVIOContext *s, uint64_t val); +attribute_deprecated void put_be64(AVIOContext *s, uint64_t val); +attribute_deprecated void put_le32(AVIOContext *s, unsigned int val); +attribute_deprecated void put_be32(AVIOContext *s, unsigned int val); +attribute_deprecated void put_le24(AVIOContext *s, unsigned int val); +attribute_deprecated void put_be24(AVIOContext *s, unsigned int val); +attribute_deprecated void put_le16(AVIOContext *s, unsigned int val); +attribute_deprecated void put_be16(AVIOContext *s, unsigned int val); +attribute_deprecated void put_tag(AVIOContext *s, const char *tag); +/** + * @} + */ + + +/** + * @defgroup old_url_f_funcs Old url_f* functions + * @deprecated use the avio_ -prefixed functions instead. + * @{ + */ +attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags); +attribute_deprecated int url_fclose(AVIOContext *s); +attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence); +attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset); +/** + * @} + */ +#endif + +AVIOContext *avio_alloc_context( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); + +void avio_w8(AVIOContext *s, int b); +void avio_write(AVIOContext *s, const unsigned char *buf, int size); +void avio_wl64(AVIOContext *s, uint64_t val); +void avio_wb64(AVIOContext *s, uint64_t val); +void avio_wl32(AVIOContext *s, unsigned int val); +void avio_wb32(AVIOContext *s, unsigned int val); +void avio_wl24(AVIOContext *s, unsigned int val); +void avio_wb24(AVIOContext *s, unsigned int val); +void avio_wl16(AVIOContext *s, unsigned int val); +void avio_wb16(AVIOContext *s, unsigned int val); #if FF_API_OLD_AVIO -attribute_deprecated void put_strz(ByteIOContext *s, const char *buf); +attribute_deprecated void put_strz(AVIOContext *s, const char *buf); #endif /** * Write a NULL-terminated string. * @return number of bytes written. */ -int avio_put_str(ByteIOContext *s, const char *str); +int avio_put_str(AVIOContext *s, const char *str); /** * Convert an UTF-8 string to UTF-16LE and write it. * @return number of bytes written. */ -int avio_put_str16le(ByteIOContext *s, const char *str); +int avio_put_str16le(AVIOContext *s, const char *str); /** - * fseek() equivalent for ByteIOContext. + * fseek() equivalent for AVIOContext. * @return new position or AVERROR. */ -int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence); - -/** - * Skip given number of bytes forward. - * @param offset number of bytes - * @return 0 on success, <0 on error - */ -int url_fskip(ByteIOContext *s, int64_t offset); +int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); /** - * ftell() equivalent for ByteIOContext. + * ftell() equivalent for AVIOContext. * @return position or AVERROR. */ -int64_t url_ftell(ByteIOContext *s); +int64_t url_ftell(AVIOContext *s); /** * Get the filesize. * @return filesize or AVERROR */ -int64_t url_fsize(ByteIOContext *s); +int64_t url_fsize(AVIOContext *s); /** - * feof() equivalent for ByteIOContext. + * feof() equivalent for AVIOContext. * @return non zero if and only if end of file */ -int url_feof(ByteIOContext *s); +int url_feof(AVIOContext *s); -int url_ferror(ByteIOContext *s); +int url_ferror(AVIOContext *s); -int av_url_read_fpause(ByteIOContext *h, int pause); -int64_t av_url_read_fseek(ByteIOContext *h, int stream_index, +int av_url_read_fpause(AVIOContext *h, int pause); +int64_t av_url_read_fseek(AVIOContext *h, int stream_index, int64_t timestamp, int flags); #define URL_EOF (-1) /** @note return URL_EOF (-1) if EOF */ -int url_fgetc(ByteIOContext *s); +int url_fgetc(AVIOContext *s); /** @warning currently size is limited */ #ifdef __GNUC__ -int url_fprintf(ByteIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); +int url_fprintf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); #else -int url_fprintf(ByteIOContext *s, const char *fmt, ...); +int url_fprintf(AVIOContext *s, const char *fmt, ...); #endif /** @note unlike fgets, the EOL character is not returned and a whole line is parsed. return NULL if first char read was EOF */ -char *url_fgets(ByteIOContext *s, char *buf, int buf_size); +char *url_fgets(AVIOContext *s, char *buf, int buf_size); -void put_flush_packet(ByteIOContext *s); +void put_flush_packet(AVIOContext *s); /** - * Read size bytes from ByteIOContext into buf. - * @return number of bytes read or AVERROR - */ -int get_buffer(ByteIOContext *s, unsigned char *buf, int size); - -/** - * Read size bytes from ByteIOContext into buf. - * This reads at most 1 packet. If that is not enough fewer bytes will be - * returned. + * Read size bytes from AVIOContext into buf. * @return number of bytes read or AVERROR */ -int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size); +int avio_read(AVIOContext *s, unsigned char *buf, int size); /** @note return 0 if EOF, so you cannot use it if EOF handling is necessary */ -int get_byte(ByteIOContext *s); -unsigned int get_le24(ByteIOContext *s); -unsigned int get_le32(ByteIOContext *s); -uint64_t get_le64(ByteIOContext *s); -unsigned int get_le16(ByteIOContext *s); +int avio_r8 (AVIOContext *s); +unsigned int avio_rl16(AVIOContext *s); +unsigned int avio_rl24(AVIOContext *s); +unsigned int avio_rl32(AVIOContext *s); +uint64_t avio_rl64(AVIOContext *s); /** * Read a UTF-16 string from pb and convert it to UTF-8. @@ -466,77 +531,77 @@ unsigned int get_le16(ByteIOContext *s); * encountered or maxlen bytes have been read. * @return number of bytes read (is always <= maxlen) */ -int avio_get_str16le(ByteIOContext *pb, int maxlen, char *buf, int buflen); -int avio_get_str16be(ByteIOContext *pb, int maxlen, char *buf, int buflen); +int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); +int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); -char *get_strz(ByteIOContext *s, char *buf, int maxlen); -unsigned int get_be16(ByteIOContext *s); -unsigned int get_be24(ByteIOContext *s); -unsigned int get_be32(ByteIOContext *s); -uint64_t get_be64(ByteIOContext *s); +char *get_strz(AVIOContext *s, char *buf, int maxlen); +unsigned int avio_rb16(AVIOContext *s); +unsigned int avio_rb24(AVIOContext *s); +unsigned int avio_rb32(AVIOContext *s); +uint64_t avio_rb64(AVIOContext *s); -uint64_t ff_get_v(ByteIOContext *bc); +uint64_t ff_get_v(AVIOContext *bc); -static inline int url_is_streamed(ByteIOContext *s) +static inline int url_is_streamed(AVIOContext *s) { return s->is_streamed; } /** - * Create and initialize a ByteIOContext for accessing the + * Create and initialize a AVIOContext for accessing the * resource referenced by the URLContext h. * @note When the URLContext h has been opened in read+write mode, the - * ByteIOContext can be used only for writing. + * AVIOContext can be used only for writing. * - * @param s Used to return the pointer to the created ByteIOContext. + * @param s Used to return the pointer to the created AVIOContext. * In case of failure the pointed to value is set to NULL. * @return 0 in case of success, a negative value corresponding to an * AVERROR code in case of failure */ -int url_fdopen(ByteIOContext **s, URLContext *h); +int url_fdopen(AVIOContext **s, URLContext *h); /** @warning must be called before any I/O */ -int url_setbufsize(ByteIOContext *s, int buf_size); +int url_setbufsize(AVIOContext *s, int buf_size); #if FF_API_URL_RESETBUF /** Reset the buffer for reading or writing. * @note Will drop any data currently in the buffer without transmitting it. * @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY * to set up the buffer for writing. */ -int url_resetbuf(ByteIOContext *s, int flags); +int url_resetbuf(AVIOContext *s, int flags); #endif /** - * Rewind the ByteIOContext using the specified buffer containing the first buf_size bytes of the file. + * Rewind the AVIOContext using the specified buffer containing the first buf_size bytes of the file. * Used after probing to avoid seeking. * Joins buf and s->buffer, taking any overlap into consideration. * @note s->buffer must overlap with buf or they can't be joined and the function fails * @note This function is NOT part of the public API * - * @param s The read-only ByteIOContext to rewind + * @param s The read-only AVIOContext to rewind * @param buf The probe buffer containing the first buf_size bytes of the file * @param buf_size The size of buf * @return 0 in case of success, a negative value corresponding to an * AVERROR code in case of failure */ -int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size); +int ff_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size); /** - * Create and initialize a ByteIOContext for accessing the + * Create and initialize a AVIOContext for accessing the * resource indicated by url. * @note When the resource indicated by url has been opened in - * read+write mode, the ByteIOContext can be used only for writing. + * read+write mode, the AVIOContext can be used only for writing. * - * @param s Used to return the pointer to the created ByteIOContext. + * @param s Used to return the pointer to the created AVIOContext. * In case of failure the pointed to value is set to NULL. * @param flags flags which control how the resource indicated by url * is to be opened * @return 0 in case of success, a negative value corresponding to an * AVERROR code in case of failure */ -int url_fopen(ByteIOContext **s, const char *url, int flags); +int avio_open(AVIOContext **s, const char *url, int flags); -int url_fclose(ByteIOContext *s); -URLContext *url_fileno(ByteIOContext *s); +int avio_close(AVIOContext *s); +URLContext *url_fileno(AVIOContext *s); /** * Return the maximum packet size associated to packetized buffered file @@ -546,12 +611,12 @@ URLContext *url_fileno(ByteIOContext *s); * @param s buffered file handle * @return maximum packet size in bytes */ -int url_fget_max_packet_size(ByteIOContext *s); +int url_fget_max_packet_size(AVIOContext *s); -int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags); +int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags); /** return the written or read size */ -int url_close_buf(ByteIOContext *s); +int url_close_buf(AVIOContext *s); /** * Open a write only memory stream. @@ -559,7 +624,7 @@ int url_close_buf(ByteIOContext *s); * @param s new IO context * @return zero if no error. */ -int url_open_dyn_buf(ByteIOContext **s); +int url_open_dyn_buf(AVIOContext **s); /** * Open a write only packetized memory stream with a maximum packet @@ -570,7 +635,7 @@ int url_open_dyn_buf(ByteIOContext **s); * @param max_packet_size maximum packet size (must be > 0) * @return zero if no error. */ -int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size); +int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size); /** * Return the written size and a pointer to the buffer. The buffer @@ -582,12 +647,12 @@ int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size); * @param pbuffer pointer to a byte buffer * @return the length of the byte buffer */ -int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer); +int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, unsigned int len); -unsigned long get_checksum(ByteIOContext *s); -void init_checksum(ByteIOContext *s, +unsigned long get_checksum(AVIOContext *s); +void init_checksum(AVIOContext *s, unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum); diff --git a/mplayer/ffmpeg/libavformat/avio_internal.h b/mplayer/ffmpeg/libavformat/avio_internal.h new file mode 100644 index 00000000..3b38990f --- /dev/null +++ b/mplayer/ffmpeg/libavformat/avio_internal.h @@ -0,0 +1,47 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_AVIO_INTERNAL_H +#define AVFORMAT_AVIO_INTERNAL_H + +#include "avio.h" + +int ffio_init_context(AVIOContext *s, + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); + + +/** + * Read size bytes from AVIOContext into buf. + * This reads at most 1 packet. If that is not enough fewer bytes will be + * returned. + * @return number of bytes read or AVERROR + */ +int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size); + +void ffio_fill(AVIOContext *s, int b, int count); + +#define ffio_wfourcc(pb, str) avio_wl32(pb, MKTAG((str)[0], (str)[1], (str)[2], (str)[3])) + +#endif // AVFORMAT_AVIO_INTERNAL_H diff --git a/mplayer/ffmpeg/libavformat/aviobuf.c b/mplayer/ffmpeg/libavformat/aviobuf.c index acea8111..3f3721c5 100644 --- a/mplayer/ffmpeg/libavformat/aviobuf.c +++ b/mplayer/ffmpeg/libavformat/aviobuf.c @@ -23,6 +23,7 @@ #include "libavutil/intreadwrite.h" #include "avformat.h" #include "avio.h" +#include "avio_internal.h" #include "internal.h" #include @@ -35,12 +36,12 @@ */ #define SHORT_SEEK_THRESHOLD 4096 -static void fill_buffer(ByteIOContext *s); +static void fill_buffer(AVIOContext *s); #if !FF_API_URL_RESETBUF -static int url_resetbuf(ByteIOContext *s, int flags); +static int url_resetbuf(AVIOContext *s, int flags); #endif -int init_put_byte(ByteIOContext *s, +int ffio_init_context(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, @@ -73,7 +74,8 @@ int init_put_byte(ByteIOContext *s, return 0; } -ByteIOContext *av_alloc_put_byte( +#if FF_API_OLD_AVIO +int init_put_byte(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, @@ -82,13 +84,39 @@ ByteIOContext *av_alloc_put_byte( int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(void *opaque, int64_t offset, int whence)) { - ByteIOContext *s = av_mallocz(sizeof(ByteIOContext)); - init_put_byte(s, buffer, buffer_size, write_flag, opaque, + return ffio_init_context(s, buffer, buffer_size, write_flag, opaque, + read_packet, write_packet, seek); +} +AVIOContext *av_alloc_put_byte( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)) +{ + return avio_alloc_context(buffer, buffer_size, write_flag, opaque, + read_packet, write_packet, seek); +} +#endif + +AVIOContext *avio_alloc_context( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)) +{ + AVIOContext *s = av_mallocz(sizeof(AVIOContext)); + ffio_init_context(s, buffer, buffer_size, write_flag, opaque, read_packet, write_packet, seek); return s; } -static void flush_buffer(ByteIOContext *s) +static void flush_buffer(AVIOContext *s) { if (s->buf_ptr > s->buffer) { if (s->write_packet && !s->error){ @@ -106,14 +134,14 @@ static void flush_buffer(ByteIOContext *s) s->buf_ptr = s->buffer; } -void put_byte(ByteIOContext *s, int b) +void avio_w8(AVIOContext *s, int b) { *(s->buf_ptr)++ = b; if (s->buf_ptr >= s->buf_end) flush_buffer(s); } -void put_nbyte(ByteIOContext *s, int b, int count) +void ffio_fill(AVIOContext *s, int b, int count) { while (count > 0) { int len = FFMIN(s->buf_end - s->buf_ptr, count); @@ -127,7 +155,7 @@ void put_nbyte(ByteIOContext *s, int b, int count) } } -void put_buffer(ByteIOContext *s, const unsigned char *buf, int size) +void avio_write(AVIOContext *s, const unsigned char *buf, int size) { while (size > 0) { int len = FFMIN(s->buf_end - s->buf_ptr, size); @@ -142,13 +170,13 @@ void put_buffer(ByteIOContext *s, const unsigned char *buf, int size) } } -void put_flush_packet(ByteIOContext *s) +void put_flush_packet(AVIOContext *s) { flush_buffer(s); s->must_flush = 0; } -int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence) +int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) { int64_t offset1; int64_t pos; @@ -205,18 +233,20 @@ int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence) return offset; } -int url_fskip(ByteIOContext *s, int64_t offset) +#if FF_API_OLD_AVIO +int url_fskip(AVIOContext *s, int64_t offset) { - int64_t ret = url_fseek(s, offset, SEEK_CUR); + int64_t ret = avio_seek(s, offset, SEEK_CUR); return ret < 0 ? ret : 0; } +#endif -int64_t url_ftell(ByteIOContext *s) +int64_t url_ftell(AVIOContext *s) { - return url_fseek(s, 0, SEEK_CUR); + return avio_seek(s, 0, SEEK_CUR); } -int64_t url_fsize(ByteIOContext *s) +int64_t url_fsize(AVIOContext *s) { int64_t size; @@ -235,55 +265,126 @@ int64_t url_fsize(ByteIOContext *s) return size; } -int url_feof(ByteIOContext *s) +int url_feof(AVIOContext *s) { if(!s) return 0; return s->eof_reached; } -int url_ferror(ByteIOContext *s) +int url_ferror(AVIOContext *s) { if(!s) return 0; return s->error; } -void put_le32(ByteIOContext *s, unsigned int val) +void avio_wl32(AVIOContext *s, unsigned int val) { - put_byte(s, val); - put_byte(s, val >> 8); - put_byte(s, val >> 16); - put_byte(s, val >> 24); + avio_w8(s, val); + avio_w8(s, val >> 8); + avio_w8(s, val >> 16); + avio_w8(s, val >> 24); } -void put_be32(ByteIOContext *s, unsigned int val) +void avio_wb32(AVIOContext *s, unsigned int val) { - put_byte(s, val >> 24); - put_byte(s, val >> 16); - put_byte(s, val >> 8); - put_byte(s, val); + avio_w8(s, val >> 24); + avio_w8(s, val >> 16); + avio_w8(s, val >> 8); + avio_w8(s, val); } #if FF_API_OLD_AVIO -void put_strz(ByteIOContext *s, const char *str) +void put_strz(AVIOContext *s, const char *str) { avio_put_str(s, str); } + +#define GET(name, type) \ + type get_be ##name(AVIOContext *s) \ +{\ + return avio_rb ##name(s);\ +}\ + type get_le ##name(AVIOContext *s) \ +{\ + return avio_rl ##name(s);\ +} + +GET(16, unsigned int) +GET(24, unsigned int) +GET(32, unsigned int) +GET(64, uint64_t) + +#undef GET + +#define PUT(name, type ) \ + void put_le ##name(AVIOContext *s, type val)\ +{\ + avio_wl ##name(s, val);\ +}\ + void put_be ##name(AVIOContext *s, type val)\ +{\ + avio_wb ##name(s, val);\ +} + +PUT(16, unsigned int) +PUT(24, unsigned int) +PUT(32, unsigned int) +PUT(64, uint64_t) +#undef PUT + +int get_byte(AVIOContext *s) +{ + return avio_r8(s); +} +int get_buffer(AVIOContext *s, unsigned char *buf, int size) +{ + return avio_read(s, buf, size); +} +int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size) +{ + return ffio_read_partial(s, buf, size); +} +void put_byte(AVIOContext *s, int val) +{ + avio_w8(s, val); +} +void put_buffer(AVIOContext *s, const unsigned char *buf, int size) +{ + avio_write(s, buf, size); +} +void put_nbyte(AVIOContext *s, int b, int count) +{ + ffio_fill(s, b, count); +} + +int url_fopen(AVIOContext **s, const char *filename, int flags) +{ + return avio_open(s, filename, flags); +} +int url_fclose(AVIOContext *s) +{ + return avio_close(s); +} +int64_t url_fseek(AVIOContext *s, int64_t offset, int whence) +{ + return avio_seek(s, offset, whence); +} #endif -int avio_put_str(ByteIOContext *s, const char *str) +int avio_put_str(AVIOContext *s, const char *str) { int len = 1; if (str) { len += strlen(str); - put_buffer(s, (const unsigned char *) str, len); + avio_write(s, (const unsigned char *) str, len); } else - put_byte(s, 0); + avio_w8(s, 0); return len; } -int avio_put_str16le(ByteIOContext *s, const char *str) +int avio_put_str16le(AVIOContext *s, const char *str) { const uint8_t *q = str; int ret = 0; @@ -293,9 +394,9 @@ int avio_put_str16le(ByteIOContext *s, const char *str) uint16_t tmp; GET_UTF8(ch, *q++, break;) - PUT_UTF16(ch, tmp, put_le16(s, tmp);ret += 2;) + PUT_UTF16(ch, tmp, avio_wl16(s, tmp);ret += 2;) } - put_le16(s, 0); + avio_wl16(s, 0); ret += 2; return ret; } @@ -309,63 +410,65 @@ int ff_get_v_length(uint64_t val){ return i; } -void ff_put_v(ByteIOContext *bc, uint64_t val){ +void ff_put_v(AVIOContext *bc, uint64_t val){ int i= ff_get_v_length(val); while(--i>0) - put_byte(bc, 128 | (val>>(7*i))); + avio_w8(bc, 128 | (val>>(7*i))); - put_byte(bc, val&127); + avio_w8(bc, val&127); } -void put_le64(ByteIOContext *s, uint64_t val) +void avio_wl64(AVIOContext *s, uint64_t val) { - put_le32(s, (uint32_t)(val & 0xffffffff)); - put_le32(s, (uint32_t)(val >> 32)); + avio_wl32(s, (uint32_t)(val & 0xffffffff)); + avio_wl32(s, (uint32_t)(val >> 32)); } -void put_be64(ByteIOContext *s, uint64_t val) +void avio_wb64(AVIOContext *s, uint64_t val) { - put_be32(s, (uint32_t)(val >> 32)); - put_be32(s, (uint32_t)(val & 0xffffffff)); + avio_wb32(s, (uint32_t)(val >> 32)); + avio_wb32(s, (uint32_t)(val & 0xffffffff)); } -void put_le16(ByteIOContext *s, unsigned int val) +void avio_wl16(AVIOContext *s, unsigned int val) { - put_byte(s, val); - put_byte(s, val >> 8); + avio_w8(s, val); + avio_w8(s, val >> 8); } -void put_be16(ByteIOContext *s, unsigned int val) +void avio_wb16(AVIOContext *s, unsigned int val) { - put_byte(s, val >> 8); - put_byte(s, val); + avio_w8(s, val >> 8); + avio_w8(s, val); } -void put_le24(ByteIOContext *s, unsigned int val) +void avio_wl24(AVIOContext *s, unsigned int val) { - put_le16(s, val & 0xffff); - put_byte(s, val >> 16); + avio_wl16(s, val & 0xffff); + avio_w8(s, val >> 16); } -void put_be24(ByteIOContext *s, unsigned int val) +void avio_wb24(AVIOContext *s, unsigned int val) { - put_be16(s, val >> 8); - put_byte(s, val); + avio_wb16(s, val >> 8); + avio_w8(s, val); } -void put_tag(ByteIOContext *s, const char *tag) +#if FF_API_OLD_AVIO +void put_tag(AVIOContext *s, const char *tag) { while (*tag) { - put_byte(s, *tag++); + avio_w8(s, *tag++); } } +#endif /* Input stream */ -static void fill_buffer(ByteIOContext *s) +static void fill_buffer(AVIOContext *s) { - uint8_t *dst= !s->max_packet_size && s->buf_end - s->buffer < s->buffer_size ? s->buf_ptr : s->buffer; + uint8_t *dst= !s->max_packet_size && s->buf_end - s->buffer < s->buffer_size ? s->buf_end : s->buffer; int len= s->buffer_size - (dst - s->buffer); int max_buffer_size = s->max_packet_size ? s->max_packet_size : IO_BUFFER_SIZE; @@ -410,14 +513,14 @@ unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, return av_crc(av_crc_get_table(AV_CRC_32_IEEE), checksum, buf, len); } -unsigned long get_checksum(ByteIOContext *s) +unsigned long get_checksum(AVIOContext *s) { s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr); s->update_checksum= NULL; return s->checksum; } -void init_checksum(ByteIOContext *s, +void init_checksum(AVIOContext *s, unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum) { @@ -429,7 +532,7 @@ void init_checksum(ByteIOContext *s, } /* XXX: put an inline version */ -int get_byte(ByteIOContext *s) +int avio_r8(AVIOContext *s) { if (s->buf_ptr >= s->buf_end) fill_buffer(s); @@ -438,7 +541,7 @@ int get_byte(ByteIOContext *s) return 0; } -int url_fgetc(ByteIOContext *s) +int url_fgetc(AVIOContext *s) { if (s->buf_ptr >= s->buf_end) fill_buffer(s); @@ -447,7 +550,7 @@ int url_fgetc(ByteIOContext *s) return URL_EOF; } -int get_buffer(ByteIOContext *s, unsigned char *buf, int size) +int avio_read(AVIOContext *s, unsigned char *buf, int size) { int len, size1; @@ -494,7 +597,7 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size) return size1 - size; } -int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size) +int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size) { int len; @@ -517,67 +620,67 @@ int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size) return len; } -unsigned int get_le16(ByteIOContext *s) +unsigned int avio_rl16(AVIOContext *s) { unsigned int val; - val = get_byte(s); - val |= get_byte(s) << 8; + val = avio_r8(s); + val |= avio_r8(s) << 8; return val; } -unsigned int get_le24(ByteIOContext *s) +unsigned int avio_rl24(AVIOContext *s) { unsigned int val; - val = get_le16(s); - val |= get_byte(s) << 16; + val = avio_rl16(s); + val |= avio_r8(s) << 16; return val; } -unsigned int get_le32(ByteIOContext *s) +unsigned int avio_rl32(AVIOContext *s) { unsigned int val; - val = get_le16(s); - val |= get_le16(s) << 16; + val = avio_rl16(s); + val |= avio_rl16(s) << 16; return val; } -uint64_t get_le64(ByteIOContext *s) +uint64_t avio_rl64(AVIOContext *s) { uint64_t val; - val = (uint64_t)get_le32(s); - val |= (uint64_t)get_le32(s) << 32; + val = (uint64_t)avio_rl32(s); + val |= (uint64_t)avio_rl32(s) << 32; return val; } -unsigned int get_be16(ByteIOContext *s) +unsigned int avio_rb16(AVIOContext *s) { unsigned int val; - val = get_byte(s) << 8; - val |= get_byte(s); + val = avio_r8(s) << 8; + val |= avio_r8(s); return val; } -unsigned int get_be24(ByteIOContext *s) +unsigned int avio_rb24(AVIOContext *s) { unsigned int val; - val = get_be16(s) << 8; - val |= get_byte(s); + val = avio_rb16(s) << 8; + val |= avio_r8(s); return val; } -unsigned int get_be32(ByteIOContext *s) +unsigned int avio_rb32(AVIOContext *s) { unsigned int val; - val = get_be16(s) << 16; - val |= get_be16(s); + val = avio_rb16(s) << 16; + val |= avio_rb16(s); return val; } -char *get_strz(ByteIOContext *s, char *buf, int maxlen) +char *get_strz(AVIOContext *s, char *buf, int maxlen) { int i = 0; char c; - while ((c = get_byte(s))) { + while ((c = avio_r8(s))) { if (i < maxlen-1) buf[i++] = c; } @@ -587,13 +690,13 @@ char *get_strz(ByteIOContext *s, char *buf, int maxlen) return buf; } -int ff_get_line(ByteIOContext *s, char *buf, int maxlen) +int ff_get_line(AVIOContext *s, char *buf, int maxlen) { int i = 0; char c; do { - c = get_byte(s); + c = avio_r8(s); if (c && i < maxlen-1) buf[i++] = c; } while (c != '\n' && c); @@ -603,7 +706,7 @@ int ff_get_line(ByteIOContext *s, char *buf, int maxlen) } #define GET_STR16(type, read) \ - int avio_get_str16 ##type(ByteIOContext *pb, int maxlen, char *buf, int buflen)\ + int avio_get_str16 ##type(AVIOContext *pb, int maxlen, char *buf, int buflen)\ {\ char* q = buf;\ int ret = 0;\ @@ -619,31 +722,31 @@ int ff_get_line(ByteIOContext *s, char *buf, int maxlen) return ret;\ }\ -GET_STR16(le, get_le16) -GET_STR16(be, get_be16) +GET_STR16(le, avio_rl16) +GET_STR16(be, avio_rb16) #undef GET_STR16 -uint64_t get_be64(ByteIOContext *s) +uint64_t avio_rb64(AVIOContext *s) { uint64_t val; - val = (uint64_t)get_be32(s) << 32; - val |= (uint64_t)get_be32(s); + val = (uint64_t)avio_rb32(s) << 32; + val |= (uint64_t)avio_rb32(s); return val; } -uint64_t ff_get_v(ByteIOContext *bc){ +uint64_t ff_get_v(AVIOContext *bc){ uint64_t val = 0; int tmp; do{ - tmp = get_byte(bc); + tmp = avio_r8(bc); val= (val<<7) + (tmp&127); }while(tmp&128); return val; } -int url_fdopen(ByteIOContext **s, URLContext *h) +int url_fdopen(AVIOContext **s, URLContext *h) { uint8_t *buffer; int buffer_size, max_packet_size; @@ -658,13 +761,13 @@ int url_fdopen(ByteIOContext **s, URLContext *h) if (!buffer) return AVERROR(ENOMEM); - *s = av_mallocz(sizeof(ByteIOContext)); + *s = av_mallocz(sizeof(AVIOContext)); if(!*s) { av_free(buffer); return AVERROR(ENOMEM); } - if (init_put_byte(*s, buffer, buffer_size, + if (ffio_init_context(*s, buffer, buffer_size, (h->flags & URL_WRONLY || h->flags & URL_RDWR), h, url_read, url_write, url_seek) < 0) { av_free(buffer); @@ -680,7 +783,7 @@ int url_fdopen(ByteIOContext **s, URLContext *h) return 0; } -int url_setbufsize(ByteIOContext *s, int buf_size) +int url_setbufsize(AVIOContext *s, int buf_size) { uint8_t *buffer; buffer = av_malloc(buf_size); @@ -696,9 +799,9 @@ int url_setbufsize(ByteIOContext *s, int buf_size) } #if FF_API_URL_RESETBUF -int url_resetbuf(ByteIOContext *s, int flags) +int url_resetbuf(AVIOContext *s, int flags) #else -static int url_resetbuf(ByteIOContext *s, int flags) +static int url_resetbuf(AVIOContext *s, int flags) #endif { #if FF_API_URL_RESETBUF @@ -718,7 +821,7 @@ static int url_resetbuf(ByteIOContext *s, int flags) return 0; } -int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size) +int ff_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size) { int64_t buffer_start; int buffer_size; @@ -757,7 +860,7 @@ int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size return 0; } -int url_fopen(ByteIOContext **s, const char *filename, int flags) +int avio_open(AVIOContext **s, const char *filename, int flags) { URLContext *h; int err; @@ -773,7 +876,7 @@ int url_fopen(ByteIOContext **s, const char *filename, int flags) return 0; } -int url_fclose(ByteIOContext *s) +int avio_close(AVIOContext *s) { URLContext *h = s->opaque; @@ -782,13 +885,13 @@ int url_fclose(ByteIOContext *s) return url_close(h); } -URLContext *url_fileno(ByteIOContext *s) +URLContext *url_fileno(AVIOContext *s) { return s->opaque; } #if CONFIG_MUXERS -int url_fprintf(ByteIOContext *s, const char *fmt, ...) +int url_fprintf(AVIOContext *s, const char *fmt, ...) { va_list ap; char buf[4096]; @@ -797,12 +900,12 @@ int url_fprintf(ByteIOContext *s, const char *fmt, ...) va_start(ap, fmt); ret = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); - put_buffer(s, buf, strlen(buf)); + avio_write(s, buf, strlen(buf)); return ret; } #endif //CONFIG_MUXERS -char *url_fgets(ByteIOContext *s, char *buf, int buf_size) +char *url_fgets(AVIOContext *s, char *buf, int buf_size) { int c; char *q; @@ -823,19 +926,19 @@ char *url_fgets(ByteIOContext *s, char *buf, int buf_size) return buf; } -int url_fget_max_packet_size(ByteIOContext *s) +int url_fget_max_packet_size(AVIOContext *s) { return s->max_packet_size; } -int av_url_read_fpause(ByteIOContext *s, int pause) +int av_url_read_fpause(AVIOContext *s, int pause) { if (!s->read_pause) return AVERROR(ENOSYS); return s->read_pause(s->opaque, pause); } -int64_t av_url_read_fseek(ByteIOContext *s, int stream_index, +int64_t av_url_read_fseek(AVIOContext *s, int stream_index, int64_t timestamp, int flags) { URLContext *h = s->opaque; @@ -859,13 +962,13 @@ int64_t av_url_read_fseek(ByteIOContext *s, int stream_index, * back to the server even if CONFIG_MUXERS is false. */ #if CONFIG_MUXERS || CONFIG_NETWORK /* buffer handling */ -int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags) +int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags) { int ret; - *s = av_mallocz(sizeof(ByteIOContext)); + *s = av_mallocz(sizeof(AVIOContext)); if(!*s) return AVERROR(ENOMEM); - ret = init_put_byte(*s, buf, buf_size, + ret = ffio_init_context(*s, buf, buf_size, (flags & URL_WRONLY || flags & URL_RDWR), NULL, NULL, NULL, NULL); if(ret != 0) @@ -873,7 +976,7 @@ int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags) return ret; } -int url_close_buf(ByteIOContext *s) +int url_close_buf(AVIOContext *s) { put_flush_packet(s); return s->buf_ptr - s->buffer; @@ -947,7 +1050,7 @@ static int64_t dyn_buf_seek(void *opaque, int64_t offset, int whence) return 0; } -static int url_open_dyn_buf_internal(ByteIOContext **s, int max_packet_size) +static int url_open_dyn_buf_internal(AVIOContext **s, int max_packet_size) { DynBuffer *d; int ret; @@ -958,13 +1061,13 @@ static int url_open_dyn_buf_internal(ByteIOContext **s, int max_packet_size) d = av_mallocz(sizeof(DynBuffer) + io_buffer_size); if (!d) return AVERROR(ENOMEM); - *s = av_mallocz(sizeof(ByteIOContext)); + *s = av_mallocz(sizeof(AVIOContext)); if(!*s) { av_free(d); return AVERROR(ENOMEM); } d->io_buffer_size = io_buffer_size; - ret = init_put_byte(*s, d->io_buffer, io_buffer_size, + ret = ffio_init_context(*s, d->io_buffer, io_buffer_size, 1, d, NULL, max_packet_size ? dyn_packet_buf_write : dyn_buf_write, max_packet_size ? NULL : dyn_buf_seek); @@ -977,19 +1080,19 @@ static int url_open_dyn_buf_internal(ByteIOContext **s, int max_packet_size) return ret; } -int url_open_dyn_buf(ByteIOContext **s) +int url_open_dyn_buf(AVIOContext **s) { return url_open_dyn_buf_internal(s, 0); } -int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size) +int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size) { if (max_packet_size <= 0) return -1; return url_open_dyn_buf_internal(s, max_packet_size); } -int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer) +int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) { DynBuffer *d = s->opaque; int size; @@ -998,7 +1101,7 @@ int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer) /* don't attempt to pad fixed-size packet buffers */ if (!s->max_packet_size) { - put_buffer(s, padbuf, sizeof(padbuf)); + avio_write(s, padbuf, sizeof(padbuf)); padding = FF_INPUT_BUFFER_PADDING_SIZE; } diff --git a/mplayer/ffmpeg/libavformat/avs.c b/mplayer/ffmpeg/libavformat/avs.c index 2e1b2243..476c0a9a 100644 --- a/mplayer/ffmpeg/libavformat/avs.c +++ b/mplayer/ffmpeg/libavformat/avs.c @@ -61,12 +61,12 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap) s->ctx_flags |= AVFMTCTX_NOHEADER; - url_fskip(s->pb, 4); - avs->width = get_le16(s->pb); - avs->height = get_le16(s->pb); - avs->bits_per_sample = get_le16(s->pb); - avs->fps = get_le16(s->pb); - avs->nb_frames = get_le32(s->pb); + avio_seek(s->pb, 4, SEEK_CUR); + avs->width = avio_rl16(s->pb); + avs->height = avio_rl16(s->pb); + avs->bits_per_sample = avio_rl16(s->pb); + avs->fps = avio_rl16(s->pb); + avs->nb_frames = avio_rl32(s->pb); avs->remaining_frame_size = 0; avs->remaining_audio_size = 0; @@ -104,7 +104,7 @@ avs_read_video_packet(AVFormatContext * s, AVPacket * pkt, pkt->data[palette_size + 1] = type; pkt->data[palette_size + 2] = size & 0xFF; pkt->data[palette_size + 3] = (size >> 8) & 0xFF; - ret = get_buffer(s->pb, pkt->data + palette_size + 4, size - 4) + 4; + ret = avio_read(s->pb, pkt->data + palette_size + 4, size - 4) + 4; if (ret < size) { av_free_packet(pkt); return AVERROR(EIO); @@ -154,20 +154,20 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) while (1) { if (avs->remaining_frame_size <= 0) { - if (!get_le16(s->pb)) /* found EOF */ + if (!avio_rl16(s->pb)) /* found EOF */ return AVERROR(EIO); - avs->remaining_frame_size = get_le16(s->pb) - 4; + avs->remaining_frame_size = avio_rl16(s->pb) - 4; } while (avs->remaining_frame_size > 0) { - sub_type = get_byte(s->pb); - type = get_byte(s->pb); - size = get_le16(s->pb); + sub_type = avio_r8(s->pb); + type = avio_r8(s->pb); + size = avio_rl16(s->pb); avs->remaining_frame_size -= size; switch (type) { case AVS_PALETTE: - ret = get_buffer(s->pb, palette, size - 4); + ret = avio_read(s->pb, palette, size - 4); if (ret < size - 4) return AVERROR(EIO); palette_size = size; @@ -204,7 +204,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) break; default: - url_fskip(s->pb, size - 4); + avio_seek(s->pb, size - 4, SEEK_CUR); } } } diff --git a/mplayer/ffmpeg/libavformat/bethsoftvid.c b/mplayer/ffmpeg/libavformat/bethsoftvid.c index 97e8e7e0..00b3ea2a 100644 --- a/mplayer/ffmpeg/libavformat/bethsoftvid.c +++ b/mplayer/ffmpeg/libavformat/bethsoftvid.c @@ -60,15 +60,15 @@ static int vid_read_header(AVFormatContext *s, AVFormatParameters *ap) { BVID_DemuxContext *vid = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *stream; /* load main header. Contents: * bytes: 'V' 'I' 'D' * int16s: always_512, nframes, width, height, delay, always_14 */ - url_fseek(pb, 5, SEEK_CUR); - vid->nframes = get_le16(pb); + avio_seek(pb, 5, SEEK_CUR); + vid->nframes = avio_rl16(pb); stream = av_new_stream(s, 0); if (!stream) @@ -76,11 +76,11 @@ static int vid_read_header(AVFormatContext *s, av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps stream->codec->codec_type = AVMEDIA_TYPE_VIDEO; stream->codec->codec_id = CODEC_ID_BETHSOFTVID; - stream->codec->width = get_le16(pb); - stream->codec->height = get_le16(pb); + stream->codec->width = avio_rl16(pb); + stream->codec->height = avio_rl16(pb); stream->codec->pix_fmt = PIX_FMT_PAL8; - vid->bethsoft_global_delay = get_le16(pb); - get_le16(pb); + vid->bethsoft_global_delay = avio_rl16(pb); + avio_rl16(pb); // done with video codec, set up audio codec stream = av_new_stream(s, 0); @@ -97,7 +97,7 @@ static int vid_read_header(AVFormatContext *s, } #define BUFFER_PADDING_SIZE 1000 -static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt, +static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, uint8_t block_type, AVFormatContext *s, int npixels) { uint8_t * vidbuf_start = NULL; @@ -117,11 +117,11 @@ static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt, vidbuf_start[vidbuf_nbytes++] = block_type; // get the video delay (next int16), and set the presentation time - vid->video_pts += vid->bethsoft_global_delay + get_le16(pb); + vid->video_pts += vid->bethsoft_global_delay + avio_rl16(pb); // set the y offset if it exists (decoder header data should be in data section) if(block_type == VIDEO_YOFF_P_FRAME){ - if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2) + if(avio_read(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2) goto fail; vidbuf_nbytes += 2; } @@ -131,22 +131,22 @@ static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt, if(!vidbuf_start) return AVERROR(ENOMEM); - code = get_byte(pb); + code = avio_r8(pb); vidbuf_start[vidbuf_nbytes++] = code; if(code >= 0x80){ // rle sequence if(block_type == VIDEO_I_FRAME) - vidbuf_start[vidbuf_nbytes++] = get_byte(pb); + vidbuf_start[vidbuf_nbytes++] = avio_r8(pb); } else if(code){ // plain sequence - if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], code) != code) + if(avio_read(pb, &vidbuf_start[vidbuf_nbytes], code) != code) goto fail; vidbuf_nbytes += code; } bytes_copied += code & 0x7F; if(bytes_copied == npixels){ // sometimes no stop character is given, need to keep track of bytes copied // may contain a 0 byte even if read all pixels - if(get_byte(pb)) - url_fseek(pb, -1, SEEK_CUR); + if(avio_r8(pb)) + avio_seek(pb, -1, SEEK_CUR); break; } if(bytes_copied > npixels) @@ -174,7 +174,7 @@ static int vid_read_packet(AVFormatContext *s, AVPacket *pkt) { BVID_DemuxContext *vid = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned char block_type; int audio_length; int ret_value; @@ -182,10 +182,10 @@ static int vid_read_packet(AVFormatContext *s, if(vid->is_finished || url_feof(pb)) return AVERROR(EIO); - block_type = get_byte(pb); + block_type = avio_r8(pb); switch(block_type){ case PALETTE_BLOCK: - url_fseek(pb, -1, SEEK_CUR); // include block type + avio_seek(pb, -1, SEEK_CUR); // include block type ret_value = av_get_packet(pb, pkt, 3 * 256 + 1); if(ret_value != 3 * 256 + 1){ av_free_packet(pkt); @@ -195,12 +195,12 @@ static int vid_read_packet(AVFormatContext *s, return ret_value; case FIRST_AUDIO_BLOCK: - get_le16(pb); + avio_rl16(pb); // soundblaster DAC used for sample rate, as on specification page (link above) - s->streams[1]->codec->sample_rate = 1000000 / (256 - get_byte(pb)); + s->streams[1]->codec->sample_rate = 1000000 / (256 - avio_r8(pb)); s->streams[1]->codec->bit_rate = s->streams[1]->codec->channels * s->streams[1]->codec->sample_rate * s->streams[1]->codec->bits_per_coded_sample; case AUDIO_BLOCK: - audio_length = get_le16(pb); + audio_length = avio_rl16(pb); ret_value = av_get_packet(pb, pkt, audio_length); pkt->stream_index = 1; return ret_value != audio_length ? AVERROR(EIO) : ret_value; diff --git a/mplayer/ffmpeg/libavformat/bfi.c b/mplayer/ffmpeg/libavformat/bfi.c index 3b1c9aa9..21676e44 100644 --- a/mplayer/ffmpeg/libavformat/bfi.c +++ b/mplayer/ffmpeg/libavformat/bfi.c @@ -49,7 +49,7 @@ static int bfi_probe(AVProbeData * p) static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) { BFIContext *bfi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *vstream; AVStream *astream; int fps, chunk_header; @@ -65,25 +65,25 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) return AVERROR(ENOMEM); /* Set the total number of frames. */ - url_fskip(pb, 8); - chunk_header = get_le32(pb); - bfi->nframes = get_le32(pb); - get_le32(pb); - get_le32(pb); - get_le32(pb); - fps = get_le32(pb); - url_fskip(pb, 12); - vstream->codec->width = get_le32(pb); - vstream->codec->height = get_le32(pb); + avio_seek(pb, 8, SEEK_CUR); + chunk_header = avio_rl32(pb); + bfi->nframes = avio_rl32(pb); + avio_rl32(pb); + avio_rl32(pb); + avio_rl32(pb); + fps = avio_rl32(pb); + avio_seek(pb, 12, SEEK_CUR); + vstream->codec->width = avio_rl32(pb); + vstream->codec->height = avio_rl32(pb); /*Load the palette to extradata */ - url_fskip(pb, 8); + avio_seek(pb, 8, SEEK_CUR); vstream->codec->extradata = av_malloc(768); vstream->codec->extradata_size = 768; - get_buffer(pb, vstream->codec->extradata, + avio_read(pb, vstream->codec->extradata, vstream->codec->extradata_size); - astream->codec->sample_rate = get_le32(pb); + astream->codec->sample_rate = avio_rl32(pb); /* Set up the video codec... */ av_set_pts_info(vstream, 32, 1, fps); @@ -98,7 +98,7 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) astream->codec->bits_per_coded_sample = 8; astream->codec->bit_rate = astream->codec->sample_rate * astream->codec->bits_per_coded_sample; - url_fseek(pb, chunk_header - 3, SEEK_SET); + avio_seek(pb, chunk_header - 3, SEEK_SET); av_set_pts_info(astream, 64, 1, astream->codec->sample_rate); return 0; } @@ -107,7 +107,7 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) { BFIContext *bfi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret, audio_offset, video_offset, chunk_size, audio_size = 0; if (bfi->nframes == 0 || url_feof(pb)) { return AVERROR(EIO); @@ -119,14 +119,14 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) while(state != MKTAG('S','A','V','I')){ if (url_feof(pb)) return AVERROR(EIO); - state = 256*state + get_byte(pb); + state = 256*state + avio_r8(pb); } /* Now that the chunk's location is confirmed, we proceed... */ - chunk_size = get_le32(pb); - get_le32(pb); - audio_offset = get_le32(pb); - get_le32(pb); - video_offset = get_le32(pb); + chunk_size = avio_rl32(pb); + avio_rl32(pb); + audio_offset = avio_rl32(pb); + avio_rl32(pb); + video_offset = avio_rl32(pb); audio_size = video_offset - audio_offset; bfi->video_size = chunk_size - video_offset; diff --git a/mplayer/ffmpeg/libavformat/bink.c b/mplayer/ffmpeg/libavformat/bink.c index c134dd80..22beb4cb 100644 --- a/mplayer/ffmpeg/libavformat/bink.c +++ b/mplayer/ffmpeg/libavformat/bink.c @@ -70,7 +70,7 @@ static int probe(AVProbeData *p) static int read_header(AVFormatContext *s, AVFormatParameters *ap) { BinkDemuxContext *bink = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint32_t fps_num, fps_den; AVStream *vst, *ast; unsigned int i; @@ -82,29 +82,29 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) if (!vst) return AVERROR(ENOMEM); - vst->codec->codec_tag = get_le32(pb); + vst->codec->codec_tag = avio_rl32(pb); - bink->file_size = get_le32(pb) + 8; - vst->duration = get_le32(pb); + bink->file_size = avio_rl32(pb) + 8; + vst->duration = avio_rl32(pb); if (vst->duration > 1000000) { av_log(s, AV_LOG_ERROR, "invalid header: more than 1000000 frames\n"); return AVERROR(EIO); } - if (get_le32(pb) > bink->file_size) { + if (avio_rl32(pb) > bink->file_size) { av_log(s, AV_LOG_ERROR, "invalid header: largest frame size greater than file size\n"); return AVERROR(EIO); } - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); - vst->codec->width = get_le32(pb); - vst->codec->height = get_le32(pb); + vst->codec->width = avio_rl32(pb); + vst->codec->height = avio_rl32(pb); - fps_num = get_le32(pb); - fps_den = get_le32(pb); + fps_num = avio_rl32(pb); + fps_den = avio_rl32(pb); if (fps_num == 0 || fps_den == 0) { av_log(s, AV_LOG_ERROR, "invalid header: invalid fps (%d/%d)\n", fps_num, fps_den); return AVERROR(EIO); @@ -115,9 +115,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) vst->codec->codec_id = CODEC_ID_BINKVIDEO; vst->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE); vst->codec->extradata_size = 4; - get_buffer(pb, vst->codec->extradata, 4); + avio_read(pb, vst->codec->extradata, 4); - bink->num_audio_tracks = get_le32(pb); + bink->num_audio_tracks = avio_rl32(pb); if (bink->num_audio_tracks > BINK_MAX_AUDIO_TRACKS) { av_log(s, AV_LOG_ERROR, @@ -127,34 +127,35 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) } if (bink->num_audio_tracks) { - url_fskip(pb, 4 * bink->num_audio_tracks); + avio_seek(pb, 4 * bink->num_audio_tracks, SEEK_CUR); for (i = 0; i < bink->num_audio_tracks; i++) { ast = av_new_stream(s, 1); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; - ast->codec->codec_tag = 0; - ast->codec->sample_rate = get_le16(pb); + ast->codec->codec_tag = vst->codec->codec_tag; + ast->codec->sample_rate = avio_rl16(pb); av_set_pts_info(ast, 64, 1, ast->codec->sample_rate); - flags = get_le16(pb); + flags = avio_rl16(pb); ast->codec->codec_id = flags & BINK_AUD_USEDCT ? CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT; ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1; } - url_fskip(pb, 4 * bink->num_audio_tracks); + for (i = 0; i < bink->num_audio_tracks; i++) + s->streams[i + 1]->id = avio_rl32(pb); } /* frame index table */ - next_pos = get_le32(pb); + next_pos = avio_rl32(pb); for (i = 0; i < vst->duration; i++) { pos = next_pos; if (i == vst->duration - 1) { next_pos = bink->file_size; keyframe = 0; } else { - next_pos = get_le32(pb); + next_pos = avio_rl32(pb); keyframe = pos & 1; } pos &= ~1; @@ -168,7 +169,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) keyframe ? AVINDEX_KEYFRAME : 0); } - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); bink->current_track = -1; return 0; @@ -177,7 +178,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) static int read_packet(AVFormatContext *s, AVPacket *pkt) { BinkDemuxContext *bink = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret; if (bink->current_track < 0) { @@ -201,7 +202,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) } while (bink->current_track < bink->num_audio_tracks) { - uint32_t audio_size = get_le32(pb); + uint32_t audio_size = avio_rl32(pb); if (audio_size > bink->remain_packet_size - 4) { av_log(s, AV_LOG_ERROR, "frame %"PRId64": audio size in header (%u) > size of packet left (%u)\n", @@ -224,7 +225,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels); return 0; } else { - url_fseek(pb, audio_size, SEEK_CUR); + avio_seek(pb, audio_size, SEEK_CUR); } } @@ -250,7 +251,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in return -1; /* seek to the first frame */ - url_fseek(s->pb, vst->index_entries[0].pos, SEEK_SET); + avio_seek(s->pb, vst->index_entries[0].pos, SEEK_SET); bink->video_pts = 0; memset(bink->audio_pts, 0, sizeof(bink->audio_pts)); bink->current_track = -1; diff --git a/mplayer/ffmpeg/libavformat/c93.c b/mplayer/ffmpeg/libavformat/c93.c index dbb2bf38..a4a0fe3a 100644 --- a/mplayer/ffmpeg/libavformat/c93.c +++ b/mplayer/ffmpeg/libavformat/c93.c @@ -60,15 +60,15 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *video; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; C93DemuxContext *c93 = s->priv_data; int i; int framecount = 0; for (i = 0; i < 512; i++) { - c93->block_records[i].index = get_le16(pb); - c93->block_records[i].length = get_byte(pb); - c93->block_records[i].frames = get_byte(pb); + c93->block_records[i].index = avio_rl16(pb); + c93->block_records[i].length = avio_r8(pb); + c93->block_records[i].frames = avio_r8(pb); if (c93->block_records[i].frames > 32) { av_log(s, AV_LOG_ERROR, "too many frames in block\n"); return AVERROR_INVALIDDATA; @@ -89,7 +89,7 @@ static int read_header(AVFormatContext *s, video->codec->height = 192; /* 4:3 320x200 with 8 empty lines */ video->sample_aspect_ratio = (AVRational) { 5, 6 }; - video->time_base = (AVRational) { 2, 25 }; + av_set_pts_info(video, 64, 2, 25); video->nb_frames = framecount; video->duration = framecount; video->start_time = 0; @@ -105,7 +105,7 @@ static int read_header(AVFormatContext *s, static int read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; C93DemuxContext *c93 = s->priv_data; C93BlockRecord *br = &c93->block_records[c93->current_block]; int datasize; @@ -114,7 +114,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) if (c93->next_pkt_is_audio) { c93->current_frame++; c93->next_pkt_is_audio = 0; - datasize = get_le16(pb); + datasize = avio_rl16(pb); if (datasize > 42) { if (!c93->audio) { c93->audio = av_new_stream(s, 1); @@ -122,7 +122,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(ENOMEM); c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; } - url_fskip(pb, 26); /* VOC header */ + avio_seek(pb, 26, SEEK_CUR); /* VOC header */ ret = voc_get_packet(s, pkt, c93->audio, datasize - 26); if (ret > 0) { pkt->stream_index = 1; @@ -140,15 +140,15 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) } if (c93->current_frame == 0) { - url_fseek(pb, br->index * 2048, SEEK_SET); + avio_seek(pb, br->index * 2048, SEEK_SET); for (i = 0; i < 32; i++) { - c93->frame_offsets[i] = get_le32(pb); + c93->frame_offsets[i] = avio_rl32(pb); } } - url_fseek(pb,br->index * 2048 + + avio_seek(pb,br->index * 2048 + c93->frame_offsets[c93->current_frame], SEEK_SET); - datasize = get_le16(pb); /* video frame size */ + datasize = avio_rl16(pb); /* video frame size */ ret = av_new_packet(pkt, datasize + 768 + 1); if (ret < 0) @@ -156,13 +156,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) pkt->data[0] = 0; pkt->size = datasize + 1; - ret = get_buffer(pb, pkt->data + 1, datasize); + ret = avio_read(pb, pkt->data + 1, datasize); if (ret < datasize) { ret = AVERROR(EIO); goto fail; } - datasize = get_le16(pb); /* palette size */ + datasize = avio_rl16(pb); /* palette size */ if (datasize) { if (datasize != 768) { av_log(s, AV_LOG_ERROR, "invalid palette size %u\n", datasize); @@ -170,7 +170,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) goto fail; } pkt->data[0] |= C93_HAS_PALETTE; - ret = get_buffer(pb, pkt->data + pkt->size, datasize); + ret = avio_read(pb, pkt->data + pkt->size, datasize); if (ret < datasize) { ret = AVERROR(EIO); goto fail; diff --git a/mplayer/ffmpeg/libavformat/cafdec.c b/mplayer/ffmpeg/libavformat/cafdec.c index 7b0c8717..d98c4bf0 100644 --- a/mplayer/ffmpeg/libavformat/cafdec.c +++ b/mplayer/ffmpeg/libavformat/cafdec.c @@ -53,7 +53,7 @@ static int probe(AVProbeData *p) /** Read audio description chunk */ static int read_desc_chunk(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; CaffContext *caf = s->priv_data; AVStream *st; int flags; @@ -65,14 +65,14 @@ static int read_desc_chunk(AVFormatContext *s) /* parse format description */ st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->sample_rate = av_int2dbl(get_be64(pb)); - st->codec->codec_tag = get_be32(pb); - flags = get_be32(pb); - caf->bytes_per_packet = get_be32(pb); + st->codec->sample_rate = av_int2dbl(avio_rb64(pb)); + st->codec->codec_tag = avio_rb32(pb); + flags = avio_rb32(pb); + caf->bytes_per_packet = avio_rb32(pb); st->codec->block_align = caf->bytes_per_packet; - caf->frames_per_packet = get_be32(pb); - st->codec->channels = get_be32(pb); - st->codec->bits_per_coded_sample = get_be32(pb); + caf->frames_per_packet = avio_rb32(pb); + st->codec->channels = avio_rb32(pb); + st->codec->bits_per_coded_sample = avio_rb32(pb); /* calculate bit rate for constant size packets */ if (caf->frames_per_packet > 0 && caf->bytes_per_packet > 0) { @@ -93,7 +93,7 @@ static int read_desc_chunk(AVFormatContext *s) /** Read magic cookie chunk */ static int read_kuki_chunk(AVFormatContext *s, int64_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) @@ -114,27 +114,27 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) av_log(s, AV_LOG_ERROR, "invalid AAC magic cookie\n"); return AVERROR_INVALIDDATA; } - url_fskip(pb, skip); + avio_seek(pb, skip, SEEK_CUR); } else if (st->codec->codec_id == CODEC_ID_ALAC) { #define ALAC_PREAMBLE 12 #define ALAC_HEADER 36 if (size < ALAC_PREAMBLE + ALAC_HEADER) { av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n"); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); return AVERROR_INVALIDDATA; } - url_fskip(pb, ALAC_PREAMBLE); + avio_seek(pb, ALAC_PREAMBLE, SEEK_CUR); st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); - get_buffer(pb, st->codec->extradata, ALAC_HEADER); + avio_read(pb, st->codec->extradata, ALAC_HEADER); st->codec->extradata_size = ALAC_HEADER; - url_fskip(pb, size - ALAC_PREAMBLE - ALAC_HEADER); + avio_seek(pb, size - ALAC_PREAMBLE - ALAC_HEADER, SEEK_CUR); } else { st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); - get_buffer(pb, st->codec->extradata, size); + avio_read(pb, st->codec->extradata, size); st->codec->extradata_size = size; } @@ -144,7 +144,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) /** Read packet table chunk */ static int read_pakt_chunk(AVFormatContext *s, int64_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; CaffContext *caf = s->priv_data; int64_t pos = 0, ccount; @@ -152,13 +152,13 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size) ccount = url_ftell(pb); - num_packets = get_be64(pb); + num_packets = avio_rb64(pb); if (num_packets < 0 || INT32_MAX / sizeof(AVIndexEntry) < num_packets) return AVERROR_INVALIDDATA; - st->nb_frames = get_be64(pb); /* valid frames */ - st->nb_frames += get_be32(pb); /* priming frames */ - st->nb_frames += get_be32(pb); /* remainder frames */ + st->nb_frames = avio_rb64(pb); /* valid frames */ + st->nb_frames += avio_rb32(pb); /* priming frames */ + st->nb_frames += avio_rb32(pb); /* remainder frames */ st->duration = 0; for (i = 0; i < num_packets; i++) { @@ -179,9 +179,9 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size) /** Read information chunk */ static void read_info_chunk(AVFormatContext *s, int64_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int i; - unsigned int nb_entries = get_be32(pb); + unsigned int nb_entries = avio_rb32(pb); for (i = 0; i < nb_entries; i++) { char key[32]; char value[1024]; @@ -194,21 +194,21 @@ static void read_info_chunk(AVFormatContext *s, int64_t size) static int read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; CaffContext *caf = s->priv_data; AVStream *st; uint32_t tag = 0; int found_data, ret; int64_t size; - url_fskip(pb, 8); /* magic, version, file flags */ + avio_seek(pb, 8, SEEK_CUR); /* magic, version, file flags */ /* audio description chunk */ - if (get_be32(pb) != MKBETAG('d','e','s','c')) { + if (avio_rb32(pb) != MKBETAG('d','e','s','c')) { av_log(s, AV_LOG_ERROR, "desc chunk not present\n"); return AVERROR_INVALIDDATA; } - size = get_be64(pb); + size = avio_rb64(pb); if (size != 32) return AVERROR_INVALIDDATA; @@ -226,18 +226,18 @@ static int read_header(AVFormatContext *s, if (found_data && (caf->data_size < 0 || url_is_streamed(pb))) break; - tag = get_be32(pb); - size = get_be64(pb); + tag = avio_rb32(pb); + size = avio_rb64(pb); if (url_feof(pb)) break; switch (tag) { case MKBETAG('d','a','t','a'): - url_fskip(pb, 4); /* edit count */ + avio_seek(pb, 4, SEEK_CUR); /* edit count */ caf->data_start = url_ftell(pb); caf->data_size = size < 0 ? -1 : size - 4; if (caf->data_size > 0 && !url_is_streamed(pb)) - url_fskip(pb, caf->data_size); + avio_seek(pb, caf->data_size, SEEK_CUR); found_data = 1; break; @@ -265,7 +265,7 @@ static int read_header(AVFormatContext *s, case MKBETAG('f','r','e','e'): if (size < 0) return AVERROR_INVALIDDATA; - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } } @@ -292,7 +292,7 @@ static int read_header(AVFormatContext *s, /* position the stream at the start of data */ if (caf->data_size >= 0) - url_fseek(pb, caf->data_start, SEEK_SET); + avio_seek(pb, caf->data_start, SEEK_SET); return 0; } @@ -301,7 +301,7 @@ static int read_header(AVFormatContext *s, static int read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; CaffContext *caf = s->priv_data; int res, pkt_size = 0, pkt_frames = 0; @@ -377,7 +377,7 @@ static int read_seek(AVFormatContext *s, int stream_index, return -1; } - url_fseek(s->pb, pos + caf->data_start, SEEK_SET); + avio_seek(s->pb, pos + caf->data_start, SEEK_SET); return 0; } diff --git a/mplayer/ffmpeg/libavformat/crcenc.c b/mplayer/ffmpeg/libavformat/crcenc.c index 2f9a099a..ec106b0b 100644 --- a/mplayer/ffmpeg/libavformat/crcenc.c +++ b/mplayer/ffmpeg/libavformat/crcenc.c @@ -49,7 +49,7 @@ static int crc_write_trailer(struct AVFormatContext *s) char buf[64]; snprintf(buf, sizeof(buf), "CRC=0x%08x\n", crc->crcval); - put_buffer(s->pb, buf, strlen(buf)); + avio_write(s->pb, buf, strlen(buf)); put_flush_packet(s->pb); return 0; } diff --git a/mplayer/ffmpeg/libavformat/cutils.c b/mplayer/ffmpeg/libavformat/cutils.c index c1b56139..e6578df2 100644 --- a/mplayer/ffmpeg/libavformat/cutils.c +++ b/mplayer/ffmpeg/libavformat/cutils.c @@ -42,25 +42,6 @@ void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem) *nb_ptr = nb; } -time_t mktimegm(struct tm *tm) -{ - time_t t; - - int y = tm->tm_year + 1900, m = tm->tm_mon + 1, d = tm->tm_mday; - - if (m < 3) { - m += 12; - y--; - } - - t = 86400 * - (d + (153 * m - 457) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 719469); - - t += 3600 * tm->tm_hour + 60 * tm->tm_min + tm->tm_sec; - - return t; -} - #define ISLEAP(y) (((y) % 4 == 0) && (((y) % 100) != 0 || ((y) % 400) == 0)) #define LEAPS_COUNT(y) ((y)/4 - (y)/100 + (y)/400) @@ -95,94 +76,3 @@ struct tm *brktimegm(time_t secs, struct tm *tm) return tm; } - -/* get a positive number between n_min and n_max, for a maximum length - of len_max. Return -1 if error. */ -static int date_get_num(const char **pp, - int n_min, int n_max, int len_max) -{ - int i, val, c; - const char *p; - - p = *pp; - val = 0; - for(i = 0; i < len_max; i++) { - c = *p; - if (!isdigit(c)) - break; - val = (val * 10) + c - '0'; - p++; - } - /* no number read ? */ - if (p == *pp) - return -1; - if (val < n_min || val > n_max) - return -1; - *pp = p; - return val; -} - -/* small strptime for ffmpeg */ -const char *small_strptime(const char *p, const char *fmt, - struct tm *dt) -{ - int c, val; - - for(;;) { - c = *fmt++; - if (c == '\0') { - return p; - } else if (c == '%') { - c = *fmt++; - switch(c) { - case 'H': - val = date_get_num(&p, 0, 23, 2); - if (val == -1) - return NULL; - dt->tm_hour = val; - break; - case 'M': - val = date_get_num(&p, 0, 59, 2); - if (val == -1) - return NULL; - dt->tm_min = val; - break; - case 'S': - val = date_get_num(&p, 0, 59, 2); - if (val == -1) - return NULL; - dt->tm_sec = val; - break; - case 'Y': - val = date_get_num(&p, 0, 9999, 4); - if (val == -1) - return NULL; - dt->tm_year = val - 1900; - break; - case 'm': - val = date_get_num(&p, 1, 12, 2); - if (val == -1) - return NULL; - dt->tm_mon = val - 1; - break; - case 'd': - val = date_get_num(&p, 1, 31, 2); - if (val == -1) - return NULL; - dt->tm_mday = val; - break; - case '%': - goto match; - default: - return NULL; - } - } else { - match: - if (c != *p) - return NULL; - p++; - } - } - return p; -} - diff --git a/mplayer/ffmpeg/libavformat/daud.c b/mplayer/ffmpeg/libavformat/daud.c index c8af2e44..39a994b6 100644 --- a/mplayer/ffmpeg/libavformat/daud.c +++ b/mplayer/ffmpeg/libavformat/daud.c @@ -36,12 +36,12 @@ static int daud_header(AVFormatContext *s, AVFormatParameters *ap) { } static int daud_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret, size; if (url_feof(pb)) return AVERROR(EIO); - size = get_be16(pb); - get_be16(pb); // unknown + size = avio_rb16(pb); + avio_rb16(pb); // unknown ret = av_get_packet(pb, pkt, size); pkt->stream_index = 0; return ret; @@ -57,9 +57,9 @@ static int daud_write_header(struct AVFormatContext *s) static int daud_write_packet(struct AVFormatContext *s, AVPacket *pkt) { - put_be16(s->pb, pkt->size); - put_be16(s->pb, 0x8010); // unknown - put_buffer(s->pb, pkt->data, pkt->size); + avio_wb16(s->pb, pkt->size); + avio_wb16(s->pb, 0x8010); // unknown + avio_write(s->pb, pkt->data, pkt->size); put_flush_packet(s->pb); return 0; } diff --git a/mplayer/ffmpeg/libavformat/dsicin.c b/mplayer/ffmpeg/libavformat/dsicin.c index 10a2a9d2..328f9014 100644 --- a/mplayer/ffmpeg/libavformat/dsicin.c +++ b/mplayer/ffmpeg/libavformat/dsicin.c @@ -70,19 +70,19 @@ static int cin_probe(AVProbeData *p) return AVPROBE_SCORE_MAX; } -static int cin_read_file_header(CinDemuxContext *cin, ByteIOContext *pb) { +static int cin_read_file_header(CinDemuxContext *cin, AVIOContext *pb) { CinFileHeader *hdr = &cin->file_header; - if (get_le32(pb) != 0x55AA0000) + if (avio_rl32(pb) != 0x55AA0000) return AVERROR_INVALIDDATA; - hdr->video_frame_size = get_le32(pb); - hdr->video_frame_width = get_le16(pb); - hdr->video_frame_height = get_le16(pb); - hdr->audio_frequency = get_le32(pb); - hdr->audio_bits = get_byte(pb); - hdr->audio_stereo = get_byte(pb); - hdr->audio_frame_size = get_le16(pb); + hdr->video_frame_size = avio_rl32(pb); + hdr->video_frame_width = avio_rl16(pb); + hdr->video_frame_height = avio_rl16(pb); + hdr->audio_frequency = avio_rl32(pb); + hdr->audio_bits = avio_r8(pb); + hdr->audio_stereo = avio_r8(pb); + hdr->audio_frame_size = avio_rl16(pb); if (hdr->audio_frequency != 22050 || hdr->audio_bits != 16 || hdr->audio_stereo != 0) return AVERROR_INVALIDDATA; @@ -95,7 +95,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) int rc; CinDemuxContext *cin = s->priv_data; CinFileHeader *hdr = &cin->file_header; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; rc = cin_read_file_header(cin, pb); @@ -138,19 +138,19 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) return 0; } -static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) { +static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) { CinFrameHeader *hdr = &cin->frame_header; - hdr->video_frame_type = get_byte(pb); - hdr->audio_frame_type = get_byte(pb); - hdr->pal_colors_count = get_le16(pb); - hdr->video_frame_size = get_le32(pb); - hdr->audio_frame_size = get_le32(pb); + hdr->video_frame_type = avio_r8(pb); + hdr->audio_frame_type = avio_r8(pb); + hdr->pal_colors_count = avio_rl16(pb); + hdr->video_frame_size = avio_rl32(pb); + hdr->audio_frame_size = avio_rl32(pb); if (url_feof(pb) || url_ferror(pb)) return AVERROR(EIO); - if (get_le32(pb) != 0xAA55AA55) + if (avio_rl32(pb) != 0xAA55AA55) return AVERROR_INVALIDDATA; return 0; @@ -159,7 +159,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) { static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) { CinDemuxContext *cin = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; CinFrameHeader *hdr = &cin->frame_header; int rc, palette_type, pkt_size; int ret; @@ -191,7 +191,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->data[2] = hdr->pal_colors_count >> 8; pkt->data[3] = hdr->video_frame_type; - ret = get_buffer(pb, &pkt->data[4], pkt_size); + ret = avio_read(pb, &pkt->data[4], pkt_size); if (ret < 0) { av_free_packet(pkt); return ret; diff --git a/mplayer/ffmpeg/libavformat/dv.c b/mplayer/ffmpeg/libavformat/dv.c index 1f05eb2d..cdc5f769 100644 --- a/mplayer/ffmpeg/libavformat/dv.c +++ b/mplayer/ffmpeg/libavformat/dv.c @@ -410,7 +410,7 @@ static int dv_read_header(AVFormatContext *s, if (!c->dv_demux) return -1; - state = get_be32(s->pb); + state = avio_rb32(s->pb); while ((state & 0xffffff7f) != 0x1f07003f) { if (url_feof(s->pb)) { av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n"); @@ -419,16 +419,16 @@ static int dv_read_header(AVFormatContext *s, if (state == 0x003f0700 || state == 0xff3f0700) marker_pos = url_ftell(s->pb); if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) { - url_fseek(s->pb, -163, SEEK_CUR); - state = get_be32(s->pb); + avio_seek(s->pb, -163, SEEK_CUR); + state = avio_rb32(s->pb); break; } - state = (state << 8) | get_byte(s->pb); + state = (state << 8) | avio_r8(s->pb); } AV_WB32(c->buf, state); - if (get_buffer(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 || - url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0) + if (avio_read(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 || + avio_seek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0) return AVERROR(EIO); c->dv_demux->sys = ff_dv_frame_profile(c->dv_demux->sys, c->buf, DV_PROFILE_BYTES); @@ -455,7 +455,7 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt) if (!c->dv_demux->sys) return AVERROR(EIO); size = c->dv_demux->sys->frame_size; - if (get_buffer(s->pb, c->buf, size) <= 0) + if (avio_read(s->pb, c->buf, size) <= 0) return AVERROR(EIO); size = dv_produce_packet(c->dv_demux, pkt, c->buf, size); @@ -473,7 +473,7 @@ static int dv_read_seek(AVFormatContext *s, int stream_index, dv_offset_reset(c, offset / c->sys->frame_size); - offset = url_fseek(s->pb, offset, SEEK_SET); + offset = avio_seek(s->pb, offset, SEEK_SET); return (offset < 0) ? offset : 0; } diff --git a/mplayer/ffmpeg/libavformat/dvenc.c b/mplayer/ffmpeg/libavformat/dvenc.c index faaa5298..6d90024e 100644 --- a/mplayer/ffmpeg/libavformat/dvenc.c +++ b/mplayer/ffmpeg/libavformat/dvenc.c @@ -381,7 +381,7 @@ static int dv_write_packet(struct AVFormatContext *s, AVPacket *pkt) fsize = dv_assemble_frame(s->priv_data, s->streams[pkt->stream_index], pkt->data, pkt->size, &frame); if (fsize > 0) { - put_buffer(s->pb, frame, fsize); + avio_write(s->pb, frame, fsize); put_flush_packet(s->pb); } return 0; diff --git a/mplayer/ffmpeg/libavformat/dxa.c b/mplayer/ffmpeg/libavformat/dxa.c index 6ad4582e..695ca959 100644 --- a/mplayer/ffmpeg/libavformat/dxa.c +++ b/mplayer/ffmpeg/libavformat/dxa.c @@ -52,7 +52,7 @@ static int dxa_probe(AVProbeData *p) static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; DXAContext *c = s->priv_data; AVStream *st, *ast; uint32_t tag; @@ -61,17 +61,17 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) int num, den; int flags; - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag != MKTAG('D', 'E', 'X', 'A')) return -1; - flags = get_byte(pb); - c->frames = get_be16(pb); + flags = avio_r8(pb); + c->frames = avio_rb16(pb); if(!c->frames){ av_log(s, AV_LOG_ERROR, "File contains no frames ???\n"); return -1; } - fps = get_be32(pb); + fps = avio_rb32(pb); if(fps > 0){ den = 1000; num = fps; @@ -82,8 +82,8 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) den = 10; num = 1; } - w = get_be16(pb); - h = get_be16(pb); + w = avio_rb16(pb); + h = avio_rb16(pb); c->has_sound = 0; st = av_new_stream(s, 0); @@ -91,13 +91,13 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; // Parse WAV data header - if(get_le32(pb) == MKTAG('W', 'A', 'V', 'E')){ + if(avio_rl32(pb) == MKTAG('W', 'A', 'V', 'E')){ uint32_t size, fsize; c->has_sound = 1; - size = get_be32(pb); + size = avio_rb32(pb); c->vidpos = url_ftell(pb) + size; - url_fskip(pb, 16); - fsize = get_le32(pb); + avio_seek(pb, 16, SEEK_CUR); + fsize = avio_rl32(pb); ast = av_new_stream(s, 0); if (!ast) @@ -105,17 +105,17 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) ff_get_wav_header(pb, ast->codec, fsize); // find 'data' chunk while(url_ftell(pb) < c->vidpos && !url_feof(pb)){ - tag = get_le32(pb); - fsize = get_le32(pb); + tag = avio_rl32(pb); + fsize = avio_rl32(pb); if(tag == MKTAG('d', 'a', 't', 'a')) break; - url_fskip(pb, fsize); + avio_seek(pb, fsize, SEEK_CUR); } c->bpc = (fsize + c->frames - 1) / c->frames; if(ast->codec->block_align) c->bpc = ((c->bpc + ast->codec->block_align - 1) / ast->codec->block_align) * ast->codec->block_align; c->bytes_left = fsize; c->wavpos = url_ftell(pb); - url_fseek(pb, c->vidpos, SEEK_SET); + avio_seek(pb, c->vidpos, SEEK_SET); } /* now we are ready: build format streams */ @@ -151,7 +151,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) if(!c->readvid && c->has_sound && c->bytes_left){ c->readvid = 1; - url_fseek(s->pb, c->wavpos, SEEK_SET); + avio_seek(s->pb, c->wavpos, SEEK_SET); size = FFMIN(c->bytes_left, c->bpc); ret = av_get_packet(s->pb, pkt, size); pkt->stream_index = 1; @@ -161,9 +161,9 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) c->wavpos = url_ftell(s->pb); return 0; } - url_fseek(s->pb, c->vidpos, SEEK_SET); + avio_seek(s->pb, c->vidpos, SEEK_SET); while(!url_feof(s->pb) && c->frames){ - get_buffer(s->pb, buf, 4); + avio_read(s->pb, buf, 4); switch(AV_RL32(buf)){ case MKTAG('N', 'U', 'L', 'L'): if(av_new_packet(pkt, 4 + pal_size) < 0) @@ -178,10 +178,10 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) case MKTAG('C', 'M', 'A', 'P'): pal_size = 768+4; memcpy(pal, buf, 4); - get_buffer(s->pb, pal + 4, 768); + avio_read(s->pb, pal + 4, 768); break; case MKTAG('F', 'R', 'A', 'M'): - get_buffer(s->pb, buf + 4, DXA_EXTRA_SIZE - 4); + avio_read(s->pb, buf + 4, DXA_EXTRA_SIZE - 4); size = AV_RB32(buf + 5); if(size > 0xFFFFFF){ av_log(s, AV_LOG_ERROR, "Frame size is too big: %d\n", size); @@ -190,7 +190,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0) return AVERROR(ENOMEM); memcpy(pkt->data + pal_size, buf, DXA_EXTRA_SIZE); - ret = get_buffer(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size); + ret = avio_read(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size); if(ret != size){ av_free_packet(pkt); return AVERROR(EIO); diff --git a/mplayer/ffmpeg/libavformat/eacdata.c b/mplayer/ffmpeg/libavformat/eacdata.c index 809b190d..8fc8c422 100644 --- a/mplayer/ffmpeg/libavformat/eacdata.c +++ b/mplayer/ffmpeg/libavformat/eacdata.c @@ -47,11 +47,11 @@ static int cdata_probe(AVProbeData *p) static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) { CdataDemuxContext *cdata = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int sample_rate, header; AVStream *st; - header = get_be16(pb); + header = avio_rb16(pb); switch (header) { case 0x0400: cdata->channels = 1; break; case 0x0404: cdata->channels = 2; break; @@ -61,8 +61,8 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; }; - sample_rate = get_be16(pb); - url_fskip(pb, 12); + sample_rate = avio_rb16(pb); + avio_seek(pb, 12, SEEK_CUR); st = av_new_stream(s, 0); if (!st) diff --git a/mplayer/ffmpeg/libavformat/electronicarts.c b/mplayer/ffmpeg/libavformat/electronicarts.c index 5408a1f0..cd3c3380 100644 --- a/mplayer/ffmpeg/libavformat/electronicarts.c +++ b/mplayer/ffmpeg/libavformat/electronicarts.c @@ -77,16 +77,16 @@ typedef struct EaDemuxContext { int num_samples; } EaDemuxContext; -static uint32_t read_arbitary(ByteIOContext *pb) { +static uint32_t read_arbitary(AVIOContext *pb) { uint8_t size, byte; int i; uint32_t word; - size = get_byte(pb); + size = avio_r8(pb); word = 0; for (i = 0; i < size; i++) { - byte = get_byte(pb); + byte = avio_r8(pb); word <<= 8; word |= byte; } @@ -102,7 +102,7 @@ static int process_audio_header_elements(AVFormatContext *s) { int inHeader = 1; EaDemuxContext *ea = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int compression_type = -1, revision = -1, revision2 = -1; ea->bytes = 2; @@ -112,7 +112,7 @@ static int process_audio_header_elements(AVFormatContext *s) while (!url_feof(pb) && inHeader) { int inSubheader; uint8_t byte; - byte = get_byte(pb); + byte = avio_r8(pb); switch (byte) { case 0xFD: @@ -120,7 +120,7 @@ static int process_audio_header_elements(AVFormatContext *s) inSubheader = 1; while (!url_feof(pb) && inSubheader) { uint8_t subbyte; - subbyte = get_byte(pb); + subbyte = avio_r8(pb); switch (subbyte) { case 0x80: @@ -215,14 +215,14 @@ static int process_audio_header_elements(AVFormatContext *s) static int process_audio_header_eacs(AVFormatContext *s) { EaDemuxContext *ea = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int compression_type; - ea->sample_rate = ea->big_endian ? get_be32(pb) : get_le32(pb); - ea->bytes = get_byte(pb); /* 1=8-bit, 2=16-bit */ - ea->num_channels = get_byte(pb); - compression_type = get_byte(pb); - url_fskip(pb, 13); + ea->sample_rate = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb); + ea->bytes = avio_r8(pb); /* 1=8-bit, 2=16-bit */ + ea->num_channels = avio_r8(pb); + compression_type = avio_r8(pb); + avio_seek(pb, 13, SEEK_CUR); switch (compression_type) { case 0: @@ -247,11 +247,11 @@ static int process_audio_header_eacs(AVFormatContext *s) static int process_audio_header_sead(AVFormatContext *s) { EaDemuxContext *ea = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; - ea->sample_rate = get_le32(pb); - ea->bytes = get_le32(pb); /* 1=8-bit, 2=16-bit */ - ea->num_channels = get_le32(pb); + ea->sample_rate = avio_rl32(pb); + ea->bytes = avio_rl32(pb); /* 1=8-bit, 2=16-bit */ + ea->num_channels = avio_rl32(pb); ea->audio_codec = CODEC_ID_ADPCM_IMA_EA_SEAD; return 1; @@ -260,10 +260,10 @@ static int process_audio_header_sead(AVFormatContext *s) static int process_video_header_mdec(AVFormatContext *s) { EaDemuxContext *ea = s->priv_data; - ByteIOContext *pb = s->pb; - url_fskip(pb, 4); - ea->width = get_le16(pb); - ea->height = get_le16(pb); + AVIOContext *pb = s->pb; + avio_seek(pb, 4, SEEK_CUR); + ea->width = avio_rl16(pb); + ea->height = avio_rl16(pb); ea->time_base = (AVRational){1,15}; ea->video_codec = CODEC_ID_MDEC; return 1; @@ -272,11 +272,11 @@ static int process_video_header_mdec(AVFormatContext *s) static int process_video_header_vp6(AVFormatContext *s) { EaDemuxContext *ea = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; - url_fskip(pb, 16); - ea->time_base.den = get_le32(pb); - ea->time_base.num = get_le32(pb); + avio_seek(pb, 16, SEEK_CUR); + ea->time_base.den = avio_rl32(pb); + ea->time_base.num = avio_rl32(pb); ea->video_codec = CODEC_ID_VP6; return 1; @@ -289,15 +289,15 @@ static int process_video_header_vp6(AVFormatContext *s) static int process_ea_header(AVFormatContext *s) { uint32_t blockid, size = 0; EaDemuxContext *ea = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i; for (i=0; i<5 && (!ea->audio_codec || !ea->video_codec); i++) { unsigned int startpos = url_ftell(pb); int err = 0; - blockid = get_le32(pb); - size = get_le32(pb); + blockid = avio_rl32(pb); + size = avio_rl32(pb); if (i == 0) ea->big_endian = size > 0x000FFFFF; if (ea->big_endian) @@ -305,7 +305,7 @@ static int process_ea_header(AVFormatContext *s) { switch (blockid) { case ISNh_TAG: - if (get_le32(pb) != EACS_TAG) { + if (avio_rl32(pb) != EACS_TAG) { av_log (s, AV_LOG_ERROR, "unknown 1SNh headerid\n"); return 0; } @@ -314,9 +314,9 @@ static int process_ea_header(AVFormatContext *s) { case SCHl_TAG : case SHEN_TAG : - blockid = get_le32(pb); + blockid = avio_rl32(pb); if (blockid == GSTR_TAG) { - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); } else if ((blockid & 0xFFFF)!=PT00_TAG) { av_log (s, AV_LOG_ERROR, "unknown SCHl headerid\n"); return 0; @@ -369,10 +369,10 @@ static int process_ea_header(AVFormatContext *s) { return err; } - url_fseek(pb, startpos + size, SEEK_SET); + avio_seek(pb, startpos + size, SEEK_SET); } - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); return 1; } @@ -459,7 +459,7 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) { EaDemuxContext *ea = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret = 0; int packet_read = 0; unsigned int chunk_type, chunk_size; @@ -467,26 +467,26 @@ static int ea_read_packet(AVFormatContext *s, int av_uninit(num_samples); while (!packet_read) { - chunk_type = get_le32(pb); - chunk_size = (ea->big_endian ? get_be32(pb) : get_le32(pb)) - 8; + chunk_type = avio_rl32(pb); + chunk_size = (ea->big_endian ? avio_rb32(pb) : avio_rl32(pb)) - 8; switch (chunk_type) { /* audio data */ case ISNh_TAG: /* header chunk also contains data; skip over the header portion*/ - url_fskip(pb, 32); + avio_seek(pb, 32, SEEK_CUR); chunk_size -= 32; case ISNd_TAG: case SCDl_TAG: case SNDC_TAG: case SDEN_TAG: if (!ea->audio_codec) { - url_fskip(pb, chunk_size); + avio_seek(pb, chunk_size, SEEK_CUR); break; } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR || ea->audio_codec == CODEC_ID_MP3) { - num_samples = get_le32(pb); - url_fskip(pb, 8); + num_samples = avio_rl32(pb); + avio_seek(pb, 8, SEEK_CUR); chunk_size -= 12; } ret = av_get_packet(pb, pkt, chunk_size); @@ -536,12 +536,12 @@ static int ea_read_packet(AVFormatContext *s, case fVGT_TAG: case MADm_TAG: case MADe_TAG: - url_fseek(pb, -8, SEEK_CUR); // include chunk preamble + avio_seek(pb, -8, SEEK_CUR); // include chunk preamble chunk_size += 8; goto get_video_packet; case mTCD_TAG: - url_fseek(pb, 8, SEEK_CUR); // skip ea dct header + avio_seek(pb, 8, SEEK_CUR); // skip ea dct header chunk_size -= 8; goto get_video_packet; @@ -560,7 +560,7 @@ static int ea_read_packet(AVFormatContext *s, break; default: - url_fseek(pb, chunk_size, SEEK_CUR); + avio_seek(pb, chunk_size, SEEK_CUR); break; } } diff --git a/mplayer/ffmpeg/libavformat/ffmdec.c b/mplayer/ffmpeg/libavformat/ffmdec.c index 91da6504..bcfc1658 100644 --- a/mplayer/ffmpeg/libavformat/ffmdec.c +++ b/mplayer/ffmpeg/libavformat/ffmdec.c @@ -95,7 +95,7 @@ static int ffm_resync(AVFormatContext *s, int state) av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n"); return -1; } - state = (state << 8) | get_byte(s->pb); + state = (state << 8) | avio_r8(s->pb); } return 0; } @@ -105,7 +105,7 @@ static int ffm_read_data(AVFormatContext *s, uint8_t *buf, int size, int header) { FFMContext *ffm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int len, fill_size, size1, frame_offset, id; size1 = size; @@ -118,16 +118,16 @@ static int ffm_read_data(AVFormatContext *s, len = size; if (len == 0) { if (url_ftell(pb) == ffm->file_size) - url_fseek(pb, ffm->packet_size, SEEK_SET); + avio_seek(pb, ffm->packet_size, SEEK_SET); retry_read: - id = get_be16(pb); /* PACKET_ID */ + id = avio_rb16(pb); /* PACKET_ID */ if (id != PACKET_ID) if (ffm_resync(s, id) < 0) return -1; - fill_size = get_be16(pb); - ffm->dts = get_be64(pb); - frame_offset = get_be16(pb); - get_buffer(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE); + fill_size = avio_rb16(pb); + ffm->dts = avio_rb64(pb); + frame_offset = avio_rb16(pb); + avio_read(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE); ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size); if (ffm->packet_end < ffm->packet || frame_offset < 0) return -1; @@ -137,7 +137,7 @@ static int ffm_read_data(AVFormatContext *s, if (!frame_offset) { /* This packet has no frame headers in it */ if (url_ftell(pb) >= ffm->packet_size * 3) { - url_fseek(pb, -ffm->packet_size * 2, SEEK_CUR); + avio_seek(pb, -ffm->packet_size * 2, SEEK_CUR); goto retry_read; } /* This is bad, we cannot find a valid frame header */ @@ -170,7 +170,7 @@ static int ffm_read_data(AVFormatContext *s, static void ffm_seek1(AVFormatContext *s, int64_t pos1) { FFMContext *ffm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos; pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE); @@ -178,17 +178,17 @@ static void ffm_seek1(AVFormatContext *s, int64_t pos1) #ifdef DEBUG_SEEK av_log(s, AV_LOG_DEBUG, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos); #endif - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } static int64_t get_dts(AVFormatContext *s, int64_t pos) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t dts; ffm_seek1(s, pos); - url_fskip(pb, 4); - dts = get_be64(pb); + avio_seek(pb, 4, SEEK_CUR); + dts = avio_rb64(pb); #ifdef DEBUG_SEEK av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0); #endif @@ -198,7 +198,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos) static void adjust_write_index(AVFormatContext *s) { FFMContext *ffm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pts; //int64_t orig_write_index = ffm->write_index; int64_t pos_min, pos_max; @@ -248,7 +248,7 @@ static void adjust_write_index(AVFormatContext *s) //printf("pts range %0.6f - %0.6f\n", get_dts(s, 0) / 1000000. , get_dts(s, ffm->file_size - 2 * FFM_PACKET_SIZE) / 1000000. ); end: - url_fseek(pb, ptr, SEEK_SET); + avio_seek(pb, ptr, SEEK_SET); } @@ -267,19 +267,19 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) { FFMContext *ffm = s->priv_data; AVStream *st; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *codec; int i, nb_streams; uint32_t tag; /* header */ - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag != MKTAG('F', 'F', 'M', '1')) goto fail; - ffm->packet_size = get_be32(pb); + ffm->packet_size = avio_rb32(pb); if (ffm->packet_size != FFM_PACKET_SIZE) goto fail; - ffm->write_index = get_be64(pb); + ffm->write_index = avio_rb64(pb); /* get also filesize */ if (!url_is_streamed(pb)) { ffm->file_size = url_fsize(pb); @@ -289,8 +289,8 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) ffm->file_size = (UINT64_C(1) << 63) - 1; } - nb_streams = get_be32(pb); - get_be32(pb); /* total bitrate */ + nb_streams = avio_rb32(pb); + avio_rb32(pb); /* total bitrate */ /* read each stream */ for(i=0;icodec; /* generic info */ - codec->codec_id = get_be32(pb); - codec->codec_type = get_byte(pb); /* codec_type */ - codec->bit_rate = get_be32(pb); - st->quality = get_be32(pb); - codec->flags = get_be32(pb); - codec->flags2 = get_be32(pb); - codec->debug = get_be32(pb); + codec->codec_id = avio_rb32(pb); + codec->codec_type = avio_r8(pb); /* codec_type */ + codec->bit_rate = avio_rb32(pb); + st->quality = avio_rb32(pb); + codec->flags = avio_rb32(pb); + codec->flags2 = avio_rb32(pb); + codec->debug = avio_rb32(pb); /* specific info */ switch(codec->codec_type) { case AVMEDIA_TYPE_VIDEO: - codec->time_base.num = get_be32(pb); - codec->time_base.den = get_be32(pb); - codec->width = get_be16(pb); - codec->height = get_be16(pb); - codec->gop_size = get_be16(pb); - codec->pix_fmt = get_be32(pb); - codec->qmin = get_byte(pb); - codec->qmax = get_byte(pb); - codec->max_qdiff = get_byte(pb); - codec->qcompress = get_be16(pb) / 10000.0; - codec->qblur = get_be16(pb) / 10000.0; - codec->bit_rate_tolerance = get_be32(pb); + codec->time_base.num = avio_rb32(pb); + codec->time_base.den = avio_rb32(pb); + codec->width = avio_rb16(pb); + codec->height = avio_rb16(pb); + codec->gop_size = avio_rb16(pb); + codec->pix_fmt = avio_rb32(pb); + codec->qmin = avio_r8(pb); + codec->qmax = avio_r8(pb); + codec->max_qdiff = avio_r8(pb); + codec->qcompress = avio_rb16(pb) / 10000.0; + codec->qblur = avio_rb16(pb) / 10000.0; + codec->bit_rate_tolerance = avio_rb32(pb); codec->rc_eq = av_strdup(get_strz(pb, rc_eq_buf, sizeof(rc_eq_buf))); - codec->rc_max_rate = get_be32(pb); - codec->rc_min_rate = get_be32(pb); - codec->rc_buffer_size = get_be32(pb); - codec->i_quant_factor = av_int2dbl(get_be64(pb)); - codec->b_quant_factor = av_int2dbl(get_be64(pb)); - codec->i_quant_offset = av_int2dbl(get_be64(pb)); - codec->b_quant_offset = av_int2dbl(get_be64(pb)); - codec->dct_algo = get_be32(pb); - codec->strict_std_compliance = get_be32(pb); - codec->max_b_frames = get_be32(pb); - codec->luma_elim_threshold = get_be32(pb); - codec->chroma_elim_threshold = get_be32(pb); - codec->mpeg_quant = get_be32(pb); - codec->intra_dc_precision = get_be32(pb); - codec->me_method = get_be32(pb); - codec->mb_decision = get_be32(pb); - codec->nsse_weight = get_be32(pb); - codec->frame_skip_cmp = get_be32(pb); - codec->rc_buffer_aggressivity = av_int2dbl(get_be64(pb)); - codec->codec_tag = get_be32(pb); - codec->thread_count = get_byte(pb); - codec->coder_type = get_be32(pb); - codec->me_cmp = get_be32(pb); - codec->partitions = get_be32(pb); - codec->me_subpel_quality = get_be32(pb); - codec->me_range = get_be32(pb); - codec->keyint_min = get_be32(pb); - codec->scenechange_threshold = get_be32(pb); - codec->b_frame_strategy = get_be32(pb); - codec->qcompress = av_int2dbl(get_be64(pb)); - codec->qblur = av_int2dbl(get_be64(pb)); - codec->max_qdiff = get_be32(pb); - codec->refs = get_be32(pb); - codec->directpred = get_be32(pb); + codec->rc_max_rate = avio_rb32(pb); + codec->rc_min_rate = avio_rb32(pb); + codec->rc_buffer_size = avio_rb32(pb); + codec->i_quant_factor = av_int2dbl(avio_rb64(pb)); + codec->b_quant_factor = av_int2dbl(avio_rb64(pb)); + codec->i_quant_offset = av_int2dbl(avio_rb64(pb)); + codec->b_quant_offset = av_int2dbl(avio_rb64(pb)); + codec->dct_algo = avio_rb32(pb); + codec->strict_std_compliance = avio_rb32(pb); + codec->max_b_frames = avio_rb32(pb); + codec->luma_elim_threshold = avio_rb32(pb); + codec->chroma_elim_threshold = avio_rb32(pb); + codec->mpeg_quant = avio_rb32(pb); + codec->intra_dc_precision = avio_rb32(pb); + codec->me_method = avio_rb32(pb); + codec->mb_decision = avio_rb32(pb); + codec->nsse_weight = avio_rb32(pb); + codec->frame_skip_cmp = avio_rb32(pb); + codec->rc_buffer_aggressivity = av_int2dbl(avio_rb64(pb)); + codec->codec_tag = avio_rb32(pb); + codec->thread_count = avio_r8(pb); + codec->coder_type = avio_rb32(pb); + codec->me_cmp = avio_rb32(pb); + codec->partitions = avio_rb32(pb); + codec->me_subpel_quality = avio_rb32(pb); + codec->me_range = avio_rb32(pb); + codec->keyint_min = avio_rb32(pb); + codec->scenechange_threshold = avio_rb32(pb); + codec->b_frame_strategy = avio_rb32(pb); + codec->qcompress = av_int2dbl(avio_rb64(pb)); + codec->qblur = av_int2dbl(avio_rb64(pb)); + codec->max_qdiff = avio_rb32(pb); + codec->refs = avio_rb32(pb); + codec->directpred = avio_rb32(pb); break; case AVMEDIA_TYPE_AUDIO: - codec->sample_rate = get_be32(pb); - codec->channels = get_le16(pb); - codec->frame_size = get_le16(pb); - codec->sample_fmt = (int16_t) get_le16(pb); + codec->sample_rate = avio_rb32(pb); + codec->channels = avio_rl16(pb); + codec->frame_size = avio_rl16(pb); + codec->sample_fmt = (int16_t) avio_rl16(pb); break; default: goto fail; } if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) { - codec->extradata_size = get_be32(pb); + codec->extradata_size = avio_rb32(pb); codec->extradata = av_malloc(codec->extradata_size); if (!codec->extradata) return AVERROR(ENOMEM); - get_buffer(pb, codec->extradata, codec->extradata_size); + avio_read(pb, codec->extradata, codec->extradata_size); } } /* get until end of block reached */ while ((url_ftell(pb) % ffm->packet_size) != 0) - get_byte(pb); + avio_r8(pb); /* init packet demux */ ffm->packet_ptr = ffm->packet; diff --git a/mplayer/ffmpeg/libavformat/ffmenc.c b/mplayer/ffmpeg/libavformat/ffmenc.c index f9e0782c..eeaaa229 100644 --- a/mplayer/ffmpeg/libavformat/ffmenc.c +++ b/mplayer/ffmpeg/libavformat/ffmenc.c @@ -27,7 +27,7 @@ static void flush_packet(AVFormatContext *s) { FFMContext *ffm = s->priv_data; int fill_size, h; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; fill_size = ffm->packet_end - ffm->packet_ptr; memset(ffm->packet_ptr, 0, fill_size); @@ -36,14 +36,14 @@ static void flush_packet(AVFormatContext *s) av_abort(); /* put header */ - put_be16(pb, PACKET_ID); - put_be16(pb, fill_size); - put_be64(pb, ffm->dts); + avio_wb16(pb, PACKET_ID); + avio_wb16(pb, fill_size); + avio_wb64(pb, ffm->dts); h = ffm->frame_offset; if (ffm->first_packet) h |= 0x8000; - put_be16(pb, h); - put_buffer(pb, ffm->packet, ffm->packet_end - ffm->packet); + avio_wb16(pb, h); + avio_write(pb, ffm->packet, ffm->packet_end - ffm->packet); put_flush_packet(pb); /* prepare next packet */ @@ -84,24 +84,24 @@ static int ffm_write_header(AVFormatContext *s) { FFMContext *ffm = s->priv_data; AVStream *st; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *codec; int bit_rate, i; ffm->packet_size = FFM_PACKET_SIZE; /* header */ - put_le32(pb, MKTAG('F', 'F', 'M', '1')); - put_be32(pb, ffm->packet_size); - put_be64(pb, 0); /* current write position */ + avio_wl32(pb, MKTAG('F', 'F', 'M', '1')); + avio_wb32(pb, ffm->packet_size); + avio_wb64(pb, 0); /* current write position */ - put_be32(pb, s->nb_streams); + avio_wb32(pb, s->nb_streams); bit_rate = 0; for(i=0;inb_streams;i++) { st = s->streams[i]; bit_rate += st->codec->bit_rate; } - put_be32(pb, bit_rate); + avio_wb32(pb, bit_rate); /* list of streams */ for(i=0;inb_streams;i++) { @@ -110,82 +110,82 @@ static int ffm_write_header(AVFormatContext *s) codec = st->codec; /* generic info */ - put_be32(pb, codec->codec_id); - put_byte(pb, codec->codec_type); - put_be32(pb, codec->bit_rate); - put_be32(pb, st->quality); - put_be32(pb, codec->flags); - put_be32(pb, codec->flags2); - put_be32(pb, codec->debug); + avio_wb32(pb, codec->codec_id); + avio_w8(pb, codec->codec_type); + avio_wb32(pb, codec->bit_rate); + avio_wb32(pb, st->quality); + avio_wb32(pb, codec->flags); + avio_wb32(pb, codec->flags2); + avio_wb32(pb, codec->debug); /* specific info */ switch(codec->codec_type) { case AVMEDIA_TYPE_VIDEO: - put_be32(pb, codec->time_base.num); - put_be32(pb, codec->time_base.den); - put_be16(pb, codec->width); - put_be16(pb, codec->height); - put_be16(pb, codec->gop_size); - put_be32(pb, codec->pix_fmt); - put_byte(pb, codec->qmin); - put_byte(pb, codec->qmax); - put_byte(pb, codec->max_qdiff); - put_be16(pb, (int) (codec->qcompress * 10000.0)); - put_be16(pb, (int) (codec->qblur * 10000.0)); - put_be32(pb, codec->bit_rate_tolerance); + avio_wb32(pb, codec->time_base.num); + avio_wb32(pb, codec->time_base.den); + avio_wb16(pb, codec->width); + avio_wb16(pb, codec->height); + avio_wb16(pb, codec->gop_size); + avio_wb32(pb, codec->pix_fmt); + avio_w8(pb, codec->qmin); + avio_w8(pb, codec->qmax); + avio_w8(pb, codec->max_qdiff); + avio_wb16(pb, (int) (codec->qcompress * 10000.0)); + avio_wb16(pb, (int) (codec->qblur * 10000.0)); + avio_wb32(pb, codec->bit_rate_tolerance); avio_put_str(pb, codec->rc_eq ? codec->rc_eq : "tex^qComp"); - put_be32(pb, codec->rc_max_rate); - put_be32(pb, codec->rc_min_rate); - put_be32(pb, codec->rc_buffer_size); - put_be64(pb, av_dbl2int(codec->i_quant_factor)); - put_be64(pb, av_dbl2int(codec->b_quant_factor)); - put_be64(pb, av_dbl2int(codec->i_quant_offset)); - put_be64(pb, av_dbl2int(codec->b_quant_offset)); - put_be32(pb, codec->dct_algo); - put_be32(pb, codec->strict_std_compliance); - put_be32(pb, codec->max_b_frames); - put_be32(pb, codec->luma_elim_threshold); - put_be32(pb, codec->chroma_elim_threshold); - put_be32(pb, codec->mpeg_quant); - put_be32(pb, codec->intra_dc_precision); - put_be32(pb, codec->me_method); - put_be32(pb, codec->mb_decision); - put_be32(pb, codec->nsse_weight); - put_be32(pb, codec->frame_skip_cmp); - put_be64(pb, av_dbl2int(codec->rc_buffer_aggressivity)); - put_be32(pb, codec->codec_tag); - put_byte(pb, codec->thread_count); - put_be32(pb, codec->coder_type); - put_be32(pb, codec->me_cmp); - put_be32(pb, codec->partitions); - put_be32(pb, codec->me_subpel_quality); - put_be32(pb, codec->me_range); - put_be32(pb, codec->keyint_min); - put_be32(pb, codec->scenechange_threshold); - put_be32(pb, codec->b_frame_strategy); - put_be64(pb, av_dbl2int(codec->qcompress)); - put_be64(pb, av_dbl2int(codec->qblur)); - put_be32(pb, codec->max_qdiff); - put_be32(pb, codec->refs); - put_be32(pb, codec->directpred); + avio_wb32(pb, codec->rc_max_rate); + avio_wb32(pb, codec->rc_min_rate); + avio_wb32(pb, codec->rc_buffer_size); + avio_wb64(pb, av_dbl2int(codec->i_quant_factor)); + avio_wb64(pb, av_dbl2int(codec->b_quant_factor)); + avio_wb64(pb, av_dbl2int(codec->i_quant_offset)); + avio_wb64(pb, av_dbl2int(codec->b_quant_offset)); + avio_wb32(pb, codec->dct_algo); + avio_wb32(pb, codec->strict_std_compliance); + avio_wb32(pb, codec->max_b_frames); + avio_wb32(pb, codec->luma_elim_threshold); + avio_wb32(pb, codec->chroma_elim_threshold); + avio_wb32(pb, codec->mpeg_quant); + avio_wb32(pb, codec->intra_dc_precision); + avio_wb32(pb, codec->me_method); + avio_wb32(pb, codec->mb_decision); + avio_wb32(pb, codec->nsse_weight); + avio_wb32(pb, codec->frame_skip_cmp); + avio_wb64(pb, av_dbl2int(codec->rc_buffer_aggressivity)); + avio_wb32(pb, codec->codec_tag); + avio_w8(pb, codec->thread_count); + avio_wb32(pb, codec->coder_type); + avio_wb32(pb, codec->me_cmp); + avio_wb32(pb, codec->partitions); + avio_wb32(pb, codec->me_subpel_quality); + avio_wb32(pb, codec->me_range); + avio_wb32(pb, codec->keyint_min); + avio_wb32(pb, codec->scenechange_threshold); + avio_wb32(pb, codec->b_frame_strategy); + avio_wb64(pb, av_dbl2int(codec->qcompress)); + avio_wb64(pb, av_dbl2int(codec->qblur)); + avio_wb32(pb, codec->max_qdiff); + avio_wb32(pb, codec->refs); + avio_wb32(pb, codec->directpred); break; case AVMEDIA_TYPE_AUDIO: - put_be32(pb, codec->sample_rate); - put_le16(pb, codec->channels); - put_le16(pb, codec->frame_size); - put_le16(pb, codec->sample_fmt); + avio_wb32(pb, codec->sample_rate); + avio_wl16(pb, codec->channels); + avio_wl16(pb, codec->frame_size); + avio_wl16(pb, codec->sample_fmt); break; default: return -1; } if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) { - put_be32(pb, codec->extradata_size); - put_buffer(pb, codec->extradata, codec->extradata_size); + avio_wb32(pb, codec->extradata_size); + avio_write(pb, codec->extradata, codec->extradata_size); } } /* flush until end of block reached */ while ((url_ftell(pb) % ffm->packet_size) != 0) - put_byte(pb, 0); + avio_w8(pb, 0); put_flush_packet(pb); @@ -228,7 +228,7 @@ static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt) static int ffm_write_trailer(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; FFMContext *ffm = s->priv_data; /* flush packets */ diff --git a/mplayer/ffmpeg/libavformat/ffmetadec.c b/mplayer/ffmpeg/libavformat/ffmetadec.c index ab35746e..cc7e1da4 100644 --- a/mplayer/ffmpeg/libavformat/ffmetadec.c +++ b/mplayer/ffmpeg/libavformat/ffmetadec.c @@ -21,6 +21,7 @@ #include "avformat.h" #include "ffmeta.h" +#include "internal.h" static int probe(AVProbeData *p) { @@ -29,17 +30,17 @@ static int probe(AVProbeData *p) return 0; } -static void get_line(ByteIOContext *s, uint8_t *buf, int size) +static void get_line(AVIOContext *s, uint8_t *buf, int size) { do { uint8_t c; int i = 0; - while ((c = get_byte(s))) { + while ((c = avio_r8(s))) { if (c == '\\') { if (i < size - 1) buf[i++] = c; - c = get_byte(s); + c = avio_r8(s); } else if (c == '\n') break; diff --git a/mplayer/ffmpeg/libavformat/ffmetaenc.c b/mplayer/ffmpeg/libavformat/ffmetaenc.c index b20abc90..77db0b9b 100644 --- a/mplayer/ffmpeg/libavformat/ffmetaenc.c +++ b/mplayer/ffmpeg/libavformat/ffmetaenc.c @@ -25,34 +25,34 @@ #include "ffmeta.h" -static void write_escape_str(ByteIOContext *s, const uint8_t *str) +static void write_escape_str(AVIOContext *s, const uint8_t *str) { const uint8_t *p = str; while (*p) { if (*p == '#' || *p == ';' || *p == '=' || *p == '\\' || *p == '\n') - put_byte(s, '\\'); - put_byte(s, *p); + avio_w8(s, '\\'); + avio_w8(s, *p); p++; } } -static void write_tags(ByteIOContext *s, AVMetadata *m) +static void write_tags(AVIOContext *s, AVMetadata *m) { AVMetadataTag *t = NULL; while ((t = av_metadata_get(m, "", t, AV_METADATA_IGNORE_SUFFIX))) { write_escape_str(s, t->key); - put_byte(s, '='); + avio_w8(s, '='); write_escape_str(s, t->value); - put_byte(s, '\n'); + avio_w8(s, '\n'); } } static int write_header(AVFormatContext *s) { - put_tag(s->pb, ID_STRING); - put_byte(s->pb, '1'); // version - put_byte(s->pb, '\n'); + avio_write(s->pb, ID_STRING, sizeof(ID_STRING) - 1); + avio_w8(s->pb, '1'); // version + avio_w8(s->pb, '\n'); put_flush_packet(s->pb); return 0; } @@ -64,15 +64,15 @@ static int write_trailer(AVFormatContext *s) write_tags(s->pb, s->metadata); for (i = 0; i < s->nb_streams; i++) { - put_tag(s->pb, ID_STREAM); - put_byte(s->pb, '\n'); + avio_write(s->pb, ID_STREAM, sizeof(ID_STREAM) - 1); + avio_w8(s->pb, '\n'); write_tags(s->pb, s->streams[i]->metadata); } for (i = 0; i < s->nb_chapters; i++) { AVChapter *ch = s->chapters[i]; - put_tag(s->pb, ID_CHAPTER); - put_byte(s->pb, '\n'); + avio_write(s->pb, ID_CHAPTER, sizeof(ID_CHAPTER) - 1); + avio_w8(s->pb, '\n'); url_fprintf(s->pb, "TIMEBASE=%d/%d\n", ch->time_base.num, ch->time_base.den); url_fprintf(s->pb, "START=%"PRId64"\n", ch->start); url_fprintf(s->pb, "END=%"PRId64"\n", ch->end); diff --git a/mplayer/ffmpeg/libavformat/filmstripdec.c b/mplayer/ffmpeg/libavformat/filmstripdec.c index 805ca991..a987b93b 100644 --- a/mplayer/ffmpeg/libavformat/filmstripdec.c +++ b/mplayer/ffmpeg/libavformat/filmstripdec.c @@ -37,14 +37,14 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { FilmstripDemuxContext *film = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; if (url_is_streamed(s->pb)) return AVERROR(EIO); - url_fseek(pb, url_fsize(pb) - 36, SEEK_SET); - if (get_be32(pb) != RAND_TAG) { + avio_seek(pb, url_fsize(pb) - 36, SEEK_SET); + if (avio_rb32(pb) != RAND_TAG) { av_log(s, AV_LOG_ERROR, "magic number not found"); return AVERROR_INVALIDDATA; } @@ -53,23 +53,23 @@ static int read_header(AVFormatContext *s, if (!st) return AVERROR(ENOMEM); - st->nb_frames = get_be32(pb); - if (get_be16(pb) != 0) { + st->nb_frames = avio_rb32(pb); + if (avio_rb16(pb) != 0) { av_log_ask_for_sample(s, "unsupported packing method\n"); return AVERROR_INVALIDDATA; } - url_fskip(pb, 2); + avio_seek(pb, 2, SEEK_CUR); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_RAWVIDEO; st->codec->pix_fmt = PIX_FMT_RGBA; st->codec->codec_tag = 0; /* no fourcc */ - st->codec->width = get_be16(pb); - st->codec->height = get_be16(pb); - film->leading = get_be16(pb); - av_set_pts_info(st, 64, 1, get_be16(pb)); + st->codec->width = avio_rb16(pb); + st->codec->height = avio_rb16(pb); + film->leading = avio_rb16(pb); + av_set_pts_info(st, 64, 1, avio_rb16(pb)); - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); return 0; } @@ -84,7 +84,7 @@ static int read_packet(AVFormatContext *s, return AVERROR(EIO); pkt->dts = url_ftell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4); pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4); - url_fskip(s->pb, st->codec->width * film->leading * 4); + avio_seek(s->pb, st->codec->width * film->leading * 4, SEEK_CUR); if (pkt->size < 0) return pkt->size; pkt->flags |= AV_PKT_FLAG_KEY; @@ -94,7 +94,7 @@ static int read_packet(AVFormatContext *s, static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AVStream *st = s->streams[stream_index]; - url_fseek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET); + avio_seek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET); return 0; } diff --git a/mplayer/ffmpeg/libavformat/filmstripenc.c b/mplayer/ffmpeg/libavformat/filmstripenc.c index 6da575cc..d20b4ecd 100644 --- a/mplayer/ffmpeg/libavformat/filmstripenc.c +++ b/mplayer/ffmpeg/libavformat/filmstripenc.c @@ -45,7 +45,7 @@ static int write_header(AVFormatContext *s) static int write_packet(AVFormatContext *s, AVPacket *pkt) { FilmstripMuxContext *film = s->priv_data; - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, pkt->data, pkt->size); film->nb_frames++; return 0; } @@ -53,20 +53,20 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) static int write_trailer(AVFormatContext *s) { FilmstripMuxContext *film = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; int i; - put_be32(pb, RAND_TAG); - put_be32(pb, film->nb_frames); - put_be16(pb, 0); // packing method - put_be16(pb, 0); // reserved - put_be16(pb, st->codec->width); - put_be16(pb, st->codec->height); - put_be16(pb, 0); // leading - put_be16(pb, 1/av_q2d(st->codec->time_base)); + avio_wb32(pb, RAND_TAG); + avio_wb32(pb, film->nb_frames); + avio_wb16(pb, 0); // packing method + avio_wb16(pb, 0); // reserved + avio_wb16(pb, st->codec->width); + avio_wb16(pb, st->codec->height); + avio_wb16(pb, 0); // leading + avio_wb16(pb, 1/av_q2d(st->codec->time_base)); for (i = 0; i < 16; i++) - put_byte(pb, 0x00); // reserved + avio_w8(pb, 0x00); // reserved put_flush_packet(pb); return 0; } diff --git a/mplayer/ffmpeg/libavformat/flacdec.c b/mplayer/ffmpeg/libavformat/flacdec.c index f971d099..73eeacb4 100644 --- a/mplayer/ffmpeg/libavformat/flacdec.c +++ b/mplayer/ffmpeg/libavformat/flacdec.c @@ -40,14 +40,14 @@ static int flac_read_header(AVFormatContext *s, /* the parameters will be extracted from the compressed bitstream */ /* if fLaC marker is not found, assume there is no header */ - if (get_le32(s->pb) != MKTAG('f','L','a','C')) { - url_fseek(s->pb, -4, SEEK_CUR); + if (avio_rl32(s->pb) != MKTAG('f','L','a','C')) { + avio_seek(s->pb, -4, SEEK_CUR); return 0; } /* process metadata blocks */ while (!url_feof(s->pb) && !metadata_last) { - get_buffer(s->pb, header, 4); + avio_read(s->pb, header, 4); ff_flac_parse_block_header(header, &metadata_last, &metadata_type, &metadata_size); switch (metadata_type) { @@ -58,14 +58,14 @@ static int flac_read_header(AVFormatContext *s, if (!buffer) { return AVERROR(ENOMEM); } - if (get_buffer(s->pb, buffer, metadata_size) != metadata_size) { + if (avio_read(s->pb, buffer, metadata_size) != metadata_size) { av_freep(&buffer); return AVERROR(EIO); } break; /* skip metadata block for unsupported types */ default: - ret = url_fseek(s->pb, metadata_size, SEEK_CUR); + ret = avio_seek(s->pb, metadata_size, SEEK_CUR); if (ret < 0) return ret; } diff --git a/mplayer/ffmpeg/libavformat/flacenc.c b/mplayer/ffmpeg/libavformat/flacenc.c index 5eee5bec..cfd9e094 100644 --- a/mplayer/ffmpeg/libavformat/flacenc.c +++ b/mplayer/ffmpeg/libavformat/flacenc.c @@ -27,19 +27,19 @@ #include "libavcodec/bytestream.h" -static int flac_write_block_padding(ByteIOContext *pb, unsigned int n_padding_bytes, +static int flac_write_block_padding(AVIOContext *pb, unsigned int n_padding_bytes, int last_block) { - put_byte(pb, last_block ? 0x81 : 0x01); - put_be24(pb, n_padding_bytes); + avio_w8(pb, last_block ? 0x81 : 0x01); + avio_wb24(pb, n_padding_bytes); while (n_padding_bytes > 0) { - put_byte(pb, 0); + avio_w8(pb, 0); n_padding_bytes--; } return 0; } -static int flac_write_block_comment(ByteIOContext *pb, AVMetadata **m, +static int flac_write_block_comment(AVIOContext *pb, AVMetadata **m, int last_block, int bitexact) { const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; @@ -58,7 +58,7 @@ static int flac_write_block_comment(ByteIOContext *pb, AVMetadata **m, bytestream_put_be24(&p, len); ff_vorbiscomment_write(&p, m, vendor, count); - put_buffer(pb, p0, len+4); + avio_write(pb, p0, len+4); av_freep(&p0); p = NULL; @@ -90,7 +90,7 @@ static int flac_write_header(struct AVFormatContext *s) static int flac_write_trailer(struct AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint8_t *streaminfo; enum FLACExtradataFormat format; int64_t file_size; @@ -101,9 +101,9 @@ static int flac_write_trailer(struct AVFormatContext *s) if (!url_is_streamed(pb)) { /* rewrite the STREAMINFO header block data */ file_size = url_ftell(pb); - url_fseek(pb, 8, SEEK_SET); - put_buffer(pb, streaminfo, FLAC_STREAMINFO_SIZE); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, 8, SEEK_SET); + avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); } else { av_log(s, AV_LOG_WARNING, "unable to rewrite FLAC header.\n"); @@ -113,7 +113,7 @@ static int flac_write_trailer(struct AVFormatContext *s) static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt) { - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, pkt->data, pkt->size); put_flush_packet(s->pb); return 0; } diff --git a/mplayer/ffmpeg/libavformat/flacenc.h b/mplayer/ffmpeg/libavformat/flacenc.h index 8ad1c267..e83ee32a 100644 --- a/mplayer/ffmpeg/libavformat/flacenc.h +++ b/mplayer/ffmpeg/libavformat/flacenc.h @@ -26,7 +26,7 @@ #include "libavcodec/bytestream.h" #include "avformat.h" -int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec, +int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec, int last_block); #endif /* AVFORMAT_FLACENC_H */ diff --git a/mplayer/ffmpeg/libavformat/flacenc_header.c b/mplayer/ffmpeg/libavformat/flacenc_header.c index 92a129a7..389efbd0 100644 --- a/mplayer/ffmpeg/libavformat/flacenc_header.c +++ b/mplayer/ffmpeg/libavformat/flacenc_header.c @@ -24,7 +24,7 @@ #include "avformat.h" #include "flacenc.h" -int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec, +int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec, int last_block) { uint8_t header[8] = { @@ -39,11 +39,11 @@ int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec, /* write "fLaC" stream marker and first metadata block header if needed */ if (format == FLAC_EXTRADATA_FORMAT_STREAMINFO) { - put_buffer(pb, header, 8); + avio_write(pb, header, 8); } /* write STREAMINFO or full header */ - put_buffer(pb, codec->extradata, codec->extradata_size); + avio_write(pb, codec->extradata, codec->extradata_size); return 0; } diff --git a/mplayer/ffmpeg/libavformat/flic.c b/mplayer/ffmpeg/libavformat/flic.c index bf93c5c9..cdbd9c80 100644 --- a/mplayer/ffmpeg/libavformat/flic.c +++ b/mplayer/ffmpeg/libavformat/flic.c @@ -32,6 +32,7 @@ */ #include "libavutil/intreadwrite.h" +#include "libavutil/audioconvert.h" #include "avformat.h" #define FLIC_FILE_MAGIC_1 0xAF11 @@ -85,7 +86,7 @@ static int flic_read_header(AVFormatContext *s, AVFormatParameters *ap) { FlicDemuxContext *flic = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned char header[FLIC_HEADER_SIZE]; AVStream *st, *ast; int speed; @@ -95,7 +96,7 @@ static int flic_read_header(AVFormatContext *s, flic->frame_number = 0; /* load the whole header and pull out the width and height */ - if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE) + if (avio_read(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE) return AVERROR(EIO); magic_number = AV_RL16(&header[4]); @@ -129,12 +130,12 @@ static int flic_read_header(AVFormatContext *s, memcpy(st->codec->extradata, header, FLIC_HEADER_SIZE); /* peek at the preamble to detect TFTD videos - they seem to always start with an audio chunk */ - if (get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE) != FLIC_PREAMBLE_SIZE) { + if (avio_read(pb, preamble, FLIC_PREAMBLE_SIZE) != FLIC_PREAMBLE_SIZE) { av_log(s, AV_LOG_ERROR, "Failed to peek at preamble\n"); return AVERROR(EIO); } - url_fseek(pb, -FLIC_PREAMBLE_SIZE, SEEK_CUR); + avio_seek(pb, -FLIC_PREAMBLE_SIZE, SEEK_CUR); /* Time to figure out the framerate: * If the first preamble's magic number is 0xAAAA then this file is from @@ -160,7 +161,7 @@ static int flic_read_header(AVFormatContext *s, ast->codec->sample_fmt = AV_SAMPLE_FMT_U8; ast->codec->bit_rate = st->codec->sample_rate * 8; ast->codec->bits_per_coded_sample = 8; - ast->codec->channel_layout = CH_LAYOUT_MONO; + ast->codec->channel_layout = AV_CH_LAYOUT_MONO; ast->codec->extradata_size = 0; /* Since the header information is incorrect we have to figure out the @@ -172,7 +173,7 @@ static int flic_read_header(AVFormatContext *s, av_set_pts_info(st, 64, FLIC_MC_SPEED, 70); /* rewind the stream since the first chunk is at offset 12 */ - url_fseek(pb, 12, SEEK_SET); + avio_seek(pb, 12, SEEK_SET); /* send over abbreviated FLIC header chunk */ av_free(st->codec->extradata); @@ -197,7 +198,7 @@ static int flic_read_packet(AVFormatContext *s, AVPacket *pkt) { FlicDemuxContext *flic = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int packet_read = 0; unsigned int size; int magic; @@ -206,7 +207,7 @@ static int flic_read_packet(AVFormatContext *s, while (!packet_read) { - if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) != + if ((ret = avio_read(pb, preamble, FLIC_PREAMBLE_SIZE)) != FLIC_PREAMBLE_SIZE) { ret = AVERROR(EIO); break; @@ -224,7 +225,7 @@ static int flic_read_packet(AVFormatContext *s, pkt->pts = flic->frame_number++; pkt->pos = url_ftell(pb); memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE); - ret = get_buffer(pb, pkt->data + FLIC_PREAMBLE_SIZE, + ret = avio_read(pb, pkt->data + FLIC_PREAMBLE_SIZE, size - FLIC_PREAMBLE_SIZE); if (ret != size - FLIC_PREAMBLE_SIZE) { av_free_packet(pkt); @@ -238,11 +239,11 @@ static int flic_read_packet(AVFormatContext *s, } /* skip useless 10B sub-header (yes, it's not accounted for in the chunk header) */ - url_fseek(pb, 10, SEEK_CUR); + avio_seek(pb, 10, SEEK_CUR); pkt->stream_index = flic->audio_stream_index; pkt->pos = url_ftell(pb); - ret = get_buffer(pb, pkt->data, size); + ret = avio_read(pb, pkt->data, size); if (ret != size) { av_free_packet(pkt); @@ -252,7 +253,7 @@ static int flic_read_packet(AVFormatContext *s, packet_read = 1; } else { /* not interested in this chunk */ - url_fseek(pb, size - 6, SEEK_CUR); + avio_seek(pb, size - 6, SEEK_CUR); } } diff --git a/mplayer/ffmpeg/libavformat/flvdec.c b/mplayer/ffmpeg/libavformat/flvdec.c index e6081d98..3b30c7f2 100644 --- a/mplayer/ffmpeg/libavformat/flvdec.c +++ b/mplayer/ffmpeg/libavformat/flvdec.c @@ -97,7 +97,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co vcodec->extradata_size = 1; vcodec->extradata = av_malloc(1); } - vcodec->extradata[0] = get_byte(s->pb); + vcodec->extradata[0] = avio_r8(s->pb); return 1; // 1 byte body size adjustment for flv_read_packet() case FLV_CODECID_H264: vcodec->codec_id = CODEC_ID_H264; @@ -110,14 +110,14 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co return 0; } -static int amf_get_string(ByteIOContext *ioc, char *buffer, int buffsize) { - int length = get_be16(ioc); +static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) { + int length = avio_rb16(ioc); if(length >= buffsize) { - url_fskip(ioc, length); + avio_seek(ioc, length, SEEK_CUR); return -1; } - get_buffer(ioc, buffer, length); + avio_read(ioc, buffer, length); buffer[length] = '\0'; @@ -126,7 +126,7 @@ static int amf_get_string(ByteIOContext *ioc, char *buffer, int buffsize) { static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, int64_t max_pos, int depth) { AVCodecContext *acodec, *vcodec; - ByteIOContext *ioc; + AVIOContext *ioc; AMFDataType amf_type; char str_val[256]; double num_val; @@ -134,13 +134,13 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst num_val = 0; ioc = s->pb; - amf_type = get_byte(ioc); + amf_type = avio_r8(ioc); switch(amf_type) { case AMF_DATA_TYPE_NUMBER: - num_val = av_int2dbl(get_be64(ioc)); break; + num_val = av_int2dbl(avio_rb64(ioc)); break; case AMF_DATA_TYPE_BOOL: - num_val = get_byte(ioc); break; + num_val = avio_r8(ioc); break; case AMF_DATA_TYPE_STRING: if(amf_get_string(ioc, str_val, sizeof(str_val)) < 0) return -1; @@ -148,12 +148,12 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst case AMF_DATA_TYPE_OBJECT: { unsigned int keylen; - while(url_ftell(ioc) < max_pos - 2 && (keylen = get_be16(ioc))) { - url_fskip(ioc, keylen); //skip key string + while(url_ftell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) { + avio_seek(ioc, keylen, SEEK_CUR); //skip key string if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) return -1; //if we couldn't skip, bomb out. } - if(get_byte(ioc) != AMF_END_OF_OBJECT) + if(avio_r8(ioc) != AMF_END_OF_OBJECT) return -1; } break; @@ -162,19 +162,19 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst case AMF_DATA_TYPE_UNSUPPORTED: break; //these take up no additional space case AMF_DATA_TYPE_MIXEDARRAY: - url_fskip(ioc, 4); //skip 32-bit max array index + avio_seek(ioc, 4, SEEK_CUR); //skip 32-bit max array index while(url_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) { //this is the only case in which we would want a nested parse to not skip over the object if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0) return -1; } - if(get_byte(ioc) != AMF_END_OF_OBJECT) + if(avio_r8(ioc) != AMF_END_OF_OBJECT) return -1; break; case AMF_DATA_TYPE_ARRAY: { unsigned int arraylen, i; - arraylen = get_be32(ioc); + arraylen = avio_rb32(ioc); for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) { if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) return -1; //if we couldn't skip, bomb out. @@ -182,7 +182,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst } break; case AMF_DATA_TYPE_DATE: - url_fskip(ioc, 8 + 2); //timestamp (double) and UTC offset (int16) + avio_seek(ioc, 8 + 2, SEEK_CUR); //timestamp (double) and UTC offset (int16) break; default: //unsupported type, we couldn't skip return -1; @@ -213,7 +213,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) { AMFDataType type; AVStream *stream, *astream, *vstream; - ByteIOContext *ioc; + AVIOContext *ioc; int i; char buffer[11]; //only needs to hold the string "onMetaData". Anything longer is something we don't want. @@ -222,7 +222,7 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) { ioc = s->pb; //first object needs to be "onMetaData" string - type = get_byte(ioc); + type = avio_r8(ioc); if(type != AMF_DATA_TYPE_STRING || amf_get_string(ioc, buffer, sizeof(buffer)) < 0 || strcmp(buffer, "onMetaData")) return -1; @@ -254,8 +254,8 @@ static int flv_read_header(AVFormatContext *s, { int offset, flags; - url_fskip(s->pb, 4); - flags = get_byte(s->pb); + avio_seek(s->pb, 4, SEEK_CUR); + flags = avio_r8(s->pb); /* old flvtool cleared this field */ /* FIXME: better fix needed */ if (!flags) { @@ -276,9 +276,9 @@ static int flv_read_header(AVFormatContext *s, return AVERROR(ENOMEM); } - offset = get_be32(s->pb); - url_fseek(s->pb, offset, SEEK_SET); - url_fskip(s->pb, 4); + offset = avio_rb32(s->pb); + avio_seek(s->pb, offset, SEEK_SET); + avio_seek(s->pb, 4, SEEK_CUR); s->start_time = 0; @@ -292,7 +292,7 @@ static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size) if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = size; - get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size); + avio_read(s->pb, st->codec->extradata, st->codec->extradata_size); return 0; } @@ -304,16 +304,16 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) int64_t dts, pts = AV_NOPTS_VALUE; AVStream *st = NULL; - for(;;url_fskip(s->pb, 4)){ /* pkt size is repeated at end. skip it */ + for(;;avio_seek(s->pb, 4, SEEK_CUR)){ /* pkt size is repeated at end. skip it */ pos = url_ftell(s->pb); - type = get_byte(s->pb); - size = get_be24(s->pb); - dts = get_be24(s->pb); - dts |= get_byte(s->pb) << 24; + type = avio_r8(s->pb); + size = avio_rb24(s->pb); + dts = avio_rb24(s->pb); + dts |= avio_r8(s->pb) << 24; // av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts); if (url_feof(s->pb)) return AVERROR_EOF; - url_fskip(s->pb, 3); /* stream id, always 0 */ + avio_seek(s->pb, 3, SEEK_CUR); /* stream id, always 0 */ flags = 0; if(size == 0) @@ -323,11 +323,11 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) if (type == FLV_TAG_TYPE_AUDIO) { is_audio=1; - flags = get_byte(s->pb); + flags = avio_r8(s->pb); size--; } else if (type == FLV_TAG_TYPE_VIDEO) { is_audio=0; - flags = get_byte(s->pb); + flags = avio_r8(s->pb); size--; if ((flags & 0xf0) == 0x50) /* video info / command frame */ goto skip; @@ -337,7 +337,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) else /* skip packet */ av_log(s, AV_LOG_DEBUG, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags); skip: - url_fseek(s->pb, next, SEEK_SET); + avio_seek(s->pb, next, SEEK_SET); continue; } @@ -361,7 +361,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) ||(st->discard >= AVDISCARD_BIDIR && ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio)) || st->discard >= AVDISCARD_ALL ){ - url_fseek(s->pb, next, SEEK_SET); + avio_seek(s->pb, next, SEEK_SET); continue; } if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY) @@ -374,15 +374,15 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) int size; const int64_t pos= url_ftell(s->pb); const int64_t fsize= url_fsize(s->pb); - url_fseek(s->pb, fsize-4, SEEK_SET); - size= get_be32(s->pb); - url_fseek(s->pb, fsize-3-size, SEEK_SET); - if(size == get_be24(s->pb) + 11){ - uint32_t ts = get_be24(s->pb); - ts |= get_byte(s->pb) << 24; + avio_seek(s->pb, fsize-4, SEEK_SET); + size= avio_rb32(s->pb); + avio_seek(s->pb, fsize-3-size, SEEK_SET); + if(size == avio_rb24(s->pb) + 11){ + uint32_t ts = avio_rb24(s->pb); + ts |= avio_r8(s->pb) << 24; s->duration = ts * (int64_t)AV_TIME_BASE / 1000; } - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); } if(is_audio){ @@ -400,10 +400,10 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) if (st->codec->codec_id == CODEC_ID_AAC || st->codec->codec_id == CODEC_ID_H264) { - int type = get_byte(s->pb); + int type = avio_r8(s->pb); size--; if (st->codec->codec_id == CODEC_ID_H264) { - int32_t cts = (get_be24(s->pb)+0xff800000)^0xff800000; // sign extension + int32_t cts = (avio_rb24(s->pb)+0xff800000)^0xff800000; // sign extension pts = dts + cts; if (cts < 0) { // dts are wrong flv->wrong_dts = 1; @@ -454,7 +454,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->flags |= AV_PKT_FLAG_KEY; leave: - url_fskip(s->pb, 4); + avio_seek(s->pb, 4, SEEK_CUR); return ret; } diff --git a/mplayer/ffmpeg/libavformat/flvenc.c b/mplayer/ffmpeg/libavformat/flvenc.c index b6e406bf..7dd47da8 100644 --- a/mplayer/ffmpeg/libavformat/flvenc.c +++ b/mplayer/ffmpeg/libavformat/flvenc.c @@ -139,39 +139,39 @@ static int get_audio_flags(AVCodecContext *enc){ return flags; } -static void put_amf_string(ByteIOContext *pb, const char *str) +static void put_amf_string(AVIOContext *pb, const char *str) { size_t len = strlen(str); - put_be16(pb, len); - put_buffer(pb, str, len); + avio_wb16(pb, len); + avio_write(pb, str, len); } -static void put_avc_eos_tag(ByteIOContext *pb, unsigned ts) { - put_byte(pb, FLV_TAG_TYPE_VIDEO); - put_be24(pb, 5); /* Tag Data Size */ - put_be24(pb, ts); /* lower 24 bits of timestamp in ms*/ - put_byte(pb, (ts >> 24) & 0x7F); /* MSB of ts in ms*/ - put_be24(pb, 0); /* StreamId = 0 */ - put_byte(pb, 23); /* ub[4] FrameType = 1, ub[4] CodecId = 7 */ - put_byte(pb, 2); /* AVC end of sequence */ - put_be24(pb, 0); /* Always 0 for AVC EOS. */ - put_be32(pb, 16); /* Size of FLV tag */ +static void put_avc_eos_tag(AVIOContext *pb, unsigned ts) { + avio_w8(pb, FLV_TAG_TYPE_VIDEO); + avio_wb24(pb, 5); /* Tag Data Size */ + avio_wb24(pb, ts); /* lower 24 bits of timestamp in ms*/ + avio_w8(pb, (ts >> 24) & 0x7F); /* MSB of ts in ms*/ + avio_wb24(pb, 0); /* StreamId = 0 */ + avio_w8(pb, 23); /* ub[4] FrameType = 1, ub[4] CodecId = 7 */ + avio_w8(pb, 2); /* AVC end of sequence */ + avio_wb24(pb, 0); /* Always 0 for AVC EOS. */ + avio_wb32(pb, 16); /* Size of FLV tag */ } -static void put_amf_double(ByteIOContext *pb, double d) +static void put_amf_double(AVIOContext *pb, double d) { - put_byte(pb, AMF_DATA_TYPE_NUMBER); - put_be64(pb, av_dbl2int(d)); + avio_w8(pb, AMF_DATA_TYPE_NUMBER); + avio_wb64(pb, av_dbl2int(d)); } -static void put_amf_bool(ByteIOContext *pb, int b) { - put_byte(pb, AMF_DATA_TYPE_BOOL); - put_byte(pb, !!b); +static void put_amf_bool(AVIOContext *pb, int b) { + avio_w8(pb, AMF_DATA_TYPE_BOOL); + avio_w8(pb, !!b); } static int flv_write_header(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; FLVContext *flv = s->priv_data; AVCodecContext *audio_enc = NULL, *video_enc = NULL; int i; @@ -199,20 +199,20 @@ static int flv_write_header(AVFormatContext *s) } av_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */ } - put_tag(pb,"FLV"); - put_byte(pb,1); - put_byte(pb, FLV_HEADER_FLAG_HASAUDIO * !!audio_enc + avio_write(pb, "FLV", 3); + avio_w8(pb,1); + avio_w8(pb, FLV_HEADER_FLAG_HASAUDIO * !!audio_enc + FLV_HEADER_FLAG_HASVIDEO * !!video_enc); - put_be32(pb,9); - put_be32(pb,0); + avio_wb32(pb,9); + avio_wb32(pb,0); for(i=0; inb_streams; i++){ if(s->streams[i]->codec->codec_tag == 5){ - put_byte(pb,8); // message type - put_be24(pb,0); // include flags - put_be24(pb,0); // time stamp - put_be32(pb,0); // reserved - put_be32(pb,11); // size + avio_w8(pb,8); // message type + avio_wb24(pb,0); // include flags + avio_wb24(pb,0); // time stamp + avio_wb32(pb,0); // reserved + avio_wb32(pb,11); // size flv->reserved=5; } } @@ -220,21 +220,21 @@ static int flv_write_header(AVFormatContext *s) flv->last_video_ts = -1; /* write meta_tag */ - put_byte(pb, 18); // tag type META + avio_w8(pb, 18); // tag type META metadata_size_pos= url_ftell(pb); - put_be24(pb, 0); // size of data part (sum of all parts below) - put_be24(pb, 0); // time stamp - put_be32(pb, 0); // reserved + avio_wb24(pb, 0); // size of data part (sum of all parts below) + avio_wb24(pb, 0); // time stamp + avio_wb32(pb, 0); // reserved /* now data of data_size size */ /* first event name as a string */ - put_byte(pb, AMF_DATA_TYPE_STRING); + avio_w8(pb, AMF_DATA_TYPE_STRING); put_amf_string(pb, "onMetaData"); // 12 bytes /* mixed array (hash) with size and string/type/data tuples */ - put_byte(pb, AMF_DATA_TYPE_MIXEDARRAY); - put_be32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size + avio_w8(pb, AMF_DATA_TYPE_MIXEDARRAY); + avio_wb32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size put_amf_string(pb, "duration"); flv->duration_offset= url_ftell(pb); @@ -276,7 +276,7 @@ static int flv_write_header(AVFormatContext *s) while ((tag = av_metadata_get(s->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) { put_amf_string(pb, tag->key); - put_byte(pb, AMF_DATA_TYPE_STRING); + avio_w8(pb, AMF_DATA_TYPE_STRING); put_amf_string(pb, tag->value); } @@ -285,41 +285,41 @@ static int flv_write_header(AVFormatContext *s) put_amf_double(pb, 0); // delayed write put_amf_string(pb, ""); - put_byte(pb, AMF_END_OF_OBJECT); + avio_w8(pb, AMF_END_OF_OBJECT); /* write total size of tag */ data_size= url_ftell(pb) - metadata_size_pos - 10; - url_fseek(pb, metadata_size_pos, SEEK_SET); - put_be24(pb, data_size); - url_fseek(pb, data_size + 10 - 3, SEEK_CUR); - put_be32(pb, data_size + 11); + avio_seek(pb, metadata_size_pos, SEEK_SET); + avio_wb24(pb, data_size); + avio_seek(pb, data_size + 10 - 3, SEEK_CUR); + avio_wb32(pb, data_size + 11); for (i = 0; i < s->nb_streams; i++) { AVCodecContext *enc = s->streams[i]->codec; if (enc->codec_id == CODEC_ID_AAC || enc->codec_id == CODEC_ID_H264) { int64_t pos; - put_byte(pb, enc->codec_type == AVMEDIA_TYPE_VIDEO ? + avio_w8(pb, enc->codec_type == AVMEDIA_TYPE_VIDEO ? FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO); - put_be24(pb, 0); // size patched later - put_be24(pb, 0); // ts - put_byte(pb, 0); // ts ext - put_be24(pb, 0); // streamid + avio_wb24(pb, 0); // size patched later + avio_wb24(pb, 0); // ts + avio_w8(pb, 0); // ts ext + avio_wb24(pb, 0); // streamid pos = url_ftell(pb); if (enc->codec_id == CODEC_ID_AAC) { - put_byte(pb, get_audio_flags(enc)); - put_byte(pb, 0); // AAC sequence header - put_buffer(pb, enc->extradata, enc->extradata_size); + avio_w8(pb, get_audio_flags(enc)); + avio_w8(pb, 0); // AAC sequence header + avio_write(pb, enc->extradata, enc->extradata_size); } else { - put_byte(pb, enc->codec_tag | FLV_FRAME_KEY); // flags - put_byte(pb, 0); // AVC sequence header - put_be24(pb, 0); // composition time + avio_w8(pb, enc->codec_tag | FLV_FRAME_KEY); // flags + avio_w8(pb, 0); // AVC sequence header + avio_wb24(pb, 0); // composition time ff_isom_write_avcc(pb, enc->extradata, enc->extradata_size); } data_size = url_ftell(pb) - pos; - url_fseek(pb, -data_size - 10, SEEK_CUR); - put_be24(pb, data_size); - url_fseek(pb, data_size + 10 - 3, SEEK_CUR); - put_be32(pb, data_size + 11); // previous tag size + avio_seek(pb, -data_size - 10, SEEK_CUR); + avio_wb24(pb, data_size); + avio_seek(pb, data_size + 10 - 3, SEEK_CUR); + avio_wb32(pb, data_size + 11); // previous tag size } } @@ -330,7 +330,7 @@ static int flv_write_trailer(AVFormatContext *s) { int64_t file_size; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; FLVContext *flv = s->priv_data; int i; @@ -346,18 +346,18 @@ static int flv_write_trailer(AVFormatContext *s) file_size = url_ftell(pb); /* update informations */ - url_fseek(pb, flv->duration_offset, SEEK_SET); + avio_seek(pb, flv->duration_offset, SEEK_SET); put_amf_double(pb, flv->duration / (double)1000); - url_fseek(pb, flv->filesize_offset, SEEK_SET); + avio_seek(pb, flv->filesize_offset, SEEK_SET); put_amf_double(pb, file_size); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); return 0; } static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[pkt->stream_index]->codec; FLVContext *flv = s->priv_data; unsigned ts; @@ -376,7 +376,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) flags_size= 1; if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { - put_byte(pb, FLV_TAG_TYPE_VIDEO); + avio_w8(pb, FLV_TAG_TYPE_VIDEO); flags = enc->codec_tag; if(flags == 0) { @@ -391,7 +391,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) assert(size); - put_byte(pb, FLV_TAG_TYPE_AUDIO); + avio_w8(pb, FLV_TAG_TYPE_AUDIO); } if (enc->codec_id == CODEC_ID_H264) { @@ -409,25 +409,25 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) if (flv->last_video_ts < ts) flv->last_video_ts = ts; } - put_be24(pb,size + flags_size); - put_be24(pb,ts); - put_byte(pb,(ts >> 24) & 0x7F); // timestamps are 32bits _signed_ - put_be24(pb,flv->reserved); - put_byte(pb,flags); + avio_wb24(pb,size + flags_size); + avio_wb24(pb,ts); + avio_w8(pb,(ts >> 24) & 0x7F); // timestamps are 32bits _signed_ + avio_wb24(pb,flv->reserved); + avio_w8(pb,flags); if (enc->codec_id == CODEC_ID_VP6) - put_byte(pb,0); + avio_w8(pb,0); if (enc->codec_id == CODEC_ID_VP6F) - put_byte(pb, enc->extradata_size ? enc->extradata[0] : 0); + avio_w8(pb, enc->extradata_size ? enc->extradata[0] : 0); else if (enc->codec_id == CODEC_ID_AAC) - put_byte(pb,1); // AAC raw + avio_w8(pb,1); // AAC raw else if (enc->codec_id == CODEC_ID_H264) { - put_byte(pb,1); // AVC NALU - put_be24(pb,pkt->pts - pkt->dts); + avio_w8(pb,1); // AVC NALU + avio_wb24(pb,pkt->pts - pkt->dts); } - put_buffer(pb, data ? data : pkt->data, size); + avio_write(pb, data ? data : pkt->data, size); - put_be32(pb,size+flags_size+11); // previous tag size + avio_wb32(pb,size+flags_size+11); // previous tag size flv->duration = FFMAX(flv->duration, pkt->pts + flv->delay + pkt->duration); put_flush_packet(pb); diff --git a/mplayer/ffmpeg/libavformat/framecrcenc.c b/mplayer/ffmpeg/libavformat/framecrcenc.c index f456ec68..26ede954 100644 --- a/mplayer/ffmpeg/libavformat/framecrcenc.c +++ b/mplayer/ffmpeg/libavformat/framecrcenc.c @@ -28,7 +28,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt) char buf[256]; snprintf(buf, sizeof(buf), "%d, %"PRId64", %d, 0x%08x\n", pkt->stream_index, pkt->dts, pkt->size, crc); - put_buffer(s->pb, buf, strlen(buf)); + avio_write(s->pb, buf, strlen(buf)); put_flush_packet(s->pb); return 0; } diff --git a/mplayer/ffmpeg/libavformat/gif.c b/mplayer/ffmpeg/libavformat/gif.c index 2388f9ba..17effaaa 100644 --- a/mplayer/ffmpeg/libavformat/gif.c +++ b/mplayer/ffmpeg/libavformat/gif.c @@ -107,33 +107,33 @@ static const rgb_triplet gif_clut[216] = { }; /* GIF header */ -static int gif_image_write_header(ByteIOContext *pb, +static int gif_image_write_header(AVIOContext *pb, int width, int height, int loop_count, uint32_t *palette) { int i; unsigned int v; - put_tag(pb, "GIF"); - put_tag(pb, "89a"); - put_le16(pb, width); - put_le16(pb, height); + avio_write(pb, "GIF", 3); + avio_write(pb, "89a", 3); + avio_wl16(pb, width); + avio_wl16(pb, height); - put_byte(pb, 0xf7); /* flags: global clut, 256 entries */ - put_byte(pb, 0x1f); /* background color index */ - put_byte(pb, 0); /* aspect ratio */ + avio_w8(pb, 0xf7); /* flags: global clut, 256 entries */ + avio_w8(pb, 0x1f); /* background color index */ + avio_w8(pb, 0); /* aspect ratio */ /* the global palette */ if (!palette) { - put_buffer(pb, (const unsigned char *)gif_clut, 216*3); + avio_write(pb, (const unsigned char *)gif_clut, 216*3); for(i=0;i<((256-216)*3);i++) - put_byte(pb, 0); + avio_w8(pb, 0); } else { for(i=0;i<256;i++) { v = palette[i]; - put_byte(pb, (v >> 16) & 0xff); - put_byte(pb, (v >> 8) & 0xff); - put_byte(pb, (v) & 0xff); + avio_w8(pb, (v >> 16) & 0xff); + avio_w8(pb, (v >> 8) & 0xff); + avio_w8(pb, (v) & 0xff); } } @@ -159,14 +159,14 @@ static int gif_image_write_header(ByteIOContext *pb, /* application extension header */ #ifdef GIF_ADD_APP_HEADER if (loop_count >= 0 && loop_count <= 65535) { - put_byte(pb, 0x21); - put_byte(pb, 0xff); - put_byte(pb, 0x0b); - put_tag(pb, "NETSCAPE2.0"); // bytes 4 to 14 - put_byte(pb, 0x03); // byte 15 - put_byte(pb, 0x01); // byte 16 - put_le16(pb, (uint16_t)loop_count); - put_byte(pb, 0x00); // byte 19 + avio_w8(pb, 0x21); + avio_w8(pb, 0xff); + avio_w8(pb, 0x0b); + avio_write(pb, "NETSCAPE2.0", sizeof("NETSCAPE2.0") - 1); // bytes 4 to 14 + avio_w8(pb, 0x03); // byte 15 + avio_w8(pb, 0x01); // byte 16 + avio_wl16(pb, (uint16_t)loop_count); + avio_w8(pb, 0x00); // byte 19 } #endif return 0; @@ -179,7 +179,7 @@ static inline unsigned char gif_clut_index(uint8_t r, uint8_t g, uint8_t b) } -static int gif_image_write_image(ByteIOContext *pb, +static int gif_image_write_image(AVIOContext *pb, int x1, int y1, int width, int height, const uint8_t *buf, int linesize, int pix_fmt) { @@ -189,15 +189,15 @@ static int gif_image_write_image(ByteIOContext *pb, const uint8_t *ptr; /* image block */ - put_byte(pb, 0x2c); - put_le16(pb, x1); - put_le16(pb, y1); - put_le16(pb, width); - put_le16(pb, height); - put_byte(pb, 0x00); /* flags */ + avio_w8(pb, 0x2c); + avio_wl16(pb, x1); + avio_wl16(pb, y1); + avio_wl16(pb, width); + avio_wl16(pb, height); + avio_w8(pb, 0x00); /* flags */ /* no local clut */ - put_byte(pb, 0x08); + avio_w8(pb, 0x08); left= width * height; @@ -233,13 +233,13 @@ static int gif_image_write_image(ByteIOContext *pb, flush_put_bits(&p); } if(put_bits_ptr(&p) - p.buf > 0) { - put_byte(pb, put_bits_ptr(&p) - p.buf); /* byte count of the packet */ - put_buffer(pb, p.buf, put_bits_ptr(&p) - p.buf); /* the actual buffer */ + avio_w8(pb, put_bits_ptr(&p) - p.buf); /* byte count of the packet */ + avio_write(pb, p.buf, put_bits_ptr(&p) - p.buf); /* the actual buffer */ p.buf_ptr = p.buf; /* dequeue the bytes off the bitstream */ } left-=GIF_CHUNKS; } - put_byte(pb, 0x00); /* end of image block */ + avio_w8(pb, 0x00); /* end of image block */ return 0; } @@ -252,7 +252,7 @@ typedef struct { static int gif_write_header(AVFormatContext *s) { GIFContext *gif = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc, *video_enc; int i, width, height, loop_count /*, rate*/; @@ -294,16 +294,16 @@ static int gif_write_header(AVFormatContext *s) static int gif_write_video(AVFormatContext *s, AVCodecContext *enc, const uint8_t *buf, int size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; GIFContext *gif = s->priv_data; int jiffies; int64_t delay; /* graphic control extension block */ - put_byte(pb, 0x21); - put_byte(pb, 0xf9); - put_byte(pb, 0x04); /* block size */ - put_byte(pb, 0x04); /* flags */ + avio_w8(pb, 0x21); + avio_w8(pb, 0xf9); + avio_w8(pb, 0x04); /* block size */ + avio_w8(pb, 0x04); /* flags */ /* 1 jiffy is 1/70 s */ /* the delay_time field indicates the number of jiffies - 1 */ @@ -314,10 +314,10 @@ static int gif_write_video(AVFormatContext *s, /* XXX: don't even remember if I really use it for now */ jiffies = (70*enc->time_base.num/enc->time_base.den) - 1; - put_le16(pb, jiffies); + avio_wl16(pb, jiffies); - put_byte(pb, 0x1f); /* transparent color index */ - put_byte(pb, 0x00); + avio_w8(pb, 0x1f); /* transparent color index */ + avio_w8(pb, 0x00); gif_image_write_image(pb, 0, 0, enc->width, enc->height, buf, enc->width * 3, PIX_FMT_RGB24); @@ -337,9 +337,9 @@ static int gif_write_packet(AVFormatContext *s, AVPacket *pkt) static int gif_write_trailer(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; - put_byte(pb, 0x3b); + avio_w8(pb, 0x3b); put_flush_packet(s->pb); return 0; } diff --git a/mplayer/ffmpeg/libavformat/gxf.c b/mplayer/ffmpeg/libavformat/gxf.c index 1e08d826..e2625f9d 100644 --- a/mplayer/ffmpeg/libavformat/gxf.c +++ b/mplayer/ffmpeg/libavformat/gxf.c @@ -33,26 +33,26 @@ struct gxf_stream_info { /** * \brief parses a packet header, extracting type and length - * \param pb ByteIOContext to read header from + * \param pb AVIOContext to read header from * \param type detected packet type is stored here * \param length detected packet length, excluding header is stored here * \return 0 if header not found or contains invalid data, 1 otherwise */ -static int parse_packet_header(ByteIOContext *pb, GXFPktType *type, int *length) { - if (get_be32(pb)) +static int parse_packet_header(AVIOContext *pb, GXFPktType *type, int *length) { + if (avio_rb32(pb)) return 0; - if (get_byte(pb) != 1) + if (avio_r8(pb) != 1) return 0; - *type = get_byte(pb); - *length = get_be32(pb); + *type = avio_r8(pb); + *length = avio_rb32(pb); if ((*length >> 24) || *length < 16) return 0; *length -= 16; - if (get_be32(pb)) + if (avio_rb32(pb)) return 0; - if (get_byte(pb) != 0xe1) + if (avio_r8(pb) != 0xe1) return 0; - if (get_byte(pb) != 0xe2) + if (avio_r8(pb) != 0xe2) return 0; return 1; } @@ -157,24 +157,24 @@ static int get_sindex(AVFormatContext *s, int id, int format) { * \param len length of tag section, will be adjusted to contain remaining bytes * \param si struct to store collected information into */ -static void gxf_material_tags(ByteIOContext *pb, int *len, struct gxf_stream_info *si) { +static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si) { si->first_field = AV_NOPTS_VALUE; si->last_field = AV_NOPTS_VALUE; while (*len >= 2) { - GXFMatTag tag = get_byte(pb); - int tlen = get_byte(pb); + GXFMatTag tag = avio_r8(pb); + int tlen = avio_r8(pb); *len -= 2; if (tlen > *len) return; *len -= tlen; if (tlen == 4) { - uint32_t value = get_be32(pb); + uint32_t value = avio_rb32(pb); if (tag == MAT_FIRST_FIELD) si->first_field = value; else if (tag == MAT_LAST_FIELD) si->last_field = value; } else - url_fskip(pb, tlen); + avio_seek(pb, tlen, SEEK_CUR); } } @@ -206,24 +206,24 @@ static AVRational fps_umf2avr(uint32_t flags) { * \param len length of tag section, will be adjusted to contain remaining bytes * \param si struct to store collected information into */ -static void gxf_track_tags(ByteIOContext *pb, int *len, struct gxf_stream_info *si) { +static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si) { si->frames_per_second = (AVRational){0, 0}; si->fields_per_frame = 0; while (*len >= 2) { - GXFTrackTag tag = get_byte(pb); - int tlen = get_byte(pb); + GXFTrackTag tag = avio_r8(pb); + int tlen = avio_r8(pb); *len -= 2; if (tlen > *len) return; *len -= tlen; if (tlen == 4) { - uint32_t value = get_be32(pb); + uint32_t value = avio_rb32(pb); if (tag == TRACK_FPS) si->frames_per_second = fps_tag2avr(value); else if (tag == TRACK_FPF && (value == 1 || value == 2)) si->fields_per_frame = value; } else - url_fskip(pb, tlen); + avio_seek(pb, tlen, SEEK_CUR); } } @@ -231,14 +231,14 @@ static void gxf_track_tags(ByteIOContext *pb, int *len, struct gxf_stream_info * * \brief read index from FLT packet into stream 0 av_index */ static void gxf_read_index(AVFormatContext *s, int pkt_len) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; - uint32_t fields_per_map = get_le32(pb); - uint32_t map_cnt = get_le32(pb); + uint32_t fields_per_map = avio_rl32(pb); + uint32_t map_cnt = avio_rl32(pb); int i; pkt_len -= 8; if (s->flags & AVFMT_FLAG_IGNIDX) { - url_fskip(pb, pkt_len); + avio_seek(pb, pkt_len, SEEK_CUR); return; } if (map_cnt > 1000) { @@ -247,19 +247,19 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { } if (pkt_len < 4 * map_cnt) { av_log(s, AV_LOG_ERROR, "invalid index length\n"); - url_fskip(pb, pkt_len); + avio_seek(pb, pkt_len, SEEK_CUR); return; } pkt_len -= 4 * map_cnt; av_add_index_entry(st, 0, 0, 0, 0, 0); for (i = 0; i < map_cnt; i++) - av_add_index_entry(st, (uint64_t)get_le32(pb) * 1024, + av_add_index_entry(st, (uint64_t)avio_rl32(pb) * 1024, i * (uint64_t)fields_per_map + 1, 0, 0, 0); - url_fskip(pb, pkt_len); + avio_seek(pb, pkt_len, SEEK_CUR); } static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; GXFPktType pkt_type; int map_len; int len; @@ -271,21 +271,21 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { return 0; } map_len -= 2; - if (get_byte(pb) != 0x0e0 || get_byte(pb) != 0xff) { + if (avio_r8(pb) != 0x0e0 || avio_r8(pb) != 0xff) { av_log(s, AV_LOG_ERROR, "unknown version or invalid map preamble\n"); return 0; } map_len -= 2; - len = get_be16(pb); // length of material data section + len = avio_rb16(pb); // length of material data section if (len > map_len) { av_log(s, AV_LOG_ERROR, "material data longer than map data\n"); return 0; } map_len -= len; gxf_material_tags(pb, &len, &si); - url_fskip(pb, len); + avio_seek(pb, len, SEEK_CUR); map_len -= 2; - len = get_be16(pb); // length of track description + len = avio_rb16(pb); // length of track description if (len > map_len) { av_log(s, AV_LOG_ERROR, "track description longer than map data\n"); return 0; @@ -296,12 +296,12 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *st; int idx; len -= 4; - track_type = get_byte(pb); - track_id = get_byte(pb); - track_len = get_be16(pb); + track_type = avio_r8(pb); + track_id = avio_r8(pb); + track_len = avio_rb16(pb); len -= track_len; gxf_track_tags(pb, &track_len, &si); - url_fskip(pb, track_len); + avio_seek(pb, track_len, SEEK_CUR); if (!(track_type & 0x80)) { av_log(s, AV_LOG_ERROR, "invalid track type %x\n", track_type); continue; @@ -326,7 +326,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { if (len < 0) av_log(s, AV_LOG_ERROR, "invalid track description length specified\n"); if (map_len) - url_fskip(pb, map_len); + avio_seek(pb, map_len, SEEK_CUR); if (!parse_packet_header(pb, &pkt_type, &len)) { av_log(s, AV_LOG_ERROR, "sync lost in header\n"); return -1; @@ -342,9 +342,9 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { if (len >= 0x39) { AVRational fps; len -= 0x39; - url_fskip(pb, 5); // preamble - url_fskip(pb, 0x30); // payload description - fps = fps_umf2avr(get_le32(pb)); + avio_seek(pb, 5, SEEK_CUR); // preamble + avio_seek(pb, 0x30, SEEK_CUR); // payload description + fps = fps_umf2avr(avio_rl32(pb)); if (!main_timebase.num || !main_timebase.den) { // this may not always be correct, but simply the best we can get main_timebase.num = fps.den; @@ -354,7 +354,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { av_log(s, AV_LOG_INFO, "UMF packet too short\n"); } else av_log(s, AV_LOG_INFO, "UMF packet missing\n"); - url_fskip(pb, len); + avio_seek(pb, len, SEEK_CUR); // set a fallback value, 60000/1001 is specified for audio-only files // so use that regardless of why we do not know the video frame rate. if (!main_timebase.num || !main_timebase.den) @@ -370,7 +370,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { { \ if (!max_interval-- || url_feof(pb)) \ goto out; \ - tmp = tmp << 8 | get_byte(pb); \ + tmp = tmp << 8 | avio_r8(pb); \ } /** @@ -387,9 +387,9 @@ static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int t int cur_track; int64_t cur_timestamp = AV_NOPTS_VALUE; int len; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; GXFPktType type; - tmp = get_be32(pb); + tmp = avio_rb32(pb); start: while (tmp) READ_ONE(); @@ -397,29 +397,29 @@ static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int t if (tmp != 1) goto start; last_pos = url_ftell(pb); - if (url_fseek(pb, -5, SEEK_CUR) < 0) + if (avio_seek(pb, -5, SEEK_CUR) < 0) goto out; if (!parse_packet_header(pb, &type, &len) || type != PKT_MEDIA) { - if (url_fseek(pb, last_pos, SEEK_SET) < 0) + if (avio_seek(pb, last_pos, SEEK_SET) < 0) goto out; goto start; } - get_byte(pb); - cur_track = get_byte(pb); - cur_timestamp = get_be32(pb); + avio_r8(pb); + cur_track = avio_r8(pb); + cur_timestamp = avio_rb32(pb); last_found_pos = url_ftell(pb) - 16 - 6; if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) { - if (url_fseek(pb, last_pos, SEEK_SET) >= 0) + if (avio_seek(pb, last_pos, SEEK_SET) >= 0) goto start; } out: if (last_found_pos) - url_fseek(pb, last_found_pos, SEEK_SET); + avio_seek(pb, last_found_pos, SEEK_SET); return cur_timestamp; } static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; GXFPktType pkt_type; int pkt_len; while (!url_feof(pb)) { @@ -437,7 +437,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { continue; } if (pkt_type != PKT_MEDIA) { - url_fskip(pb, pkt_len); + avio_seek(pb, pkt_len, SEEK_CUR); continue; } if (pkt_len < 16) { @@ -445,24 +445,24 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { continue; } pkt_len -= 16; - track_type = get_byte(pb); - track_id = get_byte(pb); + track_type = avio_r8(pb); + track_id = avio_r8(pb); stream_index = get_sindex(s, track_id, track_type); if (stream_index < 0) return stream_index; st = s->streams[stream_index]; - field_nr = get_be32(pb); - field_info = get_be32(pb); - get_be32(pb); // "timeline" field number - get_byte(pb); // flags - get_byte(pb); // reserved + field_nr = avio_rb32(pb); + field_info = avio_rb32(pb); + avio_rb32(pb); // "timeline" field number + avio_r8(pb); // flags + avio_r8(pb); // reserved if (st->codec->codec_id == CODEC_ID_PCM_S24LE || st->codec->codec_id == CODEC_ID_PCM_S16LE) { int first = field_info >> 16; int last = field_info & 0xffff; // last is exclusive int bps = av_get_bits_per_sample(st->codec->codec_id)>>3; if (first <= last && last*bps <= pkt_len) { - url_fskip(pb, first*bps); + avio_seek(pb, first*bps, SEEK_CUR); skip = pkt_len - last*bps; pkt_len = (last-first)*bps; } else @@ -470,7 +470,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { } ret = av_get_packet(pb, pkt, pkt_len); if (skip) - url_fskip(pb, skip); + avio_seek(pb, skip, SEEK_CUR); pkt->stream_index = stream_index; pkt->dts = field_nr; return ret; @@ -495,7 +495,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int if (idx < st->nb_index_entries - 2) maxlen = st->index_entries[idx + 2].pos - pos; maxlen = FFMAX(maxlen, 200 * 1024); - res = url_fseek(s->pb, pos, SEEK_SET); + res = avio_seek(s->pb, pos, SEEK_SET); if (res < 0) return res; found = gxf_resync_media(s, maxlen, -1, timestamp); @@ -506,9 +506,9 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos, int64_t pos_limit) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t res; - if (url_fseek(pb, *pos, SEEK_SET) < 0) + if (avio_seek(pb, *pos, SEEK_SET) < 0) return AV_NOPTS_VALUE; res = gxf_resync_media(s, pos_limit - *pos, -1, -1); *pos = url_ftell(pb); diff --git a/mplayer/ffmpeg/libavformat/gxfenc.c b/mplayer/ffmpeg/libavformat/gxfenc.c index 94976a36..66accb3e 100644 --- a/mplayer/ffmpeg/libavformat/gxfenc.c +++ b/mplayer/ffmpeg/libavformat/gxfenc.c @@ -113,14 +113,14 @@ static int gxf_find_lines_index(AVStream *st) return -1; } -static void gxf_write_padding(ByteIOContext *pb, int64_t to_pad) +static void gxf_write_padding(AVIOContext *pb, int64_t to_pad) { for (; to_pad > 0; to_pad--) { - put_byte(pb, 0); + avio_w8(pb, 0); } } -static int64_t updatePacketSize(ByteIOContext *pb, int64_t pos) +static int64_t updatePacketSize(AVIOContext *pb, int64_t pos) { int64_t curpos; int size; @@ -131,35 +131,35 @@ static int64_t updatePacketSize(ByteIOContext *pb, int64_t pos) size = url_ftell(pb) - pos; } curpos = url_ftell(pb); - url_fseek(pb, pos + 6, SEEK_SET); - put_be32(pb, size); - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, pos + 6, SEEK_SET); + avio_wb32(pb, size); + avio_seek(pb, curpos, SEEK_SET); return curpos - pos; } -static int64_t updateSize(ByteIOContext *pb, int64_t pos) +static int64_t updateSize(AVIOContext *pb, int64_t pos) { int64_t curpos; curpos = url_ftell(pb); - url_fseek(pb, pos, SEEK_SET); - put_be16(pb, curpos - pos - 2); - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); + avio_wb16(pb, curpos - pos - 2); + avio_seek(pb, curpos, SEEK_SET); return curpos - pos; } -static void gxf_write_packet_header(ByteIOContext *pb, GXFPktType type) +static void gxf_write_packet_header(AVIOContext *pb, GXFPktType type) { - put_be32(pb, 0); /* packet leader for synchro */ - put_byte(pb, 1); - put_byte(pb, type); /* map packet */ - put_be32(pb, 0); /* size */ - put_be32(pb, 0); /* reserved */ - put_byte(pb, 0xE1); /* trailer 1 */ - put_byte(pb, 0xE2); /* trailer 2 */ + avio_wb32(pb, 0); /* packet leader for synchro */ + avio_w8(pb, 1); + avio_w8(pb, type); /* map packet */ + avio_wb32(pb, 0); /* size */ + avio_wb32(pb, 0); /* reserved */ + avio_w8(pb, 0xE1); /* trailer 1 */ + avio_w8(pb, 0xE2); /* trailer 2 */ } -static int gxf_write_mpeg_auxiliary(ByteIOContext *pb, AVStream *st) +static int gxf_write_mpeg_auxiliary(AVIOContext *pb, AVStream *st) { GXFStreamContext *sc = st->priv_data; char buffer[1024]; @@ -191,75 +191,75 @@ static int gxf_write_mpeg_auxiliary(ByteIOContext *pb, AVStream *st) (float)st->codec->bit_rate, sc->p_per_gop, sc->b_per_i_or_p, st->codec->pix_fmt == PIX_FMT_YUV422P ? 2 : 1, sc->first_gop_closed == 1, starting_line, (st->codec->height + 15) / 16); - put_byte(pb, TRACK_MPG_AUX); - put_byte(pb, size + 1); - put_buffer(pb, (uint8_t *)buffer, size + 1); + avio_w8(pb, TRACK_MPG_AUX); + avio_w8(pb, size + 1); + avio_write(pb, (uint8_t *)buffer, size + 1); return size + 3; } -static int gxf_write_timecode_auxiliary(ByteIOContext *pb, GXFStreamContext *sc) +static int gxf_write_timecode_auxiliary(AVIOContext *pb, GXFStreamContext *sc) { - put_byte(pb, 0); /* fields */ - put_byte(pb, 0); /* seconds */ - put_byte(pb, 0); /* minutes */ - put_byte(pb, 0); /* flags + hours */ + avio_w8(pb, 0); /* fields */ + avio_w8(pb, 0); /* seconds */ + avio_w8(pb, 0); /* minutes */ + avio_w8(pb, 0); /* flags + hours */ /* reserved */ - put_be32(pb, 0); + avio_wb32(pb, 0); return 8; } static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, int index) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos; int mpeg = sc->track_type == 4 || sc->track_type == 9; /* track description section */ - put_byte(pb, sc->media_type + 0x80); - put_byte(pb, index + 0xC0); + avio_w8(pb, sc->media_type + 0x80); + avio_w8(pb, index + 0xC0); pos = url_ftell(pb); - put_be16(pb, 0); /* size */ + avio_wb16(pb, 0); /* size */ /* media file name */ - put_byte(pb, TRACK_NAME); - put_byte(pb, strlen(ES_NAME_PATTERN) + 3); - put_tag(pb, ES_NAME_PATTERN); - put_be16(pb, sc->media_info); - put_byte(pb, 0); + avio_w8(pb, TRACK_NAME); + avio_w8(pb, strlen(ES_NAME_PATTERN) + 3); + avio_write(pb, ES_NAME_PATTERN, sizeof(ES_NAME_PATTERN) - 1); + avio_wb16(pb, sc->media_info); + avio_w8(pb, 0); if (!mpeg) { /* auxiliary information */ - put_byte(pb, TRACK_AUX); - put_byte(pb, 8); + avio_w8(pb, TRACK_AUX); + avio_w8(pb, 8); if (sc->track_type == 3) gxf_write_timecode_auxiliary(pb, sc); else - put_le64(pb, 0); + avio_wl64(pb, 0); } /* file system version */ - put_byte(pb, TRACK_VER); - put_byte(pb, 4); - put_be32(pb, 0); + avio_w8(pb, TRACK_VER); + avio_w8(pb, 4); + avio_wb32(pb, 0); if (mpeg) gxf_write_mpeg_auxiliary(pb, s->streams[index]); /* frame rate */ - put_byte(pb, TRACK_FPS); - put_byte(pb, 4); - put_be32(pb, sc->frame_rate_index); + avio_w8(pb, TRACK_FPS); + avio_w8(pb, 4); + avio_wb32(pb, sc->frame_rate_index); /* lines per frame */ - put_byte(pb, TRACK_LINES); - put_byte(pb, 4); - put_be32(pb, sc->lines_index); + avio_w8(pb, TRACK_LINES); + avio_w8(pb, 4); + avio_wb32(pb, sc->lines_index); /* fields per frame */ - put_byte(pb, TRACK_FPF); - put_byte(pb, 4); - put_be32(pb, sc->fields); + avio_w8(pb, TRACK_FPF); + avio_w8(pb, 4); + avio_wb32(pb, sc->fields); return updateSize(pb, pos); } @@ -267,47 +267,50 @@ static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, static int gxf_write_material_data_section(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos; + int len; const char *filename = strrchr(s->filename, '/'); pos = url_ftell(pb); - put_be16(pb, 0); /* size */ + avio_wb16(pb, 0); /* size */ /* name */ if (filename) filename++; else filename = s->filename; - put_byte(pb, MAT_NAME); - put_byte(pb, strlen(SERVER_PATH) + strlen(filename) + 1); - put_tag(pb, SERVER_PATH); - put_tag(pb, filename); - put_byte(pb, 0); + len = strlen(filename); + + avio_w8(pb, MAT_NAME); + avio_w8(pb, strlen(SERVER_PATH) + len + 1); + avio_write(pb, SERVER_PATH, sizeof(SERVER_PATH) - 1); + avio_write(pb, filename, len); + avio_w8(pb, 0); /* first field */ - put_byte(pb, MAT_FIRST_FIELD); - put_byte(pb, 4); - put_be32(pb, 0); + avio_w8(pb, MAT_FIRST_FIELD); + avio_w8(pb, 4); + avio_wb32(pb, 0); /* last field */ - put_byte(pb, MAT_LAST_FIELD); - put_byte(pb, 4); - put_be32(pb, gxf->nb_fields); + avio_w8(pb, MAT_LAST_FIELD); + avio_w8(pb, 4); + avio_wb32(pb, gxf->nb_fields); /* reserved */ - put_byte(pb, MAT_MARK_IN); - put_byte(pb, 4); - put_be32(pb, 0); + avio_w8(pb, MAT_MARK_IN); + avio_w8(pb, 4); + avio_wb32(pb, 0); - put_byte(pb, MAT_MARK_OUT); - put_byte(pb, 4); - put_be32(pb, gxf->nb_fields); + avio_w8(pb, MAT_MARK_OUT); + avio_w8(pb, 4); + avio_wb32(pb, gxf->nb_fields); /* estimated size */ - put_byte(pb, MAT_SIZE); - put_byte(pb, 4); - put_be32(pb, url_fsize(pb) / 1024); + avio_w8(pb, MAT_SIZE); + avio_w8(pb, 4); + avio_wb32(pb, url_fsize(pb) / 1024); return updateSize(pb, pos); } @@ -315,12 +318,12 @@ static int gxf_write_material_data_section(AVFormatContext *s) static int gxf_write_track_description_section(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos; int i; pos = url_ftell(pb); - put_be16(pb, 0); /* size */ + avio_wb16(pb, 0); /* size */ for (i = 0; i < s->nb_streams; ++i) gxf_write_track_description(s, s->streams[i]->priv_data, i); @@ -332,7 +335,7 @@ static int gxf_write_track_description_section(AVFormatContext *s) static int gxf_write_map_packet(AVFormatContext *s, int rewrite) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos = url_ftell(pb); if (!rewrite) { @@ -350,8 +353,8 @@ static int gxf_write_map_packet(AVFormatContext *s, int rewrite) gxf_write_packet_header(pb, PKT_MAP); /* preamble */ - put_byte(pb, 0xE0); /* version */ - put_byte(pb, 0xFF); /* reserved */ + avio_w8(pb, 0xE0); /* version */ + avio_w8(pb, 0xFF); /* reserved */ gxf_write_material_data_section(s); gxf_write_track_description_section(s); @@ -362,7 +365,7 @@ static int gxf_write_map_packet(AVFormatContext *s, int rewrite) static int gxf_write_flt_packet(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos = url_ftell(pb); int fields_per_flt = (gxf->nb_fields+1) / 1000 + 1; int flt_entries = gxf->nb_fields / fields_per_flt; @@ -370,16 +373,16 @@ static int gxf_write_flt_packet(AVFormatContext *s) gxf_write_packet_header(pb, PKT_FLT); - put_le32(pb, fields_per_flt); /* number of fields */ - put_le32(pb, flt_entries); /* number of active flt entries */ + avio_wl32(pb, fields_per_flt); /* number of fields */ + avio_wl32(pb, flt_entries); /* number of active flt entries */ if (gxf->flt_entries) { for (i = 0; i < flt_entries; i++) - put_le32(pb, gxf->flt_entries[(i*fields_per_flt)>>1]); + avio_wl32(pb, gxf->flt_entries[(i*fields_per_flt)>>1]); } for (; i < 1000; i++) - put_le32(pb, 0); + avio_wl32(pb, 0); return updatePacketSize(pb, pos); } @@ -387,7 +390,7 @@ static int gxf_write_flt_packet(AVFormatContext *s) static int gxf_write_umf_material_description(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int timecode_base = gxf->time_base.den == 60000 ? 60 : 50; // XXX drop frame @@ -397,47 +400,47 @@ static int gxf_write_umf_material_description(AVFormatContext *s) gxf->nb_fields / timecode_base % 60 << 8 | // seconds gxf->nb_fields % timecode_base; // fields - put_le32(pb, gxf->flags); - put_le32(pb, gxf->nb_fields); /* length of the longest track */ - put_le32(pb, gxf->nb_fields); /* length of the shortest track */ - put_le32(pb, 0); /* mark in */ - put_le32(pb, gxf->nb_fields); /* mark out */ - put_le32(pb, 0); /* timecode mark in */ - put_le32(pb, timecode); /* timecode mark out */ - put_le64(pb, s->timestamp); /* modification time */ - put_le64(pb, s->timestamp); /* creation time */ - put_le16(pb, 0); /* reserved */ - put_le16(pb, 0); /* reserved */ - put_le16(pb, gxf->audio_tracks); - put_le16(pb, 1); /* timecode track count */ - put_le16(pb, 0); /* reserved */ - put_le16(pb, gxf->mpeg_tracks); + avio_wl32(pb, gxf->flags); + avio_wl32(pb, gxf->nb_fields); /* length of the longest track */ + avio_wl32(pb, gxf->nb_fields); /* length of the shortest track */ + avio_wl32(pb, 0); /* mark in */ + avio_wl32(pb, gxf->nb_fields); /* mark out */ + avio_wl32(pb, 0); /* timecode mark in */ + avio_wl32(pb, timecode); /* timecode mark out */ + avio_wl64(pb, s->timestamp); /* modification time */ + avio_wl64(pb, s->timestamp); /* creation time */ + avio_wl16(pb, 0); /* reserved */ + avio_wl16(pb, 0); /* reserved */ + avio_wl16(pb, gxf->audio_tracks); + avio_wl16(pb, 1); /* timecode track count */ + avio_wl16(pb, 0); /* reserved */ + avio_wl16(pb, gxf->mpeg_tracks); return 48; } static int gxf_write_umf_payload(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; - - put_le32(pb, gxf->umf_length); /* total length of the umf data */ - put_le32(pb, 3); /* version */ - put_le32(pb, s->nb_streams+1); - put_le32(pb, gxf->umf_track_offset); /* umf track section offset */ - put_le32(pb, gxf->umf_track_size); - put_le32(pb, s->nb_streams+1); - put_le32(pb, gxf->umf_media_offset); - put_le32(pb, gxf->umf_media_size); - put_le32(pb, gxf->umf_length); /* user data offset */ - put_le32(pb, 0); /* user data size */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ + AVIOContext *pb = s->pb; + + avio_wl32(pb, gxf->umf_length); /* total length of the umf data */ + avio_wl32(pb, 3); /* version */ + avio_wl32(pb, s->nb_streams+1); + avio_wl32(pb, gxf->umf_track_offset); /* umf track section offset */ + avio_wl32(pb, gxf->umf_track_size); + avio_wl32(pb, s->nb_streams+1); + avio_wl32(pb, gxf->umf_media_offset); + avio_wl32(pb, gxf->umf_media_size); + avio_wl32(pb, gxf->umf_length); /* user data offset */ + avio_wl32(pb, 0); /* user data size */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ return 48; } static int gxf_write_umf_track_description(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; GXFContext *gxf = s->priv_data; int64_t pos = url_ftell(pb); int i; @@ -445,80 +448,80 @@ static int gxf_write_umf_track_description(AVFormatContext *s) gxf->umf_track_offset = pos - gxf->umf_start_offset; for (i = 0; i < s->nb_streams; ++i) { GXFStreamContext *sc = s->streams[i]->priv_data; - put_le16(pb, sc->media_info); - put_le16(pb, 1); + avio_wl16(pb, sc->media_info); + avio_wl16(pb, 1); } - put_le16(pb, gxf->timecode_track.media_info); - put_le16(pb, 1); + avio_wl16(pb, gxf->timecode_track.media_info); + avio_wl16(pb, 1); return url_ftell(pb) - pos; } -static int gxf_write_umf_media_mpeg(ByteIOContext *pb, AVStream *st) +static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st) { GXFStreamContext *sc = st->priv_data; if (st->codec->pix_fmt == PIX_FMT_YUV422P) - put_le32(pb, 2); + avio_wl32(pb, 2); else - put_le32(pb, 1); /* default to 420 */ - put_le32(pb, sc->first_gop_closed == 1); /* closed = 1, open = 0, unknown = 255 */ - put_le32(pb, 3); /* top = 1, bottom = 2, frame = 3, unknown = 0 */ - put_le32(pb, 1); /* I picture per GOP */ - put_le32(pb, sc->p_per_gop); - put_le32(pb, sc->b_per_i_or_p); + avio_wl32(pb, 1); /* default to 420 */ + avio_wl32(pb, sc->first_gop_closed == 1); /* closed = 1, open = 0, unknown = 255 */ + avio_wl32(pb, 3); /* top = 1, bottom = 2, frame = 3, unknown = 0 */ + avio_wl32(pb, 1); /* I picture per GOP */ + avio_wl32(pb, sc->p_per_gop); + avio_wl32(pb, sc->b_per_i_or_p); if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO) - put_le32(pb, 2); + avio_wl32(pb, 2); else if (st->codec->codec_id == CODEC_ID_MPEG1VIDEO) - put_le32(pb, 1); + avio_wl32(pb, 1); else - put_le32(pb, 0); - put_le32(pb, 0); /* reserved */ + avio_wl32(pb, 0); + avio_wl32(pb, 0); /* reserved */ return 32; } -static int gxf_write_umf_media_timecode(ByteIOContext *pb, GXFStreamContext *sc) +static int gxf_write_umf_media_timecode(AVIOContext *pb, GXFStreamContext *sc) { - put_le32(pb, 1); /* non drop frame */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ + avio_wl32(pb, 1); /* non drop frame */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ return 32; } -static int gxf_write_umf_media_dv(ByteIOContext *pb, GXFStreamContext *sc) +static int gxf_write_umf_media_dv(AVIOContext *pb, GXFStreamContext *sc) { int i; for (i = 0; i < 8; i++) { - put_be32(pb, 0); + avio_wb32(pb, 0); } return 32; } -static int gxf_write_umf_media_audio(ByteIOContext *pb, GXFStreamContext *sc) +static int gxf_write_umf_media_audio(AVIOContext *pb, GXFStreamContext *sc) { - put_le64(pb, av_dbl2int(1)); /* sound level to begin to */ - put_le64(pb, av_dbl2int(1)); /* sound level to begin to */ - put_le32(pb, 0); /* number of fields over which to ramp up sound level */ - put_le32(pb, 0); /* number of fields over which to ramp down sound level */ - put_le32(pb, 0); /* reserved */ - put_le32(pb, 0); /* reserved */ + avio_wl64(pb, av_dbl2int(1)); /* sound level to begin to */ + avio_wl64(pb, av_dbl2int(1)); /* sound level to begin to */ + avio_wl32(pb, 0); /* number of fields over which to ramp up sound level */ + avio_wl32(pb, 0); /* number of fields over which to ramp down sound level */ + avio_wl32(pb, 0); /* reserved */ + avio_wl32(pb, 0); /* reserved */ return 32; } #if 0 -static int gxf_write_umf_media_mjpeg(ByteIOContext *pb, GXFStreamContext *sc) +static int gxf_write_umf_media_mjpeg(AVIOContext *pb, GXFStreamContext *sc) { - put_be64(pb, 0); /* FIXME FLOAT max chroma quant level */ - put_be64(pb, 0); /* FIXME FLOAT max luma quant level */ - put_be64(pb, 0); /* FIXME FLOAT min chroma quant level */ - put_be64(pb, 0); /* FIXME FLOAT min luma quant level */ + avio_wb64(pb, 0); /* FIXME FLOAT max chroma quant level */ + avio_wb64(pb, 0); /* FIXME FLOAT max luma quant level */ + avio_wb64(pb, 0); /* FIXME FLOAT min chroma quant level */ + avio_wb64(pb, 0); /* FIXME FLOAT min luma quant level */ return 32; } #endif @@ -526,7 +529,7 @@ static int gxf_write_umf_media_mjpeg(ByteIOContext *pb, GXFStreamContext *sc) static int gxf_write_umf_media_description(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos; int i, j; @@ -542,22 +545,22 @@ static int gxf_write_umf_media_description(AVFormatContext *s) sc = s->streams[i]->priv_data; startpos = url_ftell(pb); - put_le16(pb, 0); /* length */ - put_le16(pb, sc->media_info); - put_le16(pb, 0); /* reserved */ - put_le16(pb, 0); /* reserved */ - put_le32(pb, gxf->nb_fields); - put_le32(pb, 0); /* attributes rw, ro */ - put_le32(pb, 0); /* mark in */ - put_le32(pb, gxf->nb_fields); /* mark out */ - put_buffer(pb, ES_NAME_PATTERN, strlen(ES_NAME_PATTERN)); - put_be16(pb, sc->media_info); + avio_wl16(pb, 0); /* length */ + avio_wl16(pb, sc->media_info); + avio_wl16(pb, 0); /* reserved */ + avio_wl16(pb, 0); /* reserved */ + avio_wl32(pb, gxf->nb_fields); + avio_wl32(pb, 0); /* attributes rw, ro */ + avio_wl32(pb, 0); /* mark in */ + avio_wl32(pb, gxf->nb_fields); /* mark out */ + avio_write(pb, ES_NAME_PATTERN, strlen(ES_NAME_PATTERN)); + avio_wb16(pb, sc->media_info); for (j = strlen(ES_NAME_PATTERN)+2; j < 88; j++) - put_byte(pb, 0); - put_le32(pb, sc->track_type); - put_le32(pb, sc->sample_rate); - put_le32(pb, sc->sample_size); - put_le32(pb, 0); /* reserved */ + avio_w8(pb, 0); + avio_wl32(pb, sc->track_type); + avio_wl32(pb, sc->sample_rate); + avio_wl32(pb, sc->sample_size); + avio_wl32(pb, 0); /* reserved */ if (sc == &gxf->timecode_track) gxf_write_umf_media_timecode(pb, sc); /* 8 0bytes */ @@ -578,9 +581,9 @@ static int gxf_write_umf_media_description(AVFormatContext *s) } curpos = url_ftell(pb); - url_fseek(pb, startpos, SEEK_SET); - put_le16(pb, curpos - startpos); - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, startpos, SEEK_SET); + avio_wl16(pb, curpos - startpos); + avio_seek(pb, curpos, SEEK_SET); } return url_ftell(pb) - pos; } @@ -588,14 +591,14 @@ static int gxf_write_umf_media_description(AVFormatContext *s) static int gxf_write_umf_packet(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos = url_ftell(pb); gxf_write_packet_header(pb, PKT_UMF); /* preamble */ - put_byte(pb, 3); /* first and last (only) packet */ - put_be32(pb, gxf->umf_length); /* data length */ + avio_w8(pb, 3); /* first and last (only) packet */ + avio_wb32(pb, gxf->umf_length); /* data length */ gxf->umf_start_offset = url_ftell(pb); gxf_write_umf_payload(s); @@ -625,7 +628,7 @@ static void gxf_init_timecode_track(GXFStreamContext *sc, GXFStreamContext *vsc) static int gxf_write_header(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; GXFContext *gxf = s->priv_data; GXFStreamContext *vsc = NULL; uint8_t tracks[255] = {0}; @@ -754,7 +757,7 @@ static int gxf_write_header(AVFormatContext *s) return 0; } -static int gxf_write_eos_packet(ByteIOContext *pb) +static int gxf_write_eos_packet(AVIOContext *pb) { int64_t pos = url_ftell(pb); @@ -765,7 +768,7 @@ static int gxf_write_eos_packet(ByteIOContext *pb) static int gxf_write_trailer(AVFormatContext *s) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t end; int i; @@ -773,7 +776,7 @@ static int gxf_write_trailer(AVFormatContext *s) gxf_write_eos_packet(pb); end = url_ftell(pb); - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); /* overwrite map, flt and umf packets with new values */ gxf_write_map_packet(s, 1); gxf_write_flt_packet(s); @@ -781,12 +784,12 @@ static int gxf_write_trailer(AVFormatContext *s) put_flush_packet(pb); /* update duration in all map packets */ for (i = 1; i < gxf->map_offsets_nb; i++) { - url_fseek(pb, gxf->map_offsets[i], SEEK_SET); + avio_seek(pb, gxf->map_offsets[i], SEEK_SET); gxf_write_map_packet(s, 1); put_flush_packet(pb); } - url_fseek(pb, end, SEEK_SET); + avio_seek(pb, end, SEEK_SET); av_freep(&gxf->flt_entries); av_freep(&gxf->map_offsets); @@ -809,7 +812,7 @@ static int gxf_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int si static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[pkt->stream_index]; GXFStreamContext *sc = st->priv_data; unsigned field_nb; @@ -823,40 +826,40 @@ static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size) (int64_t)48000*gxf->time_base.num, AV_ROUND_UP); } - put_byte(pb, sc->media_type); - put_byte(pb, st->index); - put_be32(pb, field_nb); + avio_w8(pb, sc->media_type); + avio_w8(pb, st->index); + avio_wb32(pb, field_nb); if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { - put_be16(pb, 0); - put_be16(pb, size / 2); + avio_wb16(pb, 0); + avio_wb16(pb, size / 2); } else if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO) { int frame_type = gxf_parse_mpeg_frame(sc, pkt->data, pkt->size); if (frame_type == FF_I_TYPE) { - put_byte(pb, 0x0d); + avio_w8(pb, 0x0d); sc->iframes++; } else if (frame_type == FF_B_TYPE) { - put_byte(pb, 0x0f); + avio_w8(pb, 0x0f); sc->bframes++; } else { - put_byte(pb, 0x0e); + avio_w8(pb, 0x0e); sc->pframes++; } - put_be24(pb, size); + avio_wb24(pb, size); } else if (st->codec->codec_id == CODEC_ID_DVVIDEO) { - put_byte(pb, size / 4096); - put_be24(pb, 0); + avio_w8(pb, size / 4096); + avio_wb24(pb, 0); } else - put_be32(pb, size); - put_be32(pb, field_nb); - put_byte(pb, 1); /* flags */ - put_byte(pb, 0); /* reserved */ + avio_wb32(pb, size); + avio_wb32(pb, field_nb); + avio_w8(pb, 1); /* flags */ + avio_w8(pb, 0); /* reserved */ return 16; } static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt) { GXFContext *gxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[pkt->stream_index]; int64_t pos = url_ftell(pb); int padding = 0; @@ -868,7 +871,7 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt) else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) padding = GXF_AUDIO_PACKET_SIZE - pkt->size; gxf_write_media_preamble(s, pkt, pkt->size + padding); - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); gxf_write_padding(pb, padding); if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { diff --git a/mplayer/ffmpeg/libavformat/id3v1.c b/mplayer/ffmpeg/libavformat/id3v1.c index 481db973..e17e785a 100644 --- a/mplayer/ffmpeg/libavformat/id3v1.c +++ b/mplayer/ffmpeg/libavformat/id3v1.c @@ -232,12 +232,12 @@ void ff_id3v1_read(AVFormatContext *s) /* XXX: change that */ filesize = url_fsize(s->pb); if (filesize > 128) { - url_fseek(s->pb, filesize - 128, SEEK_SET); - ret = get_buffer(s->pb, buf, ID3v1_TAG_SIZE); + avio_seek(s->pb, filesize - 128, SEEK_SET); + ret = avio_read(s->pb, buf, ID3v1_TAG_SIZE); if (ret == ID3v1_TAG_SIZE) { parse_tag(s, buf); } - url_fseek(s->pb, 0, SEEK_SET); + avio_seek(s->pb, 0, SEEK_SET); } } } diff --git a/mplayer/ffmpeg/libavformat/id3v2.c b/mplayer/ffmpeg/libavformat/id3v2.c index 7cedf6e6..47bc706d 100644 --- a/mplayer/ffmpeg/libavformat/id3v2.c +++ b/mplayer/ffmpeg/libavformat/id3v2.c @@ -24,6 +24,7 @@ #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" #include "metadata.h" +#include "avio_internal.h" int ff_id3v2_match(const uint8_t *buf, const char * magic) { @@ -50,21 +51,21 @@ int ff_id3v2_tag_len(const uint8_t * buf) return len; } -static unsigned int get_size(ByteIOContext *s, int len) +static unsigned int get_size(AVIOContext *s, int len) { int v = 0; while (len--) - v = (v << 7) + (get_byte(s) & 0x7F); + v = (v << 7) + (avio_r8(s) & 0x7F); return v; } -static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const char *key) +static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const char *key) { char *q, dst[512]; const char *val = NULL; int len, dstlen = sizeof(dst) - 1; unsigned genre; - unsigned int (*get)(ByteIOContext*) = get_be16; + unsigned int (*get)(AVIOContext*) = avio_rb16; dst[0] = 0; if (taglen < 1) @@ -72,22 +73,22 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c taglen--; /* account for encoding type byte */ - switch (get_byte(pb)) { /* encoding type */ + switch (avio_r8(pb)) { /* encoding type */ case ID3v2_ENCODING_ISO8859: q = dst; while (taglen-- && q - dst < dstlen - 7) { uint8_t tmp; - PUT_UTF8(get_byte(pb), tmp, *q++ = tmp;) + PUT_UTF8(avio_r8(pb), tmp, *q++ = tmp;) } *q = 0; break; case ID3v2_ENCODING_UTF16BOM: taglen -= 2; - switch (get_be16(pb)) { + switch (avio_rb16(pb)) { case 0xfffe: - get = get_le16; + get = avio_rl16; case 0xfeff: break; default: @@ -110,7 +111,7 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c case ID3v2_ENCODING_UTF8: len = FFMIN(taglen, dstlen); - get_buffer(pb, dst, len); + avio_read(pb, dst, len); dst[len] = 0; break; default: @@ -142,7 +143,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t int64_t next; int taghdrlen; const char *reason; - ByteIOContext pb; + AVIOContext pb; unsigned char *buffer = NULL; int buffer_size = 0; @@ -170,25 +171,25 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t unsync = flags & 0x80; if (isv34 && flags & 0x40) /* Extended header present, just skip over it */ - url_fskip(s->pb, get_size(s->pb, 4)); + avio_seek(s->pb, get_size(s->pb, 4), SEEK_CUR); while (len >= taghdrlen) { unsigned int tflags; int tunsync = 0; if (isv34) { - get_buffer(s->pb, tag, 4); + avio_read(s->pb, tag, 4); tag[4] = 0; if(version==3){ - tlen = get_be32(s->pb); + tlen = avio_rb32(s->pb); }else tlen = get_size(s->pb, 4); - tflags = get_be16(s->pb); + tflags = avio_rb16(s->pb); tunsync = tflags & ID3v2_FLAG_UNSYNCH; } else { - get_buffer(s->pb, tag, 3); + avio_read(s->pb, tag, 3); tag[3] = 0; - tlen = get_be24(s->pb); + tlen = avio_rb24(s->pb); } len -= taghdrlen + tlen; @@ -198,25 +199,25 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t next = url_ftell(s->pb) + tlen; if (tflags & ID3v2_FLAG_DATALEN) { - get_be32(s->pb); + avio_rb32(s->pb); tlen -= 4; } if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) { av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag); - url_fskip(s->pb, tlen); + avio_seek(s->pb, tlen, SEEK_CUR); } else if (tag[0] == 'T') { if (unsync || tunsync) { int i, j; av_fast_malloc(&buffer, &buffer_size, tlen); for (i = 0, j = 0; i < tlen; i++, j++) { - buffer[j] = get_byte(s->pb); + buffer[j] = avio_r8(s->pb); if (j > 0 && !buffer[j] && buffer[j - 1] == 0xff) { /* Unsynchronised byte, skip it */ j--; } } - init_put_byte(&pb, buffer, j, 0, NULL, NULL, NULL, NULL); + ffio_init_context(&pb, buffer, j, 0, NULL, NULL, NULL, NULL); read_ttag(s, &pb, j, tag); } else { read_ttag(s, s->pb, tlen, tag); @@ -225,26 +226,26 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t else if (!tag[0]) { if (tag[1]) av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding"); - url_fskip(s->pb, tlen); + avio_seek(s->pb, tlen, SEEK_CUR); break; } /* Skip to end of tag */ - url_fseek(s->pb, next, SEEK_SET); + avio_seek(s->pb, next, SEEK_SET); } if (len > 0) { /* Skip padding */ - url_fskip(s->pb, len); + avio_seek(s->pb, len, SEEK_CUR); } if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */ - url_fskip(s->pb, 10); + avio_seek(s->pb, 10, SEEK_CUR); av_free(buffer); return; error: av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason); - url_fskip(s->pb, len); + avio_seek(s->pb, len, SEEK_CUR); av_free(buffer); } @@ -258,7 +259,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic) do { /* save the current offset in case there's nothing to read/skip */ off = url_ftell(s->pb); - ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE); + ret = avio_read(s->pb, buf, ID3v2_HEADER_SIZE); if (ret != ID3v2_HEADER_SIZE) break; found_header = ff_id3v2_match(buf, magic); @@ -270,7 +271,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic) (buf[9] & 0x7f); ff_id3v2_parse(s, len, buf[3], buf[5]); } else { - url_fseek(s->pb, off, SEEK_SET); + avio_seek(s->pb, off, SEEK_SET); } } while (found_header); ff_metadata_conv(&s->metadata, NULL, ff_id3v2_34_metadata_conv); diff --git a/mplayer/ffmpeg/libavformat/idcin.c b/mplayer/ffmpeg/libavformat/idcin.c index e40d725f..1aecf866 100644 --- a/mplayer/ffmpeg/libavformat/idcin.c +++ b/mplayer/ffmpeg/libavformat/idcin.c @@ -142,18 +142,18 @@ static int idcin_probe(AVProbeData *p) static int idcin_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; IdcinDemuxContext *idcin = s->priv_data; AVStream *st; unsigned int width, height; unsigned int sample_rate, bytes_per_sample, channels; /* get the 5 header parameters */ - width = get_le32(pb); - height = get_le32(pb); - sample_rate = get_le32(pb); - bytes_per_sample = get_le32(pb); - channels = get_le32(pb); + width = avio_rl32(pb); + height = avio_rl32(pb); + sample_rate = avio_rl32(pb); + bytes_per_sample = avio_rl32(pb); + channels = avio_rl32(pb); st = av_new_stream(s, 0); if (!st) @@ -169,7 +169,7 @@ static int idcin_read_header(AVFormatContext *s, /* load up the Huffman tables into extradata */ st->codec->extradata_size = HUFFMAN_TABLE_SIZE; st->codec->extradata = av_malloc(HUFFMAN_TABLE_SIZE); - if (get_buffer(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) != + if (avio_read(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) != HUFFMAN_TABLE_SIZE) return AVERROR(EIO); /* save a reference in order to transport the palette */ @@ -221,7 +221,7 @@ static int idcin_read_packet(AVFormatContext *s, unsigned int command; unsigned int chunk_size; IdcinDemuxContext *idcin = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i; int palette_scale; unsigned char r, g, b; @@ -231,13 +231,13 @@ static int idcin_read_packet(AVFormatContext *s, return AVERROR(EIO); if (idcin->next_chunk_is_video) { - command = get_le32(pb); + command = avio_rl32(pb); if (command == 2) { return AVERROR(EIO); } else if (command == 1) { /* trigger a palette change */ idcin->palctrl.palette_changed = 1; - if (get_buffer(pb, palette_buffer, 768) != 768) + if (avio_read(pb, palette_buffer, 768) != 768) return AVERROR(EIO); /* scale the palette as necessary */ palette_scale = 2; @@ -255,9 +255,9 @@ static int idcin_read_packet(AVFormatContext *s, } } - chunk_size = get_le32(pb); + chunk_size = avio_rl32(pb); /* skip the number of decoded bytes (always equal to width * height) */ - url_fseek(pb, 4, SEEK_CUR); + avio_seek(pb, 4, SEEK_CUR); chunk_size -= 4; ret= av_get_packet(pb, pkt, chunk_size); if (ret < 0) diff --git a/mplayer/ffmpeg/libavformat/idroqdec.c b/mplayer/ffmpeg/libavformat/idroqdec.c index 285a3e1e..71324d88 100644 --- a/mplayer/ffmpeg/libavformat/idroqdec.c +++ b/mplayer/ffmpeg/libavformat/idroqdec.c @@ -68,13 +68,13 @@ static int roq_read_header(AVFormatContext *s, AVFormatParameters *ap) { RoqDemuxContext *roq = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int framerate; AVStream *st; unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE]; /* get the main header */ - if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != + if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); framerate = AV_RL16(&preamble[6]); @@ -100,7 +100,7 @@ static int roq_read_packet(AVFormatContext *s, AVPacket *pkt) { RoqDemuxContext *roq = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret = 0; unsigned int chunk_size; unsigned int chunk_type; @@ -115,7 +115,7 @@ static int roq_read_packet(AVFormatContext *s, return AVERROR(EIO); /* get the next chunk preamble */ - if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) != + if ((ret = avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) != RoQ_CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); @@ -129,29 +129,29 @@ static int roq_read_packet(AVFormatContext *s, case RoQ_INFO: if (!roq->width || !roq->height) { AVStream *st = s->streams[roq->video_stream_index]; - if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) + if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); st->codec->width = roq->width = AV_RL16(preamble); st->codec->height = roq->height = AV_RL16(preamble + 2); break; } /* don't care about this chunk anymore */ - url_fseek(pb, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_CUR); + avio_seek(pb, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_CUR); break; case RoQ_QUAD_CODEBOOK: /* packet needs to contain both this codebook and next VQ chunk */ codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE; codebook_size = chunk_size; - url_fseek(pb, codebook_size, SEEK_CUR); - if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != + avio_seek(pb, codebook_size, SEEK_CUR); + if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); chunk_size = AV_RL32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 + codebook_size; /* rewind */ - url_fseek(pb, codebook_offset, SEEK_SET); + avio_seek(pb, codebook_offset, SEEK_SET); /* load up the packet */ ret= av_get_packet(pb, pkt, chunk_size); @@ -198,7 +198,7 @@ static int roq_read_packet(AVFormatContext *s, } pkt->pos= url_ftell(pb); - ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE, + ret = avio_read(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE, chunk_size); if (ret != chunk_size) ret = AVERROR(EIO); diff --git a/mplayer/ffmpeg/libavformat/idroqenc.c b/mplayer/ffmpeg/libavformat/idroqenc.c index 8859c98a..9935b61e 100644 --- a/mplayer/ffmpeg/libavformat/idroqenc.c +++ b/mplayer/ffmpeg/libavformat/idroqenc.c @@ -29,7 +29,7 @@ static int roq_write_header(struct AVFormatContext *s) 0x84, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x1E, 0x00 }; - put_buffer(s->pb, header, 8); + avio_write(s->pb, header, 8); put_flush_packet(s->pb); return 0; diff --git a/mplayer/ffmpeg/libavformat/iff.c b/mplayer/ffmpeg/libavformat/iff.c index 90a3ea9c..66224456 100644 --- a/mplayer/ffmpeg/libavformat/iff.c +++ b/mplayer/ffmpeg/libavformat/iff.c @@ -101,7 +101,7 @@ static int get_metadata(AVFormatContext *s, if (!buf) return AVERROR(ENOMEM); - if (get_buffer(s->pb, buf, data_size) < 0) { + if (avio_read(s->pb, buf, data_size) < 0) { av_free(buf); return AVERROR(EIO); } @@ -124,7 +124,7 @@ static int iff_read_header(AVFormatContext *s, AVFormatParameters *ap) { IffDemuxContext *iff = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; uint32_t chunk_id, data_size; int compression = -1; @@ -134,16 +134,16 @@ static int iff_read_header(AVFormatContext *s, return AVERROR(ENOMEM); st->codec->channels = 1; - url_fskip(pb, 8); + avio_seek(pb, 8, SEEK_CUR); // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content - st->codec->codec_tag = get_le32(pb); + st->codec->codec_tag = avio_rl32(pb); while(!url_feof(pb)) { uint64_t orig_pos; int res; const char *metadata_tag = NULL; - chunk_id = get_le32(pb); - data_size = get_be32(pb); + chunk_id = avio_rl32(pb); + data_size = avio_rb32(pb); orig_pos = url_ftell(pb); switch(chunk_id) { @@ -152,11 +152,11 @@ static int iff_read_header(AVFormatContext *s, if (data_size < 14) return AVERROR_INVALIDDATA; - url_fskip(pb, 12); - st->codec->sample_rate = get_be16(pb); + avio_seek(pb, 12, SEEK_CUR); + st->codec->sample_rate = avio_rb16(pb); if (data_size >= 16) { - url_fskip(pb, 1); - compression = get_byte(pb); + avio_seek(pb, 1, SEEK_CUR); + compression = avio_r8(pb); } break; @@ -168,7 +168,7 @@ static int iff_read_header(AVFormatContext *s, case ID_CHAN: if (data_size < 4) return AVERROR_INVALIDDATA; - st->codec->channels = (get_be32(pb) < 6) ? 1 : 2; + st->codec->channels = (avio_rb32(pb) < 6) ? 1 : 2; break; case ID_CMAP: @@ -176,7 +176,7 @@ static int iff_read_header(AVFormatContext *s, st->codec->extradata = av_malloc(data_size); if (!st->codec->extradata) return AVERROR(ENOMEM); - if (get_buffer(pb, st->codec->extradata, data_size) < 0) + if (avio_read(pb, st->codec->extradata, data_size) < 0) return AVERROR(EIO); break; @@ -184,18 +184,18 @@ static int iff_read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_VIDEO; if (data_size <= 8) return AVERROR_INVALIDDATA; - st->codec->width = get_be16(pb); - st->codec->height = get_be16(pb); - url_fskip(pb, 4); // x, y offset - st->codec->bits_per_coded_sample = get_byte(pb); + st->codec->width = avio_rb16(pb); + st->codec->height = avio_rb16(pb); + avio_seek(pb, 4, SEEK_CUR); // x, y offset + st->codec->bits_per_coded_sample = avio_r8(pb); if (data_size >= 11) { - url_fskip(pb, 1); // masking - compression = get_byte(pb); + avio_seek(pb, 1, SEEK_CUR); // masking + compression = avio_r8(pb); } if (data_size >= 16) { - url_fskip(pb, 3); // paddding, transparent - st->sample_aspect_ratio.num = get_byte(pb); - st->sample_aspect_ratio.den = get_byte(pb); + avio_seek(pb, 3, SEEK_CUR); // paddding, transparent + st->sample_aspect_ratio.num = avio_r8(pb); + st->sample_aspect_ratio.den = avio_r8(pb); } break; @@ -223,10 +223,10 @@ static int iff_read_header(AVFormatContext *s, return res; } } - url_fskip(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1)); + avio_seek(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1), SEEK_CUR); } - url_fseek(pb, iff->body_pos, SEEK_SET); + avio_seek(pb, iff->body_pos, SEEK_SET); switch(st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: @@ -276,7 +276,7 @@ static int iff_read_packet(AVFormatContext *s, AVPacket *pkt) { IffDemuxContext *iff = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; int ret; @@ -286,7 +286,7 @@ static int iff_read_packet(AVFormatContext *s, if(st->codec->channels == 2) { uint8_t sample_buffer[PACKET_SIZE]; - ret = get_buffer(pb, sample_buffer, PACKET_SIZE); + ret = avio_read(pb, sample_buffer, PACKET_SIZE); if(av_new_packet(pkt, PACKET_SIZE) < 0) { av_log(s, AV_LOG_ERROR, "cannot allocate packet\n"); return AVERROR(ENOMEM); diff --git a/mplayer/ffmpeg/libavformat/img2.c b/mplayer/ffmpeg/libavformat/img2.c index 13fdc74d..c37af1f7 100644 --- a/mplayer/ffmpeg/libavformat/img2.c +++ b/mplayer/ffmpeg/libavformat/img2.c @@ -23,6 +23,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/avstring.h" #include "avformat.h" +#include "avio_internal.h" #ifndef GEKKO #include #endif @@ -257,7 +258,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt) char filename[1024]; int i; int size[3]={0}, ret[3]={0}; - ByteIOContext *f[3]; + AVIOContext *f[3]; AVCodecContext *codec= s1->streams[0]->codec; if (!s->is_pipe) { @@ -271,7 +272,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt) s->path, s->img_number)<0 && s->img_number > 1) return AVERROR(EIO); for(i=0; i<3; i++){ - if (url_fopen(&f[i], filename, URL_RDONLY) < 0) { + if (avio_open(&f[i], filename, URL_RDONLY) < 0) { if(i==1) break; av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",filename); @@ -300,9 +301,9 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt) pkt->size= 0; for(i=0; i<3; i++){ if(size[i]){ - ret[i]= get_buffer(f[i], pkt->data + pkt->size, size[i]); + ret[i]= avio_read(f[i], pkt->data + pkt->size, size[i]); if (!s->is_pipe) - url_fclose(f[i]); + avio_close(f[i]); if(ret[i]>0) pkt->size += ret[i]; } @@ -341,7 +342,7 @@ static int write_header(AVFormatContext *s) static int write_packet(AVFormatContext *s, AVPacket *pkt) { VideoData *img = s->priv_data; - ByteIOContext *pb[3]; + AVIOContext *pb[3]; char filename[1024]; AVCodecContext *codec= s->streams[ pkt->stream_index ]->codec; int i; @@ -355,7 +356,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(EIO); } for(i=0; i<3; i++){ - if (url_fopen(&pb[i], filename, URL_WRONLY) < 0) { + if (avio_open(&pb[i], filename, URL_WRONLY) < 0) { av_log(s, AV_LOG_ERROR, "Could not open file : %s\n",filename); return AVERROR(EIO); } @@ -370,13 +371,13 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) if(codec->codec_id == CODEC_ID_RAWVIDEO){ int ysize = codec->width * codec->height; - put_buffer(pb[0], pkt->data , ysize); - put_buffer(pb[1], pkt->data + ysize, (pkt->size - ysize)/2); - put_buffer(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2); + avio_write(pb[0], pkt->data , ysize); + avio_write(pb[1], pkt->data + ysize, (pkt->size - ysize)/2); + avio_write(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2); put_flush_packet(pb[1]); put_flush_packet(pb[2]); - url_fclose(pb[1]); - url_fclose(pb[2]); + avio_close(pb[1]); + avio_close(pb[2]); }else{ if(av_str2id(img_tags, s->filename) == CODEC_ID_JPEG2000){ AVStream *st = s->streams[0]; @@ -384,15 +385,15 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) AV_RL32(st->codec->extradata+4) == MKTAG('j','p','2','h')){ if(pkt->size < 8 || AV_RL32(pkt->data+4) != MKTAG('j','p','2','c')) goto error; - put_be32(pb[0], 12); - put_tag (pb[0], "jP "); - put_be32(pb[0], 0x0D0A870A); // signature - put_be32(pb[0], 20); - put_tag (pb[0], "ftyp"); - put_tag (pb[0], "jp2 "); - put_be32(pb[0], 0); - put_tag (pb[0], "jp2 "); - put_buffer(pb[0], st->codec->extradata, st->codec->extradata_size); + avio_wb32(pb[0], 12); + ffio_wfourcc(pb[0], "jP "); + avio_wb32(pb[0], 0x0D0A870A); // signature + avio_wb32(pb[0], 20); + ffio_wfourcc(pb[0], "ftyp"); + ffio_wfourcc(pb[0], "jp2 "); + avio_wb32(pb[0], 0); + ffio_wfourcc(pb[0], "jp2 "); + avio_write(pb[0], st->codec->extradata, st->codec->extradata_size); }else if(pkt->size < 8 || (!st->codec->extradata_size && AV_RL32(pkt->data+4) != MKTAG('j','P',' ',' '))){ // signature @@ -401,11 +402,11 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) return -1; } } - put_buffer(pb[0], pkt->data, pkt->size); + avio_write(pb[0], pkt->data, pkt->size); } put_flush_packet(pb[0]); if (!img->is_pipe) { - url_fclose(pb[0]); + avio_close(pb[0]); } img->img_number++; diff --git a/mplayer/ffmpeg/libavformat/ingenientdec.c b/mplayer/ffmpeg/libavformat/ingenientdec.c index 79587b51..9f7065ce 100644 --- a/mplayer/ffmpeg/libavformat/ingenientdec.c +++ b/mplayer/ffmpeg/libavformat/ingenientdec.c @@ -27,19 +27,19 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) { int ret, size, w, h, unk1, unk2; - if (get_le32(s->pb) != MKTAG('M', 'J', 'P', 'G')) + if (avio_rl32(s->pb) != MKTAG('M', 'J', 'P', 'G')) return AVERROR(EIO); // FIXME - size = get_le32(s->pb); + size = avio_rl32(s->pb); - w = get_le16(s->pb); - h = get_le16(s->pb); + w = avio_rl16(s->pb); + h = avio_rl16(s->pb); - url_fskip(s->pb, 8); // zero + size (padded?) - url_fskip(s->pb, 2); - unk1 = get_le16(s->pb); - unk2 = get_le16(s->pb); - url_fskip(s->pb, 22); // ASCII timestamp + avio_seek(s->pb, 8, SEEK_CUR); // zero + size (padded?) + avio_seek(s->pb, 2, SEEK_CUR); + unk1 = avio_rl16(s->pb); + unk2 = avio_rl16(s->pb); + avio_seek(s->pb, 22, SEEK_CUR); // ASCII timestamp av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n", size, w, h, unk1, unk2); @@ -49,7 +49,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->pos = url_ftell(s->pb); pkt->stream_index = 0; - ret = get_buffer(s->pb, pkt->data, size); + ret = avio_read(s->pb, pkt->data, size); if (ret < 0) { av_free_packet(pkt); return ret; diff --git a/mplayer/ffmpeg/libavformat/internal.h b/mplayer/ffmpeg/libavformat/internal.h index b401d352..02a27e47 100644 --- a/mplayer/ffmpeg/libavformat/internal.h +++ b/mplayer/ffmpeg/libavformat/internal.h @@ -48,10 +48,7 @@ do {\ } while(0) #endif -time_t mktimegm(struct tm *tm); struct tm *brktimegm(time_t secs, struct tm *tm); -const char *small_strptime(const char *p, const char *fmt, - struct tm *dt); char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase); @@ -82,25 +79,6 @@ void ff_read_frame_flush(AVFormatContext *s); /** Get the current time since NTP epoch in microseconds. */ uint64_t ff_ntp_time(void); -/** - * Probe a bytestream to determine the input format. Each time a probe returns - * with a score that is too low, the probe buffer size is increased and another - * attempt is made. When the maximum probe size is reached, the input format - * with the highest score is returned. - * - * @param pb the bytestream to probe, it may be closed and opened again - * @param fmt the input format is put here - * @param filename the filename of the stream - * @param logctx the log context - * @param offset the offset within the bytestream to probe from - * @param max_probe_size the maximum probe buffer size (zero for default) - * @return 0 in case of success, a negative value corresponding to an - * AVERROR code otherwise - */ -int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt, - const char *filename, void *logctx, - unsigned int offset, unsigned int max_probe_size); - #if FF_API_URL_SPLIT /** * @deprecated use av_url_split() instead @@ -179,20 +157,20 @@ int ff_get_v_length(uint64_t val); /** * Put val using a variable number of bytes. */ -void ff_put_v(ByteIOContext *bc, uint64_t val); +void ff_put_v(AVIOContext *bc, uint64_t val); /** - * Read a whole line of text from ByteIOContext. Stop reading after reaching + * Read a whole line of text from AVIOContext. Stop reading after reaching * either a \n, a \0 or EOF. The returned string is always \0 terminated, * and may be truncated if the buffer is too small. * - * @param s the read-only ByteIOContext + * @param s the read-only AVIOContext * @param buf buffer to store the read line * @param maxlen size of the buffer * @return the length of the string written in the buffer, not including the * final \0 */ -int ff_get_line(ByteIOContext *s, char *buf, int maxlen); +int ff_get_line(AVIOContext *s, char *buf, int maxlen); #define SPACE_CHARS " \t\r\n" @@ -226,4 +204,39 @@ void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf, */ int ff_find_stream_index(AVFormatContext *s, int id); +/** + * Internal version of av_index_search_timestamp + */ +int ff_index_search_timestamp(const AVIndexEntry *entries, int nb_entries, + int64_t wanted_timestamp, int flags); + +/** + * Internal version of av_add_index_entry + */ +int ff_add_index_entry(AVIndexEntry **index_entries, + int *nb_index_entries, + unsigned int *index_entries_allocated_size, + int64_t pos, int64_t timestamp, int size, int distance, int flags); + +/** + * Add a new chapter. + * + * @param s media file handle + * @param id unique ID for this chapter + * @param start chapter start time in time_base units + * @param end chapter end time in time_base units + * @param title chapter title + * + * @return AVChapter or NULL on error + */ +AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, + int64_t start, int64_t end, const char *title); + +/** + * Ensure the index uses less memory than the maximum specified in + * AVFormatContext.max_index_size by discarding entries if it grows + * too large. + */ +void ff_reduce_index(AVFormatContext *s, int stream_index); + #endif /* AVFORMAT_INTERNAL_H */ diff --git a/mplayer/ffmpeg/libavformat/ipmovie.c b/mplayer/ffmpeg/libavformat/ipmovie.c index 6d84402c..e02e00b1 100644 --- a/mplayer/ffmpeg/libavformat/ipmovie.c +++ b/mplayer/ffmpeg/libavformat/ipmovie.c @@ -120,7 +120,7 @@ typedef struct IPMVEContext { } IPMVEContext; -static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb, +static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, AVPacket *pkt) { int chunk_type; @@ -133,7 +133,7 @@ static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb, s->audio_chunk_size -= 6; } - url_fseek(pb, s->audio_chunk_offset, SEEK_SET); + avio_seek(pb, s->audio_chunk_offset, SEEK_SET); s->audio_chunk_offset = 0; if (s->audio_chunk_size != av_get_packet(pb, pkt, s->audio_chunk_size)) @@ -163,19 +163,19 @@ static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb, return CHUNK_NOMEM; pkt->pos= s->decode_map_chunk_offset; - url_fseek(pb, s->decode_map_chunk_offset, SEEK_SET); + avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET); s->decode_map_chunk_offset = 0; - if (get_buffer(pb, pkt->data, s->decode_map_chunk_size) != + if (avio_read(pb, pkt->data, s->decode_map_chunk_size) != s->decode_map_chunk_size) { av_free_packet(pkt); return CHUNK_EOF; } - url_fseek(pb, s->video_chunk_offset, SEEK_SET); + avio_seek(pb, s->video_chunk_offset, SEEK_SET); s->video_chunk_offset = 0; - if (get_buffer(pb, pkt->data + s->decode_map_chunk_size, + if (avio_read(pb, pkt->data + s->decode_map_chunk_size, s->video_chunk_size) != s->video_chunk_size) { av_free_packet(pkt); return CHUNK_EOF; @@ -193,7 +193,7 @@ static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb, } else { - url_fseek(pb, s->next_chunk_offset, SEEK_SET); + avio_seek(pb, s->next_chunk_offset, SEEK_SET); chunk_type = CHUNK_DONE; } @@ -203,7 +203,7 @@ static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb, /* This function loads and processes a single chunk in an IP movie file. * It returns the type of chunk that was processed. */ -static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, +static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, AVPacket *pkt) { unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE]; @@ -227,7 +227,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, /* read the next chunk, wherever the file happens to be pointing */ if (url_feof(pb)) return CHUNK_EOF; - if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != + if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != CHUNK_PREAMBLE_SIZE) return CHUNK_BAD; chunk_size = AV_RL16(&chunk_preamble[0]); @@ -275,7 +275,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, chunk_type = CHUNK_EOF; break; } - if (get_buffer(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) != + if (avio_read(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) != CHUNK_PREAMBLE_SIZE) { chunk_type = CHUNK_BAD; break; @@ -299,12 +299,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, case OPCODE_END_OF_STREAM: debug_ipmovie("end of stream\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_END_OF_CHUNK: debug_ipmovie("end of chunk\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_CREATE_TIMER: @@ -314,7 +314,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, chunk_type = CHUNK_BAD; break; } - if (get_buffer(pb, scratch, opcode_size) != + if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; @@ -331,7 +331,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, chunk_type = CHUNK_BAD; break; } - if (get_buffer(pb, scratch, opcode_size) != + if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; @@ -359,7 +359,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, case OPCODE_START_STOP_AUDIO: debug_ipmovie("start/stop audio\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_INIT_VIDEO_BUFFERS: @@ -369,7 +369,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, chunk_type = CHUNK_BAD; break; } - if (get_buffer(pb, scratch, opcode_size) != + if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; @@ -393,12 +393,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, case OPCODE_UNKNOWN_14: case OPCODE_UNKNOWN_15: debug_ipmovie("unknown (but documented) opcode %02X\n", opcode_type); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_SEND_BUFFER: debug_ipmovie("send buffer\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_AUDIO_FRAME: @@ -407,22 +407,22 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, /* log position and move on for now */ s->audio_chunk_offset = url_ftell(pb); s->audio_chunk_size = opcode_size; - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_SILENCE_FRAME: debug_ipmovie("silence frame\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_INIT_VIDEO_MODE: debug_ipmovie("initialize video mode\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_CREATE_GRADIENT: debug_ipmovie("create gradient\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_SET_PALETTE: @@ -434,7 +434,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, chunk_type = CHUNK_BAD; break; } - if (get_buffer(pb, scratch, opcode_size) != opcode_size) { + if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; } @@ -464,7 +464,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, case OPCODE_SET_PALETTE_COMPRESSED: debug_ipmovie("set palette compressed\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_SET_DECODING_MAP: @@ -473,7 +473,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, /* log position and move on for now */ s->decode_map_chunk_offset = url_ftell(pb); s->decode_map_chunk_size = opcode_size; - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_VIDEO_DATA: @@ -482,7 +482,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, /* log position and move on for now */ s->video_chunk_offset = url_ftell(pb); s->video_chunk_size = opcode_size; - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; default: @@ -521,17 +521,17 @@ static int ipmovie_read_header(AVFormatContext *s, AVFormatParameters *ap) { IPMVEContext *ipmovie = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVPacket pkt; AVStream *st; unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE]; int chunk_type; uint8_t signature_buffer[sizeof(signature)]; - get_buffer(pb, signature_buffer, sizeof(signature_buffer)); + avio_read(pb, signature_buffer, sizeof(signature_buffer)); while (memcmp(signature_buffer, signature, sizeof(signature))) { memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1); - signature_buffer[sizeof(signature_buffer) - 1] = get_byte(pb); + signature_buffer[sizeof(signature_buffer) - 1] = avio_r8(pb); if (url_feof(pb)) return AVERROR_EOF; } @@ -549,11 +549,11 @@ static int ipmovie_read_header(AVFormatContext *s, /* peek ahead to the next chunk-- if it is an init audio chunk, process * it; if it is the first video chunk, this is a silent file */ - if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != + if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); chunk_type = AV_RL16(&chunk_preamble[2]); - url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR); + avio_seek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR); if (chunk_type == CHUNK_VIDEO) ipmovie->audio_type = CODEC_ID_NONE; /* no audio */ @@ -602,7 +602,7 @@ static int ipmovie_read_packet(AVFormatContext *s, AVPacket *pkt) { IPMVEContext *ipmovie = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret; ret = process_ipmovie_chunk(ipmovie, pb, pkt); diff --git a/mplayer/ffmpeg/libavformat/isom.c b/mplayer/ffmpeg/libavformat/isom.c index 23ef82a1..3a0d3487 100644 --- a/mplayer/ffmpeg/libavformat/isom.c +++ b/mplayer/ffmpeg/libavformat/isom.c @@ -134,6 +134,10 @@ const AVCodecTag codec_movvideo_tags[] = { { CODEC_ID_RAWVIDEO, MKTAG('W', 'R', 'A', 'W') }, { CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */ + { CODEC_ID_H264, MKTAG('a', 'i', '5', '5') }, /* AVC Intra 50 / 1080 */ + { CODEC_ID_H264, MKTAG('a', 'i', '5', 'q') }, /* AVC Intra 50 / 720 */ + { CODEC_ID_H264, MKTAG('a', 'i', '1', '5') }, /* AVC Intra 100 / 1080 */ + { CODEC_ID_H264, MKTAG('a', 'i', '1', 'q') }, /* AVC Intra 100 / 720 */ { CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 Camcorder */ { CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */ @@ -193,6 +197,12 @@ const AVCodecTag codec_movvideo_tags[] = { { CODEC_ID_SGI, MKTAG('s', 'g', 'i', ' ') }, /* SGI */ { CODEC_ID_DPX, MKTAG('d', 'p', 'x', ' ') }, /* DPX */ + { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'h') }, /* Apple ProRes 422 High Quality */ + { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'n') }, /* Apple ProRes 422 Standard Definition */ + { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 's') }, /* Apple ProRes 422 LT */ + { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'o') }, /* Apple ProRes 422 Proxy */ + { CODEC_ID_PRORES, MKTAG('a', 'p', '4', 'h') }, /* Apple ProRes 4444 */ + { CODEC_ID_NONE, 0 }, }; @@ -241,6 +251,7 @@ const AVCodecTag codec_movaudio_tags[] = { { CODEC_ID_QCELP, MKTAG('Q','c','l','q') }, { CODEC_ID_QCELP, MKTAG('s','q','c','p') }, /* ISO Media fourcc */ + { CODEC_ID_QDMC, MKTAG('Q', 'D', 'M', 'C') }, /* QDMC */ { CODEC_ID_QDM2, MKTAG('Q', 'D', 'M', '2') }, /* QDM2 */ { CODEC_ID_DVAUDIO, MKTAG('v', 'd', 'v', 'a') }, @@ -332,12 +343,12 @@ int ff_mov_lang_to_iso639(unsigned code, char to[4]) return 1; } -int ff_mp4_read_descr_len(ByteIOContext *pb) +int ff_mp4_read_descr_len(AVIOContext *pb) { int len = 0; int count = 4; while (count--) { - int c = get_byte(pb); + int c = avio_r8(pb); len = (len << 7) | (c & 0x7f); if (!(c & 0x80)) break; @@ -345,10 +356,10 @@ int ff_mp4_read_descr_len(ByteIOContext *pb) return len; } -int ff_mp4_read_descr(AVFormatContext *fc, ByteIOContext *pb, int *tag) +int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag) { int len; - *tag = get_byte(pb); + *tag = avio_r8(pb); len = ff_mp4_read_descr_len(pb); av_dlog(fc, "MPEG4 description: tag=0x%02x len=%d\n", *tag, len); return len; @@ -363,14 +374,14 @@ static const AVCodecTag mp4_audio_types[] = { { CODEC_ID_NONE, AOT_NULL }, }; -int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, ByteIOContext *pb) +int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb) { int len, tag; - int object_type_id = get_byte(pb); - get_byte(pb); /* stream type */ - get_be24(pb); /* buffer size db */ - get_be32(pb); /* max bitrate */ - get_be32(pb); /* avg bitrate */ + int object_type_id = avio_r8(pb); + avio_r8(pb); /* stream type */ + avio_rb24(pb); /* buffer size db */ + avio_rb32(pb); /* max bitrate */ + avio_rb32(pb); /* avg bitrate */ st->codec->codec_id= ff_codec_get_id(ff_mp4_obj_type, object_type_id); av_dlog(fc, "esds object type id 0x%02x\n", object_type_id); @@ -383,7 +394,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, ByteIOContex st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); - get_buffer(pb, st->codec->extradata, len); + avio_read(pb, st->codec->extradata, len); st->codec->extradata_size = len; if (st->codec->codec_id == CODEC_ID_AAC) { MPEG4AudioConfig cfg; diff --git a/mplayer/ffmpeg/libavformat/isom.h b/mplayer/ffmpeg/libavformat/isom.h index 2990c9ce..1df666f1 100644 --- a/mplayer/ffmpeg/libavformat/isom.h +++ b/mplayer/ffmpeg/libavformat/isom.h @@ -88,7 +88,7 @@ typedef struct { } MOVTrackExt; typedef struct MOVStreamContext { - ByteIOContext *pb; + AVIOContext *pb; int ffindex; ///< AVStream index int next_chunk; unsigned int chunk_count; @@ -141,18 +141,18 @@ typedef struct MOVContext { int chapter_track; } MOVContext; -int ff_mp4_read_descr_len(ByteIOContext *pb); -int ff_mp4_read_descr(AVFormatContext *fc, ByteIOContext *pb, int *tag); -int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, ByteIOContext *pb); +int ff_mp4_read_descr_len(AVIOContext *pb); +int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag); +int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb); #define MP4IODescrTag 0x02 #define MP4ESDescrTag 0x03 #define MP4DecConfigDescrTag 0x04 #define MP4DecSpecificDescrTag 0x05 -int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom); +int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom); enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags); -int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries); +int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries); #endif /* AVFORMAT_ISOM_H */ diff --git a/mplayer/ffmpeg/libavformat/iss.c b/mplayer/ffmpeg/libavformat/iss.c index c47c8c87..04bb1c52 100644 --- a/mplayer/ffmpeg/libavformat/iss.c +++ b/mplayer/ffmpeg/libavformat/iss.c @@ -39,12 +39,12 @@ typedef struct { int sample_start_pos; } IssDemuxContext; -static void get_token(ByteIOContext *s, char *buf, int maxlen) +static void get_token(AVIOContext *s, char *buf, int maxlen) { int i = 0; char c; - while ((c = get_byte(s))) { + while ((c = avio_r8(s))) { if(c == ' ') break; if (i < maxlen-1) @@ -52,7 +52,7 @@ static void get_token(ByteIOContext *s, char *buf, int maxlen) } if(!c) - get_byte(s); + avio_r8(s); buf[i] = 0; /* Ensure null terminated, but may be truncated */ } @@ -68,7 +68,7 @@ static int iss_probe(AVProbeData *p) static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap) { IssDemuxContext *iss = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; char token[MAX_TOKEN_SIZE]; int stereo, rate_divisor; diff --git a/mplayer/ffmpeg/libavformat/iv8.c b/mplayer/ffmpeg/libavformat/iv8.c index 07659cf8..4671a18e 100644 --- a/mplayer/ffmpeg/libavformat/iv8.c +++ b/mplayer/ffmpeg/libavformat/iv8.c @@ -57,20 +57,20 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) { int ret, size, pts, type; retry: - type= get_be16(s->pb); // 257 or 258 - size= get_be16(s->pb); + type= avio_rb16(s->pb); // 257 or 258 + size= avio_rb16(s->pb); - get_be16(s->pb); //some flags, 0x80 indicates end of frame - get_be16(s->pb); //packet number - pts=get_be32(s->pb); - get_be32(s->pb); //6A 13 E3 88 + avio_rb16(s->pb); //some flags, 0x80 indicates end of frame + avio_rb16(s->pb); //packet number + pts=avio_rb32(s->pb); + avio_rb32(s->pb); //6A 13 E3 88 size -= 12; if(size<1) return -1; if(type==258){ - url_fskip(s->pb, size); + avio_seek(s->pb, size, SEEK_CUR); goto retry; } diff --git a/mplayer/ffmpeg/libavformat/ivfdec.c b/mplayer/ffmpeg/libavformat/ivfdec.c index 94b8b82a..af3fe19e 100644 --- a/mplayer/ffmpeg/libavformat/ivfdec.c +++ b/mplayer/ffmpeg/libavformat/ivfdec.c @@ -36,9 +36,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *st; AVRational time_base; - get_le32(s->pb); // DKIF - get_le16(s->pb); // version - get_le16(s->pb); // header size + avio_rl32(s->pb); // DKIF + avio_rl16(s->pb); // version + avio_rl16(s->pb); // header size st = av_new_stream(s, 0); if (!st) @@ -46,13 +46,13 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_tag = get_le32(s->pb); + st->codec->codec_tag = avio_rl32(s->pb); st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, st->codec->codec_tag); - st->codec->width = get_le16(s->pb); - st->codec->height = get_le16(s->pb); - time_base.den = get_le32(s->pb); - time_base.num = get_le32(s->pb); - st->duration = get_le64(s->pb); + st->codec->width = avio_rl16(s->pb); + st->codec->height = avio_rl16(s->pb); + time_base.den = avio_rl32(s->pb); + time_base.num = avio_rl32(s->pb); + st->duration = avio_rl64(s->pb); st->need_parsing = AVSTREAM_PARSE_HEADERS; @@ -68,8 +68,8 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) static int read_packet(AVFormatContext *s, AVPacket *pkt) { - int ret, size = get_le32(s->pb); - int64_t pts = get_le64(s->pb); + int ret, size = avio_rl32(s->pb); + int64_t pts = avio_rl64(s->pb); ret = av_get_packet(s->pb, pkt, size); pkt->stream_index = 0; diff --git a/mplayer/ffmpeg/libavformat/ivfenc.c b/mplayer/ffmpeg/libavformat/ivfenc.c index b3b28419..39139881 100644 --- a/mplayer/ffmpeg/libavformat/ivfenc.c +++ b/mplayer/ffmpeg/libavformat/ivfenc.c @@ -23,36 +23,36 @@ static int ivf_write_header(AVFormatContext *s) { AVCodecContext *ctx; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (s->nb_streams != 1) { av_log(s, AV_LOG_ERROR, "Format supports only exactly one video stream\n"); return AVERROR(EINVAL); } ctx = s->streams[0]->codec; - if (ctx->codec_type != CODEC_TYPE_VIDEO || ctx->codec_id != CODEC_ID_VP8) { + if (ctx->codec_type != AVMEDIA_TYPE_VIDEO || ctx->codec_id != CODEC_ID_VP8) { av_log(s, AV_LOG_ERROR, "Currently only VP8 is supported!\n"); return AVERROR(EINVAL); } - put_buffer(pb, "DKIF", 4); - put_le16(pb, 0); // version - put_le16(pb, 32); // header length - put_le32(pb, ctx->codec_tag ? ctx->codec_tag : AV_RL32("VP80")); - put_le16(pb, ctx->width); - put_le16(pb, ctx->height); - put_le32(pb, s->streams[0]->time_base.den); - put_le32(pb, s->streams[0]->time_base.num); - put_le64(pb, s->streams[0]->duration); // TODO: duration or number of frames?!? + avio_write(pb, "DKIF", 4); + avio_wl16(pb, 0); // version + avio_wl16(pb, 32); // header length + avio_wl32(pb, ctx->codec_tag ? ctx->codec_tag : AV_RL32("VP80")); + avio_wl16(pb, ctx->width); + avio_wl16(pb, ctx->height); + avio_wl32(pb, s->streams[0]->time_base.den); + avio_wl32(pb, s->streams[0]->time_base.num); + avio_wl64(pb, s->streams[0]->duration); // TODO: duration or number of frames?!? return 0; } static int ivf_write_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; - put_le32(pb, pkt->size); - put_le64(pb, pkt->pts); - put_buffer(pb, pkt->data, pkt->size); + AVIOContext *pb = s->pb; + avio_wl32(pb, pkt->size); + avio_wl64(pb, pkt->pts); + avio_write(pb, pkt->data, pkt->size); put_flush_packet(pb); return 0; diff --git a/mplayer/ffmpeg/libavformat/libnut.c b/mplayer/ffmpeg/libavformat/libnut.c index 5630bf8c..467ca9c4 100644 --- a/mplayer/ffmpeg/libavformat/libnut.c +++ b/mplayer/ffmpeg/libavformat/libnut.c @@ -46,15 +46,15 @@ static const AVCodecTag nut_tags[] = { #if CONFIG_LIBNUT_MUXER static int av_write(void * h, size_t len, const uint8_t * buf) { - ByteIOContext * bc = h; - put_buffer(bc, buf, len); + AVIOContext * bc = h; + avio_write(bc, buf, len); //put_flush_packet(bc); return len; } static int nut_write_header(AVFormatContext * avf) { NUTContext * priv = avf->priv_data; - ByteIOContext * bc = avf->pb; + AVIOContext * bc = avf->pb; nut_muxer_opts_tt mopts = { .output = { .priv = bc, @@ -137,7 +137,7 @@ static int nut_write_packet(AVFormatContext * avf, AVPacket * pkt) { } static int nut_write_trailer(AVFormatContext * avf) { - ByteIOContext * bc = avf->pb; + AVIOContext * bc = avf->pb; NUTContext * priv = avf->priv_data; int i; @@ -172,22 +172,22 @@ static int nut_probe(AVProbeData *p) { } static size_t av_read(void * h, size_t len, uint8_t * buf) { - ByteIOContext * bc = h; - return get_buffer(bc, buf, len); + AVIOContext * bc = h; + return avio_read(bc, buf, len); } static off_t av_seek(void * h, long long pos, int whence) { - ByteIOContext * bc = h; + AVIOContext * bc = h; if (whence == SEEK_END) { pos = url_fsize(bc) + pos; whence = SEEK_SET; } - return url_fseek(bc, pos, whence); + return avio_seek(bc, pos, whence); } static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { NUTContext * priv = avf->priv_data; - ByteIOContext * bc = avf->pb; + AVIOContext * bc = avf->pb; nut_demuxer_opts_tt dopts = { .input = { .priv = bc, diff --git a/mplayer/ffmpeg/libavformat/lmlm4.c b/mplayer/ffmpeg/libavformat/lmlm4.c index 5cb202e4..97ece015 100644 --- a/mplayer/ffmpeg/libavformat/lmlm4.c +++ b/mplayer/ffmpeg/libavformat/lmlm4.c @@ -78,13 +78,13 @@ static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) { } static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret; unsigned int frame_type, packet_size, padding, frame_size; - get_be16(pb); /* channel number */ - frame_type = get_be16(pb); - packet_size = get_be32(pb); + avio_rb16(pb); /* channel number */ + frame_type = avio_rb16(pb); + packet_size = avio_rb32(pb); padding = -packet_size & 511; frame_size = packet_size - 8; @@ -100,7 +100,7 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0) return AVERROR(EIO); - url_fskip(pb, padding); + avio_seek(pb, padding, SEEK_CUR); switch (frame_type) { case LMLM4_I_FRAME: diff --git a/mplayer/ffmpeg/libavformat/lxfdec.c b/mplayer/ffmpeg/libavformat/lxfdec.c index 1d4d269d..4e98c895 100644 --- a/mplayer/ffmpeg/libavformat/lxfdec.c +++ b/mplayer/ffmpeg/libavformat/lxfdec.c @@ -86,7 +86,7 @@ static int sync(AVFormatContext *s, uint8_t *header) uint8_t buf[LXF_IDENT_LENGTH]; int ret; - if ((ret = get_buffer(s->pb, buf, LXF_IDENT_LENGTH)) != LXF_IDENT_LENGTH) + if ((ret = avio_read(s->pb, buf, LXF_IDENT_LENGTH)) != LXF_IDENT_LENGTH) return ret < 0 ? ret : AVERROR_EOF; while (memcmp(buf, LXF_IDENT, LXF_IDENT_LENGTH)) { @@ -94,7 +94,7 @@ static int sync(AVFormatContext *s, uint8_t *header) return AVERROR_EOF; memmove(buf, &buf[1], LXF_IDENT_LENGTH-1); - buf[LXF_IDENT_LENGTH-1] = get_byte(s->pb); + buf[LXF_IDENT_LENGTH-1] = avio_r8(s->pb); } memcpy(header, LXF_IDENT, LXF_IDENT_LENGTH); @@ -111,7 +111,7 @@ static int sync(AVFormatContext *s, uint8_t *header) */ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *format) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int track_size, samples, ret; AVStream *st; @@ -120,7 +120,7 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form return ret; //read the rest of the packet header - if ((ret = get_buffer(pb, header + LXF_IDENT_LENGTH, + if ((ret = avio_read(pb, header + LXF_IDENT_LENGTH, LXF_PACKET_HEADER_SIZE - LXF_IDENT_LENGTH)) != LXF_PACKET_HEADER_SIZE - LXF_IDENT_LENGTH) { return ret < 0 ? ret : AVERROR_EOF; @@ -137,8 +137,8 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form case 0: //video //skip VBI data and metadata - url_fskip(pb, (int64_t)(uint32_t)AV_RL32(&header[44]) + - (int64_t)(uint32_t)AV_RL32(&header[52])); + avio_seek(pb, (int64_t)(uint32_t)AV_RL32(&header[44]) + + (int64_t)(uint32_t)AV_RL32(&header[52]), SEEK_CUR); break; case 1: //audio @@ -198,7 +198,7 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) { LXFDemuxContext *lxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint8_t header[LXF_PACKET_HEADER_SIZE], header_data[LXF_HEADER_DATA_SIZE]; int ret; AVStream *st; @@ -214,7 +214,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR_INVALIDDATA; } - if ((ret = get_buffer(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE) + if ((ret = avio_read(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE) return ret < 0 ? ret : AVERROR_EOF; if (!(st = av_new_stream(s, 0))) @@ -255,7 +255,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (format == 1) { //skip extended field data - url_fskip(s->pb, (uint32_t)AV_RL32(&header[40])); + avio_seek(s->pb, (uint32_t)AV_RL32(&header[40]), SEEK_CUR); } return 0; @@ -281,7 +281,7 @@ static void deplanarize(LXFDemuxContext *lxf, AVStream *ast, uint8_t *out, int b static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt) { LXFDemuxContext *lxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint8_t header[LXF_PACKET_HEADER_SIZE], *buf; AVStream *ast = NULL; uint32_t stream, format; @@ -315,7 +315,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt) //read non-20-bit audio data into lxf->temp so we can deplanarize it buf = ast && ast->codec->codec_id != CODEC_ID_PCM_LXF ? lxf->temp : pkt->data; - if ((ret2 = get_buffer(pb, buf, ret)) != ret) { + if ((ret2 = avio_read(pb, buf, ret)) != ret) { av_free_packet(pkt); return ret2 < 0 ? ret2 : AVERROR_EOF; } diff --git a/mplayer/ffmpeg/libavformat/matroskadec.c b/mplayer/ffmpeg/libavformat/matroskadec.c index 1a87f4a0..7480475c 100644 --- a/mplayer/ffmpeg/libavformat/matroskadec.c +++ b/mplayer/ffmpeg/libavformat/matroskadec.c @@ -31,6 +31,7 @@ #include #include "avformat.h" #include "internal.h" +#include "avio_internal.h" /* For ff_codec_get_id(). */ #include "riff.h" #include "isom.h" @@ -58,6 +59,7 @@ typedef enum { EBML_NEST, EBML_PASS, EBML_STOP, + EBML_TYPE_COUNT } EbmlType; typedef const struct EbmlSyntax { @@ -514,7 +516,7 @@ static const char *matroska_doctypes[] = { "matroska", "webm" }; */ static int ebml_level_end(MatroskaDemuxContext *matroska) { - ByteIOContext *pb = matroska->ctx->pb; + AVIOContext *pb = matroska->ctx->pb; int64_t pos = url_ftell(pb); if (matroska->num_levels > 0) { @@ -535,16 +537,16 @@ static int ebml_level_end(MatroskaDemuxContext *matroska) * number. * Returns: number of bytes read, < 0 on error */ -static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb, +static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb, int max_size, uint64_t *number) { int read = 1, n = 1; uint64_t total = 0; - /* The first byte tells us the length in bytes - get_byte() can normally + /* The first byte tells us the length in bytes - avio_r8() can normally * return 0, but since that's not a valid first ebmlID byte, we can * use it safely here to catch EOS. */ - if (!(total = get_byte(pb))) { + if (!(total = avio_r8(pb))) { /* we might encounter EOS here */ if (!url_feof(pb)) { int64_t pos = url_ftell(pb); @@ -568,7 +570,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb, /* read out length */ total ^= 1 << ff_log2_tab[total]; while (n++ < read) - total = (total << 8) | get_byte(pb); + total = (total << 8) | avio_r8(pb); *number = total; @@ -580,7 +582,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb, * This needs special handling for the "unknown length" case which has multiple * encodings. */ -static int ebml_read_length(MatroskaDemuxContext *matroska, ByteIOContext *pb, +static int ebml_read_length(MatroskaDemuxContext *matroska, AVIOContext *pb, uint64_t *number) { int res = ebml_read_num(matroska, pb, 8, number); @@ -593,7 +595,7 @@ static int ebml_read_length(MatroskaDemuxContext *matroska, ByteIOContext *pb, * Read the next element as an unsigned int. * 0 is success, < 0 is failure. */ -static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num) +static int ebml_read_uint(AVIOContext *pb, int size, uint64_t *num) { int n = 0; @@ -603,7 +605,7 @@ static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num) /* big-endian ordering; build up number */ *num = 0; while (n++ < size) - *num = (*num << 8) | get_byte(pb); + *num = (*num << 8) | avio_r8(pb); return 0; } @@ -612,14 +614,14 @@ static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num) * Read the next element as a float. * 0 is success, < 0 is failure. */ -static int ebml_read_float(ByteIOContext *pb, int size, double *num) +static int ebml_read_float(AVIOContext *pb, int size, double *num) { if (size == 0) { *num = 0; } else if (size == 4) { - *num= av_int2flt(get_be32(pb)); + *num= av_int2flt(avio_rb32(pb)); } else if(size==8){ - *num= av_int2dbl(get_be64(pb)); + *num= av_int2dbl(avio_rb64(pb)); } else return AVERROR_INVALIDDATA; @@ -630,14 +632,14 @@ static int ebml_read_float(ByteIOContext *pb, int size, double *num) * Read the next element as an ASCII string. * 0 is success, < 0 is failure. */ -static int ebml_read_ascii(ByteIOContext *pb, int size, char **str) +static int ebml_read_ascii(AVIOContext *pb, int size, char **str) { av_free(*str); /* EBML strings are usually not 0-terminated, so we allocate one * byte more, read the string and NULL-terminate it ourselves. */ if (!(*str = av_malloc(size + 1))) return AVERROR(ENOMEM); - if (get_buffer(pb, (uint8_t *) *str, size) != size) { + if (avio_read(pb, (uint8_t *) *str, size) != size) { av_freep(str); return AVERROR(EIO); } @@ -650,7 +652,7 @@ static int ebml_read_ascii(ByteIOContext *pb, int size, char **str) * Read the next element as binary data. * 0 is success, < 0 is failure. */ -static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin) +static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin) { av_free(bin->data); if (!(bin->data = av_malloc(length))) @@ -658,7 +660,7 @@ static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin) bin->size = length; bin->pos = url_ftell(pb); - if (get_buffer(pb, bin->data, length) != length) { + if (avio_read(pb, bin->data, length) != length) { av_freep(&bin->data); return AVERROR(EIO); } @@ -673,7 +675,7 @@ static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin) */ static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length) { - ByteIOContext *pb = matroska->ctx->pb; + AVIOContext *pb = matroska->ctx->pb; MatroskaLevel *level; if (matroska->num_levels >= EBML_MAX_DEPTH) { @@ -696,8 +698,8 @@ static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length) static int matroska_ebmlnum_uint(MatroskaDemuxContext *matroska, uint8_t *data, uint32_t size, uint64_t *num) { - ByteIOContext pb; - init_put_byte(&pb, data, size, 0, NULL, NULL, NULL, NULL); + AVIOContext pb; + ffio_init_context(&pb, data, size, 0, NULL, NULL, NULL, NULL); return ebml_read_num(matroska, &pb, FFMIN(size, 8), num); } @@ -780,7 +782,17 @@ static int ebml_parse_nest(MatroskaDemuxContext *matroska, EbmlSyntax *syntax, static int ebml_parse_elem(MatroskaDemuxContext *matroska, EbmlSyntax *syntax, void *data) { - ByteIOContext *pb = matroska->ctx->pb; + static const uint64_t max_lengths[EBML_TYPE_COUNT] = { + [EBML_UINT] = 8, + [EBML_FLOAT] = 8, + // max. 16 MB for strings + [EBML_STR] = 0x1000000, + [EBML_UTF8] = 0x1000000, + // max. 256 MB for binary data + [EBML_BIN] = 0x10000000, + // no limits for anything else + }; + AVIOContext *pb = matroska->ctx->pb; uint32_t id = syntax->id; uint64_t length; int res; @@ -798,6 +810,12 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska, matroska->current_id = 0; if ((res = ebml_read_length(matroska, pb, &length)) < 0) return res; + if (max_lengths[syntax->type] && length > max_lengths[syntax->type]) { + av_log(matroska->ctx, AV_LOG_ERROR, + "Invalid length 0x%"PRIx64" > 0x%"PRIx64" for syntax element %i\n", + length, max_lengths[syntax->type], syntax->type); + return AVERROR_INVALIDDATA; + } } switch (syntax->type) { @@ -813,7 +831,7 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska, return ebml_parse_nest(matroska, syntax->def.n, data); case EBML_PASS: return ebml_parse_id(matroska, syntax->def.n, id, data); case EBML_STOP: return 1; - default: return url_fseek(pb,length,SEEK_CUR)<0 ? AVERROR(EIO) : 0; + default: return avio_seek(pb,length,SEEK_CUR)<0 ? AVERROR(EIO) : 0; } if (res == AVERROR_INVALIDDATA) av_log(matroska->ctx, AV_LOG_ERROR, "Invalid element\n"); @@ -1112,7 +1130,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska) continue; /* seek */ - if (url_fseek(matroska->ctx->pb, offset, SEEK_SET) != offset) + if (avio_seek(matroska->ctx->pb, offset, SEEK_SET) != offset) continue; /* We don't want to lose our seekhead level, so we add @@ -1141,7 +1159,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska) } /* seek back */ - url_fseek(matroska->ctx->pb, before_pos, SEEK_SET); + avio_seek(matroska->ctx->pb, before_pos, SEEK_SET); matroska->level_up = level_up; matroska->current_id = saved_id; } @@ -1225,7 +1243,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) uint8_t *extradata = NULL; int extradata_size = 0; int extradata_offset = 0; - ByteIOContext b; + AVIOContext b; /* Apply some sanity checks. */ if (track->type != MATROSKA_TRACK_TYPE_VIDEO && @@ -1311,7 +1329,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) } else if (!strcmp(track->codec_id, "A_MS/ACM") && track->codec_priv.size >= 14 && track->codec_priv.data != NULL) { - init_put_byte(&b, track->codec_priv.data, track->codec_priv.size, + ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size, URL_RDONLY, NULL, NULL, NULL, NULL); ff_get_wav_header(&b, st->codec, track->codec_priv.size); codec_id = st->codec->codec_id; @@ -1356,14 +1374,14 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) extradata = av_mallocz(extradata_size); if (extradata == NULL) return AVERROR(ENOMEM); - init_put_byte(&b, extradata, extradata_size, 1, + ffio_init_context(&b, extradata, extradata_size, 1, NULL, NULL, NULL, NULL); - put_buffer(&b, "TTA1", 4); - put_le16(&b, 1); - put_le16(&b, track->audio.channels); - put_le16(&b, track->audio.bitdepth); - put_le32(&b, track->audio.out_samplerate); - put_le32(&b, matroska->ctx->duration * track->audio.out_samplerate); + avio_write(&b, "TTA1", 4); + avio_wl16(&b, 1); + avio_wl16(&b, track->audio.channels); + avio_wl16(&b, track->audio.bitdepth); + avio_wl32(&b, track->audio.out_samplerate); + avio_wl32(&b, matroska->ctx->duration * track->audio.out_samplerate); } else if (codec_id == CODEC_ID_RV10 || codec_id == CODEC_ID_RV20 || codec_id == CODEC_ID_RV30 || codec_id == CODEC_ID_RV40) { extradata_offset = 26; @@ -1373,15 +1391,15 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) } else if (codec_id == CODEC_ID_RA_288 || codec_id == CODEC_ID_COOK || codec_id == CODEC_ID_ATRAC3 || codec_id == CODEC_ID_SIPR) { int flavor; - init_put_byte(&b, track->codec_priv.data,track->codec_priv.size, + ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size, 0, NULL, NULL, NULL, NULL); - url_fskip(&b, 22); - flavor = get_be16(&b); - track->audio.coded_framesize = get_be32(&b); - url_fskip(&b, 12); - track->audio.sub_packet_h = get_be16(&b); - track->audio.frame_size = get_be16(&b); - track->audio.sub_packet_size = get_be16(&b); + avio_seek(&b, 22, SEEK_CUR); + flavor = avio_rb16(&b); + track->audio.coded_framesize = avio_rb32(&b); + avio_seek(&b, 12, SEEK_CUR); + track->audio.sub_packet_h = avio_rb16(&b); + track->audio.frame_size = avio_rb16(&b); + track->audio.sub_packet_size = avio_rb16(&b); track->audio.buf = av_malloc(track->audio.frame_size * track->audio.sub_packet_h); if (codec_id == CODEC_ID_RA_288) { st->codec->block_align = track->audio.coded_framesize; @@ -1871,7 +1889,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index, timestamp = FFMAX(timestamp, st->index_entries[0].timestamp); if ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) { - url_fseek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET); while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) { matroska_clear_queue(matroska); if (matroska_parse_cluster(matroska) < 0) @@ -1896,7 +1914,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index, } } - url_fseek(s->pb, st->index_entries[index_min].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index_min].pos, SEEK_SET); matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY); matroska->skip_to_timecode = st->index_entries[index].timestamp; matroska->done = 0; diff --git a/mplayer/ffmpeg/libavformat/matroskaenc.c b/mplayer/ffmpeg/libavformat/matroskaenc.c index a288c7f8..6f752204 100644 --- a/mplayer/ffmpeg/libavformat/matroskaenc.c +++ b/mplayer/ffmpeg/libavformat/matroskaenc.c @@ -26,7 +26,7 @@ #include "avc.h" #include "flacenc.h" #include "avlanguage.h" -#include "libavcore/samplefmt.h" +#include "libavutil/samplefmt.h" #include "libavutil/intreadwrite.h" #include "libavutil/random_seed.h" #include "libavutil/lfg.h" @@ -74,7 +74,7 @@ typedef struct { typedef struct MatroskaMuxContext { int mode; - ByteIOContext *dyn_bc; + AVIOContext *dyn_bc; ebml_master segment; int64_t segment_offset; ebml_master cluster; @@ -108,11 +108,11 @@ static int ebml_id_size(unsigned int id) return (av_log2(id+1)-1)/7+1; } -static void put_ebml_id(ByteIOContext *pb, unsigned int id) +static void put_ebml_id(AVIOContext *pb, unsigned int id) { int i = ebml_id_size(id); while (i--) - put_byte(pb, id >> (i*8)); + avio_w8(pb, id >> (i*8)); } /** @@ -120,12 +120,12 @@ static void put_ebml_id(ByteIOContext *pb, unsigned int id) * * @param bytes The number of bytes the size should occupy (maximum: 8). */ -static void put_ebml_size_unknown(ByteIOContext *pb, int bytes) +static void put_ebml_size_unknown(AVIOContext *pb, int bytes) { assert(bytes <= 8); - put_byte(pb, 0x1ff >> bytes); + avio_w8(pb, 0x1ff >> bytes); while (--bytes) - put_byte(pb, 0xff); + avio_w8(pb, 0xff); } /** @@ -144,7 +144,7 @@ static int ebml_num_size(uint64_t num) * @param bytes The number of bytes that need to be used to write the number. * If zero, any number of bytes can be used. */ -static void put_ebml_num(ByteIOContext *pb, uint64_t num, int bytes) +static void put_ebml_num(AVIOContext *pb, uint64_t num, int bytes) { int i, needed_bytes = ebml_num_size(num); @@ -160,10 +160,10 @@ static void put_ebml_num(ByteIOContext *pb, uint64_t num, int bytes) num |= 1ULL << bytes*7; for (i = bytes - 1; i >= 0; i--) - put_byte(pb, num >> i*8); + avio_w8(pb, num >> i*8); } -static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t val) +static void put_ebml_uint(AVIOContext *pb, unsigned int elementid, uint64_t val) { int i, bytes = 1; uint64_t tmp = val; @@ -172,25 +172,25 @@ static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t va put_ebml_id(pb, elementid); put_ebml_num(pb, bytes, 0); for (i = bytes - 1; i >= 0; i--) - put_byte(pb, val >> i*8); + avio_w8(pb, val >> i*8); } -static void put_ebml_float(ByteIOContext *pb, unsigned int elementid, double val) +static void put_ebml_float(AVIOContext *pb, unsigned int elementid, double val) { put_ebml_id(pb, elementid); put_ebml_num(pb, 8, 0); - put_be64(pb, av_dbl2int(val)); + avio_wb64(pb, av_dbl2int(val)); } -static void put_ebml_binary(ByteIOContext *pb, unsigned int elementid, +static void put_ebml_binary(AVIOContext *pb, unsigned int elementid, const void *buf, int size) { put_ebml_id(pb, elementid); put_ebml_num(pb, size, 0); - put_buffer(pb, buf, size); + avio_write(pb, buf, size); } -static void put_ebml_string(ByteIOContext *pb, unsigned int elementid, const char *str) +static void put_ebml_string(AVIOContext *pb, unsigned int elementid, const char *str) { put_ebml_binary(pb, elementid, str, strlen(str)); } @@ -201,7 +201,7 @@ static void put_ebml_string(ByteIOContext *pb, unsigned int elementid, const cha * * @param size The number of bytes to reserve, which must be at least 2. */ -static void put_ebml_void(ByteIOContext *pb, uint64_t size) +static void put_ebml_void(AVIOContext *pb, uint64_t size) { int64_t currentpos = url_ftell(pb); @@ -216,10 +216,10 @@ static void put_ebml_void(ByteIOContext *pb, uint64_t size) else put_ebml_num(pb, size-9, 8); while(url_ftell(pb) < currentpos + size) - put_byte(pb, 0); + avio_w8(pb, 0); } -static ebml_master start_ebml_master(ByteIOContext *pb, unsigned int elementid, uint64_t expectedsize) +static ebml_master start_ebml_master(AVIOContext *pb, unsigned int elementid, uint64_t expectedsize) { int bytes = expectedsize ? ebml_num_size(expectedsize) : 8; put_ebml_id(pb, elementid); @@ -227,22 +227,22 @@ static ebml_master start_ebml_master(ByteIOContext *pb, unsigned int elementid, return (ebml_master){ url_ftell(pb), bytes }; } -static void end_ebml_master(ByteIOContext *pb, ebml_master master) +static void end_ebml_master(AVIOContext *pb, ebml_master master) { int64_t pos = url_ftell(pb); - if (url_fseek(pb, master.pos - master.sizebytes, SEEK_SET) < 0) + if (avio_seek(pb, master.pos - master.sizebytes, SEEK_SET) < 0) return; put_ebml_num(pb, pos - master.pos, master.sizebytes); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } -static void put_xiph_size(ByteIOContext *pb, int size) +static void put_xiph_size(AVIOContext *pb, int size) { int i; for (i = 0; i < size / 255; i++) - put_byte(pb, 255); - put_byte(pb, size % 255); + avio_w8(pb, 255); + avio_w8(pb, size % 255); } /** @@ -256,7 +256,7 @@ static void put_xiph_size(ByteIOContext *pb, int size) * @param numelements The maximum number of elements that will be indexed * by this seek head, 0 if unlimited. */ -static mkv_seekhead * mkv_start_seekhead(ByteIOContext *pb, int64_t segment_offset, int numelements) +static mkv_seekhead * mkv_start_seekhead(AVIOContext *pb, int64_t segment_offset, int numelements) { mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead)); if (new_seekhead == NULL) @@ -304,7 +304,7 @@ static int mkv_add_seekhead_entry(mkv_seekhead *seekhead, unsigned int elementid * @return The file offset where the seekhead was written, * -1 if an error occurred. */ -static int64_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead) +static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead) { ebml_master metaseek, seekentry; int64_t currentpos; @@ -313,7 +313,7 @@ static int64_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead) currentpos = url_ftell(pb); if (seekhead->reserved_size > 0) - if (url_fseek(pb, seekhead->filepos, SEEK_SET) < 0) + if (avio_seek(pb, seekhead->filepos, SEEK_SET) < 0) return -1; metaseek = start_ebml_master(pb, MATROSKA_ID_SEEKHEAD, seekhead->reserved_size); @@ -334,7 +334,7 @@ static int64_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead) if (seekhead->reserved_size > 0) { uint64_t remaining = seekhead->filepos + seekhead->reserved_size - url_ftell(pb); put_ebml_void(pb, remaining); - url_fseek(pb, currentpos, SEEK_SET); + avio_seek(pb, currentpos, SEEK_SET); currentpos = seekhead->filepos; } @@ -373,7 +373,7 @@ static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t clus return 0; } -static int64_t mkv_write_cues(ByteIOContext *pb, mkv_cues *cues, int num_tracks) +static int64_t mkv_write_cues(AVIOContext *pb, mkv_cues *cues, int num_tracks) { ebml_master cues_element; int64_t currentpos; @@ -408,7 +408,7 @@ static int64_t mkv_write_cues(ByteIOContext *pb, mkv_cues *cues, int num_tracks) return currentpos; } -static int put_xiph_codecpriv(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec) +static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb, AVCodecContext *codec) { uint8_t *header_start[3]; int header_len[3]; @@ -426,12 +426,12 @@ static int put_xiph_codecpriv(AVFormatContext *s, ByteIOContext *pb, AVCodecCont return -1; } - put_byte(pb, 2); // number packets - 1 + avio_w8(pb, 2); // number packets - 1 for (j = 0; j < 2; j++) { put_xiph_size(pb, header_len[j]); } for (j = 0; j < 3; j++) - put_buffer(pb, header_start[j], header_len[j]); + avio_write(pb, header_start[j], header_len[j]); return 0; } @@ -463,9 +463,9 @@ static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int } } -static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec, int native_id, int qt_id) +static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecContext *codec, int native_id, int qt_id) { - ByteIOContext *dyn_cp; + AVIOContext *dyn_cp; uint8_t *codecpriv; int ret, codecpriv_size; @@ -481,13 +481,13 @@ static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodec else if (codec->codec_id == CODEC_ID_H264) ret = ff_isom_write_avcc(dyn_cp, codec->extradata, codec->extradata_size); else if (codec->extradata_size) - put_buffer(dyn_cp, codec->extradata, codec->extradata_size); + avio_write(dyn_cp, codec->extradata, codec->extradata_size); } else if (codec->codec_type == AVMEDIA_TYPE_VIDEO) { if (qt_id) { if (!codec->codec_tag) codec->codec_tag = ff_codec_get_tag(codec_movvideo_tags, codec->codec_id); if (codec->extradata_size) - put_buffer(dyn_cp, codec->extradata, codec->extradata_size); + avio_write(dyn_cp, codec->extradata, codec->extradata_size); } else { if (!codec->codec_tag) codec->codec_tag = ff_codec_get_tag(ff_codec_bmp_tags, codec->codec_id); @@ -522,7 +522,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodec static int mkv_write_tracks(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; ebml_master tracks; int i, j, ret; @@ -650,7 +650,7 @@ static int mkv_write_tracks(AVFormatContext *s) static int mkv_write_chapters(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; ebml_master chapters, editionentry; AVRational scale = {1, 1E9}; int i, ret; @@ -691,7 +691,7 @@ static int mkv_write_chapters(AVFormatContext *s) return 0; } -static void mkv_write_simpletag(ByteIOContext *pb, AVMetadataTag *t) +static void mkv_write_simpletag(AVIOContext *pb, AVMetadataTag *t) { uint8_t *key = av_strdup(t->key); uint8_t *p = key; @@ -790,7 +790,7 @@ static int mkv_write_tags(AVFormatContext *s) static int mkv_write_header(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; ebml_master ebml_header, segment_info; AVMetadataTag *tag; int ret, i; @@ -901,7 +901,7 @@ static int ass_get_duration(const uint8_t *p) return end - start; } -static int mkv_write_ass_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt) +static int mkv_write_ass_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) { MatroskaMuxContext *mkv = s->priv_data; int i, layer = 0, max_duration = 0, size, line_size, data_size = pkt->size; @@ -932,10 +932,10 @@ static int mkv_write_ass_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(size)); put_ebml_id(pb, MATROSKA_ID_BLOCK); put_ebml_num(pb, size+4, 0); - put_byte(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126 - put_be16(pb, pkt->pts - mkv->cluster_pts); - put_byte(pb, 0); - put_buffer(pb, buffer, size); + avio_w8(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126 + avio_wb16(pb, pkt->pts - mkv->cluster_pts); + avio_w8(pb, 0); + avio_write(pb, buffer, size); put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration); end_ebml_master(pb, blockgroup); @@ -946,7 +946,7 @@ static int mkv_write_ass_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket return max_duration; } -static void mkv_write_block(AVFormatContext *s, ByteIOContext *pb, +static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, unsigned int blockid, AVPacket *pkt, int flags) { MatroskaMuxContext *mkv = s->priv_data; @@ -965,10 +965,10 @@ static void mkv_write_block(AVFormatContext *s, ByteIOContext *pb, data = pkt->data; put_ebml_id(pb, blockid); put_ebml_num(pb, size+4, 0); - put_byte(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126 - put_be16(pb, ts - mkv->cluster_pts); - put_byte(pb, flags); - put_buffer(pb, data, size); + avio_w8(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126 + avio_wb16(pb, ts - mkv->cluster_pts); + avio_w8(pb, flags); + avio_write(pb, data, size); if (data != pkt->data) av_free(data); } @@ -992,7 +992,7 @@ static int srt_get_duration(uint8_t **buf) return duration; } -static int mkv_write_srt_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt) +static int mkv_write_srt_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) { ebml_master blockgroup; AVPacket pkt2 = *pkt; @@ -1018,7 +1018,7 @@ static void mkv_flush_dynbuf(AVFormatContext *s) return; bufsize = url_close_dyn_buf(mkv->dyn_bc, &dyn_buf); - put_buffer(s->pb, dyn_buf, bufsize); + avio_write(s->pb, dyn_buf, bufsize); av_free(dyn_buf); mkv->dyn_bc = NULL; } @@ -1026,7 +1026,7 @@ static void mkv_flush_dynbuf(AVFormatContext *s) static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt) { MatroskaMuxContext *mkv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *codec = s->streams[pkt->stream_index]->codec; int keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY); int duration = pkt->duration; @@ -1090,7 +1090,7 @@ static int mkv_copy_packet(MatroskaMuxContext *mkv, const AVPacket *pkt) static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt) { MatroskaMuxContext *mkv = s->priv_data; - ByteIOContext *pb = url_is_streamed(s->pb) ? mkv->dyn_bc : s->pb; + AVIOContext *pb = url_is_streamed(s->pb) ? mkv->dyn_bc : s->pb; AVCodecContext *codec = s->streams[pkt->stream_index]->codec; int ret, keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY); int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts; @@ -1132,7 +1132,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt) static int mkv_write_trailer(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t currentpos, cuespos; int ret; @@ -1163,10 +1163,10 @@ static int mkv_write_trailer(AVFormatContext *s) // update the duration av_log(s, AV_LOG_DEBUG, "end duration = %" PRIu64 "\n", mkv->duration); currentpos = url_ftell(pb); - url_fseek(pb, mkv->duration_offset, SEEK_SET); + avio_seek(pb, mkv->duration_offset, SEEK_SET); put_ebml_float(pb, MATROSKA_ID_DURATION, mkv->duration); - url_fseek(pb, currentpos, SEEK_SET); + avio_seek(pb, currentpos, SEEK_SET); } end_ebml_master(pb, mkv->segment); diff --git a/mplayer/ffmpeg/libavformat/md5enc.c b/mplayer/ffmpeg/libavformat/md5enc.c index dd2f7c03..065f7e8d 100644 --- a/mplayer/ffmpeg/libavformat/md5enc.c +++ b/mplayer/ffmpeg/libavformat/md5enc.c @@ -36,7 +36,7 @@ static void md5_finish(struct AVFormatContext *s, char *buf) buf[offset] = '\n'; buf[offset+1] = 0; - put_buffer(s->pb, buf, strlen(buf)); + avio_write(s->pb, buf, strlen(buf)); put_flush_packet(s->pb); } diff --git a/mplayer/ffmpeg/libavformat/mm.c b/mplayer/ffmpeg/libavformat/mm.c index 475930f8..699daac5 100644 --- a/mplayer/ffmpeg/libavformat/mm.c +++ b/mplayer/ffmpeg/libavformat/mm.c @@ -84,25 +84,25 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { MmDemuxContext *mm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; unsigned int type, length; unsigned int frame_rate, width, height; - type = get_le16(pb); - length = get_le32(pb); + type = avio_rl16(pb); + length = avio_rl32(pb); if (type != MM_TYPE_HEADER) return AVERROR_INVALIDDATA; /* read header */ - get_le16(pb); /* total number of chunks */ - frame_rate = get_le16(pb); - get_le16(pb); /* ibm-pc video bios mode */ - width = get_le16(pb); - height = get_le16(pb); - url_fseek(pb, length - 10, SEEK_CUR); /* unknown data */ + avio_rl16(pb); /* total number of chunks */ + frame_rate = avio_rl16(pb); + avio_rl16(pb); /* ibm-pc video bios mode */ + width = avio_rl16(pb); + height = avio_rl16(pb); + avio_seek(pb, length - 10, SEEK_CUR); /* unknown data */ /* video stream */ st = av_new_stream(s, 0); @@ -137,13 +137,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) { MmDemuxContext *mm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned char preamble[MM_PREAMBLE_SIZE]; unsigned int type, length; while(1) { - if (get_buffer(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) { + if (avio_read(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) { return AVERROR(EIO); } @@ -162,7 +162,7 @@ static int read_packet(AVFormatContext *s, if (av_new_packet(pkt, length + MM_PREAMBLE_SIZE)) return AVERROR(ENOMEM); memcpy(pkt->data, preamble, MM_PREAMBLE_SIZE); - if (get_buffer(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length) + if (avio_read(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length) return AVERROR(EIO); pkt->size = length + MM_PREAMBLE_SIZE; pkt->stream_index = 0; @@ -181,7 +181,7 @@ static int read_packet(AVFormatContext *s, default : av_log(s, AV_LOG_INFO, "unknown chunk type 0x%x\n", type); - url_fseek(pb, length, SEEK_CUR); + avio_seek(pb, length, SEEK_CUR); } } diff --git a/mplayer/ffmpeg/libavformat/mmf.c b/mplayer/ffmpeg/libavformat/mmf.c index 2b2af4df..a68870c1 100644 --- a/mplayer/ffmpeg/libavformat/mmf.c +++ b/mplayer/ffmpeg/libavformat/mmf.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" +#include "avio_internal.h" #include "pcm.h" #include "riff.h" @@ -47,20 +48,20 @@ static int mmf_rate_code(int rate) } /* Copy of end_tag() from avienc.c, but for big-endian chunk size */ -static void end_tag_be(ByteIOContext *pb, int64_t start) +static void end_tag_be(AVIOContext *pb, int64_t start) { int64_t pos; pos = url_ftell(pb); - url_fseek(pb, start - 4, SEEK_SET); - put_be32(pb, (uint32_t)(pos - start)); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, start - 4, SEEK_SET); + avio_wb32(pb, (uint32_t)(pos - start)); + avio_seek(pb, pos, SEEK_SET); } static int mmf_write_header(AVFormatContext *s) { MMFContext *mmf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos; int rate; @@ -70,32 +71,32 @@ static int mmf_write_header(AVFormatContext *s) return -1; } - put_tag(pb, "MMMD"); - put_be32(pb, 0); + ffio_wfourcc(pb, "MMMD"); + avio_wb32(pb, 0); pos = ff_start_tag(pb, "CNTI"); - put_byte(pb, 0); /* class */ - put_byte(pb, 0); /* type */ - put_byte(pb, 0); /* code type */ - put_byte(pb, 0); /* status */ - put_byte(pb, 0); /* counts */ - put_tag(pb, "VN:libavcodec,"); /* metadata ("ST:songtitle,VN:version,...") */ + avio_w8(pb, 0); /* class */ + avio_w8(pb, 0); /* type */ + avio_w8(pb, 0); /* code type */ + avio_w8(pb, 0); /* status */ + avio_w8(pb, 0); /* counts */ + avio_write(pb, "VN:libavcodec,", sizeof("VN:libavcodec,") -1); /* metadata ("ST:songtitle,VN:version,...") */ end_tag_be(pb, pos); - put_buffer(pb, "ATR\x00", 4); - put_be32(pb, 0); + avio_write(pb, "ATR\x00", 4); + avio_wb32(pb, 0); mmf->atrpos = url_ftell(pb); - put_byte(pb, 0); /* format type */ - put_byte(pb, 0); /* sequence type */ - put_byte(pb, (0 << 7) | (1 << 4) | rate); /* (channel << 7) | (format << 4) | rate */ - put_byte(pb, 0); /* wave base bit */ - put_byte(pb, 2); /* time base d */ - put_byte(pb, 2); /* time base g */ - - put_tag(pb, "Atsq"); - put_be32(pb, 16); + avio_w8(pb, 0); /* format type */ + avio_w8(pb, 0); /* sequence type */ + avio_w8(pb, (0 << 7) | (1 << 4) | rate); /* (channel << 7) | (format << 4) | rate */ + avio_w8(pb, 0); /* wave base bit */ + avio_w8(pb, 2); /* time base d */ + avio_w8(pb, 2); /* time base g */ + + ffio_wfourcc(pb, "Atsq"); + avio_wb32(pb, 16); mmf->atsqpos = url_ftell(pb); /* Will be filled on close */ - put_buffer(pb, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16); + avio_write(pb, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16); mmf->awapos = ff_start_tag(pb, "Awa\x01"); @@ -108,26 +109,26 @@ static int mmf_write_header(AVFormatContext *s) static int mmf_write_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; - put_buffer(pb, pkt->data, pkt->size); + AVIOContext *pb = s->pb; + avio_write(pb, pkt->data, pkt->size); return 0; } /* Write a variable-length symbol */ -static void put_varlength(ByteIOContext *pb, int val) +static void put_varlength(AVIOContext *pb, int val) { if(val < 128) - put_byte(pb, val); + avio_w8(pb, val); else { val -= 128; - put_byte(pb, 0x80 | val >> 7); - put_byte(pb, 0x7f & val); + avio_w8(pb, 0x80 | val >> 7); + avio_w8(pb, 0x7f & val); } } static int mmf_write_trailer(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; MMFContext *mmf = s->priv_data; int64_t pos, size; int gatetime; @@ -142,22 +143,22 @@ static int mmf_write_trailer(AVFormatContext *s) size = pos - mmf->awapos; /* Fill Atsq chunk */ - url_fseek(pb, mmf->atsqpos, SEEK_SET); + avio_seek(pb, mmf->atsqpos, SEEK_SET); /* "play wav" */ - put_byte(pb, 0); /* start time */ - put_byte(pb, 1); /* (channel << 6) | wavenum */ + avio_w8(pb, 0); /* start time */ + avio_w8(pb, 1); /* (channel << 6) | wavenum */ gatetime = size * 500 / s->streams[0]->codec->sample_rate; put_varlength(pb, gatetime); /* duration */ /* "nop" */ put_varlength(pb, gatetime); /* start time */ - put_buffer(pb, "\xff\x00", 2); /* nop */ + avio_write(pb, "\xff\x00", 2); /* nop */ /* "end of sequence" */ - put_buffer(pb, "\x00\x00\x00\x00", 4); + avio_write(pb, "\x00\x00\x00\x00", 4); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); put_flush_packet(pb); } @@ -183,20 +184,20 @@ static int mmf_read_header(AVFormatContext *s, { MMFContext *mmf = s->priv_data; unsigned int tag; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; int64_t file_size, size; int rate, params; - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag != MKTAG('M', 'M', 'M', 'D')) return -1; - file_size = get_be32(pb); + file_size = avio_rb32(pb); /* Skip some unused chunks that may or may not be present */ - for(;; url_fseek(pb, size, SEEK_CUR)) { - tag = get_le32(pb); - size = get_be32(pb); + for(;; avio_seek(pb, size, SEEK_CUR)) { + tag = avio_rl32(pb); + size = avio_rb32(pb); if(tag == MKTAG('C','N','T','I')) continue; if(tag == MKTAG('O','P','D','A')) continue; break; @@ -212,22 +213,22 @@ static int mmf_read_header(AVFormatContext *s, return -1; } - get_byte(pb); /* format type */ - get_byte(pb); /* sequence type */ - params = get_byte(pb); /* (channel << 7) | (format << 4) | rate */ + avio_r8(pb); /* format type */ + avio_r8(pb); /* sequence type */ + params = avio_r8(pb); /* (channel << 7) | (format << 4) | rate */ rate = mmf_rate(params & 0x0f); if(rate < 0) { av_log(s, AV_LOG_ERROR, "Invalid sample rate\n"); return -1; } - get_byte(pb); /* wave base bit */ - get_byte(pb); /* time base d */ - get_byte(pb); /* time base g */ + avio_r8(pb); /* wave base bit */ + avio_r8(pb); /* time base d */ + avio_r8(pb); /* time base g */ /* Skip some unused chunks that may or may not be present */ - for(;; url_fseek(pb, size, SEEK_CUR)) { - tag = get_le32(pb); - size = get_be32(pb); + for(;; avio_seek(pb, size, SEEK_CUR)) { + tag = avio_rl32(pb); + size = avio_rb32(pb); if(tag == MKTAG('A','t','s','q')) continue; if(tag == MKTAG('A','s','p','I')) continue; break; @@ -280,7 +281,7 @@ static int mmf_read_packet(AVFormatContext *s, return AVERROR(EIO); pkt->stream_index = 0; - ret = get_buffer(s->pb, pkt->data, pkt->size); + ret = avio_read(s->pb, pkt->data, pkt->size); if (ret < 0) av_free_packet(pkt); diff --git a/mplayer/ffmpeg/libavformat/mms.c b/mplayer/ffmpeg/libavformat/mms.c index d995a43a..b541208e 100644 --- a/mplayer/ffmpeg/libavformat/mms.c +++ b/mplayer/ffmpeg/libavformat/mms.c @@ -115,6 +115,34 @@ int ff_mms_asf_header_parser(MMSContext *mms) "Corrupt stream (too many A/V streams)\n"); return AVERROR_INVALIDDATA; } + } else if (!memcmp(p, ff_asf_ext_stream_header, sizeof(ff_asf_guid))) { + if (end - p >= 88) { + int stream_count = AV_RL16(p + 84), ext_len_count = AV_RL16(p + 86); + uint64_t skip_bytes = 88; + while (stream_count--) { + if (end - p < skip_bytes + 4) { + av_log(NULL, AV_LOG_ERROR, + "Corrupt stream (next stream name length is not in the buffer)\n"); + return AVERROR_INVALIDDATA; + } + skip_bytes += 4 + AV_RL16(p + skip_bytes + 2); + } + while (ext_len_count--) { + if (end - p < skip_bytes + 22) { + av_log(NULL, AV_LOG_ERROR, + "Corrupt stream (next extension system info length is not in the buffer)\n"); + return AVERROR_INVALIDDATA; + } + skip_bytes += 22 + AV_RL32(p + skip_bytes + 18); + } + if (end - p < skip_bytes) { + av_log(NULL, AV_LOG_ERROR, + "Corrupt stream (the last extension system info length is invalid)\n"); + return AVERROR_INVALIDDATA; + } + if (chunksize - skip_bytes > 24) + chunksize = skip_bytes; + } } else if (!memcmp(p, ff_asf_head1_guid, sizeof(ff_asf_guid))) { chunksize = 46; // see references [2] section 3.4. This should be set 46. } diff --git a/mplayer/ffmpeg/libavformat/mmst.c b/mplayer/ffmpeg/libavformat/mmst.c index 8464d3b3..e3af4bfb 100644 --- a/mplayer/ffmpeg/libavformat/mmst.c +++ b/mplayer/ffmpeg/libavformat/mmst.c @@ -31,6 +31,7 @@ #include "avformat.h" #include "mms.h" #include "internal.h" +#include "avio_internal.h" #include "libavutil/intreadwrite.h" #include "libavcodec/bytestream.h" #include "network.h" @@ -152,10 +153,10 @@ static int send_command_packet(MMSTContext *mmst) static void mms_put_utf16(MMSContext *mms, uint8_t *src) { - ByteIOContext bic; + AVIOContext bic; int size = mms->write_out_ptr - mms->out_buffer; int len; - init_put_byte(&bic, mms->write_out_ptr, + ffio_init_context(&bic, mms->write_out_ptr, sizeof(mms->out_buffer) - size, 1, NULL, NULL, NULL, NULL); len = avio_put_str16le(&bic, src); @@ -290,10 +291,9 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) return read_result < 0 ? read_result : AVERROR_IO; } packet_type= AV_RL16(mms->in_buffer+36); - hr = AV_RL32(mms->in_buffer + 40); - if (hr) { + if (read_result >= 44 && (hr = AV_RL32(mms->in_buffer + 40))) { av_log(NULL, AV_LOG_ERROR, - "Server sent an error status code: 0x%08x\n", hr); + "Server sent a message with packet type 0x%x and error status code 0x%08x\n", packet_type, hr); return AVERROR_UNKNOWN; } } else { diff --git a/mplayer/ffmpeg/libavformat/mov.c b/mplayer/ffmpeg/libavformat/mov.c index a48000fe..537b9c6f 100644 --- a/mplayer/ffmpeg/libavformat/mov.c +++ b/mplayer/ffmpeg/libavformat/mov.c @@ -29,6 +29,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/avstring.h" #include "avformat.h" +#include "avio_internal.h" #include "riff.h" #include "isom.h" #include "libavcodec/get_bits.h" @@ -73,20 +74,20 @@ /* links atom IDs to parse functions */ typedef struct MOVParseTableEntry { uint32_t type; - int (*parse)(MOVContext *ctx, ByteIOContext *pb, MOVAtom atom); + int (*parse)(MOVContext *ctx, AVIOContext *pb, MOVAtom atom); } MOVParseTableEntry; static const MOVParseTableEntry mov_default_parse_table[]; -static int mov_metadata_trkn(MOVContext *c, ByteIOContext *pb, unsigned len) +static int mov_metadata_trkn(MOVContext *c, AVIOContext *pb, unsigned len) { char buf[16]; - get_be16(pb); // unknown - snprintf(buf, sizeof(buf), "%d", get_be16(pb)); + avio_rb16(pb); // unknown + snprintf(buf, sizeof(buf), "%d", avio_rb16(pb)); av_metadata_set2(&c->fc->metadata, "track", buf, 0); - get_be16(pb); // total tracks + avio_rb16(pb); // total tracks return 0; } @@ -110,7 +111,7 @@ static const uint32_t mac_to_unicode[128] = { 0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7, }; -static int mov_read_mac_string(MOVContext *c, ByteIOContext *pb, int len, +static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len, char *dst, int dstlen) { char *p = dst; @@ -118,7 +119,7 @@ static int mov_read_mac_string(MOVContext *c, ByteIOContext *pb, int len, int i; for (i = 0; i < len; i++) { - uint8_t t, c = get_byte(pb); + uint8_t t, c = avio_r8(pb); if (c < 0x80 && p < end) *p++ = c; else @@ -128,7 +129,7 @@ static int mov_read_mac_string(MOVContext *c, ByteIOContext *pb, int len, return p - dst; } -static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) { #ifdef MOV_EXPORT_ALL_METADATA char tmp_key[5]; @@ -137,7 +138,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom) const char *key = NULL; uint16_t str_size, langcode = 0; uint32_t data_type = 0; - int (*parse)(MOVContext*, ByteIOContext*, unsigned) = NULL; + int (*parse)(MOVContext*, AVIOContext*, unsigned) = NULL; switch (atom.type) { case MKTAG(0xa9,'n','a','m'): key = "title"; break; @@ -164,17 +165,17 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom) } if (c->itunes_metadata && atom.size > 8) { - int data_size = get_be32(pb); - int tag = get_le32(pb); + int data_size = avio_rb32(pb); + int tag = avio_rl32(pb); if (tag == MKTAG('d','a','t','a')) { - data_type = get_be32(pb); // type - get_be32(pb); // unknown + data_type = avio_rb32(pb); // type + avio_rb32(pb); // unknown str_size = data_size - 16; atom.size -= 16; } else return 0; } else if (atom.size > 4 && key && !c->itunes_metadata) { - str_size = get_be16(pb); // string length - langcode = get_be16(pb); + str_size = avio_rb16(pb); // string length + langcode = avio_rb16(pb); ff_mov_lang_to_iso639(langcode, language); atom.size -= 4; } else @@ -200,7 +201,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom) if (data_type == 3 || (data_type == 0 && langcode < 0x800)) { // MAC Encoded mov_read_mac_string(c, pb, str_size, str, sizeof(str)); } else { - get_buffer(pb, str, str_size); + avio_read(pb, str, str_size); str[str_size] = 0; } av_metadata_set2(&c->fc->metadata, key, str, 0); @@ -218,7 +219,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_chpl(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_chpl(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int64_t start; int i, nb_chapters, str_len, version; @@ -227,30 +228,30 @@ static int mov_read_chpl(MOVContext *c, ByteIOContext *pb, MOVAtom atom) if ((atom.size -= 5) < 0) return 0; - version = get_byte(pb); - get_be24(pb); + version = avio_r8(pb); + avio_rb24(pb); if (version) - get_be32(pb); // ??? - nb_chapters = get_byte(pb); + avio_rb32(pb); // ??? + nb_chapters = avio_r8(pb); for (i = 0; i < nb_chapters; i++) { if (atom.size < 9) return 0; - start = get_be64(pb); - str_len = get_byte(pb); + start = avio_rb64(pb); + str_len = avio_r8(pb); if ((atom.size -= 9+str_len) < 0) return 0; - get_buffer(pb, str, str_len); + avio_read(pb, str, str_len); str[str_len] = 0; ff_new_chapter(c->fc, i, (AVRational){1,10000000}, start, AV_NOPTS_VALUE, str); } return 0; } -static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int64_t total_size = 0; MOVAtom a; @@ -259,18 +260,18 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom) if (atom.size < 0) atom.size = INT64_MAX; while (total_size + 8 < atom.size && !url_feof(pb)) { - int (*parse)(MOVContext*, ByteIOContext*, MOVAtom) = NULL; + int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL; a.size = atom.size; a.type=0; if(atom.size >= 8) { - a.size = get_be32(pb); - a.type = get_le32(pb); + a.size = avio_rb32(pb); + a.type = avio_rl32(pb); } av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n", a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size); total_size += 8; if (a.size == 1) { /* 64 bit extended size */ - a.size = get_be64(pb) - 8; + a.size = avio_rb64(pb) - 8; total_size += 8; } if (a.size == 0) { @@ -295,7 +296,7 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom) parse = mov_read_udta_string; if (!parse) { /* skip leaf atoms data */ - url_fskip(pb, a.size); + avio_seek(pb, a.size, SEEK_CUR); } else { int64_t start_pos = url_ftell(pb); int64_t left; @@ -307,19 +308,19 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; left = a.size - url_ftell(pb) + start_pos; if (left > 0) /* skip garbage at atom end */ - url_fskip(pb, left); + avio_seek(pb, left, SEEK_CUR); } total_size += a.size; } if (total_size < atom.size && atom.size < 0x7ffff) - url_fskip(pb, atom.size - total_size); + avio_seek(pb, atom.size - total_size, SEEK_CUR); return 0; } -static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -330,8 +331,8 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_be32(pb); // version + flags - entries = get_be32(pb); + avio_rb32(pb); // version + flags + entries = avio_rb32(pb); if (entries >= UINT_MAX / sizeof(*sc->drefs)) return -1; sc->drefs = av_mallocz(entries * sizeof(*sc->drefs)); @@ -341,14 +342,14 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom) for (i = 0; i < sc->drefs_count; i++) { MOVDref *dref = &sc->drefs[i]; - uint32_t size = get_be32(pb); + uint32_t size = avio_rb32(pb); int64_t next = url_ftell(pb) + size - 4; if (size < 12) return -1; - dref->type = get_le32(pb); - get_be32(pb); // version + flags + dref->type = avio_rl32(pb); + avio_rb32(pb); // version + flags av_dlog(c->fc, "type %.4s size %d\n", (char*)&dref->type, size); if (dref->type == MKTAG('a','l','i','s') && size > 150) { @@ -356,35 +357,35 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom) uint16_t volume_len, len; int16_t type; - url_fskip(pb, 10); + avio_seek(pb, 10, SEEK_CUR); - volume_len = get_byte(pb); + volume_len = avio_r8(pb); volume_len = FFMIN(volume_len, 27); - get_buffer(pb, dref->volume, 27); + avio_read(pb, dref->volume, 27); dref->volume[volume_len] = 0; av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len); - url_fskip(pb, 12); + avio_seek(pb, 12, SEEK_CUR); - len = get_byte(pb); + len = avio_r8(pb); len = FFMIN(len, 63); - get_buffer(pb, dref->filename, 63); + avio_read(pb, dref->filename, 63); dref->filename[len] = 0; av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len); - url_fskip(pb, 16); + avio_seek(pb, 16, SEEK_CUR); /* read next level up_from_alias/down_to_target */ - dref->nlvl_from = get_be16(pb); - dref->nlvl_to = get_be16(pb); + dref->nlvl_from = avio_rb16(pb); + dref->nlvl_to = avio_rb16(pb); av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n", dref->nlvl_from, dref->nlvl_to); - url_fskip(pb, 16); + avio_seek(pb, 16, SEEK_CUR); for (type = 0; type != -1 && url_ftell(pb) < next; ) { - type = get_be16(pb); - len = get_be16(pb); + type = avio_rb16(pb); + len = avio_rb16(pb); av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); if (len&1) len += 1; @@ -393,7 +394,7 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom) dref->path = av_mallocz(len+1); if (!dref->path) return AVERROR(ENOMEM); - get_buffer(pb, dref->path, len); + avio_read(pb, dref->path, len); if (len > volume_len && !strncmp(dref->path, dref->volume, volume_len)) { len -= volume_len; memmove(dref->path, dref->path+volume_len, len); @@ -408,22 +409,22 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom) dref->dir = av_malloc(len+1); if (!dref->dir) return AVERROR(ENOMEM); - get_buffer(pb, dref->dir, len); + avio_read(pb, dref->dir, len); dref->dir[len] = 0; for (j = 0; j < len; j++) if (dref->dir[j] == ':') dref->dir[j] = '/'; av_log(c->fc, AV_LOG_DEBUG, "dir %s\n", dref->dir); } else - url_fskip(pb, len); + avio_seek(pb, len, SEEK_CUR); } } - url_fseek(pb, next, SEEK_SET); + avio_seek(pb, next, SEEK_SET); } return 0; } -static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; uint32_t type; @@ -434,12 +435,12 @@ static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ /* component type */ - ctype = get_le32(pb); - type = get_le32(pb); /* component subtype */ + ctype = avio_rl32(pb); + type = avio_rl32(pb); /* component subtype */ av_dlog(c->fc, "ctype= %.4s (0x%08x)\n", (char*)&ctype, ctype); av_dlog(c->fc, "stype= %.4s\n", (char*)&type); @@ -453,14 +454,14 @@ static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom) else if(type == MKTAG('s','u','b','p')) st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; - get_be32(pb); /* component manufacture */ - get_be32(pb); /* component flags */ - get_be32(pb); /* component flags mask */ + avio_rb32(pb); /* component manufacture */ + avio_rb32(pb); /* component flags */ + avio_rb32(pb); /* component flags mask */ return 0; } -int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom) +int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom) { AVStream *st; int tag, len; @@ -469,13 +470,13 @@ int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom) return 0; st = fc->streams[fc->nb_streams-1]; - get_be32(pb); /* version + flags */ + avio_rb32(pb); /* version + flags */ len = ff_mp4_read_descr(fc, pb, &tag); if (tag == MP4ESDescrTag) { - get_be16(pb); /* ID */ - get_byte(pb); /* priority */ + avio_rb16(pb); /* ID */ + avio_r8(pb); /* priority */ } else - get_be16(pb); /* ID */ + avio_rb16(pb); /* ID */ len = ff_mp4_read_descr(fc, pb, &tag); if (tag == MP4DecConfigDescrTag) @@ -483,12 +484,12 @@ int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_esds(MOVContext *c, AVIOContext *pb, MOVAtom atom) { return ff_mov_read_esds(c->fc, pb, atom); } -static int mov_read_dac3(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; int ac3info, acmod, lfeon; @@ -497,7 +498,7 @@ static int mov_read_dac3(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; st = c->fc->streams[c->fc->nb_streams-1]; - ac3info = get_be24(pb); + ac3info = avio_rb24(pb); acmod = (ac3info >> 11) & 0x7; lfeon = (ac3info >> 10) & 0x1; st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon; @@ -505,10 +506,10 @@ static int mov_read_dac3(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom) { - const int num = get_be32(pb); - const int den = get_be32(pb); + const int num = avio_rb32(pb); + const int den = avio_rb32(pb); AVStream *st; if (c->fc->nb_streams < 1) @@ -529,7 +530,7 @@ static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) } /* this atom contains actual media data */ -static int mov_read_mdat(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_mdat(MOVContext *c, AVIOContext *pb, MOVAtom atom) { if(atom.size == 0) /* wrong one (MP4) */ return 0; @@ -538,7 +539,7 @@ static int mov_read_mdat(MOVContext *c, ByteIOContext *pb, MOVAtom atom) } /* read major brand, minor version and compatible brands and store them as metadata */ -static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom) { uint32_t minor_ver; int comp_brand_size; @@ -546,12 +547,12 @@ static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) char* comp_brands_str; uint8_t type[5] = {0}; - get_buffer(pb, type, 4); + avio_read(pb, type, 4); if (strcmp(type, "qt ")) c->isom = 1; av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char *)&type); av_metadata_set2(&c->fc->metadata, "major_brand", type, 0); - minor_ver = get_be32(pb); /* minor version */ + minor_ver = avio_rb32(pb); /* minor version */ snprintf(minor_ver_str, sizeof(minor_ver_str), "%d", minor_ver); av_metadata_set2(&c->fc->metadata, "minor_version", minor_ver_str, 0); @@ -561,7 +562,7 @@ static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) comp_brands_str = av_malloc(comp_brand_size + 1); /* Add null terminator */ if (!comp_brands_str) return AVERROR(ENOMEM); - get_buffer(pb, comp_brands_str, comp_brand_size); + avio_read(pb, comp_brands_str, comp_brand_size); comp_brands_str[comp_brand_size] = 0; av_metadata_set2(&c->fc->metadata, "compatible_brands", comp_brands_str, 0); av_freep(&comp_brands_str); @@ -570,7 +571,7 @@ static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) } /* this atom should contain all header atoms */ -static int mov_read_moov(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_moov(MOVContext *c, AVIOContext *pb, MOVAtom atom) { if (mov_read_default(c, pb, atom) < 0) return -1; @@ -580,7 +581,7 @@ static int mov_read_moov(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; /* now go for mdat */ } -static int mov_read_moof(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom) { c->fragment.moof_offset = url_ftell(pb) - 8; av_dlog(c->fc, "moof offset %llx\n", c->fragment.moof_offset); @@ -600,7 +601,7 @@ static void mov_metadata_creation_time(AVMetadata **metadata, time_t time) } } -static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -614,70 +615,70 @@ static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - version = get_byte(pb); + version = avio_r8(pb); if (version > 1) return -1; /* unsupported */ - get_be24(pb); /* flags */ + avio_rb24(pb); /* flags */ if (version == 1) { - creation_time = get_be64(pb); - get_be64(pb); + creation_time = avio_rb64(pb); + avio_rb64(pb); } else { - creation_time = get_be32(pb); - get_be32(pb); /* modification time */ + creation_time = avio_rb32(pb); + avio_rb32(pb); /* modification time */ } mov_metadata_creation_time(&st->metadata, creation_time); - sc->time_scale = get_be32(pb); - st->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */ + sc->time_scale = avio_rb32(pb); + st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ - lang = get_be16(pb); /* language */ + lang = avio_rb16(pb); /* language */ if (ff_mov_lang_to_iso639(lang, language)) av_metadata_set2(&st->metadata, "language", language, 0); - get_be16(pb); /* quality */ + avio_rb16(pb); /* quality */ return 0; } -static int mov_read_mvhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { time_t creation_time; - int version = get_byte(pb); /* version */ - get_be24(pb); /* flags */ + int version = avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ if (version == 1) { - creation_time = get_be64(pb); - get_be64(pb); + creation_time = avio_rb64(pb); + avio_rb64(pb); } else { - creation_time = get_be32(pb); - get_be32(pb); /* modification time */ + creation_time = avio_rb32(pb); + avio_rb32(pb); /* modification time */ } mov_metadata_creation_time(&c->fc->metadata, creation_time); - c->time_scale = get_be32(pb); /* time scale */ + c->time_scale = avio_rb32(pb); /* time scale */ av_dlog(c->fc, "time scale = %i\n", c->time_scale); - c->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */ - get_be32(pb); /* preferred scale */ + c->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ + avio_rb32(pb); /* preferred scale */ - get_be16(pb); /* preferred volume */ + avio_rb16(pb); /* preferred volume */ - url_fskip(pb, 10); /* reserved */ + avio_seek(pb, 10, SEEK_CUR); /* reserved */ - url_fskip(pb, 36); /* display matrix */ + avio_seek(pb, 36, SEEK_CUR); /* display matrix */ - get_be32(pb); /* preview time */ - get_be32(pb); /* preview duration */ - get_be32(pb); /* poster time */ - get_be32(pb); /* selection time */ - get_be32(pb); /* selection duration */ - get_be32(pb); /* current time */ - get_be32(pb); /* next track ID */ + avio_rb32(pb); /* preview time */ + avio_rb32(pb); /* preview duration */ + avio_rb32(pb); /* poster time */ + avio_rb32(pb); /* selection time */ + avio_rb32(pb); /* selection duration */ + avio_rb32(pb); /* current time */ + avio_rb32(pb); /* next track ID */ return 0; } -static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_smi(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; @@ -696,12 +697,12 @@ static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return AVERROR(ENOMEM); st->codec->extradata_size = 0x5a + atom.size; memcpy(st->codec->extradata, "SVQ3", 4); // fake - get_buffer(pb, st->codec->extradata + 0x5a, atom.size); + avio_read(pb, st->codec->extradata + 0x5a, atom.size); av_dlog(c->fc, "Reading SMI %"PRId64" %s\n", atom.size, st->codec->extradata + 0x5a); return 0; } -static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; int little_endian; @@ -710,7 +711,7 @@ static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; st = c->fc->streams[c->fc->nb_streams-1]; - little_endian = get_be16(pb); + little_endian = avio_rb16(pb); av_dlog(c->fc, "enda %d\n", little_endian); if (little_endian == 1) { switch (st->codec->codec_id) { @@ -734,7 +735,7 @@ static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom) } /* FIXME modify qdm2/svq3/h264 decoders to take full atom as extradata */ -static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; uint64_t size; @@ -754,11 +755,11 @@ static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom) st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE; AV_WB32( buf , atom.size + 8); AV_WL32( buf + 4, atom.type); - get_buffer(pb, buf + 8, atom.size); + avio_read(pb, buf + 8, atom.size); return 0; } -static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; @@ -769,19 +770,19 @@ static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOVAtom atom) if((uint64_t)atom.size > (1<<30)) return -1; - if (st->codec->codec_id == CODEC_ID_QDM2) { - // pass all frma atom to codec, needed at least for QDM2 + if (st->codec->codec_id == CODEC_ID_QDM2 || st->codec->codec_id == CODEC_ID_QDMC) { + // pass all frma atom to codec, needed at least for QDMC and QDM2 av_free(st->codec->extradata); st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size; - get_buffer(pb, st->codec->extradata, atom.size); + avio_read(pb, st->codec->extradata, atom.size); } else if (atom.size > 8) { /* to read frma, esds atoms */ if (mov_read_default(c, pb, atom) < 0) return -1; } else - url_fskip(pb, atom.size); + avio_seek(pb, atom.size, SEEK_CUR); return 0; } @@ -789,7 +790,7 @@ static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOVAtom atom) * This function reads atom content and puts data in extradata without tag * nor size unlike mov_read_extradata. */ -static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; @@ -805,7 +806,7 @@ static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom) if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size; - get_buffer(pb, st->codec->extradata, atom.size); + avio_read(pb, st->codec->extradata, atom.size); return 0; } @@ -814,7 +815,7 @@ static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom) * but can have extradata appended at the end after the 40 bytes belonging * to the struct. */ -static int mov_read_strf(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; @@ -832,12 +833,12 @@ static int mov_read_strf(MOVContext *c, ByteIOContext *pb, MOVAtom atom) if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size - 40; - url_fskip(pb, 40); - get_buffer(pb, st->codec->extradata, atom.size - 40); + avio_seek(pb, 40, SEEK_CUR); + avio_read(pb, st->codec->extradata, atom.size - 40); return 0; } -static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -848,10 +849,10 @@ static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ - entries = get_be32(pb); + entries = avio_rb32(pb); if(entries >= UINT_MAX/sizeof(int64_t)) return -1; @@ -863,10 +864,10 @@ static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom) if (atom.type == MKTAG('s','t','c','o')) for(i=0; ichunk_offsets[i] = get_be32(pb); + sc->chunk_offsets[i] = avio_rb32(pb); else if (atom.type == MKTAG('c','o','6','4')) for(i=0; ichunk_offsets[i] = get_be64(pb); + sc->chunk_offsets[i] = avio_rb64(pb); else return -1; @@ -908,7 +909,7 @@ enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags) return CODEC_ID_NONE; } -int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) +int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) { AVStream *st; MOVStreamContext *sc; @@ -925,13 +926,13 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) int dref_id = 1; MOVAtom a = { AV_RL32("stsd") }; int64_t start_pos = url_ftell(pb); - int size = get_be32(pb); /* size */ - uint32_t format = get_le32(pb); /* data format */ + int size = avio_rb32(pb); /* size */ + uint32_t format = avio_rl32(pb); /* data format */ if (size >= 16) { - get_be32(pb); /* reserved */ - get_be16(pb); /* reserved */ - dref_id = get_be16(pb); + avio_rb32(pb); /* reserved */ + avio_rb16(pb); /* reserved */ + dref_id = avio_rb16(pb); } if (st->codec->codec_tag && @@ -944,7 +945,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) * in the MOV demuxer, patch welcome. */ multiple_stsd: av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n"); - url_fskip(pb, size - (url_ftell(pb) - start_pos)); + avio_seek(pb, size - (url_ftell(pb) - start_pos), SEEK_CUR); continue; } /* we cannot demux concatenated h264 streams because of different extradata */ @@ -983,32 +984,32 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) int color_greyscale; st->codec->codec_id = id; - get_be16(pb); /* version */ - get_be16(pb); /* revision level */ - get_be32(pb); /* vendor */ - get_be32(pb); /* temporal quality */ - get_be32(pb); /* spatial quality */ + avio_rb16(pb); /* version */ + avio_rb16(pb); /* revision level */ + avio_rb32(pb); /* vendor */ + avio_rb32(pb); /* temporal quality */ + avio_rb32(pb); /* spatial quality */ - st->codec->width = get_be16(pb); /* width */ - st->codec->height = get_be16(pb); /* height */ + st->codec->width = avio_rb16(pb); /* width */ + st->codec->height = avio_rb16(pb); /* height */ - get_be32(pb); /* horiz resolution */ - get_be32(pb); /* vert resolution */ - get_be32(pb); /* data size, always 0 */ - get_be16(pb); /* frames per samples */ + avio_rb32(pb); /* horiz resolution */ + avio_rb32(pb); /* vert resolution */ + avio_rb32(pb); /* data size, always 0 */ + avio_rb16(pb); /* frames per samples */ - len = get_byte(pb); /* codec name, pascal string */ + len = avio_r8(pb); /* codec name, pascal string */ if (len > 31) len = 31; mov_read_mac_string(c, pb, len, st->codec->codec_name, 32); if (len < 31) - url_fskip(pb, 31 - len); + avio_seek(pb, 31 - len, SEEK_CUR); /* codec_tag YV12 triggers an UV swap in rawdec.c */ if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) st->codec->codec_tag=MKTAG('I', '4', '2', '0'); - st->codec->bits_per_coded_sample = get_be16(pb); /* depth */ - st->codec->color_table_id = get_be16(pb); /* colortable id */ + st->codec->bits_per_coded_sample = avio_rb16(pb); /* depth */ + st->codec->color_table_id = avio_rb16(pb); /* colortable id */ av_dlog(c->fc, "depth %d, ctab id %d\n", st->codec->bits_per_coded_sample, st->codec->color_table_id); /* figure out the palette situation */ @@ -1058,23 +1059,23 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) } } else { /* load the palette from the file */ - color_start = get_be32(pb); - color_count = get_be16(pb); - color_end = get_be16(pb); + color_start = avio_rb32(pb); + color_count = avio_rb16(pb); + color_end = avio_rb16(pb); if ((color_start <= 255) && (color_end <= 255)) { for (j = color_start; j <= color_end; j++) { /* each R, G, or B component is 16 bits; * only use the top 8 bits; skip alpha bytes * up front */ - get_byte(pb); - get_byte(pb); - r = get_byte(pb); - get_byte(pb); - g = get_byte(pb); - get_byte(pb); - b = get_byte(pb); - get_byte(pb); + avio_r8(pb); + avio_r8(pb); + r = avio_r8(pb); + avio_r8(pb); + g = avio_r8(pb); + avio_r8(pb); + b = avio_r8(pb); + avio_r8(pb); st->codec->palctrl->palette[j] = (r << 16) | (g << 8) | (b); } @@ -1084,38 +1085,38 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) } } else if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO) { int bits_per_sample, flags; - uint16_t version = get_be16(pb); + uint16_t version = avio_rb16(pb); st->codec->codec_id = id; - get_be16(pb); /* revision level */ - get_be32(pb); /* vendor */ + avio_rb16(pb); /* revision level */ + avio_rb32(pb); /* vendor */ - st->codec->channels = get_be16(pb); /* channel count */ + st->codec->channels = avio_rb16(pb); /* channel count */ av_dlog(c->fc, "audio channels %d\n", st->codec->channels); - st->codec->bits_per_coded_sample = get_be16(pb); /* sample size */ + st->codec->bits_per_coded_sample = avio_rb16(pb); /* sample size */ - sc->audio_cid = get_be16(pb); - get_be16(pb); /* packet size = 0 */ + sc->audio_cid = avio_rb16(pb); + avio_rb16(pb); /* packet size = 0 */ - st->codec->sample_rate = ((get_be32(pb) >> 16)); + st->codec->sample_rate = ((avio_rb32(pb) >> 16)); //Read QT version 1 fields. In version 0 these do not exist. av_dlog(c->fc, "version =%d, isom =%d\n",version,c->isom); if(!c->isom) { if(version==1) { - sc->samples_per_frame = get_be32(pb); - get_be32(pb); /* bytes per packet */ - sc->bytes_per_frame = get_be32(pb); - get_be32(pb); /* bytes per sample */ + sc->samples_per_frame = avio_rb32(pb); + avio_rb32(pb); /* bytes per packet */ + sc->bytes_per_frame = avio_rb32(pb); + avio_rb32(pb); /* bytes per sample */ } else if(version==2) { - get_be32(pb); /* sizeof struct only */ - st->codec->sample_rate = av_int2dbl(get_be64(pb)); /* float 64 */ - st->codec->channels = get_be32(pb); - get_be32(pb); /* always 0x7F000000 */ - st->codec->bits_per_coded_sample = get_be32(pb); /* bits per channel if sound is uncompressed */ - flags = get_be32(pb); /* lpcm format specific flag */ - sc->bytes_per_frame = get_be32(pb); /* bytes per audio packet if constant */ - sc->samples_per_frame = get_be32(pb); /* lpcm frames per audio packet if constant */ + avio_rb32(pb); /* sizeof struct only */ + st->codec->sample_rate = av_int2dbl(avio_rb64(pb)); /* float 64 */ + st->codec->channels = avio_rb32(pb); + avio_rb32(pb); /* always 0x7F000000 */ + st->codec->bits_per_coded_sample = avio_rb32(pb); /* bits per channel if sound is uncompressed */ + flags = avio_rb32(pb); /* lpcm format specific flag */ + sc->bytes_per_frame = avio_rb32(pb); /* bytes per audio packet if constant */ + sc->samples_per_frame = avio_rb32(pb); /* lpcm frames per audio packet if constant */ if (format == MKTAG('l','p','c','m')) st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags); } @@ -1173,7 +1174,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) st->codec->height = sc->height; } else { /* other codec type, just skip (rtp, mp4s, tmcd ...) */ - url_fskip(pb, size - (url_ftell(pb) - start_pos)); + avio_seek(pb, size - (url_ftell(pb) - start_pos), SEEK_CUR); } /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */ a.size = size - (url_ftell(pb) - start_pos); @@ -1181,7 +1182,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) if (mov_read_default(c, pb, a) < 0) return -1; } else if (a.size > 0) - url_fskip(pb, a.size); + avio_seek(pb, a.size, SEEK_CUR); } if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1) @@ -1244,18 +1245,18 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) return 0; } -static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int entries; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ - entries = get_be32(pb); + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ + entries = avio_rb32(pb); return ff_mov_read_stsd_entries(c, pb, entries); } -static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -1266,10 +1267,10 @@ static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ - entries = get_be32(pb); + entries = avio_rb32(pb); av_dlog(c->fc, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries); @@ -1281,14 +1282,14 @@ static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom) sc->stsc_count = entries; for(i=0; istsc_data[i].first = get_be32(pb); - sc->stsc_data[i].count = get_be32(pb); - sc->stsc_data[i].id = get_be32(pb); + sc->stsc_data[i].first = avio_rb32(pb); + sc->stsc_data[i].count = avio_rb32(pb); + sc->stsc_data[i].id = avio_rb32(pb); } return 0; } -static int mov_read_stps(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -1299,9 +1300,9 @@ static int mov_read_stps(MOVContext *c, ByteIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_be32(pb); // version + flags + avio_rb32(pb); // version + flags - entries = get_be32(pb); + entries = avio_rb32(pb); if (entries >= UINT_MAX / sizeof(*sc->stps_data)) return -1; sc->stps_data = av_malloc(entries * sizeof(*sc->stps_data)); @@ -1310,14 +1311,14 @@ static int mov_read_stps(MOVContext *c, ByteIOContext *pb, MOVAtom atom) sc->stps_count = entries; for (i = 0; i < entries; i++) { - sc->stps_data[i] = get_be32(pb); + sc->stps_data[i] = avio_rb32(pb); //av_dlog(c->fc, "stps %d\n", sc->stps_data[i]); } return 0; } -static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -1328,10 +1329,10 @@ static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ - entries = get_be32(pb); + entries = avio_rb32(pb); av_dlog(c->fc, "keyframe_count = %d\n", entries); @@ -1343,13 +1344,13 @@ static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom) sc->keyframe_count = entries; for(i=0; ikeyframes[i] = get_be32(pb); + sc->keyframes[i] = avio_rb32(pb); //av_dlog(c->fc, "keyframes[]=%d\n", sc->keyframes[i]); } return 0; } -static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -1362,20 +1363,20 @@ static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ if (atom.type == MKTAG('s','t','s','z')) { - sample_size = get_be32(pb); + sample_size = avio_rb32(pb); if (!sc->sample_size) /* do not overwrite value computed in stsd */ sc->sample_size = sample_size; field_size = 32; } else { sample_size = 0; - get_be24(pb); /* reserved */ - field_size = get_byte(pb); + avio_rb24(pb); /* reserved */ + field_size = avio_r8(pb); } - entries = get_be32(pb); + entries = avio_rb32(pb); av_dlog(c->fc, "sample_size = %d sample_count = %d\n", sc->sample_size, entries); @@ -1402,7 +1403,7 @@ static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return AVERROR(ENOMEM); } - if (get_buffer(pb, buf, num_bytes) < num_bytes) { + if (avio_read(pb, buf, num_bytes) < num_bytes) { av_freep(&sc->sample_sizes); av_free(buf); return -1; @@ -1417,7 +1418,7 @@ static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -1430,9 +1431,9 @@ static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ - entries = get_be32(pb); + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ + entries = avio_rb32(pb); av_dlog(c->fc, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries); @@ -1447,8 +1448,8 @@ static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) int sample_duration; int sample_count; - sample_count=get_be32(pb); - sample_duration = get_be32(pb); + sample_count=avio_rb32(pb); + sample_duration = avio_rb32(pb); sc->stts_data[i].count= sample_count; sc->stts_data[i].duration= sample_duration; @@ -1464,7 +1465,7 @@ static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -1475,9 +1476,9 @@ static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ - entries = get_be32(pb); + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ + entries = avio_rb32(pb); av_dlog(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); @@ -1489,8 +1490,8 @@ static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) sc->ctts_count = entries; for(i=0; ictts_data[i].count = count; sc->ctts_data[i].duration= duration; @@ -1682,7 +1683,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st) } } -static int mov_open_dref(ByteIOContext **pb, char *src, MOVDref *ref) +static int mov_open_dref(AVIOContext **pb, char *src, MOVDref *ref) { /* try relative path, we do not try the absolute because it can leak information about our system to an attacker */ @@ -1717,15 +1718,15 @@ static int mov_open_dref(ByteIOContext **pb, char *src, MOVDref *ref) av_strlcat(filename, ref->path + l + 1, 1024); - if (!url_fopen(pb, filename, URL_RDONLY)) + if (!avio_open(pb, filename, URL_RDONLY)) return 0; } } return AVERROR(ENOENT); -}; +} -static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; @@ -1824,7 +1825,7 @@ static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_ilst(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_ilst(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int ret; c->itunes_metadata = 1; @@ -1833,13 +1834,13 @@ static int mov_read_ilst(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return ret; } -static int mov_read_meta(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom) { while (atom.size > 8) { - uint32_t tag = get_le32(pb); + uint32_t tag = avio_rl32(pb); atom.size -= 4; if (tag == MKTAG('h','d','l','r')) { - url_fseek(pb, -8, SEEK_CUR); + avio_seek(pb, -8, SEEK_CUR); atom.size += 8; return mov_read_default(c, pb, atom); } @@ -1847,7 +1848,7 @@ static int mov_read_meta(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int i; int width; @@ -1863,8 +1864,8 @@ static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; - version = get_byte(pb); - get_be24(pb); /* flags */ + version = avio_r8(pb); + avio_rb24(pb); /* flags */ /* MOV_TRACK_ENABLED 0x0001 MOV_TRACK_IN_MOVIE 0x0002 @@ -1873,36 +1874,36 @@ static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) */ if (version == 1) { - get_be64(pb); - get_be64(pb); + avio_rb64(pb); + avio_rb64(pb); } else { - get_be32(pb); /* creation time */ - get_be32(pb); /* modification time */ + avio_rb32(pb); /* creation time */ + avio_rb32(pb); /* modification time */ } - st->id = (int)get_be32(pb); /* track id (NOT 0 !)*/ - get_be32(pb); /* reserved */ + st->id = (int)avio_rb32(pb); /* track id (NOT 0 !)*/ + avio_rb32(pb); /* reserved */ /* highlevel (considering edits) duration in movie timebase */ - (version == 1) ? get_be64(pb) : get_be32(pb); - get_be32(pb); /* reserved */ - get_be32(pb); /* reserved */ + (version == 1) ? avio_rb64(pb) : avio_rb32(pb); + avio_rb32(pb); /* reserved */ + avio_rb32(pb); /* reserved */ - get_be16(pb); /* layer */ - get_be16(pb); /* alternate group */ - get_be16(pb); /* volume */ - get_be16(pb); /* reserved */ + avio_rb16(pb); /* layer */ + avio_rb16(pb); /* alternate group */ + avio_rb16(pb); /* volume */ + avio_rb16(pb); /* reserved */ //read in the display matrix (outlined in ISO 14496-12, Section 6.2.2) // they're kept in fixed point format through all calculations // ignore u,v,z b/c we don't need the scale factor to calc aspect ratio for (i = 0; i < 3; i++) { - display_matrix[i][0] = get_be32(pb); // 16.16 fixed point - display_matrix[i][1] = get_be32(pb); // 16.16 fixed point - get_be32(pb); // 2.30 fixed point (not used) + display_matrix[i][0] = avio_rb32(pb); // 16.16 fixed point + display_matrix[i][1] = avio_rb32(pb); // 16.16 fixed point + avio_rb32(pb); // 2.30 fixed point (not used) } - width = get_be32(pb); // 16.16 fixed point track width - height = get_be32(pb); // 16.16 fixed point track height + width = avio_rb32(pb); // 16.16 fixed point track width + height = avio_rb32(pb); // 16.16 fixed point track height sc->width = width >> 16; sc->height = height >> 16; @@ -1930,16 +1931,16 @@ static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_tfhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { MOVFragment *frag = &c->fragment; MOVTrackExt *trex = NULL; int flags, track_id, i; - get_byte(pb); /* version */ - flags = get_be24(pb); + avio_r8(pb); /* version */ + flags = avio_rb24(pb); - track_id = get_be32(pb); + track_id = avio_rb32(pb); if (!track_id) return -1; frag->track_id = track_id; @@ -1953,25 +1954,25 @@ static int mov_read_tfhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return -1; } - if (flags & 0x01) frag->base_data_offset = get_be64(pb); + if (flags & 0x01) frag->base_data_offset = avio_rb64(pb); else frag->base_data_offset = frag->moof_offset; - if (flags & 0x02) frag->stsd_id = get_be32(pb); + if (flags & 0x02) frag->stsd_id = avio_rb32(pb); else frag->stsd_id = trex->stsd_id; - frag->duration = flags & 0x08 ? get_be32(pb) : trex->duration; - frag->size = flags & 0x10 ? get_be32(pb) : trex->size; - frag->flags = flags & 0x20 ? get_be32(pb) : trex->flags; + frag->duration = flags & 0x08 ? avio_rb32(pb) : trex->duration; + frag->size = flags & 0x10 ? avio_rb32(pb) : trex->size; + frag->flags = flags & 0x20 ? avio_rb32(pb) : trex->flags; av_dlog(c->fc, "frag flags 0x%x\n", frag->flags); return 0; } -static int mov_read_chap(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_chap(MOVContext *c, AVIOContext *pb, MOVAtom atom) { - c->chapter_track = get_be32(pb); + c->chapter_track = avio_rb32(pb); return 0; } -static int mov_read_trex(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_trex(MOVContext *c, AVIOContext *pb, MOVAtom atom) { MOVTrackExt *trex; @@ -1982,17 +1983,17 @@ static int mov_read_trex(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return AVERROR(ENOMEM); c->trex_data = trex; trex = &c->trex_data[c->trex_count++]; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ - trex->track_id = get_be32(pb); - trex->stsd_id = get_be32(pb); - trex->duration = get_be32(pb); - trex->size = get_be32(pb); - trex->flags = get_be32(pb); + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ + trex->track_id = avio_rb32(pb); + trex->stsd_id = avio_rb32(pb); + trex->duration = avio_rb32(pb); + trex->size = avio_rb32(pb); + trex->flags = avio_rb32(pb); return 0; } -static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) { MOVFragment *frag = &c->fragment; AVStream *st = NULL; @@ -2016,12 +2017,12 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom) sc = st->priv_data; if (sc->pseudo_stream_id+1 != frag->stsd_id) return 0; - get_byte(pb); /* version */ - flags = get_be24(pb); - entries = get_be32(pb); + avio_r8(pb); /* version */ + flags = avio_rb24(pb); + entries = avio_rb32(pb); av_dlog(c->fc, "flags 0x%x entries %d\n", flags, entries); - if (flags & 0x001) data_offset = get_be32(pb); - if (flags & 0x004) first_sample_flags = get_be32(pb); + if (flags & 0x001) data_offset = avio_rb32(pb); + if (flags & 0x004) first_sample_flags = avio_rb32(pb); if (flags & 0x800) { MOVStts *ctts_data; if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data)) @@ -2042,12 +2043,12 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom) unsigned sample_duration = frag->duration; int keyframe; - if (flags & 0x100) sample_duration = get_be32(pb); - if (flags & 0x200) sample_size = get_be32(pb); - if (flags & 0x400) sample_flags = get_be32(pb); + if (flags & 0x100) sample_duration = avio_rb32(pb); + if (flags & 0x200) sample_size = avio_rb32(pb); + if (flags & 0x400) sample_flags = avio_rb32(pb); if (flags & 0x800) { sc->ctts_data[sc->ctts_count].count = 1; - sc->ctts_data[sc->ctts_count].duration = get_be32(pb); + sc->ctts_data[sc->ctts_count].duration = avio_rb32(pb); sc->ctts_count++; } if ((keyframe = st->codec->codec_type == AVMEDIA_TYPE_AUDIO || @@ -2070,46 +2071,46 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom) /* this atom should be null (from specs), but some buggy files put the 'moov' atom inside it... */ /* like the files created with Adobe Premiere 5.0, for samples see */ /* http://graphics.tudelft.nl/~wouter/publications/soundtests/ */ -static int mov_read_wide(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int err; if (atom.size < 8) return 0; /* continue */ - if (get_be32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */ - url_fskip(pb, atom.size - 4); + if (avio_rb32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */ + avio_seek(pb, atom.size - 4, SEEK_CUR); return 0; } - atom.type = get_le32(pb); + atom.type = avio_rl32(pb); atom.size -= 8; if (atom.type != MKTAG('m','d','a','t')) { - url_fskip(pb, atom.size); + avio_seek(pb, atom.size, SEEK_CUR); return 0; } err = mov_read_mdat(c, pb, atom); return err; } -static int mov_read_cmov(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom) { #if CONFIG_ZLIB - ByteIOContext ctx; + AVIOContext ctx; uint8_t *cmov_data; uint8_t *moov_data; /* uncompressed data */ long cmov_len, moov_len; int ret = -1; - get_be32(pb); /* dcom atom */ - if (get_le32(pb) != MKTAG('d','c','o','m')) + avio_rb32(pb); /* dcom atom */ + if (avio_rl32(pb) != MKTAG('d','c','o','m')) return -1; - if (get_le32(pb) != MKTAG('z','l','i','b')) { + if (avio_rl32(pb) != MKTAG('z','l','i','b')) { av_log(c->fc, AV_LOG_ERROR, "unknown compression for cmov atom !"); return -1; } - get_be32(pb); /* cmvd atom */ - if (get_le32(pb) != MKTAG('c','m','v','d')) + avio_rb32(pb); /* cmvd atom */ + if (avio_rl32(pb) != MKTAG('c','m','v','d')) return -1; - moov_len = get_be32(pb); /* uncompressed size */ + moov_len = avio_rb32(pb); /* uncompressed size */ cmov_len = atom.size - 6 * 4; cmov_data = av_malloc(cmov_len); @@ -2120,10 +2121,10 @@ static int mov_read_cmov(MOVContext *c, ByteIOContext *pb, MOVAtom atom) av_free(cmov_data); return AVERROR(ENOMEM); } - get_buffer(pb, cmov_data, cmov_len); + avio_read(pb, cmov_data, cmov_len); if(uncompress (moov_data, (uLongf *) &moov_len, (const Bytef *)cmov_data, cmov_len) != Z_OK) goto free_and_return; - if(init_put_byte(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0) + if(ffio_init_context(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0) goto free_and_return; atom.type = MKTAG('m','o','o','v'); atom.size = moov_len; @@ -2142,7 +2143,7 @@ static int mov_read_cmov(MOVContext *c, ByteIOContext *pb, MOVAtom atom) } /* edit list atom */ -static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom) { MOVStreamContext *sc; int i, edit_count; @@ -2151,18 +2152,18 @@ static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom) return 0; sc = c->fc->streams[c->fc->nb_streams-1]->priv_data; - get_byte(pb); /* version */ - get_be24(pb); /* flags */ - edit_count = get_be32(pb); /* entries */ + avio_r8(pb); /* version */ + avio_rb24(pb); /* flags */ + edit_count = avio_rb32(pb); /* entries */ if((uint64_t)edit_count*12+8 > atom.size) return -1; for(i=0; i= -1) { sc->time_offset = time != -1 ? time : -duration; } @@ -2307,13 +2308,13 @@ static void mov_read_chapters(AVFormatContext *s) uint16_t ch; int len, title_len; - if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { + if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i); goto finish; } // the first two bytes are the length of the title - len = get_be16(sc->pb); + len = avio_rb16(sc->pb); if (len > sample->size-2) continue; title_len = 2*len + 1; @@ -2323,7 +2324,7 @@ static void mov_read_chapters(AVFormatContext *s) // The samples could theoretically be in any encoding if there's an encd // atom following, but in practice are only utf-8 or utf-16, distinguished // instead by the presence of a BOM - ch = get_be16(sc->pb); + ch = avio_rb16(sc->pb); if (ch == 0xfeff) avio_get_str16be(sc->pb, len, title, title_len); else if (ch == 0xfffe) @@ -2337,13 +2338,13 @@ static void mov_read_chapters(AVFormatContext *s) av_freep(&title); } finish: - url_fseek(sc->pb, cur_pos, SEEK_SET); + avio_seek(sc->pb, cur_pos, SEEK_SET); } static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) { MOVContext *mov = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int err; MOVAtom atom = { AV_RL32("root") }; @@ -2420,7 +2421,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) sc->current_sample++; if (st->discard != AVDISCARD_ALL) { - if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { + if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n", sc->ffindex, sample->pos); return -1; @@ -2545,7 +2546,7 @@ static int mov_read_close(AVFormatContext *s) } av_freep(&sc->drefs); if (sc->pb && sc->pb != s->pb) - url_fclose(sc->pb); + avio_close(sc->pb); av_freep(&st->codec->palctrl); } diff --git a/mplayer/ffmpeg/libavformat/movenc.c b/mplayer/ffmpeg/libavformat/movenc.c index 0949d294..231976b0 100644 --- a/mplayer/ffmpeg/libavformat/movenc.c +++ b/mplayer/ffmpeg/libavformat/movenc.c @@ -23,6 +23,7 @@ #include "movenc.h" #include "avformat.h" +#include "avio_internal.h" #include "riff.h" #include "avio.h" #include "isom.h" @@ -36,49 +37,49 @@ #include //FIXME support 64 bit variant with wide placeholders -static int64_t updateSize(ByteIOContext *pb, int64_t pos) +static int64_t updateSize(AVIOContext *pb, int64_t pos) { int64_t curpos = url_ftell(pb); - url_fseek(pb, pos, SEEK_SET); - put_be32(pb, curpos - pos); /* rewrite size */ - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); + avio_wb32(pb, curpos - pos); /* rewrite size */ + avio_seek(pb, curpos, SEEK_SET); return curpos - pos; } /* Chunk offset atom */ -static int mov_write_stco_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track) { int i; int mode64 = 0; // use 32 bit size variant if possible int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ + avio_wb32(pb, 0); /* size */ if (pos > UINT32_MAX) { mode64 = 1; - put_tag(pb, "co64"); + ffio_wfourcc(pb, "co64"); } else - put_tag(pb, "stco"); - put_be32(pb, 0); /* version & flags */ - put_be32(pb, track->entry); /* entry count */ + ffio_wfourcc(pb, "stco"); + avio_wb32(pb, 0); /* version & flags */ + avio_wb32(pb, track->entry); /* entry count */ for (i=0; ientry; i++) { if(mode64 == 1) - put_be64(pb, track->cluster[i].pos); + avio_wb64(pb, track->cluster[i].pos); else - put_be32(pb, track->cluster[i].pos); + avio_wb32(pb, track->cluster[i].pos); } return updateSize(pb, pos); } /* Sample size atom */ -static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track) { int equalChunks = 1; int i, j, entries = 0, tst = -1, oldtst = -1; int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ - put_tag(pb, "stsz"); - put_be32(pb, 0); /* version & flags */ + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "stsz"); + avio_wb32(pb, 0); /* version & flags */ for (i=0; ientry; i++) { tst = track->cluster[i].size/track->cluster[i].entries; @@ -90,15 +91,15 @@ static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track) } if (equalChunks) { int sSize = track->cluster[0].size/track->cluster[0].entries; - put_be32(pb, sSize); // sample size - put_be32(pb, entries); // sample count + avio_wb32(pb, sSize); // sample size + avio_wb32(pb, entries); // sample count } else { - put_be32(pb, 0); // sample size - put_be32(pb, entries); // sample count + avio_wb32(pb, 0); // sample size + avio_wb32(pb, entries); // sample count for (i=0; ientry; i++) { for (j=0; jcluster[i].entries; j++) { - put_be32(pb, track->cluster[i].size / + avio_wb32(pb, track->cluster[i].size / track->cluster[i].entries); } } @@ -107,74 +108,74 @@ static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track) } /* Sample to chunk atom */ -static int mov_write_stsc_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track) { int index = 0, oldval = -1, i; int64_t entryPos, curpos; int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ - put_tag(pb, "stsc"); - put_be32(pb, 0); // version & flags + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "stsc"); + avio_wb32(pb, 0); // version & flags entryPos = url_ftell(pb); - put_be32(pb, track->entry); // entry count + avio_wb32(pb, track->entry); // entry count for (i=0; ientry; i++) { if(oldval != track->cluster[i].samplesInChunk) { - put_be32(pb, i+1); // first chunk - put_be32(pb, track->cluster[i].samplesInChunk); // samples per chunk - put_be32(pb, 0x1); // sample description index + avio_wb32(pb, i+1); // first chunk + avio_wb32(pb, track->cluster[i].samplesInChunk); // samples per chunk + avio_wb32(pb, 0x1); // sample description index oldval = track->cluster[i].samplesInChunk; index++; } } curpos = url_ftell(pb); - url_fseek(pb, entryPos, SEEK_SET); - put_be32(pb, index); // rewrite size - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, entryPos, SEEK_SET); + avio_wb32(pb, index); // rewrite size + avio_seek(pb, curpos, SEEK_SET); return updateSize(pb, pos); } /* Sync sample atom */ -static int mov_write_stss_tag(ByteIOContext *pb, MOVTrack *track, uint32_t flag) +static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag) { int64_t curpos, entryPos; int i, index = 0; int64_t pos = url_ftell(pb); - put_be32(pb, 0); // size - put_tag(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps"); - put_be32(pb, 0); // version & flags + avio_wb32(pb, 0); // size + ffio_wfourcc(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps"); + avio_wb32(pb, 0); // version & flags entryPos = url_ftell(pb); - put_be32(pb, track->entry); // entry count + avio_wb32(pb, track->entry); // entry count for (i=0; ientry; i++) { if (track->cluster[i].flags & flag) { - put_be32(pb, i+1); + avio_wb32(pb, i+1); index++; } } curpos = url_ftell(pb); - url_fseek(pb, entryPos, SEEK_SET); - put_be32(pb, index); // rewrite size - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, entryPos, SEEK_SET); + avio_wb32(pb, index); // rewrite size + avio_seek(pb, curpos, SEEK_SET); return updateSize(pb, pos); } -static int mov_write_amr_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track) { - put_be32(pb, 0x11); /* size */ - if (track->mode == MODE_MOV) put_tag(pb, "samr"); - else put_tag(pb, "damr"); - put_tag(pb, "FFMP"); - put_byte(pb, 0); /* decoder version */ + avio_wb32(pb, 0x11); /* size */ + if (track->mode == MODE_MOV) ffio_wfourcc(pb, "samr"); + else ffio_wfourcc(pb, "damr"); + ffio_wfourcc(pb, "FFMP"); + avio_w8(pb, 0); /* decoder version */ - put_be16(pb, 0x81FF); /* Mode set (all modes for AMR_NB) */ - put_byte(pb, 0x00); /* Mode change period (no restriction) */ - put_byte(pb, 0x01); /* Frames per sample */ + avio_wb16(pb, 0x81FF); /* Mode set (all modes for AMR_NB) */ + avio_w8(pb, 0x00); /* Mode change period (no restriction) */ + avio_w8(pb, 0x01); /* Frames per sample */ return 0x11; } -static int mov_write_ac3_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_ac3_tag(AVIOContext *pb, MOVTrack *track) { GetBitContext gbc; PutBitContext pbc; @@ -184,8 +185,8 @@ static int mov_write_ac3_tag(ByteIOContext *pb, MOVTrack *track) if (track->vosLen < 7) return -1; - put_be32(pb, 11); - put_tag(pb, "dac3"); + avio_wb32(pb, 11); + ffio_wfourcc(pb, "dac3"); init_get_bits(&gbc, track->vosData+4, track->vosLen-4); fscod = get_bits(&gbc, 2); @@ -213,7 +214,7 @@ static int mov_write_ac3_tag(ByteIOContext *pb, MOVTrack *track) put_bits(&pbc, 5, 0); // reserved flush_put_bits(&pbc); - put_buffer(pb, buf, sizeof(buf)); + avio_write(pb, buf, sizeof(buf)); return 11; } @@ -222,17 +223,17 @@ static int mov_write_ac3_tag(ByteIOContext *pb, MOVTrack *track) * This function writes extradata "as is". * Extradata must be formated like a valid atom (with size and tag) */ -static int mov_write_extradata_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_extradata_tag(AVIOContext *pb, MOVTrack *track) { - put_buffer(pb, track->enc->extradata, track->enc->extradata_size); + avio_write(pb, track->enc->extradata, track->enc->extradata_size); return track->enc->extradata_size; } -static int mov_write_enda_tag(ByteIOContext *pb) +static int mov_write_enda_tag(AVIOContext *pb) { - put_be32(pb, 10); - put_tag(pb, "enda"); - put_be16(pb, 1); /* little endian */ + avio_wb32(pb, 10); + ffio_wfourcc(pb, "enda"); + avio_wb16(pb, 1); /* little endian */ return 10; } @@ -243,29 +244,29 @@ static unsigned int descrLength(unsigned int len) return len + 1 + i; } -static void putDescr(ByteIOContext *pb, int tag, unsigned int size) +static void putDescr(AVIOContext *pb, int tag, unsigned int size) { int i= descrLength(size) - size - 2; - put_byte(pb, tag); + avio_w8(pb, tag); for(; i>0; i--) - put_byte(pb, (size>>(7*i)) | 0x80); - put_byte(pb, size & 0x7F); + avio_w8(pb, (size>>(7*i)) | 0x80); + avio_w8(pb, size & 0x7F); } -static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack *track) // Basic +static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic { int64_t pos = url_ftell(pb); int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0; - put_be32(pb, 0); // size - put_tag(pb, "esds"); - put_be32(pb, 0); // Version + avio_wb32(pb, 0); // size + ffio_wfourcc(pb, "esds"); + avio_wb32(pb, 0); // Version // ES descriptor putDescr(pb, 0x03, 3 + descrLength(13 + decoderSpecificInfoLen) + descrLength(1)); - put_be16(pb, track->trackID); - put_byte(pb, 0x00); // flags (= no flags) + avio_wb16(pb, track->trackID); + avio_w8(pb, 0x00); // flags (= no flags) // DecoderConfig descriptor putDescr(pb, 0x04, 13 + decoderSpecificInfoLen); @@ -274,35 +275,35 @@ static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack *track) // Basic if ((track->enc->codec_id == CODEC_ID_MP2 || track->enc->codec_id == CODEC_ID_MP3) && track->enc->sample_rate > 24000) - put_byte(pb, 0x6B); // 11172-3 + avio_w8(pb, 0x6B); // 11172-3 else - put_byte(pb, ff_codec_get_tag(ff_mp4_obj_type, track->enc->codec_id)); + avio_w8(pb, ff_codec_get_tag(ff_mp4_obj_type, track->enc->codec_id)); // the following fields is made of 6 bits to identify the streamtype (4 for video, 5 for audio) // plus 1 bit to indicate upstream and 1 bit set to 1 (reserved) if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO) - put_byte(pb, 0x15); // flags (= Audiostream) + avio_w8(pb, 0x15); // flags (= Audiostream) else - put_byte(pb, 0x11); // flags (= Visualstream) + avio_w8(pb, 0x11); // flags (= Visualstream) - put_byte(pb, track->enc->rc_buffer_size>>(3+16)); // Buffersize DB (24 bits) - put_be16(pb, (track->enc->rc_buffer_size>>3)&0xFFFF); // Buffersize DB + avio_w8(pb, track->enc->rc_buffer_size>>(3+16)); // Buffersize DB (24 bits) + avio_wb16(pb, (track->enc->rc_buffer_size>>3)&0xFFFF); // Buffersize DB - put_be32(pb, FFMAX(track->enc->bit_rate, track->enc->rc_max_rate)); // maxbitrate (FIXME should be max rate in any 1 sec window) + avio_wb32(pb, FFMAX(track->enc->bit_rate, track->enc->rc_max_rate)); // maxbitrate (FIXME should be max rate in any 1 sec window) if(track->enc->rc_max_rate != track->enc->rc_min_rate || track->enc->rc_min_rate==0) - put_be32(pb, 0); // vbr + avio_wb32(pb, 0); // vbr else - put_be32(pb, track->enc->rc_max_rate); // avg bitrate + avio_wb32(pb, track->enc->rc_max_rate); // avg bitrate if (track->vosLen) { // DecoderSpecific info descriptor putDescr(pb, 0x05, track->vosLen); - put_buffer(pb, track->vosData, track->vosLen); + avio_write(pb, track->vosData, track->vosLen); } // SL descriptor putDescr(pb, 0x06, 1); - put_byte(pb, 0x02); + avio_w8(pb, 0x02); return updateSize(pb, pos); } @@ -314,32 +315,32 @@ static int mov_pcm_le_gt16(enum CodecID codec_id) codec_id == CODEC_ID_PCM_F64LE; } -static int mov_write_ms_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); - put_le32(pb, track->tag); // store it byteswapped + avio_wb32(pb, 0); + avio_wl32(pb, track->tag); // store it byteswapped track->enc->codec_tag = av_bswap16(track->tag >> 16); ff_put_wav_header(pb, track->enc); return updateSize(pb, pos); } -static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ - put_tag(pb, "wave"); + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "wave"); - put_be32(pb, 12); /* size */ - put_tag(pb, "frma"); - put_le32(pb, track->tag); + avio_wb32(pb, 12); /* size */ + ffio_wfourcc(pb, "frma"); + avio_wl32(pb, track->tag); if (track->enc->codec_id == CODEC_ID_AAC) { /* useless atom needed by mplayer, ipod, not needed by quicktime */ - put_be32(pb, 12); /* size */ - put_tag(pb, "mp4a"); - put_be32(pb, 0); + avio_wb32(pb, 12); /* size */ + ffio_wfourcc(pb, "mp4a"); + avio_wb32(pb, 0); mov_write_esds_tag(pb, track); } else if (mov_pcm_le_gt16(track->enc->codec_id)) { mov_write_enda_tag(pb); @@ -354,17 +355,17 @@ static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track) mov_write_ms_tag(pb, track); } - put_be32(pb, 8); /* size */ - put_be32(pb, 0); /* null tag */ + avio_wb32(pb, 8); /* size */ + avio_wb32(pb, 0); /* null tag */ return updateSize(pb, pos); } -static int mov_write_glbl_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_glbl_tag(AVIOContext *pb, MOVTrack *track) { - put_be32(pb, track->vosLen+8); - put_tag(pb, "glbl"); - put_buffer(pb, track->vosData, track->vosLen); + avio_wb32(pb, track->vosLen+8); + ffio_wfourcc(pb, "glbl"); + avio_write(pb, track->vosData, track->vosLen); return 8+track->vosLen; } @@ -397,7 +398,7 @@ static int mov_get_lpcm_flags(enum CodecID codec_id) } } -static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); int version = 0; @@ -415,56 +416,56 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track) } } - put_be32(pb, 0); /* size */ - put_le32(pb, tag); // store it byteswapped - put_be32(pb, 0); /* Reserved */ - put_be16(pb, 0); /* Reserved */ - put_be16(pb, 1); /* Data-reference index, XXX == 1 */ + avio_wb32(pb, 0); /* size */ + avio_wl32(pb, tag); // store it byteswapped + avio_wb32(pb, 0); /* Reserved */ + avio_wb16(pb, 0); /* Reserved */ + avio_wb16(pb, 1); /* Data-reference index, XXX == 1 */ /* SoundDescription */ - put_be16(pb, version); /* Version */ - put_be16(pb, 0); /* Revision level */ - put_be32(pb, 0); /* Reserved */ + avio_wb16(pb, version); /* Version */ + avio_wb16(pb, 0); /* Revision level */ + avio_wb32(pb, 0); /* Reserved */ if (version == 2) { - put_be16(pb, 3); - put_be16(pb, 16); - put_be16(pb, 0xfffe); - put_be16(pb, 0); - put_be32(pb, 0x00010000); - put_be32(pb, 72); - put_be64(pb, av_dbl2int(track->timescale)); - put_be32(pb, track->enc->channels); - put_be32(pb, 0x7F000000); - put_be32(pb, av_get_bits_per_sample(track->enc->codec_id)); - put_be32(pb, mov_get_lpcm_flags(track->enc->codec_id)); - put_be32(pb, track->sampleSize); - put_be32(pb, track->enc->frame_size); + avio_wb16(pb, 3); + avio_wb16(pb, 16); + avio_wb16(pb, 0xfffe); + avio_wb16(pb, 0); + avio_wb32(pb, 0x00010000); + avio_wb32(pb, 72); + avio_wb64(pb, av_dbl2int(track->timescale)); + avio_wb32(pb, track->enc->channels); + avio_wb32(pb, 0x7F000000); + avio_wb32(pb, av_get_bits_per_sample(track->enc->codec_id)); + avio_wb32(pb, mov_get_lpcm_flags(track->enc->codec_id)); + avio_wb32(pb, track->sampleSize); + avio_wb32(pb, track->enc->frame_size); } else { if (track->mode == MODE_MOV) { - put_be16(pb, track->enc->channels); + avio_wb16(pb, track->enc->channels); if (track->enc->codec_id == CODEC_ID_PCM_U8 || track->enc->codec_id == CODEC_ID_PCM_S8) - put_be16(pb, 8); /* bits per sample */ + avio_wb16(pb, 8); /* bits per sample */ else - put_be16(pb, 16); - put_be16(pb, track->audio_vbr ? -2 : 0); /* compression ID */ + avio_wb16(pb, 16); + avio_wb16(pb, track->audio_vbr ? -2 : 0); /* compression ID */ } else { /* reserved for mp4/3gp */ - put_be16(pb, 2); - put_be16(pb, 16); - put_be16(pb, 0); + avio_wb16(pb, 2); + avio_wb16(pb, 16); + avio_wb16(pb, 0); } - put_be16(pb, 0); /* packet size (= 0) */ - put_be16(pb, track->timescale); /* Time scale */ - put_be16(pb, 0); /* Reserved */ + avio_wb16(pb, 0); /* packet size (= 0) */ + avio_wb16(pb, track->timescale); /* Time scale */ + avio_wb16(pb, 0); /* Reserved */ } if(version == 1) { /* SoundDescription V1 extended info */ - put_be32(pb, track->enc->frame_size); /* Samples per packet */ - put_be32(pb, track->sampleSize / track->enc->channels); /* Bytes per packet */ - put_be32(pb, track->sampleSize); /* Bytes per frame */ - put_be32(pb, 2); /* Bytes per sample */ + avio_wb32(pb, track->enc->frame_size); /* Samples per packet */ + avio_wb32(pb, track->sampleSize / track->enc->channels); /* Bytes per packet */ + avio_wb32(pb, track->sampleSize); /* Bytes per frame */ + avio_wb32(pb, 2); /* Bytes per sample */ } if(track->mode == MODE_MOV && @@ -490,86 +491,86 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_d263_tag(ByteIOContext *pb) +static int mov_write_d263_tag(AVIOContext *pb) { - put_be32(pb, 0xf); /* size */ - put_tag(pb, "d263"); - put_tag(pb, "FFMP"); - put_byte(pb, 0); /* decoder version */ + avio_wb32(pb, 0xf); /* size */ + ffio_wfourcc(pb, "d263"); + ffio_wfourcc(pb, "FFMP"); + avio_w8(pb, 0); /* decoder version */ /* FIXME use AVCodecContext level/profile, when encoder will set values */ - put_byte(pb, 0xa); /* level */ - put_byte(pb, 0); /* profile */ + avio_w8(pb, 0xa); /* level */ + avio_w8(pb, 0); /* profile */ return 0xf; } /* TODO: No idea about these values */ -static int mov_write_svq3_tag(ByteIOContext *pb) -{ - put_be32(pb, 0x15); - put_tag(pb, "SMI "); - put_tag(pb, "SEQH"); - put_be32(pb, 0x5); - put_be32(pb, 0xe2c0211d); - put_be32(pb, 0xc0000000); - put_byte(pb, 0); +static int mov_write_svq3_tag(AVIOContext *pb) +{ + avio_wb32(pb, 0x15); + ffio_wfourcc(pb, "SMI "); + ffio_wfourcc(pb, "SEQH"); + avio_wb32(pb, 0x5); + avio_wb32(pb, 0xe2c0211d); + avio_wb32(pb, 0xc0000000); + avio_w8(pb, 0); return 0x15; } -static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); - put_tag(pb, "avcC"); + avio_wb32(pb, 0); + ffio_wfourcc(pb, "avcC"); ff_isom_write_avcc(pb, track->vosData, track->vosLen); return updateSize(pb, pos); } /* also used by all avid codecs (dv, imx, meridien) and their variants */ -static int mov_write_avid_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track) { int i; - put_be32(pb, 24); /* size */ - put_tag(pb, "ACLR"); - put_tag(pb, "ACLR"); - put_tag(pb, "0001"); - put_be32(pb, 1); /* yuv 1 / rgb 2 ? */ - put_be32(pb, 0); /* unknown */ - - put_be32(pb, 24); /* size */ - put_tag(pb, "APRG"); - put_tag(pb, "APRG"); - put_tag(pb, "0001"); - put_be32(pb, 1); /* unknown */ - put_be32(pb, 0); /* unknown */ - - put_be32(pb, 120); /* size */ - put_tag(pb, "ARES"); - put_tag(pb, "ARES"); - put_tag(pb, "0001"); - put_be32(pb, AV_RB32(track->vosData + 0x28)); /* dnxhd cid, some id ? */ - put_be32(pb, track->enc->width); + avio_wb32(pb, 24); /* size */ + ffio_wfourcc(pb, "ACLR"); + ffio_wfourcc(pb, "ACLR"); + ffio_wfourcc(pb, "0001"); + avio_wb32(pb, 1); /* yuv 1 / rgb 2 ? */ + avio_wb32(pb, 0); /* unknown */ + + avio_wb32(pb, 24); /* size */ + ffio_wfourcc(pb, "APRG"); + ffio_wfourcc(pb, "APRG"); + ffio_wfourcc(pb, "0001"); + avio_wb32(pb, 1); /* unknown */ + avio_wb32(pb, 0); /* unknown */ + + avio_wb32(pb, 120); /* size */ + ffio_wfourcc(pb, "ARES"); + ffio_wfourcc(pb, "ARES"); + ffio_wfourcc(pb, "0001"); + avio_wb32(pb, AV_RB32(track->vosData + 0x28)); /* dnxhd cid, some id ? */ + avio_wb32(pb, track->enc->width); /* values below are based on samples created with quicktime and avid codecs */ if (track->vosData[5] & 2) { // interlaced - put_be32(pb, track->enc->height/2); - put_be32(pb, 2); /* unknown */ - put_be32(pb, 0); /* unknown */ - put_be32(pb, 4); /* unknown */ + avio_wb32(pb, track->enc->height/2); + avio_wb32(pb, 2); /* unknown */ + avio_wb32(pb, 0); /* unknown */ + avio_wb32(pb, 4); /* unknown */ } else { - put_be32(pb, track->enc->height); - put_be32(pb, 1); /* unknown */ - put_be32(pb, 0); /* unknown */ + avio_wb32(pb, track->enc->height); + avio_wb32(pb, 1); /* unknown */ + avio_wb32(pb, 0); /* unknown */ if (track->enc->height == 1080) - put_be32(pb, 5); /* unknown */ + avio_wb32(pb, 5); /* unknown */ else - put_be32(pb, 6); /* unknown */ + avio_wb32(pb, 6); /* unknown */ } /* padding */ for (i = 0; i < 10; i++) - put_be64(pb, 0); + avio_wb64(pb, 0); /* extra padding for stsd needed */ - put_be32(pb, 0); + avio_wb32(pb, 0); return 0; } @@ -622,12 +623,23 @@ static int mov_get_dv_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag; - if (track->enc->height == 480) /* NTSC */ - if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','n'); - else tag = MKTAG('d','v','c',' '); - else if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','p'); - else if (track->enc->pix_fmt == PIX_FMT_YUV420P) tag = MKTAG('d','v','c','p'); - else tag = MKTAG('d','v','p','p'); + if (track->enc->width == 720) /* SD */ + if (track->enc->height == 480) /* NTSC */ + if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','n'); + else tag = MKTAG('d','v','c',' '); + else if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','p'); + else if (track->enc->pix_fmt == PIX_FMT_YUV420P) tag = MKTAG('d','v','c','p'); + else tag = MKTAG('d','v','p','p'); + else if (track->enc->height == 720) /* HD 720 line */ + if (track->enc->time_base.den == 50) tag = MKTAG('d','v','h','q'); + else tag = MKTAG('d','v','h','p'); + else if (track->enc->height == 1080) /* HD 1080 line */ + if (track->enc->time_base.den == 25) tag = MKTAG('d','v','h','5'); + else tag = MKTAG('d','v','h','6'); + else { + av_log(s, AV_LOG_ERROR, "unsupported height for dv codec\n"); + return 0; + } return tag; } @@ -738,92 +750,92 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) * Needed to make file play in iPods running newest firmware * goes after avcC atom in moov.trak.mdia.minf.stbl.stsd.avc1 */ -static int mov_write_uuid_tag_ipod(ByteIOContext *pb) -{ - put_be32(pb, 28); - put_tag(pb, "uuid"); - put_be32(pb, 0x6b6840f2); - put_be32(pb, 0x5f244fc5); - put_be32(pb, 0xba39a51b); - put_be32(pb, 0xcf0323f3); - put_be32(pb, 0x0); +static int mov_write_uuid_tag_ipod(AVIOContext *pb) +{ + avio_wb32(pb, 28); + ffio_wfourcc(pb, "uuid"); + avio_wb32(pb, 0x6b6840f2); + avio_wb32(pb, 0x5f244fc5); + avio_wb32(pb, 0xba39a51b); + avio_wb32(pb, 0xcf0323f3); + avio_wb32(pb, 0x0); return 28; } -static int mov_write_subtitle_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ - put_le32(pb, track->tag); // store it byteswapped - put_be32(pb, 0); /* Reserved */ - put_be16(pb, 0); /* Reserved */ - put_be16(pb, 1); /* Data-reference index */ + avio_wb32(pb, 0); /* size */ + avio_wl32(pb, track->tag); // store it byteswapped + avio_wb32(pb, 0); /* Reserved */ + avio_wb16(pb, 0); /* Reserved */ + avio_wb16(pb, 1); /* Data-reference index */ if (track->enc->extradata_size) - put_buffer(pb, track->enc->extradata, track->enc->extradata_size); + avio_write(pb, track->enc->extradata, track->enc->extradata_size); return updateSize(pb, pos); } -static int mov_write_pasp_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track) { AVRational sar; av_reduce(&sar.num, &sar.den, track->enc->sample_aspect_ratio.num, track->enc->sample_aspect_ratio.den, INT_MAX); - put_be32(pb, 16); - put_tag(pb, "pasp"); - put_be32(pb, sar.num); - put_be32(pb, sar.den); + avio_wb32(pb, 16); + ffio_wfourcc(pb, "pasp"); + avio_wb32(pb, sar.num); + avio_wb32(pb, sar.den); return 16; } -static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); char compressor_name[32]; - put_be32(pb, 0); /* size */ - put_le32(pb, track->tag); // store it byteswapped - put_be32(pb, 0); /* Reserved */ - put_be16(pb, 0); /* Reserved */ - put_be16(pb, 1); /* Data-reference index */ + avio_wb32(pb, 0); /* size */ + avio_wl32(pb, track->tag); // store it byteswapped + avio_wb32(pb, 0); /* Reserved */ + avio_wb16(pb, 0); /* Reserved */ + avio_wb16(pb, 1); /* Data-reference index */ - put_be16(pb, 0); /* Codec stream version */ - put_be16(pb, 0); /* Codec stream revision (=0) */ + avio_wb16(pb, 0); /* Codec stream version */ + avio_wb16(pb, 0); /* Codec stream revision (=0) */ if (track->mode == MODE_MOV) { - put_tag(pb, "FFMP"); /* Vendor */ + ffio_wfourcc(pb, "FFMP"); /* Vendor */ if(track->enc->codec_id == CODEC_ID_RAWVIDEO) { - put_be32(pb, 0); /* Temporal Quality */ - put_be32(pb, 0x400); /* Spatial Quality = lossless*/ + avio_wb32(pb, 0); /* Temporal Quality */ + avio_wb32(pb, 0x400); /* Spatial Quality = lossless*/ } else { - put_be32(pb, 0x200); /* Temporal Quality = normal */ - put_be32(pb, 0x200); /* Spatial Quality = normal */ + avio_wb32(pb, 0x200); /* Temporal Quality = normal */ + avio_wb32(pb, 0x200); /* Spatial Quality = normal */ } } else { - put_be32(pb, 0); /* Reserved */ - put_be32(pb, 0); /* Reserved */ - put_be32(pb, 0); /* Reserved */ + avio_wb32(pb, 0); /* Reserved */ + avio_wb32(pb, 0); /* Reserved */ + avio_wb32(pb, 0); /* Reserved */ } - put_be16(pb, track->enc->width); /* Video width */ - put_be16(pb, track->height); /* Video height */ - put_be32(pb, 0x00480000); /* Horizontal resolution 72dpi */ - put_be32(pb, 0x00480000); /* Vertical resolution 72dpi */ - put_be32(pb, 0); /* Data size (= 0) */ - put_be16(pb, 1); /* Frame count (= 1) */ + avio_wb16(pb, track->enc->width); /* Video width */ + avio_wb16(pb, track->height); /* Video height */ + avio_wb32(pb, 0x00480000); /* Horizontal resolution 72dpi */ + avio_wb32(pb, 0x00480000); /* Vertical resolution 72dpi */ + avio_wb32(pb, 0); /* Data size (= 0) */ + avio_wb16(pb, 1); /* Frame count (= 1) */ memset(compressor_name,0,32); /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */ if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name) strncpy(compressor_name,track->enc->codec->name,31); - put_byte(pb, strlen(compressor_name)); - put_buffer(pb, compressor_name, 31); + avio_w8(pb, strlen(compressor_name)); + avio_write(pb, compressor_name, 31); if (track->mode == MODE_MOV && track->enc->bits_per_coded_sample) - put_be16(pb, track->enc->bits_per_coded_sample); + avio_wb16(pb, track->enc->bits_per_coded_sample); else - put_be16(pb, 0x18); /* Reserved */ - put_be16(pb, 0xffff); /* Reserved */ + avio_wb16(pb, 0x18); /* Reserved */ + avio_wb16(pb, 0xffff); /* Reserved */ if(track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if(track->enc->codec_id == CODEC_ID_H263) @@ -839,8 +851,7 @@ static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track) } else if(track->vosLen > 0) mov_write_glbl_tag(pb, track); - if (track->mode == MODE_MOV && - track->enc->sample_aspect_ratio.den && track->enc->sample_aspect_ratio.num && + if (track->enc->sample_aspect_ratio.den && track->enc->sample_aspect_ratio.num && track->enc->sample_aspect_ratio.den != track->enc->sample_aspect_ratio.num) { mov_write_pasp_tag(pb, track); } @@ -848,33 +859,33 @@ static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_rtp_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ - put_tag(pb, "rtp "); - put_be32(pb, 0); /* Reserved */ - put_be16(pb, 0); /* Reserved */ - put_be16(pb, 1); /* Data-reference index */ + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "rtp "); + avio_wb32(pb, 0); /* Reserved */ + avio_wb16(pb, 0); /* Reserved */ + avio_wb16(pb, 1); /* Data-reference index */ - put_be16(pb, 1); /* Hint track version */ - put_be16(pb, 1); /* Highest compatible version */ - put_be32(pb, track->max_packet_size); /* Max packet size */ + avio_wb16(pb, 1); /* Hint track version */ + avio_wb16(pb, 1); /* Highest compatible version */ + avio_wb32(pb, track->max_packet_size); /* Max packet size */ - put_be32(pb, 12); /* size */ - put_tag(pb, "tims"); - put_be32(pb, track->timescale); + avio_wb32(pb, 12); /* size */ + ffio_wfourcc(pb, "tims"); + avio_wb32(pb, track->timescale); return updateSize(pb, pos); } -static int mov_write_stsd_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_stsd_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ - put_tag(pb, "stsd"); - put_be32(pb, 0); /* version & flags */ - put_be32(pb, 1); /* entry count */ + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "stsd"); + avio_wb32(pb, 0); /* version & flags */ + avio_wb32(pb, 1); /* entry count */ if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) mov_write_video_tag(pb, track); else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) @@ -886,7 +897,7 @@ static int mov_write_stsd_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_ctts_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) { MOVStts *ctts_entries; uint32_t entries = 0; @@ -907,20 +918,20 @@ static int mov_write_ctts_tag(ByteIOContext *pb, MOVTrack *track) } entries++; /* last one */ atom_size = 16 + (entries * 8); - put_be32(pb, atom_size); /* size */ - put_tag(pb, "ctts"); - put_be32(pb, 0); /* version & flags */ - put_be32(pb, entries); /* entry count */ + avio_wb32(pb, atom_size); /* size */ + ffio_wfourcc(pb, "ctts"); + avio_wb32(pb, 0); /* version & flags */ + avio_wb32(pb, entries); /* entry count */ for (i=0; ienc->codec_type == AVMEDIA_TYPE_VIDEO || @@ -997,59 +1008,59 @@ static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_dinf_tag(ByteIOContext *pb) +static int mov_write_dinf_tag(AVIOContext *pb) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ - put_tag(pb, "dinf"); + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "dinf"); mov_write_dref_tag(pb); return updateSize(pb, pos); } -static int mov_write_nmhd_tag(ByteIOContext *pb) +static int mov_write_nmhd_tag(AVIOContext *pb) { - put_be32(pb, 12); - put_tag(pb, "nmhd"); - put_be32(pb, 0); + avio_wb32(pb, 12); + ffio_wfourcc(pb, "nmhd"); + avio_wb32(pb, 0); return 12; } -static int mov_write_gmhd_tag(ByteIOContext *pb) +static int mov_write_gmhd_tag(AVIOContext *pb) { - put_be32(pb, 0x20); /* size */ - put_tag(pb, "gmhd"); - put_be32(pb, 0x18); /* gmin size */ - put_tag(pb, "gmin"); /* generic media info */ - put_be32(pb, 0); /* version & flags */ - put_be16(pb, 0x40); /* graphics mode = */ - put_be16(pb, 0x8000); /* opColor (r?) */ - put_be16(pb, 0x8000); /* opColor (g?) */ - put_be16(pb, 0x8000); /* opColor (b?) */ - put_be16(pb, 0); /* balance */ - put_be16(pb, 0); /* reserved */ + avio_wb32(pb, 0x20); /* size */ + ffio_wfourcc(pb, "gmhd"); + avio_wb32(pb, 0x18); /* gmin size */ + ffio_wfourcc(pb, "gmin");/* generic media info */ + avio_wb32(pb, 0); /* version & flags */ + avio_wb16(pb, 0x40); /* graphics mode = */ + avio_wb16(pb, 0x8000); /* opColor (r?) */ + avio_wb16(pb, 0x8000); /* opColor (g?) */ + avio_wb16(pb, 0x8000); /* opColor (b?) */ + avio_wb16(pb, 0); /* balance */ + avio_wb16(pb, 0); /* reserved */ return 0x20; } -static int mov_write_smhd_tag(ByteIOContext *pb) +static int mov_write_smhd_tag(AVIOContext *pb) { - put_be32(pb, 16); /* size */ - put_tag(pb, "smhd"); - put_be32(pb, 0); /* version & flags */ - put_be16(pb, 0); /* reserved (balance, normally = 0) */ - put_be16(pb, 0); /* reserved */ + avio_wb32(pb, 16); /* size */ + ffio_wfourcc(pb, "smhd"); + avio_wb32(pb, 0); /* version & flags */ + avio_wb16(pb, 0); /* reserved (balance, normally = 0) */ + avio_wb16(pb, 0); /* reserved */ return 16; } -static int mov_write_vmhd_tag(ByteIOContext *pb) +static int mov_write_vmhd_tag(AVIOContext *pb) { - put_be32(pb, 0x14); /* size (always 0x14) */ - put_tag(pb, "vmhd"); - put_be32(pb, 0x01); /* version & flags */ - put_be64(pb, 0); /* reserved (graphics mode = copy) */ + avio_wb32(pb, 0x14); /* size (always 0x14) */ + ffio_wfourcc(pb, "vmhd"); + avio_wb32(pb, 0x01); /* version & flags */ + avio_wb64(pb, 0); /* reserved (graphics mode = copy) */ return 0x14; } -static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track) { const char *hdlr, *descr = NULL, *hdlr_type = NULL; int64_t pos = url_ftell(pb); @@ -1076,42 +1087,42 @@ static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack *track) } } - put_be32(pb, 0); /* size */ - put_tag(pb, "hdlr"); - put_be32(pb, 0); /* Version & flags */ - put_buffer(pb, hdlr, 4); /* handler */ - put_tag(pb, hdlr_type); /* handler type */ - put_be32(pb ,0); /* reserved */ - put_be32(pb ,0); /* reserved */ - put_be32(pb ,0); /* reserved */ + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "hdlr"); + avio_wb32(pb, 0); /* Version & flags */ + avio_write(pb, hdlr, 4); /* handler */ + ffio_wfourcc(pb, hdlr_type); /* handler type */ + avio_wb32(pb ,0); /* reserved */ + avio_wb32(pb ,0); /* reserved */ + avio_wb32(pb ,0); /* reserved */ if (!track || track->mode == MODE_MOV) - put_byte(pb, strlen(descr)); /* pascal string */ - put_buffer(pb, descr, strlen(descr)); /* handler description */ + avio_w8(pb, strlen(descr)); /* pascal string */ + avio_write(pb, descr, strlen(descr)); /* handler description */ if (track && track->mode != MODE_MOV) - put_byte(pb, 0); /* c string */ + avio_w8(pb, 0); /* c string */ return updateSize(pb, pos); } -static int mov_write_hmhd_tag(ByteIOContext *pb) +static int mov_write_hmhd_tag(AVIOContext *pb) { /* This atom must be present, but leaving the values at zero * seems harmless. */ - put_be32(pb, 28); /* size */ - put_tag(pb, "hmhd"); - put_be32(pb, 0); /* version, flags */ - put_be16(pb, 0); /* maxPDUsize */ - put_be16(pb, 0); /* avgPDUsize */ - put_be32(pb, 0); /* maxbitrate */ - put_be32(pb, 0); /* avgbitrate */ - put_be32(pb, 0); /* reserved */ + avio_wb32(pb, 28); /* size */ + ffio_wfourcc(pb, "hmhd"); + avio_wb32(pb, 0); /* version, flags */ + avio_wb16(pb, 0); /* maxPDUsize */ + avio_wb16(pb, 0); /* avgPDUsize */ + avio_wb32(pb, 0); /* maxbitrate */ + avio_wb32(pb, 0); /* avgbitrate */ + avio_wb32(pb, 0); /* reserved */ return 28; } -static int mov_write_minf_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ - put_tag(pb, "minf"); + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "minf"); if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO) mov_write_vmhd_tag(pb); else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) @@ -1129,25 +1140,25 @@ static int mov_write_minf_tag(ByteIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } -static int mov_write_mdhd_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track) { int version = track->trackDuration < INT32_MAX ? 0 : 1; - (version == 1) ? put_be32(pb, 44) : put_be32(pb, 32); /* size */ - put_tag(pb, "mdhd"); - put_byte(pb, version); - put_be24(pb, 0); /* flags */ + (version == 1) ? avio_wb32(pb, 44) : avio_wb32(pb, 32); /* size */ + ffio_wfourcc(pb, "mdhd"); + avio_w8(pb, version); + avio_wb24(pb, 0); /* flags */ if (version == 1) { - put_be64(pb, track->time); - put_be64(pb, track->time); + avio_wb64(pb, track->time); + avio_wb64(pb, track->time); } else { - put_be32(pb, track->time); /* creation time */ - put_be32(pb, track->time); /* modification time */ + avio_wb32(pb, track->time); /* creation time */ + avio_wb32(pb, track->time); /* modification time */ } - put_be32(pb, track->timescale); /* time scale (sample rate for audio) */ - (version == 1) ? put_be64(pb, track->trackDuration) : put_be32(pb, track->trackDuration); /* duration */ - put_be16(pb, track->language); /* language */ - put_be16(pb, 0); /* reserved (quality) */ + avio_wb32(pb, track->timescale); /* time scale (sample rate for audio) */ + (version == 1) ? avio_wb64(pb, track->trackDuration) : avio_wb32(pb, track->trackDuration); /* duration */ + avio_wb16(pb, track->language); /* language */ + avio_wb16(pb, 0); /* reserved (quality) */ if(version!=0 && track->mode == MODE_MOV){ av_log(NULL, AV_LOG_ERROR, @@ -1159,124 +1170,154 @@ static int mov_write_mdhd_tag(ByteIOContext *pb, MOVTrack *track) return 32; } -static int mov_write_mdia_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_mdia_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ - put_tag(pb, "mdia"); + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "mdia"); mov_write_mdhd_tag(pb, track); mov_write_hdlr_tag(pb, track); mov_write_minf_tag(pb, track); return updateSize(pb, pos); } -static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st) +static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) { int64_t duration = av_rescale_rnd(track->trackDuration, MOV_TIMESCALE, track->timescale, AV_ROUND_UP); int version = duration < INT32_MAX ? 0 : 1; - (version == 1) ? put_be32(pb, 104) : put_be32(pb, 92); /* size */ - put_tag(pb, "tkhd"); - put_byte(pb, version); - put_be24(pb, 0xf); /* flags (track enabled) */ + (version == 1) ? avio_wb32(pb, 104) : avio_wb32(pb, 92); /* size */ + ffio_wfourcc(pb, "tkhd"); + avio_w8(pb, version); + avio_wb24(pb, 0xf); /* flags (track enabled) */ if (version == 1) { - put_be64(pb, track->time); - put_be64(pb, track->time); + avio_wb64(pb, track->time); + avio_wb64(pb, track->time); } else { - put_be32(pb, track->time); /* creation time */ - put_be32(pb, track->time); /* modification time */ + avio_wb32(pb, track->time); /* creation time */ + avio_wb32(pb, track->time); /* modification time */ } - put_be32(pb, track->trackID); /* track-id */ - put_be32(pb, 0); /* reserved */ - (version == 1) ? put_be64(pb, duration) : put_be32(pb, duration); + avio_wb32(pb, track->trackID); /* track-id */ + avio_wb32(pb, 0); /* reserved */ + (version == 1) ? avio_wb64(pb, duration) : avio_wb32(pb, duration); - put_be32(pb, 0); /* reserved */ - put_be32(pb, 0); /* reserved */ - put_be32(pb, 0x0); /* reserved (Layer & Alternate group) */ + avio_wb32(pb, 0); /* reserved */ + avio_wb32(pb, 0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved (Layer & Alternate group) */ /* Volume, only for audio */ if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO) - put_be16(pb, 0x0100); + avio_wb16(pb, 0x0100); else - put_be16(pb, 0); - put_be16(pb, 0); /* reserved */ + avio_wb16(pb, 0); + avio_wb16(pb, 0); /* reserved */ /* Matrix structure */ - put_be32(pb, 0x00010000); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x00010000); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x40000000); /* reserved */ + avio_wb32(pb, 0x00010000); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x00010000); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x40000000); /* reserved */ /* Track width and height, for visual only */ if(st && (track->enc->codec_type == AVMEDIA_TYPE_VIDEO || track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)) { - double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio); - if(!sample_aspect_ratio || track->height != track->enc->height) - sample_aspect_ratio = 1; - put_be32(pb, sample_aspect_ratio * track->enc->width*0x10000); - put_be32(pb, track->height*0x10000); + if(track->mode == MODE_MOV) { + avio_wb32(pb, track->enc->width << 16); + avio_wb32(pb, track->height << 16); + } else { + double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio); + if(!sample_aspect_ratio || track->height != track->enc->height) + sample_aspect_ratio = 1; + avio_wb32(pb, sample_aspect_ratio * track->enc->width*0x10000); + avio_wb32(pb, track->height*0x10000); + } } else { - put_be32(pb, 0); - put_be32(pb, 0); + avio_wb32(pb, 0); + avio_wb32(pb, 0); } return 0x5c; } +static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track) +{ + int32_t width = av_rescale(track->enc->sample_aspect_ratio.num, track->enc->width, + track->enc->sample_aspect_ratio.den); + + int64_t pos = url_ftell(pb); + + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "tapt"); + + avio_wb32(pb, 20); + ffio_wfourcc(pb, "clef"); + avio_wb32(pb, 0); + avio_wb32(pb, width << 16); + avio_wb32(pb, track->enc->height << 16); + + avio_wb32(pb, 20); + ffio_wfourcc(pb, "enof"); + avio_wb32(pb, 0); + avio_wb32(pb, track->enc->width << 16); + avio_wb32(pb, track->enc->height << 16); + + return updateSize(pb, pos); +}; + // This box seems important for the psp playback ... without it the movie seems to hang -static int mov_write_edts_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track) { - put_be32(pb, 0x24); /* size */ - put_tag(pb, "edts"); - put_be32(pb, 0x1c); /* size */ - put_tag(pb, "elst"); - put_be32(pb, 0x0); - put_be32(pb, 0x1); + avio_wb32(pb, 0x24); /* size */ + ffio_wfourcc(pb, "edts"); + avio_wb32(pb, 0x1c); /* size */ + ffio_wfourcc(pb, "elst"); + avio_wb32(pb, 0x0); + avio_wb32(pb, 0x1); /* duration ... doesn't seem to effect psp */ - put_be32(pb, av_rescale_rnd(track->trackDuration, MOV_TIMESCALE, + avio_wb32(pb, av_rescale_rnd(track->trackDuration, MOV_TIMESCALE, track->timescale, AV_ROUND_UP)); - put_be32(pb, track->cluster[0].cts); /* first pts is cts since dts is 0 */ - put_be32(pb, 0x00010000); + avio_wb32(pb, track->cluster[0].cts); /* first pts is cts since dts is 0 */ + avio_wb32(pb, 0x00010000); return 0x24; } -static int mov_write_tref_tag(ByteIOContext *pb, MOVTrack *track) +static int mov_write_tref_tag(AVIOContext *pb, MOVTrack *track) { - put_be32(pb, 20); // size - put_tag(pb, "tref"); - put_be32(pb, 12); // size (subatom) - put_le32(pb, track->tref_tag); - put_be32(pb, track->tref_id); + avio_wb32(pb, 20); // size + ffio_wfourcc(pb, "tref"); + avio_wb32(pb, 12); // size (subatom) + avio_wl32(pb, track->tref_tag); + avio_wb32(pb, track->tref_id); return 20; } // goes at the end of each track! ... Critical for PSP playback ("Incompatible data" without it) -static int mov_write_uuid_tag_psp(ByteIOContext *pb, MOVTrack *mov) -{ - put_be32(pb, 0x34); /* size ... reports as 28 in mp4box! */ - put_tag(pb, "uuid"); - put_tag(pb, "USMT"); - put_be32(pb, 0x21d24fce); - put_be32(pb, 0xbb88695c); - put_be32(pb, 0xfac9c740); - put_be32(pb, 0x1c); // another size here! - put_tag(pb, "MTDT"); - put_be32(pb, 0x00010012); - put_be32(pb, 0x0a); - put_be32(pb, 0x55c40000); - put_be32(pb, 0x1); - put_be32(pb, 0x0); +static int mov_write_uuid_tag_psp(AVIOContext *pb, MOVTrack *mov) +{ + avio_wb32(pb, 0x34); /* size ... reports as 28 in mp4box! */ + ffio_wfourcc(pb, "uuid"); + ffio_wfourcc(pb, "USMT"); + avio_wb32(pb, 0x21d24fce); + avio_wb32(pb, 0xbb88695c); + avio_wb32(pb, 0xfac9c740); + avio_wb32(pb, 0x1c); // another size here! + ffio_wfourcc(pb, "MTDT"); + avio_wb32(pb, 0x00010012); + avio_wb32(pb, 0x0a); + avio_wb32(pb, 0x55c40000); + avio_wb32(pb, 0x1); + avio_wb32(pb, 0x0); return 0x34; } -static int mov_write_udta_sdp(ByteIOContext *pb, AVCodecContext *ctx, int index) +static int mov_write_udta_sdp(AVIOContext *pb, AVCodecContext *ctx, int index) { char buf[1000] = ""; int len; @@ -1285,21 +1326,21 @@ static int mov_write_udta_sdp(ByteIOContext *pb, AVCodecContext *ctx, int index) av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index); len = strlen(buf); - put_be32(pb, len + 24); - put_tag (pb, "udta"); - put_be32(pb, len + 16); - put_tag (pb, "hnti"); - put_be32(pb, len + 8); - put_tag (pb, "sdp "); - put_buffer(pb, buf, len); + avio_wb32(pb, len + 24); + ffio_wfourcc(pb, "udta"); + avio_wb32(pb, len + 16); + ffio_wfourcc(pb, "hnti"); + avio_wb32(pb, len + 8); + ffio_wfourcc(pb, "sdp "); + avio_write(pb, buf, len); return len + 24; } -static int mov_write_trak_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st) +static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ - put_tag(pb, "trak"); + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "trak"); mov_write_tkhd_tag(pb, track, st); if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS) mov_write_edts_tag(pb, track); // PSP Movies require edts box @@ -1310,26 +1351,31 @@ static int mov_write_trak_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st) mov_write_uuid_tag_psp(pb,track); // PSP Movies require this uuid box if (track->tag == MKTAG('r','t','p',' ')) mov_write_udta_sdp(pb, track->rtp_ctx->streams[0]->codec, track->trackID); + if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO && track->mode == MODE_MOV) { + double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio); + if (0.0 != sample_aspect_ratio && 1.0 != sample_aspect_ratio) + mov_write_tapt_tag(pb, track); + }; return updateSize(pb, pos); } #if 0 /* TODO: Not sorted out, but not necessary either */ -static int mov_write_iods_tag(ByteIOContext *pb, MOVMuxContext *mov) -{ - put_be32(pb, 0x15); /* size */ - put_tag(pb, "iods"); - put_be32(pb, 0); /* version & flags */ - put_be16(pb, 0x1007); - put_byte(pb, 0); - put_be16(pb, 0x4fff); - put_be16(pb, 0xfffe); - put_be16(pb, 0x01ff); +static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov) +{ + avio_wb32(pb, 0x15); /* size */ + ffio_wfourcc(pb, "iods"); + avio_wb32(pb, 0); /* version & flags */ + avio_wb16(pb, 0x1007); + avio_w8(pb, 0); + avio_wb16(pb, 0x4fff); + avio_wb16(pb, 0xfffe); + avio_wb16(pb, 0x01ff); return 0x15; } #endif -static int mov_write_mvhd_tag(ByteIOContext *pb, MOVMuxContext *mov) +static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov) { int maxTrackID = 1, i; int64_t maxTrackLenTemp, maxTrackLen = 0; @@ -1349,96 +1395,96 @@ static int mov_write_mvhd_tag(ByteIOContext *pb, MOVMuxContext *mov) } version = maxTrackLen < UINT32_MAX ? 0 : 1; - (version == 1) ? put_be32(pb, 120) : put_be32(pb, 108); /* size */ - put_tag(pb, "mvhd"); - put_byte(pb, version); - put_be24(pb, 0); /* flags */ + (version == 1) ? avio_wb32(pb, 120) : avio_wb32(pb, 108); /* size */ + ffio_wfourcc(pb, "mvhd"); + avio_w8(pb, version); + avio_wb24(pb, 0); /* flags */ if (version == 1) { - put_be64(pb, mov->time); - put_be64(pb, mov->time); + avio_wb64(pb, mov->time); + avio_wb64(pb, mov->time); } else { - put_be32(pb, mov->time); /* creation time */ - put_be32(pb, mov->time); /* modification time */ + avio_wb32(pb, mov->time); /* creation time */ + avio_wb32(pb, mov->time); /* modification time */ } - put_be32(pb, MOV_TIMESCALE); - (version == 1) ? put_be64(pb, maxTrackLen) : put_be32(pb, maxTrackLen); /* duration of longest track */ + avio_wb32(pb, MOV_TIMESCALE); + (version == 1) ? avio_wb64(pb, maxTrackLen) : avio_wb32(pb, maxTrackLen); /* duration of longest track */ - put_be32(pb, 0x00010000); /* reserved (preferred rate) 1.0 = normal */ - put_be16(pb, 0x0100); /* reserved (preferred volume) 1.0 = normal */ - put_be16(pb, 0); /* reserved */ - put_be32(pb, 0); /* reserved */ - put_be32(pb, 0); /* reserved */ + avio_wb32(pb, 0x00010000); /* reserved (preferred rate) 1.0 = normal */ + avio_wb16(pb, 0x0100); /* reserved (preferred volume) 1.0 = normal */ + avio_wb16(pb, 0); /* reserved */ + avio_wb32(pb, 0); /* reserved */ + avio_wb32(pb, 0); /* reserved */ /* Matrix structure */ - put_be32(pb, 0x00010000); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x00010000); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x0); /* reserved */ - put_be32(pb, 0x40000000); /* reserved */ - - put_be32(pb, 0); /* reserved (preview time) */ - put_be32(pb, 0); /* reserved (preview duration) */ - put_be32(pb, 0); /* reserved (poster time) */ - put_be32(pb, 0); /* reserved (selection time) */ - put_be32(pb, 0); /* reserved (selection duration) */ - put_be32(pb, 0); /* reserved (current time) */ - put_be32(pb, maxTrackID+1); /* Next track id */ + avio_wb32(pb, 0x00010000); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x00010000); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x0); /* reserved */ + avio_wb32(pb, 0x40000000); /* reserved */ + + avio_wb32(pb, 0); /* reserved (preview time) */ + avio_wb32(pb, 0); /* reserved (preview duration) */ + avio_wb32(pb, 0); /* reserved (poster time) */ + avio_wb32(pb, 0); /* reserved (selection time) */ + avio_wb32(pb, 0); /* reserved (selection duration) */ + avio_wb32(pb, 0); /* reserved (current time) */ + avio_wb32(pb, maxTrackID+1); /* Next track id */ return 0x6c; } -static int mov_write_itunes_hdlr_tag(ByteIOContext *pb, MOVMuxContext *mov, +static int mov_write_itunes_hdlr_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { - put_be32(pb, 33); /* size */ - put_tag(pb, "hdlr"); - put_be32(pb, 0); - put_be32(pb, 0); - put_tag(pb, "mdir"); - put_tag(pb, "appl"); - put_be32(pb, 0); - put_be32(pb, 0); - put_byte(pb, 0); + avio_wb32(pb, 33); /* size */ + ffio_wfourcc(pb, "hdlr"); + avio_wb32(pb, 0); + avio_wb32(pb, 0); + ffio_wfourcc(pb, "mdir"); + ffio_wfourcc(pb, "appl"); + avio_wb32(pb, 0); + avio_wb32(pb, 0); + avio_w8(pb, 0); return 33; } /* helper function to write a data tag with the specified string as data */ -static int mov_write_string_data_tag(ByteIOContext *pb, const char *data, int lang, int long_style) +static int mov_write_string_data_tag(AVIOContext *pb, const char *data, int lang, int long_style) { if(long_style){ int size = 16 + strlen(data); - put_be32(pb, size); /* size */ - put_tag(pb, "data"); - put_be32(pb, 1); - put_be32(pb, 0); - put_buffer(pb, data, strlen(data)); + avio_wb32(pb, size); /* size */ + ffio_wfourcc(pb, "data"); + avio_wb32(pb, 1); + avio_wb32(pb, 0); + avio_write(pb, data, strlen(data)); return size; }else{ if (!lang) lang = ff_mov_iso639_to_lang("und", 1); - put_be16(pb, strlen(data)); /* string length */ - put_be16(pb, lang); - put_buffer(pb, data, strlen(data)); + avio_wb16(pb, strlen(data)); /* string length */ + avio_wb16(pb, lang); + avio_write(pb, data, strlen(data)); return strlen(data) + 4; } } -static int mov_write_string_tag(ByteIOContext *pb, const char *name, const char *value, int lang, int long_style){ +static int mov_write_string_tag(AVIOContext *pb, const char *name, const char *value, int lang, int long_style){ int size = 0; if (value && value[0]) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ - put_tag(pb, name); + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, name); mov_write_string_data_tag(pb, value, lang, long_style); size= updateSize(pb, pos); } return size; } -static int mov_write_string_metadata(AVFormatContext *s, ByteIOContext *pb, +static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb, const char *name, const char *tag, int long_style) { @@ -1463,34 +1509,34 @@ static int mov_write_string_metadata(AVFormatContext *s, ByteIOContext *pb, } /* iTunes track number */ -static int mov_write_trkn_tag(ByteIOContext *pb, MOVMuxContext *mov, +static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { AVMetadataTag *t = av_metadata_get(s->metadata, "track", NULL, 0); int size = 0, track = t ? atoi(t->value) : 0; if (track) { - put_be32(pb, 32); /* size */ - put_tag(pb, "trkn"); - put_be32(pb, 24); /* size */ - put_tag(pb, "data"); - put_be32(pb, 0); // 8 bytes empty - put_be32(pb, 0); - put_be16(pb, 0); // empty - put_be16(pb, track); // track number - put_be16(pb, 0); // total track number - put_be16(pb, 0); // empty + avio_wb32(pb, 32); /* size */ + ffio_wfourcc(pb, "trkn"); + avio_wb32(pb, 24); /* size */ + ffio_wfourcc(pb, "data"); + avio_wb32(pb, 0); // 8 bytes empty + avio_wb32(pb, 0); + avio_wb16(pb, 0); // empty + avio_wb16(pb, track); // track number + avio_wb16(pb, 0); // total track number + avio_wb16(pb, 0); // empty size = 32; } return size; } /* iTunes meta data list */ -static int mov_write_ilst_tag(ByteIOContext *pb, MOVMuxContext *mov, +static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ - put_tag(pb, "ilst"); + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "ilst"); mov_write_string_metadata(s, pb, "\251nam", "title" , 1); mov_write_string_metadata(s, pb, "\251ART", "artist" , 1); mov_write_string_metadata(s, pb, "aART", "album_artist", 1); @@ -1513,14 +1559,14 @@ static int mov_write_ilst_tag(ByteIOContext *pb, MOVMuxContext *mov, } /* iTunes meta data tag */ -static int mov_write_meta_tag(ByteIOContext *pb, MOVMuxContext *mov, +static int mov_write_meta_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int size = 0; int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size */ - put_tag(pb, "meta"); - put_be32(pb, 0); + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "meta"); + avio_wb32(pb, 0); mov_write_itunes_hdlr_tag(pb, mov, s); mov_write_ilst_tag(pb, mov, s); size = updateSize(pb, pos); @@ -1538,14 +1584,14 @@ static int utf8len(const uint8_t *b) return len; } -static int ascii_to_wc(ByteIOContext *pb, const uint8_t *b) +static int ascii_to_wc(AVIOContext *pb, const uint8_t *b) { int val; while(*b){ GET_UTF8(val, *b++, return -1;) - put_be16(pb, val); + avio_wb16(pb, val); } - put_be16(pb, 0x00); + avio_wb16(pb, 0x00); return 0; } @@ -1554,58 +1600,58 @@ static uint16_t language_code(const char *str) return (((str[0]-0x60) & 0x1F) << 10) + (((str[1]-0x60) & 0x1F) << 5) + ((str[2]-0x60) & 0x1F); } -static int mov_write_3gp_udta_tag(ByteIOContext *pb, AVFormatContext *s, +static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s, const char *tag, const char *str) { int64_t pos = url_ftell(pb); AVMetadataTag *t = av_metadata_get(s->metadata, str, NULL, 0); if (!t || !utf8len(t->value)) return 0; - put_be32(pb, 0); /* size */ - put_tag (pb, tag); /* type */ - put_be32(pb, 0); /* version + flags */ + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, tag); /* type */ + avio_wb32(pb, 0); /* version + flags */ if (!strcmp(tag, "yrrc")) - put_be16(pb, atoi(t->value)); + avio_wb16(pb, atoi(t->value)); else { - put_be16(pb, language_code("eng")); /* language */ - put_buffer(pb, t->value, strlen(t->value)+1); /* UTF8 string value */ + avio_wb16(pb, language_code("eng")); /* language */ + avio_write(pb, t->value, strlen(t->value)+1); /* UTF8 string value */ if (!strcmp(tag, "albm") && (t = av_metadata_get(s->metadata, "track", NULL, 0))) - put_byte(pb, atoi(t->value)); + avio_w8(pb, atoi(t->value)); } return updateSize(pb, pos); } -static int mov_write_chpl_tag(ByteIOContext *pb, AVFormatContext *s) +static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s) { int64_t pos = url_ftell(pb); int i, nb_chapters = FFMIN(s->nb_chapters, 255); - put_be32(pb, 0); // size - put_tag (pb, "chpl"); - put_be32(pb, 0x01000000); // version + flags - put_be32(pb, 0); // unknown - put_byte(pb, nb_chapters); + avio_wb32(pb, 0); // size + ffio_wfourcc(pb, "chpl"); + avio_wb32(pb, 0x01000000); // version + flags + avio_wb32(pb, 0); // unknown + avio_w8(pb, nb_chapters); for (i = 0; i < nb_chapters; i++) { AVChapter *c = s->chapters[i]; AVMetadataTag *t; - put_be64(pb, av_rescale_q(c->start, c->time_base, (AVRational){1,10000000})); + avio_wb64(pb, av_rescale_q(c->start, c->time_base, (AVRational){1,10000000})); if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) { int len = FFMIN(strlen(t->value), 255); - put_byte(pb, len); - put_buffer(pb, t->value, len); + avio_w8(pb, len); + avio_write(pb, t->value, len); } else - put_byte(pb, 0); + avio_w8(pb, 0); } return updateSize(pb, pos); } -static int mov_write_udta_tag(ByteIOContext *pb, MOVMuxContext *mov, +static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { - ByteIOContext *pb_buf; + AVIOContext *pb_buf; int i, ret, size; uint8_t *buf; @@ -1646,53 +1692,53 @@ static int mov_write_udta_tag(ByteIOContext *pb, MOVMuxContext *mov, mov_write_chpl_tag(pb_buf, s); if ((size = url_close_dyn_buf(pb_buf, &buf)) > 0) { - put_be32(pb, size+8); - put_tag(pb, "udta"); - put_buffer(pb, buf, size); + avio_wb32(pb, size+8); + ffio_wfourcc(pb, "udta"); + avio_write(pb, buf, size); } av_free(buf); return 0; } -static void mov_write_psp_udta_tag(ByteIOContext *pb, +static void mov_write_psp_udta_tag(AVIOContext *pb, const char *str, const char *lang, int type) { int len = utf8len(str)+1; if(len<=0) return; - put_be16(pb, len*2+10); /* size */ - put_be32(pb, type); /* type */ - put_be16(pb, language_code(lang)); /* language */ - put_be16(pb, 0x01); /* ? */ + avio_wb16(pb, len*2+10); /* size */ + avio_wb32(pb, type); /* type */ + avio_wb16(pb, language_code(lang)); /* language */ + avio_wb16(pb, 0x01); /* ? */ ascii_to_wc(pb, str); } -static int mov_write_uuidusmt_tag(ByteIOContext *pb, AVFormatContext *s) +static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) { AVMetadataTag *title = av_metadata_get(s->metadata, "title", NULL, 0); int64_t pos, pos2; if (title) { pos = url_ftell(pb); - put_be32(pb, 0); /* size placeholder*/ - put_tag(pb, "uuid"); - put_tag(pb, "USMT"); - put_be32(pb, 0x21d24fce); /* 96 bit UUID */ - put_be32(pb, 0xbb88695c); - put_be32(pb, 0xfac9c740); + avio_wb32(pb, 0); /* size placeholder*/ + ffio_wfourcc(pb, "uuid"); + ffio_wfourcc(pb, "USMT"); + avio_wb32(pb, 0x21d24fce); /* 96 bit UUID */ + avio_wb32(pb, 0xbb88695c); + avio_wb32(pb, 0xfac9c740); pos2 = url_ftell(pb); - put_be32(pb, 0); /* size placeholder*/ - put_tag(pb, "MTDT"); - put_be16(pb, 4); + avio_wb32(pb, 0); /* size placeholder*/ + ffio_wfourcc(pb, "MTDT"); + avio_wb16(pb, 4); // ? - put_be16(pb, 0x0C); /* size */ - put_be32(pb, 0x0B); /* type */ - put_be16(pb, language_code("und")); /* language */ - put_be16(pb, 0x0); /* ? */ - put_be16(pb, 0x021C); /* data */ + avio_wb16(pb, 0x0C); /* size */ + avio_wb32(pb, 0x0B); /* type */ + avio_wb16(pb, language_code("und")); /* language */ + avio_wb16(pb, 0x0); /* ? */ + avio_wb16(pb, 0x021C); /* data */ mov_write_psp_udta_tag(pb, LIBAVCODEC_IDENT, "eng", 0x04); mov_write_psp_udta_tag(pb, title->value, "eng", 0x01); @@ -1706,13 +1752,13 @@ static int mov_write_uuidusmt_tag(ByteIOContext *pb, AVFormatContext *s) return 0; } -static int mov_write_moov_tag(ByteIOContext *pb, MOVMuxContext *mov, +static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int i; int64_t pos = url_ftell(pb); - put_be32(pb, 0); /* size placeholder*/ - put_tag(pb, "moov"); + avio_wb32(pb, 0); /* size placeholder*/ + ffio_wfourcc(pb, "moov"); for (i=0; inb_streams; i++) { if(mov->tracks[i].entry <= 0) continue; @@ -1750,19 +1796,19 @@ static int mov_write_moov_tag(ByteIOContext *pb, MOVMuxContext *mov, return updateSize(pb, pos); } -static int mov_write_mdat_tag(ByteIOContext *pb, MOVMuxContext *mov) +static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov) { - put_be32(pb, 8); // placeholder for extended size field (64 bit) - put_tag(pb, mov->mode == MODE_MOV ? "wide" : "free"); + avio_wb32(pb, 8); // placeholder for extended size field (64 bit) + ffio_wfourcc(pb, mov->mode == MODE_MOV ? "wide" : "free"); mov->mdat_pos = url_ftell(pb); - put_be32(pb, 0); /* size placeholder*/ - put_tag(pb, "mdat"); + avio_wb32(pb, 0); /* size placeholder*/ + ffio_wfourcc(pb, "mdat"); return 0; } /* TODO: This needs to be more general */ -static int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s) +static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; int64_t pos = url_ftell(pb); @@ -1778,47 +1824,47 @@ static int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s) has_h264 = 1; } - put_be32(pb, 0); /* size */ - put_tag(pb, "ftyp"); + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, "ftyp"); if (mov->mode == MODE_3GP) { - put_tag(pb, has_h264 ? "3gp6" : "3gp4"); + ffio_wfourcc(pb, has_h264 ? "3gp6" : "3gp4"); minor = has_h264 ? 0x100 : 0x200; } else if (mov->mode & MODE_3G2) { - put_tag(pb, has_h264 ? "3g2b" : "3g2a"); + ffio_wfourcc(pb, has_h264 ? "3g2b" : "3g2a"); minor = has_h264 ? 0x20000 : 0x10000; }else if (mov->mode == MODE_PSP) - put_tag(pb, "MSNV"); + ffio_wfourcc(pb, "MSNV"); else if (mov->mode == MODE_MP4) - put_tag(pb, "isom"); + ffio_wfourcc(pb, "isom"); else if (mov->mode == MODE_IPOD) - put_tag(pb, has_video ? "M4V ":"M4A "); + ffio_wfourcc(pb, has_video ? "M4V ":"M4A "); else - put_tag(pb, "qt "); + ffio_wfourcc(pb, "qt "); - put_be32(pb, minor); + avio_wb32(pb, minor); if(mov->mode == MODE_MOV) - put_tag(pb, "qt "); + ffio_wfourcc(pb, "qt "); else{ - put_tag(pb, "isom"); - put_tag(pb, "iso2"); + ffio_wfourcc(pb, "isom"); + ffio_wfourcc(pb, "iso2"); if(has_h264) - put_tag(pb, "avc1"); + ffio_wfourcc(pb, "avc1"); } if (mov->mode == MODE_3GP) - put_tag(pb, has_h264 ? "3gp6":"3gp4"); + ffio_wfourcc(pb, has_h264 ? "3gp6":"3gp4"); else if (mov->mode & MODE_3G2) - put_tag(pb, has_h264 ? "3g2b":"3g2a"); + ffio_wfourcc(pb, has_h264 ? "3g2b":"3g2a"); else if (mov->mode == MODE_PSP) - put_tag(pb, "MSNV"); + ffio_wfourcc(pb, "MSNV"); else if (mov->mode == MODE_MP4) - put_tag(pb, "mp41"); + ffio_wfourcc(pb, "mp41"); return updateSize(pb, pos); } -static void mov_write_uuidprof_tag(ByteIOContext *pb, AVFormatContext *s) +static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s) { AVCodecContext *VideoCodec = s->streams[0]->codec; AVCodecContext *AudioCodec = s->streams[1]->codec; @@ -1827,56 +1873,56 @@ static void mov_write_uuidprof_tag(ByteIOContext *pb, AVFormatContext *s) int audio_kbitrate= AudioCodec->bit_rate / 1000; int video_kbitrate= FFMIN(VideoCodec->bit_rate / 1000, 800 - audio_kbitrate); - put_be32(pb, 0x94); /* size */ - put_tag(pb, "uuid"); - put_tag(pb, "PROF"); - - put_be32(pb, 0x21d24fce); /* 96 bit UUID */ - put_be32(pb, 0xbb88695c); - put_be32(pb, 0xfac9c740); - - put_be32(pb, 0x0); /* ? */ - put_be32(pb, 0x3); /* 3 sections ? */ - - put_be32(pb, 0x14); /* size */ - put_tag(pb, "FPRF"); - put_be32(pb, 0x0); /* ? */ - put_be32(pb, 0x0); /* ? */ - put_be32(pb, 0x0); /* ? */ - - put_be32(pb, 0x2c); /* size */ - put_tag(pb, "APRF"); /* audio */ - put_be32(pb, 0x0); - put_be32(pb, 0x2); /* TrackID */ - put_tag(pb, "mp4a"); - put_be32(pb, 0x20f); - put_be32(pb, 0x0); - put_be32(pb, audio_kbitrate); - put_be32(pb, audio_kbitrate); - put_be32(pb, AudioRate); - put_be32(pb, AudioCodec->channels); - - put_be32(pb, 0x34); /* size */ - put_tag(pb, "VPRF"); /* video */ - put_be32(pb, 0x0); - put_be32(pb, 0x1); /* TrackID */ + avio_wb32(pb, 0x94); /* size */ + ffio_wfourcc(pb, "uuid"); + ffio_wfourcc(pb, "PROF"); + + avio_wb32(pb, 0x21d24fce); /* 96 bit UUID */ + avio_wb32(pb, 0xbb88695c); + avio_wb32(pb, 0xfac9c740); + + avio_wb32(pb, 0x0); /* ? */ + avio_wb32(pb, 0x3); /* 3 sections ? */ + + avio_wb32(pb, 0x14); /* size */ + ffio_wfourcc(pb, "FPRF"); + avio_wb32(pb, 0x0); /* ? */ + avio_wb32(pb, 0x0); /* ? */ + avio_wb32(pb, 0x0); /* ? */ + + avio_wb32(pb, 0x2c); /* size */ + ffio_wfourcc(pb, "APRF");/* audio */ + avio_wb32(pb, 0x0); + avio_wb32(pb, 0x2); /* TrackID */ + ffio_wfourcc(pb, "mp4a"); + avio_wb32(pb, 0x20f); + avio_wb32(pb, 0x0); + avio_wb32(pb, audio_kbitrate); + avio_wb32(pb, audio_kbitrate); + avio_wb32(pb, AudioRate); + avio_wb32(pb, AudioCodec->channels); + + avio_wb32(pb, 0x34); /* size */ + ffio_wfourcc(pb, "VPRF"); /* video */ + avio_wb32(pb, 0x0); + avio_wb32(pb, 0x1); /* TrackID */ if (VideoCodec->codec_id == CODEC_ID_H264) { - put_tag(pb, "avc1"); - put_be16(pb, 0x014D); - put_be16(pb, 0x0015); + ffio_wfourcc(pb, "avc1"); + avio_wb16(pb, 0x014D); + avio_wb16(pb, 0x0015); } else { - put_tag(pb, "mp4v"); - put_be16(pb, 0x0000); - put_be16(pb, 0x0103); + ffio_wfourcc(pb, "mp4v"); + avio_wb16(pb, 0x0000); + avio_wb16(pb, 0x0103); } - put_be32(pb, 0x0); - put_be32(pb, video_kbitrate); - put_be32(pb, video_kbitrate); - put_be32(pb, FrameRate); - put_be32(pb, FrameRate); - put_be16(pb, VideoCodec->width); - put_be16(pb, VideoCodec->height); - put_be32(pb, 0x010001); /* ? */ + avio_wb32(pb, 0x0); + avio_wb32(pb, video_kbitrate); + avio_wb32(pb, video_kbitrate); + avio_wb32(pb, FrameRate); + avio_wb32(pb, FrameRate); + avio_wb16(pb, VideoCodec->width); + avio_wb16(pb, VideoCodec->height); + avio_wb32(pb, 0x010001); /* ? */ } static int mov_parse_mpeg2_frame(AVPacket *pkt, uint32_t *flags) @@ -1903,7 +1949,7 @@ static int mov_parse_mpeg2_frame(AVPacket *pkt, uint32_t *flags) int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) { MOVMuxContext *mov = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; MOVTrack *trk = &mov->tracks[pkt->stream_index]; AVCodecContext *enc = trk->enc; unsigned int samplesInChunk = 0; @@ -1946,7 +1992,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) /* nal reformating needed */ size = ff_avc_parse_nal_units(pb, pkt->data, pkt->size); } else { - put_buffer(pb, pkt->data, size); + avio_write(pb, pkt->data, size); } if ((enc->codec_id == CODEC_ID_DNXHD || @@ -1981,7 +2027,8 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) trk->cluster[trk->entry].cts = pkt->pts - pkt->dts; trk->cluster[trk->entry].flags = 0; if (pkt->flags & AV_PKT_FLAG_KEY) { - if (mov->mode == MODE_MOV && enc->codec_id == CODEC_ID_MPEG2VIDEO) { + if (mov->mode == MODE_MOV && enc->codec_id == CODEC_ID_MPEG2VIDEO && + trk->entry > 0) { // force sync sample for the first key frame mov_parse_mpeg2_frame(pkt, &trk->cluster[trk->entry].flags); if (trk->cluster[trk->entry].flags & MOV_PARTIAL_SYNC_SAMPLE) trk->flags |= MOV_TRACK_STPS; @@ -2039,7 +2086,7 @@ static void mov_create_chapter_track(AVFormatContext *s, int tracknum) static int mov_write_header(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; MOVMuxContext *mov = s->priv_data; int i, hint_track = 0; @@ -2191,7 +2238,7 @@ static int mov_write_header(AVFormatContext *s) static int mov_write_trailer(AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int res = 0; int i; @@ -2199,16 +2246,16 @@ static int mov_write_trailer(AVFormatContext *s) /* Write size of mdat tag */ if (mov->mdat_size+8 <= UINT32_MAX) { - url_fseek(pb, mov->mdat_pos, SEEK_SET); - put_be32(pb, mov->mdat_size+8); + avio_seek(pb, mov->mdat_pos, SEEK_SET); + avio_wb32(pb, mov->mdat_size+8); } else { /* overwrite 'wide' placeholder atom */ - url_fseek(pb, mov->mdat_pos - 8, SEEK_SET); - put_be32(pb, 1); /* special value: real atom size will be 64 bit value after tag field */ - put_tag(pb, "mdat"); - put_be64(pb, mov->mdat_size+16); + avio_seek(pb, mov->mdat_pos - 8, SEEK_SET); + avio_wb32(pb, 1); /* special value: real atom size will be 64 bit value after tag field */ + ffio_wfourcc(pb, "mdat"); + avio_wb64(pb, mov->mdat_size+16); } - url_fseek(pb, moov_pos, SEEK_SET); + avio_seek(pb, moov_pos, SEEK_SET); mov_write_moov_tag(pb, mov, s); diff --git a/mplayer/ffmpeg/libavformat/movenchint.c b/mplayer/ffmpeg/libavformat/movenchint.c index 2ebe8b80..e6f74cdb 100644 --- a/mplayer/ffmpeg/libavformat/movenchint.c +++ b/mplayer/ffmpeg/libavformat/movenchint.c @@ -22,6 +22,7 @@ #include "movenc.h" #include "libavutil/intreadwrite.h" #include "internal.h" +#include "rtpenc_chain.h" int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index) { @@ -30,44 +31,20 @@ int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index) MOVTrack *src_track = &mov->tracks[src_index]; AVStream *src_st = s->streams[src_index]; int ret = AVERROR(ENOMEM); - AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); track->tag = MKTAG('r','t','p',' '); track->src_track = src_index; - if (!rtp_format) { - ret = AVERROR(ENOENT); - goto fail; - } - track->enc = avcodec_alloc_context(); if (!track->enc) goto fail; track->enc->codec_type = AVMEDIA_TYPE_DATA; track->enc->codec_tag = track->tag; - track->rtp_ctx = avformat_alloc_context(); + track->rtp_ctx = ff_rtp_chain_mux_open(s, src_st, NULL, + RTP_MAX_PACKET_SIZE); if (!track->rtp_ctx) goto fail; - track->rtp_ctx->oformat = rtp_format; - if (!av_new_stream(track->rtp_ctx, 0)) - goto fail; - - /* Copy stream parameters */ - track->rtp_ctx->streams[0]->sample_aspect_ratio = - src_st->sample_aspect_ratio; - - /* Remove the allocated codec context, link to the original one - * instead, to give the rtp muxer access to codec parameters. */ - av_free(track->rtp_ctx->streams[0]->codec); - track->rtp_ctx->streams[0]->codec = src_st->codec; - - if ((ret = url_open_dyn_packet_buf(&track->rtp_ctx->pb, - RTP_MAX_PACKET_SIZE)) < 0) - goto fail; - ret = av_write_header(track->rtp_ctx); - if (ret) - goto fail; /* Copy the RTP AVStream timebase back to the hint AVStream */ track->timescale = track->rtp_ctx->streams[0]->time_base.den; @@ -79,22 +56,8 @@ int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index) fail: av_log(s, AV_LOG_WARNING, "Unable to initialize hinting of stream %d\n", src_index); - if (track->rtp_ctx && track->rtp_ctx->pb) { - uint8_t *buf; - url_close_dyn_buf(track->rtp_ctx->pb, &buf); - av_free(buf); - } - if (track->rtp_ctx && track->rtp_ctx->streams[0]) { - av_metadata_free(&track->rtp_ctx->streams[0]->metadata); - av_free(track->rtp_ctx->streams[0]); - } - if (track->rtp_ctx) { - av_metadata_free(&track->rtp_ctx->metadata); - av_free(track->rtp_ctx->priv_data); - av_freep(&track->rtp_ctx); - } av_freep(&track->enc); - /* Set a default timescale, to avoid crashes in dump_format */ + /* Set a default timescale, to avoid crashes in av_dump_format */ track->timescale = 90000; return ret; } @@ -282,40 +245,40 @@ static int find_sample_match(const uint8_t *data, int len, } static void output_immediate(const uint8_t *data, int size, - ByteIOContext *out, int *entries) + AVIOContext *out, int *entries) { while (size > 0) { int len = size; if (len > 14) len = 14; - put_byte(out, 1); /* immediate constructor */ - put_byte(out, len); /* amount of valid data */ - put_buffer(out, data, len); + avio_w8(out, 1); /* immediate constructor */ + avio_w8(out, len); /* amount of valid data */ + avio_write(out, data, len); data += len; size -= len; for (; len < 14; len++) - put_byte(out, 0); + avio_w8(out, 0); (*entries)++; } } -static void output_match(ByteIOContext *out, int match_sample, +static void output_match(AVIOContext *out, int match_sample, int match_offset, int match_len, int *entries) { - put_byte(out, 2); /* sample constructor */ - put_byte(out, 0); /* track reference */ - put_be16(out, match_len); - put_be32(out, match_sample); - put_be32(out, match_offset); - put_be16(out, 1); /* bytes per block */ - put_be16(out, 1); /* samples per block */ + avio_w8(out, 2); /* sample constructor */ + avio_w8(out, 0); /* track reference */ + avio_wb16(out, match_len); + avio_wb32(out, match_sample); + avio_wb32(out, match_offset); + avio_wb16(out, 1); /* bytes per block */ + avio_wb16(out, 1); /* samples per block */ (*entries)++; } static void describe_payload(const uint8_t *data, int size, - ByteIOContext *out, int *entries, + AVIOContext *out, int *entries, HintSampleQueue *queue) { /* Describe the payload using different constructors */ @@ -346,7 +309,7 @@ static void describe_payload(const uint8_t *data, int size, * @param pts pointer where the timestamp for the written RTP hint is stored * @return the number of RTP packets in the written hint */ -static int write_hint_packets(ByteIOContext *out, const uint8_t *data, +static int write_hint_packets(AVIOContext *out, const uint8_t *data, int size, MOVTrack *trk, int64_t *pts) { int64_t curpos; @@ -355,8 +318,8 @@ static int write_hint_packets(ByteIOContext *out, const uint8_t *data, count_pos = url_ftell(out); /* RTPsample header */ - put_be16(out, 0); /* packet count */ - put_be16(out, 0); /* reserved */ + avio_wb16(out, 0); /* packet count */ + avio_wb16(out, 0); /* reserved */ while (size > 4) { uint32_t packet_len = AV_RB32(data); @@ -391,12 +354,12 @@ static int write_hint_packets(ByteIOContext *out, const uint8_t *data, count++; /* RTPpacket header */ - put_be32(out, 0); /* relative_time */ - put_buffer(out, data, 2); /* RTP header */ - put_be16(out, seq); /* RTPsequenceseed */ - put_be16(out, 0); /* reserved + flags */ + avio_wb32(out, 0); /* relative_time */ + avio_write(out, data, 2); /* RTP header */ + avio_wb16(out, seq); /* RTPsequenceseed */ + avio_wb16(out, 0); /* reserved + flags */ entries_pos = url_ftell(out); - put_be16(out, 0); /* entry count */ + avio_wb16(out, 0); /* entry count */ data += 12; size -= 12; @@ -409,15 +372,15 @@ static int write_hint_packets(ByteIOContext *out, const uint8_t *data, size -= packet_len; curpos = url_ftell(out); - url_fseek(out, entries_pos, SEEK_SET); - put_be16(out, entries); - url_fseek(out, curpos, SEEK_SET); + avio_seek(out, entries_pos, SEEK_SET); + avio_wb16(out, entries); + avio_seek(out, curpos, SEEK_SET); } curpos = url_ftell(out); - url_fseek(out, count_pos, SEEK_SET); - put_be16(out, count); - url_fseek(out, curpos, SEEK_SET); + avio_seek(out, count_pos, SEEK_SET); + avio_wb16(out, count); + avio_seek(out, curpos, SEEK_SET); return count; } @@ -429,7 +392,7 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt, AVFormatContext *rtp_ctx = trk->rtp_ctx; uint8_t *buf = NULL; int size; - ByteIOContext *hintbuf = NULL; + AVIOContext *hintbuf = NULL; AVPacket hint_pkt; int ret = 0, count; @@ -488,9 +451,6 @@ void ff_mov_close_hinting(MOVTrack *track) { url_close_dyn_buf(rtp_ctx->pb, &ptr); av_free(ptr); } - av_metadata_free(&rtp_ctx->streams[0]->metadata); - av_metadata_free(&rtp_ctx->metadata); - av_free(rtp_ctx->streams[0]); - av_freep(&rtp_ctx); + avformat_free_context(rtp_ctx); } diff --git a/mplayer/ffmpeg/libavformat/mp3dec.c b/mplayer/ffmpeg/libavformat/mp3dec.c index 5bc4ce64..f90348c1 100644 --- a/mplayer/ffmpeg/libavformat/mp3dec.c +++ b/mplayer/ffmpeg/libavformat/mp3dec.c @@ -80,7 +80,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) MPADecodeHeader c; int vbrtag_size = 0; - v = get_be32(s->pb); + v = avio_rb32(s->pb); if(ff_mpa_check_header(v) < 0) return -1; @@ -90,26 +90,26 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) return -1; /* Check for Xing / Info tag */ - url_fseek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR); - v = get_be32(s->pb); + avio_seek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR); + v = avio_rb32(s->pb); if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) { - v = get_be32(s->pb); + v = avio_rb32(s->pb); if(v & 0x1) - frames = get_be32(s->pb); + frames = avio_rb32(s->pb); if(v & 0x2) - size = get_be32(s->pb); + size = avio_rb32(s->pb); } /* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */ - url_fseek(s->pb, base + 4 + 32, SEEK_SET); - v = get_be32(s->pb); + avio_seek(s->pb, base + 4 + 32, SEEK_SET); + v = avio_rb32(s->pb); if(v == MKBETAG('V', 'B', 'R', 'I')) { /* Check tag version */ - if(get_be16(s->pb) == 1) { + if(avio_rb16(s->pb) == 1) { /* skip delay and quality */ - url_fseek(s->pb, 4, SEEK_CUR); - frames = get_be32(s->pb); - size = get_be32(s->pb); + avio_seek(s->pb, 4, SEEK_CUR); + frames = avio_rb32(s->pb); + size = avio_rb32(s->pb); } } @@ -117,7 +117,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) return -1; /* Skip the vbr tag frame */ - url_fseek(s->pb, base + vbrtag_size, SEEK_SET); + avio_seek(s->pb, base + vbrtag_size, SEEK_SET); spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */ if(frames) @@ -153,7 +153,7 @@ static int mp3_read_header(AVFormatContext *s, ff_id3v1_read(s); if (mp3_parse_vbr_tags(s, st, off) < 0) - url_fseek(s->pb, off, SEEK_SET); + avio_seek(s->pb, off, SEEK_SET); /* the parameters will be extracted from the compressed bitstream */ return 0; diff --git a/mplayer/ffmpeg/libavformat/mp3enc.c b/mplayer/ffmpeg/libavformat/mp3enc.c index b2c0a7e6..c4654206 100644 --- a/mplayer/ffmpeg/libavformat/mp3enc.c +++ b/mplayer/ffmpeg/libavformat/mp3enc.c @@ -71,10 +71,16 @@ static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf) static void id3v2_put_size(AVFormatContext *s, int size) { - put_byte(s->pb, size >> 21 & 0x7f); - put_byte(s->pb, size >> 14 & 0x7f); - put_byte(s->pb, size >> 7 & 0x7f); - put_byte(s->pb, size & 0x7f); + avio_w8(s->pb, size >> 21 & 0x7f); + avio_w8(s->pb, size >> 14 & 0x7f); + avio_w8(s->pb, size >> 7 & 0x7f); + avio_w8(s->pb, size & 0x7f); +} + +static int string_is_ascii(const uint8_t *str) +{ + while (*str && *str < 128) str++; + return !*str; } /** @@ -87,14 +93,20 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2 { int len; uint8_t *pb; - int (*put)(ByteIOContext*, const char*); - ByteIOContext *dyn_buf; + int (*put)(AVIOContext*, const char*); + AVIOContext *dyn_buf; if (url_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); - put_byte(dyn_buf, enc); + /* check if the strings are ASCII-only and use UTF16 only if + * they're not */ + if (enc == ID3v2_ENCODING_UTF16BOM && string_is_ascii(str1) && + (!str2 || string_is_ascii(str2))) + enc = ID3v2_ENCODING_ISO8859; + + avio_w8(dyn_buf, enc); if (enc == ID3v2_ENCODING_UTF16BOM) { - put_le16(dyn_buf, 0xFEFF); /* BOM */ + avio_wl16(dyn_buf, 0xFEFF); /* BOM */ put = avio_put_str16le; } else put = avio_put_str; @@ -104,10 +116,10 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2 put(dyn_buf, str2); len = url_close_dyn_buf(dyn_buf, &pb); - put_be32(s->pb, tag); + avio_wb32(s->pb, tag); id3v2_put_size(s, len); - put_be16(s->pb, 0); - put_buffer(s->pb, pb, len); + avio_wb16(s->pb, 0); + avio_write(s->pb, pb, len); av_freep(&pb); return len + ID3v2_HEADER_SIZE; @@ -116,7 +128,7 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2 static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt) { - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, pkt->data, pkt->size); put_flush_packet(s->pb); return 0; } @@ -127,7 +139,7 @@ static int mp3_write_trailer(struct AVFormatContext *s) /* write the id3v1 tag */ if (id3v1_create_tag(s, buf) > 0) { - put_buffer(s->pb, buf, ID3v1_TAG_SIZE); + avio_write(s->pb, buf, ID3v1_TAG_SIZE); put_flush_packet(s->pb); } return 0; @@ -194,13 +206,13 @@ static int mp3_write_header(struct AVFormatContext *s) ID3v2_ENCODING_UTF8; int64_t size_pos, cur_pos; - put_be32(s->pb, MKBETAG('I', 'D', '3', mp3->id3v2_version)); - put_byte(s->pb, 0); - put_byte(s->pb, 0); /* flags */ + avio_wb32(s->pb, MKBETAG('I', 'D', '3', mp3->id3v2_version)); + avio_w8(s->pb, 0); + avio_w8(s->pb, 0); /* flags */ /* reserve space for size */ size_pos = url_ftell(s->pb); - put_be32(s->pb, 0); + avio_wb32(s->pb, 0); ff_metadata_conv(&s->metadata, ff_id3v2_34_metadata_conv, NULL); if (mp3->id3v2_version == 4) @@ -226,9 +238,9 @@ static int mp3_write_header(struct AVFormatContext *s) } cur_pos = url_ftell(s->pb); - url_fseek(s->pb, size_pos, SEEK_SET); + avio_seek(s->pb, size_pos, SEEK_SET); id3v2_put_size(s, totlen); - url_fseek(s->pb, cur_pos, SEEK_SET); + avio_seek(s->pb, cur_pos, SEEK_SET); return 0; } diff --git a/mplayer/ffmpeg/libavformat/mpc.c b/mplayer/ffmpeg/libavformat/mpc.c index aa057260..c2293836 100644 --- a/mplayer/ffmpeg/libavformat/mpc.c +++ b/mplayer/ffmpeg/libavformat/mpc.c @@ -55,16 +55,16 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) MPCContext *c = s->priv_data; AVStream *st; - if(get_le24(s->pb) != MKTAG('M', 'P', '+', 0)){ + if(avio_rl24(s->pb) != MKTAG('M', 'P', '+', 0)){ av_log(s, AV_LOG_ERROR, "Not a Musepack file\n"); return -1; } - c->ver = get_byte(s->pb); + c->ver = avio_r8(s->pb); if(c->ver != 0x07 && c->ver != 0x17){ av_log(s, AV_LOG_ERROR, "Can demux Musepack SV7, got version %02X\n", c->ver); return -1; } - c->fcount = get_le32(s->pb); + c->fcount = avio_rl32(s->pb); if((int64_t)c->fcount * sizeof(MPCFrame) >= UINT_MAX){ av_log(s, AV_LOG_ERROR, "Too many frames, seeking is not possible\n"); return -1; @@ -85,7 +85,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->extradata_size = 16; st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(s->pb, st->codec->extradata, 16); + avio_read(s->pb, st->codec->extradata, 16); st->codec->sample_rate = mpc_rate[st->codec->extradata[2] & 3]; av_set_pts_info(st, 32, MPC_FRAMESIZE, st->codec->sample_rate); /* scan for seekpoints */ @@ -98,7 +98,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) ff_ape_parse_tag(s); if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) ff_id3v1_read(s); - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); } return 0; @@ -114,22 +114,22 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) return -1; if(c->curframe != c->lastframe + 1){ - url_fseek(s->pb, c->frames[c->curframe].pos, SEEK_SET); + avio_seek(s->pb, c->frames[c->curframe].pos, SEEK_SET); c->curbits = c->frames[c->curframe].skip; } c->lastframe = c->curframe; c->curframe++; curbits = c->curbits; pos = url_ftell(s->pb); - tmp = get_le32(s->pb); + tmp = avio_rl32(s->pb); if(curbits <= 12){ size2 = (tmp >> (12 - curbits)) & 0xFFFFF; }else{ - tmp = (tmp << 32) | get_le32(s->pb); + tmp = (tmp << 32) | avio_rl32(s->pb); size2 = (tmp >> (44 - curbits)) & 0xFFFFF; } curbits += 20; - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); size = ((size2 + curbits + 31) & ~31) >> 3; if(cur == c->frames_noted){ @@ -151,9 +151,9 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->stream_index = 0; pkt->pts = cur; - ret = get_buffer(s->pb, pkt->data + 4, size); + ret = avio_read(s->pb, pkt->data + 4, size); if(c->curbits) - url_fseek(s->pb, -4, SEEK_CUR); + avio_seek(s->pb, -4, SEEK_CUR); if(ret < size){ av_free_packet(pkt); return AVERROR(EIO); diff --git a/mplayer/ffmpeg/libavformat/mpc8.c b/mplayer/ffmpeg/libavformat/mpc8.c index 11173004..9d8a4d80 100644 --- a/mplayer/ffmpeg/libavformat/mpc8.c +++ b/mplayer/ffmpeg/libavformat/mpc8.c @@ -117,11 +117,11 @@ static inline int64_t gb_get_v(GetBitContext *gb) return v; } -static void mpc8_get_chunk_header(ByteIOContext *pb, int *tag, int64_t *size) +static void mpc8_get_chunk_header(AVIOContext *pb, int *tag, int64_t *size) { int64_t pos; pos = url_ftell(pb); - *tag = get_le16(pb); + *tag = avio_rl16(pb); *size = ff_get_v(pb); *size -= url_ftell(pb) - pos; } @@ -135,7 +135,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) int i, t, seekd; GetBitContext gb; - url_fseek(s->pb, off, SEEK_SET); + avio_seek(s->pb, off, SEEK_SET); mpc8_get_chunk_header(s->pb, &tag, &size); if(tag != TAG_SEEKTABLE){ av_log(s, AV_LOG_ERROR, "No seek table at given position\n"); @@ -143,7 +143,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) } if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE))) return; - get_buffer(s->pb, buf, size); + avio_read(s->pb, buf, size); init_get_bits(&gb, buf, size * 8); size = gb_get_v(&gb); if(size > UINT_MAX/4 || size > c->samples/1152){ @@ -171,7 +171,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, int64_t size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos, off; switch(tag){ @@ -179,23 +179,23 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in pos = url_ftell(pb) + size; off = ff_get_v(pb); mpc8_parse_seektable(s, chunk_pos + off); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); break; default: - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); } } static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) { MPCContext *c = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; int tag = 0; int64_t size, pos; c->header_pos = url_ftell(pb); - if(get_le32(pb) != TAG_MPCK){ + if(avio_rl32(pb) != TAG_MPCK){ av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n"); return -1; } @@ -212,8 +212,8 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } pos = url_ftell(pb); - url_fskip(pb, 4); //CRC - c->ver = get_byte(pb); + avio_seek(pb, 4, SEEK_CUR); //CRC + c->ver = avio_r8(pb); if(c->ver != 8){ av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver); return -1; @@ -230,7 +230,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->extradata_size = 2; st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(pb, st->codec->extradata, st->codec->extradata_size); + avio_read(pb, st->codec->extradata, st->codec->extradata_size); st->codec->channels = (st->codec->extradata[1] >> 4) + 1; st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5]; @@ -273,7 +273,7 @@ static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestam int index = av_index_search_timestamp(st, timestamp, flags); if(index < 0) return -1; - url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); c->frame = st->index_entries[index].timestamp; return 0; } diff --git a/mplayer/ffmpeg/libavformat/mpeg.c b/mplayer/ffmpeg/libavformat/mpeg.c index 135482b7..a1ba6aa2 100644 --- a/mplayer/ffmpeg/libavformat/mpeg.c +++ b/mplayer/ffmpeg/libavformat/mpeg.c @@ -20,6 +20,7 @@ */ #include "avformat.h" +#include "internal.h" #include "mpeg.h" //#define DEBUG_SEEK @@ -112,7 +113,7 @@ static int mpegps_read_header(AVFormatContext *s, m->sofdec = -1; do { - v = get_byte(s->pb); + v = avio_r8(s->pb); m->header_state = m->header_state << 8 | v; m->sofdec++; } while (v == sofdec[i] && i++ < 6); @@ -123,17 +124,17 @@ static int mpegps_read_header(AVFormatContext *s, return 0; } -static int64_t get_pts(ByteIOContext *pb, int c) +static int64_t get_pts(AVIOContext *pb, int c) { uint8_t buf[5]; - buf[0] = c<0 ? get_byte(pb) : c; - get_buffer(pb, buf+1, 4); + buf[0] = c<0 ? avio_r8(pb) : c; + avio_read(pb, buf+1, 4); return ff_parse_pes_pts(buf); } -static int find_next_start_code(ByteIOContext *pb, int *size_ptr, +static int find_next_start_code(AVIOContext *pb, int *size_ptr, int32_t *header_state) { unsigned int state, v; @@ -144,7 +145,7 @@ static int find_next_start_code(ByteIOContext *pb, int *size_ptr, while (n > 0) { if (url_feof(pb)) break; - v = get_byte(pb); + v = avio_r8(pb); n--; if (state == 0x000001) { state = ((state << 8) | v) & 0xffffff; @@ -162,7 +163,7 @@ static int find_next_start_code(ByteIOContext *pb, int *size_ptr, #if 0 /* unused, remove? */ /* XXX: optimize */ -static int find_prev_start_code(ByteIOContext *pb, int *size_ptr) +static int find_prev_start_code(AVIOContext *pb, int *size_ptr) { int64_t pos, pos_start; int max_size, start_code; @@ -174,8 +175,8 @@ static int find_prev_start_code(ByteIOContext *pb, int *size_ptr) pos = pos_start - 16386; if (pos < 0) pos = 0; - url_fseek(pb, pos, SEEK_SET); - get_byte(pb); + avio_seek(pb, pos, SEEK_SET); + avio_r8(pb); pos = pos_start; for(;;) { @@ -184,8 +185,8 @@ static int find_prev_start_code(ByteIOContext *pb, int *size_ptr) start_code = -1; goto the_end; } - url_fseek(pb, pos, SEEK_SET); - start_code = get_be32(pb); + avio_seek(pb, pos, SEEK_SET); + start_code = avio_rb32(pb); if ((start_code & 0xffffff00) == 0x100) break; } @@ -201,31 +202,31 @@ static int find_prev_start_code(ByteIOContext *pb, int *size_ptr) * * @return number of bytes occupied by PSM in the bitstream */ -static long mpegps_psm_parse(MpegDemuxContext *m, ByteIOContext *pb) +static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb) { int psm_length, ps_info_length, es_map_length; - psm_length = get_be16(pb); - get_byte(pb); - get_byte(pb); - ps_info_length = get_be16(pb); + psm_length = avio_rb16(pb); + avio_r8(pb); + avio_r8(pb); + ps_info_length = avio_rb16(pb); /* skip program_stream_info */ - url_fskip(pb, ps_info_length); - es_map_length = get_be16(pb); + avio_seek(pb, ps_info_length, SEEK_CUR); + es_map_length = avio_rb16(pb); /* at least one es available? */ while (es_map_length >= 4){ - unsigned char type = get_byte(pb); - unsigned char es_id = get_byte(pb); - uint16_t es_info_length = get_be16(pb); + unsigned char type = avio_r8(pb); + unsigned char es_id = avio_r8(pb); + uint16_t es_info_length = avio_rb16(pb); /* remember mapping from stream id to stream type */ m->psm_es_type[es_id] = type; /* skip program_stream_info */ - url_fskip(pb, es_info_length); + avio_seek(pb, es_info_length, SEEK_CUR); es_map_length -= 4 + es_info_length; } - get_be32(pb); /* crc32 */ + avio_rb32(pb); /* crc32 */ return 2 + psm_length; } @@ -243,7 +244,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, int64_t last_sync= url_ftell(s->pb); error_redo: - url_fseek(s->pb, last_sync, SEEK_SET); + avio_seek(s->pb, last_sync, SEEK_SET); redo: /* next start code (should be immediately after) */ m->header_state = 0xff; @@ -263,16 +264,16 @@ static int mpegps_read_pes_header(AVFormatContext *s, if (startcode == SYSTEM_HEADER_START_CODE) goto redo; if (startcode == PADDING_STREAM) { - url_fskip(s->pb, get_be16(s->pb)); + avio_seek(s->pb, avio_rb16(s->pb), SEEK_CUR); goto redo; } if (startcode == PRIVATE_STREAM_2) { - len = get_be16(s->pb); + len = avio_rb16(s->pb); if (!m->sofdec) { while (len-- >= 6) { - if (get_byte(s->pb) == 'S') { + if (avio_r8(s->pb) == 'S') { uint8_t buf[5]; - get_buffer(s->pb, buf, sizeof(buf)); + avio_read(s->pb, buf, sizeof(buf)); m->sofdec = !memcmp(buf, "ofdec", 5); len -= sizeof(buf); break; @@ -280,7 +281,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, } m->sofdec -= !m->sofdec; } - url_fskip(s->pb, len); + avio_seek(s->pb, len, SEEK_CUR); goto redo; } if (startcode == PROGRAM_STREAM_MAP) { @@ -296,14 +297,14 @@ static int mpegps_read_pes_header(AVFormatContext *s, if (ppos) { *ppos = url_ftell(s->pb) - 4; } - len = get_be16(s->pb); + len = avio_rb16(s->pb); pts = dts = AV_NOPTS_VALUE; /* stuffing */ for(;;) { if (len < 1) goto error_redo; - c = get_byte(s->pb); + c = avio_r8(s->pb); len--; /* XXX: for mpeg1, should test only bit 7 */ if (c != 0xff) @@ -311,8 +312,8 @@ static int mpegps_read_pes_header(AVFormatContext *s, } if ((c & 0xc0) == 0x40) { /* buffer scale & size */ - get_byte(s->pb); - c = get_byte(s->pb); + avio_r8(s->pb); + c = avio_r8(s->pb); len -= 2; } if ((c & 0xe0) == 0x20) { @@ -330,8 +331,8 @@ static int mpegps_read_pes_header(AVFormatContext *s, goto redo; } #endif - flags = get_byte(s->pb); - header_len = get_byte(s->pb); + flags = avio_r8(s->pb); + header_len = avio_r8(s->pb); len -= 2; if (header_len > len) goto error_redo; @@ -349,7 +350,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, av_log(s, AV_LOG_WARNING, "Further flags set but no bytes left\n"); } if (flags & 0x01) { /* PES extension */ - pes_ext = get_byte(s->pb); + pes_ext = avio_r8(s->pb); header_len--; /* Skip PES private data, program packet sequence counter and P-STD buffer */ skip = (pes_ext >> 4) & 0xb; @@ -358,14 +359,14 @@ static int mpegps_read_pes_header(AVFormatContext *s, av_log(s, AV_LOG_WARNING, "pes_ext %X is invalid\n", pes_ext); pes_ext=skip=0; } - url_fskip(s->pb, skip); + avio_seek(s->pb, skip, SEEK_CUR); header_len -= skip; if (pes_ext & 0x01) { /* PES extension 2 */ - ext2_len = get_byte(s->pb); + ext2_len = avio_r8(s->pb); header_len--; if ((ext2_len & 0x7f) > 0) { - id_ext = get_byte(s->pb); + id_ext = avio_r8(s->pb); if ((id_ext & 0x80) == 0) startcode = ((startcode & 0xff) << 8) | id_ext; header_len--; @@ -374,23 +375,23 @@ static int mpegps_read_pes_header(AVFormatContext *s, } if(header_len < 0) goto error_redo; - url_fskip(s->pb, header_len); + avio_seek(s->pb, header_len, SEEK_CUR); } else if( c!= 0xf ) goto redo; if (startcode == PRIVATE_STREAM_1 && !m->psm_es_type[startcode & 0xff]) { - startcode = get_byte(s->pb); + startcode = avio_r8(s->pb); len--; if (startcode >= 0x80 && startcode <= 0xcf) { /* audio: skip header */ - get_byte(s->pb); - get_byte(s->pb); - get_byte(s->pb); + avio_r8(s->pb); + avio_r8(s->pb); + avio_r8(s->pb); len -= 3; if (startcode >= 0xb0 && startcode <= 0xbf) { /* MLP/TrueHD audio has a 4-byte header */ - get_byte(s->pb); + avio_r8(s->pb); len--; } } @@ -431,8 +432,8 @@ static int mpegps_read_packet(AVFormatContext *s, return len; if(startcode == 0x1bd) { - dvdaudio_substream_type = get_byte(s->pb); - url_fskip(s->pb, 3); + dvdaudio_substream_type = avio_r8(s->pb); + avio_seek(s->pb, 3, SEEK_CUR); len -= 4; } @@ -473,8 +474,8 @@ static int mpegps_read_packet(AVFormatContext *s, } else if (startcode >= 0x1e0 && startcode <= 0x1ef) { static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 }; unsigned char buf[8]; - get_buffer(s->pb, buf, 8); - url_fseek(s->pb, -8, SEEK_CUR); + avio_read(s->pb, buf, 8); + avio_seek(s->pb, -8, SEEK_CUR); if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1)) codec_id = CODEC_ID_CAVS; else @@ -524,7 +525,7 @@ static int mpegps_read_packet(AVFormatContext *s, } else { skip: /* skip packet */ - url_fskip(s->pb, len); + avio_seek(s->pb, len, SEEK_CUR); goto redo; } /* no stream found: add a new stream */ @@ -546,9 +547,9 @@ static int mpegps_read_packet(AVFormatContext *s, audio data */ if (len <= 3) goto skip; - get_byte(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */ - b1 = get_byte(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */ - get_byte(s->pb); /* dynamic range control (0x80 = off) */ + avio_r8(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */ + b1 = avio_r8(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */ + avio_r8(s->pb); /* dynamic range control (0x80 = off) */ len -= 3; freq = (b1 >> 4) & 3; st->codec->sample_rate = lpcm_freq_tab[freq]; @@ -563,7 +564,7 @@ static int mpegps_read_packet(AVFormatContext *s, return AVERROR(EINVAL); } av_new_packet(pkt, len); - get_buffer(s->pb, pkt->data, pkt->size); + avio_read(s->pb, pkt->data, pkt->size); pkt->pts = pts; pkt->dts = dts; pkt->pos = dummy_pos; @@ -586,7 +587,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, #ifdef DEBUG_SEEK printf("read_dts: pos=0x%"PRIx64" next=%d -> ", pos, find_next); #endif - if (url_fseek(s->pb, pos, SEEK_SET) < 0) + if (avio_seek(s->pb, pos, SEEK_SET) < 0) return AV_NOPTS_VALUE; for(;;) { @@ -601,7 +602,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, dts != AV_NOPTS_VALUE) { break; } - url_fskip(s->pb, len); + avio_seek(s->pb, len, SEEK_CUR); } #ifdef DEBUG_SEEK printf("pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n", pos, dts, dts / 90000.0); diff --git a/mplayer/ffmpeg/libavformat/mpeg.h b/mplayer/ffmpeg/libavformat/mpeg.h index d09b2e81..ca019c9e 100644 --- a/mplayer/ffmpeg/libavformat/mpeg.h +++ b/mplayer/ffmpeg/libavformat/mpeg.h @@ -63,7 +63,7 @@ static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 }; /** * Parse MPEG-PES five-byte timestamp */ -static inline int64_t ff_parse_pes_pts(uint8_t *buf) { +static inline int64_t ff_parse_pes_pts(const uint8_t *buf) { return (int64_t)(*buf & 0x0e) << 29 | (AV_RB16(buf+1) >> 1) << 15 | AV_RB16(buf+3) >> 1; diff --git a/mplayer/ffmpeg/libavformat/mpegenc.c b/mplayer/ffmpeg/libavformat/mpegenc.c index eef385f0..8c5c644f 100644 --- a/mplayer/ffmpeg/libavformat/mpegenc.c +++ b/mplayer/ffmpeg/libavformat/mpegenc.c @@ -491,14 +491,14 @@ static int mpeg_mux_init(AVFormatContext *ctx) return AVERROR(ENOMEM); } -static inline void put_timestamp(ByteIOContext *pb, int id, int64_t timestamp) +static inline void put_timestamp(AVIOContext *pb, int id, int64_t timestamp) { - put_byte(pb, + avio_w8(pb, (id << 4) | (((timestamp >> 30) & 0x07) << 1) | 1); - put_be16(pb, (uint16_t)((((timestamp >> 15) & 0x7fff) << 1) | 1)); - put_be16(pb, (uint16_t)((((timestamp ) & 0x7fff) << 1) | 1)); + avio_wb16(pb, (uint16_t)((((timestamp >> 15) & 0x7fff) << 1) | 1)); + avio_wb16(pb, (uint16_t)((((timestamp ) & 0x7fff) << 1) | 1)); } @@ -613,21 +613,21 @@ static int get_packet_payload_size(AVFormatContext *ctx, int stream_index, #endif /* Write an MPEG padding packet header. */ -static void put_padding_packet(AVFormatContext *ctx, ByteIOContext *pb,int packet_bytes) +static void put_padding_packet(AVFormatContext *ctx, AVIOContext *pb,int packet_bytes) { MpegMuxContext *s = ctx->priv_data; int i; - put_be32(pb, PADDING_STREAM); - put_be16(pb, packet_bytes - 6); + avio_wb32(pb, PADDING_STREAM); + avio_wb16(pb, packet_bytes - 6); if (!s->is_mpeg2) { - put_byte(pb, 0x0f); + avio_w8(pb, 0x0f); packet_bytes -= 7; } else packet_bytes -= 6; for(i=0;ipb, buffer, size); + avio_write(ctx->pb, buffer, size); - put_be32(ctx->pb, PRIVATE_STREAM_2); - put_be16(ctx->pb, 0x03d4); // length - put_byte(ctx->pb, 0x00); // substream ID, 00=PCI + avio_wb32(ctx->pb, PRIVATE_STREAM_2); + avio_wb16(ctx->pb, 0x03d4); // length + avio_w8(ctx->pb, 0x00); // substream ID, 00=PCI for (i = 0; i < 979; i++) - put_byte(ctx->pb, 0x00); + avio_w8(ctx->pb, 0x00); - put_be32(ctx->pb, PRIVATE_STREAM_2); - put_be16(ctx->pb, 0x03fa); // length - put_byte(ctx->pb, 0x01); // substream ID, 01=DSI + avio_wb32(ctx->pb, PRIVATE_STREAM_2); + avio_wb16(ctx->pb, 0x03fa); // length + avio_w8(ctx->pb, 0x01); // substream ID, 01=DSI for (i = 0; i < 1017; i++) - put_byte(ctx->pb, 0x00); + avio_w8(ctx->pb, 0x00); memset(buffer, 0, 128); buf_ptr = buffer; @@ -734,7 +734,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, } } size = buf_ptr - buffer; - put_buffer(ctx->pb, buffer, size); + avio_write(ctx->pb, buffer, size); packet_size = s->packet_size - size; @@ -839,16 +839,16 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, nb_frames= get_nb_frames(ctx, stream, payload_size - stuffing_size); - put_be32(ctx->pb, startcode); + avio_wb32(ctx->pb, startcode); - put_be16(ctx->pb, packet_size); + avio_wb16(ctx->pb, packet_size); if (!s->is_mpeg2) for(i=0;ipb, 0xff); + avio_w8(ctx->pb, 0xff); if (s->is_mpeg2) { - put_byte(ctx->pb, 0x80); /* mpeg2 id */ + avio_w8(ctx->pb, 0x80); /* mpeg2 id */ pes_flags=0; @@ -865,8 +865,8 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, if (stream->packet_number == 0) pes_flags |= 0x01; - put_byte(ctx->pb, pes_flags); /* flags */ - put_byte(ctx->pb, header_len - 3 + stuffing_size); + avio_w8(ctx->pb, pes_flags); /* flags */ + avio_w8(ctx->pb, header_len - 3 + stuffing_size); if (pes_flags & 0x80) /*write pts*/ put_timestamp(ctx->pb, (pes_flags & 0x40) ? 0x03 : 0x02, pts); @@ -874,13 +874,13 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, put_timestamp(ctx->pb, 0x01, dts); if (pes_flags & 0x01) { /*write pes extension*/ - put_byte(ctx->pb, 0x10); /* flags */ + avio_w8(ctx->pb, 0x10); /* flags */ /* P-STD buffer info */ if ((id & 0xe0) == AUDIO_ID) - put_be16(ctx->pb, 0x4000 | stream->max_buffer_size/ 128); + avio_wb16(ctx->pb, 0x4000 | stream->max_buffer_size/ 128); else - put_be16(ctx->pb, 0x6000 | stream->max_buffer_size/1024); + avio_wb16(ctx->pb, 0x6000 | stream->max_buffer_size/1024); } } else { @@ -892,38 +892,38 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, put_timestamp(ctx->pb, 0x02, pts); } } else { - put_byte(ctx->pb, 0x0f); + avio_w8(ctx->pb, 0x0f); } } if (s->is_mpeg2) { /* special stuffing byte that is always written to prevent accidental generation of start codes. */ - put_byte(ctx->pb, 0xff); + avio_w8(ctx->pb, 0xff); for(i=0;ipb, 0xff); + avio_w8(ctx->pb, 0xff); } if (startcode == PRIVATE_STREAM_1) { - put_byte(ctx->pb, id); + avio_w8(ctx->pb, id); if (id >= 0xa0) { /* LPCM (XXX: check nb_frames) */ - put_byte(ctx->pb, 7); - put_be16(ctx->pb, 4); /* skip 3 header bytes */ - put_byte(ctx->pb, stream->lpcm_header[0]); - put_byte(ctx->pb, stream->lpcm_header[1]); - put_byte(ctx->pb, stream->lpcm_header[2]); + avio_w8(ctx->pb, 7); + avio_wb16(ctx->pb, 4); /* skip 3 header bytes */ + avio_w8(ctx->pb, stream->lpcm_header[0]); + avio_w8(ctx->pb, stream->lpcm_header[1]); + avio_w8(ctx->pb, stream->lpcm_header[2]); } else if (id >= 0x40) { /* AC-3 */ - put_byte(ctx->pb, nb_frames); - put_be16(ctx->pb, trailer_size+1); + avio_w8(ctx->pb, nb_frames); + avio_wb16(ctx->pb, trailer_size+1); } } /* output data */ assert(payload_size - stuffing_size <= av_fifo_size(stream->fifo)); - av_fifo_generic_read(stream->fifo, ctx->pb, payload_size - stuffing_size, &put_buffer); + av_fifo_generic_read(stream->fifo, ctx->pb, payload_size - stuffing_size, &avio_write); stream->bytes_to_iframe -= payload_size - stuffing_size; }else{ payload_size= @@ -934,7 +934,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, put_padding_packet(ctx,ctx->pb, pad_packet_bytes); for(i=0;ipb, 0x00); + avio_w8(ctx->pb, 0x00); put_flush_packet(ctx->pb); @@ -961,7 +961,7 @@ static void put_vcd_padding_sector(AVFormatContext *ctx) int i; for(i=0;ipacket_size;i++) - put_byte(ctx->pb, 0); + avio_w8(ctx->pb, 0); s->vcd_padding_bytes_written += s->packet_size; @@ -1220,7 +1220,7 @@ static int mpeg_mux_end(AVFormatContext *ctx) /* End header according to MPEG1 systems standard. We do not write it as it is usually not needed by decoders and because it complicates MPEG stream concatenation. */ - //put_be32(ctx->pb, ISO_11172_END_CODE); + //avio_wb32(ctx->pb, ISO_11172_END_CODE); //put_flush_packet(ctx->pb); for(i=0;inb_streams;i++) { diff --git a/mplayer/ffmpeg/libavformat/mpegts.c b/mplayer/ffmpeg/libavformat/mpegts.c index f2b580a2..8815044f 100644 --- a/mplayer/ffmpeg/libavformat/mpegts.c +++ b/mplayer/ffmpeg/libavformat/mpegts.c @@ -29,12 +29,11 @@ #include "avformat.h" #include "mpegts.h" #include "internal.h" +#include "avio_internal.h" #include "seek.h" +#include "mpeg.h" #include "isom.h" -/* 1.0 second at 24Mbit/s */ -#define MAX_SCAN_PACKETS 32000 - /* maximum size in which we look for synchronisation if synchronisation is lost */ #define MAX_RESYNC_SIZE 65536 @@ -601,14 +600,6 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes, return 0; } -static int64_t get_pts(const uint8_t *p) -{ - int64_t pts = (int64_t)((p[0] >> 1) & 0x07) << 30; - pts |= (AV_RB16(p + 1) >> 1) << 15; - pts |= AV_RB16(p + 3) >> 1; - return pts; -} - static void new_pes_packet(PESContext *pes, AVPacket *pkt) { av_init_packet(pkt); @@ -767,12 +758,12 @@ static int mpegts_push_data(MpegTSFilter *filter, pes->pts = AV_NOPTS_VALUE; pes->dts = AV_NOPTS_VALUE; if ((flags & 0xc0) == 0x80) { - pes->dts = pes->pts = get_pts(r); + pes->dts = pes->pts = ff_parse_pes_pts(r); r += 5; } else if ((flags & 0xc0) == 0xc0) { - pes->pts = get_pts(r); + pes->pts = ff_parse_pes_pts(r); r += 5; - pes->dts = get_pts(r); + pes->dts = ff_parse_pes_pts(r); r += 5; } pes->extended_stream_id = -1; @@ -861,32 +852,32 @@ static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size, int *es_id, uint8_t **dec_config_descr, int *dec_config_descr_size) { - ByteIOContext pb; + AVIOContext pb; int tag; unsigned len; - init_put_byte(&pb, buf, size, 0, NULL, NULL, NULL, NULL); + ffio_init_context(&pb, buf, size, 0, NULL, NULL, NULL, NULL); len = ff_mp4_read_descr(s, &pb, &tag); if (tag == MP4IODescrTag) { - get_be16(&pb); // ID - get_byte(&pb); - get_byte(&pb); - get_byte(&pb); - get_byte(&pb); - get_byte(&pb); + avio_rb16(&pb); // ID + avio_r8(&pb); + avio_r8(&pb); + avio_r8(&pb); + avio_r8(&pb); + avio_r8(&pb); len = ff_mp4_read_descr(s, &pb, &tag); if (tag == MP4ESDescrTag) { - *es_id = get_be16(&pb); /* ES_ID */ + *es_id = avio_rb16(&pb); /* ES_ID */ av_dlog(s, "ES_ID %#x\n", *es_id); - get_byte(&pb); /* priority */ + avio_r8(&pb); /* priority */ len = ff_mp4_read_descr(s, &pb, &tag); if (tag == MP4DecConfigDescrTag) { *dec_config_descr = av_malloc(len); if (!*dec_config_descr) return AVERROR(ENOMEM); *dec_config_descr_size = len; - get_buffer(&pb, *dec_config_descr, len); + avio_read(&pb, *dec_config_descr, len); } } } @@ -923,8 +914,8 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type get16(pp, desc_end); if (st->codec->codec_id == CODEC_ID_AAC_LATM && mp4_dec_config_descr_len && mp4_es_id == pid) { - ByteIOContext pb; - init_put_byte(&pb, mp4_dec_config_descr, + AVIOContext pb; + ffio_init_context(&pb, mp4_dec_config_descr, mp4_dec_config_descr_len, 0, NULL, NULL, NULL, NULL); ff_mp4_read_dec_config_descr(fc, st, &pb); if (st->codec->codec_id == CODEC_ID_AAC && @@ -964,6 +955,11 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type language[2] = get8(pp, desc_end); language[3] = 0; av_metadata_set2(&st->metadata, "language", language, 0); + switch (get8(pp, desc_end)) { + case 0x01: st->disposition |= AV_DISPOSITION_CLEAN_EFFECTS; break; + case 0x02: st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; break; + case 0x03: st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; break; + } break; case 0x05: /* registration descriptor */ st->codec->codec_tag = bytestream_get_le32(pp); @@ -1312,7 +1308,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet) get_packet_size() ?) */ static int mpegts_resync(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int c, i; for(i = 0;i < MAX_RESYNC_SIZE; i++) { @@ -1320,7 +1316,7 @@ static int mpegts_resync(AVFormatContext *s) if (c < 0) return -1; if (c == 0x47) { - url_fseek(pb, -1, SEEK_CUR); + avio_seek(pb, -1, SEEK_CUR); return 0; } } @@ -1332,17 +1328,17 @@ static int mpegts_resync(AVFormatContext *s) /* return -1 if error or EOF. Return 0 if OK. */ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int skip, len; for(;;) { - len = get_buffer(pb, buf, TS_PACKET_SIZE); + len = avio_read(pb, buf, TS_PACKET_SIZE); if (len != TS_PACKET_SIZE) return AVERROR(EIO); /* check paquet sync byte */ if (buf[0] != 0x47) { /* find a new packet start */ - url_fseek(pb, -TS_PACKET_SIZE, SEEK_CUR); + avio_seek(pb, -TS_PACKET_SIZE, SEEK_CUR); if (mpegts_resync(s) < 0) return AVERROR(EAGAIN); else @@ -1350,7 +1346,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size) } else { skip = raw_packet_size - TS_PACKET_SIZE; if (skip > 0) - url_fskip(pb, skip); + avio_seek(pb, skip, SEEK_CUR); break; } } @@ -1444,7 +1440,7 @@ static int mpegts_read_header(AVFormatContext *s, AVFormatParameters *ap) { MpegTSContext *ts = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint8_t buf[5*1024]; int len; int64_t pos; @@ -1459,7 +1455,7 @@ static int mpegts_read_header(AVFormatContext *s, /* read the first 1024 bytes to get packet size */ pos = url_ftell(pb); - len = get_buffer(pb, buf, sizeof(buf)); + len = avio_read(pb, buf, sizeof(buf)); if (len != sizeof(buf)) goto fail; ts->raw_packet_size = get_packet_size(buf, sizeof(buf)); @@ -1472,7 +1468,7 @@ static int mpegts_read_header(AVFormatContext *s, /* normal demux */ /* first do a scaning to get all the services */ - if (url_fseek(pb, pos, SEEK_SET) < 0) + if (avio_seek(pb, pos, SEEK_SET) < 0) av_log(s, AV_LOG_ERROR, "Unable to seek back to the start\n"); mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1); @@ -1537,7 +1533,7 @@ static int mpegts_read_header(AVFormatContext *s, #endif } - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); return 0; fail: return -1; @@ -1568,8 +1564,8 @@ static int mpegts_raw_read_packet(AVFormatContext *s, /* we read the next PCR (XXX: optimize it by using a bigger buffer */ pos = url_ftell(s->pb); for(i = 0; i < MAX_PACKET_READAHEAD; i++) { - url_fseek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET); - get_buffer(s->pb, pcr_buf, 12); + avio_seek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET); + avio_read(s->pb, pcr_buf, 12); if (parse_pcr(&next_pcr_h, &next_pcr_l, pcr_buf) == 0) { /* XXX: not precise enough */ ts->pcr_incr = ((next_pcr_h - pcr_h) * 300 + (next_pcr_l - pcr_l)) / @@ -1577,7 +1573,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s, break; } } - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); /* no next PCR found: we use previous increment */ ts->cur_pcr = pcr_h * 300 + pcr_l; } @@ -1653,8 +1649,8 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, pos = ((*ppos + ts->raw_packet_size - 1 - ts->pos47) / ts->raw_packet_size) * ts->raw_packet_size + ts->pos47; if (find_next) { for(;;) { - url_fseek(s->pb, pos, SEEK_SET); - if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) + avio_seek(s->pb, pos, SEEK_SET); + if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) return AV_NOPTS_VALUE; if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) && parse_pcr(×tamp, &pcr_l, buf) == 0) { @@ -1667,8 +1663,8 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, pos -= ts->raw_packet_size; if (pos < 0) return AV_NOPTS_VALUE; - url_fseek(s->pb, pos, SEEK_SET); - if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) + avio_seek(s->pb, pos, SEEK_SET); + if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) return AV_NOPTS_VALUE; if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) && parse_pcr(×tamp, &pcr_l, buf) == 0) { @@ -1778,14 +1774,14 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in pos= url_ftell(s->pb); for(;;) { - url_fseek(s->pb, pos, SEEK_SET); - if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) + avio_seek(s->pb, pos, SEEK_SET); + if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) return -1; // pid = AV_RB16(buf + 1) & 0x1fff; if(buf[1] & 0x40) break; pos += ts->raw_packet_size; } - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); return 0; } diff --git a/mplayer/ffmpeg/libavformat/mpegtsenc.c b/mplayer/ffmpeg/libavformat/mpegtsenc.c index b58e84be..be11a06f 100644 --- a/mplayer/ffmpeg/libavformat/mpegtsenc.c +++ b/mplayer/ffmpeg/libavformat/mpegtsenc.c @@ -21,6 +21,7 @@ #include "libavutil/bswap.h" #include "libavutil/crc.h" +#include "libavutil/opt.h" #include "libavcodec/mpegvideo.h" #include "avformat.h" #include "internal.h" @@ -64,8 +65,36 @@ typedef struct MpegTSWrite { int tsid; int64_t first_pcr; int mux_rate; ///< set to 1 when VBR + + int transport_stream_id; + int original_network_id; + int service_id; + + int pmt_start_pid; + int start_pid; } MpegTSWrite; +static const AVOption options[] = { + { "mpegts_transport_stream_id", "Set transport_stream_id field.", + offsetof(MpegTSWrite, transport_stream_id), FF_OPT_TYPE_INT, 0x0001, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM}, + { "mpegts_original_network_id", "Set original_network_id field.", + offsetof(MpegTSWrite, original_network_id), FF_OPT_TYPE_INT, 0x0001, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM}, + { "mpegts_service_id", "Set service_id field.", + offsetof(MpegTSWrite, service_id), FF_OPT_TYPE_INT, 0x0001, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM}, + { "mpegts_pmt_start_pid", "Set the first pid of the PMT.", + offsetof(MpegTSWrite, pmt_start_pid), FF_OPT_TYPE_INT, 0x1000, 0x1000, 0x1f00, AV_OPT_FLAG_ENCODING_PARAM}, + { "mpegts_start_pid", "Set the first pid.", + offsetof(MpegTSWrite, start_pid), FF_OPT_TYPE_INT, 0x0100, 0x0100, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM}, + { NULL }, +}; + +static const AVClass mpegts_muxer_class = { + "MPEGTS muxer", + av_default_item_name, + options, + LIBAVUTIL_VERSION_INT, +}; + /* NOTE: 4 bytes must be left at the end for the crc32 */ static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len) { @@ -152,16 +181,9 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id, /*********************************************/ /* mpegts writer */ -#define DEFAULT_PMT_START_PID 0x1000 -#define DEFAULT_START_PID 0x0100 #define DEFAULT_PROVIDER_NAME "FFmpeg" #define DEFAULT_SERVICE_NAME "Service01" -/* default network id, transport stream and service identifiers */ -#define DEFAULT_ONID 0x0001 -#define DEFAULT_TSID 0x0001 -#define DEFAULT_SID 0x0001 - /* a PES packet header is generated every DEFAULT_PES_HEADER_FREQ packets */ #define DEFAULT_PES_HEADER_FREQ 16 #define DEFAULT_PES_PAYLOAD_SIZE ((DEFAULT_PES_HEADER_FREQ - 1) * 184 + 170) @@ -267,7 +289,14 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) *q++ = lang->value[0]; *q++ = lang->value[1]; *q++ = lang->value[2]; - *q++ = 0; /* undefined type */ + if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) + *q++ = 0x01; + else if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) + *q++ = 0x02; + else if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) + *q++ = 0x03; + else + *q++ = 0; /* undefined type */ } break; case AVMEDIA_TYPE_SUBTITLE: @@ -374,7 +403,7 @@ static MpegTSService *mpegts_add_service(MpegTSWrite *ts, service = av_mallocz(sizeof(MpegTSService)); if (!service) return NULL; - service->pmt.pid = DEFAULT_PMT_START_PID + ts->nb_services - 1; + service->pmt.pid = ts->pmt_start_pid + ts->nb_services - 1; service->sid = sid; service->provider_name = av_strdup(provider_name); service->name = av_strdup(name); @@ -386,7 +415,7 @@ static MpegTSService *mpegts_add_service(MpegTSWrite *ts, static void section_write_packet(MpegTSSection *s, const uint8_t *packet) { AVFormatContext *ctx = s->opaque; - put_buffer(ctx->pb, packet, TS_PACKET_SIZE); + avio_write(ctx->pb, packet, TS_PACKET_SIZE); } static int mpegts_write_header(AVFormatContext *s) @@ -401,8 +430,8 @@ static int mpegts_write_header(AVFormatContext *s) const char *provider_name; int *pids; - ts->tsid = DEFAULT_TSID; - ts->onid = DEFAULT_ONID; + ts->tsid = ts->transport_stream_id; + ts->onid = ts->original_network_id; /* allocate a single DVB service */ title = av_metadata_get(s->metadata, "service_name", NULL, 0); if (!title) @@ -410,7 +439,7 @@ static int mpegts_write_header(AVFormatContext *s) service_name = title ? title->value : DEFAULT_SERVICE_NAME; provider = av_metadata_get(s->metadata, "service_provider", NULL, 0); provider_name = provider ? provider->value : DEFAULT_PROVIDER_NAME; - service = mpegts_add_service(ts, DEFAULT_SID, provider_name, service_name); + service = mpegts_add_service(ts, ts->service_id, provider_name, service_name); service->pmt.write_packet = section_write_packet; service->pmt.opaque = s; service->pmt.cc = 15; @@ -440,7 +469,7 @@ static int mpegts_write_header(AVFormatContext *s) /* MPEG pid values < 16 are reserved. Applications which set st->id in * this range are assigned a calculated pid. */ if (st->id < 16) { - ts_st->pid = DEFAULT_START_PID + i; + ts_st->pid = ts->start_pid + i; } else if (st->id < 0x1FFF) { ts_st->pid = st->id; } else { @@ -564,7 +593,7 @@ static void retransmit_si_info(AVFormatContext *s) } } -static int64_t get_pcr(const MpegTSWrite *ts, ByteIOContext *pb) +static int64_t get_pcr(const MpegTSWrite *ts, AVIOContext *pb) { return av_rescale(url_ftell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) + ts->first_pcr; @@ -596,7 +625,7 @@ static void mpegts_insert_null_packet(AVFormatContext *s) *q++ = 0xff; *q++ = 0x10; memset(q, 0x0FF, TS_PACKET_SIZE - (q - buf)); - put_buffer(s->pb, buf, TS_PACKET_SIZE); + avio_write(s->pb, buf, TS_PACKET_SIZE); } /* Write a single transport stream packet with a PCR and no payload */ @@ -621,7 +650,7 @@ static void mpegts_insert_pcr_only(AVFormatContext *s, AVStream *st) /* stuffing bytes */ memset(q, 0xFF, TS_PACKET_SIZE - (q - buf)); - put_buffer(s->pb, buf, TS_PACKET_SIZE); + avio_write(s->pb, buf, TS_PACKET_SIZE); } static void write_pts(uint8_t *q, int fourbits, int64_t pts) @@ -717,7 +746,8 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st, *q++ = 0xe0; } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && (st->codec->codec_id == CODEC_ID_MP2 || - st->codec->codec_id == CODEC_ID_MP3)) { + st->codec->codec_id == CODEC_ID_MP3 || + st->codec->codec_id == CODEC_ID_AAC)) { *q++ = 0xc0; } else { *q++ = 0xbd; @@ -815,7 +845,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st, memcpy(buf + TS_PACKET_SIZE - len, payload, len); payload += len; payload_size -= len; - put_buffer(s->pb, buf, TS_PACKET_SIZE); + avio_write(s->pb, buf, TS_PACKET_SIZE); } put_flush_packet(s->pb); } @@ -964,4 +994,5 @@ AVOutputFormat ff_mpegts_muxer = { mpegts_write_header, mpegts_write_packet, mpegts_write_end, + .priv_class = &mpegts_muxer_class, }; diff --git a/mplayer/ffmpeg/libavformat/mpjpeg.c b/mplayer/ffmpeg/libavformat/mpjpeg.c index 76f59859..e98fb363 100644 --- a/mplayer/ffmpeg/libavformat/mpjpeg.c +++ b/mplayer/ffmpeg/libavformat/mpjpeg.c @@ -29,7 +29,7 @@ static int mpjpeg_write_header(AVFormatContext *s) uint8_t buf1[256]; snprintf(buf1, sizeof(buf1), "--%s\n", BOUNDARY_TAG); - put_buffer(s->pb, buf1, strlen(buf1)); + avio_write(s->pb, buf1, strlen(buf1)); put_flush_packet(s->pb); return 0; } @@ -39,11 +39,11 @@ static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt) uint8_t buf1[256]; snprintf(buf1, sizeof(buf1), "Content-type: image/jpeg\n\n"); - put_buffer(s->pb, buf1, strlen(buf1)); - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, buf1, strlen(buf1)); + avio_write(s->pb, pkt->data, pkt->size); snprintf(buf1, sizeof(buf1), "\n--%s\n", BOUNDARY_TAG); - put_buffer(s->pb, buf1, strlen(buf1)); + avio_write(s->pb, buf1, strlen(buf1)); put_flush_packet(s->pb); return 0; } diff --git a/mplayer/ffmpeg/libavformat/msnwc_tcp.c b/mplayer/ffmpeg/libavformat/msnwc_tcp.c index f9cde027..2a11a572 100644 --- a/mplayer/ffmpeg/libavformat/msnwc_tcp.c +++ b/mplayer/ffmpeg/libavformat/msnwc_tcp.c @@ -71,7 +71,7 @@ static int msnwc_tcp_probe(AVProbeData *p) static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) { - ByteIOContext *pb = ctx->pb; + AVIOContext *pb = ctx->pb; AVCodecContext *codec; AVStream *st; @@ -88,7 +88,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) /* Some files start with "connected\r\n\r\n". * So skip until we find the first byte of struct size */ - while(get_byte(pb) != HEADER_SIZE && !url_feof(pb)); + while(avio_r8(pb) != HEADER_SIZE && !url_feof(pb)); if(url_feof(pb)) { av_log(ctx, AV_LOG_ERROR, "Could not find valid start."); @@ -100,23 +100,23 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt) { - ByteIOContext *pb = ctx->pb; + AVIOContext *pb = ctx->pb; uint16_t keyframe; uint32_t size, timestamp; - url_fskip(pb, 1); /* one byte has been read ahead */ - url_fskip(pb, 2); - url_fskip(pb, 2); - keyframe = get_le16(pb); - size = get_le32(pb); - url_fskip(pb, 4); - url_fskip(pb, 4); - timestamp = get_le32(pb); + avio_seek(pb, 1, SEEK_CUR); /* one byte has been read ahead */ + avio_seek(pb, 2, SEEK_CUR); + avio_seek(pb, 2, SEEK_CUR); + keyframe = avio_rl16(pb); + size = avio_rl32(pb); + avio_seek(pb, 4, SEEK_CUR); + avio_seek(pb, 4, SEEK_CUR); + timestamp = avio_rl32(pb); if(!size || av_get_packet(pb, pkt, size) != size) return -1; - url_fskip(pb, 1); /* Read ahead one byte of struct size like read_header */ + avio_seek(pb, 1, SEEK_CUR); /* Read ahead one byte of struct size like read_header */ pkt->pts = timestamp; pkt->dts = timestamp; diff --git a/mplayer/ffmpeg/libavformat/mtv.c b/mplayer/ffmpeg/libavformat/mtv.c index acb21a99..c5f14cf6 100644 --- a/mplayer/ffmpeg/libavformat/mtv.c +++ b/mplayer/ffmpeg/libavformat/mtv.c @@ -79,21 +79,21 @@ static int mtv_probe(AVProbeData *p) static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) { MTVDemuxContext *mtv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; unsigned int audio_subsegments; - url_fskip(pb, 3); - mtv->file_size = get_le32(pb); - mtv->segments = get_le32(pb); - url_fskip(pb, 32); - mtv->audio_identifier = get_le24(pb); - mtv->audio_br = get_le16(pb); - mtv->img_colorfmt = get_le24(pb); - mtv->img_bpp = get_byte(pb); - mtv->img_width = get_le16(pb); - mtv->img_height = get_le16(pb); - mtv->img_segment_size = get_le16(pb); + avio_seek(pb, 3, SEEK_CUR); + mtv->file_size = avio_rl32(pb); + mtv->segments = avio_rl32(pb); + avio_seek(pb, 32, SEEK_CUR); + mtv->audio_identifier = avio_rl24(pb); + mtv->audio_br = avio_rl16(pb); + mtv->img_colorfmt = avio_rl24(pb); + mtv->img_bpp = avio_r8(pb); + mtv->img_width = avio_rl16(pb); + mtv->img_height = avio_rl16(pb); + mtv->img_segment_size = avio_rl16(pb); /* Calculate width and height if missing from header */ @@ -105,8 +105,8 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) mtv->img_height=mtv->img_segment_size / (mtv->img_bpp>>3) / mtv->img_width; - url_fskip(pb, 4); - audio_subsegments = get_le16(pb); + avio_seek(pb, 4, SEEK_CUR); + audio_subsegments = avio_rl16(pb); mtv->full_segment_size = audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) + mtv->img_segment_size; @@ -146,7 +146,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) // Jump over header - if(url_fseek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE) + if(avio_seek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE) return AVERROR(EIO); return 0; @@ -156,7 +156,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) { MTVDemuxContext *mtv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret; #if !HAVE_BIGENDIAN int i; @@ -164,7 +164,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) if((url_ftell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size) { - url_fskip(pb, MTV_AUDIO_PADDING_SIZE); + avio_seek(pb, MTV_AUDIO_PADDING_SIZE, SEEK_CUR); ret = av_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE); if(ret < 0) diff --git a/mplayer/ffmpeg/libavformat/mvi.c b/mplayer/ffmpeg/libavformat/mvi.c index c982e6bc..4784efae 100644 --- a/mplayer/ffmpeg/libavformat/mvi.c +++ b/mplayer/ffmpeg/libavformat/mvi.c @@ -27,7 +27,7 @@ #define MVI_VIDEO_STREAM_INDEX 1 typedef struct MviDemuxContext { - unsigned int (*get_int)(ByteIOContext *); + unsigned int (*get_int)(AVIOContext *); uint32_t audio_data_size; uint64_t audio_size_counter; uint64_t audio_frame_size; @@ -38,7 +38,7 @@ typedef struct MviDemuxContext { static int read_header(AVFormatContext *s, AVFormatParameters *ap) { MviDemuxContext *mvi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *ast, *vst; unsigned int version, frames_count, msecs_per_frame, player_version; @@ -53,20 +53,20 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) vst->codec->extradata_size = 2; vst->codec->extradata = av_mallocz(2 + FF_INPUT_BUFFER_PADDING_SIZE); - version = get_byte(pb); - vst->codec->extradata[0] = get_byte(pb); - vst->codec->extradata[1] = get_byte(pb); - frames_count = get_le32(pb); - msecs_per_frame = get_le32(pb); - vst->codec->width = get_le16(pb); - vst->codec->height = get_le16(pb); - get_byte(pb); - ast->codec->sample_rate = get_le16(pb); - mvi->audio_data_size = get_le32(pb); - get_byte(pb); - player_version = get_le32(pb); - get_le16(pb); - get_byte(pb); + version = avio_r8(pb); + vst->codec->extradata[0] = avio_r8(pb); + vst->codec->extradata[1] = avio_r8(pb); + frames_count = avio_rl32(pb); + msecs_per_frame = avio_rl32(pb); + vst->codec->width = avio_rl16(pb); + vst->codec->height = avio_rl16(pb); + avio_r8(pb); + ast->codec->sample_rate = avio_rl16(pb); + mvi->audio_data_size = avio_rl32(pb); + avio_r8(pb); + player_version = avio_rl32(pb); + avio_rl16(pb); + avio_r8(pb); if (frames_count == 0 || mvi->audio_data_size == 0) return AVERROR_INVALIDDATA; @@ -87,7 +87,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = CODEC_ID_MOTIONPIXELS; - mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? get_le16 : get_le24; + mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? avio_rl16 : avio_rl24; mvi->audio_frame_size = ((uint64_t)mvi->audio_data_size << MVI_FRAC_BITS) / frames_count; mvi->audio_size_counter = (ast->codec->sample_rate * 830 / mvi->audio_frame_size - 1) * mvi->audio_frame_size; @@ -100,7 +100,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) { int ret, count; MviDemuxContext *mvi = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (mvi->video_frame_size == 0) { mvi->video_frame_size = (mvi->get_int)(pb); diff --git a/mplayer/ffmpeg/libavformat/mxfdec.c b/mplayer/ffmpeg/libavformat/mxfdec.c index 91935619..be618406 100644 --- a/mplayer/ffmpeg/libavformat/mxfdec.c +++ b/mplayer/ffmpeg/libavformat/mxfdec.c @@ -140,7 +140,7 @@ enum MXFWrappingScheme { Clip, }; -typedef int MXFMetadataReadFunc(void *arg, ByteIOContext *pb, int tag, int size, UID uid); +typedef int MXFMetadataReadFunc(void *arg, AVIOContext *pb, int tag, int size, UID uid); typedef struct { const UID key; @@ -161,9 +161,9 @@ static const uint8_t mxf_sony_mpeg4_extradata[] = { 0x06,0x0e,0x2b,0x #define IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y))) -static int64_t klv_decode_ber_length(ByteIOContext *pb) +static int64_t klv_decode_ber_length(AVIOContext *pb) { - uint64_t size = get_byte(pb); + uint64_t size = avio_r8(pb); if (size & 0x80) { /* long form */ int bytes_num = size & 0x7f; /* SMPTE 379M 5.3.4 guarantee that bytes_num must not exceed 8 bytes */ @@ -171,16 +171,16 @@ static int64_t klv_decode_ber_length(ByteIOContext *pb) return -1; size = 0; while (bytes_num--) - size = size << 8 | get_byte(pb); + size = size << 8 | avio_r8(pb); } return size; } -static int mxf_read_sync(ByteIOContext *pb, const uint8_t *key, unsigned size) +static int mxf_read_sync(AVIOContext *pb, const uint8_t *key, unsigned size) { int i, b; for (i = 0; i < size && !url_feof(pb); i++) { - b = get_byte(pb); + b = avio_r8(pb); if (b == key[0]) i = 0; else if (b != key[i]) @@ -189,13 +189,13 @@ static int mxf_read_sync(ByteIOContext *pb, const uint8_t *key, unsigned size) return i == size; } -static int klv_read_packet(KLVPacket *klv, ByteIOContext *pb) +static int klv_read_packet(KLVPacket *klv, AVIOContext *pb) { if (!mxf_read_sync(pb, mxf_klv_key, 4)) return -1; klv->offset = url_ftell(pb) - 4; memcpy(klv->key, mxf_klv_key, 4); - get_buffer(pb, klv->key + 4, 12); + avio_read(pb, klv->key + 4, 12); klv->length = klv_decode_ber_length(pb); return klv->length == -1 ? -1 : 0; } @@ -215,7 +215,7 @@ static int mxf_get_stream_index(AVFormatContext *s, KLVPacket *klv) } /* XXX: use AVBitStreamFilter */ -static int mxf_get_d10_aes3_packet(ByteIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length) +static int mxf_get_d10_aes3_packet(AVIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length) { const uint8_t *buf_ptr, *end_ptr; uint8_t *data_ptr; @@ -224,7 +224,7 @@ static int mxf_get_d10_aes3_packet(ByteIOContext *pb, AVStream *st, AVPacket *pk if (length > 61444) /* worst case PAL 1920 samples 8 channels */ return -1; av_new_packet(pkt, length); - get_buffer(pb, pkt->data, length); + avio_read(pb, pkt->data, length); data_ptr = pkt->data; end_ptr = pkt->data + length; buf_ptr = pkt->data + 4; /* skip SMPTE 331M header */ @@ -246,7 +246,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv { static const uint8_t checkv[16] = {0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b}; MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t end = url_ftell(pb) + klv->length; uint64_t size; uint64_t orig_size; @@ -262,13 +262,13 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv av_aes_init(mxf->aesc, s->key, 128, 1); } // crypto context - url_fskip(pb, klv_decode_ber_length(pb)); + avio_seek(pb, klv_decode_ber_length(pb), SEEK_CUR); // plaintext offset klv_decode_ber_length(pb); - plaintext_size = get_be64(pb); + plaintext_size = avio_rb64(pb); // source klv key klv_decode_ber_length(pb); - get_buffer(pb, klv->key, 16); + avio_read(pb, klv->key, 16); if (!IS_KLV_KEY(klv, mxf_essence_element_key)) return -1; index = mxf_get_stream_index(s, klv); @@ -276,15 +276,15 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv return -1; // source size klv_decode_ber_length(pb); - orig_size = get_be64(pb); + orig_size = avio_rb64(pb); if (orig_size < plaintext_size) return -1; // enc. code size = klv_decode_ber_length(pb); if (size < 32 || size - 32 < orig_size) return -1; - get_buffer(pb, ivec, 16); - get_buffer(pb, tmpbuf, 16); + avio_read(pb, ivec, 16); + avio_read(pb, tmpbuf, 16); if (mxf->aesc) av_aes_crypt(mxf->aesc, tmpbuf, tmpbuf, 1, ivec, 1); if (memcmp(tmpbuf, checkv, 16)) @@ -297,7 +297,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv &pkt->data[plaintext_size], size >> 4, ivec, 1); pkt->size = orig_size; pkt->stream_index = index; - url_fskip(pb, end - url_ftell(pb)); + avio_seek(pb, end - url_ftell(pb), SEEK_CUR); return 0; } @@ -339,16 +339,16 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } else skip: - url_fskip(s->pb, klv.length); + avio_seek(s->pb, klv.length, SEEK_CUR); } return AVERROR_EOF; } -static int mxf_read_primer_pack(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFContext *mxf = arg; - int item_num = get_be32(pb); - int item_len = get_be32(pb); + int item_num = avio_rb32(pb); + int item_len = avio_rb32(pb); if (item_len != 18) { av_log(mxf->fc, AV_LOG_ERROR, "unsupported primer pack item length\n"); @@ -360,7 +360,7 @@ static int mxf_read_primer_pack(void *arg, ByteIOContext *pb, int tag, int size, mxf->local_tags = av_malloc(item_num*item_len); if (!mxf->local_tags) return -1; - get_buffer(pb, mxf->local_tags, item_num*item_len); + avio_read(pb, mxf->local_tags, item_num*item_len); return 0; } @@ -376,166 +376,166 @@ static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set) return 0; } -static int mxf_read_cryptographic_context(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFCryptoContext *cryptocontext = arg; if (size != 16) return -1; if (IS_KLV_KEY(uid, mxf_crypto_source_container_ul)) - get_buffer(pb, cryptocontext->source_container_ul, 16); + avio_read(pb, cryptocontext->source_container_ul, 16); return 0; } -static int mxf_read_content_storage(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFContext *mxf = arg; switch (tag) { case 0x1901: - mxf->packages_count = get_be32(pb); + mxf->packages_count = avio_rb32(pb); if (mxf->packages_count >= UINT_MAX / sizeof(UID)) return -1; mxf->packages_refs = av_malloc(mxf->packages_count * sizeof(UID)); if (!mxf->packages_refs) return -1; - url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ - get_buffer(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID)); + avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_read(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID)); break; } return 0; } -static int mxf_read_source_clip(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFStructuralComponent *source_clip = arg; switch(tag) { case 0x0202: - source_clip->duration = get_be64(pb); + source_clip->duration = avio_rb64(pb); break; case 0x1201: - source_clip->start_position = get_be64(pb); + source_clip->start_position = avio_rb64(pb); break; case 0x1101: /* UMID, only get last 16 bytes */ - url_fskip(pb, 16); - get_buffer(pb, source_clip->source_package_uid, 16); + avio_seek(pb, 16, SEEK_CUR); + avio_read(pb, source_clip->source_package_uid, 16); break; case 0x1102: - source_clip->source_track_id = get_be32(pb); + source_clip->source_track_id = avio_rb32(pb); break; } return 0; } -static int mxf_read_material_package(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFPackage *package = arg; switch(tag) { case 0x4403: - package->tracks_count = get_be32(pb); + package->tracks_count = avio_rb32(pb); if (package->tracks_count >= UINT_MAX / sizeof(UID)) return -1; package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID)); if (!package->tracks_refs) return -1; - url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ - get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); + avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); break; } return 0; } -static int mxf_read_track(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_track(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFTrack *track = arg; switch(tag) { case 0x4801: - track->track_id = get_be32(pb); + track->track_id = avio_rb32(pb); break; case 0x4804: - get_buffer(pb, track->track_number, 4); + avio_read(pb, track->track_number, 4); break; case 0x4B01: - track->edit_rate.den = get_be32(pb); - track->edit_rate.num = get_be32(pb); + track->edit_rate.den = avio_rb32(pb); + track->edit_rate.num = avio_rb32(pb); break; case 0x4803: - get_buffer(pb, track->sequence_ref, 16); + avio_read(pb, track->sequence_ref, 16); break; } return 0; } -static int mxf_read_sequence(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFSequence *sequence = arg; switch(tag) { case 0x0202: - sequence->duration = get_be64(pb); + sequence->duration = avio_rb64(pb); break; case 0x0201: - get_buffer(pb, sequence->data_definition_ul, 16); + avio_read(pb, sequence->data_definition_ul, 16); break; case 0x1001: - sequence->structural_components_count = get_be32(pb); + sequence->structural_components_count = avio_rb32(pb); if (sequence->structural_components_count >= UINT_MAX / sizeof(UID)) return -1; sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID)); if (!sequence->structural_components_refs) return -1; - url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ - get_buffer(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID)); + avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_read(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID)); break; } return 0; } -static int mxf_read_source_package(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFPackage *package = arg; switch(tag) { case 0x4403: - package->tracks_count = get_be32(pb); + package->tracks_count = avio_rb32(pb); if (package->tracks_count >= UINT_MAX / sizeof(UID)) return -1; package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID)); if (!package->tracks_refs) return -1; - url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ - get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); + avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); break; case 0x4401: /* UMID, only get last 16 bytes */ - url_fskip(pb, 16); - get_buffer(pb, package->package_uid, 16); + avio_seek(pb, 16, SEEK_CUR); + avio_read(pb, package->package_uid, 16); break; case 0x4701: - get_buffer(pb, package->descriptor_ref, 16); + avio_read(pb, package->descriptor_ref, 16); break; } return 0; } -static int mxf_read_index_table_segment(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_index_table_segment(void *arg, AVIOContext *pb, int tag, int size, UID uid) { switch(tag) { - case 0x3F05: av_dlog(NULL, "EditUnitByteCount %d\n", get_be32(pb)); break; - case 0x3F06: av_dlog(NULL, "IndexSID %d\n", get_be32(pb)); break; - case 0x3F07: av_dlog(NULL, "BodySID %d\n", get_be32(pb)); break; - case 0x3F0B: av_dlog(NULL, "IndexEditRate %d/%d\n", get_be32(pb), get_be32(pb)); break; - case 0x3F0C: av_dlog(NULL, "IndexStartPosition %lld\n", get_be64(pb)); break; - case 0x3F0D: av_dlog(NULL, "IndexDuration %lld\n", get_be64(pb)); break; + case 0x3F05: av_dlog(NULL, "EditUnitByteCount %d\n", avio_rb32(pb)); break; + case 0x3F06: av_dlog(NULL, "IndexSID %d\n", avio_rb32(pb)); break; + case 0x3F07: av_dlog(NULL, "BodySID %d\n", avio_rb32(pb)); break; + case 0x3F0B: av_dlog(NULL, "IndexEditRate %d/%d\n", avio_rb32(pb), avio_rb32(pb)); break; + case 0x3F0C: av_dlog(NULL, "IndexStartPosition %lld\n", avio_rb64(pb)); break; + case 0x3F0D: av_dlog(NULL, "IndexDuration %lld\n", avio_rb64(pb)); break; } return 0; } -static void mxf_read_pixel_layout(ByteIOContext *pb, MXFDescriptor *descriptor) +static void mxf_read_pixel_layout(AVIOContext *pb, MXFDescriptor *descriptor) { int code, value, ofs = 0; char layout[16] = {0}; do { - code = get_byte(pb); - value = get_byte(pb); + code = avio_r8(pb); + value = avio_r8(pb); av_dlog(NULL, "pixel layout: code %#x\n", code); if (ofs < 16) { @@ -547,51 +547,51 @@ static void mxf_read_pixel_layout(ByteIOContext *pb, MXFDescriptor *descriptor) ff_mxf_decode_pixel_layout(layout, &descriptor->pix_fmt); } -static int mxf_read_generic_descriptor(void *arg, ByteIOContext *pb, int tag, int size, UID uid) +static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFDescriptor *descriptor = arg; switch(tag) { case 0x3F01: - descriptor->sub_descriptors_count = get_be32(pb); + descriptor->sub_descriptors_count = avio_rb32(pb); if (descriptor->sub_descriptors_count >= UINT_MAX / sizeof(UID)) return -1; descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID)); if (!descriptor->sub_descriptors_refs) return -1; - url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ - get_buffer(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID)); + avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_read(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID)); break; case 0x3004: - get_buffer(pb, descriptor->essence_container_ul, 16); + avio_read(pb, descriptor->essence_container_ul, 16); break; case 0x3006: - descriptor->linked_track_id = get_be32(pb); + descriptor->linked_track_id = avio_rb32(pb); break; case 0x3201: /* PictureEssenceCoding */ - get_buffer(pb, descriptor->essence_codec_ul, 16); + avio_read(pb, descriptor->essence_codec_ul, 16); break; case 0x3203: - descriptor->width = get_be32(pb); + descriptor->width = avio_rb32(pb); break; case 0x3202: - descriptor->height = get_be32(pb); + descriptor->height = avio_rb32(pb); break; case 0x320E: - descriptor->aspect_ratio.num = get_be32(pb); - descriptor->aspect_ratio.den = get_be32(pb); + descriptor->aspect_ratio.num = avio_rb32(pb); + descriptor->aspect_ratio.den = avio_rb32(pb); break; case 0x3D03: - descriptor->sample_rate.num = get_be32(pb); - descriptor->sample_rate.den = get_be32(pb); + descriptor->sample_rate.num = avio_rb32(pb); + descriptor->sample_rate.den = avio_rb32(pb); break; case 0x3D06: /* SoundEssenceCompression */ - get_buffer(pb, descriptor->essence_codec_ul, 16); + avio_read(pb, descriptor->essence_codec_ul, 16); break; case 0x3D07: - descriptor->channels = get_be32(pb); + descriptor->channels = avio_rb32(pb); break; case 0x3D01: - descriptor->bits_per_sample = get_be32(pb); + descriptor->bits_per_sample = avio_rb32(pb); break; case 0x3401: mxf_read_pixel_layout(pb, descriptor); @@ -603,7 +603,7 @@ static int mxf_read_generic_descriptor(void *arg, ByteIOContext *pb, int tag, in if (!descriptor->extradata) return -1; descriptor->extradata_size = size; - get_buffer(pb, descriptor->extradata, size); + avio_read(pb, descriptor->extradata, size); } break; } @@ -864,15 +864,15 @@ static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = { static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadFunc *read_child, int ctx_size, enum MXFMetadataSetType type) { - ByteIOContext *pb = mxf->fc->pb; + AVIOContext *pb = mxf->fc->pb; MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf; uint64_t klv_end = url_ftell(pb) + klv->length; if (!ctx) return -1; while (url_ftell(pb) + 4 < klv_end) { - int tag = get_be16(pb); - int size = get_be16(pb); /* KLV specified by 0x53 */ + int tag = avio_rb16(pb); + int size = avio_rb16(pb); /* KLV specified by 0x53 */ uint64_t next = url_ftell(pb) + size; UID uid = {0}; @@ -893,11 +893,11 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF } } if (ctx_size && tag == 0x3C0A) - get_buffer(pb, ctx->uid, 16); + avio_read(pb, ctx->uid, 16); else if (read_child(ctx, pb, tag, size, uid) < 0) return -1; - url_fseek(pb, next, SEEK_SET); + avio_seek(pb, next, SEEK_SET); } if (ctx_size) ctx->type = type; return ctx_size ? mxf_add_metadata_set(mxf, ctx) : 0; @@ -912,7 +912,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "could not find header partition pack key\n"); return -1; } - url_fseek(s->pb, -14, SEEK_CUR); + avio_seek(s->pb, -14, SEEK_CUR); mxf->fc = s; while (!url_feof(s->pb)) { const MXFMetadataReadTableEntry *metadata; @@ -924,7 +924,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) || IS_KLV_KEY(klv.key, mxf_essence_element_key)) { /* FIXME avoid seek */ - url_fseek(s->pb, klv.offset, SEEK_SET); + avio_seek(s->pb, klv.offset, SEEK_SET); break; } @@ -943,7 +943,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) } } if (!metadata->read) - url_fskip(s->pb, klv.length); + avio_seek(s->pb, klv.length, SEEK_CUR); } return mxf_parse_structural_metadata(mxf); } @@ -1009,7 +1009,7 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti if (sample_time < 0) sample_time = 0; seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den); - url_fseek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET); + avio_seek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET); av_update_cur_dts(s, st, sample_time); return 0; } diff --git a/mplayer/ffmpeg/libavformat/mxfenc.c b/mplayer/ffmpeg/libavformat/mxfenc.c index 8a8d7dda..395d7c39 100644 --- a/mplayer/ffmpeg/libavformat/mxfenc.c +++ b/mplayer/ffmpeg/libavformat/mxfenc.c @@ -305,26 +305,26 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = { { 0x3D0A, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x03,0x02,0x01,0x00,0x00,0x00}}, /* Block Align */ }; -static void mxf_write_uuid(ByteIOContext *pb, enum MXFMetadataSetType type, int value) +static void mxf_write_uuid(AVIOContext *pb, enum MXFMetadataSetType type, int value) { - put_buffer(pb, uuid_base, 12); - put_be16(pb, type); - put_be16(pb, value); + avio_write(pb, uuid_base, 12); + avio_wb16(pb, type); + avio_wb16(pb, value); } static void mxf_write_umid(AVFormatContext *s, int type) { MXFContext *mxf = s->priv_data; - put_buffer(s->pb, umid_ul, 13); - put_be24(s->pb, mxf->instance_number); - put_buffer(s->pb, mxf->umid, 15); - put_byte(s->pb, type); + avio_write(s->pb, umid_ul, 13); + avio_wb24(s->pb, mxf->instance_number); + avio_write(s->pb, mxf->umid, 15); + avio_w8(s->pb, type); } -static void mxf_write_refs_count(ByteIOContext *pb, int ref_count) +static void mxf_write_refs_count(AVIOContext *pb, int ref_count) { - put_be32(pb, ref_count); - put_be32(pb, 16); + avio_wb32(pb, ref_count); + avio_wb32(pb, 16); } static int klv_ber_length(uint64_t len) @@ -335,31 +335,31 @@ static int klv_ber_length(uint64_t len) return (av_log2(len) >> 3) + 2; } -static int klv_encode_ber_length(ByteIOContext *pb, uint64_t len) +static int klv_encode_ber_length(AVIOContext *pb, uint64_t len) { // Determine the best BER size int size; if (len < 128) { //short form - put_byte(pb, len); + avio_w8(pb, len); return 1; } size = (av_log2(len) >> 3) + 1; // long form - put_byte(pb, 0x80 + size); + avio_w8(pb, 0x80 + size); while(size) { size--; - put_byte(pb, len >> 8 * size & 0xff); + avio_w8(pb, len >> 8 * size & 0xff); } return 0; } -static void klv_encode_ber4_length(ByteIOContext *pb, int len) +static void klv_encode_ber4_length(AVIOContext *pb, int len) { - put_byte(pb, 0x80 + 3); - put_be24(pb, len); + avio_w8(pb, 0x80 + 3); + avio_wb24(pb, len); } /* @@ -376,33 +376,33 @@ static int mxf_get_essence_container_ul_index(enum CodecID id) static void mxf_write_primer_pack(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int local_tag_number, i = 0; local_tag_number = FF_ARRAY_ELEMS(mxf_local_tag_batch); - put_buffer(pb, primer_pack_key, 16); + avio_write(pb, primer_pack_key, 16); klv_encode_ber_length(pb, local_tag_number * 18 + 8); - put_be32(pb, local_tag_number); // local_tag num - put_be32(pb, 18); // item size, always 18 according to the specs + avio_wb32(pb, local_tag_number); // local_tag num + avio_wb32(pb, 18); // item size, always 18 according to the specs for (i = 0; i < local_tag_number; i++) { - put_be16(pb, mxf_local_tag_batch[i].local_tag); - put_buffer(pb, mxf_local_tag_batch[i].uid, 16); + avio_wb16(pb, mxf_local_tag_batch[i].local_tag); + avio_write(pb, mxf_local_tag_batch[i].uid, 16); } } -static void mxf_write_local_tag(ByteIOContext *pb, int size, int tag) +static void mxf_write_local_tag(AVIOContext *pb, int size, int tag) { - put_be16(pb, tag); - put_be16(pb, size); + avio_wb16(pb, tag); + avio_wb16(pb, size); } -static void mxf_write_metadata_key(ByteIOContext *pb, unsigned int value) +static void mxf_write_metadata_key(AVIOContext *pb, unsigned int value) { - put_buffer(pb, header_metadata_key, 13); - put_be24(pb, value); + avio_write(pb, header_metadata_key, 13); + avio_wb24(pb, value); } static void mxf_free(AVFormatContext *s) @@ -429,21 +429,21 @@ static const MXFCodecUL *mxf_get_data_definition_ul(int type) static void mxf_write_essence_container_refs(AVFormatContext *s) { MXFContext *c = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i; mxf_write_refs_count(pb, c->essence_container_count); av_log(s,AV_LOG_DEBUG, "essence container count:%d\n", c->essence_container_count); for (i = 0; i < c->essence_container_count; i++) { MXFStreamContext *sc = s->streams[i]->priv_data; - put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16); + avio_write(pb, mxf_essence_container_uls[sc->index].container_ul, 16); } } static void mxf_write_preface(AVFormatContext *s) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; mxf_write_metadata_key(pb, 0x012f00); PRINT_KEY(s, "preface key", pb->buf_ptr - 16); @@ -456,11 +456,11 @@ static void mxf_write_preface(AVFormatContext *s) // last modified date mxf_write_local_tag(pb, 8, 0x3B02); - put_be64(pb, mxf->timestamp); + avio_wb64(pb, mxf->timestamp); // write version mxf_write_local_tag(pb, 2, 0x3B05); - put_be16(pb, 258); // v1.2 + avio_wb16(pb, 258); // v1.2 // write identification_refs mxf_write_local_tag(pb, 16 + 8, 0x3B06); @@ -473,7 +473,7 @@ static void mxf_write_preface(AVFormatContext *s) // operational pattern mxf_write_local_tag(pb, 16, 0x3B09); - put_buffer(pb, op1a_ul, 16); + avio_write(pb, op1a_ul, 16); // write essence_container_refs mxf_write_local_tag(pb, 8 + 16 * mxf->essence_container_count, 0x3B0A); @@ -481,24 +481,24 @@ static void mxf_write_preface(AVFormatContext *s) // write dm_scheme_refs mxf_write_local_tag(pb, 8, 0x3B0B); - put_be64(pb, 0); + avio_wb64(pb, 0); } /* * Write a local tag containing an ascii string as utf-16 */ -static void mxf_write_local_tag_utf16(ByteIOContext *pb, int tag, const char *value) +static void mxf_write_local_tag_utf16(AVIOContext *pb, int tag, const char *value) { int i, size = strlen(value); mxf_write_local_tag(pb, size*2, tag); for (i = 0; i < size; i++) - put_be16(pb, value[i]); + avio_wb16(pb, value[i]); } static void mxf_write_identification(AVFormatContext *s) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; const char *company = "FFmpeg"; const char *product = "OP1a Muxer"; const char *version; @@ -531,12 +531,12 @@ static void mxf_write_identification(AVFormatContext *s) // modification date mxf_write_local_tag(pb, 8, 0x3C06); - put_be64(pb, mxf->timestamp); + avio_wb64(pb, mxf->timestamp); } static void mxf_write_content_storage(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; mxf_write_metadata_key(pb, 0x011800); PRINT_KEY(s, "content storage key", pb->buf_ptr - 16); @@ -562,7 +562,7 @@ static void mxf_write_content_storage(AVFormatContext *s) static void mxf_write_track(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; MXFStreamContext *sc = st->priv_data; mxf_write_metadata_key(pb, 0x013b00); @@ -576,22 +576,22 @@ static void mxf_write_track(AVFormatContext *s, AVStream *st, enum MXFMetadataSe // write track id mxf_write_local_tag(pb, 4, 0x4801); - put_be32(pb, st->index+2); + avio_wb32(pb, st->index+2); // write track number mxf_write_local_tag(pb, 4, 0x4804); if (type == MaterialPackage) - put_be32(pb, 0); // track number of material package is 0 + avio_wb32(pb, 0); // track number of material package is 0 else - put_buffer(pb, sc->track_essence_element_key + 12, 4); + avio_write(pb, sc->track_essence_element_key + 12, 4); mxf_write_local_tag(pb, 8, 0x4B01); - put_be32(pb, mxf->time_base.den); - put_be32(pb, mxf->time_base.num); + avio_wb32(pb, mxf->time_base.den); + avio_wb32(pb, mxf->time_base.num); // write origin mxf_write_local_tag(pb, 8, 0x4B02); - put_be64(pb, 0); + avio_wb64(pb, 0); // write sequence refs mxf_write_local_tag(pb, 16, 0x4803); @@ -603,26 +603,26 @@ static const uint8_t smpte_12m_timecode_track_data_ul[] = { 0x06,0x0E,0x2B,0x34, static void mxf_write_common_fields(AVFormatContext *s, AVStream *st) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; // find data define uls mxf_write_local_tag(pb, 16, 0x0201); if (st == mxf->timecode_track) - put_buffer(pb, smpte_12m_timecode_track_data_ul, 16); + avio_write(pb, smpte_12m_timecode_track_data_ul, 16); else { const MXFCodecUL *data_def_ul = mxf_get_data_definition_ul(st->codec->codec_type); - put_buffer(pb, data_def_ul->uid, 16); + avio_write(pb, data_def_ul->uid, 16); } // write duration mxf_write_local_tag(pb, 8, 0x0202); - put_be64(pb, mxf->duration); + avio_wb64(pb, mxf->duration); } static void mxf_write_sequence(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; enum MXFMetadataSetType component; mxf_write_metadata_key(pb, 0x010f00); @@ -650,7 +650,7 @@ static void mxf_write_sequence(AVFormatContext *s, AVStream *st, enum MXFMetadat static void mxf_write_timecode_component(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; mxf_write_metadata_key(pb, 0x011400); klv_encode_ber_length(pb, 75); @@ -664,20 +664,20 @@ static void mxf_write_timecode_component(AVFormatContext *s, AVStream *st, enum // Start Time Code mxf_write_local_tag(pb, 8, 0x1501); - put_be64(pb, mxf->timecode_start); + avio_wb64(pb, mxf->timecode_start); // Rounded Time Code Base mxf_write_local_tag(pb, 2, 0x1502); - put_be16(pb, mxf->timecode_base); + avio_wb16(pb, mxf->timecode_base); // Drop Frame mxf_write_local_tag(pb, 1, 0x1503); - put_byte(pb, mxf->timecode_drop_frame); + avio_w8(pb, mxf->timecode_drop_frame); } static void mxf_write_structural_component(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i; mxf_write_metadata_key(pb, 0x011100); @@ -693,28 +693,28 @@ static void mxf_write_structural_component(AVFormatContext *s, AVStream *st, enu // write start_position mxf_write_local_tag(pb, 8, 0x1201); - put_be64(pb, 0); + avio_wb64(pb, 0); // write source package uid, end of the reference mxf_write_local_tag(pb, 32, 0x1101); if (type == SourcePackage) { for (i = 0; i < 4; i++) - put_be64(pb, 0); + avio_wb64(pb, 0); } else mxf_write_umid(s, 1); // write source track id mxf_write_local_tag(pb, 4, 0x1102); if (type == SourcePackage) - put_be32(pb, 0); + avio_wb32(pb, 0); else - put_be32(pb, st->index+2); + avio_wb32(pb, st->index+2); } static void mxf_write_multi_descriptor(AVFormatContext *s) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; const uint8_t *ul; int i; @@ -728,8 +728,8 @@ static void mxf_write_multi_descriptor(AVFormatContext *s) // write sample rate mxf_write_local_tag(pb, 8, 0x3001); - put_be32(pb, mxf->time_base.den); - put_be32(pb, mxf->time_base.num); + avio_wb32(pb, mxf->time_base.den); + avio_wb32(pb, mxf->time_base.num); // write essence container ul mxf_write_local_tag(pb, 16, 0x3004); @@ -739,7 +739,7 @@ static void mxf_write_multi_descriptor(AVFormatContext *s) MXFStreamContext *sc = s->streams[0]->priv_data; ul = mxf_essence_container_uls[sc->index].container_ul; } - put_buffer(pb, ul, 16); + avio_write(pb, ul, 16); // write sub descriptor refs mxf_write_local_tag(pb, s->nb_streams * 16 + 8, 0x3F01); @@ -752,23 +752,23 @@ static void mxf_write_generic_desc(AVFormatContext *s, AVStream *st, const UID k { MXFContext *mxf = s->priv_data; MXFStreamContext *sc = st->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; - put_buffer(pb, key, 16); + avio_write(pb, key, 16); klv_encode_ber4_length(pb, size+20+8+12+20); mxf_write_local_tag(pb, 16, 0x3C0A); mxf_write_uuid(pb, SubDescriptor, st->index); mxf_write_local_tag(pb, 4, 0x3006); - put_be32(pb, st->index+2); + avio_wb32(pb, st->index+2); mxf_write_local_tag(pb, 8, 0x3001); - put_be32(pb, mxf->time_base.den); - put_be32(pb, mxf->time_base.num); + avio_wb32(pb, mxf->time_base.den); + avio_wb32(pb, mxf->time_base.num); mxf_write_local_tag(pb, 16, 0x3004); - put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16); + avio_write(pb, mxf_essence_container_uls[sc->index].container_ul, 16); } static const UID mxf_mpegvideo_descriptor_key = { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x51,0x00 }; @@ -780,7 +780,7 @@ static const UID mxf_generic_sound_descriptor_key = { 0x06,0x0E,0x2B,0x34,0x02,0 static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size) { MXFStreamContext *sc = st->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int stored_height = (st->codec->height+15)/16*16; int display_height; int f1, f2; @@ -788,13 +788,13 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke mxf_write_generic_desc(s, st, key, size+8+8+8+8+8+8+5+16+sc->interlaced*4+12+20); mxf_write_local_tag(pb, 4, 0x3203); - put_be32(pb, st->codec->width); + avio_wb32(pb, st->codec->width); mxf_write_local_tag(pb, 4, 0x3202); - put_be32(pb, stored_height>>sc->interlaced); + avio_wb32(pb, stored_height>>sc->interlaced); mxf_write_local_tag(pb, 4, 0x3209); - put_be32(pb, st->codec->width); + avio_wb32(pb, st->codec->width); if (st->codec->height == 608) // PAL + VBI display_height = 576; @@ -804,19 +804,19 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke display_height = st->codec->height; mxf_write_local_tag(pb, 4, 0x3208); - put_be32(pb, display_height>>sc->interlaced); + avio_wb32(pb, display_height>>sc->interlaced); // component depth mxf_write_local_tag(pb, 4, 0x3301); - put_be32(pb, 8); + avio_wb32(pb, 8); // horizontal subsampling mxf_write_local_tag(pb, 4, 0x3302); - put_be32(pb, 2); + avio_wb32(pb, 2); // frame layout mxf_write_local_tag(pb, 1, 0x320C); - put_byte(pb, sc->interlaced); + avio_w8(pb, sc->interlaced); // video line map switch (st->codec->height) { @@ -835,18 +835,18 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke } mxf_write_local_tag(pb, 12+sc->interlaced*4, 0x320D); - put_be32(pb, sc->interlaced ? 2 : 1); - put_be32(pb, 4); - put_be32(pb, f1); + avio_wb32(pb, sc->interlaced ? 2 : 1); + avio_wb32(pb, 4); + avio_wb32(pb, f1); if (sc->interlaced) - put_be32(pb, f2); + avio_wb32(pb, f2); mxf_write_local_tag(pb, 8, 0x320E); - put_be32(pb, sc->aspect_ratio.num); - put_be32(pb, sc->aspect_ratio.den); + avio_wb32(pb, sc->aspect_ratio.num); + avio_wb32(pb, sc->aspect_ratio.den); mxf_write_local_tag(pb, 16, 0x3201); - put_buffer(pb, *sc->codec_ul, 16); + avio_write(pb, *sc->codec_ul, 16); } static void mxf_write_cdci_desc(AVFormatContext *s, AVStream *st) @@ -856,56 +856,56 @@ static void mxf_write_cdci_desc(AVFormatContext *s, AVStream *st) static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int profile_and_level = (st->codec->profile<<4) | st->codec->level; mxf_write_cdci_common(s, st, mxf_mpegvideo_descriptor_key, 8+5); // bit rate mxf_write_local_tag(pb, 4, 0x8000); - put_be32(pb, st->codec->bit_rate); + avio_wb32(pb, st->codec->bit_rate); // profile and level mxf_write_local_tag(pb, 1, 0x8007); if (!st->codec->profile) profile_and_level |= 0x80; // escape bit - put_byte(pb, profile_and_level); + avio_w8(pb, profile_and_level); } static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; mxf_write_generic_desc(s, st, key, size+5+12+8+8); // audio locked mxf_write_local_tag(pb, 1, 0x3D02); - put_byte(pb, 1); + avio_w8(pb, 1); // write audio sampling rate mxf_write_local_tag(pb, 8, 0x3D03); - put_be32(pb, st->codec->sample_rate); - put_be32(pb, 1); + avio_wb32(pb, st->codec->sample_rate); + avio_wb32(pb, 1); mxf_write_local_tag(pb, 4, 0x3D07); - put_be32(pb, st->codec->channels); + avio_wb32(pb, st->codec->channels); mxf_write_local_tag(pb, 4, 0x3D01); - put_be32(pb, av_get_bits_per_sample(st->codec->codec_id)); + avio_wb32(pb, av_get_bits_per_sample(st->codec->codec_id)); } static void mxf_write_wav_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; mxf_write_generic_sound_common(s, st, key, size+6+8); mxf_write_local_tag(pb, 2, 0x3D0A); - put_be16(pb, st->codec->block_align); + avio_wb16(pb, st->codec->block_align); // avg bytes per sec mxf_write_local_tag(pb, 4, 0x3D09); - put_be32(pb, st->codec->block_align*st->codec->sample_rate); + avio_wb32(pb, st->codec->block_align*st->codec->sample_rate); } static void mxf_write_wav_desc(AVFormatContext *s, AVStream *st) @@ -926,7 +926,7 @@ static void mxf_write_generic_sound_desc(AVFormatContext *s, AVStream *st) static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i, track_count = s->nb_streams+1; if (type == MaterialPackage) { @@ -952,11 +952,11 @@ static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type) // package creation date mxf_write_local_tag(pb, 8, 0x4405); - put_be64(pb, mxf->timestamp); + avio_wb64(pb, mxf->timestamp); // package modified date mxf_write_local_tag(pb, 8, 0x4404); - put_be64(pb, mxf->timestamp); + avio_wb64(pb, mxf->timestamp); // write track refs mxf_write_local_tag(pb, track_count*16 + 8, 0x4403); @@ -996,7 +996,7 @@ static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type) static int mxf_write_essence_container_data(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; mxf_write_metadata_key(pb, 0x012300); klv_encode_ber_length(pb, 72); @@ -1008,10 +1008,10 @@ static int mxf_write_essence_container_data(AVFormatContext *s) mxf_write_umid(s, 1); mxf_write_local_tag(pb, 4, 0x3F07); // BodySID - put_be32(pb, 1); + avio_wb32(pb, 1); mxf_write_local_tag(pb, 4, 0x3F06); // IndexSID - put_be32(pb, 2); + avio_wb32(pb, 2); return 0; } @@ -1039,7 +1039,7 @@ static unsigned klv_fill_size(uint64_t size) static void mxf_write_index_table_segment(AVFormatContext *s) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i, j, temporal_reordering = 0; int key_index = mxf->last_key_index; @@ -1048,7 +1048,7 @@ static void mxf_write_index_table_segment(AVFormatContext *s) if (!mxf->edit_units_count && !mxf->edit_unit_byte_count) return; - put_buffer(pb, index_table_segment_key, 16); + avio_write(pb, index_table_segment_key, 16); if (mxf->edit_unit_byte_count) { klv_encode_ber_length(pb, 80); @@ -1063,65 +1063,65 @@ static void mxf_write_index_table_segment(AVFormatContext *s) // index edit rate mxf_write_local_tag(pb, 8, 0x3F0B); - put_be32(pb, mxf->time_base.den); - put_be32(pb, mxf->time_base.num); + avio_wb32(pb, mxf->time_base.den); + avio_wb32(pb, mxf->time_base.num); // index start position mxf_write_local_tag(pb, 8, 0x3F0C); - put_be64(pb, mxf->last_indexed_edit_unit); + avio_wb64(pb, mxf->last_indexed_edit_unit); // index duration mxf_write_local_tag(pb, 8, 0x3F0D); if (mxf->edit_unit_byte_count) - put_be64(pb, 0); // index table covers whole container + avio_wb64(pb, 0); // index table covers whole container else - put_be64(pb, mxf->edit_units_count); + avio_wb64(pb, mxf->edit_units_count); // edit unit byte count mxf_write_local_tag(pb, 4, 0x3F05); - put_be32(pb, mxf->edit_unit_byte_count); + avio_wb32(pb, mxf->edit_unit_byte_count); // index sid mxf_write_local_tag(pb, 4, 0x3F06); - put_be32(pb, 2); + avio_wb32(pb, 2); // body sid mxf_write_local_tag(pb, 4, 0x3F07); - put_be32(pb, 1); + avio_wb32(pb, 1); if (!mxf->edit_unit_byte_count) { // real slice count - 1 mxf_write_local_tag(pb, 1, 0x3F08); - put_byte(pb, mxf->slice_count); + avio_w8(pb, mxf->slice_count); // delta entry array mxf_write_local_tag(pb, 8 + (s->nb_streams+1)*6, 0x3F09); - put_be32(pb, s->nb_streams+1); // num of entries - put_be32(pb, 6); // size of one entry + avio_wb32(pb, s->nb_streams+1); // num of entries + avio_wb32(pb, 6); // size of one entry // write system item delta entry - put_byte(pb, 0); - put_byte(pb, 0); // slice entry - put_be32(pb, 0); // element delta + avio_w8(pb, 0); + avio_w8(pb, 0); // slice entry + avio_wb32(pb, 0); // element delta for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MXFStreamContext *sc = st->priv_data; - put_byte(pb, sc->temporal_reordering); + avio_w8(pb, sc->temporal_reordering); if (sc->temporal_reordering) temporal_reordering = 1; if (i == 0) { // video track - put_byte(pb, 0); // slice number - put_be32(pb, KAG_SIZE); // system item size including klv fill + avio_w8(pb, 0); // slice number + avio_wb32(pb, KAG_SIZE); // system item size including klv fill } else { // audio track unsigned audio_frame_size = sc->aic.samples[0]*sc->aic.sample_size; audio_frame_size += klv_fill_size(audio_frame_size); - put_byte(pb, 1); - put_be32(pb, (i-1)*audio_frame_size); // element delta + avio_w8(pb, 1); + avio_wb32(pb, (i-1)*audio_frame_size); // element delta } } mxf_write_local_tag(pb, 8 + mxf->edit_units_count*(11+mxf->slice_count*4), 0x3F0A); - put_be32(pb, mxf->edit_units_count); // num of entries - put_be32(pb, 11+mxf->slice_count*4); // size of one entry + avio_wb32(pb, mxf->edit_units_count); // num of entries + avio_wb32(pb, 11+mxf->slice_count*4); // size of one entry for (i = 0; i < mxf->edit_units_count; i++) { int temporal_offset = 0; @@ -1143,12 +1143,12 @@ static void mxf_write_index_table_segment(AVFormatContext *s) temporal_offset = j - key_index - pic_num_in_gop; } } - put_byte(pb, temporal_offset); + avio_w8(pb, temporal_offset); if ((mxf->index_entries[i].flags & 0x30) == 0x30) { // back and forward prediction - put_byte(pb, mxf->last_key_index - i); + avio_w8(pb, mxf->last_key_index - i); } else { - put_byte(pb, key_index - i); // key frame offset + avio_w8(pb, key_index - i); // key frame offset if ((mxf->index_entries[i].flags & 0x20) == 0x20) // only forward mxf->last_key_index = key_index; } @@ -1156,11 +1156,11 @@ static void mxf_write_index_table_segment(AVFormatContext *s) if (!(mxf->index_entries[i].flags & 0x33) && // I frame mxf->index_entries[i].flags & 0x40 && !temporal_offset) mxf->index_entries[i].flags |= 0x80; // random access - put_byte(pb, mxf->index_entries[i].flags); + avio_w8(pb, mxf->index_entries[i].flags); // stream offset - put_be64(pb, mxf->index_entries[i].offset); + avio_wb64(pb, mxf->index_entries[i].offset); if (s->nb_streams > 1) - put_be32(pb, mxf->index_entries[i].slice_offset); + avio_wb32(pb, mxf->index_entries[i].slice_offset); } mxf->last_key_index = key_index - mxf->edit_units_count; @@ -1173,11 +1173,11 @@ static void mxf_write_klv_fill(AVFormatContext *s) { unsigned pad = klv_fill_size(url_ftell(s->pb)); if (pad) { - put_buffer(s->pb, klv_fill_key, 16); + avio_write(s->pb, klv_fill_key, 16); pad -= 16 + 4; klv_encode_ber4_length(s->pb, pad); for (; pad; pad--) - put_byte(s->pb, 0); + avio_w8(s->pb, 0); assert(!(url_ftell(s->pb) & (KAG_SIZE-1))); } } @@ -1187,7 +1187,7 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, const uint8_t *key, int write_metadata) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t header_byte_count_offset; unsigned index_byte_count = 0; uint64_t partition_offset = url_ftell(pb); @@ -1213,43 +1213,43 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, } // write klv - put_buffer(pb, key, 16); + avio_write(pb, key, 16); klv_encode_ber_length(pb, 88 + 16 * mxf->essence_container_count); // write partition value - put_be16(pb, 1); // majorVersion - put_be16(pb, 2); // minorVersion - put_be32(pb, KAG_SIZE); // KAGSize + avio_wb16(pb, 1); // majorVersion + avio_wb16(pb, 2); // minorVersion + avio_wb32(pb, KAG_SIZE); // KAGSize - put_be64(pb, partition_offset); // ThisPartition + avio_wb64(pb, partition_offset); // ThisPartition if (!memcmp(key, body_partition_key, 16) && mxf->body_partitions_count > 1) - put_be64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]); // PreviousPartition + avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]); // PreviousPartition else if (!memcmp(key, footer_partition_key, 16) && mxf->body_partitions_count) - put_be64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]); // PreviousPartition + avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]); // PreviousPartition else - put_be64(pb, 0); + avio_wb64(pb, 0); - put_be64(pb, mxf->footer_partition_offset); // footerPartition + avio_wb64(pb, mxf->footer_partition_offset); // footerPartition // set offset header_byte_count_offset = url_ftell(pb); - put_be64(pb, 0); // headerByteCount, update later + avio_wb64(pb, 0); // headerByteCount, update later // indexTable - put_be64(pb, index_byte_count); // indexByteCount - put_be32(pb, index_byte_count ? indexsid : 0); // indexSID + avio_wb64(pb, index_byte_count); // indexByteCount + avio_wb32(pb, index_byte_count ? indexsid : 0); // indexSID // BodyOffset if (bodysid && mxf->edit_units_count && mxf->body_partitions_count) { - put_be64(pb, mxf->body_offset); + avio_wb64(pb, mxf->body_offset); } else - put_be64(pb, 0); + avio_wb64(pb, 0); - put_be32(pb, bodysid); // bodySID + avio_wb32(pb, bodysid); // bodySID // operational pattern - put_buffer(pb, op1a_ul, 16); + avio_write(pb, op1a_ul, 16); // essence container mxf_write_essence_container_refs(s); @@ -1267,9 +1267,9 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, header_byte_count = pos - start + klv_fill_size(pos); // update header_byte_count - url_fseek(pb, header_byte_count_offset, SEEK_SET); - put_be64(pb, header_byte_count); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, header_byte_count_offset, SEEK_SET); + avio_wb64(pb, header_byte_count); + avio_seek(pb, pos, SEEK_SET); } put_flush_packet(pb); @@ -1557,48 +1557,48 @@ static uint32_t ff_framenum_to_12m_time_code(unsigned frame, int drop, int fps) static void mxf_write_system_item(AVFormatContext *s) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned frame; uint32_t time_code; frame = mxf->timecode_start + mxf->last_indexed_edit_unit + mxf->edit_units_count; // write system metadata pack - put_buffer(pb, system_metadata_pack_key, 16); + avio_write(pb, system_metadata_pack_key, 16); klv_encode_ber4_length(pb, 57); - put_byte(pb, 0x5c); // UL, user date/time stamp, picture and sound item present - put_byte(pb, 0x04); // content package rate - put_byte(pb, 0x00); // content package type - put_be16(pb, 0x00); // channel handle - put_be16(pb, frame); // continuity count + avio_w8(pb, 0x5c); // UL, user date/time stamp, picture and sound item present + avio_w8(pb, 0x04); // content package rate + avio_w8(pb, 0x00); // content package type + avio_wb16(pb, 0x00); // channel handle + avio_wb16(pb, frame); // continuity count if (mxf->essence_container_count > 1) - put_buffer(pb, multiple_desc_ul, 16); + avio_write(pb, multiple_desc_ul, 16); else { MXFStreamContext *sc = s->streams[0]->priv_data; - put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16); + avio_write(pb, mxf_essence_container_uls[sc->index].container_ul, 16); } - put_byte(pb, 0); - put_be64(pb, 0); - put_be64(pb, 0); // creation date/time stamp + avio_w8(pb, 0); + avio_wb64(pb, 0); + avio_wb64(pb, 0); // creation date/time stamp - put_byte(pb, 0x81); // SMPTE 12M time code + avio_w8(pb, 0x81); // SMPTE 12M time code time_code = ff_framenum_to_12m_time_code(frame, mxf->timecode_drop_frame, mxf->timecode_base); - put_be32(pb, time_code); - put_be32(pb, 0); // binary group data - put_be64(pb, 0); + avio_wb32(pb, time_code); + avio_wb32(pb, 0); // binary group data + avio_wb64(pb, 0); // write system metadata package set - put_buffer(pb, system_metadata_package_set_key, 16); + avio_write(pb, system_metadata_package_set_key, 16); klv_encode_ber4_length(pb, 35); - put_byte(pb, 0x83); // UMID - put_be16(pb, 0x20); + avio_w8(pb, 0x83); // UMID + avio_wb16(pb, 0x20); mxf_write_umid(s, 1); } static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int packet_size = (uint64_t)st->codec->bit_rate*mxf->time_base.num / (8*mxf->time_base.den); // frame size int pad; @@ -1607,28 +1607,28 @@ static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacke packet_size += klv_fill_size(packet_size); klv_encode_ber4_length(pb, pkt->size); - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); // ensure CBR muxing by padding to correct video frame size pad = packet_size - pkt->size - 16 - 4; if (pad > 20) { - put_buffer(s->pb, klv_fill_key, 16); + avio_write(s->pb, klv_fill_key, 16); pad -= 16 + 4; klv_encode_ber4_length(s->pb, pad); for (; pad; pad--) - put_byte(s->pb, 0); + avio_w8(s->pb, 0); assert(!(url_ftell(s->pb) & (KAG_SIZE-1))); } else { av_log(s, AV_LOG_WARNING, "cannot fill d-10 video packet\n"); for (; pad > 0; pad--) - put_byte(s->pb, 0); + avio_w8(s->pb, 0); } } static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int frame_size = pkt->size / st->codec->block_align; uint8_t *samples = pkt->data; uint8_t *end = pkt->data + pkt->size; @@ -1636,9 +1636,9 @@ static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacke klv_encode_ber4_length(pb, 4 + frame_size*4*8); - put_byte(pb, (frame_size == 1920 ? 0 : (mxf->edit_units_count-1) % 5 + 1)); - put_le16(pb, frame_size); - put_byte(pb, (1<codec->channels)-1); + avio_w8(pb, (frame_size == 1920 ? 0 : (mxf->edit_units_count-1) % 5 + 1)); + avio_wl16(pb, frame_size); + avio_w8(pb, (1<codec->channels)-1); while (samples < end) { for (i = 0; i < st->codec->channels; i++) { @@ -1650,17 +1650,17 @@ static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacke sample = AV_RL16(samples)<<12; samples += 2; } - put_le32(pb, sample | i); + avio_wl32(pb, sample | i); } for (; i < 8; i++) - put_le32(pb, i); + avio_wl32(pb, i); } } static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = s->streams[pkt->stream_index]; MXFStreamContext *sc = st->priv_data; MXFIndexEntry ie = {0}; @@ -1719,7 +1719,7 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) } mxf_write_klv_fill(s); - put_buffer(pb, sc->track_essence_element_key, 16); // write key + avio_write(pb, sc->track_essence_element_key, 16); // write key if (s->oformat == &ff_mxf_d10_muxer) { if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) mxf_write_d10_video_packet(s, st, pkt); @@ -1727,7 +1727,7 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) mxf_write_d10_audio_packet(s, st, pkt); } else { klv_encode_ber4_length(pb, pkt->size); // write length - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); mxf->body_offset += 16+4+pkt->size + klv_fill_size(16+4+pkt->size); } @@ -1739,34 +1739,34 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) static void mxf_write_random_index_pack(AVFormatContext *s) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint64_t pos = url_ftell(pb); int i; - put_buffer(pb, random_index_pack_key, 16); + avio_write(pb, random_index_pack_key, 16); klv_encode_ber_length(pb, 28 + 12*mxf->body_partitions_count); if (mxf->edit_unit_byte_count) - put_be32(pb, 1); // BodySID of header partition + avio_wb32(pb, 1); // BodySID of header partition else - put_be32(pb, 0); - put_be64(pb, 0); // offset of header partition + avio_wb32(pb, 0); + avio_wb64(pb, 0); // offset of header partition for (i = 0; i < mxf->body_partitions_count; i++) { - put_be32(pb, 1); // BodySID - put_be64(pb, mxf->body_partition_offset[i]); + avio_wb32(pb, 1); // BodySID + avio_wb64(pb, mxf->body_partition_offset[i]); } - put_be32(pb, 0); // BodySID of footer partition - put_be64(pb, mxf->footer_partition_offset); + avio_wb32(pb, 0); // BodySID of footer partition + avio_wb64(pb, mxf->footer_partition_offset); - put_be32(pb, url_ftell(pb) - pos + 4); + avio_wb32(pb, url_ftell(pb) - pos + 4); } static int mxf_write_footer(AVFormatContext *s) { MXFContext *mxf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; mxf->duration = mxf->last_indexed_edit_unit + mxf->edit_units_count; @@ -1785,7 +1785,7 @@ static int mxf_write_footer(AVFormatContext *s) mxf_write_random_index_pack(s); if (!url_is_streamed(s->pb)) { - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); if (mxf->edit_unit_byte_count) { mxf_write_partition(s, 1, 2, header_closed_partition_key, 1); mxf_write_klv_fill(s); diff --git a/mplayer/ffmpeg/libavformat/mxg.c b/mplayer/ffmpeg/libavformat/mxg.c index 9be97d0d..81ffec69 100644 --- a/mplayer/ffmpeg/libavformat/mxg.c +++ b/mplayer/ffmpeg/libavformat/mxg.c @@ -115,7 +115,7 @@ static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size) if (mxg->soi_ptr) mxg->soi_ptr = mxg->buffer + soi_pos; /* get data */ - ret = get_buffer(s->pb, mxg->buffer_ptr + mxg->cache_size, + ret = avio_read(s->pb, mxg->buffer_ptr + mxg->cache_size, cache_size - mxg->cache_size); if (ret < 0) return ret; diff --git a/mplayer/ffmpeg/libavformat/ncdec.c b/mplayer/ffmpeg/libavformat/ncdec.c index 1472d15c..79a4dbaf 100644 --- a/mplayer/ffmpeg/libavformat/ncdec.c +++ b/mplayer/ffmpeg/libavformat/ncdec.c @@ -68,12 +68,12 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt) while (state != NC_VIDEO_FLAG) { if (url_feof(s->pb)) return AVERROR(EIO); - state = (state<<8) + get_byte(s->pb); + state = (state<<8) + avio_r8(s->pb); } - get_byte(s->pb); - size = get_le16(s->pb); - url_fskip(s->pb, 9); + avio_r8(s->pb); + size = avio_rl16(s->pb); + avio_seek(s->pb, 9, SEEK_CUR); if (size == 0) { av_log(s, AV_LOG_DEBUG, "Next packet size is zero\n"); diff --git a/mplayer/ffmpeg/libavformat/network.h b/mplayer/ffmpeg/libavformat/network.h index eda6a8ef..1e80f1d2 100644 --- a/mplayer/ffmpeg/libavformat/network.h +++ b/mplayer/ffmpeg/libavformat/network.h @@ -27,31 +27,60 @@ #include #include -#define ff_neterrno() (-WSAGetLastError()) -#define FF_NETERROR(err) (-WSA##err) -#define WSAEAGAIN WSAEWOULDBLOCK +#define EPROTONOSUPPORT WSAEPROTONOSUPPORT +#define ETIMEDOUT WSAETIMEDOUT +#define ECONNREFUSED WSAECONNREFUSED +#define EINPROGRESS WSAEINPROGRESS + +static inline int ff_neterrno() { + int err = WSAGetLastError(); + switch (err) { + case WSAEWOULDBLOCK: + return AVERROR(EAGAIN); + case WSAEINTR: + return AVERROR(EINTR); + } + return -err; +} #else -#ifndef GEKKO #include +#if !defined(GEKKO) #include #include #include #else #include -#define INADDR_LOOPBACK ((unsigned long) 0x7f000001) /* 127.0.0.1 */ -#define send net_send -#define sendto net_sendto -#define recv net_recv -#define select net_select -#define socket net_socket -#define gethostbyname net_gethostbyname -#define setsockopt net_setsockopt -#define bind net_bind -#define connect net_connect + +#define INADDR_LOOPBACK 0x7f000001 + +static inline int _net_result(s32 ret) +{ + if (ret < 0) errno = AVUNERROR(ret); + return ret < 0 ? SOCKET_ERROR : ret; +} + +#define socket(domain, type, protocol) \ + _net_result(net_socket(domain, type, IPPROTO_IP)) +#define bind(sockfd, my_addr, addrlen) \ + _net_result(net_bind(sockfd, my_addr, addrlen)) +#define connect(sockfd, serv_addr, addrlen) \ + _net_result(net_connect(sockfd, serv_addr, addrlen)) +#define send(s, buf, len, flags) \ + _net_result(net_send(s, buf, len, flags)) +#define sendto(s, buf, len, flags, to, tolen) \ + _net_result(net_sendto(s, buf, len, flags, to, tolen)) +#define recv(s, buf, len, flags) \ + _net_result(net_recv(s, buf, len, flags)) +#define closesocket(sockfd) \ + _net_result(net_close(sockfd)) +#define setsockopt(s, level, optname, optval, optlen) \ + _net_result(net_setsockopt(s, level, optname, optval, optlen)) +#define poll(fds, nfds, timeout) \ + _net_result(net_poll((struct pollsd *)fds, nfds, timeout)) +#define gethostbyname(name) net_gethostbyname(name) #endif #define ff_neterrno() AVERROR(errno) -#define FF_NETERROR(err) AVERROR(err) #endif #if HAVE_ARPA_INET_H diff --git a/mplayer/ffmpeg/libavformat/nsvdec.c b/mplayer/ffmpeg/libavformat/nsvdec.c index e15d6e28..cc0c5d7c 100644 --- a/mplayer/ffmpeg/libavformat/nsvdec.c +++ b/mplayer/ffmpeg/libavformat/nsvdec.c @@ -81,12 +81,6 @@ * - seek */ -#ifdef DEBUG -#define PRINT(_v) printf _v -#else -#define PRINT(_v) -#endif - #if 0 struct NSVf_header { uint32_t chunk_tag; /* 'NSVf' */ @@ -216,102 +210,96 @@ static const AVCodecTag nsv_codec_audio_tags[] = { //static int nsv_load_index(AVFormatContext *s); static int nsv_read_chunk(AVFormatContext *s, int fill_header); -#ifdef DEBUG -static void print_tag(const char *str, unsigned int tag, int size) -{ - printf("%s: tag=%c%c%c%c\n", - str, tag & 0xff, - (tag >> 8) & 0xff, - (tag >> 16) & 0xff, - (tag >> 24) & 0xff); -} -#endif +#define print_tag(str, tag, size) \ + av_dlog(NULL, "%s: tag=%c%c%c%c\n", \ + str, tag & 0xff, \ + (tag >> 8) & 0xff, \ + (tag >> 16) & 0xff, \ + (tag >> 24) & 0xff); /* try to find something we recognize, and set the state accordingly */ static int nsv_resync(AVFormatContext *s) { NSVContext *nsv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint32_t v = 0; int i; - PRINT(("%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, url_ftell(pb), nsv->state)); + av_dlog(s, "%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, url_ftell(pb), nsv->state); //nsv->state = NSV_UNSYNC; for (i = 0; i < NSV_MAX_RESYNC; i++) { if (url_feof(pb)) { - PRINT(("NSV EOF\n")); + av_dlog(s, "NSV EOF\n"); nsv->state = NSV_UNSYNC; return -1; } v <<= 8; - v |= get_byte(pb); -/* + v |= avio_r8(pb); if (i < 8) { - PRINT(("NSV resync: [%d] = %02x\n", i, v & 0x0FF)); + av_dlog(s, "NSV resync: [%d] = %02x\n", i, v & 0x0FF); } -*/ if ((v & 0x0000ffff) == 0xefbe) { /* BEEF */ - PRINT(("NSV resynced on BEEF after %d bytes\n", i+1)); + av_dlog(s, "NSV resynced on BEEF after %d bytes\n", i+1); nsv->state = NSV_FOUND_BEEF; return 0; } /* we read as big endian, thus the MK*BE* */ if (v == TB_NSVF) { /* NSVf */ - PRINT(("NSV resynced on NSVf after %d bytes\n", i+1)); + av_dlog(s, "NSV resynced on NSVf after %d bytes\n", i+1); nsv->state = NSV_FOUND_NSVF; return 0; } if (v == MKBETAG('N', 'S', 'V', 's')) { /* NSVs */ - PRINT(("NSV resynced on NSVs after %d bytes\n", i+1)); + av_dlog(s, "NSV resynced on NSVs after %d bytes\n", i+1); nsv->state = NSV_FOUND_NSVS; return 0; } } - PRINT(("NSV sync lost\n")); + av_dlog(s, "NSV sync lost\n"); return -1; } static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) { NSVContext *nsv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int file_size, size; int64_t duration; int strings_size; int table_entries; int table_entries_used; - PRINT(("%s()\n", __FUNCTION__)); + av_dlog(s, "%s()\n", __FUNCTION__); nsv->state = NSV_UNSYNC; /* in case we fail */ - size = get_le32(pb); + size = avio_rl32(pb); if (size < 28) return -1; nsv->NSVf_end = size; - //s->file_size = (uint32_t)get_le32(pb); - file_size = (uint32_t)get_le32(pb); - PRINT(("NSV NSVf chunk_size %u\n", size)); - PRINT(("NSV NSVf file_size %u\n", file_size)); + //s->file_size = (uint32_t)avio_rl32(pb); + file_size = (uint32_t)avio_rl32(pb); + av_dlog(s, "NSV NSVf chunk_size %u\n", size); + av_dlog(s, "NSV NSVf file_size %u\n", file_size); - nsv->duration = duration = get_le32(pb); /* in ms */ - PRINT(("NSV NSVf duration %"PRId64" ms\n", duration)); + nsv->duration = duration = avio_rl32(pb); /* in ms */ + av_dlog(s, "NSV NSVf duration %"PRId64" ms\n", duration); // XXX: store it in AVStreams - strings_size = get_le32(pb); - table_entries = get_le32(pb); - table_entries_used = get_le32(pb); - PRINT(("NSV NSVf info-strings size: %d, table entries: %d, bis %d\n", - strings_size, table_entries, table_entries_used)); + strings_size = avio_rl32(pb); + table_entries = avio_rl32(pb); + table_entries_used = avio_rl32(pb); + av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n", + strings_size, table_entries, table_entries_used); if (url_feof(pb)) return -1; - PRINT(("NSV got header; filepos %"PRId64"\n", url_ftell(pb))); + av_dlog(s, "NSV got header; filepos %"PRId64"\n", url_ftell(pb)); if (strings_size > 0) { char *strings; /* last byte will be '\0' to play safe with str*() */ @@ -321,7 +309,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) p = strings = av_mallocz(strings_size + 1); endp = strings + strings_size; - get_buffer(pb, strings, strings_size); + avio_read(pb, strings, strings_size); while (p < endp) { while (*p == ' ') p++; /* strip out spaces */ @@ -338,7 +326,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) if (!p || p >= endp) break; *p++ = '\0'; - PRINT(("NSV NSVf INFO: %s='%s'\n", token, value)); + av_dlog(s, "NSV NSVf INFO: %s='%s'\n", token, value); av_metadata_set2(&s->metadata, token, value, 0); } av_free(strings); @@ -346,7 +334,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) if (url_feof(pb)) return -1; - PRINT(("NSV got infos; filepos %"PRId64"\n", url_ftell(pb))); + av_dlog(s, "NSV got infos; filepos %"PRId64"\n", url_ftell(pb)); if (table_entries_used > 0) { int i; @@ -356,39 +344,39 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) nsv->nsvs_file_offset = av_malloc((unsigned)table_entries_used * sizeof(uint32_t)); for(i=0;insvs_file_offset[i] = get_le32(pb) + size; + nsv->nsvs_file_offset[i] = avio_rl32(pb) + size; if(table_entries > table_entries_used && - get_le32(pb) == MKTAG('T','O','C','2')) { + avio_rl32(pb) == MKTAG('T','O','C','2')) { nsv->nsvs_timestamps = av_malloc((unsigned)table_entries_used*sizeof(uint32_t)); for(i=0;insvs_timestamps[i] = get_le32(pb); + nsv->nsvs_timestamps[i] = avio_rl32(pb); } } } - PRINT(("NSV got index; filepos %"PRId64"\n", url_ftell(pb))); + av_dlog(s, "NSV got index; filepos %"PRId64"\n", url_ftell(pb)); #ifdef DEBUG_DUMP_INDEX #define V(v) ((v<0x20 || v > 127)?'.':v) /* dump index */ - PRINT(("NSV %d INDEX ENTRIES:\n", table_entries)); - PRINT(("NSV [dataoffset][fileoffset]\n", table_entries)); + av_dlog(s, "NSV %d INDEX ENTRIES:\n", table_entries); + av_dlog(s, "NSV [dataoffset][fileoffset]\n", table_entries); for (i = 0; i < table_entries; i++) { unsigned char b[8]; - url_fseek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET); - get_buffer(pb, b, 8); - PRINT(("NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x" + avio_seek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET); + avio_read(pb, b, 8); + av_dlog(s, "NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x" "%c%c%c%c%c%c%c%c\n", nsv->nsvs_file_offset[i], size + nsv->nsvs_file_offset[i], b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], - V(b[0]), V(b[1]), V(b[2]), V(b[3]), V(b[4]), V(b[5]), V(b[6]), V(b[7]) )); + V(b[0]), V(b[1]), V(b[2]), V(b[3]), V(b[4]), V(b[5]), V(b[6]), V(b[7]) ); } - //url_fseek(pb, size, SEEK_SET); /* go back to end of header */ + //avio_seek(pb, size, SEEK_SET); /* go back to end of header */ #undef V #endif - url_fseek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */ + avio_seek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */ if (url_feof(pb)) return -1; @@ -399,22 +387,22 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) { NSVContext *nsv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint32_t vtag, atag; uint16_t vwidth, vheight; AVRational framerate; int i; AVStream *st; NSVStream *nst; - PRINT(("%s()\n", __FUNCTION__)); + av_dlog(s, "%s()\n", __FUNCTION__); - vtag = get_le32(pb); - atag = get_le32(pb); - vwidth = get_le16(pb); - vheight = get_le16(pb); - i = get_byte(pb); + vtag = avio_rl32(pb); + atag = avio_rl32(pb); + vwidth = avio_rl16(pb); + vheight = avio_rl16(pb); + i = avio_r8(pb); - PRINT(("NSV NSVs framerate code %2x\n", i)); + av_dlog(s, "NSV NSVs framerate code %2x\n", i); if(i&0x80) { /* odd way of giving native framerates from docs */ int t=(i & 0x7F)>>2; if(t<16) framerate = (AVRational){1, t+1}; @@ -432,13 +420,12 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) else framerate= (AVRational){i, 1}; - nsv->avsync = get_le16(pb); + nsv->avsync = avio_rl16(pb); nsv->framerate = framerate; -#ifdef DEBUG + print_tag("NSV NSVs vtag", vtag, 0); print_tag("NSV NSVs atag", atag, 0); - PRINT(("NSV NSVs vsize %dx%d\n", vwidth, vheight)); -#endif + av_dlog(s, "NSV NSVs vsize %dx%d\n", vwidth, vheight); /* XXX change to ap != NULL ? */ if (s->nb_streams == 0) { /* streams not yet published, let's do that */ @@ -502,7 +489,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) #ifdef CHECK_SUBSEQUENT_NSVS } else { if (nsv->vtag != vtag || nsv->atag != atag || nsv->vwidth != vwidth || nsv->vheight != vwidth) { - PRINT(("NSV NSVs header values differ from the first one!!!\n")); + av_dlog(s, "NSV NSVs header values differ from the first one!!!\n"); //return -1; } #endif /* CHECK_SUBSEQUENT_NSVS */ @@ -521,8 +508,8 @@ static int nsv_read_header(AVFormatContext *s, AVFormatParameters *ap) NSVContext *nsv = s->priv_data; int i, err; - PRINT(("%s()\n", __FUNCTION__)); - PRINT(("filename '%s'\n", s->filename)); + av_dlog(s, "%s()\n", __FUNCTION__); + av_dlog(s, "filename '%s'\n", s->filename); nsv->state = NSV_UNSYNC; nsv->ahead[0].data = nsv->ahead[1].data = NULL; @@ -543,14 +530,14 @@ static int nsv_read_header(AVFormatContext *s, AVFormatParameters *ap) /* now read the first chunk, so we can attempt to decode more info */ err = nsv_read_chunk(s, 1); - PRINT(("parsed header\n")); + av_dlog(s, "parsed header\n"); return 0; } static int nsv_read_chunk(AVFormatContext *s, int fill_header) { NSVContext *nsv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st[2] = {NULL, NULL}; NSVStream *nst; AVPacket *pkt; @@ -561,7 +548,7 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header) uint16_t auxsize; uint32_t auxtag; - PRINT(("%s(%d)\n", __FUNCTION__, fill_header)); + av_dlog(s, "%s(%d)\n", __FUNCTION__, fill_header); if (nsv->ahead[0].data || nsv->ahead[1].data) return 0; //-1; /* hey! eat what you've in your plate first! */ @@ -581,23 +568,23 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header) if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF) return -1; - auxcount = get_byte(pb); - vsize = get_le16(pb); - asize = get_le16(pb); + auxcount = avio_r8(pb); + vsize = avio_rl16(pb); + asize = avio_rl16(pb); vsize = (vsize << 4) | (auxcount >> 4); auxcount &= 0x0f; - PRINT(("NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize)); + av_dlog(s, "NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize); /* skip aux stuff */ for (i = 0; i < auxcount; i++) { - auxsize = get_le16(pb); - auxtag = get_le32(pb); - PRINT(("NSV aux data: '%c%c%c%c', %d bytes\n", + auxsize = avio_rl16(pb); + auxtag = avio_rl32(pb); + av_dlog(s, "NSV aux data: '%c%c%c%c', %d bytes\n", (auxtag & 0x0ff), ((auxtag >> 8) & 0x0ff), ((auxtag >> 16) & 0x0ff), ((auxtag >> 24) & 0x0ff), - auxsize)); - url_fskip(pb, auxsize); + auxsize); + avio_seek(pb, auxsize, SEEK_CUR); vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming braindead */ } @@ -621,10 +608,8 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header) pkt->stream_index = st[NSV_ST_VIDEO]->index;//NSV_ST_VIDEO; pkt->dts = nst->frame_offset; pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */ -/* - for (i = 0; i < MIN(8, vsize); i++) - PRINT(("NSV video: [%d] = %02x\n", i, pkt->data[i])); -*/ + for (i = 0; i < FFMIN(8, vsize); i++) + av_dlog(s, "NSV video: [%d] = %02x\n", i, pkt->data[i]); } if(st[NSV_ST_VIDEO]) ((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset++; @@ -638,15 +623,15 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header) uint8_t bps; uint8_t channels; uint16_t samplerate; - bps = get_byte(pb); - channels = get_byte(pb); - samplerate = get_le16(pb); + bps = avio_r8(pb); + channels = avio_r8(pb); + samplerate = avio_rl16(pb); asize-=4; - PRINT(("NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate)); + av_dlog(s, "NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate); if (fill_header) { st[NSV_ST_AUDIO]->need_parsing = AVSTREAM_PARSE_NONE; /* we know everything */ if (bps != 16) { - PRINT(("NSV AUDIO bit/sample != 16 (%d)!!!\n", bps)); + av_dlog(s, "NSV AUDIO bit/sample != 16 (%d)!!!\n", bps); } bps /= channels; // ??? if (bps == 8) @@ -655,7 +640,7 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header) channels = 1; st[NSV_ST_AUDIO]->codec->channels = channels; st[NSV_ST_AUDIO]->codec->sample_rate = samplerate; - PRINT(("NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate)); + av_dlog(s, "NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate); } } av_get_packet(pb, pkt, asize); @@ -666,7 +651,7 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header) pkt->dts = (((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset-1); pkt->dts *= (int64_t)1000 * nsv->framerate.den; pkt->dts += (int64_t)nsv->avsync * nsv->framerate.num; - PRINT(("NSV AUDIO: sync:%d, dts:%"PRId64, nsv->avsync, pkt->dts)); + av_dlog(s, "NSV AUDIO: sync:%d, dts:%"PRId64, nsv->avsync, pkt->dts); } nst->frame_offset++; } @@ -681,7 +666,7 @@ static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt) NSVContext *nsv = s->priv_data; int i, err = 0; - PRINT(("%s()\n", __FUNCTION__)); + av_dlog(s, "%s()\n", __FUNCTION__); /* in case we don't already have something to eat ... */ if (nsv->ahead[0].data == NULL && nsv->ahead[1].data == NULL) @@ -692,7 +677,7 @@ static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt) /* now pick one of the plates */ for (i = 0; i < 2; i++) { if (nsv->ahead[i].data) { - PRINT(("%s: using cached packet[%d]\n", __FUNCTION__, i)); + av_dlog(s, "%s: using cached packet[%d]\n", __FUNCTION__, i); /* avoid the cost of new_packet + memcpy(->data) */ memcpy(pkt, &nsv->ahead[i], sizeof(AVPacket)); nsv->ahead[i].data = NULL; /* we ate that one */ @@ -715,7 +700,7 @@ static int nsv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp if(index < 0) return -1; - url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); nst->frame_offset = st->index_entries[index].timestamp; nsv->state = NSV_UNSYNC; return 0; @@ -752,7 +737,7 @@ static int nsv_read_close(AVFormatContext *s) static int nsv_probe(AVProbeData *p) { int i; -// PRINT(("nsv_probe(), buf_size %d\n", p->buf_size)); + av_dlog(NULL, "nsv_probe(), buf_size %d\n", p->buf_size); /* check file header */ /* streamed files might not have any header */ if (p->buf[0] == 'N' && p->buf[1] == 'S' && diff --git a/mplayer/ffmpeg/libavformat/nutdec.c b/mplayer/ffmpeg/libavformat/nutdec.c index 6ca6be83..57e77586 100644 --- a/mplayer/ffmpeg/libavformat/nutdec.c +++ b/mplayer/ffmpeg/libavformat/nutdec.c @@ -37,13 +37,13 @@ #define NUT_MAX_STREAMS 256 /* arbitrary sanity check value */ #endif -static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){ +static int get_str(AVIOContext *bc, char *string, unsigned int maxlen){ unsigned int len= ff_get_v(bc); if(len && maxlen) - get_buffer(bc, string, FFMIN(len, maxlen)); + avio_read(bc, string, FFMIN(len, maxlen)); while(len > maxlen){ - get_byte(bc); + avio_r8(bc); len--; } @@ -56,37 +56,37 @@ static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){ return 0; } -static int64_t get_s(ByteIOContext *bc){ +static int64_t get_s(AVIOContext *bc){ int64_t v = ff_get_v(bc) + 1; if (v&1) return -(v>>1); else return (v>>1); } -static uint64_t get_fourcc(ByteIOContext *bc){ +static uint64_t get_fourcc(AVIOContext *bc){ unsigned int len= ff_get_v(bc); - if (len==2) return get_le16(bc); - else if(len==4) return get_le32(bc); + if (len==2) return avio_rl16(bc); + else if(len==4) return avio_rl32(bc); else return -1; } #ifdef TRACE -static inline uint64_t get_v_trace(ByteIOContext *bc, char *file, char *func, int line){ +static inline uint64_t get_v_trace(AVIOContext *bc, char *file, char *func, int line){ uint64_t v= ff_get_v(bc); av_log(NULL, AV_LOG_DEBUG, "get_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); return v; } -static inline int64_t get_s_trace(ByteIOContext *bc, char *file, char *func, int line){ +static inline int64_t get_s_trace(AVIOContext *bc, char *file, char *func, int line){ int64_t v= get_s(bc); av_log(NULL, AV_LOG_DEBUG, "get_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); return v; } -static inline uint64_t get_vb_trace(ByteIOContext *bc, char *file, char *func, int line){ +static inline uint64_t get_vb_trace(AVIOContext *bc, char *file, char *func, int line){ uint64_t v= get_vb(bc); av_log(NULL, AV_LOG_DEBUG, "get_vb %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); @@ -97,7 +97,7 @@ static inline uint64_t get_vb_trace(ByteIOContext *bc, char *file, char *func, i #define get_vb(bc) get_vb_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__) #endif -static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_checksum, uint64_t startcode) +static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_checksum, uint64_t startcode) { int64_t size; // start= url_ftell(bc) - 8; @@ -108,7 +108,7 @@ static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_ch init_checksum(bc, ff_crc04C11DB7_update, startcode); size= ff_get_v(bc); if(size > 4096) - get_be32(bc); + avio_rb32(bc); if(get_checksum(bc) && size > 4096) return -1; @@ -117,14 +117,14 @@ static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_ch return size; } -static uint64_t find_any_startcode(ByteIOContext *bc, int64_t pos){ +static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){ uint64_t state=0; if(pos >= 0) - url_fseek(bc, pos, SEEK_SET); //note, this may fail if the stream is not seekable, but that should not matter, as in this case we simply start where we currently are + avio_seek(bc, pos, SEEK_SET); //note, this may fail if the stream is not seekable, but that should not matter, as in this case we simply start where we currently are while(!url_feof(bc)){ - state= (state<<8) | get_byte(bc); + state= (state<<8) | avio_r8(bc); if((state>>56) != 'N') continue; switch(state){ @@ -146,7 +146,7 @@ static uint64_t find_any_startcode(ByteIOContext *bc, int64_t pos){ * @param pos the start position of the search, or -1 if the current position * @return the position of the startcode or -1 if not found */ -static int64_t find_startcode(ByteIOContext *bc, uint64_t code, int64_t pos){ +static int64_t find_startcode(AVIOContext *bc, uint64_t code, int64_t pos){ for(;;){ uint64_t startcode= find_any_startcode(bc, pos); if(startcode == code) @@ -177,21 +177,21 @@ static int nut_probe(AVProbeData *p){ }\ dst= tmp; -static int skip_reserved(ByteIOContext *bc, int64_t pos){ +static int skip_reserved(AVIOContext *bc, int64_t pos){ pos -= url_ftell(bc); if(pos<0){ - url_fseek(bc, pos, SEEK_CUR); + avio_seek(bc, pos, SEEK_CUR); return -1; }else{ while(pos--) - get_byte(bc); + avio_r8(bc); return 0; } } static int decode_main_header(NUTContext *nut){ AVFormatContext *s= nut->avf; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; uint64_t tmp, end; unsigned int stream_count; int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res, tmp_head_idx; @@ -281,7 +281,7 @@ static int decode_main_header(NUTContext *nut){ return AVERROR_INVALIDDATA; } nut->header[i]= av_malloc(nut->header_len[i]); - get_buffer(bc, nut->header[i], nut->header_len[i]); + avio_read(bc, nut->header[i], nut->header_len[i]); } assert(nut->header_len[0]==0); } @@ -301,7 +301,7 @@ static int decode_main_header(NUTContext *nut){ static int decode_stream_header(NUTContext *nut){ AVFormatContext *s= nut->avf; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; StreamContext *stc; int class, stream_id; uint64_t tmp, end; @@ -357,7 +357,7 @@ static int decode_stream_header(NUTContext *nut){ GET_V(st->codec->extradata_size, tmp < (1<<30)); if(st->codec->extradata_size){ st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(bc, st->codec->extradata, st->codec->extradata_size); + avio_read(bc, st->codec->extradata, st->codec->extradata_size); } if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO){ @@ -399,7 +399,7 @@ static void set_disposition_bits(AVFormatContext* avf, char* value, int stream_i static int decode_info_header(NUTContext *nut){ AVFormatContext *s= nut->avf; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; uint64_t tmp, chapter_start, chapter_len; unsigned int stream_id_plus1, count; int chapter_id, i; @@ -479,7 +479,7 @@ static int decode_info_header(NUTContext *nut){ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){ AVFormatContext *s= nut->avf; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; int64_t end, tmp; nut->last_syncpoint_pos= url_ftell(bc)-8; @@ -507,7 +507,7 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){ static int find_and_decode_index(NUTContext *nut){ AVFormatContext *s= nut->avf; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; uint64_t tmp, end; int i, j, syncpoint_count; int64_t filesize= url_fsize(bc); @@ -515,9 +515,9 @@ static int find_and_decode_index(NUTContext *nut){ int8_t *has_keyframe; int ret= -1; - url_fseek(bc, filesize-12, SEEK_SET); - url_fseek(bc, filesize-get_be64(bc), SEEK_SET); - if(get_be64(bc) != INDEX_STARTCODE){ + avio_seek(bc, filesize-12, SEEK_SET); + avio_seek(bc, filesize-avio_rb64(bc), SEEK_SET); + if(avio_rb64(bc) != INDEX_STARTCODE){ av_log(s, AV_LOG_ERROR, "no index at the end\n"); return -1; } @@ -605,7 +605,7 @@ static int find_and_decode_index(NUTContext *nut){ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap) { NUTContext *nut = s->priv_data; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; int64_t pos; int initialized_stream_count; @@ -657,7 +657,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap) if(!url_is_streamed(bc)){ int64_t orig_pos= url_ftell(bc); find_and_decode_index(nut); - url_fseek(bc, orig_pos, SEEK_SET); + avio_seek(bc, orig_pos, SEEK_SET); } assert(nut->next_startcode == SYNCPOINT_STARTCODE); @@ -668,7 +668,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap) static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, uint8_t *header_idx, int frame_code){ AVFormatContext *s= nut->avf; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; StreamContext *stc; int size, flags, size_mul, pts_delta, i, reserved_count; uint64_t tmp; @@ -724,7 +724,7 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui size -= nut->header_len[*header_idx]; if(flags&FLAG_CHECKSUM){ - get_be32(bc); //FIXME check this + avio_rb32(bc); //FIXME check this }else if(size > 2*nut->max_distance || FFABS(stc->last_pts - *pts) > stc->max_pts_distance){ av_log(s, AV_LOG_ERROR, "frame size > 2max_distance and no checksum\n"); return AVERROR_INVALIDDATA; @@ -738,7 +738,7 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ AVFormatContext *s= nut->avf; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; int size, stream_id, discard; int64_t pts, last_IP_pts; StreamContext *stc; @@ -759,14 +759,14 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts) || discard >= AVDISCARD_ALL || stc->skip_until_key_frame){ - url_fskip(bc, size); + avio_seek(bc, size, SEEK_CUR); return 1; } av_new_packet(pkt, size + nut->header_len[header_idx]); memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]); pkt->pos= url_ftell(bc); //FIXME - get_buffer(bc, pkt->data + nut->header_len[header_idx], size); + avio_read(bc, pkt->data + nut->header_len[header_idx], size); pkt->stream_index = stream_id; if (stc->last_flags & FLAG_KEY) @@ -779,7 +779,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) { NUTContext *nut = s->priv_data; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; int i, frame_code=0, ret, skip; int64_t ts, back_ptr; @@ -791,13 +791,13 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) if(tmp){ pos-=8; }else{ - frame_code = get_byte(bc); + frame_code = avio_r8(bc); if(url_feof(bc)) return -1; if(frame_code == 'N'){ tmp= frame_code; for(i=1; i<8; i++) - tmp = (tmp<<8) + get_byte(bc); + tmp = (tmp<<8) + avio_r8(bc); } } switch(tmp){ @@ -805,7 +805,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) case STREAM_STARTCODE: case INDEX_STARTCODE: skip= get_packetheader(nut, bc, 0, tmp); - url_fseek(bc, skip, SEEK_CUR); + avio_seek(bc, skip, SEEK_CUR); break; case INFO_STARTCODE: if(decode_info_header(nut)<0) @@ -814,7 +814,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) case SYNCPOINT_STARTCODE: if(decode_syncpoint(nut, &ts, &back_ptr)<0) goto resync; - frame_code = get_byte(bc); + frame_code = avio_r8(bc); case 0: ret= decode_frame(nut, pkt, frame_code); if(ret==0) @@ -835,7 +835,7 @@ av_log(s, AV_LOG_DEBUG, "sync\n"); static int64_t nut_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit){ NUTContext *nut = s->priv_data; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; int64_t pos, pts, back_ptr; av_log(s, AV_LOG_DEBUG, "read_timestamp(X,%d,%"PRId64",%"PRId64")\n", stream_index, *pos_arg, pos_limit); @@ -902,7 +902,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flag } av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos2); pos= find_startcode(s->pb, SYNCPOINT_STARTCODE, pos2); - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); av_log(NULL, AV_LOG_DEBUG, "SP: %"PRId64"\n", pos); if(pos2 > pos || pos2 + 15 < pos){ av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n"); diff --git a/mplayer/ffmpeg/libavformat/nutenc.c b/mplayer/ffmpeg/libavformat/nutenc.c index 288e4bd4..078ffac0 100644 --- a/mplayer/ffmpeg/libavformat/nutenc.c +++ b/mplayer/ffmpeg/libavformat/nutenc.c @@ -241,7 +241,7 @@ static void build_frame_code(AVFormatContext *s){ nut->frame_code['N'].flags= FLAG_INVALID; } -static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext *bc, uint64_t val){ +static void put_tt(NUTContext *nut, StreamContext *nus, AVIOContext *bc, uint64_t val){ val *= nut->time_base_count; val += nus->time_base - nut->time_base; ff_put_v(bc, val); @@ -250,25 +250,25 @@ static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext *bc, uint6 /** * Store a string as vb. */ -static void put_str(ByteIOContext *bc, const char *string){ +static void put_str(AVIOContext *bc, const char *string){ int len= strlen(string); ff_put_v(bc, len); - put_buffer(bc, string, len); + avio_write(bc, string, len); } -static void put_s(ByteIOContext *bc, int64_t val){ +static void put_s(AVIOContext *bc, int64_t val){ ff_put_v(bc, 2*FFABS(val) - (val>0)); } #ifdef TRACE -static inline void ff_put_v_trace(ByteIOContext *bc, uint64_t v, char *file, char *func, int line){ +static inline void ff_put_v_trace(AVIOContext *bc, uint64_t v, char *file, char *func, int line){ av_log(NULL, AV_LOG_DEBUG, "ff_put_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); ff_put_v(bc, v); } -static inline void put_s_trace(ByteIOContext *bc, int64_t v, char *file, char *func, int line){ +static inline void put_s_trace(AVIOContext *bc, int64_t v, char *file, char *func, int line){ av_log(NULL, AV_LOG_DEBUG, "put_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); put_s(bc, v); @@ -278,28 +278,28 @@ static inline void put_s_trace(ByteIOContext *bc, int64_t v, char *file, char *f #endif //FIXME remove calculate_checksum -static void put_packet(NUTContext *nut, ByteIOContext *bc, ByteIOContext *dyn_bc, int calculate_checksum, uint64_t startcode){ +static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc, int calculate_checksum, uint64_t startcode){ uint8_t *dyn_buf=NULL; int dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf); int forw_ptr= dyn_size + 4*calculate_checksum; if(forw_ptr > 4096) init_checksum(bc, ff_crc04C11DB7_update, 0); - put_be64(bc, startcode); + avio_wb64(bc, startcode); ff_put_v(bc, forw_ptr); if(forw_ptr > 4096) - put_le32(bc, get_checksum(bc)); + avio_wl32(bc, get_checksum(bc)); if(calculate_checksum) init_checksum(bc, ff_crc04C11DB7_update, 0); - put_buffer(bc, dyn_buf, dyn_size); + avio_write(bc, dyn_buf, dyn_size); if(calculate_checksum) - put_le32(bc, get_checksum(bc)); + avio_wl32(bc, get_checksum(bc)); av_free(dyn_buf); } -static void write_mainheader(NUTContext *nut, ByteIOContext *bc){ +static void write_mainheader(NUTContext *nut, AVIOContext *bc){ int i, j, tmp_pts, tmp_flags, tmp_stream, tmp_mul, tmp_size, tmp_fields, tmp_head_idx; int64_t tmp_match; @@ -366,11 +366,11 @@ static void write_mainheader(NUTContext *nut, ByteIOContext *bc){ ff_put_v(bc, nut->header_count-1); for(i=1; iheader_count; i++){ ff_put_v(bc, nut->header_len[i]); - put_buffer(bc, nut->header[i], nut->header_len[i]); + avio_write(bc, nut->header[i], nut->header_len[i]); } } -static int write_streamheader(AVFormatContext *avctx, ByteIOContext *bc, AVStream *st, int i){ +static int write_streamheader(AVFormatContext *avctx, AVIOContext *bc, AVStream *st, int i){ NUTContext *nut = avctx->priv_data; AVCodecContext *codec = st->codec; ff_put_v(bc, i); @@ -382,7 +382,7 @@ static int write_streamheader(AVFormatContext *avctx, ByteIOContext *bc, AVStrea } ff_put_v(bc, 4); if (codec->codec_tag){ - put_le32(bc, codec->codec_tag); + avio_wl32(bc, codec->codec_tag); } else { av_log(avctx, AV_LOG_ERROR, "No codec tag defined for stream %d\n", i); return AVERROR(EINVAL); @@ -392,10 +392,10 @@ static int write_streamheader(AVFormatContext *avctx, ByteIOContext *bc, AVStrea ff_put_v(bc, nut->stream[i].msb_pts_shift); ff_put_v(bc, nut->stream[i].max_pts_distance); ff_put_v(bc, codec->has_b_frames); - put_byte(bc, 0); /* flags: 0x1 - fixed_fps, 0x2 - index_present */ + avio_w8(bc, 0); /* flags: 0x1 - fixed_fps, 0x2 - index_present */ ff_put_v(bc, codec->extradata_size); - put_buffer(bc, codec->extradata, codec->extradata_size); + avio_write(bc, codec->extradata, codec->extradata_size); switch(codec->codec_type){ case AVMEDIA_TYPE_AUDIO: @@ -422,17 +422,17 @@ static int write_streamheader(AVFormatContext *avctx, ByteIOContext *bc, AVStrea return 0; } -static int add_info(ByteIOContext *bc, const char *type, const char *value){ +static int add_info(AVIOContext *bc, const char *type, const char *value){ put_str(bc, type); put_s(bc, -1); put_str(bc, value); return 1; } -static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){ +static int write_globalinfo(NUTContext *nut, AVIOContext *bc){ AVFormatContext *s= nut->avf; AVMetadataTag *t = NULL; - ByteIOContext *dyn_bc; + AVIOContext *dyn_bc; uint8_t *dyn_buf=NULL; int count=0, dyn_size; int ret = url_open_dyn_buf(&dyn_bc); @@ -450,15 +450,15 @@ static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){ ff_put_v(bc, count); dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf); - put_buffer(bc, dyn_buf, dyn_size); + avio_write(bc, dyn_buf, dyn_size); av_free(dyn_buf); return 0; } -static int write_streaminfo(NUTContext *nut, ByteIOContext *bc, int stream_id){ +static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id){ AVFormatContext *s= nut->avf; AVStream* st = s->streams[stream_id]; - ByteIOContext *dyn_bc; + AVIOContext *dyn_bc; uint8_t *dyn_buf=NULL; int count=0, dyn_size, i; int ret = url_open_dyn_buf(&dyn_bc); @@ -479,16 +479,16 @@ static int write_streaminfo(NUTContext *nut, ByteIOContext *bc, int stream_id){ ff_put_v(bc, count); - put_buffer(bc, dyn_buf, dyn_size); + avio_write(bc, dyn_buf, dyn_size); } av_free(dyn_buf); return count; } -static int write_headers(AVFormatContext *avctx, ByteIOContext *bc){ +static int write_headers(AVFormatContext *avctx, AVIOContext *bc){ NUTContext *nut = avctx->priv_data; - ByteIOContext *dyn_bc; + AVIOContext *dyn_bc; int i, ret; ff_metadata_conv_ctx(avctx, ff_nut_metadata_conv, NULL); @@ -537,7 +537,7 @@ static int write_headers(AVFormatContext *avctx, ByteIOContext *bc){ static int write_header(AVFormatContext *s){ NUTContext *nut = s->priv_data; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; int i, j, ret; nut->avf= s; @@ -575,8 +575,8 @@ static int write_header(AVFormatContext *s){ build_frame_code(s); assert(nut->frame_code['N'].flags == FLAG_INVALID); - put_buffer(bc, ID_STRING, strlen(ID_STRING)); - put_byte(bc, 0); + avio_write(bc, ID_STRING, strlen(ID_STRING)); + avio_w8(bc, 0); if ((ret = write_headers(s, bc)) < 0) return ret; @@ -628,7 +628,7 @@ static int find_best_header_idx(NUTContext *nut, AVPacket *pkt){ static int write_packet(AVFormatContext *s, AVPacket *pkt){ NUTContext *nut = s->priv_data; StreamContext *nus= &nut->stream[pkt->stream_index]; - ByteIOContext *bc = s->pb, *dyn_bc; + AVIOContext *bc = s->pb, *dyn_bc; FrameCode *fc; int64_t coded_pts; int best_length, frame_code, flags, needed_flags, i, header_idx, best_header_idx; @@ -749,7 +749,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ header_idx= fc->header_idx; init_checksum(bc, ff_crc04C11DB7_update, 0); - put_byte(bc, frame_code); + avio_w8(bc, frame_code); if(flags & FLAG_CODED){ ff_put_v(bc, (flags^needed_flags) & ~(FLAG_CODED)); flags = needed_flags; @@ -759,10 +759,10 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ if(flags & FLAG_SIZE_MSB) ff_put_v(bc, pkt->size / fc->size_mul); if(flags & FLAG_HEADER_IDX) ff_put_v(bc, header_idx= best_header_idx); - if(flags & FLAG_CHECKSUM) put_le32(bc, get_checksum(bc)); + if(flags & FLAG_CHECKSUM) avio_wl32(bc, get_checksum(bc)); else get_checksum(bc); - put_buffer(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]); + avio_write(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]); nus->last_flags= flags; nus->last_pts= pkt->pts; @@ -781,7 +781,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ static int write_trailer(AVFormatContext *s){ NUTContext *nut= s->priv_data; - ByteIOContext *bc= s->pb; + AVIOContext *bc= s->pb; while(nut->header_count<3) write_headers(s, bc); diff --git a/mplayer/ffmpeg/libavformat/nuv.c b/mplayer/ffmpeg/libavformat/nuv.c index 58a00dfa..6c7c563b 100644 --- a/mplayer/ffmpeg/libavformat/nuv.c +++ b/mplayer/ffmpeg/libavformat/nuv.c @@ -55,100 +55,100 @@ static int nuv_probe(AVProbeData *p) { * \param myth set if this is a MythTVVideo format file * \return 1 if all required codec data was found */ -static int get_codec_data(ByteIOContext *pb, AVStream *vst, +static int get_codec_data(AVIOContext *pb, AVStream *vst, AVStream *ast, int myth) { nuv_frametype frametype; if (!vst && !myth) return 1; // no codec data needed while (!url_feof(pb)) { int size, subtype; - frametype = get_byte(pb); + frametype = avio_r8(pb); switch (frametype) { case NUV_EXTRADATA: - subtype = get_byte(pb); - url_fskip(pb, 6); - size = PKTSIZE(get_le32(pb)); + subtype = avio_r8(pb); + avio_seek(pb, 6, SEEK_CUR); + size = PKTSIZE(avio_rl32(pb)); if (vst && subtype == 'R') { vst->codec->extradata_size = size; vst->codec->extradata = av_malloc(size); - get_buffer(pb, vst->codec->extradata, size); + avio_read(pb, vst->codec->extradata, size); size = 0; if (!myth) return 1; } break; case NUV_MYTHEXT: - url_fskip(pb, 7); - size = PKTSIZE(get_le32(pb)); + avio_seek(pb, 7, SEEK_CUR); + size = PKTSIZE(avio_rl32(pb)); if (size != 128 * 4) break; - get_le32(pb); // version + avio_rl32(pb); // version if (vst) { - vst->codec->codec_tag = get_le32(pb); + vst->codec->codec_tag = avio_rl32(pb); vst->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, vst->codec->codec_tag); if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G')) vst->codec->codec_id = CODEC_ID_NUV; } else - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); if (ast) { - ast->codec->codec_tag = get_le32(pb); - ast->codec->sample_rate = get_le32(pb); - ast->codec->bits_per_coded_sample = get_le32(pb); - ast->codec->channels = get_le32(pb); + ast->codec->codec_tag = avio_rl32(pb); + ast->codec->sample_rate = avio_rl32(pb); + ast->codec->bits_per_coded_sample = avio_rl32(pb); + ast->codec->channels = avio_rl32(pb); ast->codec->codec_id = ff_wav_codec_get_id(ast->codec->codec_tag, ast->codec->bits_per_coded_sample); ast->need_parsing = AVSTREAM_PARSE_FULL; } else - url_fskip(pb, 4 * 4); + avio_seek(pb, 4 * 4, SEEK_CUR); size -= 6 * 4; - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); return 1; case NUV_SEEKP: size = 11; break; default: - url_fskip(pb, 7); - size = PKTSIZE(get_le32(pb)); + avio_seek(pb, 7, SEEK_CUR); + size = PKTSIZE(avio_rl32(pb)); break; } - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); } return 0; } static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { NUVContext *ctx = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; char id_string[12]; double aspect, fps; int is_mythtv, width, height, v_packs, a_packs; int stream_nr = 0; AVStream *vst = NULL, *ast = NULL; - get_buffer(pb, id_string, 12); + avio_read(pb, id_string, 12); is_mythtv = !memcmp(id_string, "MythTVVideo", 12); - url_fskip(pb, 5); // version string - url_fskip(pb, 3); // padding - width = get_le32(pb); - height = get_le32(pb); - get_le32(pb); // unused, "desiredwidth" - get_le32(pb); // unused, "desiredheight" - get_byte(pb); // 'P' == progressive, 'I' == interlaced - url_fskip(pb, 3); // padding - aspect = av_int2dbl(get_le64(pb)); + avio_seek(pb, 5, SEEK_CUR); // version string + avio_seek(pb, 3, SEEK_CUR); // padding + width = avio_rl32(pb); + height = avio_rl32(pb); + avio_rl32(pb); // unused, "desiredwidth" + avio_rl32(pb); // unused, "desiredheight" + avio_r8(pb); // 'P' == progressive, 'I' == interlaced + avio_seek(pb, 3, SEEK_CUR); // padding + aspect = av_int2dbl(avio_rl64(pb)); if (aspect > 0.9999 && aspect < 1.0001) aspect = 4.0 / 3.0; - fps = av_int2dbl(get_le64(pb)); + fps = av_int2dbl(avio_rl64(pb)); // number of packets per stream type, -1 means unknown, e.g. streaming - v_packs = get_le32(pb); - a_packs = get_le32(pb); - get_le32(pb); // text + v_packs = avio_rl32(pb); + a_packs = avio_rl32(pb); + avio_rl32(pb); // text - get_le32(pb); // keyframe distance (?) + avio_rl32(pb); // keyframe distance (?) if (v_packs) { ctx->v_id = stream_nr++; @@ -191,14 +191,14 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { NUVContext *ctx = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; uint8_t hdr[HDRSIZE]; nuv_frametype frametype; int ret, size; while (!url_feof(pb)) { int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0; uint64_t pos = url_ftell(pb); - ret = get_buffer(pb, hdr, HDRSIZE); + ret = avio_read(pb, hdr, HDRSIZE); if (ret < HDRSIZE) return ret < 0 ? ret : AVERROR(EIO); frametype = hdr[0]; @@ -206,13 +206,13 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { switch (frametype) { case NUV_EXTRADATA: if (!ctx->rtjpg_video) { - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } case NUV_VIDEO: if (ctx->v_id < 0) { av_log(s, AV_LOG_ERROR, "Video packet in file without video stream!\n"); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } ret = av_new_packet(pkt, copyhdrsize + size); @@ -225,7 +225,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { pkt->pts = AV_RL32(&hdr[4]); pkt->stream_index = ctx->v_id; memcpy(pkt->data, hdr, copyhdrsize); - ret = get_buffer(pb, pkt->data + copyhdrsize, size); + ret = avio_read(pb, pkt->data + copyhdrsize, size); if (ret < 0) { av_free_packet(pkt); return ret; @@ -236,7 +236,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { case NUV_AUDIO: if (ctx->a_id < 0) { av_log(s, AV_LOG_ERROR, "Audio packet in file without audio stream!\n"); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } ret = av_get_packet(pb, pkt, size); @@ -250,7 +250,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { // contains no data, size value is invalid break; default: - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); break; } } diff --git a/mplayer/ffmpeg/libavformat/oggdec.c b/mplayer/ffmpeg/libavformat/oggdec.c index 1b4553c7..af9860bf 100644 --- a/mplayer/ffmpeg/libavformat/oggdec.c +++ b/mplayer/ffmpeg/libavformat/oggdec.c @@ -84,7 +84,7 @@ static int ogg_restore (AVFormatContext * s, int discard) { struct ogg *ogg = s->priv_data; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; struct ogg_state *ost = ogg->state; int i; @@ -97,7 +97,7 @@ ogg_restore (AVFormatContext * s, int discard) for (i = 0; i < ogg->nstreams; i++) av_free (ogg->streams[i].buf); - url_fseek (bc, ost->pos, SEEK_SET); + avio_seek (bc, ost->pos, SEEK_SET); ogg->curidx = ost->curidx; ogg->nstreams = ost->nstreams; memcpy(ogg->streams, ost->streams, @@ -194,7 +194,7 @@ ogg_new_buf(struct ogg *ogg, int idx) static int ogg_read_page (AVFormatContext * s, int *str) { - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; struct ogg *ogg = s->priv_data; struct ogg_stream *os; int i = 0; @@ -207,7 +207,7 @@ ogg_read_page (AVFormatContext * s, int *str) uint8_t sync[4]; int sp = 0; - if (get_buffer (bc, sync, 4) < 4) + if (avio_read (bc, sync, 4) < 4) return -1; do{ @@ -233,10 +233,10 @@ ogg_read_page (AVFormatContext * s, int *str) return -1; flags = url_fgetc (bc); - gp = get_le64 (bc); - serial = get_le32 (bc); - seq = get_le32 (bc); - crc = get_le32 (bc); + gp = avio_rl64 (bc); + serial = avio_rl32 (bc); + seq = avio_rl32 (bc); + crc = avio_rl32 (bc); nsegs = url_fgetc (bc); idx = ogg_find_stream (ogg, serial); @@ -252,7 +252,7 @@ ogg_read_page (AVFormatContext * s, int *str) if(os->psize > 0) ogg_new_buf(ogg, idx); - if (get_buffer (bc, os->segments, nsegs) < nsegs) + if (avio_read (bc, os->segments, nsegs) < nsegs) return -1; os->nsegs = nsegs; @@ -284,7 +284,7 @@ ogg_read_page (AVFormatContext * s, int *str) os->buf = nb; } - if (get_buffer (bc, os->buf + os->bufpos, size) < size) + if (avio_read (bc, os->buf + os->bufpos, size) < size) return -1; os->bufpos += size; @@ -374,20 +374,20 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo os->segp = segp; os->psize = psize; - // We have reached the first non-header packet. All header - // packets must be complete before the first non-header - // one, so everything that follows must be non-header. + // We have reached the first non-header packet in this stream. + // Unfortunately more header packets may still follow for others, + // so we reset this later unless we are done with the headers + // for all streams. ogg->headers = 1; // Update the header state for all streams and // compute the data_offset. - s->data_offset = os->sync_pos; + if (!s->data_offset) + s->data_offset = os->sync_pos; for (i = 0; i < ogg->nstreams; i++) { struct ogg_stream *cur_os = ogg->streams + i; - // Set stream header state to 0 if its last packet - // was a header. if (cur_os->header > 0) - cur_os->header = 0; + ogg->headers = 0; // if we have a partial non-header packet, its start is // obviously at or after the data start @@ -468,7 +468,7 @@ ogg_get_length (AVFormatContext * s) end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: 0; ogg_save (s); - url_fseek (s->pb, end, SEEK_SET); + avio_seek (s->pb, end, SEEK_SET); while (!ogg_read_page (s, &i)){ if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 && @@ -601,10 +601,10 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg, { struct ogg *ogg = s->priv_data; struct ogg_stream *os = ogg->streams + stream_index; - ByteIOContext *bc = s->pb; + AVIOContext *bc = s->pb; int64_t pts = AV_NOPTS_VALUE; int i; - url_fseek(bc, *pos_arg, SEEK_SET); + avio_seek(bc, *pos_arg, SEEK_SET); ogg_reset(ogg); while (url_ftell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) { diff --git a/mplayer/ffmpeg/libavformat/oggenc.c b/mplayer/ffmpeg/libavformat/oggenc.c index 4c2a9d6a..92591dde 100644 --- a/mplayer/ffmpeg/libavformat/oggenc.c +++ b/mplayer/ffmpeg/libavformat/oggenc.c @@ -25,6 +25,7 @@ #include "libavcodec/bytestream.h" #include "libavcodec/flac.h" #include "avformat.h" +#include "avio_internal.h" #include "internal.h" #include "vorbiscomment.h" @@ -64,19 +65,19 @@ typedef struct { OGGPageList *page_list; } OGGContext; -static void ogg_update_checksum(AVFormatContext *s, ByteIOContext *pb, int64_t crc_offset) +static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc_offset) { int64_t pos = url_ftell(pb); uint32_t checksum = get_checksum(pb); - url_fseek(pb, crc_offset, SEEK_SET); - put_be32(pb, checksum); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, crc_offset, SEEK_SET); + avio_wb32(pb, checksum); + avio_seek(pb, pos, SEEK_SET); } static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) { OGGStreamContext *oggstream = s->streams[page->stream_index]->priv_data; - ByteIOContext *pb; + AVIOContext *pb; int64_t crc_offset; int ret, size; uint8_t *buf; @@ -85,17 +86,17 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) if (ret < 0) return ret; init_checksum(pb, ff_crc04C11DB7_update, 0); - put_tag(pb, "OggS"); - put_byte(pb, 0); - put_byte(pb, page->flags | extra_flags); - put_le64(pb, page->granule); - put_le32(pb, oggstream->serial_num); - put_le32(pb, oggstream->page_counter++); + ffio_wfourcc(pb, "OggS"); + avio_w8(pb, 0); + avio_w8(pb, page->flags | extra_flags); + avio_wl64(pb, page->granule); + avio_wl32(pb, oggstream->serial_num); + avio_wl32(pb, oggstream->page_counter++); crc_offset = url_ftell(pb); - put_le32(pb, 0); // crc - put_byte(pb, page->segments_count); - put_buffer(pb, page->segments, page->segments_count); - put_buffer(pb, page->data, page->size); + avio_wl32(pb, 0); // crc + avio_w8(pb, page->segments_count); + avio_write(pb, page->segments, page->segments_count); + avio_write(pb, page->data, page->size); ogg_update_checksum(s, pb, crc_offset); put_flush_packet(pb); @@ -104,7 +105,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) if (size < 0) return size; - put_buffer(s->pb, buf, size); + avio_write(s->pb, buf, size); put_flush_packet(s->pb); av_free(buf); oggstream->page_count--; diff --git a/mplayer/ffmpeg/libavformat/oggparsedirac.c b/mplayer/ffmpeg/libavformat/oggparsedirac.c index a7f0401f..b8ce4fe2 100644 --- a/mplayer/ffmpeg/libavformat/oggparsedirac.c +++ b/mplayer/ffmpeg/libavformat/oggparsedirac.c @@ -42,7 +42,7 @@ static int dirac_header(AVFormatContext *s, int idx) st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_DIRAC; // dirac in ogg always stores timestamps as though the video were interlaced - st->time_base = (AVRational){st->codec->time_base.num, 2*st->codec->time_base.den}; + av_set_pts_info(st, 64, st->codec->time_base.num, 2*st->codec->time_base.den); return 1; } @@ -79,8 +79,7 @@ static int old_dirac_header(AVFormatContext *s, int idx) st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_DIRAC; - st->time_base.den = AV_RB32(buf+8); - st->time_base.num = AV_RB32(buf+12); + av_set_pts_info(st, 64, AV_RB32(buf+12), AV_RB32(buf+8)); return 1; } diff --git a/mplayer/ffmpeg/libavformat/oggparseflac.c b/mplayer/ffmpeg/libavformat/oggparseflac.c index e5034af3..a51a8554 100644 --- a/mplayer/ffmpeg/libavformat/oggparseflac.c +++ b/mplayer/ffmpeg/libavformat/oggparseflac.c @@ -65,8 +65,7 @@ flac_header (AVFormatContext * s, int idx) memcpy(st->codec->extradata, streaminfo_start, FLAC_STREAMINFO_SIZE); st->codec->extradata_size = FLAC_STREAMINFO_SIZE; - st->time_base.num = 1; - st->time_base.den = st->codec->sample_rate; + av_set_pts_info(st, 64, 1, st->codec->sample_rate); } else if (mdt == FLAC_METADATA_TYPE_VORBIS_COMMENT) { ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 4, os->psize - 4); } diff --git a/mplayer/ffmpeg/libavformat/oggparseogm.c b/mplayer/ffmpeg/libavformat/oggparseogm.c index e1d046f2..dda5be60 100644 --- a/mplayer/ffmpeg/libavformat/oggparseogm.c +++ b/mplayer/ffmpeg/libavformat/oggparseogm.c @@ -83,14 +83,13 @@ ogm_header(AVFormatContext *s, int idx) st->codec->height = bytestream_get_le32(&p); st->codec->time_base.den = spu * 10000000; st->codec->time_base.num = time_unit; - st->time_base = st->codec->time_base; + av_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den); } else { st->codec->channels = bytestream_get_le16(&p); p += 2; /* block_align */ st->codec->bit_rate = bytestream_get_le32(&p) * 8; st->codec->sample_rate = spu * 10000000 / time_unit; - st->time_base.num = 1; - st->time_base.den = st->codec->sample_rate; + av_set_pts_info(st, 64, 1, st->codec->sample_rate); } } else if (*p == 3) { if (os->psize > 8) diff --git a/mplayer/ffmpeg/libavformat/oggparseskeleton.c b/mplayer/ffmpeg/libavformat/oggparseskeleton.c index ad0dded0..e318e9e7 100644 --- a/mplayer/ffmpeg/libavformat/oggparseskeleton.c +++ b/mplayer/ffmpeg/libavformat/oggparseskeleton.c @@ -60,8 +60,9 @@ static int skeleton_header(AVFormatContext *s, int idx) start_den = AV_RL64(buf+20); if (start_den) { - av_reduce(&start_time, &st->time_base.den, start_num, start_den, INT_MAX); - st->time_base.num = 1; + int base_den; + av_reduce(&start_time, &base_den, start_num, start_den, INT_MAX); + av_set_pts_info(st, 64, 1, base_den); os->lastpts = st->start_time = start_time; } diff --git a/mplayer/ffmpeg/libavformat/oggparsespeex.c b/mplayer/ffmpeg/libavformat/oggparsespeex.c index 936b37e9..80b2001d 100644 --- a/mplayer/ffmpeg/libavformat/oggparsespeex.c +++ b/mplayer/ffmpeg/libavformat/oggparsespeex.c @@ -72,8 +72,7 @@ static int speex_header(AVFormatContext *s, int idx) { + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(st->codec->extradata, p, st->codec->extradata_size); - st->time_base.num = 1; - st->time_base.den = st->codec->sample_rate; + av_set_pts_info(st, 64, 1, st->codec->sample_rate); } else ff_vorbis_comment(s, &st->metadata, p, os->psize); diff --git a/mplayer/ffmpeg/libavformat/oggparsetheora.c b/mplayer/ffmpeg/libavformat/oggparsetheora.c index 2299f550..d02781f2 100644 --- a/mplayer/ffmpeg/libavformat/oggparsetheora.c +++ b/mplayer/ffmpeg/libavformat/oggparsetheora.c @@ -91,7 +91,7 @@ theora_header (AVFormatContext * s, int idx) st->codec->time_base.num = 1; st->codec->time_base.den = 25; } - st->time_base = st->codec->time_base; + av_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den); st->sample_aspect_ratio.num = get_bits_long(&gb, 24); st->sample_aspect_ratio.den = get_bits_long(&gb, 24); diff --git a/mplayer/ffmpeg/libavformat/oggparsevorbis.c b/mplayer/ffmpeg/libavformat/oggparsevorbis.c index d743d25e..830f0bca 100644 --- a/mplayer/ffmpeg/libavformat/oggparsevorbis.c +++ b/mplayer/ffmpeg/libavformat/oggparsevorbis.c @@ -28,6 +28,7 @@ #include "libavcodec/get_bits.h" #include "libavcodec/bytestream.h" #include "avformat.h" +#include "internal.h" #include "oggdec.h" #include "vorbiscomment.h" @@ -252,12 +253,19 @@ vorbis_header (AVFormatContext * s, int idx) if (srate > 0) { st->codec->sample_rate = srate; - st->time_base.num = 1; - st->time_base.den = srate; + av_set_pts_info(st, 64, 1, srate); } } else if (os->buf[os->pstart] == 3) { - if (os->psize > 8) - ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8); + if (os->psize > 8 && + ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8) >= 0) { + // drop all metadata we parsed and which is not required by libvorbis + unsigned new_len = 7 + 4 + AV_RL32(priv->packet[1] + 7) + 4 + 1; + if (new_len >= 16 && new_len < os->psize) { + AV_WL32(priv->packet[1] + new_len - 5, 0); + priv->packet[1][new_len - 1] = 1; + priv->len[1] = new_len; + } + } } else { st->codec->extradata_size = fixup_vorbis_headers(s, priv, &st->codec->extradata); diff --git a/mplayer/ffmpeg/libavformat/oma.c b/mplayer/ffmpeg/libavformat/oma.c index 158ed117..03dc1e9d 100644 --- a/mplayer/ffmpeg/libavformat/oma.c +++ b/mplayer/ffmpeg/libavformat/oma.c @@ -79,7 +79,7 @@ static int oma_read_header(AVFormatContext *s, AVStream *st; ff_id3v2_read(s, ID3v2_EA3_MAGIC); - ret = get_buffer(s->pb, buf, EA3_HEADER_SIZE); + ret = avio_read(s->pb, buf, EA3_HEADER_SIZE); if (memcmp(buf, ((const uint8_t[]){'E', 'A', '3'}),3) || buf[4] != 0 || buf[5] != EA3_HEADER_SIZE) { av_log(s, AV_LOG_ERROR, "Couldn't find the EA3 header !\n"); diff --git a/mplayer/ffmpeg/libavformat/os_support.c b/mplayer/ffmpeg/libavformat/os_support.c index de0dd527..45667dfb 100644 --- a/mplayer/ffmpeg/libavformat/os_support.c +++ b/mplayer/ffmpeg/libavformat/os_support.c @@ -179,7 +179,7 @@ int ff_getnameinfo(const struct sockaddr *sa, int salen, return EAI_NONAME; if (host && hostlen > 0) { - #ifndef GEKKO +#if !defined(GEKKO) struct hostent *ent = NULL; uint32_t a; if (!(flags & NI_NUMERICHOST)) @@ -196,17 +196,17 @@ int ff_getnameinfo(const struct sockaddr *sa, int salen, ((a >> 24) & 0xff), ((a >> 16) & 0xff), ((a >> 8) & 0xff), ( a & 0xff)); } - #else +#else uint32_t a; a = ntohl(sin->sin_addr.s_addr); snprintf(host, hostlen, "%d.%d.%d.%d", ((a >> 24) & 0xff), ((a >> 16) & 0xff), ((a >> 8) & 0xff), ( a & 0xff)); - #endif +#endif } if (serv && servlen > 0) { - #ifndef GEKKO +#if !defined(GEKKO) struct servent *ent = NULL; if (!(flags & NI_NUMERICSERV)) ent = getservbyport(sin->sin_port, flags & NI_DGRAM ? "udp" : "tcp"); @@ -214,7 +214,7 @@ int ff_getnameinfo(const struct sockaddr *sa, int salen, if (ent) { snprintf(serv, servlen, "%s", ent->s_name); } else - #endif +#endif snprintf(serv, servlen, "%d", ntohs(sin->sin_port)); } @@ -237,15 +237,19 @@ int ff_socket_nonblock(int socket, int enable) { #if HAVE_WINSOCK2_H return ioctlsocket(socket, FIONBIO, &enable); +#else +#if defined(GEKKO) + return net_ioctl(socket, FIONBIO, &enable); #else if (enable) return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) | O_NONBLOCK); else return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK); #endif +#endif } -#if !HAVE_POLL_H +#if !HAVE_POLL_H && !defined(GEKKO) int poll(struct pollfd *fds, nfds_t numfds, int timeout) { fd_set read_set; @@ -302,7 +306,7 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout) if (rc < 0) return rc; - for(i = 0; i < (nfds_t) n; i++) { + for(i = 0; i < numfds; i++) { fds[i].revents = 0; if (FD_ISSET(fds[i].fd, &read_set)) fds[i].revents |= POLLIN; diff --git a/mplayer/ffmpeg/libavformat/os_support.h b/mplayer/ffmpeg/libavformat/os_support.h index df321511..1f186060 100644 --- a/mplayer/ffmpeg/libavformat/os_support.h +++ b/mplayer/ffmpeg/libavformat/os_support.h @@ -64,6 +64,7 @@ struct pollfd { short revents; /* events that occurred */ }; +#if !defined(GEKKO) /* events & revents */ #define POLLIN 0x0001 /* any readable data available */ #define POLLOUT 0x0002 /* file descriptor is writeable */ @@ -80,6 +81,7 @@ struct pollfd { int poll(struct pollfd *fds, nfds_t numfds, int timeout); +#endif #endif /* HAVE_POLL_H */ #endif /* CONFIG_NETWORK */ diff --git a/mplayer/ffmpeg/libavformat/output-example.c b/mplayer/ffmpeg/libavformat/output-example.c index 06207edd..b6be2b97 100644 --- a/mplayer/ffmpeg/libavformat/output-example.c +++ b/mplayer/ffmpeg/libavformat/output-example.c @@ -481,7 +481,7 @@ int main(int argc, char **argv) exit(1); } - dump_format(oc, 0, filename, 1); + av_dump_format(oc, 0, filename, 1); /* now that all the parameters are set, we can open the audio and video codecs and allocate the necessary encode buffers */ @@ -492,7 +492,7 @@ int main(int argc, char **argv) /* open the output file, if needed */ if (!(fmt->flags & AVFMT_NOFILE)) { - if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) { + if (avio_open(&oc->pb, filename, URL_WRONLY) < 0) { fprintf(stderr, "Could not open '%s'\n", filename); exit(1); } @@ -545,7 +545,7 @@ int main(int argc, char **argv) if (!(fmt->flags & AVFMT_NOFILE)) { /* close the output file */ - url_fclose(oc->pb); + avio_close(oc->pb); } /* free the stream */ diff --git a/mplayer/ffmpeg/libavformat/pcm.c b/mplayer/ffmpeg/libavformat/pcm.c index 5de23af1..def183c5 100644 --- a/mplayer/ffmpeg/libavformat/pcm.c +++ b/mplayer/ffmpeg/libavformat/pcm.c @@ -49,7 +49,7 @@ int pcm_read_seek(AVFormatContext *s, /* recompute exact position */ st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num); - if ((ret = url_fseek(s->pb, pos + s->data_offset, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, pos + s->data_offset, SEEK_SET)) < 0) return ret; return 0; } diff --git a/mplayer/ffmpeg/libavformat/psxstr.c b/mplayer/ffmpeg/libavformat/psxstr.c index 4b3d0f3a..a0dc531a 100644 --- a/mplayer/ffmpeg/libavformat/psxstr.c +++ b/mplayer/ffmpeg/libavformat/psxstr.c @@ -98,21 +98,21 @@ static int str_probe(AVProbeData *p) static int str_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; StrDemuxContext *str = s->priv_data; unsigned char sector[RAW_CD_SECTOR_SIZE]; int start; int i; /* skip over any RIFF header */ - if (get_buffer(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE) + if (avio_read(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE) return AVERROR(EIO); if (AV_RL32(§or[0]) == RIFF_TAG) start = RIFF_HEADER_SIZE; else start = 0; - url_fseek(pb, start, SEEK_SET); + avio_seek(pb, start, SEEK_SET); for(i=0; i<32; i++){ str->channels[i].video_stream_index= @@ -127,7 +127,7 @@ static int str_read_header(AVFormatContext *s, static int str_read_packet(AVFormatContext *s, AVPacket *ret_pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; StrDemuxContext *str = s->priv_data; unsigned char sector[RAW_CD_SECTOR_SIZE]; int channel; @@ -136,7 +136,7 @@ static int str_read_packet(AVFormatContext *s, while (1) { - if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE) + if (avio_read(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE) return AVERROR(EIO); channel = sector[0x11]; diff --git a/mplayer/ffmpeg/libavformat/pva.c b/mplayer/ffmpeg/libavformat/pva.c index 544fc7d0..8091baae 100644 --- a/mplayer/ffmpeg/libavformat/pva.c +++ b/mplayer/ffmpeg/libavformat/pva.c @@ -67,7 +67,7 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) { static int read_part_of_packet(AVFormatContext *s, int64_t *pts, int *len, int *strid, int read_packet) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; PVAContext *pvactx = s->priv_data; int syncword, streamid, reserved, flags, length, pts_flag; int64_t pva_pts = AV_NOPTS_VALUE, startpos; @@ -75,12 +75,12 @@ static int read_part_of_packet(AVFormatContext *s, int64_t *pts, recover: startpos = url_ftell(pb); - syncword = get_be16(pb); - streamid = get_byte(pb); - get_byte(pb); /* counter not used */ - reserved = get_byte(pb); - flags = get_byte(pb); - length = get_be16(pb); + syncword = avio_rb16(pb); + streamid = avio_r8(pb); + avio_r8(pb); /* counter not used */ + reserved = avio_r8(pb); + flags = avio_r8(pb); + length = avio_rb16(pb); pts_flag = flags & 0x10; @@ -101,7 +101,7 @@ static int read_part_of_packet(AVFormatContext *s, int64_t *pts, } if (streamid == PVA_VIDEO_PAYLOAD && pts_flag) { - pva_pts = get_be32(pb); + pva_pts = avio_rb32(pb); length -= 4; } else if (streamid == PVA_AUDIO_PAYLOAD) { /* PVA Audio Packets either start with a signaled PES packet or @@ -113,22 +113,22 @@ static int read_part_of_packet(AVFormatContext *s, int64_t *pts, pes_flags; unsigned char pes_header_data[256]; - pes_signal = get_be24(pb); - get_byte(pb); - pes_packet_length = get_be16(pb); - pes_flags = get_be16(pb); - pes_header_data_length = get_byte(pb); + pes_signal = avio_rb24(pb); + avio_r8(pb); + pes_packet_length = avio_rb16(pb); + pes_flags = avio_rb16(pb); + pes_header_data_length = avio_r8(pb); if (pes_signal != 1) { pva_log(s, AV_LOG_WARNING, "expected signaled PES packet, " "trying to recover\n"); - url_fskip(pb, length - 9); + avio_seek(pb, length - 9, SEEK_CUR); if (!read_packet) return AVERROR(EIO); goto recover; } - get_buffer(pb, pes_header_data, pes_header_data_length); + avio_read(pb, pes_header_data, pes_header_data_length); length -= 9 + pes_header_data_length; pes_packet_length -= 3 + pes_header_data_length; @@ -157,7 +157,7 @@ static int read_part_of_packet(AVFormatContext *s, int64_t *pts, } static int pva_read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pva_pts; int ret, length, streamid; @@ -173,7 +173,7 @@ static int pva_read_packet(AVFormatContext *s, AVPacket *pkt) { static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index, int64_t *pos, int64_t pos_limit) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; PVAContext *pvactx = s->priv_data; int length, streamid; int64_t res = AV_NOPTS_VALUE; @@ -182,7 +182,7 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index, while (*pos < pos_limit) { res = AV_NOPTS_VALUE; - url_fseek(pb, *pos, SEEK_SET); + avio_seek(pb, *pos, SEEK_SET); pvactx->continue_pes = 0; if (read_part_of_packet(s, &res, &length, &streamid, 0)) { diff --git a/mplayer/ffmpeg/libavformat/qcp.c b/mplayer/ffmpeg/libavformat/qcp.c index 7bc32b97..6222bd5d 100644 --- a/mplayer/ffmpeg/libavformat/qcp.c +++ b/mplayer/ffmpeg/libavformat/qcp.c @@ -82,7 +82,7 @@ static int qcp_probe(AVProbeData *pd) static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; QCPContext *c = s->priv_data; AVStream *st = av_new_stream(s, 0); uint8_t buf[16]; @@ -91,13 +91,13 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) if (!st) return AVERROR(ENOMEM); - get_be32(pb); // "RIFF" - s->file_size = get_le32(pb) + 8; - url_fskip(pb, 8 + 4 + 1 + 1); // "QLCMfmt " + chunk-size + major-version + minor-version + avio_rb32(pb); // "RIFF" + s->file_size = avio_rl32(pb) + 8; + avio_seek(pb, 8 + 4 + 1 + 1, SEEK_CUR); // "QLCMfmt " + chunk-size + major-version + minor-version st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->channels = 1; - get_buffer(pb, buf, 16); + avio_read(pb, buf, 16); if (is_qcelp_13k_guid(buf)) { st->codec->codec_id = CODEC_ID_QCELP; } else if (!memcmp(buf, guid_evrc, 16)) { @@ -110,39 +110,39 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "Unknown codec GUID.\n"); return AVERROR_INVALIDDATA; } - url_fskip(pb, 2 + 80); // codec-version + codec-name - st->codec->bit_rate = get_le16(pb); + avio_seek(pb, 2 + 80, SEEK_CUR); // codec-version + codec-name + st->codec->bit_rate = avio_rl16(pb); - s->packet_size = get_le16(pb); - url_fskip(pb, 2); // block-size - st->codec->sample_rate = get_le16(pb); - url_fskip(pb, 2); // sample-size + s->packet_size = avio_rl16(pb); + avio_seek(pb, 2, SEEK_CUR); // block-size + st->codec->sample_rate = avio_rl16(pb); + avio_seek(pb, 2, SEEK_CUR); // sample-size memset(c->rates_per_mode, -1, sizeof(c->rates_per_mode)); - nb_rates = get_le32(pb); + nb_rates = avio_rl32(pb); nb_rates = FFMIN(nb_rates, 8); for (i=0; i QCP_MAX_MODE) { av_log(s, AV_LOG_WARNING, "Unknown entry %d=>%d in rate-map-table.\n ", mode, size); } else c->rates_per_mode[mode] = size; } - url_fskip(pb, 16 - 2*nb_rates + 20); // empty entries of rate-map-table + reserved + avio_seek(pb, 16 - 2*nb_rates + 20, SEEK_CUR); // empty entries of rate-map-table + reserved return 0; } static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; QCPContext *c = s->priv_data; unsigned int chunk_size, tag; while(!url_feof(pb)) { if (c->data_size) { - int pkt_size, ret, mode = get_byte(pb); + int pkt_size, ret, mode = avio_r8(pb); if (s->packet_size) { pkt_size = s->packet_size - 1; @@ -165,23 +165,23 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } - if (url_ftell(pb) & 1 && get_byte(pb)) + if (url_ftell(pb) & 1 && avio_r8(pb)) av_log(s, AV_LOG_WARNING, "Padding should be 0.\n"); - tag = get_le32(pb); - chunk_size = get_le32(pb); + tag = avio_rl32(pb); + chunk_size = avio_rl32(pb); switch (tag) { case MKTAG('v', 'r', 'a', 't'): - if (get_le32(pb)) // var-rate-flag + if (avio_rl32(pb)) // var-rate-flag s->packet_size = 0; - url_fskip(pb, 4); // size-in-packets + avio_seek(pb, 4, SEEK_CUR); // size-in-packets break; case MKTAG('d', 'a', 't', 'a'): c->data_size = chunk_size; break; default: - url_fskip(pb, chunk_size); + avio_seek(pb, chunk_size, SEEK_CUR); } } return AVERROR_EOF; diff --git a/mplayer/ffmpeg/libavformat/r3d.c b/mplayer/ffmpeg/libavformat/r3d.c index 9c9fa1bb..0e103b6a 100644 --- a/mplayer/ffmpeg/libavformat/r3d.c +++ b/mplayer/ffmpeg/libavformat/r3d.c @@ -39,10 +39,10 @@ typedef struct { static int read_atom(AVFormatContext *s, Atom *atom) { atom->offset = url_ftell(s->pb); - atom->size = get_be32(s->pb); + atom->size = avio_rb32(s->pb); if (atom->size < 8) return -1; - atom->tag = get_le32(s->pb); + atom->tag = avio_rl32(s->pb); av_dlog(s, "atom %d %.4s offset %#llx\n", atom->size, (char*)&atom->tag, atom->offset); return atom->size; @@ -59,31 +59,31 @@ static int r3d_read_red1(AVFormatContext *s) st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_JPEG2000; - tmp = get_byte(s->pb); // major version - tmp2 = get_byte(s->pb); // minor version + tmp = avio_r8(s->pb); // major version + tmp2 = avio_r8(s->pb); // minor version av_dlog(s, "version %d.%d\n", tmp, tmp2); - tmp = get_be16(s->pb); // unknown + tmp = avio_rb16(s->pb); // unknown av_dlog(s, "unknown1 %d\n", tmp); - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_set_pts_info(st, 32, 1, tmp); - tmp = get_be32(s->pb); // filenum + tmp = avio_rb32(s->pb); // filenum av_dlog(s, "filenum %d\n", tmp); - url_fskip(s->pb, 32); // unknown + avio_seek(s->pb, 32, SEEK_CUR); // unknown - st->codec->width = get_be32(s->pb); - st->codec->height = get_be32(s->pb); + st->codec->width = avio_rb32(s->pb); + st->codec->height = avio_rb32(s->pb); - tmp = get_be16(s->pb); // unknown + tmp = avio_rb16(s->pb); // unknown av_dlog(s, "unknown2 %d\n", tmp); - st->codec->time_base.den = get_be16(s->pb); - st->codec->time_base.num = get_be16(s->pb); + st->codec->time_base.den = avio_rb16(s->pb); + st->codec->time_base.num = avio_rb16(s->pb); - tmp = get_byte(s->pb); // audio channels + tmp = avio_r8(s->pb); // audio channels av_dlog(s, "audio channels %d\n", tmp); if (tmp > 0) { AVStream *ast = av_new_stream(s, 1); @@ -95,7 +95,7 @@ static int r3d_read_red1(AVFormatContext *s) av_set_pts_info(ast, 32, 1, st->time_base.den); } - get_buffer(s->pb, filename, 257); + avio_read(s->pb, filename, 257); filename[sizeof(filename)-1] = 0; av_metadata_set2(&st->metadata, "filename", filename, 0); @@ -120,7 +120,7 @@ static int r3d_read_rdvo(AVFormatContext *s, Atom *atom) return AVERROR(ENOMEM); for (i = 0; i < r3d->video_offsets_count; i++) { - r3d->video_offsets[i] = get_be32(s->pb); + r3d->video_offsets[i] = avio_rb32(s->pb); if (!r3d->video_offsets[i]) { r3d->video_offsets_count = i; break; @@ -141,18 +141,18 @@ static void r3d_read_reos(AVFormatContext *s) R3DContext *r3d = s->priv_data; int tmp; - r3d->rdvo_offset = get_be32(s->pb); - get_be32(s->pb); // rdvs offset - get_be32(s->pb); // rdao offset - get_be32(s->pb); // rdas offset + r3d->rdvo_offset = avio_rb32(s->pb); + avio_rb32(s->pb); // rdvs offset + avio_rb32(s->pb); // rdao offset + avio_rb32(s->pb); // rdas offset - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_dlog(s, "num video chunks %d\n", tmp); - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_dlog(s, "num audio chunks %d\n", tmp); - url_fskip(s->pb, 6*4); + avio_seek(s->pb, 6*4, SEEK_CUR); } static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) @@ -180,7 +180,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) if (url_is_streamed(s->pb)) return 0; // find REOB/REOF/REOS to load index - url_fseek(s->pb, url_fsize(s->pb)-48-8, SEEK_SET); + avio_seek(s->pb, url_fsize(s->pb)-48-8, SEEK_SET); if (read_atom(s, &atom) < 0) av_log(s, AV_LOG_ERROR, "error reading end atom\n"); @@ -192,7 +192,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) r3d_read_reos(s); if (r3d->rdvo_offset) { - url_fseek(s->pb, r3d->rdvo_offset, SEEK_SET); + avio_seek(s->pb, r3d->rdvo_offset, SEEK_SET); if (read_atom(s, &atom) < 0) av_log(s, AV_LOG_ERROR, "error reading 'rdvo' atom\n"); if (atom.tag == MKTAG('R','D','V','O')) { @@ -202,7 +202,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) } out: - url_fseek(s->pb, s->data_offset, SEEK_SET); + avio_seek(s->pb, s->data_offset, SEEK_SET); return 0; } @@ -214,31 +214,31 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) unsigned dts; int ret; - dts = get_be32(s->pb); + dts = avio_rb32(s->pb); - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_dlog(s, "frame num %d\n", tmp); - tmp = get_byte(s->pb); // major version - tmp2 = get_byte(s->pb); // minor version + tmp = avio_r8(s->pb); // major version + tmp2 = avio_r8(s->pb); // minor version av_dlog(s, "version %d.%d\n", tmp, tmp2); - tmp = get_be16(s->pb); // unknown + tmp = avio_rb16(s->pb); // unknown av_dlog(s, "unknown %d\n", tmp); if (tmp > 4) { - tmp = get_be16(s->pb); // unknown + tmp = avio_rb16(s->pb); // unknown av_dlog(s, "unknown %d\n", tmp); - tmp = get_be16(s->pb); // unknown + tmp = avio_rb16(s->pb); // unknown av_dlog(s, "unknown %d\n", tmp); - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_dlog(s, "width %d\n", tmp); - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_dlog(s, "height %d\n", tmp); - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_dlog(s, "metadata len %d\n", tmp); } tmp = atom->size - 8 - (url_ftell(s->pb) - pos); @@ -268,23 +268,23 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) unsigned dts; int ret; - dts = get_be32(s->pb); + dts = avio_rb32(s->pb); - st->codec->sample_rate = get_be32(s->pb); + st->codec->sample_rate = avio_rb32(s->pb); - samples = get_be32(s->pb); + samples = avio_rb32(s->pb); - tmp = get_be32(s->pb); + tmp = avio_rb32(s->pb); av_dlog(s, "packet num %d\n", tmp); - tmp = get_be16(s->pb); // unkown + tmp = avio_rb16(s->pb); // unkown av_dlog(s, "unknown %d\n", tmp); - tmp = get_byte(s->pb); // major version - tmp2 = get_byte(s->pb); // minor version + tmp = avio_r8(s->pb); // major version + tmp2 = avio_r8(s->pb); // minor version av_dlog(s, "version %d.%d\n", tmp, tmp2); - tmp = get_be32(s->pb); // unknown + tmp = avio_rb32(s->pb); // unknown av_dlog(s, "unknown %d\n", tmp); size = atom->size - 8 - (url_ftell(s->pb) - pos); @@ -332,7 +332,7 @@ static int r3d_read_packet(AVFormatContext *s, AVPacket *pkt) break; default: skip: - url_fskip(s->pb, atom.size-8); + avio_seek(s->pb, atom.size-8, SEEK_CUR); } } return err; @@ -359,7 +359,7 @@ static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, i av_dlog(s, "seek frame num %d timestamp %lld\n", frame_num, sample_time); if (frame_num < r3d->video_offsets_count) { - url_fseek(s->pb, r3d->video_offsets_count, SEEK_SET); + avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET); } else { av_log(s, AV_LOG_ERROR, "could not seek to frame %d\n", frame_num); return -1; diff --git a/mplayer/ffmpeg/libavformat/rawdec.c b/mplayer/ffmpeg/libavformat/rawdec.c index 4f830e3c..1c2f1211 100644 --- a/mplayer/ffmpeg/libavformat/rawdec.c +++ b/mplayer/ffmpeg/libavformat/rawdec.c @@ -21,6 +21,7 @@ */ #include "avformat.h" +#include "avio_internal.h" #include "rawdec.h" /* raw input */ @@ -81,7 +82,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) pkt->pos= url_ftell(s->pb); pkt->stream_index = 0; - ret = get_partial_buffer(s->pb, pkt->data, size); + ret = ffio_read_partial(s->pb, pkt->data, size); if (ret < 0) { av_free_packet(pkt); return ret; diff --git a/mplayer/ffmpeg/libavformat/rawenc.c b/mplayer/ffmpeg/libavformat/rawenc.c index 6f9fdce4..20ddfd56 100644 --- a/mplayer/ffmpeg/libavformat/rawenc.c +++ b/mplayer/ffmpeg/libavformat/rawenc.c @@ -25,7 +25,7 @@ int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt) { - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, pkt->data, pkt->size); put_flush_packet(s->pb); return 0; } diff --git a/mplayer/ffmpeg/libavformat/rdt.c b/mplayer/ffmpeg/libavformat/rdt.c index 3428b4d3..ce398963 100644 --- a/mplayer/ffmpeg/libavformat/rdt.c +++ b/mplayer/ffmpeg/libavformat/rdt.c @@ -33,6 +33,7 @@ #include "libavutil/md5.h" #include "rm.h" #include "internal.h" +#include "avio_internal.h" #include "libavcodec/get_bits.h" struct RDTDemuxContext { @@ -63,7 +64,7 @@ ff_rdt_parse_open(AVFormatContext *ic, int first_stream_of_set_idx, do { s->n_streams++; } while (first_stream_of_set_idx + s->n_streams < ic->nb_streams && - s->streams[s->n_streams]->priv_data == s->streams[0]->priv_data); + s->streams[s->n_streams]->id == s->streams[0]->id); s->prev_set_id = -1; s->prev_stream_id = -1; s->prev_timestamp = -1; @@ -76,11 +77,6 @@ ff_rdt_parse_open(AVFormatContext *ic, int first_stream_of_set_idx, void ff_rdt_parse_close(RDTDemuxContext *s) { - int i; - - for (i = 1; i < s->n_streams; i++) - s->streams[i]->priv_data = NULL; - av_free(s); } @@ -135,7 +131,7 @@ ff_rdt_calc_response_and_checksum(char response[41], char chksum[9], static int rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) { - ByteIOContext pb; + AVIOContext pb; int size; uint32_t tag; @@ -155,30 +151,30 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) */ if (!rdt->mlti_data) return -1; - init_put_byte(&pb, rdt->mlti_data, rdt->mlti_data_size, 0, + ffio_init_context(&pb, rdt->mlti_data, rdt->mlti_data_size, 0, NULL, NULL, NULL, NULL); - tag = get_le32(&pb); + tag = avio_rl32(&pb); if (tag == MKTAG('M', 'L', 'T', 'I')) { int num, chunk_nr; /* read index of MDPR chunk numbers */ - num = get_be16(&pb); + num = avio_rb16(&pb); if (rule_nr < 0 || rule_nr >= num) return -1; - url_fskip(&pb, rule_nr * 2); - chunk_nr = get_be16(&pb); - url_fskip(&pb, (num - 1 - rule_nr) * 2); + avio_seek(&pb, rule_nr * 2, SEEK_CUR); + chunk_nr = avio_rb16(&pb); + avio_seek(&pb, (num - 1 - rule_nr) * 2, SEEK_CUR); /* read MDPR chunks */ - num = get_be16(&pb); + num = avio_rb16(&pb); if (chunk_nr >= num) return -1; while (chunk_nr--) - url_fskip(&pb, get_be32(&pb)); - size = get_be32(&pb); + avio_seek(&pb, avio_rb32(&pb), SEEK_CUR); + size = avio_rb32(&pb); } else { size = rdt->mlti_data_size; - url_fseek(&pb, 0, SEEK_SET); + avio_seek(&pb, 0, SEEK_SET); } if (ff_rm_read_mdpr_codecdata(rdt->rmctx, &pb, st, rdt->rmst[st->index], size) < 0) return -1; @@ -300,12 +296,12 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st, const uint8_t *buf, int len, int flags) { int seq = 1, res; - ByteIOContext pb; + AVIOContext pb; if (rdt->audio_pkt_cnt == 0) { int pos; - init_put_byte(&pb, buf, len, 0, NULL, NULL, NULL, NULL); + ffio_init_context(&pb, buf, len, 0, NULL, NULL, NULL, NULL); flags = (flags & RTP_FLAG_KEY) ? 2 : 0; res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt, &seq, flags, *timestamp); @@ -315,7 +311,7 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st, if (res > 0) { if (st->codec->codec_id == CODEC_ID_AAC) { memcpy (rdt->buffer, buf + pos, len - pos); - rdt->rmctx->pb = av_alloc_put_byte (rdt->buffer, len - pos, 0, + rdt->rmctx->pb = avio_alloc_context (rdt->buffer, len - pos, 0, NULL, NULL, NULL, NULL); } goto get_cache; @@ -422,7 +418,7 @@ rdt_parse_sdp_line (AVFormatContext *s, int st_index, int n, first = -1; for (n = 0; n < s->nb_streams; n++) - if (s->streams[n]->priv_data == stream->priv_data) { + if (s->streams[n]->id == stream->id) { int count = s->streams[n]->index + 1; if (first == -1) first = n; if (rdt->nb_rmst < count) { @@ -463,10 +459,9 @@ add_dstream(AVFormatContext *s, AVStream *orig_st) { AVStream *st; - if (!(st = av_new_stream(s, 0))) + if (!(st = av_new_stream(s, orig_st->id))) return NULL; st->codec->codec_type = orig_st->codec->codec_type; - st->priv_data = orig_st->priv_data; st->first_dts = orig_st->first_dts; return st; @@ -559,7 +554,7 @@ static RTPDynamicProtocolHandler ff_rdt_ ## n ## _handler = { \ .open = rdt_new_context, \ .close = rdt_free_context, \ .parse_packet = rdt_parse_packet \ -}; +} RDT_HANDLER(live_video, "x-pn-multirate-realvideo-live", AVMEDIA_TYPE_VIDEO); RDT_HANDLER(live_audio, "x-pn-multirate-realaudio-live", AVMEDIA_TYPE_AUDIO); diff --git a/mplayer/ffmpeg/libavformat/riff.c b/mplayer/ffmpeg/libavformat/riff.c index 4edccced..709aaad2 100644 --- a/mplayer/ffmpeg/libavformat/riff.c +++ b/mplayer/ffmpeg/libavformat/riff.c @@ -21,6 +21,7 @@ #include "libavcodec/avcodec.h" #include "avformat.h" +#include "avio_internal.h" #include "riff.h" #include "libavcodec/bytestream.h" @@ -319,26 +320,26 @@ const AVCodecTag ff_codec_wav_tags[] = { }; #if CONFIG_MUXERS -int64_t ff_start_tag(ByteIOContext *pb, const char *tag) +int64_t ff_start_tag(AVIOContext *pb, const char *tag) { - put_tag(pb, tag); - put_le32(pb, 0); + ffio_wfourcc(pb, tag); + avio_wl32(pb, 0); return url_ftell(pb); } -void ff_end_tag(ByteIOContext *pb, int64_t start) +void ff_end_tag(AVIOContext *pb, int64_t start) { int64_t pos; pos = url_ftell(pb); - url_fseek(pb, start - 4, SEEK_SET); - put_le32(pb, (uint32_t)(pos - start)); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, start - 4, SEEK_SET); + avio_wl32(pb, (uint32_t)(pos - start)); + avio_seek(pb, pos, SEEK_SET); } /* WAVEFORMATEX header */ /* returns the size or -1 on error */ -int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc) +int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc) { int bps, blkalign, bytespersec; int hdrsize = 18; @@ -354,12 +355,12 @@ int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc) || av_get_bits_per_sample(enc->codec_id) > 16; if (waveformatextensible) { - put_le16(pb, 0xfffe); + avio_wl16(pb, 0xfffe); } else { - put_le16(pb, enc->codec_tag); + avio_wl16(pb, enc->codec_tag); } - put_le16(pb, enc->channels); - put_le32(pb, enc->sample_rate); + avio_wl16(pb, enc->channels); + avio_wl32(pb, enc->sample_rate); if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_GSM_MS) { bps = 0; } else if (enc->codec_id == CODEC_ID_ADPCM_G726) { @@ -393,9 +394,9 @@ int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc) } else { bytespersec = enc->bit_rate / 8; } - put_le32(pb, bytespersec); /* bytes per second */ - put_le16(pb, blkalign); /* block align */ - put_le16(pb, bps); /* bits per sample */ + avio_wl32(pb, bytespersec); /* bytes per second */ + avio_wl16(pb, blkalign); /* block align */ + avio_wl16(pb, bps); /* bits per sample */ if (enc->codec_id == CODEC_ID_MP3) { hdrsize += 12; bytestream_put_le16(&riff_extradata, 1); /* wID */ @@ -425,47 +426,47 @@ int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc) } if(waveformatextensible) { /* write WAVEFORMATEXTENSIBLE extensions */ hdrsize += 22; - put_le16(pb, riff_extradata - riff_extradata_start + 22); /* 22 is WAVEFORMATEXTENSIBLE size */ - put_le16(pb, enc->bits_per_coded_sample); /* ValidBitsPerSample || SamplesPerBlock || Reserved */ - put_le32(pb, enc->channel_layout); /* dwChannelMask */ - put_le32(pb, enc->codec_tag); /* GUID + next 3 */ - put_le32(pb, 0x00100000); - put_le32(pb, 0xAA000080); - put_le32(pb, 0x719B3800); + avio_wl16(pb, riff_extradata - riff_extradata_start + 22); /* 22 is WAVEFORMATEXTENSIBLE size */ + avio_wl16(pb, enc->bits_per_coded_sample); /* ValidBitsPerSample || SamplesPerBlock || Reserved */ + avio_wl32(pb, enc->channel_layout); /* dwChannelMask */ + avio_wl32(pb, enc->codec_tag); /* GUID + next 3 */ + avio_wl32(pb, 0x00100000); + avio_wl32(pb, 0xAA000080); + avio_wl32(pb, 0x719B3800); } else if(riff_extradata - riff_extradata_start) { - put_le16(pb, riff_extradata - riff_extradata_start); + avio_wl16(pb, riff_extradata - riff_extradata_start); } - put_buffer(pb, riff_extradata_start, riff_extradata - riff_extradata_start); + avio_write(pb, riff_extradata_start, riff_extradata - riff_extradata_start); if(hdrsize&1){ hdrsize++; - put_byte(pb, 0); + avio_w8(pb, 0); } return hdrsize; } /* BITMAPINFOHEADER header */ -void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf) +void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf) { - put_le32(pb, 40 + enc->extradata_size); /* size */ - put_le32(pb, enc->width); + avio_wl32(pb, 40 + enc->extradata_size); /* size */ + avio_wl32(pb, enc->width); //We always store RGB TopDown - put_le32(pb, enc->codec_tag ? enc->height : -enc->height); - put_le16(pb, 1); /* planes */ + avio_wl32(pb, enc->codec_tag ? enc->height : -enc->height); + avio_wl16(pb, 1); /* planes */ - put_le16(pb, enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24); /* depth */ + avio_wl16(pb, enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24); /* depth */ /* compression type */ - put_le32(pb, enc->codec_tag); - put_le32(pb, enc->width * enc->height * 3); - put_le32(pb, 0); - put_le32(pb, 0); - put_le32(pb, 0); - put_le32(pb, 0); + avio_wl32(pb, enc->codec_tag); + avio_wl32(pb, enc->width * enc->height * 3); + avio_wl32(pb, 0); + avio_wl32(pb, 0); + avio_wl32(pb, 0); + avio_wl32(pb, 0); - put_buffer(pb, enc->extradata, enc->extradata_size); + avio_write(pb, enc->extradata, enc->extradata_size); if (!for_asf && enc->extradata_size & 1) - put_byte(pb, 0); + avio_w8(pb, 0); } #endif //CONFIG_MUXERS @@ -477,43 +478,43 @@ void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag * WAVEFORMATEX adds 'WORD cbSize' and basically makes itself * an openended structure. */ -void ff_get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size) +void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) { int id; - id = get_le16(pb); + id = avio_rl16(pb); codec->codec_type = AVMEDIA_TYPE_AUDIO; codec->codec_tag = id; - codec->channels = get_le16(pb); - codec->sample_rate = get_le32(pb); - codec->bit_rate = get_le32(pb) * 8; - codec->block_align = get_le16(pb); + codec->channels = avio_rl16(pb); + codec->sample_rate = avio_rl32(pb); + codec->bit_rate = avio_rl32(pb) * 8; + codec->block_align = avio_rl16(pb); if (size == 14) { /* We're dealing with plain vanilla WAVEFORMAT */ codec->bits_per_coded_sample = 8; }else - codec->bits_per_coded_sample = get_le16(pb); + codec->bits_per_coded_sample = avio_rl16(pb); if (size >= 18) { /* We're obviously dealing with WAVEFORMATEX */ - int cbSize = get_le16(pb); /* cbSize */ + int cbSize = avio_rl16(pb); /* cbSize */ size -= 18; cbSize = FFMIN(size, cbSize); if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */ - codec->bits_per_coded_sample = get_le16(pb); - codec->channel_layout = get_le32(pb); /* dwChannelMask */ - id = get_le32(pb); /* 4 first bytes of GUID */ - url_fskip(pb, 12); /* skip end of GUID */ + codec->bits_per_coded_sample = avio_rl16(pb); + codec->channel_layout = avio_rl32(pb); /* dwChannelMask */ + id = avio_rl32(pb); /* 4 first bytes of GUID */ + avio_seek(pb, 12, SEEK_CUR); /* skip end of GUID */ cbSize -= 22; size -= 22; } codec->extradata_size = cbSize; if (cbSize > 0) { codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(pb, codec->extradata, codec->extradata_size); + avio_read(pb, codec->extradata, codec->extradata_size); size -= cbSize; } /* It is possible for the chunk to contain garbage at the end */ if (size > 0) - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); } codec->codec_id = ff_wav_codec_get_id(id, codec->bits_per_coded_sample); if (codec->codec_id == CODEC_ID_AAC_LATM) { @@ -544,20 +545,20 @@ enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps) return id; } -int ff_get_bmp_header(ByteIOContext *pb, AVStream *st) +int ff_get_bmp_header(AVIOContext *pb, AVStream *st) { int tag1; - get_le32(pb); /* size */ - st->codec->width = get_le32(pb); - st->codec->height = (int32_t)get_le32(pb); - get_le16(pb); /* planes */ - st->codec->bits_per_coded_sample= get_le16(pb); /* depth */ - tag1 = get_le32(pb); - get_le32(pb); /* ImageSize */ - get_le32(pb); /* XPelsPerMeter */ - get_le32(pb); /* YPelsPerMeter */ - get_le32(pb); /* ClrUsed */ - get_le32(pb); /* ClrImportant */ + avio_rl32(pb); /* size */ + st->codec->width = avio_rl32(pb); + st->codec->height = (int32_t)avio_rl32(pb); + avio_rl16(pb); /* planes */ + st->codec->bits_per_coded_sample= avio_rl16(pb); /* depth */ + tag1 = avio_rl32(pb); + avio_rl32(pb); /* ImageSize */ + avio_rl32(pb); /* XPelsPerMeter */ + avio_rl32(pb); /* YPelsPerMeter */ + avio_rl32(pb); /* ClrUsed */ + avio_rl32(pb); /* ClrImportant */ return tag1; } #endif // CONFIG_DEMUXERS diff --git a/mplayer/ffmpeg/libavformat/riff.h b/mplayer/ffmpeg/libavformat/riff.h index 5045abcd..5a45a38e 100644 --- a/mplayer/ffmpeg/libavformat/riff.h +++ b/mplayer/ffmpeg/libavformat/riff.h @@ -32,20 +32,20 @@ #include "avio.h" #include "internal.h" -int64_t ff_start_tag(ByteIOContext *pb, const char *tag); -void ff_end_tag(ByteIOContext *pb, int64_t start); +int64_t ff_start_tag(AVIOContext *pb, const char *tag); +void ff_end_tag(AVIOContext *pb, int64_t start); /** * Read BITMAPINFOHEADER structure and set AVStream codec width, height and * bits_per_encoded_sample fields. Does not read extradata. * @return codec tag */ -int ff_get_bmp_header(ByteIOContext *pb, AVStream *st); +int ff_get_bmp_header(AVIOContext *pb, AVStream *st); -void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf); -int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc); +void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf); +int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc); enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps); -void ff_get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size); +void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size); extern const AVCodecTag ff_codec_bmp_tags[]; extern const AVCodecTag ff_codec_wav_tags[]; diff --git a/mplayer/ffmpeg/libavformat/rl2.c b/mplayer/ffmpeg/libavformat/rl2.c index ed1fb232..4538d5c5 100644 --- a/mplayer/ffmpeg/libavformat/rl2.c +++ b/mplayer/ffmpeg/libavformat/rl2.c @@ -74,7 +74,7 @@ static int rl2_probe(AVProbeData *p) static av_cold int rl2_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; unsigned int frame_count; unsigned int audio_frame_counter = 0; @@ -95,21 +95,21 @@ static av_cold int rl2_read_header(AVFormatContext *s, int i; int ret = 0; - url_fskip(pb,4); /* skip FORM tag */ - back_size = get_le32(pb); /**< get size of the background frame */ - signature = get_be32(pb); - data_size = get_be32(pb); - frame_count = get_le32(pb); + avio_seek(pb,4, SEEK_CUR); /* skip FORM tag */ + back_size = avio_rl32(pb); /**< get size of the background frame */ + signature = avio_rb32(pb); + data_size = avio_rb32(pb); + frame_count = avio_rl32(pb); /* disallow back_sizes and frame_counts that may lead to overflows later */ if(back_size > INT_MAX/2 || frame_count > INT_MAX / sizeof(uint32_t)) return AVERROR_INVALIDDATA; - encoding_method = get_le16(pb); - sound_rate = get_le16(pb); - rate = get_le16(pb); - channels = get_le16(pb); - def_sound_size = get_le16(pb); + encoding_method = avio_rl16(pb); + sound_rate = avio_rl16(pb); + rate = avio_rl16(pb); + channels = avio_rl16(pb); + def_sound_size = avio_rl16(pb); /** setup video stream */ st = av_new_stream(s, 0); @@ -133,7 +133,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, if(!st->codec->extradata) return AVERROR(ENOMEM); - if(get_buffer(pb,st->codec->extradata,st->codec->extradata_size) != + if(avio_read(pb,st->codec->extradata,st->codec->extradata_size) != st->codec->extradata_size) return AVERROR(EIO); @@ -173,11 +173,11 @@ static av_cold int rl2_read_header(AVFormatContext *s, /** read offset and size tables */ for(i=0; i < frame_count;i++) - chunk_size[i] = get_le32(pb); + chunk_size[i] = avio_rl32(pb); for(i=0; i < frame_count;i++) - chunk_offset[i] = get_le32(pb); + chunk_offset[i] = avio_rl32(pb); for(i=0; i < frame_count;i++) - audio_size[i] = get_le32(pb) & 0xFFFF; + audio_size[i] = avio_rl32(pb) & 0xFFFF; /** build the sample index */ for(i=0;ipriv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVIndexEntry *sample = NULL; int i; int ret = 0; @@ -237,7 +237,7 @@ static int rl2_read_packet(AVFormatContext *s, ++rl2->index_pos[stream_id]; /** position the stream (will probably be there anyway) */ - url_fseek(pb, sample->pos, SEEK_SET); + avio_seek(pb, sample->pos, SEEK_SET); /** fill the packet */ ret = av_get_packet(pb, pkt, sample->size); diff --git a/mplayer/ffmpeg/libavformat/rm.h b/mplayer/ffmpeg/libavformat/rm.h index 2d4656aa..6de10924 100644 --- a/mplayer/ffmpeg/libavformat/rm.h +++ b/mplayer/ffmpeg/libavformat/rm.h @@ -41,7 +41,7 @@ extern AVInputFormat ff_rdt_demuxer; * Read the MDPR chunk, which contains stream-specific codec initialization * parameters. * - * @param s context containing RMContext and ByteIOContext for stream reading + * @param s context containing RMContext and AVIOContext for stream reading * @param pb context to read the data from * @param st the stream that the MDPR chunk belongs to and where to store the * parameters read from the chunk into @@ -49,14 +49,14 @@ extern AVInputFormat ff_rdt_demuxer; * @param codec_data_size size of the MDPR chunk * @return 0 on success, errno codes on error */ -int ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb, +int ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *rst, int codec_data_size); /** * Parse one rm-stream packet from the input bytestream. * - * @param s context containing RMContext and ByteIOContext for stream reading + * @param s context containing RMContext and AVIOContext for stream reading * @param pb context to read the data from * @param st stream to which the packet to be read belongs * @param rst Real-specific stream information @@ -70,7 +70,7 @@ int ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb, * value >0 means that no data was placed in pkt, but that cached * data is available by calling ff_rm_retrieve_cache(). */ -int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, +int ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *rst, int len, AVPacket *pkt, int *seq, int flags, int64_t ts); @@ -82,7 +82,7 @@ int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, * a positive number, the amount of cached packets. Using this function, each * of those packets can be retrieved sequentially. * - * @param s context containing RMContext and ByteIOContext for stream reading + * @param s context containing RMContext and AVIOContext for stream reading * @param pb context to read the data from * @param st stream that this packet belongs to * @param rst Real-specific stream information @@ -90,7 +90,7 @@ int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, * @return the number of samples left for subsequent calls to this same * function, or 0 if all samples have been retrieved. */ -int ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, +int ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *rst, AVPacket *pkt); /** diff --git a/mplayer/ffmpeg/libavformat/rmdec.c b/mplayer/ffmpeg/libavformat/rmdec.c index da7e6b23..23f20759 100644 --- a/mplayer/ffmpeg/libavformat/rmdec.c +++ b/mplayer/ffmpeg/libavformat/rmdec.c @@ -64,33 +64,33 @@ static const unsigned char sipr_swaps[38][2] = { const unsigned char ff_sipr_subpk_size[4] = { 29, 19, 37, 20 }; -static inline void get_strl(ByteIOContext *pb, char *buf, int buf_size, int len) +static inline void get_strl(AVIOContext *pb, char *buf, int buf_size, int len) { int i; char *q, r; q = buf; for(i=0;i 0) *q = '\0'; } -static void get_str8(ByteIOContext *pb, char *buf, int buf_size) +static void get_str8(AVIOContext *pb, char *buf, int buf_size) { - get_strl(pb, buf, buf_size, get_byte(pb)); + get_strl(pb, buf, buf_size, avio_r8(pb)); } -static int rm_read_extradata(ByteIOContext *pb, AVCodecContext *avctx, unsigned size) +static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned size) { if (size >= 1<<24) return -1; avctx->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); - avctx->extradata_size = get_buffer(pb, avctx->extradata, size); + avctx->extradata_size = avio_read(pb, avctx->extradata, size); memset(avctx->extradata + avctx->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); if (avctx->extradata_size != size) return AVERROR(EIO); @@ -102,7 +102,7 @@ static void rm_read_metadata(AVFormatContext *s, int wide) char buf[1024]; int i; for (i=0; ipb) : get_byte(s->pb); + int len = wide ? avio_rb16(s->pb) : avio_r8(s->pb); get_strl(s->pb, buf, sizeof(buf), len); av_metadata_set2(&s->metadata, ff_rm_metadata[i], buf, 0); } @@ -120,7 +120,7 @@ void ff_rm_free_rmstream (RMStream *rms) av_free_packet(&rms->pkt); } -static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb, +static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, int read_all) { char buf[256]; @@ -128,20 +128,20 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb, int ret; /* ra type header */ - version = get_be16(pb); /* version */ + version = avio_rb16(pb); /* version */ if (version == 3) { - int header_size = get_be16(pb); + int header_size = avio_rb16(pb); int64_t startpos = url_ftell(pb); - url_fskip(pb, 14); + avio_seek(pb, 14, SEEK_CUR); rm_read_metadata(s, 0); if ((startpos + header_size) >= url_ftell(pb) + 2) { // fourcc (should always be "lpcJ") - get_byte(pb); + avio_r8(pb); get_str8(pb, buf, sizeof(buf)); } // Skip extra header crap (this should never happen) if ((startpos + header_size) > url_ftell(pb)) - url_fskip(pb, header_size + startpos - url_ftell(pb)); + avio_seek(pb, header_size + startpos - url_ftell(pb), SEEK_CUR); st->codec->sample_rate = 8000; st->codec->channels = 1; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -150,29 +150,29 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb, int flavor, sub_packet_h, coded_framesize, sub_packet_size; int codecdata_length; /* old version (4) */ - url_fskip(pb, 2); /* unused */ - get_be32(pb); /* .ra4 */ - get_be32(pb); /* data size */ - get_be16(pb); /* version2 */ - get_be32(pb); /* header size */ - flavor= get_be16(pb); /* add codec info / flavor */ - ast->coded_framesize = coded_framesize = get_be32(pb); /* coded frame size */ - get_be32(pb); /* ??? */ - get_be32(pb); /* ??? */ - get_be32(pb); /* ??? */ - ast->sub_packet_h = sub_packet_h = get_be16(pb); /* 1 */ - st->codec->block_align= get_be16(pb); /* frame size */ - ast->sub_packet_size = sub_packet_size = get_be16(pb); /* sub packet size */ - get_be16(pb); /* ??? */ + avio_seek(pb, 2, SEEK_CUR); /* unused */ + avio_rb32(pb); /* .ra4 */ + avio_rb32(pb); /* data size */ + avio_rb16(pb); /* version2 */ + avio_rb32(pb); /* header size */ + flavor= avio_rb16(pb); /* add codec info / flavor */ + ast->coded_framesize = coded_framesize = avio_rb32(pb); /* coded frame size */ + avio_rb32(pb); /* ??? */ + avio_rb32(pb); /* ??? */ + avio_rb32(pb); /* ??? */ + ast->sub_packet_h = sub_packet_h = avio_rb16(pb); /* 1 */ + st->codec->block_align= avio_rb16(pb); /* frame size */ + ast->sub_packet_size = sub_packet_size = avio_rb16(pb); /* sub packet size */ + avio_rb16(pb); /* ??? */ if (version == 5) { - get_be16(pb); get_be16(pb); get_be16(pb); + avio_rb16(pb); avio_rb16(pb); avio_rb16(pb); } - st->codec->sample_rate = get_be16(pb); - get_be32(pb); - st->codec->channels = get_be16(pb); + st->codec->sample_rate = avio_rb16(pb); + avio_rb32(pb); + st->codec->channels = avio_rb16(pb); if (version == 5) { - get_be32(pb); - get_buffer(pb, buf, 4); + avio_rb32(pb); + avio_read(pb, buf, 4); buf[4] = 0; } else { get_str8(pb, buf, sizeof(buf)); /* desc */ @@ -201,10 +201,10 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb, case CODEC_ID_COOK: case CODEC_ID_ATRAC3: case CODEC_ID_SIPR: - get_be16(pb); get_byte(pb); + avio_rb16(pb); avio_r8(pb); if (version == 5) - get_byte(pb); - codecdata_length = get_be32(pb); + avio_r8(pb); + codecdata_length = avio_rb32(pb); if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){ av_log(s, AV_LOG_ERROR, "codecdata_length too large\n"); return -1; @@ -236,16 +236,16 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb, av_new_packet(&ast->pkt, ast->audio_framesize * sub_packet_h); break; case CODEC_ID_AAC: - get_be16(pb); get_byte(pb); + avio_rb16(pb); avio_r8(pb); if (version == 5) - get_byte(pb); - codecdata_length = get_be32(pb); + avio_r8(pb); + codecdata_length = avio_rb32(pb); if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){ av_log(s, AV_LOG_ERROR, "codecdata_length too large\n"); return -1; } if (codecdata_length >= 1) { - get_byte(pb); + avio_r8(pb); if ((ret = rm_read_extradata(pb, st->codec, codecdata_length - 1)) < 0) return ret; } @@ -254,9 +254,9 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb, av_strlcpy(st->codec->codec_name, buf, sizeof(st->codec->codec_name)); } if (read_all) { - get_byte(pb); - get_byte(pb); - get_byte(pb); + avio_r8(pb); + avio_r8(pb); + avio_r8(pb); rm_read_metadata(s, 0); } } @@ -264,7 +264,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb, } int -ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb, +ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *rst, int codec_data_size) { unsigned int v; @@ -274,32 +274,32 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb, av_set_pts_info(st, 64, 1, 1000); codec_pos = url_ftell(pb); - v = get_be32(pb); + v = avio_rb32(pb); if (v == MKTAG(0xfd, 'a', 'r', '.')) { /* ra type header */ if (rm_read_audio_stream_info(s, pb, st, rst, 0)) return -1; } else { int fps, fps2; - if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) { + if (avio_rl32(pb) != MKTAG('V', 'I', 'D', 'O')) { fail1: av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n"); goto skip; } - st->codec->codec_tag = get_le32(pb); + st->codec->codec_tag = avio_rl32(pb); st->codec->codec_id = ff_codec_get_id(ff_rm_codec_tags, st->codec->codec_tag); // av_log(s, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0')); if (st->codec->codec_id == CODEC_ID_NONE) goto fail1; - st->codec->width = get_be16(pb); - st->codec->height = get_be16(pb); + st->codec->width = avio_rb16(pb); + st->codec->height = avio_rb16(pb); st->codec->time_base.num= 1; - fps= get_be16(pb); + fps= avio_rb16(pb); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - get_be32(pb); - fps2= get_be16(pb); - get_be16(pb); + avio_rb32(pb); + fps2= avio_rb16(pb); + avio_rb16(pb); if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (url_ftell(pb) - codec_pos))) < 0) return ret; @@ -321,7 +321,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb, skip: /* skip codec info */ size = url_ftell(pb) - codec_pos; - url_fskip(pb, codec_data_size - size); + avio_seek(pb, codec_data_size - size, SEEK_CUR); return 0; } @@ -330,20 +330,20 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb, * of the INDX chunk, and will bail out if not. */ static int rm_read_index(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int size, n_pkts, str_id, next_off, n, pos, pts; AVStream *st; do { - if (get_le32(pb) != MKTAG('I','N','D','X')) + if (avio_rl32(pb) != MKTAG('I','N','D','X')) return -1; - size = get_be32(pb); + size = avio_rb32(pb); if (size < 20) return -1; - url_fskip(pb, 2); - n_pkts = get_be32(pb); - str_id = get_be16(pb); - next_off = get_be32(pb); + avio_seek(pb, 2, SEEK_CUR); + n_pkts = avio_rb32(pb); + str_id = avio_rb16(pb); + next_off = avio_rb32(pb); for (n = 0; n < s->nb_streams; n++) if (s->streams[n]->id == str_id) { st = s->streams[n]; @@ -353,17 +353,17 @@ static int rm_read_index(AVFormatContext *s) goto skip; for (n = 0; n < n_pkts; n++) { - url_fskip(pb, 2); - pts = get_be32(pb); - pos = get_be32(pb); - url_fskip(pb, 4); /* packet no. */ + avio_seek(pb, 2, SEEK_CUR); + pts = avio_rb32(pb); + pos = avio_rb32(pb); + avio_seek(pb, 4, SEEK_CUR); /* packet no. */ av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME); } skip: if (next_off && url_ftell(pb) != next_off && - url_fseek(pb, next_off, SEEK_SET) < 0) + avio_seek(pb, next_off, SEEK_SET) < 0) return -1; } while (next_off); @@ -387,7 +387,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) { RMDemuxContext *rm = s->priv_data; AVStream *st; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int tag; int tag_size; unsigned int start_time, duration; @@ -395,7 +395,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) char buf[128]; int flags = 0; - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag == MKTAG('.', 'r', 'a', 0xfd)) { /* very old .ra format */ return rm_read_header_old(s, ap); @@ -403,17 +403,17 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR(EIO); } - get_be32(pb); /* header size */ - get_be16(pb); - get_be32(pb); - get_be32(pb); /* number of headers */ + avio_rb32(pb); /* header size */ + avio_rb16(pb); + avio_rb32(pb); + avio_rb32(pb); /* number of headers */ for(;;) { if (url_feof(pb)) return -1; - tag = get_le32(pb); - tag_size = get_be32(pb); - get_be16(pb); + tag = avio_rl32(pb); + tag_size = avio_rb32(pb); + avio_rb16(pb); #if 0 printf("tag=%c%c%c%c (%08x) size=%d\n", (tag) & 0xff, @@ -428,17 +428,17 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) switch(tag) { case MKTAG('P', 'R', 'O', 'P'): /* file header */ - get_be32(pb); /* max bit rate */ - get_be32(pb); /* avg bit rate */ - get_be32(pb); /* max packet size */ - get_be32(pb); /* avg packet size */ - get_be32(pb); /* nb packets */ - get_be32(pb); /* duration */ - get_be32(pb); /* preroll */ - indx_off = get_be32(pb); /* index offset */ - data_off = get_be32(pb); /* data offset */ - get_be16(pb); /* nb streams */ - flags = get_be16(pb); /* flags */ + avio_rb32(pb); /* max bit rate */ + avio_rb32(pb); /* avg bit rate */ + avio_rb32(pb); /* max packet size */ + avio_rb32(pb); /* avg packet size */ + avio_rb32(pb); /* nb packets */ + avio_rb32(pb); /* duration */ + avio_rb32(pb); /* preroll */ + indx_off = avio_rb32(pb); /* index offset */ + data_off = avio_rb32(pb); /* data offset */ + avio_rb16(pb); /* nb streams */ + flags = avio_rb16(pb); /* flags */ break; case MKTAG('C', 'O', 'N', 'T'): rm_read_metadata(s, 1); @@ -447,14 +447,14 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); - st->id = get_be16(pb); - get_be32(pb); /* max bit rate */ - st->codec->bit_rate = get_be32(pb); /* bit rate */ - get_be32(pb); /* max packet size */ - get_be32(pb); /* avg packet size */ - start_time = get_be32(pb); /* start time */ - get_be32(pb); /* preroll */ - duration = get_be32(pb); /* duration */ + st->id = avio_rb16(pb); + avio_rb32(pb); /* max bit rate */ + st->codec->bit_rate = avio_rb32(pb); /* bit rate */ + avio_rb32(pb); /* max packet size */ + avio_rb32(pb); /* avg packet size */ + start_time = avio_rb32(pb); /* start time */ + avio_rb32(pb); /* preroll */ + duration = avio_rb32(pb); /* duration */ st->start_time = start_time; st->duration = duration; get_str8(pb, buf, sizeof(buf)); /* desc */ @@ -462,45 +462,45 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->codec_type = AVMEDIA_TYPE_DATA; st->priv_data = ff_rm_alloc_rmstream(); if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data, - get_be32(pb)) < 0) + avio_rb32(pb)) < 0) return -1; break; case MKTAG('D', 'A', 'T', 'A'): goto header_end; default: /* unknown tag: skip it */ - url_fskip(pb, tag_size - 10); + avio_seek(pb, tag_size - 10, SEEK_CUR); break; } } header_end: - rm->nb_packets = get_be32(pb); /* number of packets */ + rm->nb_packets = avio_rb32(pb); /* number of packets */ if (!rm->nb_packets && (flags & 4)) rm->nb_packets = 3600 * 25; - get_be32(pb); /* next data header */ + avio_rb32(pb); /* next data header */ if (!data_off) data_off = url_ftell(pb) - 18; if (indx_off && !url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX) && - url_fseek(pb, indx_off, SEEK_SET) >= 0) { + avio_seek(pb, indx_off, SEEK_SET) >= 0) { rm_read_index(s); - url_fseek(pb, data_off + 18, SEEK_SET); + avio_seek(pb, data_off + 18, SEEK_SET); } return 0; } -static int get_num(ByteIOContext *pb, int *len) +static int get_num(AVIOContext *pb, int *len) { int n, n1; - n = get_be16(pb); + n = avio_rb16(pb); (*len)-=2; n &= 0x7FFF; if (n >= 0x4000) { return n - 0x4000; } else { - n1 = get_be16(pb); + n1 = avio_rb16(pb); (*len)-=2; return (n << 16) | n1; } @@ -511,7 +511,7 @@ static int get_num(ByteIOContext *pb, int *len) static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_index, int64_t *pos){ RMDemuxContext *rm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; uint32_t state=0xFFFFFFFF; @@ -524,13 +524,13 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ *timestamp = AV_NOPTS_VALUE; *flags= 0; }else{ - state= (state<<8) + get_byte(pb); + state= (state<<8) + avio_r8(pb); if(state == MKBETAG('I', 'N', 'D', 'X')){ int n_pkts, expected_len; - len = get_be32(pb); - url_fskip(pb, 2); - n_pkts = get_be32(pb); + len = avio_rb32(pb); + avio_seek(pb, 2, SEEK_CUR); + n_pkts = avio_rb32(pb); expected_len = 20 + n_pkts * 14; if (len == 20) /* some files don't add index entries to chunk size... */ @@ -553,10 +553,10 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ len=state - 12; state= 0xFFFFFFFF; - num = get_be16(pb); - *timestamp = get_be32(pb); - get_byte(pb); /* reserved */ - *flags = get_byte(pb); /* flags */ + num = avio_rb16(pb); + *timestamp = avio_rb32(pb); + avio_r8(pb); /* reserved */ + *flags = avio_r8(pb); /* flags */ } for(i=0;inb_streams;i++) { st = s->streams[i]; @@ -566,7 +566,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ if (i == s->nb_streams) { skip: /* skip packet if unknown number */ - url_fskip(pb, len); + avio_seek(pb, len, SEEK_CUR); rm->remaining_len = 0; continue; } @@ -577,23 +577,23 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ return -1; } -static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb, +static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, RMDemuxContext *rm, RMStream *vst, AVPacket *pkt, int len, int *pseq) { int hdr, seq, pic_num, len2, pos; int type; - hdr = get_byte(pb); len--; + hdr = avio_r8(pb); len--; type = hdr >> 6; if(type != 3){ // not frame as a part of packet - seq = get_byte(pb); len--; + seq = avio_r8(pb); len--; } if(type != 1){ // not whole frame len2 = get_num(pb, &len); pos = get_num(pb, &len); - pic_num = get_byte(pb); len--; + pic_num = avio_r8(pb); len--; } if(len<0) return -1; @@ -609,7 +609,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb, pkt->data[0] = 0; AV_WL32(pkt->data + 1, 1); AV_WL32(pkt->data + 5, 0); - get_buffer(pb, pkt->data + 9, len); + avio_read(pb, pkt->data + 9, len); return 0; } //now we have to deal with single slice @@ -635,7 +635,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb, AV_WL32(vst->pkt.data - 3 + 8*vst->cur_slice, vst->videobufpos - 8*vst->slices - 1); if(vst->videobufpos + len > vst->videobufsize) return 1; - if (get_buffer(pb, vst->pkt.data + vst->videobufpos, len) != len) + if (avio_read(pb, vst->pkt.data + vst->videobufpos, len) != len) return AVERROR(EIO); vst->videobufpos += len; rm->remaining_len-= len; @@ -700,7 +700,7 @@ void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize) } int -ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, +ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, int len, AVPacket *pkt, int *seq, int flags, int64_t timestamp) { @@ -730,15 +730,15 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, switch(st->codec->codec_id) { case CODEC_ID_RA_288: for (x = 0; x < h/2; x++) - get_buffer(pb, ast->pkt.data+x*2*w+y*cfs, cfs); + avio_read(pb, ast->pkt.data+x*2*w+y*cfs, cfs); break; case CODEC_ID_ATRAC3: case CODEC_ID_COOK: for (x = 0; x < w/sps; x++) - get_buffer(pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps); + avio_read(pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps); break; case CODEC_ID_SIPR: - get_buffer(pb, ast->pkt.data + y * w, w); + avio_read(pb, ast->pkt.data + y * w, w); break; } @@ -753,10 +753,10 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, } else if (st->codec->codec_id == CODEC_ID_AAC) { int x; rm->audio_stream_num = st->index; - ast->sub_packet_cnt = (get_be16(pb) & 0xf0) >> 4; + ast->sub_packet_cnt = (avio_rb16(pb) & 0xf0) >> 4; if (ast->sub_packet_cnt) { for (x = 0; x < ast->sub_packet_cnt; x++) - ast->sub_packet_lengths[x] = get_be16(pb); + ast->sub_packet_lengths[x] = avio_rb16(pb); rm->audio_pkt_cnt = ast->sub_packet_cnt; ast->audiotimestamp = timestamp; } else @@ -791,7 +791,7 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, } int -ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, +ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, AVPacket *pkt) { RMDemuxContext *rm = s->priv_data; @@ -904,7 +904,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, if(rm->old_format) return AV_NOPTS_VALUE; - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); rm->remaining_len=0; for(;;){ int seq=1; @@ -916,9 +916,9 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, st = s->streams[stream_index2]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { - h= get_byte(s->pb); len--; + h= avio_r8(s->pb); len--; if(!(h & 0x40)){ - seq = get_byte(s->pb); len--; + seq = avio_r8(s->pb); len--; } } @@ -929,7 +929,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, break; } - url_fskip(s->pb, len); + avio_seek(s->pb, len, SEEK_CUR); } *ppos = pos; return dts; diff --git a/mplayer/ffmpeg/libavformat/rmenc.c b/mplayer/ffmpeg/libavformat/rmenc.c index 5670d95e..8a608861 100644 --- a/mplayer/ffmpeg/libavformat/rmenc.c +++ b/mplayer/ffmpeg/libavformat/rmenc.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" +#include "avio_internal.h" #include "rm.h" typedef struct { @@ -44,19 +45,19 @@ typedef struct { #define BUFFER_DURATION 0 -static void put_str(ByteIOContext *s, const char *tag) +static void put_str(AVIOContext *s, const char *tag) { - put_be16(s,strlen(tag)); + avio_wb16(s,strlen(tag)); while (*tag) { - put_byte(s, *tag++); + avio_w8(s, *tag++); } } -static void put_str8(ByteIOContext *s, const char *tag) +static void put_str8(AVIOContext *s, const char *tag) { - put_byte(s, strlen(tag)); + avio_w8(s, strlen(tag)); while (*tag) { - put_byte(s, *tag++); + avio_w8(s, *tag++); } } @@ -64,7 +65,7 @@ static int rv10_write_header(AVFormatContext *ctx, int data_size, int index_pos) { RMMuxContext *rm = ctx->priv_data; - ByteIOContext *s = ctx->pb; + AVIOContext *s = ctx->pb; StreamInfo *stream; unsigned char *data_offset_ptr, *start_ptr; const char *desc, *mimetype; @@ -74,15 +75,15 @@ static int rv10_write_header(AVFormatContext *ctx, start_ptr = s->buf_ptr; - put_tag(s, ".RMF"); - put_be32(s,18); /* header size */ - put_be16(s,0); - put_be32(s,0); - put_be32(s,4 + ctx->nb_streams); /* num headers */ + ffio_wfourcc(s, ".RMF"); + avio_wb32(s,18); /* header size */ + avio_wb16(s,0); + avio_wb32(s,0); + avio_wb32(s,4 + ctx->nb_streams); /* num headers */ - put_tag(s,"PROP"); - put_be32(s, 50); - put_be16(s, 0); + ffio_wfourcc(s,"PROP"); + avio_wb32(s, 50); + avio_wb16(s, 0); packet_max_size = 0; packet_total_size = 0; nb_packets = 0; @@ -100,37 +101,37 @@ static int rv10_write_header(AVFormatContext *ctx, if (v > duration) duration = v; } - put_be32(s, bit_rate); /* max bit rate */ - put_be32(s, bit_rate); /* avg bit rate */ - put_be32(s, packet_max_size); /* max packet size */ + avio_wb32(s, bit_rate); /* max bit rate */ + avio_wb32(s, bit_rate); /* avg bit rate */ + avio_wb32(s, packet_max_size); /* max packet size */ if (nb_packets > 0) packet_avg_size = packet_total_size / nb_packets; else packet_avg_size = 0; - put_be32(s, packet_avg_size); /* avg packet size */ - put_be32(s, nb_packets); /* num packets */ - put_be32(s, duration); /* duration */ - put_be32(s, BUFFER_DURATION); /* preroll */ - put_be32(s, index_pos); /* index offset */ + avio_wb32(s, packet_avg_size); /* avg packet size */ + avio_wb32(s, nb_packets); /* num packets */ + avio_wb32(s, duration); /* duration */ + avio_wb32(s, BUFFER_DURATION); /* preroll */ + avio_wb32(s, index_pos); /* index offset */ /* computation of data the data offset */ data_offset_ptr = s->buf_ptr; - put_be32(s, 0); /* data offset : will be patched after */ - put_be16(s, ctx->nb_streams); /* num streams */ + avio_wb32(s, 0); /* data offset : will be patched after */ + avio_wb16(s, ctx->nb_streams); /* num streams */ flags = 1 | 2; /* save allowed & perfect play */ if (url_is_streamed(s)) flags |= 4; /* live broadcast */ - put_be16(s, flags); + avio_wb16(s, flags); /* comments */ - put_tag(s,"CONT"); + ffio_wfourcc(s,"CONT"); size = 4 * 2 + 10; for(i=0; imetadata, ff_rm_metadata[i], NULL, 0); if(tag) size += strlen(tag->value); } - put_be32(s,size); - put_be16(s,0); + avio_wb32(s,size); + avio_wb16(s,0); for(i=0; imetadata, ff_rm_metadata[i], NULL, 0); put_str(s, tag ? tag->value : ""); @@ -151,31 +152,31 @@ static int rv10_write_header(AVFormatContext *ctx, codec_data_size = 34; } - put_tag(s,"MDPR"); + ffio_wfourcc(s,"MDPR"); size = 10 + 9 * 4 + strlen(desc) + strlen(mimetype) + codec_data_size; - put_be32(s, size); - put_be16(s, 0); + avio_wb32(s, size); + avio_wb16(s, 0); - put_be16(s, i); /* stream number */ - put_be32(s, stream->bit_rate); /* max bit rate */ - put_be32(s, stream->bit_rate); /* avg bit rate */ - put_be32(s, stream->packet_max_size); /* max packet size */ + avio_wb16(s, i); /* stream number */ + avio_wb32(s, stream->bit_rate); /* max bit rate */ + avio_wb32(s, stream->bit_rate); /* avg bit rate */ + avio_wb32(s, stream->packet_max_size); /* max packet size */ if (stream->nb_packets > 0) packet_avg_size = stream->packet_total_size / stream->nb_packets; else packet_avg_size = 0; - put_be32(s, packet_avg_size); /* avg packet size */ - put_be32(s, 0); /* start time */ - put_be32(s, BUFFER_DURATION); /* preroll */ + avio_wb32(s, packet_avg_size); /* avg packet size */ + avio_wb32(s, 0); /* start time */ + avio_wb32(s, BUFFER_DURATION); /* preroll */ /* duration */ if (url_is_streamed(s) || !stream->total_frames) - put_be32(s, (int)(3600 * 1000)); + avio_wb32(s, (int)(3600 * 1000)); else - put_be32(s, (int)(stream->total_frames * 1000 / stream->frame_rate)); + avio_wb32(s, (int)(stream->total_frames * 1000 / stream->frame_rate)); put_str8(s, desc); put_str8(s, mimetype); - put_be32(s, codec_data_size); + avio_wb32(s, codec_data_size); if (stream->enc->codec_type == AVMEDIA_TYPE_AUDIO) { int coded_frame_size, fscode, sample_rate; @@ -183,13 +184,13 @@ static int rv10_write_header(AVFormatContext *ctx, coded_frame_size = (stream->enc->bit_rate * stream->enc->frame_size) / (8 * sample_rate); /* audio codec info */ - put_tag(s, ".ra"); - put_byte(s, 0xfd); - put_be32(s, 0x00040000); /* version */ - put_tag(s, ".ra4"); - put_be32(s, 0x01b53530); /* stream length */ - put_be16(s, 4); /* unknown */ - put_be32(s, 0x39); /* header size */ + avio_write(s, ".ra", 3); + avio_w8(s, 0xfd); + avio_wb32(s, 0x00040000); /* version */ + ffio_wfourcc(s, ".ra4"); + avio_wb32(s, 0x01b53530); /* stream length */ + avio_wb16(s, 4); /* unknown */ + avio_wb32(s, 0x39); /* header size */ switch(sample_rate) { case 48000: @@ -208,56 +209,57 @@ static int rv10_write_header(AVFormatContext *ctx, case 8000: fscode = 3; } - put_be16(s, fscode); /* codec additional info, for AC-3, seems + avio_wb16(s, fscode); /* codec additional info, for AC-3, seems to be a frequency code */ /* special hack to compensate rounding errors... */ if (coded_frame_size == 557) coded_frame_size--; - put_be32(s, coded_frame_size); /* frame length */ - put_be32(s, 0x51540); /* unknown */ - put_be32(s, 0x249f0); /* unknown */ - put_be32(s, 0x249f0); /* unknown */ - put_be16(s, 0x01); + avio_wb32(s, coded_frame_size); /* frame length */ + avio_wb32(s, 0x51540); /* unknown */ + avio_wb32(s, 0x249f0); /* unknown */ + avio_wb32(s, 0x249f0); /* unknown */ + avio_wb16(s, 0x01); /* frame length : seems to be very important */ - put_be16(s, coded_frame_size); - put_be32(s, 0); /* unknown */ - put_be16(s, stream->enc->sample_rate); /* sample rate */ - put_be32(s, 0x10); /* unknown */ - put_be16(s, stream->enc->channels); + avio_wb16(s, coded_frame_size); + avio_wb32(s, 0); /* unknown */ + avio_wb16(s, stream->enc->sample_rate); /* sample rate */ + avio_wb32(s, 0x10); /* unknown */ + avio_wb16(s, stream->enc->channels); put_str8(s, "Int0"); /* codec name */ if (stream->enc->codec_tag) { - put_byte(s, 4); /* tag length */ - put_le32(s, stream->enc->codec_tag); + avio_w8(s, 4); /* tag length */ + avio_wl32(s, stream->enc->codec_tag); } else { av_log(ctx, AV_LOG_ERROR, "Invalid codec tag\n"); return -1; } - put_be16(s, 0); /* title length */ - put_be16(s, 0); /* author length */ - put_be16(s, 0); /* copyright length */ - put_byte(s, 0); /* end of header */ + avio_wb16(s, 0); /* title length */ + avio_wb16(s, 0); /* author length */ + avio_wb16(s, 0); /* copyright length */ + avio_w8(s, 0); /* end of header */ } else { /* video codec info */ - put_be32(s,34); /* size */ + avio_wb32(s,34); /* size */ + ffio_wfourcc(s, "VIDO"); if(stream->enc->codec_id == CODEC_ID_RV10) - put_tag(s,"VIDORV10"); + ffio_wfourcc(s,"RV10"); else - put_tag(s,"VIDORV20"); - put_be16(s, stream->enc->width); - put_be16(s, stream->enc->height); - put_be16(s, (int) stream->frame_rate); /* frames per seconds ? */ - put_be32(s,0); /* unknown meaning */ - put_be16(s, (int) stream->frame_rate); /* unknown meaning */ - put_be32(s,0); /* unknown meaning */ - put_be16(s, 8); /* unknown meaning */ + ffio_wfourcc(s,"RV20"); + avio_wb16(s, stream->enc->width); + avio_wb16(s, stream->enc->height); + avio_wb16(s, (int) stream->frame_rate); /* frames per seconds ? */ + avio_wb32(s,0); /* unknown meaning */ + avio_wb16(s, (int) stream->frame_rate); /* unknown meaning */ + avio_wb32(s,0); /* unknown meaning */ + avio_wb16(s, 8); /* unknown meaning */ /* Seems to be the codec version: only use basic H263. The next versions seems to add a diffential DC coding as in MPEG... nothing new under the sun */ if(stream->enc->codec_id == CODEC_ID_RV10) - put_be32(s,0x10000000); + avio_wb32(s,0x10000000); else - put_be32(s,0x20103001); - //put_be32(s,0x10003000); + avio_wb32(s,0x20103001); + //avio_wb32(s,0x10003000); } } @@ -270,12 +272,12 @@ static int rv10_write_header(AVFormatContext *ctx, data_offset_ptr[3] = data_pos; /* data stream */ - put_tag(s,"DATA"); - put_be32(s,data_size + 10 + 8); - put_be16(s,0); + ffio_wfourcc(s, "DATA"); + avio_wb32(s,data_size + 10 + 8); + avio_wb16(s,0); - put_be32(s, nb_packets); /* number of packets */ - put_be32(s,0); /* next data header */ + avio_wb32(s, nb_packets); /* number of packets */ + avio_wb32(s,0); /* next data header */ return 0; } @@ -283,20 +285,20 @@ static void write_packet_header(AVFormatContext *ctx, StreamInfo *stream, int length, int key_frame) { int timestamp; - ByteIOContext *s = ctx->pb; + AVIOContext *s = ctx->pb; stream->nb_packets++; stream->packet_total_size += length; if (length > stream->packet_max_size) stream->packet_max_size = length; - put_be16(s,0); /* version */ - put_be16(s,length + 12); - put_be16(s, stream->num); /* stream number */ + avio_wb16(s,0); /* version */ + avio_wb16(s,length + 12); + avio_wb16(s, stream->num); /* stream number */ timestamp = (1000 * (float)stream->nb_frames) / stream->frame_rate; - put_be32(s, timestamp); /* timestamp */ - put_byte(s, 0); /* reserved */ - put_byte(s, key_frame ? 2 : 0); /* flags */ + avio_wb32(s, timestamp); /* timestamp */ + avio_w8(s, 0); /* reserved */ + avio_w8(s, key_frame ? 2 : 0); /* flags */ } static int rm_write_header(AVFormatContext *s) @@ -347,7 +349,7 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int { uint8_t *buf1; RMMuxContext *rm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; StreamInfo *stream = rm->audio_stream; int i; @@ -362,9 +364,9 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int buf1[i] = buf[i+1]; buf1[i+1] = buf[i]; } - put_buffer(pb, buf1, size); + avio_write(pb, buf1, size); } else { - put_buffer(pb, buf, size); + avio_write(pb, buf, size); } put_flush_packet(pb); stream->nb_frames++; @@ -375,7 +377,7 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int flags) { RMMuxContext *rm = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; StreamInfo *stream = rm->video_stream; int key_frame = !!(flags & AV_PKT_FLAG_KEY); @@ -386,31 +388,31 @@ static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int #if 1 write_packet_header(s, stream, size + 7 + (size >= 0x4000)*4, key_frame); /* bit 7: '1' if final packet of a frame converted in several packets */ - put_byte(pb, 0x81); + avio_w8(pb, 0x81); /* bit 7: '1' if I frame. bits 6..0 : sequence number in current frame starting from 1 */ if (key_frame) { - put_byte(pb, 0x81); + avio_w8(pb, 0x81); } else { - put_byte(pb, 0x01); + avio_w8(pb, 0x01); } if(size >= 0x4000){ - put_be32(pb, size); /* total frame size */ - put_be32(pb, size); /* offset from the start or the end */ + avio_wb32(pb, size); /* total frame size */ + avio_wb32(pb, size); /* offset from the start or the end */ }else{ - put_be16(pb, 0x4000 | size); /* total frame size */ - put_be16(pb, 0x4000 | size); /* offset from the start or the end */ + avio_wb16(pb, 0x4000 | size); /* total frame size */ + avio_wb16(pb, 0x4000 | size); /* offset from the start or the end */ } #else /* full frame */ write_packet_header(s, size + 6); - put_byte(pb, 0xc0); - put_be16(pb, 0x4000 + size); /* total frame size */ - put_be16(pb, 0x4000 + packet_number * 126); /* position in stream */ + avio_w8(pb, 0xc0); + avio_wb16(pb, 0x4000 + size); /* total frame size */ + avio_wb16(pb, 0x4000 + packet_number * 126); /* position in stream */ #endif - put_byte(pb, stream->nb_frames & 0xff); + avio_w8(pb, stream->nb_frames & 0xff); - put_buffer(pb, buf, size); + avio_write(pb, buf, size); put_flush_packet(pb); stream->nb_frames++; @@ -430,27 +432,27 @@ static int rm_write_trailer(AVFormatContext *s) { RMMuxContext *rm = s->priv_data; int data_size, index_pos, i; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (!url_is_streamed(s->pb)) { /* end of file: finish to write header */ - index_pos = url_fseek(pb, 0, SEEK_CUR); + index_pos = avio_seek(pb, 0, SEEK_CUR); data_size = index_pos - rm->data_pos; /* FIXME: write index */ /* undocumented end header */ - put_be32(pb, 0); - put_be32(pb, 0); + avio_wb32(pb, 0); + avio_wb32(pb, 0); - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); for(i=0;inb_streams;i++) rm->streams[i].total_frames = rm->streams[i].nb_frames; rv10_write_header(s, data_size, 0); } else { /* undocumented end header */ - put_be32(pb, 0); - put_be32(pb, 0); + avio_wb32(pb, 0); + avio_wb32(pb, 0); } put_flush_packet(pb); return 0; diff --git a/mplayer/ffmpeg/libavformat/rpl.c b/mplayer/ffmpeg/libavformat/rpl.c index 241b541b..9702fc70 100644 --- a/mplayer/ffmpeg/libavformat/rpl.c +++ b/mplayer/ffmpeg/libavformat/rpl.c @@ -47,11 +47,11 @@ typedef struct RPLContext { uint32_t frame_in_part; } RPLContext; -static int read_line(ByteIOContext * pb, char* line, int bufsize) +static int read_line(AVIOContext * pb, char* line, int bufsize) { int i; for (i = 0; i < bufsize - 1; i++) { - int b = get_byte(pb); + int b = avio_r8(pb); if (b == 0) break; if (b == '\n') { @@ -76,7 +76,7 @@ static int32_t read_int(const char* line, const char** endptr, int* error) return result; } -static int32_t read_line_and_int(ByteIOContext * pb, int* error) +static int32_t read_line_and_int(AVIOContext * pb, int* error) { char line[RPL_LINE_LENGTH]; const char *endptr; @@ -110,7 +110,7 @@ static AVRational read_fps(const char* line, int* error) static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; RPLContext *rpl = s->priv_data; AVStream *vst = NULL, *ast = NULL; int total_audio_size; @@ -250,7 +250,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) error |= read_line(pb, line, sizeof(line)); // offset to key frame list // Read the index - url_fseek(pb, chunk_catalog_offset, SEEK_SET); + avio_seek(pb, chunk_catalog_offset, SEEK_SET); total_audio_size = 0; for (i = 0; i < number_of_chunks; i++) { int64_t offset, video_size, audio_size; @@ -274,7 +274,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) { RPLContext *rpl = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream* stream; AVIndexEntry* index_entry; uint32_t ret; @@ -292,7 +292,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) index_entry = &stream->index_entries[rpl->chunk_number]; if (rpl->frame_in_part == 0) - if (url_fseek(pb, index_entry->pos, SEEK_SET) < 0) + if (avio_seek(pb, index_entry->pos, SEEK_SET) < 0) return AVERROR(EIO); if (stream->codec->codec_type == AVMEDIA_TYPE_VIDEO && @@ -301,9 +301,9 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) // multiple frames per chunk in Escape 124 samples. uint32_t frame_size, frame_flags; - frame_flags = get_le32(pb); - frame_size = get_le32(pb); - if (url_fseek(pb, -8, SEEK_CUR) < 0) + frame_flags = avio_rl32(pb); + frame_size = avio_rl32(pb); + if (avio_seek(pb, -8, SEEK_CUR) < 0) return AVERROR(EIO); ret = av_get_packet(pb, pkt, frame_size); diff --git a/mplayer/ffmpeg/libavformat/rsodec.c b/mplayer/ffmpeg/libavformat/rsodec.c index 698f82ed..a34be80c 100644 --- a/mplayer/ffmpeg/libavformat/rsodec.c +++ b/mplayer/ffmpeg/libavformat/rsodec.c @@ -29,16 +29,16 @@ static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int id, rate, bps; unsigned int size; enum CodecID codec; AVStream *st; - id = get_be16(pb); - size = get_be16(pb); - rate = get_be16(pb); - get_be16(pb); /* play mode ? (0x0000 = don't loop) */ + id = avio_rb16(pb); + size = avio_rb16(pb); + rate = avio_rb16(pb); + avio_rb16(pb); /* play mode ? (0x0000 = don't loop) */ codec = ff_codec_get_id(ff_codec_rso_tags, id); diff --git a/mplayer/ffmpeg/libavformat/rsoenc.c b/mplayer/ffmpeg/libavformat/rsoenc.c index 7b138986..c776a1ac 100644 --- a/mplayer/ffmpeg/libavformat/rsoenc.c +++ b/mplayer/ffmpeg/libavformat/rsoenc.c @@ -27,7 +27,7 @@ static int rso_write_header(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; if (!enc->codec_tag) @@ -55,10 +55,10 @@ static int rso_write_header(AVFormatContext *s) } /* format header */ - put_be16(pb, enc->codec_tag); /* codec ID */ - put_be16(pb, 0); /* data size, will be written at EOF */ - put_be16(pb, enc->sample_rate); - put_be16(pb, 0x0000); /* play mode ? (0x0000 = don't loop) */ + avio_wb16(pb, enc->codec_tag); /* codec ID */ + avio_wb16(pb, 0); /* data size, will be written at EOF */ + avio_wb16(pb, enc->sample_rate); + avio_wb16(pb, 0x0000); /* play mode ? (0x0000 = don't loop) */ put_flush_packet(pb); @@ -67,13 +67,13 @@ static int rso_write_header(AVFormatContext *s) static int rso_write_packet(AVFormatContext *s, AVPacket *pkt) { - put_buffer(s->pb, pkt->data, pkt->size); + avio_write(s->pb, pkt->data, pkt->size); return 0; } static int rso_write_trailer(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t file_size; uint16_t coded_file_size; @@ -91,9 +91,9 @@ static int rso_write_trailer(AVFormatContext *s) } /* update file size */ - url_fseek(pb, 2, SEEK_SET); - put_be16(pb, coded_file_size); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, 2, SEEK_SET); + avio_wb16(pb, coded_file_size); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); diff --git a/mplayer/ffmpeg/libavformat/rtmpproto.c b/mplayer/ffmpeg/libavformat/rtmpproto.c index 3ad49d62..748aab33 100644 --- a/mplayer/ffmpeg/libavformat/rtmpproto.c +++ b/mplayer/ffmpeg/libavformat/rtmpproto.c @@ -923,9 +923,9 @@ static int rtmp_read(URLContext *s, uint8_t *buf, int size) return orig_size; } -static int rtmp_write(URLContext *h, const uint8_t *buf, int size) +static int rtmp_write(URLContext *s, const uint8_t *buf, int size) { - RTMPContext *rt = h->priv_data; + RTMPContext *rt = s->priv_data; int size_temp = size; int pktsize, pkttype; uint32_t ts; diff --git a/mplayer/ffmpeg/libavformat/rtpdec.c b/mplayer/ffmpeg/libavformat/rtpdec.c index c81ba1cd..b4b8ffcd 100644 --- a/mplayer/ffmpeg/libavformat/rtpdec.c +++ b/mplayer/ffmpeg/libavformat/rtpdec.c @@ -237,7 +237,7 @@ static void rtcp_update_jitter(RTPStatistics *s, uint32_t sent_timestamp, uint32 int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) { - ByteIOContext *pb; + AVIOContext *pb; uint8_t *buf; int len; int rtcp_bytes; @@ -268,12 +268,12 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) return -1; // Receiver Report - put_byte(pb, (RTP_VERSION << 6) + 1); /* 1 report block */ - put_byte(pb, RTCP_RR); - put_be16(pb, 7); /* length in words - 1 */ + avio_w8(pb, (RTP_VERSION << 6) + 1); /* 1 report block */ + avio_w8(pb, RTCP_RR); + avio_wb16(pb, 7); /* length in words - 1 */ // our own SSRC: we use the server's SSRC + 1 to avoid conflicts - put_be32(pb, s->ssrc + 1); - put_be32(pb, s->ssrc); // server SSRC + avio_wb32(pb, s->ssrc + 1); + avio_wb32(pb, s->ssrc); // server SSRC // some placeholders we should really fill... // RFC 1889/p64 extended_max= stats->cycles + stats->max_seq; @@ -290,34 +290,34 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) fraction= (fraction<<24) | lost; - put_be32(pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */ - put_be32(pb, extended_max); /* max sequence received */ - put_be32(pb, stats->jitter>>4); /* jitter */ + avio_wb32(pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */ + avio_wb32(pb, extended_max); /* max sequence received */ + avio_wb32(pb, stats->jitter>>4); /* jitter */ if(s->last_rtcp_ntp_time==AV_NOPTS_VALUE) { - put_be32(pb, 0); /* last SR timestamp */ - put_be32(pb, 0); /* delay since last SR */ + avio_wb32(pb, 0); /* last SR timestamp */ + avio_wb32(pb, 0); /* delay since last SR */ } else { uint32_t middle_32_bits= s->last_rtcp_ntp_time>>16; // this is valid, right? do we need to handle 64 bit values special? uint32_t delay_since_last= ntp_time - s->last_rtcp_ntp_time; - put_be32(pb, middle_32_bits); /* last SR timestamp */ - put_be32(pb, delay_since_last); /* delay since last SR */ + avio_wb32(pb, middle_32_bits); /* last SR timestamp */ + avio_wb32(pb, delay_since_last); /* delay since last SR */ } // CNAME - put_byte(pb, (RTP_VERSION << 6) + 1); /* 1 report block */ - put_byte(pb, RTCP_SDES); + avio_w8(pb, (RTP_VERSION << 6) + 1); /* 1 report block */ + avio_w8(pb, RTCP_SDES); len = strlen(s->hostname); - put_be16(pb, (6 + len + 3) / 4); /* length in words - 1 */ - put_be32(pb, s->ssrc); - put_byte(pb, 0x01); - put_byte(pb, len); - put_buffer(pb, s->hostname, len); + avio_wb16(pb, (6 + len + 3) / 4); /* length in words - 1 */ + avio_wb32(pb, s->ssrc); + avio_w8(pb, 0x01); + avio_w8(pb, len); + avio_write(pb, s->hostname, len); // padding for (len = (6 + len) % 4; len % 4; len++) { - put_byte(pb, 0); + avio_w8(pb, 0); } put_flush_packet(pb); @@ -334,7 +334,7 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count) void rtp_send_punch_packets(URLContext* rtp_handle) { - ByteIOContext *pb; + AVIOContext *pb; uint8_t *buf; int len; @@ -342,11 +342,11 @@ void rtp_send_punch_packets(URLContext* rtp_handle) if (url_open_dyn_buf(&pb) < 0) return; - put_byte(pb, (RTP_VERSION << 6)); - put_byte(pb, 0); /* Payload type */ - put_be16(pb, 0); /* Seq */ - put_be32(pb, 0); /* Timestamp */ - put_be32(pb, 0); /* SSRC */ + avio_w8(pb, (RTP_VERSION << 6)); + avio_w8(pb, 0); /* Payload type */ + avio_wb16(pb, 0); /* Seq */ + avio_wb32(pb, 0); /* Timestamp */ + avio_wb32(pb, 0); /* SSRC */ put_flush_packet(pb); len = url_close_dyn_buf(pb, &buf); @@ -358,10 +358,10 @@ void rtp_send_punch_packets(URLContext* rtp_handle) if (url_open_dyn_buf(&pb) < 0) return; - put_byte(pb, (RTP_VERSION << 6)); - put_byte(pb, RTCP_RR); /* receiver report */ - put_be16(pb, 1); /* length in words - 1 */ - put_be32(pb, 0); /* our own SSRC */ + avio_w8(pb, (RTP_VERSION << 6)); + avio_w8(pb, RTCP_RR); /* receiver report */ + avio_wb16(pb, 1); /* length in words - 1 */ + avio_wb32(pb, 0); /* our own SSRC */ put_flush_packet(pb); len = url_close_dyn_buf(pb, &buf); diff --git a/mplayer/ffmpeg/libavformat/rtpdec_asf.c b/mplayer/ffmpeg/libavformat/rtpdec_asf.c index db09f8f3..7d0bf672 100644 --- a/mplayer/ffmpeg/libavformat/rtpdec_asf.c +++ b/mplayer/ffmpeg/libavformat/rtpdec_asf.c @@ -32,6 +32,7 @@ #include "rtpdec_formats.h" #include "rtsp.h" #include "asf.h" +#include "avio_internal.h" /** * From MSDN 2.2.1.4, we learn that ASF data packets over RTP should not @@ -72,7 +73,7 @@ static int rtp_asf_fix_header(uint8_t *buf, int len) } /** - * The following code is basically a buffered ByteIOContext, + * The following code is basically a buffered AVIOContext, * with the added benefit of returning -EAGAIN (instead of 0) * on packet boundaries, such that the ASF demuxer can return * safely and resume business at the next packet. @@ -82,9 +83,9 @@ static int packetizer_read(void *opaque, uint8_t *buf, int buf_size) return AVERROR(EAGAIN); } -static void init_packetizer(ByteIOContext *pb, uint8_t *buf, int len) +static void init_packetizer(AVIOContext *pb, uint8_t *buf, int len) { - init_put_byte(pb, buf, len, 0, NULL, packetizer_read, NULL, NULL); + ffio_init_context(pb, buf, len, 0, NULL, packetizer_read, NULL, NULL); /* this "fills" the buffer with its current content */ pb->pos = len; @@ -95,7 +96,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) { int ret = 0; if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) { - ByteIOContext pb; + AVIOContext pb; RTSPState *rt = s->priv_data; int len = strlen(p) * 6 / 8; char *buf = av_mallocz(len); @@ -147,7 +148,7 @@ static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index, } struct PayloadContext { - ByteIOContext *pktbuf, pb; + AVIOContext *pktbuf, pb; uint8_t *buf; }; @@ -161,7 +162,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, uint32_t *timestamp, const uint8_t *buf, int len, int flags) { - ByteIOContext *pb = &asf->pb; + AVIOContext *pb = &asf->pb; int res, mflags, len_off; RTSPState *rt = s->priv_data; @@ -176,21 +177,21 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, av_freep(&asf->buf); - init_put_byte(pb, buf, len, 0, NULL, NULL, NULL, NULL); + ffio_init_context(pb, buf, len, 0, NULL, NULL, NULL, NULL); while (url_ftell(pb) + 4 < len) { int start_off = url_ftell(pb); - mflags = get_byte(pb); + mflags = avio_r8(pb); if (mflags & 0x80) flags |= RTP_FLAG_KEY; - len_off = get_be24(pb); + len_off = avio_rb24(pb); if (mflags & 0x20) /**< relative timestamp */ - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); if (mflags & 0x10) /**< has duration */ - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); if (mflags & 0x8) /**< has location ID */ - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); off = url_ftell(pb); if (!(mflags & 0x40)) { @@ -212,8 +213,8 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, if (!asf->pktbuf) return AVERROR(EIO); - put_buffer(asf->pktbuf, buf + off, len - off); - url_fskip(pb, len - off); + avio_write(asf->pktbuf, buf + off, len - off); + avio_seek(pb, len - off, SEEK_CUR); if (!(flags & RTP_FLAG_MARKER)) return -1; out_len = url_close_dyn_buf(asf->pktbuf, &asf->buf); @@ -233,7 +234,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, asf->buf = av_realloc(asf->buf, out_len); memcpy(asf->buf + prev_len, buf + off, FFMIN(cur_len, len - off)); - url_fskip(pb, cur_len); + avio_seek(pb, cur_len, SEEK_CUR); } } @@ -288,7 +289,7 @@ RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \ .open = asfrtp_new_context, \ .close = asfrtp_free_context, \ .parse_packet = asfrtp_parse_packet, \ -}; +} RTP_ASF_HANDLER(asf_pfv, "x-asf-pf", AVMEDIA_TYPE_VIDEO); RTP_ASF_HANDLER(asf_pfa, "x-asf-pf", AVMEDIA_TYPE_AUDIO); diff --git a/mplayer/ffmpeg/libavformat/rtpdec_latm.c b/mplayer/ffmpeg/libavformat/rtpdec_latm.c index 8ed42a7a..c6d865a6 100644 --- a/mplayer/ffmpeg/libavformat/rtpdec_latm.c +++ b/mplayer/ffmpeg/libavformat/rtpdec_latm.c @@ -26,7 +26,7 @@ #include struct PayloadContext { - ByteIOContext *dyn_buf; + AVIOContext *dyn_buf; uint8_t *buf; int pos, len; uint32_t timestamp; @@ -68,7 +68,7 @@ static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data, if ((ret = url_open_dyn_buf(&data->dyn_buf)) < 0) return ret; } - put_buffer(data->dyn_buf, buf, len); + avio_write(data->dyn_buf, buf, len); if (!(flags & RTP_FLAG_MARKER)) return AVERROR(EAGAIN); diff --git a/mplayer/ffmpeg/libavformat/rtpdec_mpeg4.c b/mplayer/ffmpeg/libavformat/rtpdec_mpeg4.c index 137dbd26..5498d1c4 100644 --- a/mplayer/ffmpeg/libavformat/rtpdec_mpeg4.c +++ b/mplayer/ffmpeg/libavformat/rtpdec_mpeg4.c @@ -111,8 +111,7 @@ static int parse_fmtp_config(AVCodecContext * codec, char *value) { /* decode the hexa encoded parameter */ int len = ff_hex_to_data(NULL, value); - if (codec->extradata) - av_free(codec->extradata); + av_free(codec->extradata); codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); if (!codec->extradata) return AVERROR(ENOMEM); diff --git a/mplayer/ffmpeg/libavformat/rtpdec_qt.c b/mplayer/ffmpeg/libavformat/rtpdec_qt.c index 5cca0760..5cf5223c 100644 --- a/mplayer/ffmpeg/libavformat/rtpdec_qt.c +++ b/mplayer/ffmpeg/libavformat/rtpdec_qt.c @@ -26,6 +26,7 @@ */ #include "avformat.h" +#include "avio_internal.h" #include "rtp.h" #include "rtpdec.h" #include "isom.h" @@ -42,7 +43,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, uint32_t *timestamp, const uint8_t *buf, int len, int flags) { - ByteIOContext pb; + AVIOContext pb; GetBitContext gb; int packing_scheme, has_payload_desc, has_packet_info, alen, has_marker_bit = flags & RTP_FLAG_MARKER; @@ -69,7 +70,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, * http://developer.apple.com/quicktime/icefloe/dispatch026.html */ init_get_bits(&gb, buf, len << 3); - init_put_byte(&pb, buf, len, 0, NULL, NULL, NULL, NULL); + ffio_init_context(&pb, buf, len, 0, NULL, NULL, NULL, NULL); if (len < 4) return AVERROR_INVALIDDATA; @@ -102,21 +103,21 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, skip_bits(&gb, 12); // reserved data_len = get_bits(&gb, 16); - url_fseek(&pb, pos + 4, SEEK_SET); - tag = get_le32(&pb); - if ((st->codec->codec_type == CODEC_TYPE_VIDEO && + avio_seek(&pb, pos + 4, SEEK_SET); + tag = avio_rl32(&pb); + if ((st->codec->codec_type == AVMEDIA_TYPE_VIDEO && tag != MKTAG('v','i','d','e')) || - (st->codec->codec_type == CODEC_TYPE_AUDIO && + (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && tag != MKTAG('s','o','u','n'))) return AVERROR_INVALIDDATA; - av_set_pts_info(st, 32, 1, get_be32(&pb)); + av_set_pts_info(st, 32, 1, avio_rb32(&pb)); if (pos + data_len > len) return AVERROR_INVALIDDATA; /* TLVs */ while (url_ftell(&pb) + 4 < pos + data_len) { - int tlv_len = get_be16(&pb); - tag = get_le16(&pb); + int tlv_len = avio_rb16(&pb); + tag = avio_rl16(&pb); if (url_ftell(&pb) + tlv_len > pos + data_len) return AVERROR_INVALIDDATA; @@ -148,15 +149,15 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, break; } default: - url_fskip(&pb, tlv_len); + avio_seek(&pb, tlv_len, SEEK_CUR); break; } } /* 32-bit alignment */ - url_fskip(&pb, ((url_ftell(&pb) + 3) & ~3) - url_ftell(&pb)); + avio_seek(&pb, ((url_ftell(&pb) + 3) & ~3) - url_ftell(&pb), SEEK_CUR); } else - url_fseek(&pb, 4, SEEK_SET); + avio_seek(&pb, 4, SEEK_SET); if (has_packet_info) { av_log_missing_feature(s, "RTP-X-QT with packet specific info", 1); @@ -246,9 +247,9 @@ RTPDynamicProtocolHandler ff_ ## m ## _rtp_ ## n ## _handler = { \ .open = qt_rtp_new, \ .close = qt_rtp_free, \ .parse_packet = qt_rtp_parse_packet, \ -}; +} -RTP_QT_HANDLER(qt, vid, "X-QT", CODEC_TYPE_VIDEO); -RTP_QT_HANDLER(qt, aud, "X-QT", CODEC_TYPE_AUDIO); -RTP_QT_HANDLER(quicktime, vid, "X-QUICKTIME", CODEC_TYPE_VIDEO); -RTP_QT_HANDLER(quicktime, aud, "X-QUICKTIME", CODEC_TYPE_AUDIO); +RTP_QT_HANDLER(qt, vid, "X-QT", AVMEDIA_TYPE_VIDEO); +RTP_QT_HANDLER(qt, aud, "X-QT", AVMEDIA_TYPE_AUDIO); +RTP_QT_HANDLER(quicktime, vid, "X-QUICKTIME", AVMEDIA_TYPE_VIDEO); +RTP_QT_HANDLER(quicktime, aud, "X-QUICKTIME", AVMEDIA_TYPE_AUDIO); diff --git a/mplayer/ffmpeg/libavformat/rtpdec_svq3.c b/mplayer/ffmpeg/libavformat/rtpdec_svq3.c index 79a57758..a4fad1cc 100644 --- a/mplayer/ffmpeg/libavformat/rtpdec_svq3.c +++ b/mplayer/ffmpeg/libavformat/rtpdec_svq3.c @@ -33,7 +33,7 @@ #include "rtpdec_formats.h" struct PayloadContext { - ByteIOContext *pktbuf; + AVIOContext *pktbuf; int64_t timestamp; }; @@ -94,7 +94,7 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv, if (!sv->pktbuf) return AVERROR_INVALIDDATA; - put_buffer(sv->pktbuf, buf, len); + avio_write(sv->pktbuf, buf, len); if (end_packet) { av_init_packet(pkt); diff --git a/mplayer/ffmpeg/libavformat/rtpdec_vp8.c b/mplayer/ffmpeg/libavformat/rtpdec_vp8.c index b18017b2..3b1ee137 100644 --- a/mplayer/ffmpeg/libavformat/rtpdec_vp8.c +++ b/mplayer/ffmpeg/libavformat/rtpdec_vp8.c @@ -31,7 +31,7 @@ #include "rtpdec_formats.h" struct PayloadContext { - ByteIOContext *data; + AVIOContext *data; uint32_t timestamp; int is_keyframe; }; @@ -111,7 +111,7 @@ static int vp8_handle_packet(AVFormatContext *ctx, } } - put_buffer(vp8->data, buf, au_len); + avio_write(vp8->data, buf, au_len); buf += au_len; len -= au_len; } diff --git a/mplayer/ffmpeg/libavformat/rtpdec_xiph.c b/mplayer/ffmpeg/libavformat/rtpdec_xiph.c index fe17a42b..37e57f50 100644 --- a/mplayer/ffmpeg/libavformat/rtpdec_xiph.c +++ b/mplayer/ffmpeg/libavformat/rtpdec_xiph.c @@ -42,7 +42,7 @@ struct PayloadContext { unsigned ident; ///< 24-bit stream configuration identifier uint32_t timestamp; - ByteIOContext* fragment; ///< buffer for split payloads + AVIOContext* fragment; ///< buffer for split payloads uint8_t *split_buf; int split_pos, split_buf_len, split_buf_size; int split_pkts; @@ -179,7 +179,7 @@ static int xiph_handle_packet(AVFormatContext * ctx, if((res = url_open_dyn_buf(&data->fragment)) < 0) return res; - put_buffer(data->fragment, buf, pkt_len); + avio_write(data->fragment, buf, pkt_len); data->timestamp = *timestamp; } else { @@ -198,7 +198,7 @@ static int xiph_handle_packet(AVFormatContext * ctx, } // copy data to fragment buffer - put_buffer(data->fragment, buf, pkt_len); + avio_write(data->fragment, buf, pkt_len); if (fragmented == 3) { // end of xiph data packet diff --git a/mplayer/ffmpeg/libavformat/rtpenc.c b/mplayer/ffmpeg/libavformat/rtpenc.c index 22e68bac..b32a9a40 100644 --- a/mplayer/ffmpeg/libavformat/rtpenc.c +++ b/mplayer/ffmpeg/libavformat/rtpenc.c @@ -197,15 +197,15 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time) s->last_rtcp_ntp_time = ntp_time; rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 1000000}, s1->streams[0]->time_base) + s->base_timestamp; - put_byte(s1->pb, (RTP_VERSION << 6)); - put_byte(s1->pb, RTCP_SR); - put_be16(s1->pb, 6); /* length in words - 1 */ - put_be32(s1->pb, s->ssrc); - put_be32(s1->pb, ntp_time / 1000000); - put_be32(s1->pb, ((ntp_time % 1000000) << 32) / 1000000); - put_be32(s1->pb, rtp_ts); - put_be32(s1->pb, s->packet_count); - put_be32(s1->pb, s->octet_count); + avio_w8(s1->pb, (RTP_VERSION << 6)); + avio_w8(s1->pb, RTCP_SR); + avio_wb16(s1->pb, 6); /* length in words - 1 */ + avio_wb32(s1->pb, s->ssrc); + avio_wb32(s1->pb, ntp_time / 1000000); + avio_wb32(s1->pb, ((ntp_time % 1000000) << 32) / 1000000); + avio_wb32(s1->pb, rtp_ts); + avio_wb32(s1->pb, s->packet_count); + avio_wb32(s1->pb, s->octet_count); put_flush_packet(s1->pb); } @@ -218,13 +218,13 @@ void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m) av_dlog(s1, "rtp_send_data size=%d\n", len); /* build the RTP header */ - put_byte(s1->pb, (RTP_VERSION << 6)); - put_byte(s1->pb, (s->payload_type & 0x7f) | ((m & 0x01) << 7)); - put_be16(s1->pb, s->seq); - put_be32(s1->pb, s->timestamp); - put_be32(s1->pb, s->ssrc); + avio_w8(s1->pb, (RTP_VERSION << 6)); + avio_w8(s1->pb, (s->payload_type & 0x7f) | ((m & 0x01) << 7)); + avio_wb16(s1->pb, s->seq); + avio_wb32(s1->pb, s->timestamp); + avio_wb32(s1->pb, s->ssrc); - put_buffer(s1->pb, buf1, len); + avio_write(s1->pb, buf1, len); put_flush_packet(s1->pb); s->seq++; diff --git a/mplayer/ffmpeg/libavformat/rtpenc_chain.c b/mplayer/ffmpeg/libavformat/rtpenc_chain.c index 10d9df20..84611e69 100644 --- a/mplayer/ffmpeg/libavformat/rtpenc_chain.c +++ b/mplayer/ffmpeg/libavformat/rtpenc_chain.c @@ -50,11 +50,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, /* Set the synchronized start time. */ rtpctx->start_time_realtime = s->start_time_realtime; - /* Remove the local codec, link to the original codec - * context instead, to give the rtp muxer access to - * codec parameters. */ - av_free(rtpctx->streams[0]->codec); - rtpctx->streams[0]->codec = st->codec; + avcodec_copy_context(rtpctx->streams[0]->codec, st->codec); if (handle) { url_fdopen(&rtpctx->pb, handle); @@ -64,19 +60,16 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, if (ret) { if (handle) { - url_fclose(rtpctx->pb); + avio_close(rtpctx->pb); } else { uint8_t *ptr; url_close_dyn_buf(rtpctx->pb, &ptr); av_free(ptr); } - av_free(rtpctx->streams[0]); - av_free(rtpctx); + avformat_free_context(rtpctx); return NULL; } - /* Copy the RTP AVStream timebase back to the original AVStream */ - st->time_base = rtpctx->streams[0]->time_base; return rtpctx; } diff --git a/mplayer/ffmpeg/libavformat/rtpproto.c b/mplayer/ffmpeg/libavformat/rtpproto.c index aa2cc377..269b1b27 100644 --- a/mplayer/ffmpeg/libavformat/rtpproto.c +++ b/mplayer/ffmpeg/libavformat/rtpproto.c @@ -24,6 +24,7 @@ * RTP protocol */ +#include "libavutil/parseutils.h" #include "libavutil/avstring.h" #include "avformat.h" #include "rtpdec.h" @@ -161,25 +162,25 @@ static int rtp_open(URLContext *h, const char *uri, int flags) p = strchr(uri, '?'); if (p) { - if (find_info_tag(buf, sizeof(buf), "ttl", p)) { + if (av_find_info_tag(buf, sizeof(buf), "ttl", p)) { ttl = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "rtcpport", p)) { + if (av_find_info_tag(buf, sizeof(buf), "rtcpport", p)) { rtcp_port = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "localport", p)) { + if (av_find_info_tag(buf, sizeof(buf), "localport", p)) { local_rtp_port = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "localrtpport", p)) { + if (av_find_info_tag(buf, sizeof(buf), "localrtpport", p)) { local_rtp_port = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "localrtcpport", p)) { + if (av_find_info_tag(buf, sizeof(buf), "localrtcpport", p)) { local_rtcp_port = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) { + if (av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) { max_packet_size = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "connect", p)) { + if (av_find_info_tag(buf, sizeof(buf), "connect", p)) { connect = strtol(buf, NULL, 10); } } @@ -230,8 +231,8 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) len = recvfrom (s->rtp_fd, buf, size, 0, (struct sockaddr *)&from, &from_len); if (len < 0) { - if (ff_neterrno() == FF_NETERROR(EAGAIN) || - ff_neterrno() == FF_NETERROR(EINTR)) + if (ff_neterrno() == AVERROR(EAGAIN) || + ff_neterrno() == AVERROR(EINTR)) continue; return AVERROR(EIO); } @@ -250,8 +251,8 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) len = recvfrom (s->rtcp_fd, buf, size, 0, (struct sockaddr *)&from, &from_len); if (len < 0) { - if (ff_neterrno() == FF_NETERROR(EAGAIN) || - ff_neterrno() == FF_NETERROR(EINTR)) + if (ff_neterrno() == AVERROR(EAGAIN) || + ff_neterrno() == AVERROR(EINTR)) continue; return AVERROR(EIO); } @@ -263,15 +264,15 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) len = recvfrom (s->rtp_fd, buf, size, 0, (struct sockaddr *)&from, &from_len); if (len < 0) { - if (ff_neterrno() == FF_NETERROR(EAGAIN) || - ff_neterrno() == FF_NETERROR(EINTR)) + if (ff_neterrno() == AVERROR(EAGAIN) || + ff_neterrno() == AVERROR(EINTR)) continue; return AVERROR(EIO); } break; } } else if (n < 0) { - if (ff_neterrno() == FF_NETERROR(EINTR)) + if (ff_neterrno() == AVERROR(EINTR)) continue; return AVERROR(EIO); } diff --git a/mplayer/ffmpeg/libavformat/rtsp.c b/mplayer/ffmpeg/libavformat/rtsp.c index 9a6d6ad2..a24f12ba 100644 --- a/mplayer/ffmpeg/libavformat/rtsp.c +++ b/mplayer/ffmpeg/libavformat/rtsp.c @@ -22,8 +22,10 @@ #include "libavutil/base64.h" #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" +#include "libavutil/parseutils.h" #include "libavutil/random_seed.h" #include "avformat.h" +#include "avio_internal.h" #include #if HAVE_POLL_H @@ -99,11 +101,11 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end) *end = AV_NOPTS_VALUE; get_word_sep(buf, sizeof(buf), "-", &p); - *start = parse_date(buf, 1); + av_parse_time(start, buf, 1); if (*p == '-') { p++; get_word_sep(buf, sizeof(buf), "-", &p); - *end = parse_date(buf, 1); + av_parse_time(end, buf, 1); } // av_log(NULL, AV_LOG_DEBUG, "Range Start: %lld\n", *start); // av_log(NULL, AV_LOG_DEBUG, "Range End: %lld\n", *end); @@ -273,8 +275,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, s1->default_ip = sdp_ip; s1->default_ttl = ttl; } else { - st = s->streams[s->nb_streams - 1]; - rtsp_st = st->priv_data; + rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; rtsp_st->sdp_ip = sdp_ip; rtsp_st->sdp_ttl = ttl; } @@ -323,10 +324,9 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) { /* no corresponding stream */ } else { - st = av_new_stream(s, 0); + st = av_new_stream(s, rt->nb_rtsp_streams - 1); if (!st) return; - st->priv_data = rtsp_st; rtsp_st->stream_index = st->index; st->codec->codec_type = codec_type; if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) { @@ -355,8 +355,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, } else { char proto[32]; /* get the control url */ - st = s->streams[s->nb_streams - 1]; - rtsp_st = st->priv_data; + rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; /* XXX: may need to add full url resolution */ av_url_split(proto, sizeof(proto), NULL, 0, NULL, 0, @@ -377,7 +376,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, get_word(buf1, sizeof(buf1), &p); payload_type = atoi(buf1); st = s->streams[s->nb_streams - 1]; - rtsp_st = st->priv_data; + rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; sdp_parse_rtpmap(s, st, rtsp_st, payload_type, p); } else if (av_strstart(p, "fmtp:", &p) || av_strstart(p, "framesize:", &p)) { @@ -385,9 +384,8 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, // let dynamic protocol handlers have a stab at the line. get_word(buf1, sizeof(buf1), &p); payload_type = atoi(buf1); - for (i = 0; i < s->nb_streams; i++) { - st = s->streams[i]; - rtsp_st = st->priv_data; + for (i = 0; i < rt->nb_rtsp_streams; i++) { + rtsp_st = rt->rtsp_streams[i]; if (rtsp_st->sdp_payload_type == payload_type && rtsp_st->dynamic_handler && rtsp_st->dynamic_handler->parse_sdp_a_line) @@ -417,7 +415,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, if (rt->server_type == RTSP_SERVER_REAL) ff_real_parse_sdp_a_line(s, s->nb_streams - 1, p); - rtsp_st = s->streams[s->nb_streams - 1]->priv_data; + rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; if (rtsp_st->dynamic_handler && rtsp_st->dynamic_handler->parse_sdp_a_line) rtsp_st->dynamic_handler->parse_sdp_a_line(s, @@ -500,12 +498,9 @@ void ff_rtsp_undo_setup(AVFormatContext *s) url_close_dyn_buf(rtpctx->pb, &ptr); av_free(ptr); } else { - url_fclose(rtpctx->pb); + avio_close(rtpctx->pb); } - av_metadata_free(&rtpctx->streams[0]->metadata); - av_metadata_free(&rtpctx->metadata); - av_free(rtpctx->streams[0]); - av_free(rtpctx); + avformat_free_context(rtpctx); } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) ff_rdt_parse_close(rtsp_st->transport_priv); else if (CONFIG_RTPDEC) @@ -532,6 +527,7 @@ void ff_rtsp_close_streams(AVFormatContext *s) if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context) rtsp_st->dynamic_handler->close( rtsp_st->dynamic_protocol_context); + av_free(rtsp_st); } } av_free(rt->rtsp_streams); @@ -1532,7 +1528,7 @@ int ff_rtsp_connect(AVFormatContext *s) goto fail; lower_transport_mask &= ~(1 << lower_transport); if (lower_transport_mask == 0 && err == 1) { - err = FF_NETERROR(EPROTONOSUPPORT); + err = AVERROR(EPROTONOSUPPORT); goto fail; } } while (err); @@ -1619,7 +1615,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, } #endif } else if (n == 0 && ++timeout_cnt >= MAX_TIMEOUTS) { - return FF_NETERROR(ETIMEDOUT); + return AVERROR(ETIMEDOUT); } else if (n < 0 && errno != EINTR) return AVERROR(errno); } @@ -1687,7 +1683,7 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) case RTSP_LOWER_TRANSPORT_UDP: case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: len = udp_read_packet(s, &rtsp_st, rt->recvbuf, RECVBUF_SIZE, wait_end); - if (len >=0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP) + if (len > 0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP) rtp_check_and_send_back_rr(rtsp_st->transport_priv, len); break; } @@ -1788,7 +1784,7 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) /* read the whole sdp file */ /* XXX: better loading */ content = av_malloc(SDP_MAX_SIZE); - size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1); + size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); if (size <= 0) { av_free(content); return AVERROR_INVALIDDATA; @@ -1860,7 +1856,7 @@ static int rtp_read_header(AVFormatContext *s, int payload_type; AVCodecContext codec; struct sockaddr_storage addr; - ByteIOContext pb; + AVIOContext pb; socklen_t addrlen = sizeof(addr); if (!ff_network_init()) @@ -1918,7 +1914,7 @@ static int rtp_read_header(AVFormatContext *s, port, payload_type); av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", sdp); - init_put_byte(&pb, sdp, strlen(sdp), 0, NULL, NULL, NULL, NULL); + ffio_init_context(&pb, sdp, strlen(sdp), 0, NULL, NULL, NULL, NULL); s->pb = &pb; /* sdp_read_header initializes this again */ diff --git a/mplayer/ffmpeg/libavformat/rtsp.h b/mplayer/ffmpeg/libavformat/rtsp.h index 14d3f41e..0fec3cc9 100644 --- a/mplayer/ffmpeg/libavformat/rtsp.h +++ b/mplayer/ffmpeg/libavformat/rtsp.h @@ -193,7 +193,7 @@ enum RTSPServerType { /** * Private data for the RTSP demuxer. * - * @todo Use ByteIOContext instead of URLContext + * @todo Use AVIOContext instead of URLContext */ typedef struct RTSPState { URLContext *rtsp_hd; /* RTSP TCP connection handle */ @@ -218,7 +218,7 @@ typedef struct RTSPState { int64_t seek_timestamp; /* XXX: currently we use unbuffered input */ - // ByteIOContext rtsp_gb; + // AVIOContext rtsp_gb; int seq; /**< RTSP command sequence number */ diff --git a/mplayer/ffmpeg/libavformat/rtspdec.c b/mplayer/ffmpeg/libavformat/rtspdec.c index 45ed7bb9..95b8690f 100644 --- a/mplayer/ffmpeg/libavformat/rtspdec.c +++ b/mplayer/ffmpeg/libavformat/rtspdec.c @@ -283,7 +283,7 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt) for (i = 0; i < rt->nb_rtsp_streams; i++) { rule_nr = 0; for (r = 0; r < s->nb_streams; r++) { - if (s->streams[r]->priv_data == rt->rtsp_streams[i]) { + if (s->streams[r]->id == i) { if (s->streams[r]->discard != AVDISCARD_ALL) { if (!first) av_strlcat(rt->last_subscription, ",", @@ -311,7 +311,7 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt) ret = ff_rtsp_fetch_packet(s, pkt); if (ret < 0) { - if (ret == FF_NETERROR(ETIMEDOUT) && !rt->packets) { + if (ret == AVERROR(ETIMEDOUT) && !rt->packets) { if (rt->lower_transport == RTSP_LOWER_TRANSPORT_UDP && rt->lower_transport_mask & (1 << RTSP_LOWER_TRANSPORT_TCP)) { RTSPMessageHeader reply1, *reply = &reply1; @@ -382,7 +382,7 @@ static int rtsp_read_close(AVFormatContext *s) #if 0 /* NOTE: it is valid to flush the buffer here */ if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) { - url_fclose(&rt->rtsp_gb); + avio_close(&rt->rtsp_gb); } #endif ff_rtsp_send_cmd_async(s, "TEARDOWN", rt->control_uri, NULL); diff --git a/mplayer/ffmpeg/libavformat/rtspenc.c b/mplayer/ffmpeg/libavformat/rtspenc.c index d54be1a5..34deeeb6 100644 --- a/mplayer/ffmpeg/libavformat/rtspenc.c +++ b/mplayer/ffmpeg/libavformat/rtspenc.c @@ -79,14 +79,12 @@ int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr) /* Set up the RTSPStreams for each AVStream */ for (i = 0; i < s->nb_streams; i++) { RTSPStream *rtsp_st; - AVStream *st = s->streams[i]; rtsp_st = av_mallocz(sizeof(RTSPStream)); if (!rtsp_st) return AVERROR(ENOMEM); dynarray_add(&rt->rtsp_streams, &rt->nb_rtsp_streams, rtsp_st); - st->priv_data = rtsp_st; rtsp_st->stream_index = i; av_strlcpy(rtsp_st->control_url, rt->control_uri, sizeof(rtsp_st->control_url)); diff --git a/mplayer/ffmpeg/libavformat/sapdec.c b/mplayer/ffmpeg/libavformat/sapdec.c index 73525f5d..e3cdcea6 100644 --- a/mplayer/ffmpeg/libavformat/sapdec.c +++ b/mplayer/ffmpeg/libavformat/sapdec.c @@ -25,6 +25,7 @@ #include "network.h" #include "os_support.h" #include "internal.h" +#include "avio_internal.h" #if HAVE_POLL_H #include #endif @@ -33,7 +34,7 @@ struct SAPState { URLContext *ann_fd; AVFormatContext *sdp_ctx; - ByteIOContext sdp_pb; + AVIOContext sdp_pb; uint16_t hash; char *sdp; int eof; @@ -142,7 +143,7 @@ static int sap_read_header(AVFormatContext *s, } av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", sap->sdp); - init_put_byte(&sap->sdp_pb, sap->sdp, strlen(sap->sdp), 0, NULL, NULL, + ffio_init_context(&sap->sdp_pb, sap->sdp, strlen(sap->sdp), 0, NULL, NULL, NULL, NULL); infmt = av_find_input_format("sdp"); diff --git a/mplayer/ffmpeg/libavformat/sapenc.c b/mplayer/ffmpeg/libavformat/sapenc.c index b14c511c..bc66adcd 100644 --- a/mplayer/ffmpeg/libavformat/sapenc.c +++ b/mplayer/ffmpeg/libavformat/sapenc.c @@ -20,6 +20,7 @@ */ #include "avformat.h" +#include "libavutil/parseutils.h" #include "libavutil/random_seed.h" #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" @@ -45,11 +46,8 @@ static int sap_write_close(AVFormatContext *s) if (!rtpctx) continue; av_write_trailer(rtpctx); - url_fclose(rtpctx->pb); - av_metadata_free(&rtpctx->streams[0]->metadata); - av_metadata_free(&rtpctx->metadata); - av_free(rtpctx->streams[0]); - av_free(rtpctx); + avio_close(rtpctx->pb); + avformat_free_context(rtpctx); s->streams[i]->priv_data = NULL; } @@ -90,16 +88,16 @@ static int sap_write_header(AVFormatContext *s) option_list = strrchr(path, '?'); if (option_list) { char buf[50]; - if (find_info_tag(buf, sizeof(buf), "announce_port", option_list)) { + if (av_find_info_tag(buf, sizeof(buf), "announce_port", option_list)) { port = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "same_port", option_list)) { + if (av_find_info_tag(buf, sizeof(buf), "same_port", option_list)) { same_port = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "ttl", option_list)) { + if (av_find_info_tag(buf, sizeof(buf), "ttl", option_list)) { ttl = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "announce_addr", option_list)) { + if (av_find_info_tag(buf, sizeof(buf), "announce_addr", option_list)) { av_strlcpy(announce_addr, buf, sizeof(announce_addr)); } } @@ -242,7 +240,7 @@ static int sap_write_packet(AVFormatContext *s, AVPacket *pkt) if (!sap->last_time || now - sap->last_time > 5000000) { int ret = url_write(sap->ann_fd, sap->ann, sap->ann_size); /* Don't abort even if we get "Destination unreachable" */ - if (ret < 0 && ret != FF_NETERROR(ECONNREFUSED)) + if (ret < 0 && ret != AVERROR(ECONNREFUSED)) return ret; sap->last_time = now; } diff --git a/mplayer/ffmpeg/libavformat/sauce.c b/mplayer/ffmpeg/libavformat/sauce.c index 4972d339..ba737df1 100644 --- a/mplayer/ffmpeg/libavformat/sauce.c +++ b/mplayer/ffmpeg/libavformat/sauce.c @@ -30,19 +30,19 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int get_height) { - ByteIOContext *pb = avctx->pb; + AVIOContext *pb = avctx->pb; char buf[36]; int datatype, filetype, t1, t2, nb_comments, flags; uint64_t start_pos = url_fsize(pb) - 128; - url_fseek(pb, start_pos, SEEK_SET); - if (get_buffer(pb, buf, 7) != 7) + avio_seek(pb, start_pos, SEEK_SET); + if (avio_read(pb, buf, 7) != 7) return -1; if (memcmp(buf, "SAUCE00", 7)) return -1; #define GET_SAUCE_META(name,size) \ - if (get_buffer(pb, buf, size) == size && buf[0]) { \ + if (avio_read(pb, buf, size) == size && buf[0]) { \ buf[size] = 0; \ av_metadata_set2(&avctx->metadata, name, buf, 0); \ } @@ -51,14 +51,14 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g GET_SAUCE_META("artist", 20) GET_SAUCE_META("publisher", 20) GET_SAUCE_META("date", 8) - url_fskip(pb, 4); - datatype = get_byte(pb); - filetype = get_byte(pb); - t1 = get_le16(pb); - t2 = get_le16(pb); - nb_comments = get_byte(pb); - flags = get_byte(pb); - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); + datatype = avio_r8(pb); + filetype = avio_r8(pb); + t1 = avio_rl16(pb); + t2 = avio_rl16(pb); + nb_comments = avio_r8(pb); + flags = avio_r8(pb); + avio_seek(pb, 4, SEEK_CUR); GET_SAUCE_META("encoder", 22); if (got_width && datatype && filetype) { @@ -82,15 +82,15 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g *fsize -= 128; if (nb_comments > 0) { - url_fseek(pb, start_pos - 64*nb_comments - 5, SEEK_SET); - if (get_buffer(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) { + avio_seek(pb, start_pos - 64*nb_comments - 5, SEEK_SET); + if (avio_read(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) { int i; char *str = av_malloc(65*nb_comments + 1); *fsize -= 64*nb_comments + 5; if (!str) return 0; for (i = 0; i < nb_comments; i++) { - if (get_buffer(pb, str + 65*i, 64) != 64) + if (avio_read(pb, str + 65*i, 64) != 64) break; str[65*i + 64] = '\n'; } diff --git a/mplayer/ffmpeg/libavformat/sdp.c b/mplayer/ffmpeg/libavformat/sdp.c index 872e76c5..2a882181 100644 --- a/mplayer/ffmpeg/libavformat/sdp.c +++ b/mplayer/ffmpeg/libavformat/sdp.c @@ -21,6 +21,7 @@ #include #include "libavutil/avstring.h" #include "libavutil/base64.h" +#include "libavutil/parseutils.h" #include "libavcodec/xiph.h" #include "avformat.h" #include "internal.h" @@ -136,7 +137,7 @@ static int sdp_get_address(char *dest_addr, int size, int *ttl, const char *url) if (p) { char buff[64]; - if (find_info_tag(buff, sizeof(buff), "ttl", p)) { + if (av_find_info_tag(buff, sizeof(buff), "ttl", p)) { *ttl = strtol(buff, NULL, 10); } else { *ttl = 5; diff --git a/mplayer/ffmpeg/libavformat/seek.c b/mplayer/ffmpeg/libavformat/seek.c index 26b622f0..9fee9110 100644 --- a/mplayer/ffmpeg/libavformat/seek.c +++ b/mplayer/ffmpeg/libavformat/seek.c @@ -313,7 +313,7 @@ int64_t ff_gen_syncpoint_search(AVFormatContext *s, step = s->pb->buffer_size; curpos = FFMAX(pos - step / 2, 0); for (;;) { - url_fseek(s->pb, curpos, SEEK_SET); + avio_seek(s->pb, curpos, SEEK_SET); search_hi_lo_keyframes(s, ts, time_base, flags, @@ -385,7 +385,7 @@ int64_t ff_gen_syncpoint_search(AVFormatContext *s, } } - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); av_free(sync); return pos; } @@ -456,7 +456,7 @@ void ff_restore_parser_state(AVFormatContext *s, AVParserState *state) if (!state) return; - url_fseek(s->pb, state->fpos, SEEK_SET); + avio_seek(s->pb, state->fpos, SEEK_SET); // copy context structures s->cur_st = state->cur_st; diff --git a/mplayer/ffmpeg/libavformat/segafilm.c b/mplayer/ffmpeg/libavformat/segafilm.c index 4f3e5b93..7b689906 100644 --- a/mplayer/ffmpeg/libavformat/segafilm.c +++ b/mplayer/ffmpeg/libavformat/segafilm.c @@ -77,7 +77,7 @@ static int film_read_header(AVFormatContext *s, AVFormatParameters *ap) { FilmDemuxContext *film = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; unsigned char scratch[256]; int i; @@ -89,7 +89,7 @@ static int film_read_header(AVFormatContext *s, film->stereo_buffer_size = 0; /* load the main FILM header */ - if (get_buffer(pb, scratch, 16) != 16) + if (avio_read(pb, scratch, 16) != 16) return AVERROR(EIO); data_offset = AV_RB32(&scratch[4]); film->version = AV_RB32(&scratch[8]); @@ -97,7 +97,7 @@ static int film_read_header(AVFormatContext *s, /* load the FDSC chunk */ if (film->version == 0) { /* special case for Lemmings .film files; 20-byte header */ - if (get_buffer(pb, scratch, 20) != 20) + if (avio_read(pb, scratch, 20) != 20) return AVERROR(EIO); /* make some assumptions about the audio parameters */ film->audio_type = CODEC_ID_PCM_S8; @@ -106,7 +106,7 @@ static int film_read_header(AVFormatContext *s, film->audio_bits = 8; } else { /* normal Saturn .cpk files; 32-byte header */ - if (get_buffer(pb, scratch, 32) != 32) + if (avio_read(pb, scratch, 32) != 32) return AVERROR(EIO); film->audio_samplerate = AV_RB16(&scratch[24]); film->audio_channels = scratch[21]; @@ -158,7 +158,7 @@ static int film_read_header(AVFormatContext *s, } /* load the sample table */ - if (get_buffer(pb, scratch, 16) != 16) + if (avio_read(pb, scratch, 16) != 16) return AVERROR(EIO); if (AV_RB32(&scratch[0]) != STAB_TAG) return AVERROR_INVALIDDATA; @@ -174,7 +174,7 @@ static int film_read_header(AVFormatContext *s, audio_frame_counter = 0; for (i = 0; i < film->sample_count; i++) { /* load the next sample record and transfer it to an internal struct */ - if (get_buffer(pb, scratch, 16) != 16) { + if (avio_read(pb, scratch, 16) != 16) { av_free(film->sample_table); return AVERROR(EIO); } @@ -205,7 +205,7 @@ static int film_read_packet(AVFormatContext *s, AVPacket *pkt) { FilmDemuxContext *film = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; film_sample *sample; int ret = 0; int i; @@ -217,7 +217,7 @@ static int film_read_packet(AVFormatContext *s, sample = &film->sample_table[film->current_sample]; /* position the stream (will probably be there anyway) */ - url_fseek(pb, sample->sample_offset, SEEK_SET); + avio_seek(pb, sample->sample_offset, SEEK_SET); /* do a special song and dance when loading FILM Cinepak chunks */ if ((sample->stream == film->video_stream_index) && @@ -225,7 +225,7 @@ static int film_read_packet(AVFormatContext *s, pkt->pos= url_ftell(pb); if (av_new_packet(pkt, sample->sample_size)) return AVERROR(ENOMEM); - get_buffer(pb, pkt->data, sample->sample_size); + avio_read(pb, pkt->data, sample->sample_size); } else if ((sample->stream == film->audio_stream_index) && (film->audio_channels == 2)) { /* stereo PCM needs to be interleaved */ @@ -241,7 +241,7 @@ static int film_read_packet(AVFormatContext *s, } pkt->pos= url_ftell(pb); - ret = get_buffer(pb, film->stereo_buffer, sample->sample_size); + ret = avio_read(pb, film->stereo_buffer, sample->sample_size); if (ret != sample->sample_size) ret = AVERROR(EIO); diff --git a/mplayer/ffmpeg/libavformat/sierravmd.c b/mplayer/ffmpeg/libavformat/sierravmd.c index 98fe95a5..77874659 100644 --- a/mplayer/ffmpeg/libavformat/sierravmd.c +++ b/mplayer/ffmpeg/libavformat/sierravmd.c @@ -81,7 +81,7 @@ static int vmd_read_header(AVFormatContext *s, AVFormatParameters *ap) { VmdDemuxContext *vmd = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st = NULL, *vst; unsigned int toc_offset; unsigned char *raw_frame_table; @@ -95,8 +95,8 @@ static int vmd_read_header(AVFormatContext *s, int sound_buffers; /* fetch the main header, including the 2 header length bytes */ - url_fseek(pb, 0, SEEK_SET); - if (get_buffer(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE) + avio_seek(pb, 0, SEEK_SET); + if (avio_read(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE) return AVERROR(EIO); if(vmd->vmd_header[16] == 'i' && vmd->vmd_header[17] == 'v' && vmd->vmd_header[18] == '3') @@ -155,7 +155,7 @@ static int vmd_read_header(AVFormatContext *s, toc_offset = AV_RL32(&vmd->vmd_header[812]); vmd->frame_count = AV_RL16(&vmd->vmd_header[6]); vmd->frames_per_block = AV_RL16(&vmd->vmd_header[18]); - url_fseek(pb, toc_offset, SEEK_SET); + avio_seek(pb, toc_offset, SEEK_SET); raw_frame_table = NULL; vmd->frame_table = NULL; @@ -172,7 +172,7 @@ static int vmd_read_header(AVFormatContext *s, av_free(vmd->frame_table); return AVERROR(ENOMEM); } - if (get_buffer(pb, raw_frame_table, raw_frame_table_size) != + if (avio_read(pb, raw_frame_table, raw_frame_table_size) != raw_frame_table_size) { av_free(raw_frame_table); av_free(vmd->frame_table); @@ -189,7 +189,7 @@ static int vmd_read_header(AVFormatContext *s, int type; uint32_t size; - get_buffer(pb, chunk, BYTES_PER_FRAME_RECORD); + avio_read(pb, chunk, BYTES_PER_FRAME_RECORD); type = chunk[0]; size = AV_RL32(&chunk[2]); if(!size && type != 1) @@ -234,7 +234,7 @@ static int vmd_read_packet(AVFormatContext *s, AVPacket *pkt) { VmdDemuxContext *vmd = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret = 0; vmd_frame *frame; @@ -243,16 +243,16 @@ static int vmd_read_packet(AVFormatContext *s, frame = &vmd->frame_table[vmd->current_frame]; /* position the stream (will probably be there already) */ - url_fseek(pb, frame->frame_offset, SEEK_SET); + avio_seek(pb, frame->frame_offset, SEEK_SET); if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD)) return AVERROR(ENOMEM); pkt->pos= url_ftell(pb); memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD); if(vmd->is_indeo3) - ret = get_buffer(pb, pkt->data, frame->frame_size); + ret = avio_read(pb, pkt->data, frame->frame_size); else - ret = get_buffer(pb, pkt->data + BYTES_PER_FRAME_RECORD, + ret = avio_read(pb, pkt->data + BYTES_PER_FRAME_RECORD, frame->frame_size); if (ret != frame->frame_size) { diff --git a/mplayer/ffmpeg/libavformat/siff.c b/mplayer/ffmpeg/libavformat/siff.c index 5219368f..880132ff 100644 --- a/mplayer/ffmpeg/libavformat/siff.c +++ b/mplayer/ffmpeg/libavformat/siff.c @@ -84,36 +84,36 @@ static int create_audio_stream(AVFormatContext *s, SIFFContext *c) return 0; } -static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb) +static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) { AVStream *st; int width, height; - if (get_le32(pb) != TAG_VBHD){ + if (avio_rl32(pb) != TAG_VBHD){ av_log(s, AV_LOG_ERROR, "Header chunk is missing\n"); return -1; } - if(get_be32(pb) != 32){ + if(avio_rb32(pb) != 32){ av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n"); return -1; } - if(get_le16(pb) != 1){ + if(avio_rl16(pb) != 1){ av_log(s, AV_LOG_ERROR, "Incorrect header version\n"); return -1; } - width = get_le16(pb); - height = get_le16(pb); - url_fskip(pb, 4); - c->frames = get_le16(pb); + width = avio_rl16(pb); + height = avio_rl16(pb); + avio_seek(pb, 4, SEEK_CUR); + c->frames = avio_rl16(pb); if(!c->frames){ av_log(s, AV_LOG_ERROR, "File contains no frames ???\n"); return -1; } - c->bits = get_le16(pb); - c->rate = get_le16(pb); + c->bits = avio_rl16(pb); + c->rate = avio_rl16(pb); c->block_align = c->rate * (c->bits >> 3); - url_fskip(pb, 16); //zeroes + avio_seek(pb, 16, SEEK_CUR); //zeroes st = av_new_stream(s, 0); if (!st) @@ -135,33 +135,33 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb return 0; } -static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb) +static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) { - if (get_le32(pb) != TAG_SHDR){ + if (avio_rl32(pb) != TAG_SHDR){ av_log(s, AV_LOG_ERROR, "Header chunk is missing\n"); return -1; } - if(get_be32(pb) != 8){ + if(avio_rb32(pb) != 8){ av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n"); return -1; } - url_fskip(pb, 4); //unknown value - c->rate = get_le16(pb); - c->bits = get_le16(pb); + avio_seek(pb, 4, SEEK_CUR); //unknown value + c->rate = avio_rl16(pb); + c->bits = avio_rl16(pb); c->block_align = c->rate * (c->bits >> 3); return create_audio_stream(s, c); } static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; SIFFContext *c = s->priv_data; uint32_t tag; - if (get_le32(pb) != TAG_SIFF) + if (avio_rl32(pb) != TAG_SIFF) return -1; - url_fskip(pb, 4); //ignore size - tag = get_le32(pb); + avio_seek(pb, 4, SEEK_CUR); //ignore size + tag = avio_rl32(pb); if (tag != TAG_VBV1 && tag != TAG_SOUN){ av_log(s, AV_LOG_ERROR, "Not a VBV file\n"); @@ -172,11 +172,11 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; if (tag == TAG_SOUN && siff_parse_soun(s, c, pb) < 0) return -1; - if (get_le32(pb) != MKTAG('B', 'O', 'D', 'Y')){ + if (avio_rl32(pb) != MKTAG('B', 'O', 'D', 'Y')){ av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n"); return -1; } - url_fskip(pb, 4); //ignore size + avio_seek(pb, 4, SEEK_CUR); //ignore size return 0; } @@ -190,12 +190,12 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt) if (c->cur_frame >= c->frames) return AVERROR(EIO); if (c->curstrm == -1){ - c->pktsize = get_le32(s->pb) - 4; - c->flags = get_le16(s->pb); + c->pktsize = avio_rl32(s->pb) - 4; + c->flags = avio_rl16(s->pb); c->gmcsize = (c->flags & VB_HAS_GMC) ? 4 : 0; if (c->gmcsize) - get_buffer(s->pb, c->gmc, c->gmcsize); - c->sndsize = (c->flags & VB_HAS_AUDIO) ? get_le32(s->pb): 0; + avio_read(s->pb, c->gmc, c->gmcsize); + c->sndsize = (c->flags & VB_HAS_AUDIO) ? avio_rl32(s->pb): 0; c->curstrm = !!(c->flags & VB_HAS_AUDIO); } @@ -206,7 +206,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt) AV_WL16(pkt->data, c->flags); if (c->gmcsize) memcpy(pkt->data + 2, c->gmc, c->gmcsize); - get_buffer(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2); + avio_read(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2); pkt->stream_index = 0; c->curstrm = -1; }else{ diff --git a/mplayer/ffmpeg/libavformat/smacker.c b/mplayer/ffmpeg/libavformat/smacker.c index 71a968ee..8feb4e5f 100644 --- a/mplayer/ffmpeg/libavformat/smacker.c +++ b/mplayer/ffmpeg/libavformat/smacker.c @@ -98,26 +98,26 @@ static int smacker_probe(AVProbeData *p) static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; SmackerContext *smk = s->priv_data; AVStream *st, *ast[7]; int i, ret; int tbase; /* read and check header */ - smk->magic = get_le32(pb); + smk->magic = avio_rl32(pb); if (smk->magic != MKTAG('S', 'M', 'K', '2') && smk->magic != MKTAG('S', 'M', 'K', '4')) return -1; - smk->width = get_le32(pb); - smk->height = get_le32(pb); - smk->frames = get_le32(pb); - smk->pts_inc = (int32_t)get_le32(pb); - smk->flags = get_le32(pb); + smk->width = avio_rl32(pb); + smk->height = avio_rl32(pb); + smk->frames = avio_rl32(pb); + smk->pts_inc = (int32_t)avio_rl32(pb); + smk->flags = avio_rl32(pb); if(smk->flags & SMACKER_FLAG_RING_FRAME) smk->frames++; for(i = 0; i < 7; i++) - smk->audio[i] = get_le32(pb); - smk->treesize = get_le32(pb); + smk->audio[i] = avio_rl32(pb); + smk->treesize = avio_rl32(pb); if(smk->treesize >= UINT_MAX/4){ // smk->treesize + 16 must not overflow (this check is probably redundant) av_log(s, AV_LOG_ERROR, "treesize too large\n"); @@ -125,13 +125,13 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) } //FIXME remove extradata "rebuilding" - smk->mmap_size = get_le32(pb); - smk->mclr_size = get_le32(pb); - smk->full_size = get_le32(pb); - smk->type_size = get_le32(pb); + smk->mmap_size = avio_rl32(pb); + smk->mclr_size = avio_rl32(pb); + smk->full_size = avio_rl32(pb); + smk->type_size = avio_rl32(pb); for(i = 0; i < 7; i++) - smk->rates[i] = get_le32(pb); - smk->pad = get_le32(pb); + smk->rates[i] = avio_rl32(pb); + smk->pad = avio_rl32(pb); /* setup data */ if(smk->frames > 0xFFFFFF) { av_log(s, AV_LOG_ERROR, "Too many frames: %i\n", smk->frames); @@ -144,10 +144,10 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) /* read frame info */ for(i = 0; i < smk->frames; i++) { - smk->frm_size[i] = get_le32(pb); + smk->frm_size[i] = avio_rl32(pb); } for(i = 0; i < smk->frames; i++) { - smk->frm_flags[i] = get_byte(pb); + smk->frm_flags[i] = avio_r8(pb); } /* init video codec */ @@ -207,7 +207,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) av_free(smk->frm_flags); return -1; } - ret = get_buffer(pb, st->codec->extradata + 16, st->codec->extradata_size - 16); + ret = avio_read(pb, st->codec->extradata + 16, st->codec->extradata_size - 16); if(ret != st->codec->extradata_size - 16){ av_free(smk->frm_size); av_free(smk->frm_flags); @@ -240,7 +240,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) /* if we demuxed all streams, pass another frame */ if(smk->curstream < 0) { - url_fseek(s->pb, smk->nextpos, 0); + avio_seek(s->pb, smk->nextpos, 0); frame_size = smk->frm_size[smk->cur_frame] & (~3); flags = smk->frm_flags[smk->cur_frame]; /* handle palette change event */ @@ -251,19 +251,19 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) uint8_t oldpal[768]; memcpy(oldpal, pal, 768); - size = get_byte(s->pb); + size = avio_r8(s->pb); size = size * 4 - 1; frame_size -= size; frame_size--; sz = 0; pos = url_ftell(s->pb) + size; while(sz < 256){ - t = get_byte(s->pb); + t = avio_r8(s->pb); if(t & 0x80){ /* skip palette entries */ sz += (t & 0x7F) + 1; pal += ((t & 0x7F) + 1) * 3; } else if(t & 0x40){ /* copy with offset */ - off = get_byte(s->pb) * 3; + off = avio_r8(s->pb) * 3; j = (t & 0x3F) + 1; while(j-- && sz < 256) { *pal++ = oldpal[off + 0]; @@ -274,12 +274,12 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) } } else { /* new entries */ *pal++ = smk_pal[t]; - *pal++ = smk_pal[get_byte(s->pb) & 0x3F]; - *pal++ = smk_pal[get_byte(s->pb) & 0x3F]; + *pal++ = smk_pal[avio_r8(s->pb) & 0x3F]; + *pal++ = smk_pal[avio_r8(s->pb) & 0x3F]; sz++; } } - url_fseek(s->pb, pos, 0); + avio_seek(s->pb, pos, 0); palchange |= 1; } flags >>= 1; @@ -288,13 +288,13 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) for(i = 0; i < 7; i++) { if(flags & 1) { int size; - size = get_le32(s->pb) - 4; + size = avio_rl32(s->pb) - 4; frame_size -= size; frame_size -= 4; smk->curstream++; smk->bufs[smk->curstream] = av_realloc(smk->bufs[smk->curstream], size); smk->buf_sizes[smk->curstream] = size; - ret = get_buffer(s->pb, smk->bufs[smk->curstream], size); + ret = avio_read(s->pb, smk->bufs[smk->curstream], size); if(ret != size) return AVERROR(EIO); smk->stream_id[smk->curstream] = smk->indexes[i]; @@ -307,7 +307,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) palchange |= 2; pkt->data[0] = palchange; memcpy(pkt->data + 1, smk->pal, 768); - ret = get_buffer(s->pb, pkt->data + 769, frame_size); + ret = avio_read(s->pb, pkt->data + 769, frame_size); if(ret != frame_size) return AVERROR(EIO); pkt->stream_index = smk->videoindex; @@ -334,12 +334,9 @@ static int smacker_read_close(AVFormatContext *s) int i; for(i = 0; i < 7; i++) - if(smk->bufs[i]) - av_free(smk->bufs[i]); - if(smk->frm_size) - av_free(smk->frm_size); - if(smk->frm_flags) - av_free(smk->frm_flags); + av_free(smk->bufs[i]); + av_free(smk->frm_size); + av_free(smk->frm_flags); return 0; } diff --git a/mplayer/ffmpeg/libavformat/sol.c b/mplayer/ffmpeg/libavformat/sol.c index fd7eb662..7ad894e3 100644 --- a/mplayer/ffmpeg/libavformat/sol.c +++ b/mplayer/ffmpeg/libavformat/sol.c @@ -87,21 +87,21 @@ static int sol_read_header(AVFormatContext *s, { int size; unsigned int magic,tag; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int id, channels, rate, type; enum CodecID codec; AVStream *st; /* check ".snd" header */ - magic = get_le16(pb); - tag = get_le32(pb); + magic = avio_rl16(pb); + tag = avio_rl32(pb); if (tag != MKTAG('S', 'O', 'L', 0)) return -1; - rate = get_le16(pb); - type = get_byte(pb); - size = get_le32(pb); + rate = avio_rl16(pb); + type = avio_r8(pb); + size = avio_rl32(pb); if (magic != 0x0B8D) - get_byte(pb); /* newer SOLs contain padding byte */ + avio_r8(pb); /* newer SOLs contain padding byte */ codec = sol_codec_id(magic, type); channels = sol_channels(magic, type); diff --git a/mplayer/ffmpeg/libavformat/soxdec.c b/mplayer/ffmpeg/libavformat/soxdec.c index 0a57f489..6d99033f 100644 --- a/mplayer/ffmpeg/libavformat/soxdec.c +++ b/mplayer/ffmpeg/libavformat/soxdec.c @@ -44,7 +44,7 @@ static int sox_probe(AVProbeData *p) static int sox_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned header_size, comment_size; double sample_rate, sample_rate_frac; AVStream *st; @@ -55,20 +55,20 @@ static int sox_read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - if (get_le32(pb) == SOX_TAG) { + if (avio_rl32(pb) == SOX_TAG) { st->codec->codec_id = CODEC_ID_PCM_S32LE; - header_size = get_le32(pb); - url_fskip(pb, 8); /* sample count */ - sample_rate = av_int2dbl(get_le64(pb)); - st->codec->channels = get_le32(pb); - comment_size = get_le32(pb); + header_size = avio_rl32(pb); + avio_seek(pb, 8, SEEK_CUR); /* sample count */ + sample_rate = av_int2dbl(avio_rl64(pb)); + st->codec->channels = avio_rl32(pb); + comment_size = avio_rl32(pb); } else { st->codec->codec_id = CODEC_ID_PCM_S32BE; - header_size = get_be32(pb); - url_fskip(pb, 8); /* sample count */ - sample_rate = av_int2dbl(get_be64(pb)); - st->codec->channels = get_be32(pb); - comment_size = get_be32(pb); + header_size = avio_rb32(pb); + avio_seek(pb, 8, SEEK_CUR); /* sample count */ + sample_rate = av_int2dbl(avio_rb64(pb)); + st->codec->channels = avio_rb32(pb); + comment_size = avio_rb32(pb); } if (comment_size > 0xFFFFFFFFU - SOX_FIXED_HDR - 4U) { @@ -95,7 +95,7 @@ static int sox_read_header(AVFormatContext *s, if (comment_size && comment_size < UINT_MAX) { char *comment = av_malloc(comment_size+1); - if (get_buffer(pb, comment, comment_size) != comment_size) { + if (avio_read(pb, comment, comment_size) != comment_size) { av_freep(&comment); return AVERROR(EIO); } @@ -105,7 +105,7 @@ static int sox_read_header(AVFormatContext *s, AV_METADATA_DONT_STRDUP_VAL); } - url_fskip(pb, header_size - SOX_FIXED_HDR - comment_size); + avio_seek(pb, header_size - SOX_FIXED_HDR - comment_size, SEEK_CUR); st->codec->sample_rate = sample_rate; st->codec->bits_per_coded_sample = 32; diff --git a/mplayer/ffmpeg/libavformat/soxenc.c b/mplayer/ffmpeg/libavformat/soxenc.c index 413a5383..dbb2972e 100644 --- a/mplayer/ffmpeg/libavformat/soxenc.c +++ b/mplayer/ffmpeg/libavformat/soxenc.c @@ -31,6 +31,7 @@ #include "libavutil/intreadwrite.h" #include "avformat.h" +#include "avio_internal.h" #include "sox.h" typedef struct { @@ -40,7 +41,7 @@ typedef struct { static int sox_write_header(AVFormatContext *s) { SoXContext *sox = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; AVMetadataTag *comment; size_t comment_len = 0, comment_size; @@ -53,29 +54,29 @@ static int sox_write_header(AVFormatContext *s) sox->header_size = SOX_FIXED_HDR + comment_size; if (enc->codec_id == CODEC_ID_PCM_S32LE) { - put_tag(pb, ".SoX"); - put_le32(pb, sox->header_size); - put_le64(pb, 0); /* number of samples */ - put_le64(pb, av_dbl2int(enc->sample_rate)); - put_le32(pb, enc->channels); - put_le32(pb, comment_size); + ffio_wfourcc(pb, ".SoX"); + avio_wl32(pb, sox->header_size); + avio_wl64(pb, 0); /* number of samples */ + avio_wl64(pb, av_dbl2int(enc->sample_rate)); + avio_wl32(pb, enc->channels); + avio_wl32(pb, comment_size); } else if (enc->codec_id == CODEC_ID_PCM_S32BE) { - put_tag(pb, "XoS."); - put_be32(pb, sox->header_size); - put_be64(pb, 0); /* number of samples */ - put_be64(pb, av_dbl2int(enc->sample_rate)); - put_be32(pb, enc->channels); - put_be32(pb, comment_size); + ffio_wfourcc(pb, "XoS."); + avio_wb32(pb, sox->header_size); + avio_wb64(pb, 0); /* number of samples */ + avio_wb64(pb, av_dbl2int(enc->sample_rate)); + avio_wb32(pb, enc->channels); + avio_wb32(pb, comment_size); } else { av_log(s, AV_LOG_ERROR, "invalid codec; use pcm_s32le or pcm_s32be\n"); return -1; } if (comment_len) - put_buffer(pb, comment->value, comment_len); + avio_write(pb, comment->value, comment_len); for ( ; comment_size > comment_len; comment_len++) - put_byte(pb, 0); + avio_w8(pb, 0); put_flush_packet(pb); @@ -84,27 +85,27 @@ static int sox_write_header(AVFormatContext *s) static int sox_write_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; - put_buffer(pb, pkt->data, pkt->size); + AVIOContext *pb = s->pb; + avio_write(pb, pkt->data, pkt->size); return 0; } static int sox_write_trailer(AVFormatContext *s) { SoXContext *sox = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; if (!url_is_streamed(s->pb)) { /* update number of samples */ int64_t file_size = url_ftell(pb); int64_t num_samples = (file_size - sox->header_size - 4LL) >> 2LL; - url_fseek(pb, 8, SEEK_SET); + avio_seek(pb, 8, SEEK_SET); if (enc->codec_id == CODEC_ID_PCM_S32LE) { - put_le64(pb, num_samples); + avio_wl64(pb, num_samples); } else - put_be64(pb, num_samples); - url_fseek(pb, file_size, SEEK_SET); + avio_wb64(pb, num_samples); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); } diff --git a/mplayer/ffmpeg/libavformat/spdifdec.c b/mplayer/ffmpeg/libavformat/spdifdec.c index 5c4dba08..b2194ea2 100644 --- a/mplayer/ffmpeg/libavformat/spdifdec.c +++ b/mplayer/ffmpeg/libavformat/spdifdec.c @@ -163,20 +163,20 @@ static int spdif_read_header(AVFormatContext *s, AVFormatParameters *ap) static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; enum IEC61937DataType data_type; enum CodecID codec_id; uint32_t state = 0; int pkt_size_bits, offset, ret; while (state != (AV_BSWAP16C(SYNCWORD1) << 16 | AV_BSWAP16C(SYNCWORD2))) { - state = (state << 8) | get_byte(pb); + state = (state << 8) | avio_r8(pb); if (url_feof(pb)) return AVERROR_EOF; } - data_type = get_le16(pb); - pkt_size_bits = get_le16(pb); + data_type = avio_rl16(pb); + pkt_size_bits = avio_rl16(pb); if (pkt_size_bits % 16) av_log_ask_for_sample(s, "Packet does not end to a 16-bit boundary."); @@ -187,7 +187,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->pos = url_ftell(pb) - BURST_HEADER_SIZE; - if (get_buffer(pb, pkt->data, pkt->size) < pkt->size) { + if (avio_read(pb, pkt->data, pkt->size) < pkt->size) { av_free_packet(pkt); return AVERROR_EOF; } @@ -201,7 +201,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) } /* skip over the padding to the beginning of the next frame */ - url_fskip(pb, offset - pkt->size - BURST_HEADER_SIZE); + avio_seek(pb, offset - pkt->size - BURST_HEADER_SIZE, SEEK_CUR); if (!s->nb_streams) { /* first packet, create a stream */ diff --git a/mplayer/ffmpeg/libavformat/spdifenc.c b/mplayer/ffmpeg/libavformat/spdifenc.c index 3eea31e9..b4111f62 100644 --- a/mplayer/ffmpeg/libavformat/spdifenc.c +++ b/mplayer/ffmpeg/libavformat/spdifenc.c @@ -45,12 +45,16 @@ */ #include "avformat.h" +#include "avio_internal.h" #include "spdif.h" #include "libavcodec/ac3.h" #include "libavcodec/dca.h" +#include "libavcodec/dcadata.h" #include "libavcodec/aacadtsdec.h" +#include "libavutil/opt.h" typedef struct IEC61937Context { + const AVClass *av_class; enum IEC61937DataType data_type;///< burst info - reference to type of payload of the data-burst int length_code; ///< length code in bits or bytes, depending on data type int pkt_offset; ///< data burst repetition period in bytes @@ -68,11 +72,28 @@ typedef struct IEC61937Context { int hd_buf_count; ///< number of frames in the hd audio buffer int hd_buf_filled; ///< amount of bytes in the hd audio buffer + int dtshd_skip; ///< counter used for skipping DTS-HD frames + + /* AVOptions: */ + int dtshd_rate; + int dtshd_fallback; +#define SPDIF_FLAG_BIGENDIAN 0x01 + int spdif_flags; + /// function, which generates codec dependent header information. /// Sets data_type and pkt_offset, and length_code, out_bytes, out_buf if necessary int (*header_info) (AVFormatContext *s, AVPacket *pkt); } IEC61937Context; +static const AVOption options[] = { +{ "spdif_flags", "IEC 61937 encapsulation flags", offsetof(IEC61937Context, spdif_flags), FF_OPT_TYPE_FLAGS, 0, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "spdif_flags" }, +{ "be", "output in big-endian format (for use as s16be)", 0, FF_OPT_TYPE_CONST, SPDIF_FLAG_BIGENDIAN, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "spdif_flags" }, +{ "dtshd_rate", "mux complete DTS frames in HD mode at the specified IEC958 rate (in Hz, default 0=disabled)", offsetof(IEC61937Context, dtshd_rate), FF_OPT_TYPE_INT, 0, 0, 768000, AV_OPT_FLAG_ENCODING_PARAM }, +{ "dtshd_fallback_time", "min secs to strip HD for after an overflow (-1: till the end, default 60)", offsetof(IEC61937Context, dtshd_fallback), FF_OPT_TYPE_INT, 60, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, +{ NULL }, +}; + +static const AVClass class = { "spdif", av_default_item_name, options, LIBAVUTIL_VERSION_INT }; static int spdif_header_ac3(AVFormatContext *s, AVPacket *pkt) { @@ -115,15 +136,116 @@ static int spdif_header_eac3(AVFormatContext *s, AVPacket *pkt) return 0; } +/* + * DTS type IV (DTS-HD) can be transmitted with various frame repetition + * periods; longer repetition periods allow for longer packets and therefore + * higher bitrate. Longer repetition periods mean that the constant bitrate of + * the outputted IEC 61937 stream is higher. + * The repetition period is measured in IEC 60958 frames (4 bytes). + */ +static int spdif_dts4_subtype(int period) +{ + switch (period) { + case 512: return 0x0; + case 1024: return 0x1; + case 2048: return 0x2; + case 4096: return 0x3; + case 8192: return 0x4; + case 16384: return 0x5; + } + return -1; +} + +static int spdif_header_dts4(AVFormatContext *s, AVPacket *pkt, int core_size, + int sample_rate, int blocks) +{ + IEC61937Context *ctx = s->priv_data; + static const char dtshd_start_code[10] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe }; + int pkt_size = pkt->size; + int period; + int subtype; + + if (!core_size) { + av_log(s, AV_LOG_ERROR, "HD mode not supported for this format\n"); + return AVERROR(EINVAL); + } + + if (!sample_rate) { + av_log(s, AV_LOG_ERROR, "Unknown DTS sample rate for HD\n"); + return AVERROR_INVALIDDATA; + } + + period = ctx->dtshd_rate * (blocks << 5) / sample_rate; + subtype = spdif_dts4_subtype(period); + + if (subtype < 0) { + av_log(s, AV_LOG_ERROR, "Specified HD rate of %d Hz would require an " + "impossible repetition period of %d for the current DTS stream" + " (blocks = %d, sample rate = %d)\n", ctx->dtshd_rate, period, + blocks << 5, sample_rate); + return AVERROR(EINVAL); + } + + /* set pkt_offset and DTS IV subtype according to the requested output + * rate */ + ctx->pkt_offset = period * 4; + ctx->data_type = IEC61937_DTSHD | subtype << 8; + + /* If the bitrate is too high for transmitting at the selected + * repetition period setting, strip DTS-HD until a good amount + * of consecutive non-overflowing HD frames have been observed. + * This generally only happens if the caller is cramming a Master + * Audio stream into 192kHz IEC 60958 (which may or may not fit). */ + if (sizeof(dtshd_start_code) + 2 + pkt_size + > ctx->pkt_offset - BURST_HEADER_SIZE && core_size) { + if (!ctx->dtshd_skip) + av_log(s, AV_LOG_WARNING, "DTS-HD bitrate too high, " + "temporarily sending core only\n"); + if (ctx->dtshd_fallback > 0) + ctx->dtshd_skip = sample_rate * ctx->dtshd_fallback / (blocks << 5); + else + /* skip permanently (dtshd_fallback == -1) or just once + * (dtshd_fallback == 0) */ + ctx->dtshd_skip = 1; + } + if (ctx->dtshd_skip && core_size) { + pkt_size = core_size; + if (ctx->dtshd_fallback >= 0) + --ctx->dtshd_skip; + } + + ctx->out_bytes = sizeof(dtshd_start_code) + 2 + pkt_size; + ctx->length_code = ctx->out_bytes; + + av_fast_malloc(&ctx->hd_buf, &ctx->hd_buf_size, ctx->out_bytes); + if (!ctx->hd_buf) + return AVERROR(ENOMEM); + + ctx->out_buf = ctx->hd_buf; + + memcpy(ctx->hd_buf, dtshd_start_code, sizeof(dtshd_start_code)); + AV_WB16(ctx->hd_buf + sizeof(dtshd_start_code), pkt_size); + memcpy(ctx->hd_buf + sizeof(dtshd_start_code) + 2, pkt->data, pkt_size); + + return 0; +} + static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt) { IEC61937Context *ctx = s->priv_data; uint32_t syncword_dts = AV_RB32(pkt->data); int blocks; + int sample_rate = 0; + int core_size = 0; + + if (pkt->size < 9) + return AVERROR_INVALIDDATA; switch (syncword_dts) { case DCA_MARKER_RAW_BE: blocks = (AV_RB16(pkt->data + 4) >> 2) & 0x7f; + core_size = ((AV_RB24(pkt->data + 5) >> 4) & 0x3fff) + 1; + sample_rate = dca_sample_rates[(pkt->data[8] >> 2) & 0x0f]; break; case DCA_MARKER_RAW_LE: blocks = (AV_RL16(pkt->data + 4) >> 2) & 0x7f; @@ -138,11 +260,22 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt) (((pkt->data[4] & 0x07) << 4) | ((pkt->data[7] & 0x3f) >> 2)); ctx->extra_bswap = 1; break; + case DCA_HD_MARKER: + /* We only handle HD frames that are paired with core. However, + sometimes DTS-HD streams with core have a stray HD frame without + core in the beginning of the stream. */ + av_log(s, AV_LOG_ERROR, "stray DTS-HD frame\n"); + return AVERROR_INVALIDDATA; default: av_log(s, AV_LOG_ERROR, "bad DTS syncword 0x%x\n", syncword_dts); return AVERROR_INVALIDDATA; } blocks++; + + if (ctx->dtshd_rate) + /* DTS type IV output requested */ + return spdif_header_dts4(s, pkt, core_size, sample_rate, blocks); + switch (blocks) { case 512 >> 5: ctx->data_type = IEC61937_DTS1; break; case 1024 >> 5: ctx->data_type = IEC61937_DTS2; break; @@ -152,6 +285,13 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt) blocks << 5); return AVERROR(ENOSYS); } + + /* discard extraneous data by default */ + if (core_size && core_size < pkt->size) { + ctx->out_bytes = core_size; + ctx->length_code = core_size << 3; + } + ctx->pkt_offset = blocks << 7; if (ctx->out_bytes == ctx->pkt_offset) { @@ -159,6 +299,9 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt) * preamble as it would not fit in there. This is the case for dts * discs and dts-in-wav. */ ctx->use_preamble = 0; + } else if (ctx->out_bytes > ctx->pkt_offset - BURST_HEADER_SIZE) { + av_log_ask_for_sample(s, "Unrecognized large DTS frame."); + /* This will fail with a "bitrate too high" in the caller */ } return 0; @@ -330,6 +473,15 @@ static int spdif_write_trailer(AVFormatContext *s) return 0; } +static av_always_inline void spdif_put_16(IEC61937Context *ctx, + AVIOContext *pb, unsigned int val) +{ + if (ctx->spdif_flags & SPDIF_FLAG_BIGENDIAN) + avio_wb16(pb, val); + else + avio_wl16(pb, val); +} + static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) { IEC61937Context *ctx = s->priv_data; @@ -354,26 +506,27 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) } if (ctx->use_preamble) { - put_le16(s->pb, SYNCWORD1); //Pa - put_le16(s->pb, SYNCWORD2); //Pb - put_le16(s->pb, ctx->data_type); //Pc - put_le16(s->pb, ctx->length_code);//Pd + spdif_put_16(ctx, s->pb, SYNCWORD1); //Pa + spdif_put_16(ctx, s->pb, SYNCWORD2); //Pb + spdif_put_16(ctx, s->pb, ctx->data_type); //Pc + spdif_put_16(ctx, s->pb, ctx->length_code);//Pd } - if (HAVE_BIGENDIAN ^ ctx->extra_bswap) { - put_buffer(s->pb, ctx->out_buf, ctx->out_bytes & ~1); + if (ctx->extra_bswap ^ (ctx->spdif_flags & SPDIF_FLAG_BIGENDIAN)) { + avio_write(s->pb, ctx->out_buf, ctx->out_bytes & ~1); } else { av_fast_malloc(&ctx->buffer, &ctx->buffer_size, ctx->out_bytes + FF_INPUT_BUFFER_PADDING_SIZE); if (!ctx->buffer) return AVERROR(ENOMEM); ff_spdif_bswap_buf16((uint16_t *)ctx->buffer, (uint16_t *)ctx->out_buf, ctx->out_bytes >> 1); - put_buffer(s->pb, ctx->buffer, ctx->out_bytes & ~1); + avio_write(s->pb, ctx->buffer, ctx->out_bytes & ~1); } + /* a final lone byte has to be MSB aligned */ if (ctx->out_bytes & 1) - put_be16(s->pb, ctx->out_buf[ctx->out_bytes - 1]); + spdif_put_16(ctx, s->pb, ctx->out_buf[ctx->out_bytes - 1] << 8); - put_nbyte(s->pb, 0, padding); + ffio_fill(s->pb, 0, padding); av_log(s, AV_LOG_DEBUG, "type=%x len=%i pkt_offset=%i\n", ctx->data_type, ctx->out_bytes, ctx->pkt_offset); @@ -393,4 +546,6 @@ AVOutputFormat ff_spdif_muxer = { spdif_write_header, spdif_write_packet, spdif_write_trailer, + .flags = AVFMT_NOTIMESTAMPS, + .priv_class = &class, }; diff --git a/mplayer/ffmpeg/libavformat/swfdec.c b/mplayer/ffmpeg/libavformat/swfdec.c index d2a84f0c..b96b2291 100644 --- a/mplayer/ffmpeg/libavformat/swfdec.c +++ b/mplayer/ffmpeg/libavformat/swfdec.c @@ -23,18 +23,18 @@ #include "libavutil/intreadwrite.h" #include "swf.h" -static int get_swf_tag(ByteIOContext *pb, int *len_ptr) +static int get_swf_tag(AVIOContext *pb, int *len_ptr) { int tag, len; if (url_feof(pb)) return -1; - tag = get_le16(pb); + tag = avio_rl16(pb); len = tag & 0x3f; tag = tag >> 6; if (len == 0x3f) { - len = get_le32(pb); + len = avio_rl32(pb); } // av_log(NULL, AV_LOG_DEBUG, "Tag: %d - Len: %d\n", tag, len); *len_ptr = len; @@ -55,10 +55,10 @@ static int swf_probe(AVProbeData *p) static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) { SWFContext *swf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int nbits, len, tag; - tag = get_be32(pb) & 0xffffff00; + tag = avio_rb32(pb) & 0xffffff00; if (tag == MKBETAG('C', 'W', 'S', 0)) { av_log(s, AV_LOG_ERROR, "Compressed SWF format not supported\n"); @@ -66,13 +66,13 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) } if (tag != MKBETAG('F', 'W', 'S', 0)) return AVERROR(EIO); - get_le32(pb); + avio_rl32(pb); /* skip rectangle size */ - nbits = get_byte(pb) >> 3; + nbits = avio_r8(pb) >> 3; len = (4 * nbits - 3 + 7) / 8; - url_fskip(pb, len); - swf->frame_rate = get_le16(pb); /* 8.8 fixed */ - get_le16(pb); /* frame count */ + avio_seek(pb, len, SEEK_CUR); + swf->frame_rate = avio_rl16(pb); /* 8.8 fixed */ + avio_rl16(pb); /* frame count */ swf->samples_per_frame = 0; s->ctx_flags |= AVFMTCTX_NOHEADER; @@ -82,7 +82,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) { SWFContext *swf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *vst = NULL, *ast = NULL, *st = 0; int tag, len, i, frame, v; @@ -92,7 +92,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) if (tag < 0) return AVERROR(EIO); if (tag == TAG_VIDEOSTREAM) { - int ch_id = get_le16(pb); + int ch_id = avio_rl16(pb); len -= 2; for (i=0; inb_streams; i++) { @@ -101,16 +101,16 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) goto skip; } - get_le16(pb); - get_le16(pb); - get_le16(pb); - get_byte(pb); + avio_rl16(pb); + avio_rl16(pb); + avio_rl16(pb); + avio_r8(pb); /* Check for FLV1 */ vst = av_new_stream(s, ch_id); if (!vst) return -1; vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; - vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, get_byte(pb)); + vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb)); av_set_pts_info(vst, 16, 256, swf->frame_rate); vst->codec->time_base = (AVRational){ 256, swf->frame_rate }; len -= 8; @@ -124,9 +124,9 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) goto skip; } - get_byte(pb); - v = get_byte(pb); - swf->samples_per_frame = get_le16(pb); + avio_r8(pb); + v = avio_r8(pb); + swf->samples_per_frame = avio_rl16(pb); ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */ if (!ast) return -1; @@ -141,12 +141,12 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) av_set_pts_info(ast, 64, 1, ast->codec->sample_rate); len -= 4; } else if (tag == TAG_VIDEOFRAME) { - int ch_id = get_le16(pb); + int ch_id = avio_rl16(pb); len -= 2; for(i=0; inb_streams; i++) { st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) { - frame = get_le16(pb); + frame = avio_rl16(pb); av_get_packet(pb, pkt, len-2); pkt->pos = pos; pkt->pts = frame; @@ -159,7 +159,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) { if (st->codec->codec_id == CODEC_ID_MP3) { - url_fskip(pb, 4); + avio_seek(pb, 4, SEEK_CUR); av_get_packet(pb, pkt, len-4); } else { // ADPCM, PCM av_get_packet(pb, pkt, len); @@ -185,24 +185,24 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) vst->codec->time_base = (AVRational){ 256, swf->frame_rate }; st = vst; } - get_le16(pb); /* BITMAP_ID */ + avio_rl16(pb); /* BITMAP_ID */ av_new_packet(pkt, len-2); - get_buffer(pb, pkt->data, 4); + avio_read(pb, pkt->data, 4); if (AV_RB32(pkt->data) == 0xffd8ffd9 || AV_RB32(pkt->data) == 0xffd9ffd8) { /* old SWF files containing SOI/EOI as data start */ /* files created by swink have reversed tag */ pkt->size -= 4; - get_buffer(pb, pkt->data, pkt->size); + avio_read(pb, pkt->data, pkt->size); } else { - get_buffer(pb, pkt->data + 4, pkt->size - 4); + avio_read(pb, pkt->data + 4, pkt->size - 4); } pkt->pos = pos; pkt->stream_index = st->index; return pkt->size; } skip: - url_fskip(pb, len); + avio_seek(pb, len, SEEK_CUR); } return 0; } diff --git a/mplayer/ffmpeg/libavformat/swfenc.c b/mplayer/ffmpeg/libavformat/swfenc.c index 1ade1bf2..c898c0ec 100644 --- a/mplayer/ffmpeg/libavformat/swfenc.c +++ b/mplayer/ffmpeg/libavformat/swfenc.c @@ -27,39 +27,39 @@ static void put_swf_tag(AVFormatContext *s, int tag) { SWFContext *swf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; swf->tag_pos = url_ftell(pb); swf->tag = tag; /* reserve some room for the tag */ if (tag & TAG_LONG) { - put_le16(pb, 0); - put_le32(pb, 0); + avio_wl16(pb, 0); + avio_wl32(pb, 0); } else { - put_le16(pb, 0); + avio_wl16(pb, 0); } } static void put_swf_end_tag(AVFormatContext *s) { SWFContext *swf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t pos; int tag_len, tag; pos = url_ftell(pb); tag_len = pos - swf->tag_pos - 2; tag = swf->tag; - url_fseek(pb, swf->tag_pos, SEEK_SET); + avio_seek(pb, swf->tag_pos, SEEK_SET); if (tag & TAG_LONG) { tag &= ~TAG_LONG; - put_le16(pb, (tag << 6) | 0x3f); - put_le32(pb, tag_len - 4); + avio_wl16(pb, (tag << 6) | 0x3f); + avio_wl32(pb, tag_len - 4); } else { assert(tag_len < 0x3f); - put_le16(pb, (tag << 6) | tag_len); + avio_wl16(pb, (tag << 6) | tag_len); } - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } static inline void max_nbits(int *nbits_ptr, int val) @@ -78,7 +78,7 @@ static inline void max_nbits(int *nbits_ptr, int val) *nbits_ptr = n; } -static void put_swf_rect(ByteIOContext *pb, +static void put_swf_rect(AVIOContext *pb, int xmin, int xmax, int ymin, int ymax) { PutBitContext p; @@ -102,7 +102,7 @@ static void put_swf_rect(ByteIOContext *pb, put_bits(&p, nbits, ymax & mask); flush_put_bits(&p); - put_buffer(pb, buf, put_bits_ptr(&p) - p.buf); + avio_write(pb, buf, put_bits_ptr(&p) - p.buf); } static void put_swf_line_edge(PutBitContext *pb, int dx, int dy) @@ -134,7 +134,7 @@ static void put_swf_line_edge(PutBitContext *pb, int dx, int dy) #define FRAC_BITS 16 -static void put_swf_matrix(ByteIOContext *pb, +static void put_swf_matrix(AVIOContext *pb, int a, int b, int c, int d, int tx, int ty) { PutBitContext p; @@ -167,13 +167,13 @@ static void put_swf_matrix(ByteIOContext *pb, put_bits(&p, nbits, ty); flush_put_bits(&p); - put_buffer(pb, buf, put_bits_ptr(&p) - p.buf); + avio_write(pb, buf, put_bits_ptr(&p) - p.buf); } static int swf_write_header(AVFormatContext *s) { SWFContext *swf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; PutBitContext p; uint8_t buf1[256]; int i, width, height, rate, rate_base; @@ -229,7 +229,7 @@ static int swf_write_header(AVFormatContext *s) else swf->samples_per_frame = (swf->audio_enc->sample_rate * rate_base) / rate; - put_tag(pb, "FWS"); + avio_write(pb, "FWS", 3); if (!strcmp("avm2", s->oformat->name)) version = 9; @@ -239,20 +239,20 @@ static int swf_write_header(AVFormatContext *s) version = 6; /* version 6 and above support FLV1 codec */ else version = 4; /* version 4 for mpeg audio support */ - put_byte(pb, version); + avio_w8(pb, version); - put_le32(pb, DUMMY_FILE_SIZE); /* dummy size + avio_wl32(pb, DUMMY_FILE_SIZE); /* dummy size (will be patched if not streamed) */ put_swf_rect(pb, 0, width * 20, 0, height * 20); - put_le16(pb, (rate * 256) / rate_base); /* frame rate */ + avio_wl16(pb, (rate * 256) / rate_base); /* frame rate */ swf->duration_pos = url_ftell(pb); - put_le16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */ + avio_wl16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */ /* avm2/swf v9 (also v8?) files require a file attribute tag */ if (version == 9) { put_swf_tag(s, TAG_FILEATTRIBUTES); - put_le32(pb, 1<<3); /* set ActionScript v3/AVM2 flag */ + avio_wl32(pb, 1<<3); /* set ActionScript v3/AVM2 flag */ put_swf_end_tag(s); } @@ -260,17 +260,17 @@ static int swf_write_header(AVFormatContext *s) if (swf->video_enc && swf->video_enc->codec_id == CODEC_ID_MJPEG) { put_swf_tag(s, TAG_DEFINESHAPE); - put_le16(pb, SHAPE_ID); /* ID of shape */ + avio_wl16(pb, SHAPE_ID); /* ID of shape */ /* bounding rectangle */ put_swf_rect(pb, 0, width, 0, height); /* style info */ - put_byte(pb, 1); /* one fill style */ - put_byte(pb, 0x41); /* clipped bitmap fill */ - put_le16(pb, BITMAP_ID); /* bitmap ID */ + avio_w8(pb, 1); /* one fill style */ + avio_w8(pb, 0x41); /* clipped bitmap fill */ + avio_wl16(pb, BITMAP_ID); /* bitmap ID */ /* position of the bitmap */ put_swf_matrix(pb, (int)(1.0 * (1 << FRAC_BITS)), 0, 0, (int)(1.0 * (1 << FRAC_BITS)), 0, 0); - put_byte(pb, 0); /* no line style */ + avio_w8(pb, 0); /* no line style */ /* shape drawing */ init_put_bits(&p, buf1, sizeof(buf1)); @@ -295,7 +295,7 @@ static int swf_write_header(AVFormatContext *s) put_bits(&p, 5, 0); flush_put_bits(&p); - put_buffer(pb, buf1, put_bits_ptr(&p) - p.buf); + avio_write(pb, buf1, put_bits_ptr(&p) - p.buf); put_swf_end_tag(s); } @@ -317,11 +317,11 @@ static int swf_write_header(AVFormatContext *s) v |= 0x02; /* 16 bit playback */ if (swf->audio_enc->channels == 2) v |= 0x01; /* stereo playback */ - put_byte(s->pb, v); + avio_w8(s->pb, v); v |= 0x20; /* mp3 compressed */ - put_byte(s->pb, v); - put_le16(s->pb, swf->samples_per_frame); /* avg samples per frame */ - put_le16(s->pb, 0); + avio_w8(s->pb, v); + avio_wl16(s->pb, swf->samples_per_frame); /* avg samples per frame */ + avio_wl16(s->pb, 0); put_swf_end_tag(s); } @@ -334,7 +334,7 @@ static int swf_write_video(AVFormatContext *s, AVCodecContext *enc, const uint8_t *buf, int size) { SWFContext *swf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; /* Flash Player limit */ if (swf->swf_frame_number == 16000) @@ -345,70 +345,70 @@ static int swf_write_video(AVFormatContext *s, if (swf->video_frame_number == 0) { /* create a new video object */ put_swf_tag(s, TAG_VIDEOSTREAM); - put_le16(pb, VIDEO_ID); + avio_wl16(pb, VIDEO_ID); swf->vframes_pos = url_ftell(pb); - put_le16(pb, 15000); /* hard flash player limit */ - put_le16(pb, enc->width); - put_le16(pb, enc->height); - put_byte(pb, 0); - put_byte(pb,ff_codec_get_tag(swf_codec_tags,enc->codec_id)); + avio_wl16(pb, 15000); /* hard flash player limit */ + avio_wl16(pb, enc->width); + avio_wl16(pb, enc->height); + avio_w8(pb, 0); + avio_w8(pb,ff_codec_get_tag(swf_codec_tags,enc->codec_id)); put_swf_end_tag(s); /* place the video object for the first time */ put_swf_tag(s, TAG_PLACEOBJECT2); - put_byte(pb, 0x36); - put_le16(pb, 1); - put_le16(pb, VIDEO_ID); + avio_w8(pb, 0x36); + avio_wl16(pb, 1); + avio_wl16(pb, VIDEO_ID); put_swf_matrix(pb, 1 << FRAC_BITS, 0, 0, 1 << FRAC_BITS, 0, 0); - put_le16(pb, swf->video_frame_number); - put_tag(pb, "video"); - put_byte(pb, 0x00); + avio_wl16(pb, swf->video_frame_number); + avio_write(pb, "video", 5); + avio_w8(pb, 0x00); put_swf_end_tag(s); } else { /* mark the character for update */ put_swf_tag(s, TAG_PLACEOBJECT2); - put_byte(pb, 0x11); - put_le16(pb, 1); - put_le16(pb, swf->video_frame_number); + avio_w8(pb, 0x11); + avio_wl16(pb, 1); + avio_wl16(pb, swf->video_frame_number); put_swf_end_tag(s); } /* set video frame data */ put_swf_tag(s, TAG_VIDEOFRAME | TAG_LONG); - put_le16(pb, VIDEO_ID); - put_le16(pb, swf->video_frame_number++); - put_buffer(pb, buf, size); + avio_wl16(pb, VIDEO_ID); + avio_wl16(pb, swf->video_frame_number++); + avio_write(pb, buf, size); put_swf_end_tag(s); } else if (enc->codec_id == CODEC_ID_MJPEG) { if (swf->swf_frame_number > 0) { /* remove the shape */ put_swf_tag(s, TAG_REMOVEOBJECT); - put_le16(pb, SHAPE_ID); /* shape ID */ - put_le16(pb, 1); /* depth */ + avio_wl16(pb, SHAPE_ID); /* shape ID */ + avio_wl16(pb, 1); /* depth */ put_swf_end_tag(s); /* free the bitmap */ put_swf_tag(s, TAG_FREECHARACTER); - put_le16(pb, BITMAP_ID); + avio_wl16(pb, BITMAP_ID); put_swf_end_tag(s); } put_swf_tag(s, TAG_JPEG2 | TAG_LONG); - put_le16(pb, BITMAP_ID); /* ID of the image */ + avio_wl16(pb, BITMAP_ID); /* ID of the image */ /* a dummy jpeg header seems to be required */ - put_be32(pb, 0xffd8ffd9); + avio_wb32(pb, 0xffd8ffd9); /* write the jpeg image */ - put_buffer(pb, buf, size); + avio_write(pb, buf, size); put_swf_end_tag(s); /* draw the shape */ put_swf_tag(s, TAG_PLACEOBJECT); - put_le16(pb, SHAPE_ID); /* shape ID */ - put_le16(pb, 1); /* depth */ + avio_wl16(pb, SHAPE_ID); /* shape ID */ + avio_wl16(pb, 1); /* depth */ put_swf_matrix(pb, 20 << FRAC_BITS, 0, 0, 20 << FRAC_BITS, 0, 0); put_swf_end_tag(s); } @@ -419,9 +419,9 @@ static int swf_write_video(AVFormatContext *s, if (swf->audio_enc && av_fifo_size(swf->audio_fifo)) { int frame_size = av_fifo_size(swf->audio_fifo); put_swf_tag(s, TAG_STREAMBLOCK | TAG_LONG); - put_le16(pb, swf->sound_samples); - put_le16(pb, 0); // seek samples - av_fifo_generic_read(swf->audio_fifo, pb, frame_size, &put_buffer); + avio_wl16(pb, swf->sound_samples); + avio_wl16(pb, 0); // seek samples + av_fifo_generic_read(swf->audio_fifo, pb, frame_size, &avio_write); put_swf_end_tag(s); /* update FIFO */ @@ -473,7 +473,7 @@ static int swf_write_packet(AVFormatContext *s, AVPacket *pkt) static int swf_write_trailer(AVFormatContext *s) { SWFContext *swf = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *enc, *video_enc; int file_size, i; @@ -494,13 +494,13 @@ static int swf_write_trailer(AVFormatContext *s) /* patch file size and number of frames if not streamed */ if (!url_is_streamed(s->pb) && video_enc) { file_size = url_ftell(pb); - url_fseek(pb, 4, SEEK_SET); - put_le32(pb, file_size); - url_fseek(pb, swf->duration_pos, SEEK_SET); - put_le16(pb, swf->video_frame_number); - url_fseek(pb, swf->vframes_pos, SEEK_SET); - put_le16(pb, swf->video_frame_number); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, 4, SEEK_SET); + avio_wl32(pb, file_size); + avio_seek(pb, swf->duration_pos, SEEK_SET); + avio_wl16(pb, swf->video_frame_number); + avio_seek(pb, swf->vframes_pos, SEEK_SET); + avio_wl16(pb, swf->video_frame_number); + avio_seek(pb, file_size, SEEK_SET); } return 0; } diff --git a/mplayer/ffmpeg/libavformat/tcp.c b/mplayer/ffmpeg/libavformat/tcp.c index 3ee114a9..ce19c9cf 100644 --- a/mplayer/ffmpeg/libavformat/tcp.c +++ b/mplayer/ffmpeg/libavformat/tcp.c @@ -72,13 +72,13 @@ static int tcp_open(URLContext *h, const char *uri, int flags) ret = connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen); if (ret < 0) { struct pollfd p = {fd, POLLOUT, 0}; - if (ff_neterrno() == FF_NETERROR(EINTR)) { + if (ff_neterrno() == AVERROR(EINTR)) { if (url_interrupt_cb()) goto fail1; goto redo; } - if (ff_neterrno() != FF_NETERROR(EINPROGRESS) && - ff_neterrno() != FF_NETERROR(EAGAIN)) + if (ff_neterrno() != AVERROR(EINPROGRESS) && + ff_neterrno() != AVERROR(EAGAIN)) goto fail; /* wait until we are connected or until abort */ @@ -87,22 +87,31 @@ static int tcp_open(URLContext *h, const char *uri, int flags) ret = AVERROR(EINTR); goto fail1; } +#if defined(GEKKO) + usleep(1000); + connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen); + if (ff_neterrno() != AVERROR(EALREADY)) + break; +#else ret = poll(&p, 1, 100); if (ret > 0) break; +#endif } -#if !defined(GEKKO) /* test error */ +#if defined(GEKKO) + if (ff_neterrno() != AVERROR(EISCONN)) { +#else optlen = sizeof(ret); getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen); if (ret != 0) { +#endif av_log(NULL, AV_LOG_ERROR, "TCP connection to %s:%d failed: %s\n", hostname, port, strerror(ret)); goto fail; } -#endif } s = av_malloc(sizeof(TCPContext)); if (!s) { @@ -131,59 +140,46 @@ static int tcp_open(URLContext *h, const char *uri, int flags) return ret; } +static int tcp_wait_fd(int fd, int write) +{ + int ev = write ? POLLOUT : POLLIN; + struct pollfd p = { .fd = fd, .events = ev, .revents = 0 }; + int ret; + + ret = poll(&p, 1, 100); + return ret < 0 ? ff_neterrno() : p.revents & ev ? 0 : AVERROR(EAGAIN); +} + static int tcp_read(URLContext *h, uint8_t *buf, int size) { TCPContext *s = h->priv_data; - struct pollfd p = {s->fd, POLLIN, 0}; - int len, ret; - - for (;;) { - if (url_interrupt_cb()) - return AVERROR(EINTR); - ret = poll(&p, 1, 100); - if (ret == 1 && p.revents & POLLIN) { - len = recv(s->fd, buf, size, 0); - if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EINTR) && - ff_neterrno() != FF_NETERROR(EAGAIN)) - return ff_neterrno(); - } else return len; - } else if (ret < 0) { - if (ff_neterrno() == FF_NETERROR(EINTR)) - continue; - return -1; - } + int ret; + +#if !defined(GEKKO) + if (!(h->flags & URL_FLAG_NONBLOCK)) { + ret = tcp_wait_fd(s->fd, 0); + if (ret < 0) + return ret; } +#endif + ret = recv(s->fd, buf, size, 0); + return ret < 0 ? ff_neterrno() : ret; } static int tcp_write(URLContext *h, const uint8_t *buf, int size) { TCPContext *s = h->priv_data; - int ret, size1, len; - struct pollfd p = {s->fd, POLLOUT, 0}; - - size1 = size; - while (size > 0) { - if (url_interrupt_cb()) - return AVERROR(EINTR); - ret = poll(&p, 1, 100); - if (ret == 1 && p.revents & POLLOUT) { - len = send(s->fd, buf, size, 0); - if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EINTR) && - ff_neterrno() != FF_NETERROR(EAGAIN)) - return ff_neterrno(); - continue; - } - size -= len; - buf += len; - } else if (ret < 0) { - if (ff_neterrno() == FF_NETERROR(EINTR)) - continue; - return -1; - } + int ret; + +#if !defined(GEKKO) + if (!(h->flags & URL_FLAG_NONBLOCK)) { + ret = tcp_wait_fd(s->fd, 1); + if (ret < 0) + return ret; } - return size1 - size; +#endif + ret = send(s->fd, buf, size, 0); + return ret < 0 ? ff_neterrno() : ret; } static int tcp_close(URLContext *h) diff --git a/mplayer/ffmpeg/libavformat/thp.c b/mplayer/ffmpeg/libavformat/thp.c index 226f2fd2..2d1f74e3 100644 --- a/mplayer/ffmpeg/libavformat/thp.c +++ b/mplayer/ffmpeg/libavformat/thp.c @@ -57,35 +57,35 @@ static int thp_read_header(AVFormatContext *s, { ThpDemuxContext *thp = s->priv_data; AVStream *st; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int i; /* Read the file header. */ - get_be32(pb); /* Skip Magic. */ - thp->version = get_be32(pb); + avio_rb32(pb); /* Skip Magic. */ + thp->version = avio_rb32(pb); - get_be32(pb); /* Max buf size. */ - get_be32(pb); /* Max samples. */ + avio_rb32(pb); /* Max buf size. */ + avio_rb32(pb); /* Max samples. */ - thp->fps = av_d2q(av_int2flt(get_be32(pb)), INT_MAX); - thp->framecnt = get_be32(pb); - thp->first_framesz = get_be32(pb); - get_be32(pb); /* Data size. */ + thp->fps = av_d2q(av_int2flt(avio_rb32(pb)), INT_MAX); + thp->framecnt = avio_rb32(pb); + thp->first_framesz = avio_rb32(pb); + avio_rb32(pb); /* Data size. */ - thp->compoff = get_be32(pb); - get_be32(pb); /* offsetDataOffset. */ - thp->first_frame = get_be32(pb); - thp->last_frame = get_be32(pb); + thp->compoff = avio_rb32(pb); + avio_rb32(pb); /* offsetDataOffset. */ + thp->first_frame = avio_rb32(pb); + thp->last_frame = avio_rb32(pb); thp->next_framesz = thp->first_framesz; thp->next_frame = thp->first_frame; /* Read the component structure. */ - url_fseek (pb, thp->compoff, SEEK_SET); - thp->compcount = get_be32(pb); + avio_seek (pb, thp->compoff, SEEK_SET); + thp->compcount = avio_rb32(pb); /* Read the list of component types. */ - get_buffer(pb, thp->components, 16); + avio_read(pb, thp->components, 16); for (i = 0; i < thp->compcount; i++) { if (thp->components[i] == 0) { @@ -103,14 +103,14 @@ static int thp_read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_THP; st->codec->codec_tag = 0; /* no fourcc */ - st->codec->width = get_be32(pb); - st->codec->height = get_be32(pb); + st->codec->width = avio_rb32(pb); + st->codec->height = avio_rb32(pb); st->codec->sample_rate = av_q2d(thp->fps); thp->vst = st; thp->video_stream_index = st->index; if (thp->version == 0x11000) - get_be32(pb); /* Unknown. */ + avio_rb32(pb); /* Unknown. */ } else if (thp->components[i] == 1) { if (thp->has_audio != 0) break; @@ -123,8 +123,8 @@ static int thp_read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_ADPCM_THP; st->codec->codec_tag = 0; /* no fourcc */ - st->codec->channels = get_be32(pb); /* numChannels. */ - st->codec->sample_rate = get_be32(pb); /* Frequency. */ + st->codec->channels = avio_rb32(pb); /* numChannels. */ + st->codec->sample_rate = avio_rb32(pb); /* Frequency. */ av_set_pts_info(st, 64, 1, st->codec->sample_rate); @@ -140,7 +140,7 @@ static int thp_read_packet(AVFormatContext *s, AVPacket *pkt) { ThpDemuxContext *thp = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int size; int ret; @@ -149,19 +149,19 @@ static int thp_read_packet(AVFormatContext *s, if (thp->frame >= thp->framecnt) return AVERROR(EIO); - url_fseek(pb, thp->next_frame, SEEK_SET); + avio_seek(pb, thp->next_frame, SEEK_SET); /* Locate the next frame and read out its size. */ thp->next_frame += thp->next_framesz; - thp->next_framesz = get_be32(pb); + thp->next_framesz = avio_rb32(pb); - get_be32(pb); /* Previous total size. */ - size = get_be32(pb); /* Total size of this frame. */ + avio_rb32(pb); /* Previous total size. */ + size = avio_rb32(pb); /* Total size of this frame. */ /* Store the audiosize so the next time this function is called, the audio can be read. */ if (thp->has_audio) - thp->audiosize = get_be32(pb); /* Audio size. */ + thp->audiosize = avio_rb32(pb); /* Audio size. */ else thp->frame++; diff --git a/mplayer/ffmpeg/libavformat/tiertexseq.c b/mplayer/ffmpeg/libavformat/tiertexseq.c index 2992fa1b..f8a5db18 100644 --- a/mplayer/ffmpeg/libavformat/tiertexseq.c +++ b/mplayer/ffmpeg/libavformat/tiertexseq.c @@ -78,15 +78,15 @@ static int seq_probe(AVProbeData *p) return AVPROBE_SCORE_MAX / 4; } -static int seq_init_frame_buffers(SeqDemuxContext *seq, ByteIOContext *pb) +static int seq_init_frame_buffers(SeqDemuxContext *seq, AVIOContext *pb) { int i, sz; TiertexSeqFrameBuffer *seq_buffer; - url_fseek(pb, 256, SEEK_SET); + avio_seek(pb, 256, SEEK_SET); for (i = 0; i < SEQ_NUM_FRAME_BUFFERS; i++) { - sz = get_le16(pb); + sz = avio_rl16(pb); if (sz == 0) break; else { @@ -102,7 +102,7 @@ static int seq_init_frame_buffers(SeqDemuxContext *seq, ByteIOContext *pb) return 0; } -static int seq_fill_buffer(SeqDemuxContext *seq, ByteIOContext *pb, int buffer_num, unsigned int data_offs, int data_size) +static int seq_fill_buffer(SeqDemuxContext *seq, AVIOContext *pb, int buffer_num, unsigned int data_offs, int data_size) { TiertexSeqFrameBuffer *seq_buffer; @@ -113,25 +113,25 @@ static int seq_fill_buffer(SeqDemuxContext *seq, ByteIOContext *pb, int buffer_n if (seq_buffer->fill_size + data_size > seq_buffer->data_size || data_size <= 0) return AVERROR_INVALIDDATA; - url_fseek(pb, seq->current_frame_offs + data_offs, SEEK_SET); - if (get_buffer(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size) + avio_seek(pb, seq->current_frame_offs + data_offs, SEEK_SET); + if (avio_read(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size) return AVERROR(EIO); seq_buffer->fill_size += data_size; return 0; } -static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb) +static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb) { unsigned int offset_table[4], buffer_num[4]; TiertexSeqFrameBuffer *seq_buffer; int i, e, err; seq->current_frame_offs += SEQ_FRAME_SIZE; - url_fseek(pb, seq->current_frame_offs, SEEK_SET); + avio_seek(pb, seq->current_frame_offs, SEEK_SET); /* sound data */ - seq->current_audio_data_offs = get_le16(pb); + seq->current_audio_data_offs = avio_rl16(pb); if (seq->current_audio_data_offs) { seq->current_audio_data_size = SEQ_AUDIO_BUFFER_SIZE * 2; } else { @@ -139,7 +139,7 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb) } /* palette data */ - seq->current_pal_data_offs = get_le16(pb); + seq->current_pal_data_offs = avio_rl16(pb); if (seq->current_pal_data_offs) { seq->current_pal_data_size = 768; } else { @@ -148,10 +148,10 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb) /* video data */ for (i = 0; i < 4; i++) - buffer_num[i] = get_byte(pb); + buffer_num[i] = avio_r8(pb); for (i = 0; i < 4; i++) - offset_table[i] = get_le16(pb); + offset_table[i] = avio_rl16(pb); for (i = 0; i < 3; i++) { if (offset_table[i]) { @@ -184,7 +184,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap) { int i, rc; SeqDemuxContext *seq = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; /* init internal buffers */ @@ -241,7 +241,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) { int rc; SeqDemuxContext *seq = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (!seq->audio_buffer_full) { rc = seq_parse_frame_data(seq, pb); @@ -256,8 +256,8 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->data[0] = 0; if (seq->current_pal_data_size) { pkt->data[0] |= 1; - url_fseek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET); - if (get_buffer(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size) + avio_seek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET); + if (avio_read(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size) return AVERROR(EIO); } if (seq->current_video_data_size) { @@ -279,7 +279,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) if (seq->current_audio_data_offs == 0) /* end of data reached */ return AVERROR(EIO); - url_fseek(pb, seq->current_frame_offs + seq->current_audio_data_offs, SEEK_SET); + avio_seek(pb, seq->current_frame_offs + seq->current_audio_data_offs, SEEK_SET); rc = av_get_packet(pb, pkt, seq->current_audio_data_size); if (rc < 0) return rc; diff --git a/mplayer/ffmpeg/libavformat/tmv.c b/mplayer/ffmpeg/libavformat/tmv.c index 72d0f294..c632988e 100644 --- a/mplayer/ffmpeg/libavformat/tmv.c +++ b/mplayer/ffmpeg/libavformat/tmv.c @@ -65,12 +65,12 @@ static int tmv_probe(AVProbeData *p) static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) { TMVContext *tmv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *vst, *ast; AVRational fps; unsigned comp_method, char_cols, char_rows, features; - if (get_le32(pb) != TMV_TAG) + if (avio_rl32(pb) != TMV_TAG) return -1; if (!(vst = av_new_stream(s, 0))) @@ -79,30 +79,30 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) if (!(ast = av_new_stream(s, 0))) return AVERROR(ENOMEM); - ast->codec->sample_rate = get_le16(pb); + ast->codec->sample_rate = avio_rl16(pb); if (!ast->codec->sample_rate) { av_log(s, AV_LOG_ERROR, "invalid sample rate\n"); return -1; } - tmv->audio_chunk_size = get_le16(pb); + tmv->audio_chunk_size = avio_rl16(pb); if (!tmv->audio_chunk_size) { av_log(s, AV_LOG_ERROR, "invalid audio chunk size\n"); return -1; } - comp_method = get_byte(pb); + comp_method = avio_r8(pb); if (comp_method) { av_log(s, AV_LOG_ERROR, "unsupported compression method %d\n", comp_method); return -1; } - char_cols = get_byte(pb); - char_rows = get_byte(pb); + char_cols = avio_r8(pb); + char_rows = avio_r8(pb); tmv->video_chunk_size = char_cols * char_rows * 2; - features = get_byte(pb); + features = avio_r8(pb); if (features & ~(TMV_PADDING | TMV_STEREO)) { av_log(s, AV_LOG_ERROR, "unsupported features 0x%02x\n", features & ~(TMV_PADDING | TMV_STEREO)); @@ -142,7 +142,7 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) static int tmv_read_packet(AVFormatContext *s, AVPacket *pkt) { TMVContext *tmv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret, pkt_size = tmv->stream_index ? tmv->audio_chunk_size : tmv->video_chunk_size; @@ -152,7 +152,7 @@ static int tmv_read_packet(AVFormatContext *s, AVPacket *pkt) ret = av_get_packet(pb, pkt, pkt_size); if (tmv->stream_index) - url_fskip(pb, tmv->padding); + avio_seek(pb, tmv->padding, SEEK_CUR); pkt->stream_index = tmv->stream_index; tmv->stream_index ^= 1; @@ -173,7 +173,7 @@ static int tmv_read_seek(AVFormatContext *s, int stream_index, pos = timestamp * (tmv->audio_chunk_size + tmv->video_chunk_size + tmv->padding); - url_fseek(s->pb, pos + TMV_HEADER_SIZE, SEEK_SET); + avio_seek(s->pb, pos + TMV_HEADER_SIZE, SEEK_SET); tmv->stream_index = 0; return 0; } diff --git a/mplayer/ffmpeg/libavformat/tta.c b/mplayer/ffmpeg/libavformat/tta.c index 21b7538d..221cdf3e 100644 --- a/mplayer/ffmpeg/libavformat/tta.c +++ b/mplayer/ffmpeg/libavformat/tta.c @@ -47,25 +47,25 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) ff_id3v1_read(s); start_offset = url_ftell(s->pb); - if (get_le32(s->pb) != AV_RL32("TTA1")) + if (avio_rl32(s->pb) != AV_RL32("TTA1")) return -1; // not tta file - url_fskip(s->pb, 2); // FIXME: flags - channels = get_le16(s->pb); - bps = get_le16(s->pb); - samplerate = get_le32(s->pb); + avio_seek(s->pb, 2, SEEK_CUR); // FIXME: flags + channels = avio_rl16(s->pb); + bps = avio_rl16(s->pb); + samplerate = avio_rl32(s->pb); if(samplerate <= 0 || samplerate > 1000000){ av_log(s, AV_LOG_ERROR, "nonsense samplerate\n"); return -1; } - datalen = get_le32(s->pb); + datalen = avio_rl32(s->pb); if(datalen < 0){ av_log(s, AV_LOG_ERROR, "nonsense datalen\n"); return -1; } - url_fskip(s->pb, 4); // header crc + avio_seek(s->pb, 4, SEEK_CUR); // header crc framelen = samplerate*256/245; c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0); @@ -87,11 +87,11 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) framepos = url_ftell(s->pb) + 4*c->totalframes + 4; for (i = 0; i < c->totalframes; i++) { - uint32_t size = get_le32(s->pb); + uint32_t size = avio_rl32(s->pb); av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME); framepos += size; } - url_fskip(s->pb, 4); // seektable crc + avio_seek(s->pb, 4, SEEK_CUR); // seektable crc st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_TTA; @@ -101,13 +101,13 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->extradata_size = url_ftell(s->pb) - start_offset; if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){ - //this check is redundant as get_buffer should fail + //this check is redundant as avio_read should fail av_log(s, AV_LOG_ERROR, "extradata_size too large\n"); return -1; } st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE); - url_fseek(s->pb, start_offset, SEEK_SET); - get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size); + avio_seek(s->pb, start_offset, SEEK_SET); + avio_read(s->pb, st->codec->extradata, st->codec->extradata_size); return 0; } @@ -138,7 +138,7 @@ static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp return -1; c->currentframe = index; - url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); return 0; } diff --git a/mplayer/ffmpeg/libavformat/tty.c b/mplayer/ffmpeg/libavformat/tty.c index 0adbaf1f..74750584 100644 --- a/mplayer/ffmpeg/libavformat/tty.c +++ b/mplayer/ffmpeg/libavformat/tty.c @@ -42,19 +42,19 @@ typedef struct { static int efi_read(AVFormatContext *avctx, uint64_t start_pos) { TtyDemuxContext *s = avctx->priv_data; - ByteIOContext *pb = avctx->pb; + AVIOContext *pb = avctx->pb; char buf[37]; int len; - url_fseek(pb, start_pos, SEEK_SET); - if (get_byte(pb) != 0x1A) + avio_seek(pb, start_pos, SEEK_SET); + if (avio_r8(pb) != 0x1A) return -1; #define GET_EFI_META(name,size) \ - len = get_byte(pb); \ + len = avio_r8(pb); \ if (len < 1 || len > size) \ return -1; \ - if (get_buffer(pb, buf, size) == size) { \ + if (avio_read(pb, buf, size) == size) { \ buf[len] = 0; \ av_metadata_set2(&avctx->metadata, name, buf, 0); \ } @@ -95,7 +95,7 @@ static int read_header(AVFormatContext *avctx, if (ff_sauce_read(avctx, &s->fsize, 0, 0) < 0) efi_read(avctx, s->fsize - 51); - url_fseek(avctx->pb, 0, SEEK_SET); + avio_seek(avctx->pb, 0, SEEK_SET); } return 0; @@ -120,7 +120,7 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt) pkt->size = av_get_packet(avctx->pb, pkt, n); if (pkt->size <= 0) return AVERROR(EIO); - pkt->flags |= PKT_FLAG_KEY; + pkt->flags |= AV_PKT_FLAG_KEY; return 0; } diff --git a/mplayer/ffmpeg/libavformat/txd.c b/mplayer/ffmpeg/libavformat/txd.c index eb5e8b33..22dcfdbe 100644 --- a/mplayer/ffmpeg/libavformat/txd.c +++ b/mplayer/ffmpeg/libavformat/txd.c @@ -52,14 +52,14 @@ static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) { } static int txd_read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int id, chunk_size, marker; int ret; next_chunk: - id = get_le32(pb); - chunk_size = get_le32(pb); - marker = get_le32(pb); + id = avio_rl32(pb); + chunk_size = avio_rl32(pb); + marker = avio_rl32(pb); if (url_feof(s->pb)) return AVERROR_EOF; @@ -73,7 +73,7 @@ static int txd_read_packet(AVFormatContext *s, AVPacket *pkt) { if (chunk_size > 100) break; case TXD_EXTRA: - url_fskip(s->pb, chunk_size); + avio_seek(s->pb, chunk_size, SEEK_CUR); case TXD_FILE: case TXD_TEXTURE: goto next_chunk; diff --git a/mplayer/ffmpeg/libavformat/udp.c b/mplayer/ffmpeg/libavformat/udp.c index aa17c979..01965732 100644 --- a/mplayer/ffmpeg/libavformat/udp.c +++ b/mplayer/ffmpeg/libavformat/udp.c @@ -27,6 +27,7 @@ #define _BSD_SOURCE /* Needed for using struct ip_mreq with recent glibc */ #define _DARWIN_C_SOURCE /* Needed for using IP_MULTICAST_TTL on OS X */ #include "avformat.h" +#include "libavutil/parseutils.h" #include #include "internal.h" #include "network.h" @@ -259,7 +260,7 @@ int udp_set_remote_url(URLContext *h, const char *uri) s->is_multicast = ff_is_multicast_address((struct sockaddr*) &s->dest_addr); p = strchr(uri, '?'); if (p) { - if (find_info_tag(buf, sizeof(buf), "connect", p)) { + if (av_find_info_tag(buf, sizeof(buf), "connect", p)) { int was_connected = s->is_connected; s->is_connected = strtol(buf, NULL, 10); if (s->is_connected && !was_connected) { @@ -313,6 +314,7 @@ static int udp_open(URLContext *h, const char *uri, int flags) char buf[256]; struct sockaddr_storage my_addr; int len; + int reuse_specified = 0; h->is_streamed = 1; h->max_packet_size = 1472; @@ -329,20 +331,27 @@ static int udp_open(URLContext *h, const char *uri, int flags) p = strchr(uri, '?'); if (p) { - s->reuse_socket = find_info_tag(buf, sizeof(buf), "reuse", p); - if (find_info_tag(buf, sizeof(buf), "ttl", p)) { + if (av_find_info_tag(buf, sizeof(buf), "reuse", p)) { + const char *endptr=NULL; + s->reuse_socket = strtol(buf, &endptr, 10); + /* assume if no digits were found it is a request to enable it */ + if (buf == endptr) + s->reuse_socket = 1; + reuse_specified = 1; + } + if (av_find_info_tag(buf, sizeof(buf), "ttl", p)) { s->ttl = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "localport", p)) { + if (av_find_info_tag(buf, sizeof(buf), "localport", p)) { s->local_port = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) { + if (av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) { h->max_packet_size = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "buffer_size", p)) { + if (av_find_info_tag(buf, sizeof(buf), "buffer_size", p)) { s->buffer_size = strtol(buf, NULL, 10); } - if (find_info_tag(buf, sizeof(buf), "connect", p)) { + if (av_find_info_tag(buf, sizeof(buf), "connect", p)) { s->is_connected = strtol(buf, NULL, 10); } } @@ -366,9 +375,14 @@ static int udp_open(URLContext *h, const char *uri, int flags) if (udp_fd < 0) goto fail; - if (s->reuse_socket) + /* Follow the requested reuse option, unless it's multicast in which + * case enable reuse unless explicitely disabled. + */ + if (s->reuse_socket || (s->is_multicast && !reuse_specified)) { + s->reuse_socket = 1; if (setsockopt (udp_fd, SOL_SOCKET, SO_REUSEADDR, &(s->reuse_socket), sizeof(s->reuse_socket)) != 0) goto fail; + } /* the bind is needed to give a port to the socket now */ /* if multicast, try the multicast address bind first */ @@ -441,7 +455,7 @@ static int udp_read(URLContext *h, uint8_t *buf, int size) return AVERROR(EINTR); ret = poll(&p, 1, 100); if (ret < 0) { - if (ff_neterrno() == FF_NETERROR(EINTR)) + if (ff_neterrno() == AVERROR(EINTR)) continue; return AVERROR(EIO); } @@ -449,8 +463,8 @@ static int udp_read(URLContext *h, uint8_t *buf, int size) continue; len = recv(s->udp_fd, buf, size, 0); if (len < 0) { - if (ff_neterrno() != FF_NETERROR(EAGAIN) && - ff_neterrno() != FF_NETERROR(EINTR)) + if (ff_neterrno() != AVERROR(EAGAIN) && + ff_neterrno() != AVERROR(EINTR)) return AVERROR(EIO); } else { break; @@ -472,8 +486,8 @@ static int udp_write(URLContext *h, const uint8_t *buf, int size) } else ret = send(s->udp_fd, buf, size, 0); if (ret < 0) { - if (ff_neterrno() != FF_NETERROR(EINTR) && - ff_neterrno() != FF_NETERROR(EAGAIN)) + if (ff_neterrno() != AVERROR(EINTR) && + ff_neterrno() != AVERROR(EAGAIN)) return ff_neterrno(); } else { break; diff --git a/mplayer/ffmpeg/libavformat/utils.c b/mplayer/ffmpeg/libavformat/utils.c index 5cd23c8e..a86dffe3 100644 --- a/mplayer/ffmpeg/libavformat/utils.c +++ b/mplayer/ffmpeg/libavformat/utils.c @@ -325,7 +325,7 @@ FF_SYMVER(void, av_init_packet, (AVPacket *pkt), "LIBAVFORMAT_52") } #endif -int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size) +int av_get_packet(AVIOContext *s, AVPacket *pkt, int size) { int ret= av_new_packet(pkt, size); @@ -334,7 +334,7 @@ int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size) pkt->pos= url_ftell(s); - ret= get_buffer(s, pkt->data, size); + ret= avio_read(s, pkt->data, size); if(ret<=0) av_free_packet(pkt); else @@ -343,7 +343,7 @@ int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size) return ret; } -int av_append_packet(ByteIOContext *s, AVPacket *pkt, int size) +int av_append_packet(AVIOContext *s, AVPacket *pkt, int size) { int ret; int old_size; @@ -353,7 +353,7 @@ int av_append_packet(ByteIOContext *s, AVPacket *pkt, int size) ret = av_grow_packet(pkt, size); if (ret < 0) return ret; - ret = get_buffer(s, pkt->data + old_size, size); + ret = avio_read(s, pkt->data + old_size, size); av_shrink_packet(pkt, old_size + FFMAX(ret, 0)); return ret; } @@ -444,7 +444,7 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st, AVProbeDa * Open a media file from an IO stream. 'fmt' must be specified. */ int av_open_input_stream(AVFormatContext **ic_ptr, - ByteIOContext *pb, const char *filename, + AVIOContext *pb, const char *filename, AVInputFormat *fmt, AVFormatParameters *ap) { int err; @@ -481,7 +481,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr, ic->priv_data = NULL; } - // e.g. AVFMT_NOFILE formats will not have a ByteIOContext + // e.g. AVFMT_NOFILE formats will not have a AVIOContext if (ic->pb) ff_id3v2_read(ic, ID3v2_DEFAULT_MAGIC); @@ -526,7 +526,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr, #define PROBE_BUF_MIN 2048 #define PROBE_BUF_MAX (1<<20) -int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt, +int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { @@ -557,7 +557,7 @@ int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt, /* read probe data */ buf = av_realloc(buf, probe_size + AVPROBE_PADDING_SIZE); - if ((ret = get_buffer(*pb, buf + buf_offset, probe_size - buf_offset)) < 0) { + if ((ret = avio_read(pb, buf + buf_offset, probe_size - buf_offset)) < 0) { /* fail if error was not end of file, otherwise, lower score */ if (ret != AVERROR_EOF) { av_free(buf); @@ -587,7 +587,7 @@ int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt, } /* rewind. reuse probe buffer to avoid seeking */ - if ((ret = ff_rewind_with_probe_data(*pb, buf, pd.buf_size)) < 0) + if ((ret = ff_rewind_with_probe_data(pb, buf, pd.buf_size)) < 0) av_free(buf); return ret; @@ -600,7 +600,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, { int err; AVProbeData probe_data, *pd = &probe_data; - ByteIOContext *pb = NULL; + AVIOContext *pb = NULL; void *logctx= ap && ap->prealloced_context ? *ic_ptr : NULL; pd->filename = ""; @@ -618,13 +618,13 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, hack needed to handle RTSP/TCP */ if (!fmt || !(fmt->flags & AVFMT_NOFILE)) { /* if no file needed do not try to open one */ - if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) { + if ((err=avio_open(&pb, filename, URL_RDONLY)) < 0) { goto fail; } if (buf_size > 0) { url_setbufsize(pb, buf_size); } - if (!fmt && (err = ff_probe_input_buffer(&pb, &fmt, filename, logctx, 0, logctx ? (*ic_ptr)->probesize : 0)) < 0) { + if (!fmt && (err = av_probe_input_buffer(pb, &fmt, filename, logctx, 0, logctx ? (*ic_ptr)->probesize : 0)) < 0) { goto fail; } } @@ -649,7 +649,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, fail: av_freep(&pd->buf); if (pb) - url_fclose(pb); + avio_close(pb); if (ap && ap->prealloced_context) av_free(*ic_ptr); *ic_ptr = NULL; @@ -932,6 +932,12 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, /* do we have a video B-frame ? */ delay= st->codec->has_b_frames; presentation_delayed = 0; + + // ignore delay caused by frame threading so that the mpeg2-without-dts + // warning will not trigger + if (delay && st->codec->active_thread_type&FF_THREAD_FRAME) + delay -= st->codec->thread_count-1; + /* XXX: need has_b_frame, but cannot get it if the codec is not initialized */ if (delay && @@ -1372,28 +1378,30 @@ void ff_reduce_index(AVFormatContext *s, int stream_index) } } -int av_add_index_entry(AVStream *st, - int64_t pos, int64_t timestamp, int size, int distance, int flags) +int ff_add_index_entry(AVIndexEntry **index_entries, + int *nb_index_entries, + unsigned int *index_entries_allocated_size, + int64_t pos, int64_t timestamp, int size, int distance, int flags) { AVIndexEntry *entries, *ie; int index; - if((unsigned)st->nb_index_entries + 1 >= UINT_MAX / sizeof(AVIndexEntry)) + if((unsigned)*nb_index_entries + 1 >= UINT_MAX / sizeof(AVIndexEntry)) return -1; - entries = av_fast_realloc(st->index_entries, - &st->index_entries_allocated_size, - (st->nb_index_entries + 1) * + entries = av_fast_realloc(*index_entries, + index_entries_allocated_size, + (*nb_index_entries + 1) * sizeof(AVIndexEntry)); if(!entries) return -1; - st->index_entries= entries; + *index_entries= entries; - index= av_index_search_timestamp(st, timestamp, AVSEEK_FLAG_ANY); + index= ff_index_search_timestamp(*index_entries, *nb_index_entries, timestamp, AVSEEK_FLAG_ANY); if(index<0){ - index= st->nb_index_entries++; + index= (*nb_index_entries)++; ie= &entries[index]; assert(index==0 || ie[-1].timestamp < timestamp); }else{ @@ -1401,8 +1409,8 @@ int av_add_index_entry(AVStream *st, if(ie->timestamp != timestamp){ if(ie->timestamp <= timestamp) return -1; - memmove(entries + index + 1, entries + index, sizeof(AVIndexEntry)*(st->nb_index_entries - index)); - st->nb_index_entries++; + memmove(entries + index + 1, entries + index, sizeof(AVIndexEntry)*(*nb_index_entries - index)); + (*nb_index_entries)++; }else if(ie->pos == pos && distance < ie->min_distance) //do not reduce the distance distance= ie->min_distance; } @@ -1416,11 +1424,17 @@ int av_add_index_entry(AVStream *st, return index; } -int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp, - int flags) +int av_add_index_entry(AVStream *st, + int64_t pos, int64_t timestamp, int size, int distance, int flags) +{ + return ff_add_index_entry(&st->index_entries, &st->nb_index_entries, + &st->index_entries_allocated_size, pos, + timestamp, size, distance, flags); +} + +int ff_index_search_timestamp(const AVIndexEntry *entries, int nb_entries, + int64_t wanted_timestamp, int flags) { - AVIndexEntry *entries= st->index_entries; - int nb_entries= st->nb_index_entries; int a, b, m; int64_t timestamp; @@ -1452,6 +1466,13 @@ int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp, return m; } +int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp, + int flags) +{ + return ff_index_search_timestamp(st->index_entries, st->nb_index_entries, + wanted_timestamp, flags); +} + #define DEBUG_SEEK int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){ @@ -1512,7 +1533,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts return -1; /* do the seek */ - if ((ret = url_fseek(s->pb, pos, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, pos, SEEK_SET)) < 0) return ret; av_update_cur_dts(s, st, ts); @@ -1652,7 +1673,7 @@ static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, if (pos < pos_min) pos= pos_min; else if(pos > pos_max) pos= pos_max; - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); #if 0 av_update_cur_dts(s, st, ts); @@ -1682,11 +1703,11 @@ static int av_seek_frame_generic(AVFormatContext *s, if(st->nb_index_entries){ assert(st->index_entries); ie= &st->index_entries[st->nb_index_entries-1]; - if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0) return ret; av_update_cur_dts(s, st, ie->timestamp); }else{ - if ((ret = url_fseek(s->pb, s->data_offset, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, s->data_offset, SEEK_SET)) < 0) return ret; } for(i=0;; i++) { @@ -1713,7 +1734,7 @@ static int av_seek_frame_generic(AVFormatContext *s, return 0; } ie = &st->index_entries[index]; - if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0) return ret; av_update_cur_dts(s, st, ie->timestamp); @@ -1937,7 +1958,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset if (offset < 0) offset = 0; - url_fseek(ic->pb, offset, SEEK_SET); + avio_seek(ic->pb, offset, SEEK_SET); read_size = 0; for(;;) { if (read_size >= DURATION_MAX_READ_SIZE<<(FFMAX(retry-1,0))) @@ -1972,7 +1993,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset fill_all_stream_timings(ic); - url_fseek(ic->pb, old_offset, SEEK_SET); + avio_seek(ic->pb, old_offset, SEEK_SET); for (i=0; inb_streams; i++) { st= ic->streams[i]; st->cur_dts= st->first_dts; @@ -2497,6 +2518,8 @@ int av_find_best_stream(AVFormatContext *ic, continue; if (wanted_stream_nb >= 0 && stream_number++ != wanted_stream_nb) continue; + if (st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED|AV_DISPOSITION_VISUAL_IMPAIRED)) + continue; if (decoder_ret) { decoder = avcodec_find_decoder(ic->streams[i]->codec->codec_id); if (!decoder) { @@ -2508,7 +2531,7 @@ int av_find_best_stream(AVFormatContext *ic, if (best_count >= st->codec_info_nb_frames) continue; best_count = st->codec_info_nb_frames; - ret = i; + ret = program ? program[i] : i; best_decoder = decoder; if (program && i == nb_streams - 1 && ret < 0) { program = NULL; @@ -2543,12 +2566,17 @@ int av_read_pause(AVFormatContext *s) void av_close_input_stream(AVFormatContext *s) { - int i; - AVStream *st; - flush_packet_queue(s); if (s->iformat->read_close) s->iformat->read_close(s); + avformat_free_context(s); +} + +void avformat_free_context(AVFormatContext *s) +{ + int i; + AVStream *st; + for(i=0;inb_streams;i++) { /* free all data in a stream component */ st = s->streams[i]; @@ -2594,10 +2622,10 @@ void av_close_input_stream(AVFormatContext *s) void av_close_input_file(AVFormatContext *s) { - ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb; + AVIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb; av_close_input_stream(s); if (pb) - url_fclose(pb); + avio_close(pb); } AVStream *av_new_stream(AVFormatContext *s, int id) @@ -3211,14 +3239,44 @@ static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_out if(st->codec->time_base.den && st->codec->time_base.num) print_fps(1/av_q2d(st->codec->time_base), "tbc"); } + if (st->disposition & AV_DISPOSITION_DEFAULT) + av_log(NULL, AV_LOG_INFO, " (default)"); + if (st->disposition & AV_DISPOSITION_DUB) + av_log(NULL, AV_LOG_INFO, " (dub)"); + if (st->disposition & AV_DISPOSITION_ORIGINAL) + av_log(NULL, AV_LOG_INFO, " (original)"); + if (st->disposition & AV_DISPOSITION_COMMENT) + av_log(NULL, AV_LOG_INFO, " (comment)"); + if (st->disposition & AV_DISPOSITION_LYRICS) + av_log(NULL, AV_LOG_INFO, " (lyrics)"); + if (st->disposition & AV_DISPOSITION_KARAOKE) + av_log(NULL, AV_LOG_INFO, " (karaoke)"); + if (st->disposition & AV_DISPOSITION_FORCED) + av_log(NULL, AV_LOG_INFO, " (forced)"); + if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) + av_log(NULL, AV_LOG_INFO, " (hearing impaired)"); + if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) + av_log(NULL, AV_LOG_INFO, " (visual impaired)"); + if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) + av_log(NULL, AV_LOG_INFO, " (clean effects)"); av_log(NULL, AV_LOG_INFO, "\n"); dump_metadata(NULL, st->metadata, " "); } +#if FF_API_DUMP_FORMAT void dump_format(AVFormatContext *ic, int index, const char *url, int is_output) +{ + av_dump_format(ic, index, url, is_output); +} +#endif + +void av_dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output) { int i; uint8_t *printed = av_mallocz(ic->nb_streams); @@ -3295,7 +3353,7 @@ void dump_format(AVFormatContext *ic, } #if FF_API_PARSE_FRAME_PARAM -#include "libavcore/parseutils.h" +#include "libavutil/parseutils.h" int parse_image_size(int *width_ptr, int *height_ptr, const char *str) { @@ -3324,163 +3382,25 @@ uint64_t ff_ntp_time(void) return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US; } -int64_t parse_date(const char *datestr, int duration) -{ - const char *p; - int64_t t; - struct tm dt; - int i; - static const char * const date_fmt[] = { - "%Y-%m-%d", - "%Y%m%d", - }; - static const char * const time_fmt[] = { - "%H:%M:%S", - "%H%M%S", - }; - const char *q; - int is_utc, len; - char lastch; - int negative = 0; - -#undef time - time_t now = time(0); - - len = strlen(datestr); - if (len > 0) - lastch = datestr[len - 1]; - else - lastch = '\0'; - is_utc = (lastch == 'z' || lastch == 'Z'); - - memset(&dt, 0, sizeof(dt)); - - p = datestr; - q = NULL; - if (!duration) { - if (!strncasecmp(datestr, "now", len)) - return (int64_t) now * 1000000; - - /* parse the year-month-day part */ - for (i = 0; i < FF_ARRAY_ELEMS(date_fmt); i++) { - q = small_strptime(p, date_fmt[i], &dt); - if (q) { - break; - } - } - - /* if the year-month-day part is missing, then take the - * current year-month-day time */ - if (!q) { - if (is_utc) { - dt = *gmtime(&now); - } else { - dt = *localtime(&now); - } - dt.tm_hour = dt.tm_min = dt.tm_sec = 0; - } else { - p = q; - } - - if (*p == 'T' || *p == 't' || *p == ' ') - p++; - - /* parse the hour-minute-second part */ - for (i = 0; i < FF_ARRAY_ELEMS(time_fmt); i++) { - q = small_strptime(p, time_fmt[i], &dt); - if (q) { - break; - } - } - } else { - /* parse datestr as a duration */ - if (p[0] == '-') { - negative = 1; - ++p; - } - /* parse datestr as HH:MM:SS */ - q = small_strptime(p, time_fmt[0], &dt); - if (!q) { - /* parse datestr as S+ */ - dt.tm_sec = strtol(p, (char **)&q, 10); - if (q == p) - /* the parsing didn't succeed */ - return INT64_MIN; - dt.tm_min = 0; - dt.tm_hour = 0; - } - } - - /* Now we have all the fields that we can get */ - if (!q) { - return INT64_MIN; - } - - if (duration) { - t = dt.tm_hour * 3600 + dt.tm_min * 60 + dt.tm_sec; - } else { - dt.tm_isdst = -1; /* unknown */ - if (is_utc) { - t = mktimegm(&dt); - } else { - t = mktime(&dt); - } - } - - t *= 1000000; +#if FF_API_PARSE_DATE +#include "libavutil/parseutils.h" - /* parse the .m... part */ - if (*q == '.') { - int val, n; - q++; - for (val = 0, n = 100000; n >= 1; n /= 10, q++) { - if (!isdigit(*q)) - break; - val += n * (*q - '0'); - } - t += val; - } - return negative ? -t : t; +int64_t parse_date(const char *timestr, int duration) +{ + int64_t timeval; + av_parse_time(&timeval, timestr, duration); + return timeval; } +#endif + +#if FF_API_FIND_INFO_TAG +#include "libavutil/parseutils.h" int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info) { - const char *p; - char tag[128], *q; - - p = info; - if (*p == '?') - p++; - for(;;) { - q = tag; - while (*p != '\0' && *p != '=' && *p != '&') { - if ((q - tag) < sizeof(tag) - 1) - *q++ = *p; - p++; - } - *q = '\0'; - q = arg; - if (*p == '=') { - p++; - while (*p != '&' && *p != '\0') { - if ((q - arg) < arg_size - 1) { - if (*p == '+') - *q++ = ' '; - else - *q++ = *p; - } - p++; - } - } - *q = '\0'; - if (!strcmp(tag, tag1)) - return 1; - if (*p != '&') - break; - p++; - } - return 0; + return av_find_info_tag(arg, arg_size, tag1, info); } +#endif int av_get_frame_filename(char *buf, int buf_size, const char *path, int number) @@ -3576,26 +3496,25 @@ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size) hex_dump_internal(avcl, NULL, level, buf, size); } - //FIXME needs to know the time_base -static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int dump_payload) +static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int dump_payload, AVRational time_base) { #undef fprintf #define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0) PRINT("stream #%d:\n", pkt->stream_index); PRINT(" keyframe=%d\n", ((pkt->flags & AV_PKT_FLAG_KEY) != 0)); - PRINT(" duration=%0.3f\n", (double)pkt->duration / AV_TIME_BASE); + PRINT(" duration=%0.3f\n", pkt->duration * av_q2d(time_base)); /* DTS is _always_ valid after av_read_frame() */ PRINT(" dts="); if (pkt->dts == AV_NOPTS_VALUE) PRINT("N/A"); else - PRINT("%0.3f", (double)pkt->dts / AV_TIME_BASE); + PRINT("%0.3f", pkt->dts * av_q2d(time_base)); /* PTS may not be known if B-frames are present. */ PRINT(" pts="); if (pkt->pts == AV_NOPTS_VALUE) PRINT("N/A"); else - PRINT("%0.3f", (double)pkt->pts / AV_TIME_BASE); + PRINT("%0.3f", pkt->pts * av_q2d(time_base)); PRINT("\n"); PRINT(" size=%d\n", pkt->size); #undef PRINT @@ -3605,12 +3524,25 @@ static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload) { - pkt_dump_internal(NULL, f, 0, pkt, dump_payload); + AVRational tb = { 1, AV_TIME_BASE }; + pkt_dump_internal(NULL, f, 0, pkt, dump_payload, tb); +} + +void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st) +{ + pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base); } void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload) { - pkt_dump_internal(avcl, NULL, level, pkt, dump_payload); + AVRational tb = { 1, AV_TIME_BASE }; + pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, tb); +} + +void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, + AVStream *st) +{ + pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base); } #if FF_API_URL_SPLIT @@ -3744,16 +3676,19 @@ int ff_hex_to_data(uint8_t *data, const char *p) void av_set_pts_info(AVStream *s, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den) { - s->pts_wrap_bits = pts_wrap_bits; - - if(av_reduce(&s->time_base.num, &s->time_base.den, pts_num, pts_den, INT_MAX)){ - if(s->time_base.num != pts_num) - av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, pts_num/s->time_base.num); + AVRational new_tb; + if(av_reduce(&new_tb.num, &new_tb.den, pts_num, pts_den, INT_MAX)){ + if(new_tb.num != pts_num) + av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, pts_num/new_tb.num); }else av_log(NULL, AV_LOG_WARNING, "st:%d has too large timebase, reducing\n", s->index); - if(!s->time_base.num || !s->time_base.den) - s->time_base.num= s->time_base.den= 0; + if(new_tb.num <= 0 || new_tb.den <= 0) { + av_log(NULL, AV_LOG_ERROR, "Ignoring attempt to set invalid timebase for st:%d\n", s->index); + return; + } + s->time_base = new_tb; + s->pts_wrap_bits = pts_wrap_bits; } int ff_url_join(char *str, int size, const char *proto, diff --git a/mplayer/ffmpeg/libavformat/vc1test.c b/mplayer/ffmpeg/libavformat/vc1test.c index 8dd735da..2f84b526 100644 --- a/mplayer/ffmpeg/libavformat/vc1test.c +++ b/mplayer/ffmpeg/libavformat/vc1test.c @@ -44,13 +44,13 @@ static int vc1t_probe(AVProbeData *p) static int vc1t_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; int frames; uint32_t fps; - frames = get_le24(pb); - if(get_byte(pb) != 0xC5 || get_le32(pb) != 4) + frames = avio_rl24(pb); + if(avio_r8(pb) != 0xC5 || avio_rl32(pb) != 4) return -1; /* init video codec */ @@ -63,13 +63,13 @@ static int vc1t_read_header(AVFormatContext *s, st->codec->extradata = av_malloc(VC1_EXTRADATA_SIZE); st->codec->extradata_size = VC1_EXTRADATA_SIZE; - get_buffer(pb, st->codec->extradata, VC1_EXTRADATA_SIZE); - st->codec->height = get_le32(pb); - st->codec->width = get_le32(pb); - if(get_le32(pb) != 0xC) + avio_read(pb, st->codec->extradata, VC1_EXTRADATA_SIZE); + st->codec->height = avio_rl32(pb); + st->codec->width = avio_rl32(pb); + if(avio_rl32(pb) != 0xC) return -1; - url_fskip(pb, 8); - fps = get_le32(pb); + avio_seek(pb, 8, SEEK_CUR); + fps = avio_rl32(pb); if(fps == 0xFFFFFFFF) av_set_pts_info(st, 32, 1, 1000); else{ @@ -87,7 +87,7 @@ static int vc1t_read_header(AVFormatContext *s, static int vc1t_read_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int frame_size; int keyframe = 0; uint32_t pts; @@ -95,10 +95,10 @@ static int vc1t_read_packet(AVFormatContext *s, if(url_feof(pb)) return AVERROR(EIO); - frame_size = get_le24(pb); - if(get_byte(pb) & 0x80) + frame_size = avio_rl24(pb); + if(avio_r8(pb) & 0x80) keyframe = 1; - pts = get_le32(pb); + pts = avio_rl32(pb); if(av_get_packet(pb, pkt, frame_size) < 0) return AVERROR(EIO); if(s->streams[0]->time_base.den == 1000) diff --git a/mplayer/ffmpeg/libavformat/vc1testenc.c b/mplayer/ffmpeg/libavformat/vc1testenc.c index 507b332a..65ac6029 100644 --- a/mplayer/ffmpeg/libavformat/vc1testenc.c +++ b/mplayer/ffmpeg/libavformat/vc1testenc.c @@ -27,26 +27,27 @@ typedef struct RCVContext { static int vc1test_write_header(AVFormatContext *s) { AVCodecContext *avc = s->streams[0]->codec; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (avc->codec_id != CODEC_ID_WMV3) { av_log(s, AV_LOG_ERROR, "Only WMV3 is accepted!\n"); return -1; } - put_le24(pb, 0); //frames count will be here - put_byte(pb, 0xC5); - put_le32(pb, 4); - put_buffer(pb, avc->extradata, 4); - put_le32(pb, avc->height); - put_le32(pb, avc->width); - put_le32(pb, 0xC); - put_le24(pb, 0); // hrd_buffer - put_byte(pb, 0x80); // level|cbr|res1 - put_le32(pb, 0); // hrd_rate + avio_wl24(pb, 0); //frames count will be here + avio_w8(pb, 0xC5); + avio_wl32(pb, 4); + avio_write(pb, avc->extradata, 4); + avio_wl32(pb, avc->height); + avio_wl32(pb, avc->width); + avio_wl32(pb, 0xC); + avio_wl24(pb, 0); // hrd_buffer + avio_w8(pb, 0x80); // level|cbr|res1 + avio_wl32(pb, 0); // hrd_rate if (s->streams[0]->r_frame_rate.den && s->streams[0]->r_frame_rate.num == 1) - put_le32(pb, s->streams[0]->r_frame_rate.den); + avio_wl32(pb, s->streams[0]->r_frame_rate.den); else - put_le32(pb, 0xFFFFFFFF); //variable framerate + avio_wl32(pb, 0xFFFFFFFF); //variable framerate + av_set_pts_info(s->streams[0], 32, 1, 1000); return 0; } @@ -54,13 +55,13 @@ static int vc1test_write_header(AVFormatContext *s) static int vc1test_write_packet(AVFormatContext *s, AVPacket *pkt) { RCVContext *ctx = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (!pkt->size) return 0; - put_le32(pb, pkt->size | ((pkt->flags & AV_PKT_FLAG_KEY) ? 0x80000000 : 0)); - put_le32(pb, pkt->pts); - put_buffer(pb, pkt->data, pkt->size); + avio_wl32(pb, pkt->size | ((pkt->flags & AV_PKT_FLAG_KEY) ? 0x80000000 : 0)); + avio_wl32(pb, pkt->pts); + avio_write(pb, pkt->data, pkt->size); put_flush_packet(pb); ctx->frames++; @@ -70,11 +71,11 @@ static int vc1test_write_packet(AVFormatContext *s, AVPacket *pkt) static int vc1test_write_trailer(AVFormatContext *s) { RCVContext *ctx = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (!url_is_streamed(s->pb)) { - url_fseek(pb, 0, SEEK_SET); - put_le24(pb, ctx->frames); + avio_seek(pb, 0, SEEK_SET); + avio_wl24(pb, ctx->frames); put_flush_packet(pb); } return 0; diff --git a/mplayer/ffmpeg/libavformat/version.h b/mplayer/ffmpeg/libavformat/version.h index 9a902aa4..494cf11a 100644 --- a/mplayer/ffmpeg/libavformat/version.h +++ b/mplayer/ffmpeg/libavformat/version.h @@ -24,7 +24,7 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 94 +#define LIBAVFORMAT_VERSION_MINOR 102 #define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ @@ -89,5 +89,17 @@ #ifndef FF_API_OLD_AVIO #define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 53) #endif +#ifndef FF_API_INDEX_BUILT +#define FF_API_INDEX_BUILT (LIBAVFORMAT_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_DUMP_FORMAT +#define FF_API_DUMP_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_PARSE_DATE +#define FF_API_PARSE_DATE (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_FIND_INFO_TAG +#define FF_API_FIND_INFO_TAG (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif #endif //AVFORMAT_VERSION_H diff --git a/mplayer/ffmpeg/libavformat/vocdec.c b/mplayer/ffmpeg/libavformat/vocdec.c index 7ef29d8d..cb496bf7 100644 --- a/mplayer/ffmpeg/libavformat/vocdec.c +++ b/mplayer/ffmpeg/libavformat/vocdec.c @@ -41,17 +41,17 @@ static int voc_probe(AVProbeData *p) static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) { VocDecContext *voc = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int header_size; AVStream *st; - url_fskip(pb, 20); - header_size = get_le16(pb) - 22; + avio_seek(pb, 20, SEEK_CUR); + header_size = avio_rl16(pb) - 22; if (header_size != 4) { av_log(s, AV_LOG_ERROR, "unknown header size: %d\n", header_size); return AVERROR(ENOSYS); } - url_fskip(pb, header_size); + avio_seek(pb, header_size, SEEK_CUR); st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); @@ -66,17 +66,17 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) { VocDecContext *voc = s->priv_data; AVCodecContext *dec = st->codec; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; VocType type; int size, tmp_codec=-1; int sample_rate = 0; int channels = 1; while (!voc->remaining_size) { - type = get_byte(pb); + type = avio_r8(pb); if (type == VOC_TYPE_EOF) return AVERROR(EIO); - voc->remaining_size = get_le24(pb); + voc->remaining_size = avio_rl24(pb); if (!voc->remaining_size) { if (url_is_streamed(s->pb)) return AVERROR(EIO); @@ -86,11 +86,11 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) switch (type) { case VOC_TYPE_VOICE_DATA: - dec->sample_rate = 1000000 / (256 - get_byte(pb)); + dec->sample_rate = 1000000 / (256 - avio_r8(pb)); if (sample_rate) dec->sample_rate = sample_rate; dec->channels = channels; - tmp_codec = get_byte(pb); + tmp_codec = avio_r8(pb); dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id); voc->remaining_size -= 2; max_size -= 2; @@ -101,26 +101,26 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) break; case VOC_TYPE_EXTENDED: - sample_rate = get_le16(pb); - get_byte(pb); - channels = get_byte(pb) + 1; + sample_rate = avio_rl16(pb); + avio_r8(pb); + channels = avio_r8(pb) + 1; sample_rate = 256000000 / (channels * (65536 - sample_rate)); voc->remaining_size = 0; max_size -= 4; break; case VOC_TYPE_NEW_VOICE_DATA: - dec->sample_rate = get_le32(pb); - dec->bits_per_coded_sample = get_byte(pb); - dec->channels = get_byte(pb); - tmp_codec = get_le16(pb); - url_fskip(pb, 4); + dec->sample_rate = avio_rl32(pb); + dec->bits_per_coded_sample = avio_r8(pb); + dec->channels = avio_r8(pb); + tmp_codec = avio_rl16(pb); + avio_seek(pb, 4, SEEK_CUR); voc->remaining_size -= 12; max_size -= 12; break; default: - url_fskip(pb, voc->remaining_size); + avio_seek(pb, voc->remaining_size, SEEK_CUR); max_size -= voc->remaining_size; voc->remaining_size = 0; break; diff --git a/mplayer/ffmpeg/libavformat/vocenc.c b/mplayer/ffmpeg/libavformat/vocenc.c index 8d181de7..74cd4790 100644 --- a/mplayer/ffmpeg/libavformat/vocenc.c +++ b/mplayer/ffmpeg/libavformat/vocenc.c @@ -29,7 +29,7 @@ typedef struct voc_enc_context { static int voc_write_header(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; const int header_size = 26; const int version = 0x0114; @@ -37,10 +37,10 @@ static int voc_write_header(AVFormatContext *s) || s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO) return AVERROR_PATCHWELCOME; - put_buffer(pb, ff_voc_magic, sizeof(ff_voc_magic) - 1); - put_le16(pb, header_size); - put_le16(pb, version); - put_le16(pb, ~version + 0x1234); + avio_write(pb, ff_voc_magic, sizeof(ff_voc_magic) - 1); + avio_wl16(pb, header_size); + avio_wl16(pb, version); + avio_wl16(pb, ~version + 0x1234); return 0; } @@ -49,43 +49,43 @@ static int voc_write_packet(AVFormatContext *s, AVPacket *pkt) { VocEncContext *voc = s->priv_data; AVCodecContext *enc = s->streams[0]->codec; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; if (!voc->param_written) { if (enc->codec_tag > 0xFF) { - put_byte(pb, VOC_TYPE_NEW_VOICE_DATA); - put_le24(pb, pkt->size + 12); - put_le32(pb, enc->sample_rate); - put_byte(pb, enc->bits_per_coded_sample); - put_byte(pb, enc->channels); - put_le16(pb, enc->codec_tag); - put_le32(pb, 0); + avio_w8(pb, VOC_TYPE_NEW_VOICE_DATA); + avio_wl24(pb, pkt->size + 12); + avio_wl32(pb, enc->sample_rate); + avio_w8(pb, enc->bits_per_coded_sample); + avio_w8(pb, enc->channels); + avio_wl16(pb, enc->codec_tag); + avio_wl32(pb, 0); } else { if (s->streams[0]->codec->channels > 1) { - put_byte(pb, VOC_TYPE_EXTENDED); - put_le24(pb, 4); - put_le16(pb, 65536-256000000/(enc->sample_rate*enc->channels)); - put_byte(pb, enc->codec_tag); - put_byte(pb, enc->channels - 1); + avio_w8(pb, VOC_TYPE_EXTENDED); + avio_wl24(pb, 4); + avio_wl16(pb, 65536-256000000/(enc->sample_rate*enc->channels)); + avio_w8(pb, enc->codec_tag); + avio_w8(pb, enc->channels - 1); } - put_byte(pb, VOC_TYPE_VOICE_DATA); - put_le24(pb, pkt->size + 2); - put_byte(pb, 256 - 1000000 / enc->sample_rate); - put_byte(pb, enc->codec_tag); + avio_w8(pb, VOC_TYPE_VOICE_DATA); + avio_wl24(pb, pkt->size + 2); + avio_w8(pb, 256 - 1000000 / enc->sample_rate); + avio_w8(pb, enc->codec_tag); } voc->param_written = 1; } else { - put_byte(pb, VOC_TYPE_VOICE_DATA_CONT); - put_le24(pb, pkt->size); + avio_w8(pb, VOC_TYPE_VOICE_DATA_CONT); + avio_wl24(pb, pkt->size); } - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); return 0; } static int voc_write_trailer(AVFormatContext *s) { - put_byte(s->pb, 0); + avio_w8(s->pb, 0); return 0; } diff --git a/mplayer/ffmpeg/libavformat/vqf.c b/mplayer/ffmpeg/libavformat/vqf.c index 9cf0c3a6..fb440af2 100644 --- a/mplayer/ffmpeg/libavformat/vqf.c +++ b/mplayer/ffmpeg/libavformat/vqf.c @@ -54,7 +54,7 @@ static void add_metadata(AVFormatContext *s, const char *tag, buf = av_malloc(len+1); if (!buf) return; - get_buffer(s->pb, buf, len); + avio_read(s->pb, buf, len); buf[len] = 0; av_metadata_set2(&s->metadata, tag, buf, AV_METADATA_DONT_STRDUP_VAL); } @@ -72,9 +72,9 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (!st) return AVERROR(ENOMEM); - url_fskip(s->pb, 12); + avio_seek(s->pb, 12, SEEK_CUR); - header_size = get_be32(s->pb); + header_size = avio_rb32(s->pb); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_TWINVQ; @@ -82,12 +82,12 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) do { int len; - chunk_tag = get_le32(s->pb); + chunk_tag = avio_rl32(s->pb); if (chunk_tag == MKTAG('D','A','T','A')) break; - len = get_be32(s->pb); + len = avio_rb32(s->pb); if ((unsigned) len > INT_MAX/2) { av_log(s, AV_LOG_ERROR, "Malformed header\n"); @@ -98,10 +98,10 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) switch(chunk_tag){ case MKTAG('C','O','M','M'): - st->codec->channels = get_be32(s->pb) + 1; - read_bitrate = get_be32(s->pb); - rate_flag = get_be32(s->pb); - url_fskip(s->pb, len-12); + st->codec->channels = avio_rb32(s->pb) + 1; + read_bitrate = avio_rb32(s->pb); + rate_flag = avio_rb32(s->pb); + avio_seek(s->pb, len-12, SEEK_CUR); st->codec->bit_rate = read_bitrate*1000; st->codec->bits_per_coded_sample = 16; @@ -140,7 +140,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "Unknown chunk: %c%c%c%c\n", ((char*)&chunk_tag)[0], ((char*)&chunk_tag)[1], ((char*)&chunk_tag)[2], ((char*)&chunk_tag)[3]); - url_fskip(s->pb, FFMIN(len, header_size)); + avio_seek(s->pb, FFMIN(len, header_size), SEEK_CUR); break; } @@ -208,7 +208,7 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->data[0] = 8 - c->remaining_bits; // Number of bits to skip pkt->data[1] = c->last_frame_bits; - ret = get_buffer(s->pb, pkt->data+2, size); + ret = avio_read(s->pb, pkt->data+2, size); if (ret<=0) { av_free_packet(pkt); @@ -240,7 +240,7 @@ static int vqf_read_seek(AVFormatContext *s, st->cur_dts = av_rescale(pos, st->time_base.den, st->codec->bit_rate * (int64_t)st->time_base.num); - if ((ret = url_fseek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0) return ret; c->remaining_bits = -7 - ((pos-7)&7); diff --git a/mplayer/ffmpeg/libavformat/wav.c b/mplayer/ffmpeg/libavformat/wav.c index 4cf138c7..d6329e32 100644 --- a/mplayer/ffmpeg/libavformat/wav.c +++ b/mplayer/ffmpeg/libavformat/wav.c @@ -23,6 +23,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" +#include "avio_internal.h" #include "pcm.h" #include "riff.h" @@ -39,12 +40,12 @@ typedef struct { static int wav_write_header(AVFormatContext *s) { WAVContext *wav = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int64_t fmt, fact; - put_tag(pb, "RIFF"); - put_le32(pb, 0); /* file length */ - put_tag(pb, "WAVE"); + ffio_wfourcc(pb, "RIFF"); + avio_wl32(pb, 0); /* file length */ + ffio_wfourcc(pb, "WAVE"); /* format header */ fmt = ff_start_tag(pb, "fmt "); @@ -59,7 +60,7 @@ static int wav_write_header(AVFormatContext *s) if (s->streams[0]->codec->codec_tag != 0x01 /* hence for all other than PCM */ && !url_is_streamed(s->pb)) { fact = ff_start_tag(pb, "fact"); - put_le32(pb, 0); + avio_wl32(pb, 0); ff_end_tag(pb, fact); } @@ -77,9 +78,9 @@ static int wav_write_header(AVFormatContext *s) static int wav_write_packet(AVFormatContext *s, AVPacket *pkt) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; WAVContext *wav = s->priv_data; - put_buffer(pb, pkt->data, pkt->size); + avio_write(pb, pkt->data, pkt->size); if(pkt->pts != AV_NOPTS_VALUE) { wav->minpts = FFMIN(wav->minpts, pkt->pts); wav->maxpts = FFMAX(wav->maxpts, pkt->pts); @@ -91,7 +92,7 @@ static int wav_write_packet(AVFormatContext *s, AVPacket *pkt) static int wav_write_trailer(AVFormatContext *s) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; WAVContext *wav = s->priv_data; int64_t file_size; @@ -102,9 +103,9 @@ static int wav_write_trailer(AVFormatContext *s) /* update file size */ file_size = url_ftell(pb); - url_fseek(pb, 4, SEEK_SET); - put_le32(pb, (uint32_t)(file_size - 8)); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, 4, SEEK_SET); + avio_wl32(pb, (uint32_t)(file_size - 8)); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); @@ -114,9 +115,9 @@ static int wav_write_trailer(AVFormatContext *s) number_of_samples = av_rescale(wav->maxpts - wav->minpts + wav->last_duration, s->streams[0]->codec->sample_rate * (int64_t)s->streams[0]->time_base.num, s->streams[0]->time_base.den); - url_fseek(pb, wav->data-12, SEEK_SET); - put_le32(pb, number_of_samples); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, wav->data-12, SEEK_SET); + avio_wl32(pb, number_of_samples); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); } } @@ -141,14 +142,14 @@ AVOutputFormat ff_wav_muxer = { #if CONFIG_WAV_DEMUXER -static int64_t next_tag(ByteIOContext *pb, unsigned int *tag) +static int64_t next_tag(AVIOContext *pb, unsigned int *tag) { - *tag = get_le32(pb); - return get_le32(pb); + *tag = avio_rl32(pb); + return avio_rl32(pb); } /* return the size of the found tag */ -static int64_t find_tag(ByteIOContext *pb, uint32_t tag1) +static int64_t find_tag(AVIOContext *pb, uint32_t tag1) { unsigned int tag; int64_t size; @@ -159,7 +160,7 @@ static int64_t find_tag(ByteIOContext *pb, uint32_t tag1) size = next_tag(pb, &tag); if (tag == tag1) break; - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); } return size; } @@ -192,31 +193,31 @@ static int wav_read_header(AVFormatContext *s, int64_t sample_count=0; int rf64; unsigned int tag; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; WAVContext *wav = s->priv_data; /* check RIFF header */ - tag = get_le32(pb); + tag = avio_rl32(pb); rf64 = tag == MKTAG('R', 'F', '6', '4'); if (!rf64 && tag != MKTAG('R', 'I', 'F', 'F')) return -1; - get_le32(pb); /* file size */ - tag = get_le32(pb); + avio_rl32(pb); /* file size */ + tag = avio_rl32(pb); if (tag != MKTAG('W', 'A', 'V', 'E')) return -1; if (rf64) { - if (get_le32(pb) != MKTAG('d', 's', '6', '4')) + if (avio_rl32(pb) != MKTAG('d', 's', '6', '4')) return -1; - size = get_le32(pb); + size = avio_rl32(pb); if (size < 16) return -1; - get_le64(pb); /* RIFF size */ - data_size = get_le64(pb); - sample_count = get_le64(pb); - url_fskip(pb, size - 16); /* skip rest of ds64 chunk */ + avio_rl64(pb); /* RIFF size */ + data_size = avio_rl64(pb); + sample_count = avio_rl64(pb); + avio_seek(pb, size - 16, SEEK_CUR); /* skip rest of ds64 chunk */ } /* parse fmt header */ @@ -239,10 +240,10 @@ static int wav_read_header(AVFormatContext *s, if (tag == MKTAG('d', 'a', 't', 'a')){ break; }else if (tag == MKTAG('f','a','c','t') && !sample_count){ - sample_count = get_le32(pb); + sample_count = avio_rl32(pb); size -= 4; } - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); } if (rf64) size = data_size; @@ -263,19 +264,19 @@ static int wav_read_header(AVFormatContext *s, /** Find chunk with w64 GUID by skipping over other chunks * @return the size of the found chunk */ -static int64_t find_guid(ByteIOContext *pb, const uint8_t guid1[16]) +static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16]) { uint8_t guid[16]; int64_t size; while (!url_feof(pb)) { - get_buffer(pb, guid, 16); - size = get_le64(pb); + avio_read(pb, guid, 16); + size = avio_rl64(pb); if (size <= 24) return -1; if (!memcmp(guid, guid1, 16)) return size; - url_fskip(pb, FFALIGN(size, INT64_C(8)) - 24); + avio_seek(pb, FFALIGN(size, INT64_C(8)) - 24, SEEK_CUR); } return -1; } @@ -379,19 +380,19 @@ static int w64_probe(AVProbeData *p) static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) { int64_t size; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; WAVContext *wav = s->priv_data; AVStream *st; uint8_t guid[16]; - get_buffer(pb, guid, 16); + avio_read(pb, guid, 16); if (memcmp(guid, guid_riff, 16)) return -1; - if (get_le64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */ + if (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */ return -1; - get_buffer(pb, guid, 16); + avio_read(pb, guid, 16); if (memcmp(guid, guid_wave, 16)) { av_log(s, AV_LOG_ERROR, "could not find wave guid\n"); return -1; @@ -409,7 +410,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) /* subtract chunk header size - normal wav file doesn't count it */ ff_get_wav_header(pb, st->codec, size - 24); - url_fskip(pb, FFALIGN(size, INT64_C(8)) - size); + avio_seek(pb, FFALIGN(size, INT64_C(8)) - size, SEEK_CUR); st->need_parsing = AVSTREAM_PARSE_FULL; diff --git a/mplayer/ffmpeg/libavformat/wc3movie.c b/mplayer/ffmpeg/libavformat/wc3movie.c index 17571599..a4dd26b4 100644 --- a/mplayer/ffmpeg/libavformat/wc3movie.c +++ b/mplayer/ffmpeg/libavformat/wc3movie.c @@ -85,7 +85,7 @@ static int wc3_read_header(AVFormatContext *s, AVFormatParameters *ap) { Wc3DemuxContext *wc3 = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int fourcc_tag; unsigned int size; AVStream *st; @@ -101,12 +101,12 @@ static int wc3_read_header(AVFormatContext *s, wc3->vpkt.data = NULL; wc3->vpkt.size = 0; /* skip the first 3 32-bit numbers */ - url_fseek(pb, 12, SEEK_CUR); + avio_seek(pb, 12, SEEK_CUR); /* traverse through the chunks and load the header information before * the first BRCH tag */ - fourcc_tag = get_le32(pb); - size = (get_be32(pb) + 1) & (~1); + fourcc_tag = avio_rl32(pb); + size = (avio_rb32(pb) + 1) & (~1); do { switch (fourcc_tag) { @@ -114,12 +114,12 @@ static int wc3_read_header(AVFormatContext *s, case SOND_TAG: case INDX_TAG: /* SOND unknown, INDX unnecessary; ignore both */ - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); break; case PC__TAG: /* number of palettes, unneeded */ - url_fseek(pb, 12, SEEK_CUR); + avio_seek(pb, 12, SEEK_CUR); break; case BNAM_TAG: @@ -127,7 +127,7 @@ static int wc3_read_header(AVFormatContext *s, buffer = av_malloc(size+1); if (!buffer) return AVERROR(ENOMEM); - if ((ret = get_buffer(pb, buffer, size)) != size) + if ((ret = avio_read(pb, buffer, size)) != size) return AVERROR(EIO); buffer[size] = 0; av_metadata_set2(&s->metadata, "title", buffer, @@ -136,13 +136,13 @@ static int wc3_read_header(AVFormatContext *s, case SIZE_TAG: /* video resolution override */ - wc3->width = get_le32(pb); - wc3->height = get_le32(pb); + wc3->width = avio_rl32(pb); + wc3->height = avio_rl32(pb); break; case PALT_TAG: /* one of several palettes */ - url_fseek(pb, -8, SEEK_CUR); + avio_seek(pb, -8, SEEK_CUR); av_append_packet(pb, &wc3->vpkt, 8 + PALETTE_SIZE); break; @@ -154,9 +154,9 @@ static int wc3_read_header(AVFormatContext *s, break; } - fourcc_tag = get_le32(pb); + fourcc_tag = avio_rl32(pb); /* chunk sizes are 16-bit aligned */ - size = (get_be32(pb) + 1) & (~1); + size = (avio_rb32(pb) + 1) & (~1); if (url_feof(pb)) return AVERROR(EIO); @@ -196,7 +196,7 @@ static int wc3_read_packet(AVFormatContext *s, AVPacket *pkt) { Wc3DemuxContext *wc3 = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int fourcc_tag; unsigned int size; int packet_read = 0; @@ -205,9 +205,9 @@ static int wc3_read_packet(AVFormatContext *s, while (!packet_read) { - fourcc_tag = get_le32(pb); + fourcc_tag = avio_rl32(pb); /* chunk sizes are 16-bit aligned */ - size = (get_be32(pb) + 1) & (~1); + size = (avio_rb32(pb) + 1) & (~1); if (url_feof(pb)) return AVERROR(EIO); @@ -219,13 +219,13 @@ static int wc3_read_packet(AVFormatContext *s, case SHOT_TAG: /* load up new palette */ - url_fseek(pb, -8, SEEK_CUR); + avio_seek(pb, -8, SEEK_CUR); av_append_packet(pb, &wc3->vpkt, 8 + 4); break; case VGA__TAG: /* send out video chunk */ - url_fseek(pb, -8, SEEK_CUR); + avio_seek(pb, -8, SEEK_CUR); ret= av_append_packet(pb, &wc3->vpkt, 8 + size); // ignore error if we have some data if (wc3->vpkt.size > 0) @@ -240,9 +240,9 @@ static int wc3_read_packet(AVFormatContext *s, case TEXT_TAG: /* subtitle chunk */ #if 0 - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); #else - if ((unsigned)size > sizeof(text) || (ret = get_buffer(pb, text, size)) != size) + if ((unsigned)size > sizeof(text) || (ret = avio_read(pb, text, size)) != size) ret = AVERROR(EIO); else { int i = 0; diff --git a/mplayer/ffmpeg/libavformat/westwood.c b/mplayer/ffmpeg/libavformat/westwood.c index 85d2056b..adb35319 100644 --- a/mplayer/ffmpeg/libavformat/westwood.c +++ b/mplayer/ffmpeg/libavformat/westwood.c @@ -126,11 +126,11 @@ static int wsaud_read_header(AVFormatContext *s, AVFormatParameters *ap) { WsAudDemuxContext *wsaud = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; unsigned char header[AUD_HEADER_SIZE]; - if (get_buffer(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE) + if (avio_read(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE) return AVERROR(EIO); wsaud->audio_samplerate = AV_RL16(&header[0]); if (header[11] == 99) @@ -168,12 +168,12 @@ static int wsaud_read_packet(AVFormatContext *s, AVPacket *pkt) { WsAudDemuxContext *wsaud = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned char preamble[AUD_CHUNK_PREAMBLE_SIZE]; unsigned int chunk_size; int ret = 0; - if (get_buffer(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) != + if (avio_read(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) != AUD_CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); @@ -213,7 +213,7 @@ static int wsvqa_read_header(AVFormatContext *s, AVFormatParameters *ap) { WsVqaDemuxContext *wsvqa = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; unsigned char *header; unsigned char scratch[VQA_PREAMBLE_SIZE]; @@ -231,13 +231,13 @@ static int wsvqa_read_header(AVFormatContext *s, st->codec->codec_tag = 0; /* no fourcc */ /* skip to the start of the VQA header */ - url_fseek(pb, 20, SEEK_SET); + avio_seek(pb, 20, SEEK_SET); /* the VQA header needs to go to the decoder */ st->codec->extradata_size = VQA_HEADER_SIZE; st->codec->extradata = av_mallocz(VQA_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); header = (unsigned char *)st->codec->extradata; - if (get_buffer(pb, st->codec->extradata, VQA_HEADER_SIZE) != + if (avio_read(pb, st->codec->extradata, VQA_HEADER_SIZE) != VQA_HEADER_SIZE) { av_free(st->codec->extradata); return AVERROR(EIO); @@ -277,7 +277,7 @@ static int wsvqa_read_header(AVFormatContext *s, /* there are 0 or more chunks before the FINF chunk; iterate until * FINF has been skipped and the file will be ready to be demuxed */ do { - if (get_buffer(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) { + if (avio_read(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) { av_free(st->codec->extradata); return AVERROR(EIO); } @@ -303,7 +303,7 @@ static int wsvqa_read_header(AVFormatContext *s, break; } - url_fseek(pb, chunk_size, SEEK_CUR); + avio_seek(pb, chunk_size, SEEK_CUR); } while (chunk_tag != FINF_TAG); return 0; @@ -313,14 +313,14 @@ static int wsvqa_read_packet(AVFormatContext *s, AVPacket *pkt) { WsVqaDemuxContext *wsvqa = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret = -1; unsigned char preamble[VQA_PREAMBLE_SIZE]; unsigned int chunk_type; unsigned int chunk_size; int skip_byte; - while (get_buffer(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) { + while (avio_read(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) { chunk_type = AV_RB32(&preamble[0]); chunk_size = AV_RB32(&preamble[4]); skip_byte = chunk_size & 0x01; @@ -329,7 +329,7 @@ static int wsvqa_read_packet(AVFormatContext *s, if (av_new_packet(pkt, chunk_size)) return AVERROR(EIO); - ret = get_buffer(pb, pkt->data, chunk_size); + ret = avio_read(pb, pkt->data, chunk_size); if (ret != chunk_size) { av_free_packet(pkt); return AVERROR(EIO); @@ -348,7 +348,7 @@ static int wsvqa_read_packet(AVFormatContext *s, } /* stay on 16-bit alignment */ if (skip_byte) - url_fseek(pb, 1, SEEK_CUR); + avio_seek(pb, 1, SEEK_CUR); return ret; } else { @@ -359,7 +359,7 @@ static int wsvqa_read_packet(AVFormatContext *s, default: av_log(s, AV_LOG_INFO, "Skipping unknown chunk 0x%08X\n", chunk_type); } - url_fseek(pb, chunk_size + skip_byte, SEEK_CUR); + avio_seek(pb, chunk_size + skip_byte, SEEK_CUR); } } diff --git a/mplayer/ffmpeg/libavformat/wtv.c b/mplayer/ffmpeg/libavformat/wtv.c index 816c4062..6b8a58da 100644 --- a/mplayer/ffmpeg/libavformat/wtv.c +++ b/mplayer/ffmpeg/libavformat/wtv.c @@ -1,6 +1,6 @@ /* * Windows Television (WTV) demuxer - * Copyright (c) 2010 Peter Ross + * Copyright (c) 2010-2011 Peter Ross * * This file is part of FFmpeg. * @@ -26,10 +26,13 @@ */ #include "libavutil/intreadwrite.h" +#include "libavutil/intfloat_readwrite.h" #include "avformat.h" +#include "internal.h" #include "riff.h" #include "asf.h" #include "mpegts.h" +#include /* Macros for formating GUIDs */ #define PRI_GUID \ @@ -37,22 +40,294 @@ #define ARG_GUID(g) \ g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15] +#define PRI_PRETTY_GUID \ + "%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x" +#define ARG_PRETTY_GUID(g) \ + AV_RL32(g),AV_RL16(g+4),AV_RL16(g+6),g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15] +#define LEN_PRETTY_GUID 34 + +/* + * + * File system routines + * + */ + +#define WTV_SECTOR_BITS 12 +#define WTV_SECTOR_SIZE (1 << WTV_SECTOR_BITS) +#define WTV_BIGSECTOR_BITS 18 + typedef struct { - int seen_data; -} WtvStream; + AVIOContext *pb_filesystem; /** file system (AVFormatContext->pb) */ -typedef struct WtvContext { - uint64_t pts; -} WtvContext; + int sector_bits; /** sector shift bits; used to convert sector number into pb_filesystem offset */ + uint32_t *sectors; /** file allocation table */ + int nb_sectors; /** number of sectors */ + + int error; + int64_t position; + int64_t length; +} WtvFile; + +/** + * @return bytes read, 0 on end of file, or <0 on error + */ +static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size) +{ + WtvFile *wf = opaque; + AVIOContext *pb = wf->pb_filesystem; + int nread = 0; + + if (wf->error || url_ferror(pb)) + return -1; + if (wf->position >= wf->length || url_feof(pb)) + return 0; + + buf_size = FFMIN(buf_size, wf->length - wf->position); + while(nread < buf_size) { + int n; + int remaining_in_sector = (1 << wf->sector_bits) - (wf->position & ((1 << wf->sector_bits) - 1)); + int read_request = FFMIN(buf_size - nread, remaining_in_sector); + + n = avio_read(pb, buf, read_request); + if (n <= 0) + break; + nread += n; + buf += n; + wf->position += n; + if (n == remaining_in_sector) { + int i = wf->position >> wf->sector_bits; + if (i >= wf->nb_sectors || + (wf->sectors[i] != wf->sectors[i - 1] + (1 << (wf->sector_bits - WTV_SECTOR_BITS)) && + avio_seek(pb, (int64_t)wf->sectors[i] << WTV_SECTOR_BITS, SEEK_SET) < 0)) { + wf->error = 1; + break; + } + } + } + return nread; +} + +/** + * @return position (or file length) + */ +static int64_t wtvfile_seek(void *opaque, int64_t offset, int whence) +{ + WtvFile *wf = opaque; + AVIOContext *pb = wf->pb_filesystem; + + if (whence == AVSEEK_SIZE) + return wf->length; + else if (whence == SEEK_CUR) + offset = wf->position + offset; + else if (whence == SEEK_END) + offset = wf->length; + + wf->error = offset < 0 || offset >= wf->length || + avio_seek(pb, ((int64_t)wf->sectors[offset >> wf->sector_bits] << WTV_SECTOR_BITS) + + (offset & ((1 << wf->sector_bits) - 1)), SEEK_SET) < 0; + wf->position = offset; + return offset; +} + +/** + * read non-zero integers (le32) from input stream + * @param pb + * @param[out] data destination + * @param count maximum number of integers to read + * @return total number of integers read + */ +static int read_ints(AVIOContext *pb, uint32_t *data, int count) +{ + int i, total = 0; + for (i = 0; i < count; i++) { + if ((data[total] = avio_rl32(pb))) + total++; + } + return total; +} + +/** + * Open file + * @param first_sector First sector + * @param length Length of file (bytes) + * @param depth File allocation table depth + * @return NULL on error + */ +static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int depth, AVFormatContext *s) +{ + AVIOContext *pb; + WtvFile *wf; + uint8_t *buffer; + + if (avio_seek(s->pb, first_sector << WTV_SECTOR_BITS, SEEK_SET) < 0) + return NULL; + + wf = av_mallocz(sizeof(WtvFile)); + if (!wf) + return NULL; + + if (depth == 0) { + wf->sectors = av_malloc(sizeof(uint32_t)); + if (!wf->sectors) { + av_free(wf); + return NULL; + } + wf->sectors[0] = first_sector; + wf->nb_sectors = 1; + wf->sector_bits = WTV_SECTOR_BITS; + } else if (depth == 1) { + wf->sectors = av_malloc(WTV_SECTOR_SIZE); + if (!wf->sectors) { + av_free(wf); + return NULL; + } + wf->nb_sectors = read_ints(s->pb, wf->sectors, WTV_SECTOR_SIZE / 4); + wf->sector_bits = length & (1ULL<<63) ? WTV_SECTOR_BITS : WTV_BIGSECTOR_BITS; + } else if (depth == 2) { + uint32_t sectors1[WTV_SECTOR_SIZE / 4]; + int nb_sectors1 = read_ints(s->pb, sectors1, WTV_SECTOR_SIZE / 4); + int i; -static int is_zero(uint8_t *v, int n) + wf->sectors = av_malloc(nb_sectors1 << WTV_SECTOR_BITS); + if (!wf->sectors) { + av_free(wf); + return NULL; + } + wf->nb_sectors = 0; + for (i = 0; i < nb_sectors1; i++) { + if (avio_seek(s->pb, (int64_t)sectors1[i] << WTV_SECTOR_BITS, SEEK_SET) < 0) + break; + wf->nb_sectors += read_ints(s->pb, wf->sectors + i * WTV_SECTOR_SIZE / 4, WTV_SECTOR_SIZE / 4); + } + wf->sector_bits = length & (1ULL<<63) ? WTV_SECTOR_BITS : WTV_BIGSECTOR_BITS; + } else { + av_log(s, AV_LOG_ERROR, "unsupported file allocation table depth (0x%x)\n", depth); + av_free(wf); + return NULL; + } + + if (!wf->nb_sectors) { + av_free(wf->sectors); + av_free(wf); + return NULL; + } + + /* check length */ + length &= 0xFFFFFFFFFFFF; + if (length > ((int64_t)wf->nb_sectors << wf->sector_bits)) { + av_log(s, AV_LOG_WARNING, "reported file length (0x%"PRIx64") exceeds number of available sectors (0x%"PRIx64")\n", length, (int64_t)wf->nb_sectors << wf->sector_bits); + length = (int64_t)wf->nb_sectors << wf->sector_bits; + } + wf->length = length; + + /* seek to intial sector */ + wf->position = 0; + if (avio_seek(s->pb, (int64_t)wf->sectors[0] << WTV_SECTOR_BITS, SEEK_SET) < 0) { + av_free(wf->sectors); + av_free(wf); + return NULL; + } + + wf->pb_filesystem = s->pb; + buffer = av_malloc(1 << wf->sector_bits); + if (!buffer) { + av_free(wf->sectors); + av_free(wf); + return NULL; + } + + pb = avio_alloc_context(buffer, 1 << wf->sector_bits, 0, wf, + wtvfile_read_packet, NULL, wtvfile_seek); + if (!pb) { + av_free(buffer); + av_free(wf->sectors); + av_free(wf); + } + return pb; +} + +static const ff_asf_guid dir_entry_guid = + {0x92,0xB7,0x74,0x91,0x59,0x70,0x70,0x44,0x88,0xDF,0x06,0x3B,0x82,0xCC,0x21,0x3D}; + +/** + * Open file using filename + * @param[in] buf directory buffer + * @param buf_size directory buffer size + * @param[in] filename + * @param filename_size size of filename + * @return NULL on error + */ +static AVIOContext * wtvfile_open2(AVFormatContext *s, const uint8_t *buf, int buf_size, const uint8_t *filename, int filename_size) +{ + const uint8_t *buf_end = buf + buf_size; + + while(buf + 48 <= buf_end) { + int dir_length, name_size, first_sector, depth; + uint64_t file_length; + const uint8_t *name; + if (ff_guidcmp(buf, dir_entry_guid)) { + av_log(s, AV_LOG_ERROR, "unknown guid "PRI_GUID", expected dir_entry_guid; " + "remaining directory entries ignored\n", ARG_GUID(buf)); + break; + } + dir_length = AV_RL16(buf + 16); + file_length = AV_RL64(buf + 24); + name_size = 2 * AV_RL32(buf + 32); + if (buf + 48 + name_size > buf_end) { + av_log(s, AV_LOG_ERROR, "filename exceeds buffer size; remaining directory entries ignored\n"); + break; + } + first_sector = AV_RL32(buf + 40 + name_size); + depth = AV_RL32(buf + 44 + name_size); + + /* compare file name; test optional null terminator */ + name = buf + 40; + if (name_size >= filename_size && + !memcmp(name, filename, filename_size) && + (name_size < filename_size + 2 || !AV_RN16(name + filename_size))) + return wtvfile_open_sector(first_sector, file_length, depth, s); + + buf += dir_length; + } + return 0; +} + +#define wtvfile_open(s, buf, buf_size, filename) \ + wtvfile_open2(s, buf, buf_size, filename, sizeof(filename)) + +/** + * Close file opened with wtvfile_open_sector(), or wtv_open() + */ +static void wtvfile_close(AVIOContext *pb) { - int i; - for (i = 0; i < n; i++) - if (v[i]) return 0; - return 1; + WtvFile *wf = pb->opaque; + av_free(wf->sectors); + av_free(pb); } +/* + * + * Main demuxer + * + */ + +typedef struct { + int seen_data; +} WtvStream; + +typedef struct { + AVIOContext *pb; /** timeline file */ + int64_t epoch; + int64_t pts; /** pts for next data chunk */ + int64_t last_valid_pts; /** latest valid pts, used for interative seeking */ + + /* maintain private seek index, as the AVIndexEntry->pos is relative to the + start of the 'timeline' file, not the file system (AVFormatContext->pb) */ + AVIndexEntry *index_entries; + int nb_index_entries; + unsigned int index_entries_allocated_size; +} WtvContext; + typedef struct { enum CodecID id; ff_asf_guid guid; @@ -71,7 +346,7 @@ static enum CodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid g /* WTV GUIDs */ static const ff_asf_guid wtv_guid = {0xB7,0xD8,0x00,0x20,0x37,0x49,0xDA,0x11,0xA6,0x4E,0x00,0x07,0xE9,0x5E,0xAD,0x8D}; -static const ff_asf_guid meta_guid = +static const ff_asf_guid metadata_guid = {0x5A,0xFE,0xD7,0x6D,0xC8,0x1D,0x8F,0x4A,0x99,0x22,0xFA,0xB1,0x1C,0x38,0x14,0x53}; static const ff_asf_guid timestamp_guid = {0x5B,0x05,0xE6,0x1B,0x97,0xA9,0x49,0x43,0x88,0x17,0x1A,0x65,0x5A,0x29,0x8A,0x97}; @@ -97,6 +372,8 @@ static const ff_asf_guid EVENTID_StreamIDSpanningEvent = {0x68,0xAB,0xF1,0xCA,0x53,0xE1,0x41,0x4D,0xA6,0xB3,0xA7,0xC9,0x98,0xDB,0x75,0xEE}; static const ff_asf_guid EVENTID_TeletextSpanningEvent = {0x50,0xD9,0x99,0x95,0x33,0x5F,0x17,0x46,0xAF,0x7C,0x1E,0x54,0xB5,0x10,0xDA,0xA3}; +static const ff_asf_guid EVENTID_AudioTypeSpanningEvent = + {0xBE,0xBF,0x1C,0x50,0x49,0xB8,0xCE,0x42,0x9B,0xE9,0x3D,0xB8,0x69,0xFB,0x82,0xB3}; /* Windows media GUIDs */ @@ -158,15 +435,154 @@ static int read_probe(AVProbeData *p) return ff_guidcmp(p->buf, wtv_guid) ? 0 : AVPROBE_SCORE_MAX; } +/** + * Convert win32 FILETIME to ISO-8601 string + */ +static void filetime_to_iso8601(char *buf, int buf_size, int64_t value) +{ + time_t t = (value / 10000000LL) - 11644473600LL; + strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t)); +} + +/** + * Convert crazy time (100ns since 1 Jan 0001) to ISO-8601 string + */ +static void crazytime_to_iso8601(char *buf, int buf_size, int64_t value) +{ + time_t t = (value / 10000000LL) - 719162LL*86400LL; + strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t)); +} + +/** + * Convert OLE DATE to ISO-8601 string + */ +static void oledate_to_iso8601(char *buf, int buf_size, int64_t value) +{ + time_t t = 631112400LL + 86400*av_int2dbl(value); + strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t)); +} + +static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) +{ + char mime[1024]; + char description[1024]; + unsigned int filesize; + AVStream *st; + int64_t pos = url_ftell(pb); + + avio_get_str16le(pb, INT_MAX, mime, sizeof(mime)); + if (strcmp(mime, "image/jpeg")) + goto done; + + avio_r8(pb); + avio_get_str16le(pb, INT_MAX, description, sizeof(description)); + filesize = avio_rl32(pb); + if (!filesize) + goto done; + + st = av_new_stream(s, 0); + if (!st) + goto done; + av_metadata_set2(&st->metadata, "title", description, 0); + st->codec->codec_id = CODEC_ID_MJPEG; + st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT; + st->codec->extradata = av_mallocz(filesize); + if (!st->codec->extradata) + goto done; + st->codec->extradata_size = filesize; + avio_read(pb, st->codec->extradata, filesize); +done: + avio_seek(pb, pos + length, SEEK_SET); +} + +static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int type, int length) +{ + int buf_size = FFMAX(2*length, LEN_PRETTY_GUID) + 1; + char *buf = av_malloc(buf_size); + if (!buf) + return; + + if (type == 0 && length == 4) { + snprintf(buf, buf_size, "%"PRIi32, avio_rl32(pb)); + } else if (type == 1) { + avio_get_str16le(pb, length, buf, buf_size); + if (!strlen(buf)) { + av_free(buf); + return; + } + } else if (type == 3 && length == 4) { + strcpy(buf, avio_rl32(pb) ? "true" : "false"); + } else if (type == 4 && length == 8) { + int64_t num = avio_rl64(pb); + if (!strcmp(key, "WM/EncodingTime") || + !strcmp(key, "WM/MediaOriginalBroadcastDateTime")) + filetime_to_iso8601(buf, buf_size, num); + else if (!strcmp(key, "WM/WMRVEncodeTime") || + !strcmp(key, "WM/WMRVEndTime")) + crazytime_to_iso8601(buf, buf_size, num); + else if (!strcmp(key, "WM/WMRVExpirationDate")) + oledate_to_iso8601(buf, buf_size, num); + else if (!strcmp(key, "WM/WMRVBitrate")) + snprintf(buf, buf_size, "%f", av_int2dbl(num)); + else + snprintf(buf, buf_size, "%"PRIi64, num); + } else if (type == 5 && length == 2) { + snprintf(buf, buf_size, "%"PRIi16, avio_rl16(pb)); + } else if (type == 6 && length == 16) { + ff_asf_guid guid; + avio_read(pb, guid, 16); + snprintf(buf, buf_size, PRI_PRETTY_GUID, ARG_PRETTY_GUID(guid)); + } else if (type == 2 && !strcmp(key, "WM/Picture")) { + get_attachment(s, pb, length); + av_freep(&buf); + return; + } else { + av_freep(&buf); + av_log(s, AV_LOG_WARNING, "unsupported metadata entry; key:%s, type:%d, length:0x%x\n", key, type, length); + avio_seek(pb, length, SEEK_CUR); + return; + } + + av_metadata_set2(&s->metadata, key, buf, 0); + av_freep(&buf); +} + +/** + * Parse metadata entries + */ +static void parse_legacy_attrib(AVFormatContext *s, AVIOContext *pb) +{ + ff_asf_guid guid; + int length, type; + while(!url_feof(pb)) { + char key[1024]; + ff_get_guid(pb, &guid); + type = avio_rl32(pb); + length = avio_rl32(pb); + if (!length) + break; + if (ff_guidcmp(&guid, metadata_guid)) { + av_log(s, AV_LOG_WARNING, "unknown guid "PRI_GUID", expected metadata_guid; " + "remaining metadata entries ignored\n", ARG_GUID(guid)); + break; + } + avio_get_str16le(pb, INT_MAX, key, sizeof(key)); + get_tag(s, pb, key, type, length); + } + + ff_metadata_conv(&s->metadata, NULL, ff_asf_metadata_conv); +} + /** * parse VIDEOINFOHEADER2 structure * @return bytes consumed */ static int parse_videoinfoheader2(AVFormatContext *s, AVStream *st) { - ByteIOContext *pb = s->pb; + WtvContext *wtv = s->priv_data; + AVIOContext *pb = wtv->pb; - url_fskip(pb, 72); // picture aspect ratio is unreliable + avio_seek(pb, 72, SEEK_CUR); // picture aspect ratio is unreliable ff_get_bmp_header(pb, st); return 72 + 40; @@ -233,7 +649,8 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, ff_asf_guid mediatype, ff_asf_guid subtype, ff_asf_guid formattype, int size) { - ByteIOContext *pb = s->pb; + WtvContext *wtv = s->priv_data; + AVIOContext *pb = wtv->pb; if (!ff_guidcmp(subtype, mediasubtype_cpfilters_processed) && !ff_guidcmp(formattype, format_cpfilters_processed)) { ff_asf_guid actual_subtype; @@ -241,17 +658,17 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, if (size < 32) { av_log(s, AV_LOG_WARNING, "format buffer size underflow\n"); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); return NULL; } - url_fskip(pb, size - 32); + avio_seek(pb, size - 32, SEEK_CUR); ff_get_guid(pb, &actual_subtype); ff_get_guid(pb, &actual_formattype); - url_fseek(pb, -size, SEEK_CUR); + avio_seek(pb, -size, SEEK_CUR); st = parse_media_type(s, st, sid, mediatype, actual_subtype, actual_formattype, size - 32); - url_fskip(pb, 32); + avio_seek(pb, 32, SEEK_CUR); return st; } else if (!ff_guidcmp(mediatype, mediatype_audio)) { st = new_stream(s, st, sid, AVMEDIA_TYPE_AUDIO); @@ -262,7 +679,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, } else { if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); } if (!memcmp(subtype + 4, (const uint8_t[]){MEDIASUBTYPE_BASE_GUID}, 12)) { @@ -284,14 +701,14 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, return NULL; if (!ff_guidcmp(formattype, format_videoinfo2)) { int consumed = parse_videoinfoheader2(s, st); - url_fskip(pb, FFMAX(size - consumed, 0)); + avio_seek(pb, FFMAX(size - consumed, 0), SEEK_CUR); } else if (!ff_guidcmp(formattype, format_mpeg2_video)) { int consumed = parse_videoinfoheader2(s, st); - url_fskip(pb, FFMAX(size - consumed, 0)); + avio_seek(pb, FFMAX(size - consumed, 0), SEEK_CUR); } else { if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); } if (!memcmp(subtype + 4, (const uint8_t[]){MEDIASUBTYPE_BASE_GUID}, 12)) { @@ -309,7 +726,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, return NULL; if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); st->codec->codec_id = CODEC_ID_DVB_SUBTITLE; return st; } else if (!ff_guidcmp(mediatype, mediatype_mstvcaption) && @@ -319,87 +736,76 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, return NULL; if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); st->codec->codec_id = CODEC_ID_DVB_TELETEXT; return st; } else if (!ff_guidcmp(mediatype, mediatype_mpeg2_sections) && !ff_guidcmp(subtype, mediasubtype_mpeg2_sections)) { if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); return NULL; } av_log(s, AV_LOG_WARNING, "unknown media type, mediatype:"PRI_GUID ", subtype:"PRI_GUID", formattype:"PRI_GUID"\n", ARG_GUID(mediatype), ARG_GUID(subtype), ARG_GUID(formattype)); - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); return NULL; } enum { SEEK_TO_DATA = 0, - SEEK_TO_BYTE, SEEK_TO_PTS, }; /** * Parse WTV chunks - * @param mode SEEK_TO_DATA, SEEK_TO_BYTE, SEEK_TO_PTS - * @param seekts either byte position or timestamp + * @param mode SEEK_TO_DATA or SEEK_TO_PTS + * @param seekts timestamp * @param[out] len Length of data chunk * @return stream index of data chunk, or <0 on error */ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_ptr) { WtvContext *wtv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = wtv->pb; while (!url_feof(pb)) { ff_asf_guid g; int len, sid, consumed; - if (mode == SEEK_TO_BYTE && url_ftell(pb) >= seekts) - return 0; - ff_get_guid(pb, &g); - if (is_zero(g, sizeof(ff_asf_guid))) - return AVERROR_EOF; - - len = get_le32(pb); + len = avio_rl32(pb); if (len < 32) break; - sid = get_le32(pb) & 0x7FFF; - url_fskip(pb, 8); + sid = avio_rl32(pb) & 0x7FFF; + avio_seek(pb, 8, SEEK_CUR); consumed = 32; if (!ff_guidcmp(g, stream_guid)) { if (ff_find_stream_index(s, sid) < 0) { ff_asf_guid mediatype, subtype, formattype; int size; - consumed += 20; - url_fskip(pb, 16); - if (get_le32(pb)) { - url_fskip(pb, 8); - ff_get_guid(pb, &mediatype); - ff_get_guid(pb, &subtype); - url_fskip(pb, 12); - ff_get_guid(pb, &formattype); - size = get_le32(pb); - parse_media_type(s, 0, sid, mediatype, subtype, formattype, size); - consumed += 72 + size; - } + avio_seek(pb, 28, SEEK_CUR); + ff_get_guid(pb, &mediatype); + ff_get_guid(pb, &subtype); + avio_seek(pb, 12, SEEK_CUR); + ff_get_guid(pb, &formattype); + size = avio_rl32(pb); + parse_media_type(s, 0, sid, mediatype, subtype, formattype, size); + consumed += 92 + size; } } else if (!ff_guidcmp(g, stream2_guid)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0 && !((WtvStream*)s->streams[stream_index]->priv_data)->seen_data) { ff_asf_guid mediatype, subtype, formattype; int size; - url_fskip(pb, 12); + avio_seek(pb, 12, SEEK_CUR); ff_get_guid(pb, &mediatype); ff_get_guid(pb, &subtype); - url_fskip(pb, 12); + avio_seek(pb, 12, SEEK_CUR); ff_get_guid(pb, &formattype); - size = get_le32(pb); + size = avio_rl32(pb); parse_media_type(s, s->streams[stream_index], sid, mediatype, subtype, formattype, size); consumed += 76 + size; } @@ -416,24 +822,37 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p const uint8_t *pbuf = buf; int buf_size; - url_fskip(pb, 8); + avio_seek(pb, 8, SEEK_CUR); consumed += 8; if (!ff_guidcmp(g, EVENTID_CtxADescriptorSpanningEvent) || !ff_guidcmp(g, EVENTID_CSDescriptorSpanningEvent)) { - url_fskip(pb, 6); + avio_seek(pb, 6, SEEK_CUR); consumed += 6; } buf_size = FFMIN(len - consumed, sizeof(buf)); - get_buffer(pb, buf, buf_size); + avio_read(pb, buf, buf_size); consumed += buf_size; ff_parse_mpeg2_descriptor(s, st, 0, &pbuf, buf + buf_size, 0, 0, 0, 0); } + } else if (!ff_guidcmp(g, EVENTID_AudioTypeSpanningEvent)) { + int stream_index = ff_find_stream_index(s, sid); + if (stream_index >= 0) { + AVStream *st = s->streams[stream_index]; + int audio_type; + avio_seek(pb, 8, SEEK_CUR); + audio_type = avio_r8(pb); + if (audio_type == 2) + st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; + else if (audio_type == 3) + st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; + consumed += 9; + } } else if (!ff_guidcmp(g, EVENTID_DVBScramblingControlSpanningEvent)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { - url_fskip(pb, 12); - if (get_le32(pb)) + avio_seek(pb, 12, SEEK_CUR); + if (avio_rl32(pb)) av_log(s, AV_LOG_WARNING, "DVB scrambled stream detected (st:%d), decoding will likely fail\n", stream_index); consumed += 16; } @@ -442,38 +861,43 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (stream_index >= 0) { AVStream *st = s->streams[stream_index]; uint8_t language[4]; - url_fskip(pb, 12); - get_buffer(pb, language, 3); + avio_seek(pb, 12, SEEK_CUR); + avio_read(pb, language, 3); if (language[0]) { language[3] = 0; av_metadata_set2(&st->metadata, "language", language, 0); + if (!strcmp(language, "nar") || !strcmp(language, "NAR")) + st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED; } consumed += 15; } } else if (!ff_guidcmp(g, timestamp_guid)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { - url_fskip(pb, 8); - wtv->pts = get_le64(pb); + avio_seek(pb, 8, SEEK_CUR); + wtv->pts = avio_rl64(pb); consumed += 16; if (wtv->pts == -1) wtv->pts = AV_NOPTS_VALUE; + else { + wtv->last_valid_pts = wtv->pts; + if (wtv->epoch == AV_NOPTS_VALUE || wtv->pts < wtv->epoch) + wtv->epoch = wtv->pts; if (mode == SEEK_TO_PTS && wtv->pts >= seekts) { #define WTV_PAD8(x) (((x) + 7) & ~7) - url_fskip(pb, WTV_PAD8(len) - consumed); + avio_seek(pb, WTV_PAD8(len) - consumed, SEEK_CUR); return 0; } + } } } else if (!ff_guidcmp(g, data_guid)) { int stream_index = ff_find_stream_index(s, sid); - if (mode == SEEK_TO_DATA && stream_index >= 0) { + if (mode == SEEK_TO_DATA && stream_index >= 0 && len > 32) { WtvStream *wst = s->streams[stream_index]->priv_data; wst->seen_data = 1; if (len_ptr) { *len_ptr = len; } - if (wtv->pts != AV_NOPTS_VALUE) - av_add_index_entry(s->streams[stream_index], url_ftell(pb) - consumed, wtv->pts, 0, 0, AVINDEX_KEYFRAME); return stream_index; } } else if ( @@ -481,7 +905,6 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p !ff_guidcmp(g, /* DSATTRIB_PicSampleSeq */ (const ff_asf_guid){0x02,0xAE,0x5B,0x2F,0x8F,0x7B,0x60,0x4F,0x82,0xD6,0xE4,0xEA,0x2F,0x1F,0x4C,0x99}) || !ff_guidcmp(g, /* DSATTRIB_TRANSPORT_PROPERTIES */ (const ff_asf_guid){0x12,0xF6,0x22,0xB6,0xAD,0x47,0x71,0x46,0xAD,0x6C,0x05,0xA9,0x8E,0x65,0xDE,0x3A}) || !ff_guidcmp(g, /* dvr_ms_vid_frame_rep_data */ (const ff_asf_guid){0xCC,0x32,0x64,0xDD,0x29,0xE2,0xDB,0x40,0x80,0xF6,0xD2,0x63,0x28,0xD2,0x76,0x1F}) || - !ff_guidcmp(g, /* EVENTID_AudioTypeSpanningEvent */ (const ff_asf_guid){0xBE,0xBF,0x1C,0x50,0x49,0xB8,0xCE,0x42,0x9B,0xE9,0x3D,0xB8,0x69,0xFB,0x82,0xB3}) || !ff_guidcmp(g, /* EVENTID_ChannelChangeSpanningEvent */ (const ff_asf_guid){0xE5,0xC5,0x67,0x90,0x5C,0x4C,0x05,0x42,0x86,0xC8,0x7A,0xFE,0x20,0xFE,0x1E,0xFA}) || !ff_guidcmp(g, /* EVENTID_ChannelInfoSpanningEvent */ (const ff_asf_guid){0x80,0x6D,0xF3,0x41,0x32,0x41,0xC2,0x4C,0xB1,0x21,0x01,0xA4,0x32,0x19,0xD8,0x1B}) || !ff_guidcmp(g, /* EVENTID_ChannelTypeSpanningEvent */ (const ff_asf_guid){0x51,0x1D,0xAB,0x72,0xD2,0x87,0x9B,0x48,0xBA,0x11,0x0E,0x08,0xDC,0x21,0x02,0x43}) || @@ -500,31 +923,119 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p } else av_log(s, AV_LOG_WARNING, "unsupported chunk:"PRI_GUID"\n", ARG_GUID(g)); - url_fskip(pb, WTV_PAD8(len) - consumed); + avio_seek(pb, WTV_PAD8(len) - consumed, SEEK_CUR); } return AVERROR_EOF; } -#define WTV_CHUNK_START 0x40000 +/* declare utf16le strings */ +#define _ , 0, +static const uint8_t timeline_le16[] = + {'t'_'i'_'m'_'e'_'l'_'i'_'n'_'e', 0}; +static const uint8_t table_0_entries_legacy_attrib_le16[] = + {'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'e'_'n'_'t'_'r'_'i'_'e'_'s'_'.'_'l'_'e'_'g'_'a'_'c'_'y'_'_'_'a'_'t'_'t'_'r'_'i'_'b', 0}; +static const uint8_t table_0_entries_time_le16[] = + {'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'e'_'n'_'t'_'r'_'i'_'e'_'s'_'.'_'t'_'i'_'m'_'e', 0}; +static const uint8_t timeline_table_0_entries_Events_le16[] = + {'t'_'i'_'m'_'e'_'l'_'i'_'n'_'e'_'.'_'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'e'_'n'_'t'_'r'_'i'_'e'_'s'_'.'_'E'_'v'_'e'_'n'_'t'_'s', 0}; +#undef _ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + WtvContext *wtv = s->priv_data; + int root_sector, root_size; + uint8_t root[WTV_SECTOR_SIZE]; + AVIOContext *pb; + int64_t timeline_pos; int ret; - url_fseek(pb, WTV_CHUNK_START, SEEK_SET); + wtv->epoch = + wtv->pts = + wtv->last_valid_pts = AV_NOPTS_VALUE; + + /* read root directory sector */ + avio_seek(s->pb, 0x30, SEEK_CUR); + root_size = avio_rl32(s->pb); + if (root_size > sizeof(root)) { + av_log(s, AV_LOG_ERROR, "root directory size exceeds sector size\n"); + return AVERROR_INVALIDDATA; + } + avio_seek(s->pb, 4, SEEK_CUR); + root_sector = avio_rl32(s->pb); + + avio_seek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET); + root_size = avio_read(s->pb, root, root_size); + if (root_size < 0) + return AVERROR_INVALIDDATA; + + /* parse chunks up until first data chunk */ + wtv->pb = wtvfile_open(s, root, root_size, timeline_le16); + if (!wtv->pb) { + av_log(s, AV_LOG_ERROR, "timeline data missing\n"); + return AVERROR_INVALIDDATA; + } + ret = parse_chunks(s, SEEK_TO_DATA, 0, 0); if (ret < 0) return ret; + avio_seek(wtv->pb, -32, SEEK_CUR); + + timeline_pos = url_ftell(s->pb); // save before opening another file - url_fseek(pb, -32, SEEK_CUR); + /* read metadata */ + pb = wtvfile_open(s, root, root_size, table_0_entries_legacy_attrib_le16); + if (pb) { + parse_legacy_attrib(s, pb); + wtvfile_close(pb); + } + + /* read seek index */ + if (s->nb_streams) { + AVStream *st = s->streams[0]; + pb = wtvfile_open(s, root, root_size, table_0_entries_time_le16); + if (pb) { + while(1) { + uint64_t timestamp = avio_rl64(pb); + uint64_t frame_nb = avio_rl64(pb); + if (url_feof(pb)) + break; + ff_add_index_entry(&wtv->index_entries, &wtv->nb_index_entries, &wtv->index_entries_allocated_size, + 0, timestamp, frame_nb, 0, AVINDEX_KEYFRAME); + } + wtvfile_close(pb); + + if (wtv->nb_index_entries) { + pb = wtvfile_open(s, root, root_size, timeline_table_0_entries_Events_le16); + if (pb) { + int i; + while (1) { + uint64_t frame_nb = avio_rl64(pb); + uint64_t position = avio_rl64(pb); + if (url_feof(pb)) + break; + for (i = wtv->nb_index_entries - 1; i >= 0; i--) { + AVIndexEntry *e = wtv->index_entries + i; + if (frame_nb > e->size) + break; + if (position > e->pos) + e->pos = position; + } + } + wtvfile_close(pb); + st->duration = wtv->index_entries[wtv->nb_index_entries - 1].timestamp; + } + } + } + } + + avio_seek(s->pb, timeline_pos, SEEK_SET); return 0; } static int read_packet(AVFormatContext *s, AVPacket *pkt) { WtvContext *wtv = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = wtv->pb; int stream_index, len, ret; stream_index = parse_chunks(s, SEEK_TO_DATA, 0, &len); @@ -536,63 +1047,51 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return ret; pkt->stream_index = stream_index; pkt->pts = wtv->pts; - url_fskip(pb, WTV_PAD8(len) - len); + avio_seek(pb, WTV_PAD8(len) - len, SEEK_CUR); return 0; } -static int read_seek2(AVFormatContext *s, int stream_index, - int64_t min_ts, int64_t ts, int64_t max_ts, int flags) +static int read_seek(AVFormatContext *s, int stream_index, + int64_t ts, int flags) { WtvContext *wtv = s->priv_data; - ByteIOContext *pb = s->pb; - AVStream *st; + AVIOContext *pb = wtv->pb; + AVStream *st = s->streams[0]; + int64_t ts_relative; int i; - if (stream_index < 0) { - stream_index = av_find_default_stream_index(s); - if (stream_index < 0) - return -1; - } - st = s->streams[stream_index]; - - if ((flags & AVSEEK_FLAG_FRAME)) { + if ((flags & AVSEEK_FLAG_FRAME) || (flags & AVSEEK_FLAG_BYTE)) return AVERROR_NOTSUPP; - } else if ((flags & AVSEEK_FLAG_BYTE)) { - if (ts < url_ftell(pb)) { - for (i = st->nb_index_entries - 1; i >= 0; i--) { - if (st->index_entries[i].pos <= ts) { - wtv->pts = st->index_entries[i].timestamp; - url_fseek(pb, st->index_entries[i].pos, SEEK_SET); - break; - } - } - if (i < 0) { - wtv->pts = 0; - url_fseek(pb, WTV_CHUNK_START, SEEK_SET); - } - } - if (parse_chunks(s, SEEK_TO_BYTE, ts, 0) < 0) + + /* timestamp adjustment is required because wtv->pts values are absolute, + * whereas AVIndexEntry->timestamp values are relative to epoch. */ + ts_relative = ts; + if (wtv->epoch != AV_NOPTS_VALUE) + ts_relative -= wtv->epoch; + + i = ff_index_search_timestamp(wtv->index_entries, wtv->nb_index_entries, ts_relative, flags); + if (i < 0) { + if (wtv->last_valid_pts == AV_NOPTS_VALUE || ts < wtv->last_valid_pts) + avio_seek(pb, 0, SEEK_SET); + else if (st->duration != AV_NOPTS_VALUE && ts_relative > st->duration && wtv->nb_index_entries) + avio_seek(pb, wtv->index_entries[wtv->nb_index_entries - 1].pos, SEEK_SET); + if (parse_chunks(s, SEEK_TO_PTS, ts, 0) < 0) return AVERROR(ERANGE); return 0; - } else { - ts *= 10; - i = av_index_search_timestamp(st, ts, flags); - if (i < 0) { - if (st->nb_index_entries > 0) { - wtv->pts = st->index_entries[st->nb_index_entries - 1].timestamp; - url_fseek(pb, st->index_entries[st->nb_index_entries - 1].pos, SEEK_SET); - } else { - wtv->pts = 0; - url_fseek(pb, WTV_CHUNK_START, SEEK_SET); - } - if (parse_chunks(s, SEEK_TO_PTS, ts, 0) < 0) - return AVERROR(ERANGE); - return 0; - } - wtv->pts = st->index_entries[i].timestamp; - url_fseek(pb, st->index_entries[i].pos, SEEK_SET); - return 0; } + wtv->pts = wtv->index_entries[i].timestamp; + if (wtv->epoch != AV_NOPTS_VALUE) + wtv->pts += wtv->epoch; + wtv->last_valid_pts = wtv->pts; + avio_seek(pb, wtv->index_entries[i].pos, SEEK_SET); + return 0; +} + +static int read_close(AVFormatContext *s) +{ + WtvContext *wtv = s->priv_data; + wtvfile_close(wtv->pb); + return 0; } AVInputFormat ff_wtv_demuxer = { @@ -602,6 +1101,7 @@ AVInputFormat ff_wtv_demuxer = { .read_probe = read_probe, .read_header = read_header, .read_packet = read_packet, - .read_seek2 = read_seek2, - .flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT, + .read_seek = read_seek, + .read_close = read_close, + .flags = AVFMT_SHOW_IDS, }; diff --git a/mplayer/ffmpeg/libavformat/wv.c b/mplayer/ffmpeg/libavformat/wv.c index 667ae2e6..7a2c855f 100644 --- a/mplayer/ffmpeg/libavformat/wv.c +++ b/mplayer/ffmpeg/libavformat/wv.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/audioconvert.h" #include "libavutil/intreadwrite.h" #include "avformat.h" #include "apetag.h" @@ -75,7 +76,7 @@ static int wv_probe(AVProbeData *p) return 0; } -static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int append) +static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int append) { WVContext *wc = ctx->priv_data; uint32_t tag, ver; @@ -85,25 +86,25 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int app wc->pos = url_ftell(pb); if(!append){ - tag = get_le32(pb); + tag = avio_rl32(pb); if (tag != MKTAG('w', 'v', 'p', 'k')) return -1; - size = get_le32(pb); + size = avio_rl32(pb); if(size < 24 || size > WV_BLOCK_LIMIT){ av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size); return -1; } wc->blksize = size; - ver = get_le16(pb); + ver = avio_rl16(pb); if(ver < 0x402 || ver > 0x410){ av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver); return -1; } - get_byte(pb); // track no - get_byte(pb); // track sub index - wc->samples = get_le32(pb); // total samples in file - wc->soff = get_le32(pb); // offset in samples of current block - get_buffer(pb, wc->extra, WV_EXTRA_SIZE); + avio_r8(pb); // track no + avio_r8(pb); // track sub index + wc->samples = avio_rl32(pb); // total samples in file + wc->soff = avio_rl32(pb); // offset in samples of current block + avio_read(pb, wc->extra, WV_EXTRA_SIZE); }else{ size = wc->blksize; } @@ -111,7 +112,7 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int app //parse flags bpp = ((wc->flags & 3) + 1) << 3; chan = 1 + !(wc->flags & WV_MONO); - chmask = wc->flags & WV_MONO ? CH_LAYOUT_MONO : CH_LAYOUT_STEREO; + chmask = wc->flags & WV_MONO ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; rate = wv_rates[(wc->flags >> 23) & 0xF]; wc->multichannel = !!((wc->flags & WV_SINGLE_BLOCK) != WV_SINGLE_BLOCK); if(wc->multichannel){ @@ -126,8 +127,8 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int app } while(url_ftell(pb) < block_end){ int id, size; - id = get_byte(pb); - size = (id & 0x80) ? get_le24(pb) : get_byte(pb); + id = avio_r8(pb); + size = (id & 0x80) ? avio_rl24(pb) : avio_r8(pb); size <<= 1; if(id&0x40) size--; @@ -137,24 +138,24 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int app av_log(ctx, AV_LOG_ERROR, "Insufficient channel information\n"); return -1; } - chan = get_byte(pb); + chan = avio_r8(pb); switch(size - 2){ case 0: - chmask = get_byte(pb); + chmask = avio_r8(pb); break; case 1: - chmask = get_le16(pb); + chmask = avio_rl16(pb); break; case 2: - chmask = get_le24(pb); + chmask = avio_rl24(pb); break; case 3: - chmask = get_le32(pb); + chmask = avio_rl32(pb); break; case 5: - url_fskip(pb, 1); - chan |= (get_byte(pb) & 0xF) << 8; - chmask = get_le24(pb); + avio_seek(pb, 1, SEEK_CUR); + chan |= (avio_r8(pb) & 0xF) << 8; + chmask = avio_rl24(pb); break; default: av_log(ctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size); @@ -162,19 +163,19 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int app } break; case 0x27: - rate = get_le24(pb); + rate = avio_rl24(pb); break; default: - url_fskip(pb, size); + avio_seek(pb, size, SEEK_CUR); } if(id&0x40) - url_fskip(pb, 1); + avio_seek(pb, 1, SEEK_CUR); } if(rate == -1){ av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n"); return -1; } - url_fseek(pb, block_end - wc->blksize + 24, SEEK_SET); + avio_seek(pb, block_end - wc->blksize + 24, SEEK_SET); } if(!wc->bpp) wc->bpp = bpp; if(!wc->chan) wc->chan = chan; @@ -200,7 +201,7 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int app static int wv_read_header(AVFormatContext *s, AVFormatParameters *ap) { - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; WVContext *wc = s->priv_data; AVStream *st; @@ -227,7 +228,7 @@ static int wv_read_header(AVFormatContext *s, ff_ape_parse_tag(s); if(!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) ff_id3v1_read(s); - url_fseek(s->pb, cur, SEEK_SET); + avio_seek(s->pb, cur, SEEK_SET); } return 0; @@ -253,13 +254,13 @@ static int wv_read_packet(AVFormatContext *s, if(wc->multichannel) AV_WL32(pkt->data, wc->blksize + WV_EXTRA_SIZE + 12); memcpy(pkt->data + off, wc->extra, WV_EXTRA_SIZE); - ret = get_buffer(s->pb, pkt->data + WV_EXTRA_SIZE + off, wc->blksize); + ret = avio_read(s->pb, pkt->data + WV_EXTRA_SIZE + off, wc->blksize); if(ret != wc->blksize){ av_free_packet(pkt); return AVERROR(EIO); } while(!(wc->flags & WV_END_BLOCK)){ - if(get_le32(s->pb) != MKTAG('w', 'v', 'p', 'k')){ + if(avio_rl32(s->pb) != MKTAG('w', 'v', 'p', 'k')){ av_free_packet(pkt); return -1; } @@ -274,16 +275,16 @@ static int wv_read_packet(AVFormatContext *s, return -1; } wc->blksize = size; - ver = get_le16(s->pb); + ver = avio_rl16(s->pb); if(ver < 0x402 || ver > 0x410){ av_free_packet(pkt); av_log(s, AV_LOG_ERROR, "Unsupported version %03X\n", ver); return -1; } - get_byte(s->pb); // track no - get_byte(s->pb); // track sub index - wc->samples = get_le32(s->pb); // total samples in file - wc->soff = get_le32(s->pb); // offset in samples of current block + avio_r8(s->pb); // track no + avio_r8(s->pb); // track sub index + wc->samples = avio_rl32(s->pb); // total samples in file + wc->soff = avio_rl32(s->pb); // offset in samples of current block if((ret = av_append_packet(s->pb, pkt, WV_EXTRA_SIZE)) < 0){ av_free_packet(pkt); return ret; @@ -319,7 +320,7 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, /* if found, seek there */ if (index >= 0){ wc->block_parsed = 1; - url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); return 0; } /* if timestamp is out of bounds, return error */ @@ -330,7 +331,7 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, do{ ret = av_read_frame(s, pkt); if (ret < 0){ - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); return -1; } pts = pkt->pts; diff --git a/mplayer/ffmpeg/libavformat/xa.c b/mplayer/ffmpeg/libavformat/xa.c index 21a6b26e..17cf237a 100644 --- a/mplayer/ffmpeg/libavformat/xa.c +++ b/mplayer/ffmpeg/libavformat/xa.c @@ -66,7 +66,7 @@ static int xa_read_header(AVFormatContext *s, AVFormatParameters *ap) { MaxisXADemuxContext *xa = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVStream *st; /*Set up the XA Audio Decoder*/ @@ -76,15 +76,15 @@ static int xa_read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_ADPCM_EA_MAXIS_XA; - url_fskip(pb, 4); /* Skip the XA ID */ - xa->out_size = get_le32(pb); - url_fskip(pb, 2); /* Skip the tag */ - st->codec->channels = get_le16(pb); - st->codec->sample_rate = get_le32(pb); + avio_seek(pb, 4, SEEK_CUR); /* Skip the XA ID */ + xa->out_size = avio_rl32(pb); + avio_seek(pb, 2, SEEK_CUR); /* Skip the tag */ + st->codec->channels = avio_rl16(pb); + st->codec->sample_rate = avio_rl32(pb); /* Value in file is average byte rate*/ - st->codec->bit_rate = get_le32(pb) * 8; - st->codec->block_align = get_le16(pb); - st->codec->bits_per_coded_sample = get_le16(pb); + st->codec->bit_rate = avio_rl32(pb) * 8; + st->codec->block_align = avio_rl16(pb); + st->codec->bits_per_coded_sample = avio_rl16(pb); av_set_pts_info(st, 64, 1, st->codec->sample_rate); @@ -96,7 +96,7 @@ static int xa_read_packet(AVFormatContext *s, { MaxisXADemuxContext *xa = s->priv_data; AVStream *st = s->streams[0]; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; unsigned int packet_size; int ret; diff --git a/mplayer/ffmpeg/libavformat/yop.c b/mplayer/ffmpeg/libavformat/yop.c index ae909254..e4437b7a 100644 --- a/mplayer/ffmpeg/libavformat/yop.c +++ b/mplayer/ffmpeg/libavformat/yop.c @@ -50,7 +50,7 @@ static int yop_probe(AVProbeData *probe_packet) static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) { YopDecContext *yop = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVCodecContext *audio_dec, *video_dec; AVStream *audio_stream, *video_stream; @@ -81,16 +81,16 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) video_dec->codec_type = AVMEDIA_TYPE_VIDEO; video_dec->codec_id = CODEC_ID_YOP; - url_fskip(pb, 6); + avio_seek(pb, 6, SEEK_CUR); - frame_rate = get_byte(pb); - yop->frame_size = get_byte(pb) * 2048; - video_dec->width = get_le16(pb); - video_dec->height = get_le16(pb); + frame_rate = avio_r8(pb); + yop->frame_size = avio_r8(pb) * 2048; + video_dec->width = avio_rl16(pb); + video_dec->height = avio_rl16(pb); video_stream->sample_aspect_ratio = (AVRational){1, 2}; - ret = get_buffer(pb, video_dec->extradata, 8); + ret = avio_read(pb, video_dec->extradata, 8); if (ret < 8) return ret < 0 ? ret : AVERROR_EOF; @@ -104,7 +104,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR_INVALIDDATA; } - url_fseek(pb, 2048, SEEK_SET); + avio_seek(pb, 2048, SEEK_SET); av_set_pts_info(video_stream, 32, 1, frame_rate); @@ -114,7 +114,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) { YopDecContext *yop = s->priv_data; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int ret; int actual_video_data_size = yop->frame_size - @@ -138,7 +138,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) yop->video_packet.pos = url_ftell(pb); - ret = get_buffer(pb, yop->video_packet.data, yop->palette_size); + ret = avio_read(pb, yop->video_packet.data, yop->palette_size); if (ret < 0) { goto err_out; }else if (ret < yop->palette_size) { @@ -153,9 +153,9 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) // Set position to the start of the frame pkt->pos = yop->video_packet.pos; - url_fskip(pb, yop->audio_block_length - ret); + avio_seek(pb, yop->audio_block_length - ret, SEEK_CUR); - ret = get_buffer(pb, yop->video_packet.data + yop->palette_size, + ret = avio_read(pb, yop->video_packet.data + yop->palette_size, actual_video_data_size); if (ret < 0) goto err_out; @@ -198,7 +198,7 @@ static int yop_read_seek(AVFormatContext *s, int stream_index, frame_pos = timestamp * yop->frame_size + pos_min; yop->odd_frame = timestamp & 1; - url_fseek(s->pb, frame_pos, SEEK_SET); + avio_seek(s->pb, frame_pos, SEEK_SET); return 0; } diff --git a/mplayer/ffmpeg/libavformat/yuv4mpeg.c b/mplayer/ffmpeg/libavformat/yuv4mpeg.c index 6c763986..01366b08 100644 --- a/mplayer/ffmpeg/libavformat/yuv4mpeg.c +++ b/mplayer/ffmpeg/libavformat/yuv4mpeg.c @@ -90,7 +90,7 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf) static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt) { AVStream *st = s->streams[pkt->stream_index]; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; AVPicture *picture; int* first_pkt = s->priv_data; int width, height, h_chroma_shift, v_chroma_shift; @@ -108,21 +108,21 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt) av_log(s, AV_LOG_ERROR, "Error. YUV4MPEG stream header write failed.\n"); return AVERROR(EIO); } else { - put_buffer(pb, buf2, strlen(buf2)); + avio_write(pb, buf2, strlen(buf2)); } } /* construct frame header */ m = snprintf(buf1, sizeof(buf1), "%s\n", Y4M_FRAME_MAGIC); - put_buffer(pb, buf1, strlen(buf1)); + avio_write(pb, buf1, strlen(buf1)); width = st->codec->width; height = st->codec->height; ptr = picture->data[0]; for(i=0;ilinesize[0]; } @@ -135,11 +135,11 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt) ptr1 = picture->data[1]; ptr2 = picture->data[2]; for(i=0;ilinesize[1]; } for(i=0;ilinesize[2]; } } @@ -192,7 +192,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap) char header[MAX_YUV4_HEADER+10]; // Include headroom for the longest option char *tokstart,*tokend,*header_end; int i; - ByteIOContext *pb = s->pb; + AVIOContext *pb = s->pb; int width=-1, height=-1, raten=0, rated=0, aspectn=0, aspectd=0; enum PixelFormat pix_fmt=PIX_FMT_NONE,alt_pix_fmt=PIX_FMT_NONE; enum AVChromaLocation chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; @@ -200,7 +200,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap) struct frame_attributes *s1 = s->priv_data; for (i=0; ipriv_data; for (i=0; ipb); + header[i] = avio_r8(s->pb); if (header[i] == '\n') { header[i+1] = 0; break; diff --git a/mplayer/ffmpeg/libavutil/Makefile b/mplayer/ffmpeg/libavutil/Makefile index fe0302c3..300acb18 100644 --- a/mplayer/ffmpeg/libavutil/Makefile +++ b/mplayer/ffmpeg/libavutil/Makefile @@ -4,6 +4,7 @@ NAME = avutil HEADERS = adler32.h \ attributes.h \ + audioconvert.h \ avassert.h \ avstring.h \ avutil.h \ @@ -16,6 +17,7 @@ HEADERS = adler32.h \ eval.h \ fifo.h \ file.h \ + imgutils.h \ intfloat_readwrite.h \ intreadwrite.h \ lfg.h \ @@ -25,16 +27,19 @@ HEADERS = adler32.h \ md5.h \ mem.h \ opt.h \ + parseutils.h \ pixdesc.h \ pixfmt.h \ random_seed.h \ rational.h \ + samplefmt.h \ sha1.h \ BUILT_HEADERS = avconfig.h OBJS = adler32.o \ aes.o \ + audioconvert.o \ avstring.o \ base64.o \ cpu.o \ @@ -44,6 +49,7 @@ OBJS = adler32.o \ eval.o \ fifo.o \ file.o \ + imgutils.o \ intfloat_readwrite.o \ inverse.o \ lfg.o \ @@ -54,10 +60,12 @@ OBJS = adler32.o \ md5.o \ mem.o \ opt.o \ + parseutils.o \ pixdesc.o \ random_seed.o \ rational.o \ rc4.o \ + samplefmt.o \ sha.o \ tree.o \ utils.o \ diff --git a/mplayer/ffmpeg/libavutil/arm/intmath.h b/mplayer/ffmpeg/libavutil/arm/intmath.h index 2c0aa3b1..8f03d4bf 100644 --- a/mplayer/ffmpeg/libavutil/arm/intmath.h +++ b/mplayer/ffmpeg/libavutil/arm/intmath.h @@ -31,7 +31,7 @@ #if HAVE_ARMV6 #define FASTDIV FASTDIV -static inline av_const int FASTDIV(int a, int b) +static av_always_inline av_const int FASTDIV(int a, int b) { int r, t; __asm__ volatile("cmp %3, #2 \n\t" @@ -43,7 +43,7 @@ static inline av_const int FASTDIV(int a, int b) } #define av_clip_uint8 av_clip_uint8_arm -static inline av_const uint8_t av_clip_uint8_arm(int a) +static av_always_inline av_const uint8_t av_clip_uint8_arm(int a) { unsigned x; __asm__ volatile ("usat %0, #8, %1" : "=r"(x) : "r"(a)); @@ -51,7 +51,7 @@ static inline av_const uint8_t av_clip_uint8_arm(int a) } #define av_clip_int8 av_clip_int8_arm -static inline av_const uint8_t av_clip_int8_arm(int a) +static av_always_inline av_const uint8_t av_clip_int8_arm(int a) { unsigned x; __asm__ volatile ("ssat %0, #8, %1" : "=r"(x) : "r"(a)); @@ -59,7 +59,7 @@ static inline av_const uint8_t av_clip_int8_arm(int a) } #define av_clip_uint16 av_clip_uint16_arm -static inline av_const uint16_t av_clip_uint16_arm(int a) +static av_always_inline av_const uint16_t av_clip_uint16_arm(int a) { unsigned x; __asm__ volatile ("usat %0, #16, %1" : "=r"(x) : "r"(a)); @@ -67,7 +67,7 @@ static inline av_const uint16_t av_clip_uint16_arm(int a) } #define av_clip_int16 av_clip_int16_arm -static inline av_const int16_t av_clip_int16_arm(int a) +static av_always_inline av_const int16_t av_clip_int16_arm(int a) { int x; __asm__ volatile ("ssat %0, #16, %1" : "=r"(x) : "r"(a)); @@ -77,7 +77,7 @@ static inline av_const int16_t av_clip_int16_arm(int a) #else /* HAVE_ARMV6 */ #define FASTDIV FASTDIV -static inline av_const int FASTDIV(int a, int b) +static av_always_inline av_const int FASTDIV(int a, int b) { int r, t; __asm__ volatile("umull %1, %0, %2, %3" @@ -88,7 +88,7 @@ static inline av_const int FASTDIV(int a, int b) #endif /* HAVE_ARMV6 */ #define av_clipl_int32 av_clipl_int32_arm -static inline av_const int32_t av_clipl_int32_arm(int64_t a) +static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a) { int x, y; __asm__ volatile ("adds %1, %R2, %Q2, lsr #31 \n\t" diff --git a/mplayer/ffmpeg/libavutil/attributes.h b/mplayer/ffmpeg/libavutil/attributes.h index d93f4609..65a9249c 100644 --- a/mplayer/ffmpeg/libavutil/attributes.h +++ b/mplayer/ffmpeg/libavutil/attributes.h @@ -96,6 +96,19 @@ #endif #endif +/** + * Mark a variable as used and prevent the compiler from optimizing it + * away. This is useful for variables accessed only from inline + * assembler without the compiler being aware. + */ +#ifndef av_used +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_used __attribute__((used)) +#else +# define av_used +#endif +#endif + #ifndef av_alias #if (!defined(__ICC) || __ICC > 1200) && AV_GCC_VERSION_AT_LEAST(3,3) # define av_alias __attribute__((may_alias)) diff --git a/mplayer/ffmpeg/libavcore/audioconvert.c b/mplayer/ffmpeg/libavutil/audioconvert.c similarity index 99% rename from mplayer/ffmpeg/libavcore/audioconvert.c rename to mplayer/ffmpeg/libavutil/audioconvert.c index c7207338..8bc43f89 100644 --- a/mplayer/ffmpeg/libavcore/audioconvert.c +++ b/mplayer/ffmpeg/libavutil/audioconvert.c @@ -23,6 +23,7 @@ * audio conversion routines */ +#include "libavutil/avutil.h" #include "libavutil/avstring.h" #include "audioconvert.h" diff --git a/mplayer/ffmpeg/libavcore/audioconvert.h b/mplayer/ffmpeg/libavutil/audioconvert.h similarity index 97% rename from mplayer/ffmpeg/libavcore/audioconvert.h rename to mplayer/ffmpeg/libavutil/audioconvert.h index 89e9c55d..134c6107 100644 --- a/mplayer/ffmpeg/libavcore/audioconvert.h +++ b/mplayer/ffmpeg/libavutil/audioconvert.h @@ -19,16 +19,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCORE_AUDIOCONVERT_H -#define AVCORE_AUDIOCONVERT_H +#ifndef AVUTIL_AUDIOCONVERT_H +#define AVUTIL_AUDIOCONVERT_H + +#include /** * @file * audio conversion routines */ -#include "avcore.h" - /* Audio channel masks */ #define AV_CH_FRONT_LEFT 0x00000001 #define AV_CH_FRONT_RIGHT 0x00000002 @@ -92,4 +92,4 @@ void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int6 */ int av_get_channel_layout_nb_channels(int64_t channel_layout); -#endif /* AVCORE_AUDIOCONVERT_H */ +#endif /* AVUTIL_AUDIOCONVERT_H */ diff --git a/mplayer/ffmpeg/libavutil/avutil.h b/mplayer/ffmpeg/libavutil/avutil.h index 74c2b5ef..e887c4d5 100644 --- a/mplayer/ffmpeg/libavutil/avutil.h +++ b/mplayer/ffmpeg/libavutil/avutil.h @@ -40,7 +40,7 @@ #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) #define LIBAVUTIL_VERSION_MAJOR 50 -#define LIBAVUTIL_VERSION_MINOR 36 +#define LIBAVUTIL_VERSION_MINOR 39 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -93,6 +93,18 @@ enum AVMediaType { #define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove +#define AV_NOPTS_VALUE INT64_C(0x8000000000000000) +#define AV_TIME_BASE 1000000 +#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} + +/** + * Those FF_API_* defines are not part of public API. + * They may change, break or disappear at any time. + */ +#ifndef FF_API_OLD_IMAGE_NAMES +#define FF_API_OLD_IMAGE_NAMES (LIBAVUTIL_VERSION_MAJOR < 51) +#endif + #include "common.h" #include "error.h" #include "mathematics.h" diff --git a/mplayer/ffmpeg/libavutil/common.h b/mplayer/ffmpeg/libavutil/common.h index 6404076a..5814297c 100644 --- a/mplayer/ffmpeg/libavutil/common.h +++ b/mplayer/ffmpeg/libavutil/common.h @@ -64,7 +64,7 @@ extern const uint8_t ff_log2_tab[256]; extern const uint8_t av_reverse[256]; -static inline av_const int av_log2_c(unsigned int v) +static av_always_inline av_const int av_log2_c(unsigned int v) { int n = 0; if (v & 0xffff0000) { @@ -80,7 +80,7 @@ static inline av_const int av_log2_c(unsigned int v) return n; } -static inline av_const int av_log2_16bit_c(unsigned int v) +static av_always_inline av_const int av_log2_16bit_c(unsigned int v) { int n = 0; if (v & 0xff00) { @@ -107,7 +107,7 @@ static inline av_const int av_log2_16bit_c(unsigned int v) * @param amax maximum value of the clip range * @return clipped value */ -static inline av_const int av_clip_c(int a, int amin, int amax) +static av_always_inline av_const int av_clip_c(int a, int amin, int amax) { if (a < amin) return amin; else if (a > amax) return amax; @@ -119,7 +119,7 @@ static inline av_const int av_clip_c(int a, int amin, int amax) * @param a value to clip * @return clipped value */ -static inline av_const uint8_t av_clip_uint8_c(int a) +static av_always_inline av_const uint8_t av_clip_uint8_c(int a) { if (a&(~0xFF)) return (-a)>>31; else return a; @@ -130,7 +130,7 @@ static inline av_const uint8_t av_clip_uint8_c(int a) * @param a value to clip * @return clipped value */ -static inline av_const int8_t av_clip_int8_c(int a) +static av_always_inline av_const int8_t av_clip_int8_c(int a) { if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F; else return a; @@ -141,7 +141,7 @@ static inline av_const int8_t av_clip_int8_c(int a) * @param a value to clip * @return clipped value */ -static inline av_const uint16_t av_clip_uint16_c(int a) +static av_always_inline av_const uint16_t av_clip_uint16_c(int a) { if (a&(~0xFFFF)) return (-a)>>31; else return a; @@ -152,7 +152,7 @@ static inline av_const uint16_t av_clip_uint16_c(int a) * @param a value to clip * @return clipped value */ -static inline av_const int16_t av_clip_int16_c(int a) +static av_always_inline av_const int16_t av_clip_int16_c(int a) { if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF; else return a; @@ -163,7 +163,7 @@ static inline av_const int16_t av_clip_int16_c(int a) * @param a value to clip * @return clipped value */ -static inline av_const int32_t av_clipl_int32_c(int64_t a) +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) { if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF; else return a; @@ -176,7 +176,7 @@ static inline av_const int32_t av_clipl_int32_c(int64_t a) * @param amax maximum value of the clip range * @return clipped value */ -static inline av_const float av_clipf_c(float a, float amin, float amax) +static av_always_inline av_const float av_clipf_c(float a, float amin, float amax) { if (a < amin) return amin; else if (a > amax) return amax; @@ -187,7 +187,7 @@ static inline av_const float av_clipf_c(float a, float amin, float amax) * @param x value used to compute ceil(log2(x)) * @return computed ceiling of log2(x) */ -static inline av_const int av_ceil_log2_c(int x) +static av_always_inline av_const int av_ceil_log2_c(int x) { return av_log2((x - 1) << 1); } @@ -197,7 +197,7 @@ static inline av_const int av_ceil_log2_c(int x) * @param x value to count bits of * @return the number of bits set to one in x */ -static inline av_const int av_popcount_c(uint32_t x) +static av_always_inline av_const int av_popcount_c(uint32_t x) { x -= (x >> 1) & 0x55555555; x = (x & 0x33333333) + ((x >> 2) & 0x33333333); diff --git a/mplayer/ffmpeg/libavutil/cpu.c b/mplayer/ffmpeg/libavutil/cpu.c index 1e034914..3459ce43 100644 --- a/mplayer/ffmpeg/libavutil/cpu.c +++ b/mplayer/ffmpeg/libavutil/cpu.c @@ -44,7 +44,7 @@ int main(void) int cpu_flags = av_get_cpu_flags(); printf("cpu_flags = 0x%08X\n", cpu_flags); - printf("cpu_flags = %s%s%s%s%s%s%s%s%s%s%s%s\n", + printf("cpu_flags = %s%s%s%s%s%s%s%s%s%s%s%s%s\n", #if ARCH_ARM cpu_flags & AV_CPU_FLAG_IWMMXT ? "IWMMXT " : "", #elif ARCH_PPC @@ -60,6 +60,7 @@ int main(void) cpu_flags & AV_CPU_FLAG_SSSE3 ? "SSSE3 " : "", cpu_flags & AV_CPU_FLAG_SSE4 ? "SSE4.1 " : "", cpu_flags & AV_CPU_FLAG_SSE42 ? "SSE4.2 " : "", + cpu_flags & AV_CPU_FLAG_AVX ? "AVX " : "", cpu_flags & AV_CPU_FLAG_3DNOW ? "3DNow " : "", cpu_flags & AV_CPU_FLAG_3DNOWEXT ? "3DNowExt " : ""); #endif diff --git a/mplayer/ffmpeg/libavutil/cpu.h b/mplayer/ffmpeg/libavutil/cpu.h index 71cc2652..d60e062e 100644 --- a/mplayer/ffmpeg/libavutil/cpu.h +++ b/mplayer/ffmpeg/libavutil/cpu.h @@ -36,6 +36,7 @@ #define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions #define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions #define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions +#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used #define AV_CPU_FLAG_IWMMXT 0x0100 ///< XScale IWMMXT #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard diff --git a/mplayer/ffmpeg/libavcore/imgutils.c b/mplayer/ffmpeg/libavutil/imgutils.c similarity index 100% rename from mplayer/ffmpeg/libavcore/imgutils.c rename to mplayer/ffmpeg/libavutil/imgutils.c diff --git a/mplayer/ffmpeg/libavcore/imgutils.h b/mplayer/ffmpeg/libavutil/imgutils.h similarity index 96% rename from mplayer/ffmpeg/libavcore/imgutils.h rename to mplayer/ffmpeg/libavutil/imgutils.h index 6c39d531..c1818635 100644 --- a/mplayer/ffmpeg/libavcore/imgutils.h +++ b/mplayer/ffmpeg/libavutil/imgutils.h @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCORE_IMGUTILS_H -#define AVCORE_IMGUTILS_H +#ifndef AVUTIL_IMGUTILS_H +#define AVUTIL_IMGUTILS_H /** * @file @@ -25,7 +25,7 @@ */ #include "libavutil/pixdesc.h" -#include "avcore.h" +#include "avutil.h" /** * Compute the max pixel step for each plane of an image with a @@ -125,6 +125,8 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], */ int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); +int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt); + #if FF_API_OLD_IMAGE_NAMES attribute_deprecated void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], @@ -144,4 +146,4 @@ attribute_deprecated int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); #endif -#endif /* AVCORE_IMGUTILS_H */ +#endif /* AVUTIL_IMGUTILS_H */ diff --git a/mplayer/ffmpeg/libavutil/internal.h b/mplayer/ffmpeg/libavutil/internal.h index 748a823a..4c98a129 100644 --- a/mplayer/ffmpeg/libavutil/internal.h +++ b/mplayer/ffmpeg/libavutil/internal.h @@ -46,20 +46,6 @@ #endif #endif - -/** - * Mark a variable as used and prevent the compiler from optimizing it away. - * This is useful for asm that accesses varibles in ways that the compiler does not - * understand - */ -#ifndef attribute_used -#if AV_GCC_VERSION_AT_LEAST(3,1) -# define attribute_used __attribute__((used)) -#else -# define attribute_used -#endif -#endif - #ifndef INT16_MIN #define INT16_MIN (-0x7fff - 1) #endif @@ -224,4 +210,15 @@ type ff_##name args #endif +/** + * Returns NULL if a threading library has not been enabled. + * Used to disable threading functions in AVCodec definitions + * when not needed. + */ +#if HAVE_THREADS +# define ONLY_IF_THREADS_ENABLED(x) x +#else +# define ONLY_IF_THREADS_ENABLED(x) NULL +#endif + #endif /* AVUTIL_INTERNAL_H */ diff --git a/mplayer/ffmpeg/libavutil/mem.c b/mplayer/ffmpeg/libavutil/mem.c index 91d50066..33f0b385 100644 --- a/mplayer/ffmpeg/libavutil/mem.c +++ b/mplayer/ffmpeg/libavutil/mem.c @@ -138,12 +138,11 @@ void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) void av_free(void *ptr) { - /* XXX: this test should not be needed on most libcs */ - if (ptr) #if CONFIG_MEMALIGN_HACK + if (ptr) free((char*)ptr - ((char*)ptr)[-1]); #else - free(ptr); + free(ptr); #endif } diff --git a/mplayer/ffmpeg/libavutil/mem.h b/mplayer/ffmpeg/libavutil/mem.h index ab73a323..33ab48f8 100644 --- a/mplayer/ffmpeg/libavutil/mem.h +++ b/mplayer/ffmpeg/libavutil/mem.h @@ -41,7 +41,7 @@ static const t __attribute__((aligned(n))) v #elif defined(__GNUC__) #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v - #define DECLARE_ASM_CONST(n,t,v) static const t attribute_used __attribute__ ((aligned (n))) v + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v #elif defined(_MSC_VER) #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v diff --git a/mplayer/ffmpeg/libavcore/parseutils.c b/mplayer/ffmpeg/libavutil/parseutils.c similarity index 71% rename from mplayer/ffmpeg/libavcore/parseutils.c rename to mplayer/ffmpeg/libavutil/parseutils.c index 795aefda..61a1e225 100644 --- a/mplayer/ffmpeg/libavcore/parseutils.c +++ b/mplayer/ffmpeg/libavutil/parseutils.c @@ -18,12 +18,14 @@ /** * @file - * misc parsing utilities for libavcore + * misc parsing utilities */ #ifndef GEKKO #include #endif +#include +#include #include "parseutils.h" #include "libavutil/avutil.h" #include "libavutil/eval.h" @@ -373,6 +375,280 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, return 0; } +/* get a positive number between n_min and n_max, for a maximum length + of len_max. Return -1 if error. */ +static int date_get_num(const char **pp, + int n_min, int n_max, int len_max) +{ + int i, val, c; + const char *p; + + p = *pp; + val = 0; + for(i = 0; i < len_max; i++) { + c = *p; + if (!isdigit(c)) + break; + val = (val * 10) + c - '0'; + p++; + } + /* no number read ? */ + if (p == *pp) + return -1; + if (val < n_min || val > n_max) + return -1; + *pp = p; + return val; +} + +/* small strptime for ffmpeg */ +static +const char *small_strptime(const char *p, const char *fmt, + struct tm *dt) +{ + int c, val; + + for(;;) { + c = *fmt++; + if (c == '\0') { + return p; + } else if (c == '%') { + c = *fmt++; + switch(c) { + case 'H': + val = date_get_num(&p, 0, 23, 2); + if (val == -1) + return NULL; + dt->tm_hour = val; + break; + case 'M': + val = date_get_num(&p, 0, 59, 2); + if (val == -1) + return NULL; + dt->tm_min = val; + break; + case 'S': + val = date_get_num(&p, 0, 59, 2); + if (val == -1) + return NULL; + dt->tm_sec = val; + break; + case 'Y': + val = date_get_num(&p, 0, 9999, 4); + if (val == -1) + return NULL; + dt->tm_year = val - 1900; + break; + case 'm': + val = date_get_num(&p, 1, 12, 2); + if (val == -1) + return NULL; + dt->tm_mon = val - 1; + break; + case 'd': + val = date_get_num(&p, 1, 31, 2); + if (val == -1) + return NULL; + dt->tm_mday = val; + break; + case '%': + goto match; + default: + return NULL; + } + } else { + match: + if (c != *p) + return NULL; + p++; + } + } + return p; +} + +static time_t mktimegm(struct tm *tm) +{ + time_t t; + + int y = tm->tm_year + 1900, m = tm->tm_mon + 1, d = tm->tm_mday; + + if (m < 3) { + m += 12; + y--; + } + + t = 86400 * + (d + (153 * m - 457) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 719469); + + t += 3600 * tm->tm_hour + 60 * tm->tm_min + tm->tm_sec; + + return t; +} + +int av_parse_time(int64_t *timeval, const char *datestr, int duration) +{ + const char *p; + int64_t t; + struct tm dt; + int i; + static const char * const date_fmt[] = { + "%Y-%m-%d", + "%Y%m%d", + }; + static const char * const time_fmt[] = { + "%H:%M:%S", + "%H%M%S", + }; + const char *q; + int is_utc, len; + char lastch; + int negative = 0; + +#undef time + time_t now = time(0); + + len = strlen(datestr); + if (len > 0) + lastch = datestr[len - 1]; + else + lastch = '\0'; + is_utc = (lastch == 'z' || lastch == 'Z'); + + memset(&dt, 0, sizeof(dt)); + + p = datestr; + q = NULL; + if (!duration) { + if (!strncasecmp(datestr, "now", len)) { + *timeval = (int64_t) now * 1000000; + return 0; + } + + /* parse the year-month-day part */ + for (i = 0; i < FF_ARRAY_ELEMS(date_fmt); i++) { + q = small_strptime(p, date_fmt[i], &dt); + if (q) { + break; + } + } + + /* if the year-month-day part is missing, then take the + * current year-month-day time */ + if (!q) { + if (is_utc) { + dt = *gmtime(&now); + } else { + dt = *localtime(&now); + } + dt.tm_hour = dt.tm_min = dt.tm_sec = 0; + } else { + p = q; + } + + if (*p == 'T' || *p == 't' || *p == ' ') + p++; + + /* parse the hour-minute-second part */ + for (i = 0; i < FF_ARRAY_ELEMS(time_fmt); i++) { + q = small_strptime(p, time_fmt[i], &dt); + if (q) { + break; + } + } + } else { + /* parse datestr as a duration */ + if (p[0] == '-') { + negative = 1; + ++p; + } + /* parse datestr as HH:MM:SS */ + q = small_strptime(p, time_fmt[0], &dt); + if (!q) { + /* parse datestr as S+ */ + dt.tm_sec = strtol(p, (char **)&q, 10); + if (q == p) { + /* the parsing didn't succeed */ + *timeval = INT64_MIN; + return AVERROR(EINVAL); + } + dt.tm_min = 0; + dt.tm_hour = 0; + } + } + + /* Now we have all the fields that we can get */ + if (!q) { + *timeval = INT64_MIN; + return AVERROR(EINVAL); + } + + if (duration) { + t = dt.tm_hour * 3600 + dt.tm_min * 60 + dt.tm_sec; + } else { + dt.tm_isdst = -1; /* unknown */ + if (is_utc) { + t = mktimegm(&dt); + } else { + t = mktime(&dt); + } + } + + t *= 1000000; + + /* parse the .m... part */ + if (*q == '.') { + int val, n; + q++; + for (val = 0, n = 100000; n >= 1; n /= 10, q++) { + if (!isdigit(*q)) + break; + val += n * (*q - '0'); + } + t += val; + } + *timeval = negative ? -t : t; + return 0; +} + +int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info) +{ + const char *p; + char tag[128], *q; + + p = info; + if (*p == '?') + p++; + for(;;) { + q = tag; + while (*p != '\0' && *p != '=' && *p != '&') { + if ((q - tag) < sizeof(tag) - 1) + *q++ = *p; + p++; + } + *q = '\0'; + q = arg; + if (*p == '=') { + p++; + while (*p != '&' && *p != '\0') { + if ((q - arg) < arg_size - 1) { + if (*p == '+') + *q++ = ' '; + else + *q++ = *p; + } + p++; + } + } + *q = '\0'; + if (!strcmp(tag, tag1)) + return 1; + if (*p != '&') + break; + p++; + } + return 0; +} + #ifdef TEST #undef printf diff --git a/mplayer/ffmpeg/libavcore/parseutils.h b/mplayer/ffmpeg/libavutil/parseutils.h similarity index 63% rename from mplayer/ffmpeg/libavcore/parseutils.h rename to mplayer/ffmpeg/libavutil/parseutils.h index 052427bb..c3986af2 100644 --- a/mplayer/ffmpeg/libavcore/parseutils.h +++ b/mplayer/ffmpeg/libavutil/parseutils.h @@ -16,14 +16,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCORE_PARSEUTILS_H -#define AVCORE_PARSEUTILS_H +#ifndef AVUTIL_PARSEUTILS_H +#define AVUTIL_PARSEUTILS_H #include "libavutil/rational.h" /** * @file - * misc parsing utilities for libavcore + * misc parsing utilities */ /** @@ -72,4 +72,46 @@ int av_parse_video_rate(AVRational *rate, const char *str); int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx); -#endif /* AVCORE_PARSEUTILS_H */ +/** + * Parses timestr and returns in *time a corresponding number of + * microseconds. + * + * @param timeval puts here the number of microseconds corresponding + * to the string in timestr. If the string represents a duration, it + * is the number of microseconds contained in the time interval. If + * the string is a date, is the number of microseconds since 1st of + * January, 1970 up to the time of the parsed date. If timestr cannot + * be successfully parsed, set *time to INT64_MIN. + + * @param datestr a string representing a date or a duration. + * - If a date the syntax is: + * @code + * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z] + * now + * @endcode + * If the value is "now" it takes the current time. + * Time is local time unless Z is appended, in which case it is + * interpreted as UTC. + * If the year-month-day part is not specified it takes the current + * year-month-day. + * - If a duration the syntax is: + * @code + * [-]HH[:MM[:SS[.m...]]] + * [-]S+[.m...] + * @endcode + * @param duration flag which tells how to interpret timestr, if not + * zero timestr is interpreted as a duration, otherwise as a date + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_parse_time(int64_t *timeval, const char *timestr, int duration); + +/** + * Attempt to find a specific tag in a URL. + * + * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. + * Return 1 if found. + */ +int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); + +#endif /* AVUTIL_PARSEUTILS_H */ diff --git a/mplayer/ffmpeg/libavutil/ppc/bswap.h b/mplayer/ffmpeg/libavutil/ppc/bswap.h index 043a595b..4721e919 100644 --- a/mplayer/ffmpeg/libavutil/ppc/bswap.h +++ b/mplayer/ffmpeg/libavutil/ppc/bswap.h @@ -4,7 +4,7 @@ * MPlayer CE is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * MPlayer CE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/mplayer/ffmpeg/libavutil/ppc/intmath.h b/mplayer/ffmpeg/libavutil/ppc/intmath.h index 0596aeb5..525e37b2 100644 --- a/mplayer/ffmpeg/libavutil/ppc/intmath.h +++ b/mplayer/ffmpeg/libavutil/ppc/intmath.h @@ -4,7 +4,7 @@ * MPlayer CE is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * MPlayer CE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/mplayer/ffmpeg/libavutil/ppc/paired.h b/mplayer/ffmpeg/libavutil/ppc/paired.h index 92ad4a69..eb9fdbb7 100644 --- a/mplayer/ffmpeg/libavutil/ppc/paired.h +++ b/mplayer/ffmpeg/libavutil/ppc/paired.h @@ -4,7 +4,7 @@ * MPlayer CE is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * MPlayer CE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/mplayer/ffmpeg/libavcore/samplefmt.c b/mplayer/ffmpeg/libavutil/samplefmt.c similarity index 97% rename from mplayer/ffmpeg/libavcore/samplefmt.c rename to mplayer/ffmpeg/libavutil/samplefmt.c index 532acd95..c9ffd1ac 100644 --- a/mplayer/ffmpeg/libavcore/samplefmt.c +++ b/mplayer/ffmpeg/libavutil/samplefmt.c @@ -16,9 +16,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "avcore.h" #include "samplefmt.h" +#include +#include +#include + typedef struct SampleFmtInfo { const char *name; int bits; diff --git a/mplayer/ffmpeg/libavcore/samplefmt.h b/mplayer/ffmpeg/libavutil/samplefmt.h similarity index 93% rename from mplayer/ffmpeg/libavcore/samplefmt.h rename to mplayer/ffmpeg/libavutil/samplefmt.h index 9701efe7..0604580a 100644 --- a/mplayer/ffmpeg/libavcore/samplefmt.h +++ b/mplayer/ffmpeg/libavutil/samplefmt.h @@ -16,10 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCORE_SAMPLEFMT_H -#define AVCORE_SAMPLEFMT_H - -#include "avcore.h" +#ifndef AVUTIL_SAMPLEFMT_H +#define AVUTIL_SAMPLEFMT_H /** * all in native-endian format @@ -31,7 +29,7 @@ enum AVSampleFormat { AV_SAMPLE_FMT_S32, ///< signed 32 bits AV_SAMPLE_FMT_FLT, ///< float AV_SAMPLE_FMT_DBL, ///< double - AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcore + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically }; /** @@ -69,4 +67,4 @@ char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat samp */ int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt); -#endif /* AVCORE_SAMPLEFMT_H */ +#endif /* AVUTIL_SAMPLEFMT_H */ diff --git a/mplayer/ffmpeg/libavutil/tree.h b/mplayer/ffmpeg/libavutil/tree.h index bf09fd0b..8c7de2ff 100644 --- a/mplayer/ffmpeg/libavutil/tree.h +++ b/mplayer/ffmpeg/libavutil/tree.h @@ -67,7 +67,7 @@ void *av_tree_find(const struct AVTreeNode *root, void *key, int (*cmp)(void *ke * return av_tree_insert(rootp, key, cmp, next); * } * void *tree_remove(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b, AVTreeNode **next)){ - * if(*next) av_freep(next); + * av_freep(next); * return av_tree_insert(rootp, key, cmp, next); * } * @endcode diff --git a/mplayer/ffmpeg/libavutil/x86/cpu.c b/mplayer/ffmpeg/libavutil/x86/cpu.c index 4b6cb0df..14d0fe10 100644 --- a/mplayer/ffmpeg/libavutil/x86/cpu.c +++ b/mplayer/ffmpeg/libavutil/x86/cpu.c @@ -35,6 +35,9 @@ "=c" (ecx), "=d" (edx)\ : "0" (index)); +#define xgetbv(index,eax,edx) \ + __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c" (index)) + /* Function to test if multimedia instructions are supported... */ int ff_get_cpu_flags_x86(void) { @@ -93,6 +96,15 @@ int ff_get_cpu_flags_x86(void) rval |= AV_CPU_FLAG_SSE4; if (ecx & 0x00100000 ) rval |= AV_CPU_FLAG_SSE42; +#if HAVE_AVX + /* Check OXSAVE and AVX bits */ + if ((ecx & 0x18000000) == 0x18000000) { + /* Check for OS support */ + xgetbv(0, eax, edx); + if ((eax & 0x6) == 0x6) + rval |= AV_CPU_FLAG_AVX; + } +#endif #endif ; } @@ -109,13 +121,28 @@ int ff_get_cpu_flags_x86(void) rval |= AV_CPU_FLAG_MMX; if (ext_caps & (1<<22)) rval |= AV_CPU_FLAG_MMX2; + + /* Allow for selectively disabling SSE2 functions on AMD processors + with SSE2 support but not SSE4a. This includes Athlon64, some + Opteron, and some Sempron processors. MMX, SSE, or 3DNow! are faster + than SSE2 often enough to utilize this special-case flag. + AV_CPU_FLAG_SSE2 and AV_CPU_FLAG_SSE2SLOW are both set in this case + so that SSE2 is used unless explicitly disabled by checking + AV_CPU_FLAG_SSE2SLOW. */ + if (!strncmp(vendor.c, "AuthenticAMD", 12) && + rval & AV_CPU_FLAG_SSE2 && !(ecx & 0x00000040)) { + rval |= AV_CPU_FLAG_SSE2SLOW; + } } if (!strncmp(vendor.c, "GenuineIntel", 12) && family == 6 && (model == 9 || model == 13 || model == 14)) { /* 6/9 (pentium-m "banias"), 6/13 (pentium-m "dothan"), and 6/14 (core1 "yonah") * theoretically support sse2, but it's usually slower than mmx, - * so let's just pretend they don't. */ + * so let's just pretend they don't. AV_CPU_FLAG_SSE2 is disabled and + * AV_CPU_FLAG_SSE2SLOW is enabled so that SSE2 is not used unless + * explicitly enabled by checking AV_CPU_FLAG_SSE2SLOW. The same + * situation applies for AV_CPU_FLAG_SSE3 and AV_CPU_FLAG_SSE3SLOW. */ if (rval & AV_CPU_FLAG_SSE2) rval ^= AV_CPU_FLAG_SSE2SLOW|AV_CPU_FLAG_SSE2; if (rval & AV_CPU_FLAG_SSE3) rval ^= AV_CPU_FLAG_SSE3SLOW|AV_CPU_FLAG_SSE3; } diff --git a/mplayer/ffmpeg/libswscale/Makefile b/mplayer/ffmpeg/libswscale/Makefile index 8c5c4b9d..69760796 100644 --- a/mplayer/ffmpeg/libswscale/Makefile +++ b/mplayer/ffmpeg/libswscale/Makefile @@ -20,4 +20,3 @@ TESTPROGS = colorspace swscale DIRS = bfin mlib ppc sparc x86 include $(SUBDIR)../subdir.mak -$(SUBDIR)swscale-test$(EXESUF): ELIBS = -lavcore diff --git a/mplayer/ffmpeg/libswscale/swscale-test.c b/mplayer/ffmpeg/libswscale/swscale-test.c index ae5f8b70..7f171ea7 100644 --- a/mplayer/ffmpeg/libswscale/swscale-test.c +++ b/mplayer/ffmpeg/libswscale/swscale-test.c @@ -25,7 +25,7 @@ #include #undef HAVE_AV_CONFIG_H -#include "libavcore/imgutils.h" +#include "libavutil/imgutils.h" #include "libavutil/mem.h" #include "libavutil/avutil.h" #include "libavutil/crc.h" @@ -104,8 +104,7 @@ static int doTest(uint8_t *ref[4], int refStride[4], int w, int h, int p; for (p = 0; p < 4; p++) - if (src[p]) - av_freep(&src[p]); + av_freep(&src[p]); av_image_fill_linesizes(srcStride, srcFormat, srcW); for (p = 0; p < 4; p++) { diff --git a/mplayer/ffmpeg/libswscale/swscale_template.c b/mplayer/ffmpeg/libswscale/swscale_template.c index 9da6b41f..9863a7c9 100644 --- a/mplayer/ffmpeg/libswscale/swscale_template.c +++ b/mplayer/ffmpeg/libswscale/swscale_template.c @@ -1883,7 +1883,7 @@ static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, const uint8_t *src, long w static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, long width, enum PixelFormat srcFormat) { __asm__ volatile( - "movq 24+%4, %%mm6 \n\t" + "movq 24(%4), %%mm6 \n\t" "mov %3, %%"REG_a" \n\t" "pxor %%mm7, %%mm7 \n\t" "1: \n\t" @@ -1894,9 +1894,9 @@ static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uin "punpcklbw %%mm7, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm1, %%mm3 \n\t" - "pmaddwd %4, %%mm0 \n\t" - "pmaddwd 8+%4, %%mm1 \n\t" - "pmaddwd 16+%4, %%mm2 \n\t" + "pmaddwd (%4), %%mm0 \n\t" + "pmaddwd 8(%4), %%mm1 \n\t" + "pmaddwd 16(%4), %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" "paddd %%mm1, %%mm0 \n\t" "paddd %%mm3, %%mm2 \n\t" @@ -1908,9 +1908,9 @@ static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uin "punpcklbw %%mm7, %%mm3 \n\t" "movq %%mm1, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" - "pmaddwd %4, %%mm1 \n\t" - "pmaddwd 8+%4, %%mm3 \n\t" - "pmaddwd 16+%4, %%mm4 \n\t" + "pmaddwd (%4), %%mm1 \n\t" + "pmaddwd 8(%4), %%mm3 \n\t" + "pmaddwd 16(%4), %%mm4 \n\t" "pmaddwd %%mm6, %%mm5 \n\t" "paddd %%mm3, %%mm1 \n\t" "paddd %%mm5, %%mm4 \n\t" @@ -1933,7 +1933,7 @@ static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uin "add $4, %%"REG_a" \n\t" " js 1b \n\t" : "+r" (src) - : "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "m"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24][0]) + : "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "r"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24]) : "%"REG_a ); } diff --git a/mplayer/ffmpeg/tests/codec-regression.sh b/mplayer/ffmpeg/tests/codec-regression.sh index 71d50a12..b705bc18 100644 --- a/mplayer/ffmpeg/tests/codec-regression.sh +++ b/mplayer/ffmpeg/tests/codec-regression.sh @@ -249,8 +249,8 @@ do_video_decoding "" "-pix_fmt yuv420p" fi if [ -n "$do_qtrle" ] ; then -do_video_encoding qtrle.mov "" "" -do_video_decoding "" "" +do_video_encoding qtrle.mov "" "-an -vcodec qtrle" +do_video_decoding "" "-pix_fmt yuv420p" fi if [ -n "$do_rgb" ] ; then diff --git a/mplayer/ffmpeg/tests/ref/acodec/ac3_fixed b/mplayer/ffmpeg/tests/ref/acodec/ac3_fixed index 17159e18..f32443d3 100644 --- a/mplayer/ffmpeg/tests/ref/acodec/ac3_fixed +++ b/mplayer/ffmpeg/tests/ref/acodec/ac3_fixed @@ -1,2 +1,2 @@ -9823c8f74097eab5d148cf0536ae932e *./tests/data/acodec/ac3.rm +07bd593823ebd721b3a32ef298bdfc20 *./tests/data/acodec/ac3.rm 98751 ./tests/data/acodec/ac3.rm diff --git a/mplayer/ffmpeg/tests/ref/fate/bink-demux-video b/mplayer/ffmpeg/tests/ref/fate/bink-demux-video index 22fb3c5a..f3adf76b 100644 --- a/mplayer/ffmpeg/tests/ref/fate/bink-demux-video +++ b/mplayer/ffmpeg/tests/ref/fate/bink-demux-video @@ -13,8 +13,8 @@ 0, 72000, 460800, 0x71c0f48e 0, 78000, 460800, 0x5fc8f783 0, 84000, 460800, 0xd23d336a -0, 90000, 460800, 0xa7aca9e0 -0, 96000, 460800, 0x1dff2144 -0, 102000, 460800, 0x82cf8b2b -0, 108000, 460800, 0x4cbe3544 +0, 90000, 460800, 0xadcfa9e0 +0, 96000, 460800, 0x24222144 +0, 102000, 460800, 0x88f28b2b +0, 108000, 460800, 0x52e13544 0, 114000, 460800, 0x7e724731 diff --git a/mplayer/ffmpeg/tests/ref/fate/sierra-vmd b/mplayer/ffmpeg/tests/ref/fate/sierra-vmd index 4d9e4cdd..91a8e465 100644 --- a/mplayer/ffmpeg/tests/ref/fate/sierra-vmd +++ b/mplayer/ffmpeg/tests/ref/fate/sierra-vmd @@ -1,5 +1,5 @@ 0, 0, 230400, 0x0224ab01 -1, 0, 123480, 0xc1059826 +1, 0, 123480, 0x3a794c13 0, 9000, 230400, 0x449e4d81 0, 18000, 230400, 0x3e15e07a 0, 27000, 230400, 0xdabe4172 @@ -27,277 +27,306 @@ 0, 225000, 230400, 0x76aebdae 0, 234000, 230400, 0x81357545 0, 243000, 230400, 0x38baeebd -1, 252000, 4410, 0x261a09c0 +1, 252000, 4410, 0x109d04e0 0, 252000, 230400, 0x1c5c44d4 -1, 261000, 4410, 0x68e9489e +1, 261000, 4410, 0x224d244f 0, 261000, 230400, 0x60e189cc -1, 270000, 4410, 0xb830827a +1, 270000, 4410, 0xbb72413d 0, 270000, 230400, 0xb1f4381c -1, 279000, 4410, 0xb053b70c +1, 279000, 4410, 0xaa5f5b86 0, 279000, 230400, 0xb5048fed -1, 288000, 4410, 0xd8845d5d +1, 288000, 4410, 0x94e7aea7 0, 288000, 230400, 0xc947c30e -1, 297000, 4410, 0xd741f940 +1, 297000, 4410, 0xad497ca0 0, 297000, 230400, 0xe8e31c07 -1, 306000, 4410, 0x4860193c +1, 306000, 4410, 0x1de10c9e 0, 306000, 230400, 0x6d49dd02 -1, 315000, 4410, 0x2e70df5f +1, 315000, 4410, 0x9f55efa8 0, 315000, 230400, 0x293e15d3 -1, 324000, 4410, 0x4b3e0e54 +1, 324000, 4410, 0x220a072a 0, 324000, 230400, 0x354d792e -1, 333000, 4410, 0x4afbf661 +1, 333000, 4410, 0xa7dafb29 0, 333000, 230400, 0x35468780 -1, 342000, 4410, 0x485c3903 +1, 342000, 4410, 0xd5e29c7a 0, 342000, 230400, 0x365d3991 -1, 351000, 4410, 0xc0a1a00c +1, 351000, 4410, 0xb8465006 0, 351000, 230400, 0xc9debef2 -1, 360000, 4410, 0x0ce2d38e +1, 360000, 4410, 0x518669c7 0, 360000, 230400, 0x4c4634c2 -1, 369000, 4410, 0x5b52dfa3 +1, 369000, 4410, 0xb5b5efca 0, 369000, 230400, 0x347c2dca -1, 378000, 4410, 0x0d6c02ba +1, 378000, 4410, 0x8600015d 0, 378000, 230400, 0x1efa0aaa -1, 387000, 4410, 0x55f31fe1 +1, 387000, 4410, 0xe2f68fe9 0, 387000, 230400, 0xa79a0b5a -1, 396000, 4410, 0x7350b1b2 +1, 396000, 4410, 0x8d3458d9 0, 396000, 230400, 0xfdb2dcdb -1, 405000, 4410, 0x2b918eea +1, 405000, 4410, 0xf1ff4775 0, 405000, 230400, 0x42dbea33 -1, 414000, 4410, 0x6df6cf92 +1, 414000, 4410, 0x830f67c9 0, 414000, 230400, 0x2a207e43 -1, 423000, 4410, 0x2ddd1782 +1, 423000, 4410, 0x110e0bc1 0, 423000, 230400, 0x86573783 -1, 432000, 4410, 0x12265e8e +1, 432000, 4410, 0x71682f47 0, 432000, 230400, 0xc3968473 -1, 441000, 4410, 0x00c62139 +1, 441000, 4410, 0x38119095 0, 441000, 230400, 0x8f62a7b4 -1, 450000, 4410, 0xf2579b6c +1, 450000, 4410, 0xd2494db6 0, 450000, 230400, 0x5a2e3073 -1, 459000, 4410, 0x3bc24a12 +1, 459000, 4410, 0x8b552509 0, 459000, 230400, 0xd24f5e2c -1, 468000, 4410, 0x0ce25212 +1, 468000, 4410, 0x71e52909 0, 468000, 230400, 0x1df3c67d -1, 477000, 4410, 0xad70de9a +1, 477000, 4410, 0x9f0a6f4d 0, 477000, 230400, 0xe4fd884d -1, 486000, 4410, 0x232705e4 +1, 486000, 4410, 0x901302f2 0, 486000, 230400, 0x9a228555 -1, 495000, 4410, 0x5ceba444 +1, 495000, 4410, 0x855d5222 0, 495000, 230400, 0x9eba8ed5 -1, 504000, 4410, 0x17a3660b +1, 504000, 4410, 0x324bb2fe 0, 504000, 230400, 0x3d808a3d -1, 513000, 4410, 0x291bb07e +1, 513000, 4410, 0xe85f583f 0, 513000, 230400, 0xf57e866d -1, 522000, 4410, 0xc13ccf88 +1, 522000, 4410, 0x2cbc67c4 0, 522000, 230400, 0x85f594f5 -1, 531000, 4410, 0xfb0cd542 +1, 531000, 4410, 0xc82e6aa1 0, 531000, 230400, 0xb09f99dd -1, 540000, 4410, 0xb6438478 +1, 540000, 4410, 0xb9fc423c 0, 540000, 230400, 0x2b368475 -1, 549000, 4410, 0x263e9df2 +1, 549000, 4410, 0x6b9b4ef9 0, 549000, 230400, 0xa2417afd -1, 558000, 4410, 0x81621e20 +1, 558000, 4410, 0x39290f10 0, 558000, 230400, 0x590b709d -1, 567000, 4410, 0xe9a51d77 +1, 567000, 4410, 0xad718eb4 0, 567000, 230400, 0x5d617705 -1, 576000, 4410, 0x69a3c758 +1, 576000, 4410, 0x82f463ac 0, 576000, 230400, 0xabf981ad -1, 585000, 4410, 0x725af958 +1, 585000, 4410, 0xfac87cac 0, 585000, 230400, 0x5a8590cd -1, 594000, 4410, 0x09db995d +1, 594000, 4410, 0x9e8bcca7 0, 594000, 230400, 0x1bff853d -1, 603000, 4410, 0x42963941 +1, 603000, 4410, 0x52f79c99 0, 603000, 230400, 0x71d08055 -1, 612000, 4410, 0x33a29bc4 +1, 612000, 4410, 0xf2d14de2 0, 612000, 230400, 0x2ebd817d -1, 621000, 4410, 0x02ee2bd1 +1, 621000, 4410, 0x367f95e1 0, 621000, 230400, 0x6e838255 -1, 630000, 4410, 0xda968535 +1, 630000, 4410, 0x8bfac293 0, 630000, 230400, 0x043984cd -1, 639000, 4410, 0x5414a080 +1, 639000, 4410, 0x01ea5040 0, 639000, 230400, 0x7ff18495 -1, 648000, 4410, 0x021ac433 +1, 648000, 4410, 0x8ff5e212 0, 648000, 230400, 0xa43b8385 -1, 657000, 4410, 0x50195048 +1, 657000, 4410, 0x93f32824 0, 657000, 230400, 0x72b5825d -1, 666000, 4410, 0xc40921c7 +1, 666000, 4410, 0x998f90dc 0, 666000, 230400, 0x3a178085 -1, 675000, 4410, 0xdbb622e0 +1, 675000, 4410, 0x65231170 0, 675000, 230400, 0x67748245 -1, 684000, 4410, 0xc8d07342 +1, 684000, 4410, 0xc79039a1 0, 684000, 230400, 0xeddf81d5 -1, 693000, 4410, 0x6ed9b17a +1, 693000, 4410, 0x0b0e58bd 0, 693000, 230400, 0x8b088665 -1, 702000, 4410, 0x39ac6a03 +1, 702000, 4410, 0xc24ab4fa 0, 702000, 230400, 0x6c408e15 -1, 711000, 4410, 0x119ed51c +1, 711000, 4410, 0xd3796a8e 0, 711000, 230400, 0x81f196dd -1, 720000, 4410, 0xc9a20539 +1, 720000, 4410, 0xa37f8295 0, 720000, 230400, 0xab9f953d -1, 729000, 4410, 0x6db5fdbd +1, 729000, 4410, 0xb760fed7 0, 729000, 230400, 0xa5f69795 -1, 738000, 4410, 0x64c6b468 +1, 738000, 4410, 0x05495a34 0, 738000, 230400, 0xa772950d -1, 747000, 4410, 0x1286686e +1, 747000, 4410, 0x6f203437 0, 747000, 230400, 0x6a5596d5 -1, 756000, 4410, 0x76632813 +1, 756000, 4410, 0x71299402 0, 756000, 230400, 0x1355958d -1, 765000, 4410, 0x9923669b +1, 765000, 4410, 0x72e7b346 0, 765000, 230400, 0x4134981d -1, 774000, 4410, 0x1cf31b5c +1, 774000, 4410, 0x879b0dae 0, 774000, 230400, 0x8b929515 -1, 783000, 4410, 0xa9f14389 +1, 783000, 4410, 0x041aa1bd 0, 783000, 230400, 0x482f95c5 -1, 792000, 4410, 0x9438c5cc +1, 792000, 4410, 0x18a962e6 0, 792000, 230400, 0x7a9795d5 -1, 801000, 4410, 0x48dd0a72 +1, 801000, 4410, 0x21d20539 0, 801000, 230400, 0x21c29abd -1, 810000, 4410, 0xb0fe24dd +1, 810000, 4410, 0x8f449267 0, 810000, 230400, 0x9ae6a475 -1, 819000, 4410, 0xdb9d03ac +1, 819000, 4410, 0xecdc01d6 0, 819000, 230400, 0x3734aee5 -1, 828000, 4410, 0x487d7ac3 +1, 828000, 4410, 0x458abd5a 0, 828000, 230400, 0xa0a1b365 -1, 837000, 4410, 0x2b61d4d5 +1, 837000, 4410, 0xa070ea63 0, 837000, 230400, 0x2dcab1c5 -1, 846000, 4410, 0xab934d9c +1, 846000, 4410, 0xc25b26ce 0, 846000, 230400, 0x9c8b6c44 -1, 855000, 4410, 0xd2ee6f94 +1, 855000, 4410, 0x4d9237ca 0, 855000, 230400, 0x5da75feb -1, 864000, 4410, 0x012c3002 +1, 864000, 4410, 0x748e1801 0, 864000, 230400, 0x4d02f8e3 -1, 873000, 4410, 0xfccbd3cc +1, 873000, 4410, 0xc96b69e6 0, 873000, 230400, 0x66824f3a -1, 882000, 4410, 0xe53230d8 +1, 882000, 4410, 0x6663186c 0, 882000, 230400, 0x0c9257e2 -1, 891000, 4410, 0x2f6a6102 +1, 891000, 4410, 0x7f6d3081 0, 891000, 230400, 0xb2927092 -1, 900000, 4410, 0x77bb876a +1, 900000, 4410, 0x1a0343b5 0, 900000, 230400, 0xb5dc6e9a -1, 909000, 4410, 0xbcb76718 +1, 909000, 4410, 0xc48e338c 0, 909000, 230400, 0x6e567bc6 -1, 918000, 4410, 0x51c00790 +1, 918000, 4410, 0x26fc03c8 0, 918000, 230400, 0xbf9e0f7a -1, 927000, 4410, 0x51b8fc5a +1, 927000, 4410, 0x69be7e2d 0, 927000, 230400, 0xb16f684a -1, 936000, 4410, 0x20fe9b42 +1, 936000, 4410, 0x69a74da1 0, 936000, 230400, 0xf9e55e81 -1, 945000, 4410, 0x363c5566 +1, 945000, 4410, 0x85bd2ab3 0, 945000, 230400, 0xd8d0bcba -1, 954000, 4410, 0x3424a84c +1, 954000, 4410, 0xeff05426 0, 954000, 230400, 0x44720ac0 -1, 963000, 4410, 0x7c3053c0 +1, 963000, 4410, 0x292829e0 0, 963000, 230400, 0x7d4c2058 -1, 972000, 4410, 0x368f2f30 +1, 972000, 4410, 0x8f741798 0, 972000, 230400, 0xb0973eb9 -1, 981000, 4410, 0x0f1e6fd2 +1, 981000, 4410, 0x6b9337e9 0, 981000, 230400, 0x405a13ce -1, 990000, 4410, 0x3a1fe07e +1, 990000, 4410, 0xe4e1703f 0, 990000, 230400, 0x6422f00a -1, 999000, 4410, 0x74afd86a +1, 999000, 4410, 0x043d6c35 0, 999000, 230400, 0x924b6c1e -1, 1008000, 4410, 0xfdf911dd +1, 1008000, 4410, 0x3a8988e7 0, 1008000, 230400, 0xcf7809c0 -1, 1017000, 4410, 0x1206a561 +1, 1017000, 4410, 0x1fa7d2a9 0, 1017000, 230400, 0x883a3863 -1, 1026000, 4410, 0x5f0f33d5 +1, 1026000, 4410, 0xe28799e3 0, 1026000, 230400, 0x6adc9e03 -1, 1035000, 4410, 0xca3d88e0 +1, 1035000, 4410, 0xc2df4470 0, 1035000, 230400, 0x4f5ab7a8 -1, 1044000, 4410, 0xdf8f19ea +1, 1044000, 4410, 0x694d0cf5 0, 1044000, 230400, 0xdc0aab94 -1, 1053000, 4410, 0xe3275b9e -1, 1062000, 4410, 0xee1945c5 -1, 1071000, 4410, 0x0afbd006 -1, 1080000, 4410, 0x90ff8f14 -1, 1089000, 4410, 0xfc0c887a -1, 1098000, 4410, 0xae9bc232 -1, 1107000, 4410, 0x5f688eb8 -1, 1116000, 4410, 0x9a307469 -1, 1125000, 4410, 0x27f1e324 -1, 1134000, 4410, 0x0c0d4ca2 -1, 1143000, 4410, 0xd7e8ce74 -1, 1152000, 4410, 0x16a4bfd6 -1, 1161000, 4410, 0xbfb02f6d -1, 1170000, 4410, 0xf4b81a79 -1, 1179000, 4410, 0x05d97288 -1, 1188000, 4410, 0x3a7db4be -1, 1197000, 4410, 0xc6bea83e -1, 1206000, 4410, 0x436f62ed -1, 1215000, 4410, 0x6fabea0c -1, 1224000, 4410, 0x954878aa -1, 1233000, 4410, 0x4d10f579 -1, 1242000, 4410, 0xac65932a -1, 1251000, 4410, 0x6889f957 -1, 1260000, 4410, 0x65cf5830 -1, 1269000, 4410, 0x87a7af71 -1, 1278000, 4410, 0x82378c13 -1, 1287000, 4410, 0x88ab6bd5 -1, 1296000, 4410, 0xf90a3342 -1, 1305000, 4410, 0xd790a1bc -1, 1314000, 4410, 0x89919d7c -1, 1323000, 4410, 0x7ffb22bf -1, 1332000, 4410, 0xfefbcce3 -1, 1341000, 4410, 0x07714e80 -1, 1350000, 4410, 0x73078f53 -1, 1359000, 4410, 0x35c23078 -1, 1368000, 4410, 0x452538bb -1, 1377000, 4410, 0x61493f33 -1, 1386000, 4410, 0x2137c390 -1, 1395000, 4410, 0x78c9393f -1, 1404000, 4410, 0x7aeaf8e1 -1, 1413000, 4410, 0x4bb8da1c -1, 1422000, 4410, 0x5995dfc2 -1, 1431000, 4410, 0xccce8872 -1, 1440000, 4410, 0xca2753a4 -1, 1449000, 4410, 0x4296ff6d -1, 1458000, 4410, 0xe582d191 -1, 1467000, 4410, 0xc40268da -1, 1476000, 4410, 0xda1d475e -1, 1485000, 4410, 0x5e91e4e0 -1, 1494000, 4410, 0xfeb44475 -1, 1503000, 4410, 0x17ff8e38 -1, 1512000, 4410, 0x3bd58bcf -1, 1521000, 4410, 0x9476e23c -1, 1530000, 4410, 0x440651ab -1, 1539000, 4410, 0xb08cdc74 -1, 1548000, 4410, 0x6fc3031f -1, 1557000, 4410, 0x197ab39a -1, 1566000, 4410, 0xf92f0e3d -1, 1575000, 4410, 0xd5f6b678 -1, 1584000, 4410, 0x8af127a6 -1, 1593000, 4410, 0xe22f585e -1, 1602000, 4410, 0x67515610 -1, 1611000, 4410, 0x21569d7a -1, 1620000, 4410, 0x114597d8 -1, 1629000, 4410, 0xba213fb6 -1, 1638000, 4410, 0x1aca9fee -1, 1647000, 4410, 0x48cdd264 -1, 1656000, 4410, 0x533619ec -1, 1665000, 4410, 0x21466244 -1, 1674000, 4410, 0x26e00e88 -1, 1683000, 4410, 0x8e51d07c -1, 1692000, 4410, 0xa6c4048a -1, 1701000, 4410, 0x98ce10e4 -1, 1710000, 4410, 0x379bc8c2 -1, 1719000, 4410, 0x404b09c6 -1, 1728000, 4410, 0xfc89da8a -1, 1737000, 4410, 0xbdbe6914 -1, 1746000, 4410, 0x2cb09f08 -1, 1755000, 4410, 0x835bf2d9 -1, 1764000, 4410, 0xa4611790 -1, 1773000, 4410, 0x67740896 -1, 1782000, 4410, 0x489f6bd0 -1, 1791000, 4410, 0x072bae9c -1, 1800000, 4410, 0xadce5a89 -1, 1809000, 4410, 0x209f2c2c -1, 1818000, 4410, 0xf5706665 -1, 1827000, 4410, 0x631841cb -1, 1836000, 4410, 0xa1a2c65f -1, 1845000, 4410, 0x8818b96b -1, 1854000, 4410, 0x63158025 -1, 1863000, 4410, 0xf6ae79f5 -1, 1872000, 4410, 0xb3dcd214 -1, 1881000, 4410, 0x7a745449 -1, 1890000, 4410, 0x5d2b15f4 -1, 1899000, 4410, 0x48764b7c -1, 1908000, 4410, 0x1294e119 +1, 1053000, 4410, 0x5aac2dcf +1, 1062000, 4410, 0x259fa2db +1, 1071000, 4410, 0xd16d6803 +1, 1080000, 4410, 0xa4b3478a +1, 1089000, 4410, 0xdbe0443d +1, 1098000, 4410, 0x26c16119 +1, 1107000, 4410, 0x0c06475c +1, 1116000, 4410, 0x6ffaba2d +1, 1125000, 4410, 0x5b287192 +1, 1134000, 4410, 0xf2cf2651 +1, 1143000, 4410, 0x3857673a +1, 1152000, 4410, 0x5b555feb +1, 1161000, 4410, 0x93f997af +1, 1170000, 4410, 0xb3ba8d35 +1, 1179000, 4410, 0x66433944 +1, 1188000, 4410, 0xf0005a5f +1, 1197000, 4410, 0xb948541f +1, 1206000, 4410, 0xc8f1b16f +1, 1215000, 4410, 0x7d4b7506 +1, 1224000, 4410, 0xac723c55 +1, 1233000, 4410, 0x2926fab5 +1, 1242000, 4410, 0x31684995 +1, 1251000, 4410, 0x35ebfca4 +1, 1260000, 4410, 0x9cd42c18 +1, 1269000, 4410, 0xd7ecd7b1 +1, 1278000, 4410, 0x5e13c602 +1, 1287000, 4410, 0xe955b5e3 +1, 1296000, 4410, 0xefad19a1 +1, 1305000, 4410, 0x435950de +1, 1314000, 4410, 0x9d624ebe +1, 1323000, 4410, 0x774a9158 +1, 1332000, 4410, 0x8c41e66a +1, 1341000, 4410, 0x70112740 +1, 1350000, 4410, 0x55abc7a2 +1, 1359000, 4410, 0x0ec3183c +1, 1368000, 4410, 0x54609c56 +1, 1377000, 4410, 0x60d49f92 +1, 1386000, 4410, 0x5fb061c8 +1, 1395000, 4410, 0x6e119c98 +1, 1404000, 4410, 0x3f39fc69 +1, 1413000, 4410, 0xef466d0e +1, 1422000, 4410, 0xf4cb6fe1 +1, 1431000, 4410, 0xc4434439 +1, 1440000, 4410, 0xd02329d2 +1, 1449000, 4410, 0x216cffaf +1, 1458000, 4410, 0x7e59e8c1 +1, 1467000, 4410, 0xc7c3346d +1, 1476000, 4410, 0x5b3723af +1, 1485000, 4410, 0x76097270 +1, 1494000, 4410, 0xae39a233 +1, 1503000, 4410, 0x686a471c +1, 1512000, 4410, 0x3af3c5e0 +1, 1521000, 4410, 0x11ac711e +1, 1530000, 4410, 0xcd8da8ce +1, 1539000, 4410, 0x21296e3a +1, 1548000, 4410, 0x77168188 +1, 1557000, 4410, 0x5fcf59cd +1, 1566000, 4410, 0x390c8717 +1, 1575000, 4410, 0x3d5d5b3c +1, 1584000, 4410, 0x3b8f13d3 +1, 1593000, 4410, 0x5b002c2f +1, 1602000, 4410, 0x9e1d2b08 +1, 1611000, 4410, 0x69454ebd +1, 1620000, 4410, 0x62a54bec +1, 1629000, 4410, 0x4d231fdb +1, 1638000, 4410, 0x65624ff7 +1, 1647000, 4410, 0x6fc66932 +1, 1656000, 4410, 0x23200cf6 +1, 1665000, 4410, 0xf8033122 +1, 1674000, 4410, 0x0fce0744 +1, 1683000, 4410, 0x9302683e +1, 1692000, 4410, 0xd2380245 +1, 1701000, 4410, 0x482e0872 +1, 1710000, 4410, 0xe98e6461 +1, 1719000, 4410, 0x1db404e3 +1, 1728000, 4410, 0x47a26d45 +1, 1737000, 4410, 0x449a348a +1, 1746000, 4410, 0xee874f84 +1, 1755000, 4410, 0xc4ecf965 +1, 1764000, 4410, 0xcc450bc8 +1, 1773000, 4410, 0xb18d044b +1, 1782000, 4410, 0x895435e8 +1, 1791000, 4410, 0x57e7574e +1, 1800000, 4410, 0x8041ad3d +1, 1809000, 4410, 0x853d1616 +1, 1818000, 4410, 0xa11bb32b +1, 1827000, 4410, 0xe10ea0de +1, 1836000, 4410, 0xdf2ee328 +1, 1845000, 4410, 0xd5a6dcae +1, 1854000, 4410, 0xd176c00b +1, 1863000, 4410, 0x9cd6bcf3 +1, 1872000, 4410, 0x2569690a +1, 1881000, 4410, 0x6824aa1d +1, 1890000, 4410, 0xa9110afa +1, 1899000, 4410, 0x115c25be +1, 1908000, 4410, 0x1100f085 +1, 1917000, 4410, 0x00000000 +1, 1926000, 4410, 0x00000000 +1, 1935000, 4410, 0x00000000 +1, 1944000, 4410, 0x00000000 +1, 1953000, 4410, 0x00000000 +1, 1962000, 4410, 0x00000000 +1, 1971000, 4410, 0x00000000 +1, 1980000, 4410, 0x00000000 +1, 1989000, 4410, 0x00000000 +1, 1998000, 4410, 0x00000000 +1, 2007000, 4410, 0x00000000 +1, 2016000, 4410, 0x00000000 +1, 2025000, 4410, 0x00000000 +1, 2034000, 4410, 0x00000000 +1, 2043000, 4410, 0x00000000 +1, 2052000, 4410, 0x00000000 +1, 2061000, 4410, 0x00000000 +1, 2070000, 4410, 0x00000000 +1, 2079000, 4410, 0x00000000 +1, 2088000, 4410, 0x00000000 +1, 2097000, 4410, 0x00000000 +1, 2106000, 4410, 0x00000000 +1, 2115000, 4410, 0x00000000 +1, 2124000, 4410, 0x00000000 +1, 2133000, 4410, 0x00000000 +1, 2142000, 4410, 0x00000000 +1, 2151000, 4410, 0x00000000 +1, 2160000, 4410, 0x00000000 +1, 2169000, 4410, 0x00000000 diff --git a/mplayer/ffmpeg/tests/ref/lavf/rm b/mplayer/ffmpeg/tests/ref/lavf/rm index d9ec51e5..b8bf2207 100644 --- a/mplayer/ffmpeg/tests/ref/lavf/rm +++ b/mplayer/ffmpeg/tests/ref/lavf/rm @@ -1,2 +1,2 @@ -e1990def7b195a568340f2c1a89d6587 *./tests/data/lavf/lavf.rm +d149fc272dfd21fb8908ee21d7b1651b *./tests/data/lavf/lavf.rm 346706 ./tests/data/lavf/lavf.rm diff --git a/mplayer/ffmpeg/tests/ref/seek/ac3_rm b/mplayer/ffmpeg/tests/ref/seek/ac3_rm index 7b7d5b0b..07fcfa1e 100644 --- a/mplayer/ffmpeg/tests/ref/seek/ac3_rm +++ b/mplayer/ffmpeg/tests/ref/seek/ac3_rm @@ -1,13 +1,17 @@ ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st:-1 flags:0 ts:-1.000000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret:-1 st:-1 flags:1 ts: 1.894167 -ret:-1 st: 0 flags:0 ts: 0.788000 +ret: 0 st:-1 flags:1 ts: 1.894167 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 +ret: 0 st: 0 flags:0 ts: 0.788000 +ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 ret: 0 st: 0 flags:1 ts:-0.317000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret:-1 st:-1 flags:0 ts: 2.576668 +ret: 0 st:-1 flags:0 ts: 2.576668 +ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 ret:-1 st:-1 flags:1 ts: 1.470835 -ret:-1 st: 0 flags:0 ts: 0.365000 +ret: 0 st: 0 flags:0 ts: 0.365000 +ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 ret: 0 st: 0 flags:1 ts:-0.741000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret:-1 st:-1 flags:0 ts: 2.153336 @@ -16,20 +20,26 @@ ret: 0 st: 0 flags:0 ts:-0.058000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret:-1 st: 0 flags:1 ts: 2.836000 ret:-1 st:-1 flags:0 ts: 1.730004 -ret:-1 st:-1 flags:1 ts: 0.624171 +ret: 0 st:-1 flags:1 ts: 0.624171 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:0 ts:-0.482000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret:-1 st: 0 flags:1 ts: 2.413000 +ret: 0 st: 0 flags:1 ts: 2.413000 +ret: 0 st: 0 flags:1 dts: 2.229000 pts: 2.229000 pos: 36705 size: 556 ret:-1 st:-1 flags:0 ts: 1.306672 -ret:-1 st:-1 flags:1 ts: 0.200839 +ret: 0 st:-1 flags:1 ts: 0.200839 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:0 ts:-0.905000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret:-1 st: 0 flags:1 ts: 1.989000 -ret:-1 st:-1 flags:0 ts: 0.883340 +ret: 0 st:-1 flags:0 ts: 0.883340 +ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 ret: 0 st:-1 flags:1 ts:-0.222493 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 -ret:-1 st: 0 flags:0 ts: 2.672000 +ret: 0 st: 0 flags:0 ts: 2.672000 +ret: 0 st: 0 flags:1 dts:6354.691000 pts:6354.691000 pos: 10783 size: 304 ret:-1 st: 0 flags:1 ts: 1.566000 -ret:-1 st:-1 flags:0 ts: 0.460008 +ret: 0 st:-1 flags:0 ts: 0.460008 +ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116 ret: 0 st:-1 flags:1 ts:-0.645825 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 diff --git a/mplayer/ffmpeg/tests/ref/vsynth1/qtrle b/mplayer/ffmpeg/tests/ref/vsynth1/qtrle index 8aa578fc..9988897b 100644 --- a/mplayer/ffmpeg/tests/ref/vsynth1/qtrle +++ b/mplayer/ffmpeg/tests/ref/vsynth1/qtrle @@ -1,4 +1,4 @@ -3f070779d7deb54626515ac7f7002e63 *./tests/data/vsynth1/qtrle.mov -387772 ./tests/data/vsynth1/qtrle.mov -a3c2610e2c069c3ad22ec03da83f774f *./tests/data/qtrle.vsynth1.out.yuv -stddev: 15.14 PSNR: 24.53 MAXDIFF: 174 bytes: 7603200/ 7603200 +d14041925ce5ec5001dc519276b1a1ab *./tests/data/vsynth1/qtrle.mov +15263232 ./tests/data/vsynth1/qtrle.mov +243325fb2cae1a9245efd49aff936327 *./tests/data/qtrle.vsynth1.out.yuv +stddev: 3.42 PSNR: 37.43 MAXDIFF: 48 bytes: 7603200/ 7603200 diff --git a/mplayer/ffmpeg/tests/ref/vsynth2/qtrle b/mplayer/ffmpeg/tests/ref/vsynth2/qtrle index 756ed693..6b2a0116 100644 --- a/mplayer/ffmpeg/tests/ref/vsynth2/qtrle +++ b/mplayer/ffmpeg/tests/ref/vsynth2/qtrle @@ -1,4 +1,4 @@ -5346bba8e03e7de72b482efbcf712a2e *./tests/data/vsynth2/qtrle.mov -141533 ./tests/data/vsynth2/qtrle.mov -f967b290c7e6d015c0e78175db828249 *./tests/data/qtrle.vsynth2.out.yuv -stddev: 5.75 PSNR: 32.93 MAXDIFF: 92 bytes: 7603200/ 7603200 +d8c1604dc46d9aa4ec0385e6722c6989 *./tests/data/vsynth2/qtrle.mov +14798419 ./tests/data/vsynth2/qtrle.mov +b2418e0e3a9a8619b31219cbcf24dc82 *./tests/data/qtrle.vsynth2.out.yuv +stddev: 1.26 PSNR: 46.06 MAXDIFF: 13 bytes: 7603200/ 7603200 diff --git a/mplayer/ffmpeg/tools/graph2dot.c b/mplayer/ffmpeg/tools/graph2dot.c index 5e0da9a5..b67e5970 100644 --- a/mplayer/ffmpeg/tools/graph2dot.c +++ b/mplayer/ffmpeg/tools/graph2dot.c @@ -22,6 +22,7 @@ #undef HAVE_AV_CONFIG_H #include "libavutil/pixdesc.h" +#include "libavutil/audioconvert.h" #include "libavfilter/avfiltergraph.h" static void usage(void) @@ -67,10 +68,18 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph) dst_filter_ctx->filter->name); fprintf(outfile, "\"%s\" -> \"%s\"", filter_ctx_label, dst_filter_ctx_label); - fprintf(outfile, " [ label= \"fmt:%s w:%d h:%d tb:%d/%d\" ];\n", - link->type == AVMEDIA_TYPE_VIDEO ? av_pix_fmt_descriptors[link->format].name : - link->type == AVMEDIA_TYPE_AUDIO ? av_get_sample_fmt_name(link->format) : "unknown", - link->w, link->h, link->time_base.num, link->time_base.den); + if (link->type == AVMEDIA_TYPE_VIDEO) { + fprintf(outfile, " [ label= \"fmt:%s w:%d h:%d tb:%d/%d\" ]", + av_pix_fmt_descriptors[link->format].name, + link->w, link->h, link->time_base.num, link->time_base.den); + } else if (link->type == AVMEDIA_TYPE_AUDIO) { + char buf[255]; + av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout); + fprintf(outfile, " [ label= \"fmt:%s sr:%"PRId64" cl:%s\" ]", + av_get_sample_fmt_name(link->format), + link->sample_rate, buf); + } + fprintf(outfile, ";\n"); } } } diff --git a/mplayer/ffmpeg/version.sh b/mplayer/ffmpeg/version.sh index 3269e038..b34ee2c8 100644 --- a/mplayer/ffmpeg/version.sh +++ b/mplayer/ffmpeg/version.sh @@ -1,21 +1,8 @@ #!/bin/sh -# check for SVN revision number revision=$(cd "$1" && cat snapshot_version 2> /dev/null) -test "$revision" || revision=$(cd "$1" && LC_ALL=C svn info 2> /dev/null | grep "Last Changed Rev" | cut -d' ' -f4) -test "$revision" || revision=$(cd "$1" && grep committed-rev .svn/entries 2>/dev/null | head -n 1 | cut -d '"' -f2) -test "$revision" || revision=$(cd "$1" && sed -n -e '/^dir$/{n -p -q -}' .svn/entries 2>/dev/null) test "$revision" && revision=SVN-r$revision -# check for git svn revision number -if ! test "$revision"; then - revision=$(cd "$1" && git svn find-rev HEAD 2> /dev/null) - test "$revision" && revision=git-svn-r$revision -fi - # check for git short hash if ! test "$revision"; then revision=$(cd "$1" && git describe --always 2> /dev/null) diff --git a/mplayer/fmt-conversion.c b/mplayer/fmt-conversion.c index 9e881009..f55b46b0 100644 --- a/mplayer/fmt-conversion.c +++ b/mplayer/fmt-conversion.c @@ -19,6 +19,8 @@ #include "mp_msg.h" #include "libavutil/avutil.h" #include "libmpcodecs/img_format.h" +#include "libavutil/samplefmt.h" +#include "libaf/af_format.h" #include "fmt-conversion.h" static const struct { @@ -123,3 +125,42 @@ int pixfmt2imgfmt(enum PixelFormat pix_fmt) mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported PixelFormat %i\n", pix_fmt); return fmt; } + +static const struct { + int fmt; + enum AVSampleFormat sample_fmt; +} samplefmt_conversion_map[] = { + {AF_FORMAT_U8, AV_SAMPLE_FMT_U8}, + {AF_FORMAT_S16_NE, AV_SAMPLE_FMT_S16}, + {AF_FORMAT_S32_NE, AV_SAMPLE_FMT_S32}, + {AF_FORMAT_FLOAT_NE, AV_SAMPLE_FMT_FLT}, + {0, AV_SAMPLE_FMT_NONE} +}; + +enum AVSampleFormat affmt2samplefmt(int fmt) +{ + char str[50]; + int i; + enum AVSampleFormat sample_fmt; + for (i = 0; samplefmt_conversion_map[i].fmt; i++) + if (samplefmt_conversion_map[i].fmt == fmt) + break; + sample_fmt = samplefmt_conversion_map[i].sample_fmt; + if (sample_fmt == AV_SAMPLE_FMT_NONE) + mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported format %s\n", + af_fmt2str(fmt, str, sizeof(str))); + return sample_fmt; +} + +int samplefmt2affmt(enum AVSampleFormat sample_fmt) +{ + int i; + int fmt; + for (i = 0; samplefmt_conversion_map[i].sample_fmt != AV_SAMPLE_FMT_NONE; i++) + if (samplefmt_conversion_map[i].sample_fmt == sample_fmt) + break; + fmt = samplefmt_conversion_map[i].fmt; + if (!fmt) + mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported AVSampleFormat %i\n", sample_fmt); + return fmt; +} diff --git a/mplayer/fmt-conversion.h b/mplayer/fmt-conversion.h index 9e133a82..811b5e9d 100644 --- a/mplayer/fmt-conversion.h +++ b/mplayer/fmt-conversion.h @@ -21,8 +21,11 @@ #include "config.h" #include "libavutil/avutil.h" +#include "libavutil/samplefmt.h" enum PixelFormat imgfmt2pixfmt(int fmt); int pixfmt2imgfmt(enum PixelFormat pix_fmt); +enum AVSampleFormat affmt2samplefmt(int fmt); +int samplefmt2affmt(enum AVSampleFormat sample_fmt); #endif /* MPLAYER_FMT_CONVERSION_H */ diff --git a/mplayer/gui/app.c b/mplayer/gui/app.c index 35e745d6..b5bf5a03 100644 --- a/mplayer/gui/app.c +++ b/mplayer/gui/app.c @@ -16,225 +16,204 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include -#include -#include - -#include "config.h" -#include "mp_msg.h" -#include "help_mp.h" - #include "app.h" -#include "wm/wskeys.h" -#include "skin/skin.h" -#include "mplayer/gmplayer.h" + +#include "gui/skin/font.h" #include "interface.h" -static const evName evNames[] = - { - { evNone, "evNone" }, - { evPlay, "evPlay" }, - { evStop, "evStop" }, - { evPause, "evPause" }, - { evPrev, "evPrev" }, - { evNext, "evNext" }, - { evLoad, "evLoad" }, - { evEqualizer, "evEqualizer" }, - { evEqualizer, "evEqualeaser" }, - { evPlayList, "evPlaylist" }, - { evExit, "evExit" }, - { evIconify, "evIconify" }, - { evIncBalance, "evIncBalance" }, - { evDecBalance, "evDecBalance" }, - { evFullScreen, "evFullScreen" }, - { evFName, "evFName" }, - { evMovieTime, "evMovieTime" }, - { evAbout, "evAbout" }, - { evLoadPlay, "evLoadPlay" }, - { evPreferences, "evPreferences" }, - { evSkinBrowser, "evSkinBrowser" }, - { evBackward10sec, "evBackward10sec" }, - { evForward10sec, "evForward10sec" }, - { evBackward1min, "evBackward1min" }, - { evForward1min, "evForward1min" }, - { evBackward10min, "evBackward10min" }, - { evForward10min, "evForward10min" }, - { evIncVolume, "evIncVolume" }, - { evDecVolume, "evDecVolume" }, - { evMute, "evMute" }, - { evIncAudioBufDelay, "evIncAudioBufDelay" }, - { evDecAudioBufDelay, "evDecAudioBufDelay" }, - { evPlaySwitchToPause, "evPlaySwitchToPause" }, - { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, - { evNormalSize, "evHalfSize" }, - { evNormalSize, "evNormalSize" }, - { evDoubleSize, "evDoubleSize" }, - { evSetMoviePosition, "evSetMoviePosition" }, - { evSetVolume, "evSetVolume" }, - { evSetBalance, "evSetBalance" }, - { evHelp, "evHelp" }, - { evLoadSubtitle, "evLoadSubtitle" }, - { evPlayDVD, "evPlayDVD" }, - { evPlayVCD, "evPlayVCD" }, - { evSetURL, "evSetURL" }, - { evLoadAudioFile, "evLoadAudioFile" }, - { evDropSubtitle, "evDropSubtitle" }, - { evSetAspect, "evSetAspect" } - }; - -static const int evBoxs = sizeof( evNames ) / sizeof( evName ); - -// --- - -listItems appMPlayer; - -/* FIXME: Eventually remove the obsolete directory names. */ -char * skinDirInHome=NULL; -char * skinDirInHome_obsolete=NULL; -char * skinMPlayerDir=NULL; -char * skinMPlayerDir_obsolete=NULL; -char * skinName = NULL; - -void appClearItem( wItem * item ) +listItems appMPlayer; + +static const evName evNames[] = { + { evNone, "evNone" }, + { evPlay, "evPlay" }, + { evStop, "evStop" }, + { evPause, "evPause" }, + { evPrev, "evPrev" }, + { evNext, "evNext" }, + { evLoad, "evLoad" }, + { evEqualizer, "evEqualizer" }, + { evEqualizer, "evEqualeaser" }, // NOTE TO MYSELF: any skin using this? + { evPlayList, "evPlaylist" }, + { evExit, "evExit" }, + { evIconify, "evIconify" }, + { evIncBalance, "evIncBalance" }, // NOTE TO MYSELF: not all of these events + { evDecBalance, "evDecBalance" }, // are actually implemented, and update doc + { evFullScreen, "evFullScreen" }, + { evFName, "evFName" }, + { evMovieTime, "evMovieTime" }, + { evAbout, "evAbout" }, + { evLoadPlay, "evLoadPlay" }, + { evPreferences, "evPreferences" }, + { evSkinBrowser, "evSkinBrowser" }, + { evBackward10sec, "evBackward10sec" }, + { evForward10sec, "evForward10sec" }, + { evBackward1min, "evBackward1min" }, + { evForward1min, "evForward1min" }, + { evBackward10min, "evBackward10min" }, + { evForward10min, "evForward10min" }, + { evIncVolume, "evIncVolume" }, + { evDecVolume, "evDecVolume" }, + { evMute, "evMute" }, + { evIncAudioBufDelay, "evIncAudioBufDelay" }, + { evDecAudioBufDelay, "evDecAudioBufDelay" }, + { evPlaySwitchToPause, "evPlaySwitchToPause" }, + { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, + { evNormalSize, "evHalfSize" }, + { evNormalSize, "evNormalSize" }, + { evDoubleSize, "evDoubleSize" }, + { evSetMoviePosition, "evSetMoviePosition" }, + { evSetVolume, "evSetVolume" }, + { evSetBalance, "evSetBalance" }, + { evHelp, "evHelp" }, + { evLoadSubtitle, "evLoadSubtitle" }, + { evPlayDVD, "evPlayDVD" }, + { evPlayVCD, "evPlayVCD" }, + { evSetURL, "evSetURL" }, + { evLoadAudioFile, "evLoadAudioFile" }, + { evDropSubtitle, "evDropSubtitle" }, + { evSetAspect, "evSetAspect" } +}; + +static const int EVENTS = sizeof(evNames) / sizeof(evName); + +static void appClearItem(wItem *item) { - item->type=0; -// --- - item->x=0; item->y=0; item->width=0; item->height=0; -// --- - item->px=0; item->py=0; item->psx=0; item->psy=0; -// --- - item->msg=0; item->msg2=0; - item->pressed=btnReleased; - item->tmp=0; - item->key=0; item->key2=0; - item->Bitmap.Width=0; item->Bitmap.Height=0; item->Bitmap.BPP=0; item->Bitmap.ImageSize=0; - free(item->Bitmap.Image); - item->Bitmap.Image=NULL; -// --- - item->fontid=0; - free(item->label); - item->label=NULL; - item->event=0; + item->type = itNone; + item->x = 0; + item->y = 0; + item->width = 0; + item->height = 0; + bpFree(&item->Bitmap); + bpFree(&item->Mask); + item->fontid = 0; + item->align = fntAlignLeft; + gfree((void **)&item->label); + item->pwidth = 0; + item->pheight = 0; + item->numphases = 0; + item->value = 0; + item->message = evNone; + item->R = 0; + item->G = 0; + item->B = 0; + gfree((void **)&item->text); + item->textwidth = 0; + item->starttime = 0; + item->last_x = 0; + item->pressed = btnDisabled; + item->tmp = 0; } -void appCopy( listItems * dest,listItems * source ) +void appResetStruct(void) { - dest->NumberOfItems=source->NumberOfItems; - memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) ); - - dest->NumberOfMenuItems=source->NumberOfMenuItems; - memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) ); + appMPlayer.IndexOfMainItems = -1; + appMPlayer.IndexOfBarItems = -1; + appMPlayer.IndexOfMenuItems = -1; - memcpy( &dest->main,&source->main,sizeof( wItem ) ); - memcpy( &dest->sub,&source->sub,sizeof( wItem ) ); - memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) ); - memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) ); + appMPlayer.sub.x = -1; // NOTE TO MYSELF: is this really necessary? + appMPlayer.sub.y = -1; // NOTE TO MYSELF: is this really necessary? } -void appInitStruct( listItems * item ) +void appFreeStruct(void) { - int i; - for ( i=0;iNumberOfItems;i++ ) - appClearItem( &item->Items[i] ); - for ( i=0;iNumberOfMenuItems;i++ ) - appClearItem( &item->MenuItems[i] ); - for ( i=0;iNumberOfBarItems;i++ ) - appClearItem( &item->barItems[i] ); - - item->NumberOfItems=-1; - memset( item->Items,0,256 * sizeof( wItem ) ); - item->NumberOfMenuItems=-1; - memset( item->MenuItems,0,64 * sizeof( wItem ) ); - item->NumberOfBarItems=-1; - memset( item->barItems,0,256 * sizeof( wItem ) ); - - appClearItem( &item->main ); - item->mainDecoration=0; - appClearItem( &item->sub ); - item->sub.width=0; item->sub.height=0; - item->sub.x=-1; item->sub.y=-1; - appClearItem( &item->menuBase ); - appClearItem( &item->menuSelected ); - item->sub.R=item->sub.G=item->sub.B=0; - item->bar.R=item->bar.G=item->bar.B=0; - item->main.R=item->main.G=item->main.B=0; - item->barIsPresent=0; - item->menuIsPresent=0; -} + int i; -int appFindKey( unsigned char * name ) -{ - int i; - for ( i=0;i 100.f ) state=100.0f; - appMPlayer.Items[j].value=state; - break; - } - } - - for ( j=0;j < appMPlayer.NumberOfBarItems + 1;j++ ) - if ( appMPlayer.barItems[j].msg == event ) - { - switch ( appMPlayer.barItems[j].type ) - { - case itButton: - appMPlayer.barItems[j].pressed=(int)state; - appMPlayer.barItems[j].tmp=(int)state; - break; - case itPotmeter: - case itVPotmeter: - case itHPotmeter: - if ( state < 0.0f ) state=0.0f; - if ( state > 100.f ) state=100.0f; - appMPlayer.barItems[j].value=state; - break; - } - } + int i; + + for (i = 0; i < EVENTS; i++) + if (!strcmp(evNames[i].name, str)) + return evNames[i].message; + + return -1; } -float btnGetValue( int event ) +void btnModify(int event, float state) { - int j; - for ( j=0;j 100.0) + state = 100.0; + appMPlayer.mainItems[i].value = state; + break; + } + } + } + + for (i = 0; i <= appMPlayer.IndexOfBarItems; i++) { + if (appMPlayer.barItems[i].message == event) { + switch (appMPlayer.barItems[i].type) { + case itButton: + appMPlayer.barItems[i].pressed = (int)state; + appMPlayer.barItems[i].tmp = (int)state; + break; + + case itPotmeter: + case itVPotmeter: + case itHPotmeter: + if (state < 0.0) + state = 0.0; + if (state > 100.0) + state = 100.0; + appMPlayer.barItems[i].value = state; + break; + } + } + } } -void btnSet( int event,int set ) +void btnSet(int event, int set) { - int j; - for ( j=0;j #include -#include "mp_msg.h" -#include "help_mp.h" #include "bitmap.h" + +#include "help_mp.h" #include "libavcodec/avcodec.h" #include "libavutil/intreadwrite.h" #include "libvo/fastmemcpy.h" +#include "mp_msg.h" -static int pngRead( unsigned char * fname,txSample * bf ) +static int pngRead(unsigned char *fname, txSample *bf) { - int decode_ok; - void *data; - int len; - AVCodecContext *avctx; - AVFrame *frame; - AVPacket pkt; - - FILE *fp=fopen( fname,"rb" ); - if ( !fp ) - { - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] file read error ( %s )\n",fname ); - return 1; - } - - fseek(fp, 0, SEEK_END); - len = ftell(fp); - if (len > 50 * 1024 * 1024) return 2; - data = av_malloc(len + FF_INPUT_BUFFER_PADDING_SIZE); - fseek(fp, 0, SEEK_SET); - fread(data, len, 1, fp); - fclose(fp); - avctx = avcodec_alloc_context(); - frame = avcodec_alloc_frame(); - avcodec_register_all(); - avcodec_open(avctx, avcodec_find_decoder(CODEC_ID_PNG)); - av_init_packet(&pkt); - pkt.data = data; - pkt.size = len; - // HACK: make PNGs decode normally instead of as CorePNG delta frames - pkt.flags = PKT_FLAG_KEY; - avcodec_decode_video2(avctx, frame, &decode_ok, &pkt); - memset(bf, 0, sizeof(*bf)); - switch (avctx->pix_fmt) { - case PIX_FMT_GRAY8: bf->BPP = 8; break; - case PIX_FMT_GRAY16BE: bf->BPP = 16; break; - case PIX_FMT_RGB24: bf->BPP = 24; break; - case PIX_FMT_BGRA: - case PIX_FMT_ARGB: bf->BPP = 32; break; - default: bf->BPP = 0; break; - } - if (decode_ok && bf->BPP) { - int bpl; - bf->Width = avctx->width; bf->Height = avctx->height; - bpl = bf->Width * (bf->BPP / 8); - bf->ImageSize = bpl * bf->Height; - bf->Image = malloc(bf->ImageSize); - memcpy_pic(bf->Image, frame->data[0], bpl, bf->Height, bpl, frame->linesize[0]); - } - avcodec_close(avctx); - av_freep(&frame); - av_freep(&avctx); - av_freep(&data); - - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] filename: %s.\n",fname ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] imagesize: %lu\n",bf->ImageSize ); - return !(decode_ok && bf->BPP); + FILE *fp; + int decode_ok; + void *data; + int len; + AVCodecContext *avctx; + AVFrame *frame; + AVPacket pkt; + + fp = fopen(fname, "rb"); + + if (!fp) { + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[png] file read error ( %s )\n", fname); + return 1; + } + + fseek(fp, 0, SEEK_END); + len = ftell(fp); + + if (len > 50 * 1024 * 1024) { + fclose(fp); + return 2; + } + + data = av_malloc(len + FF_INPUT_BUFFER_PADDING_SIZE); + + fseek(fp, 0, SEEK_SET); + fread(data, len, 1, fp); + fclose(fp); + + avctx = avcodec_alloc_context(); + frame = avcodec_alloc_frame(); + avcodec_register_all(); + avcodec_open(avctx, avcodec_find_decoder(CODEC_ID_PNG)); + av_init_packet(&pkt); + pkt.data = data; + pkt.size = len; + // HACK: make PNGs decode normally instead of as CorePNG delta frames + pkt.flags = AV_PKT_FLAG_KEY; + avcodec_decode_video2(avctx, frame, &decode_ok, &pkt); + memset(bf, 0, sizeof(*bf)); + + switch (avctx->pix_fmt) { + case PIX_FMT_GRAY8: + bf->BPP = 8; + break; + + case PIX_FMT_GRAY16BE: + bf->BPP = 16; + break; + + case PIX_FMT_RGB24: + bf->BPP = 24; + break; + + case PIX_FMT_BGRA: + case PIX_FMT_ARGB: + bf->BPP = 32; + break; + + default: + bf->BPP = 0; + break; + } + + if (decode_ok && bf->BPP) { + int bpl; + + bf->Width = avctx->width; + bf->Height = avctx->height; + bpl = bf->Width * (bf->BPP / 8); + bf->ImageSize = bpl * bf->Height; + bf->Image = malloc(bf->ImageSize); + memcpy_pic(bf->Image, frame->data[0], bpl, bf->Height, bpl, frame->linesize[0]); + } + + avcodec_close(avctx); + av_freep(&frame); + av_freep(&avctx); + av_freep(&data); + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[png] filename: %s.\n", fname); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[png] size: %lux%lu bits: %u\n", bf->Width, bf->Height, bf->BPP); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[png] imagesize: %lu\n", bf->ImageSize); + + return !(decode_ok && bf->BPP); } -static int conv24to32( txSample * bf ) +static int conv24to32(txSample *bf) { - unsigned char * tmpImage; - int i,c; - - if ( bf->BPP == 24 ) - { - tmpImage=bf->Image; - bf->ImageSize=bf->Width * bf->Height * 4; - bf->BPP=32; - if ( ( bf->Image=calloc( 1, bf->ImageSize ) ) == NULL ) - { - free( tmpImage ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] not enough memory for image\n" ); - return 1; - } - for ( c=0,i=0; c < bf->ImageSize; c += 4, i += 3) - { - *(uint32_t *)&bf->Image[c] = AV_RB24(&tmpImage[i]); + unsigned char *tmpImage; + unsigned int i, c; + + if (bf->BPP == 24) { + tmpImage = bf->Image; + bf->BPP = 32; + bf->ImageSize = bf->Width * bf->Height * 4; + bf->Image = calloc(1, bf->ImageSize); + + if (!bf->Image) { + free(tmpImage); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] not enough memory for image\n"); + return 1; + } + + for (c = 0, i = 0; c < bf->ImageSize; c += 4, i += 3) + *(uint32_t *)&bf->Image[c] = AV_RB24(&tmpImage[i]); + + free(tmpImage); } - free( tmpImage ); - } - return 0; + + return 0; } -static void Normalize( txSample * bf ) +static void Normalize(txSample *bf) { - int i; + int i; + + for (i = 0; i < (int)bf->ImageSize; i += 4) #if !HAVE_BIGENDIAN - for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i+3]=0; + bf->Image[i + 3] = 0; #else - for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i]=0; + bf->Image[i] = 0; #endif } -static unsigned char tmp[512]; +static unsigned char *fExist(unsigned char *fname) +{ + static unsigned char tmp[512]; + FILE *fl; + unsigned char ext[][6] = { ".png\0", ".PNG\0" }; + int i; + + fl = fopen(fname, "rb"); + + if (fl != NULL) { + fclose(fl); + return fname; + } -static unsigned char * fExist( unsigned char * fname ) + for (i = 0; i < 2; i++) { + snprintf(tmp, sizeof(tmp), "%s%s", fname, ext[i]); + fl = fopen(tmp, "rb"); + + if (fl != NULL) { + fclose(fl); + return tmp; + } + } + + return NULL; +} + +int bpRead(char *fname, txSample *bf) { - FILE * fl; - unsigned char ext[][6] = { ".png\0",".PNG\0" }; - int i; - - fl=fopen( fname,"rb" ); - if ( fl != NULL ) - { - fclose( fl ); - return fname; - } - for ( i=0;i<2;i++ ) - { - snprintf( tmp,511,"%s%s",fname,ext[i] ); - fl=fopen( tmp,"rb" ); - if ( fl != NULL ) - { - fclose( fl ); - return tmp; + fname = fExist(fname); + + if (fname == NULL) + return -2; + + if (pngRead(fname, bf)) { + mp_dbg(MSGT_GPLAYER, MSGL_FATAL, "[bitmap] unknown file type ( %s )\n", fname); + return -5; + } + + if (bf->BPP < 24) { + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] Sorry, only 24 and 32 bpp bitmaps are supported.\n"); + return -1; } - } - return NULL; + + if (conv24to32(bf)) + return -8; + + Normalize(bf); + return 0; } -int bpRead( char * fname, txSample * bf ) +void bpFree(txSample *bf) { - fname=fExist( fname ); - if ( fname == NULL ) return -2; - if ( pngRead( fname,bf ) ) - { - mp_dbg( MSGT_GPLAYER,MSGL_FATAL,"[bitmap] unknown file type ( %s )\n",fname ); - return -5; - } - if ( bf->BPP < 24 ) - { - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] Sorry, only 24 and 32 bpp bitmaps are supported.\n" ); - return -1; - } - if ( conv24to32( bf ) ) return -8; - Normalize( bf ); - return 0; + free(bf->Image); + memset(bf, 0, sizeof(*bf)); } -void Convert32to1( txSample * in,txSample * out,int adaptivlimit ) +void Convert32to1(txSample *in, txSample *out, int adaptivlimit) { - out->Width=in->Width; - out->Height=in->Height; - out->BPP=1; - out->ImageSize=(out->Width * out->Height + 7) / 8; - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[c32to1] imagesize: %d\n",out->ImageSize ); - out->Image=calloc( 1,out->ImageSize ); - if ( out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_NotEnoughMemoryC32To1 ); - { - int i,b,c=0; unsigned int * buf = NULL; unsigned char tmp = 0; int nothaveshape = 1; - buf=(unsigned int *)in->Image; - for ( b=0,i=0;i < (int)(out->Width * out->Height);i++ ) - { - if ( (int)buf[i] != adaptivlimit ) tmp=( tmp >> 1 )|128; - else { tmp=tmp >> 1; buf[i]=nothaveshape=0; } - if ( b++ == 7 ) { out->Image[c++]=tmp; tmp=b=0; } - } - if ( b ) out->Image[c]=tmp; - if ( nothaveshape ) { free( out->Image ); out->Image=NULL; } - } + out->Width = in->Width; + out->Height = in->Height; + out->BPP = 1; + out->ImageSize = (out->Width * out->Height + 7) / 8; + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[c32to1] imagesize: %lu\n", out->ImageSize); + + out->Image = calloc(1, out->ImageSize); + + if (out->Image == NULL) + mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_NotEnoughMemoryC32To1); + { + int i, b, c = 0; + unsigned int *buf = NULL; + unsigned char tmp = 0; + int nothaveshape = 1; + + buf = (unsigned int *)in->Image; + + for (b = 0, i = 0; i < (int)(out->Width * out->Height); i++) { + if ((int)buf[i] != adaptivlimit) + tmp = (tmp >> 1) | 128; + else { + tmp = tmp >> 1; + buf[i] = nothaveshape = 0; + } + + if (b++ == 7) { + out->Image[c++] = tmp; + tmp = b = 0; + } + } + + if (b) + out->Image[c] = tmp; + + if (nothaveshape) { + free(out->Image); + out->Image = NULL; + } + } } diff --git a/mplayer/gui/bitmap.h b/mplayer/gui/bitmap.h index 092f5156..bb3fce37 100644 --- a/mplayer/gui/bitmap.h +++ b/mplayer/gui/bitmap.h @@ -19,16 +19,16 @@ #ifndef MPLAYER_GUI_BITMAP_H #define MPLAYER_GUI_BITMAP_H -typedef struct txSample -{ - unsigned long Width; - unsigned long Height; - unsigned int BPP; - unsigned long ImageSize; - char * Image; +typedef struct { + unsigned long Width; + unsigned long Height; + unsigned int BPP; + unsigned long ImageSize; + char *Image; } txSample; -int bpRead( char * fname, txSample * bf ); -void Convert32to1( txSample * in,txSample * out,int adaptivlimit ); +void bpFree(txSample *); +int bpRead(char *, txSample *); +void Convert32to1(txSample *, txSample *, int); #endif /* MPLAYER_GUI_BITMAP_H */ diff --git a/mplayer/gui/interface.c b/mplayer/gui/interface.c index 11aab59a..0ea05952 100644 --- a/mplayer/gui/interface.c +++ b/mplayer/gui/interface.c @@ -76,6 +76,10 @@ int vcd_seek_to_track(void *vcd, int track); guiInterface_t guiIntfStruct; int guiWinID=-1; +char *skinName; +char *skinDirInHome; +char *skinMPlayerDir; + int gstrcmp( const char * a,const char * b ) { if ( !a && !b ) return 0; @@ -159,6 +163,8 @@ void guiInit( void ) guiIntfStruct.Balance=50.0f; guiIntfStruct.StreamType=-1; + appResetStruct(); + memset( >kEquChannels,0,sizeof( gtkEquChannels ) ); #ifdef CONFIG_DXR3 if ( !gtkDXR3Device ) gtkDXR3Device=strdup( "/dev/em8300-0" ); @@ -179,13 +185,9 @@ void guiInit( void ) wsXInit( (void *)mDisplay ); // --- load skin skinDirInHome=get_path("skins"); - skinDirInHome_obsolete=get_path("Skin"); skinMPlayerDir=MPLAYER_DATADIR "/skins"; - skinMPlayerDir_obsolete=MPLAYER_DATADIR "/Skin"; mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1: '%s'\n",skinDirInHome); - mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1 (obsolete): '%s'\n",skinDirInHome_obsolete); mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2: '%s'\n",skinMPlayerDir); - mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2 (obsolete): '%s'\n",skinMPlayerDir_obsolete); if ( !skinName ) skinName=strdup( "default" ); i = skinRead( skinName ); if ((i == -1) && strcmp(skinName,"default")) @@ -441,14 +443,24 @@ void guiLoadSubtitle( char * name ) static void add_vf( char * str ) { - mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_AddingVideoFilter,str ); + void *p; + if ( vf_settings ) { int i = 0; while ( vf_settings[i].name ) if ( !gstrcmp( vf_settings[i++].name,str ) ) { i=-1; break; } if ( i != -1 ) - { vf_settings=realloc( vf_settings,( i + 2 ) * sizeof( m_obj_settings_t ) ); vf_settings[i].name=strdup( str );vf_settings[i].attribs = NULL; vf_settings[i+1].name=NULL; } - } else { vf_settings=malloc( 2 * sizeof( m_obj_settings_t ) ); vf_settings[0].name=strdup( str );vf_settings[0].attribs = NULL; vf_settings[1].name=NULL; } + { + if ( !( p=realloc( vf_settings,( i + 2 ) * sizeof( m_obj_settings_t ) ) ) ) return; + vf_settings=p; + vf_settings[i].name=strdup( str ); + vf_settings[i].attribs = NULL; + vf_settings[i+1].name=NULL; + } + } + else { vf_settings=malloc( 2 * sizeof( m_obj_settings_t ) ); vf_settings[0].name=strdup( str );vf_settings[0].attribs = NULL; vf_settings[1].name=NULL; } + + mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_AddingVideoFilter,str ); } static void remove_vf( char * str ) diff --git a/mplayer/gui/interface.h b/mplayer/gui/interface.h index e3ee37df..ffeb4f7f 100644 --- a/mplayer/gui/interface.h +++ b/mplayer/gui/interface.h @@ -185,6 +185,9 @@ typedef struct urlItem } URLItem; extern char * skinName; +extern char * skinDirInHome; +extern char * skinMPlayerDir; + extern plItem * plList; extern plItem * plCurrent; extern plItem * plLastPlayed; diff --git a/mplayer/gui/mplayer/gtk/about.c b/mplayer/gui/mplayer/gtk/about.c index c5529705..e1d6441c 100644 --- a/mplayer/gui/mplayer/gtk/about.c +++ b/mplayer/gui/mplayer/gtk/about.c @@ -73,7 +73,7 @@ GtkWidget * create_About( void ) vbox=AddVBox( AddDialogFrame( About ),0 ); pixmapstyle=gtk_widget_get_style( About ); - pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( About->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],about_xpm ); + pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( About->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar **) about_xpm ); pixmap1=gtk_pixmap_new( pixmapwid,mask ); gtk_widget_set_name( pixmap1,"pixmap1" ); diff --git a/mplayer/gui/mplayer/gtk/fs.c b/mplayer/gui/mplayer/gtk/fs.c index fe86c965..fd7fa158 100644 --- a/mplayer/gui/mplayer/gtk/fs.c +++ b/mplayer/gui/mplayer/gtk/fs.c @@ -48,6 +48,7 @@ char * get_current_dir_name( void ); #endif gchar * fsSelectedFile = NULL; +gchar * fsSelectedFileUtf8 = NULL; gchar * fsSelectedDirectory = NULL; unsigned char * fsThatDir = "."; const gchar * fsFilter = "*"; @@ -155,6 +156,16 @@ GdkPixmap * fpixmap; GdkBitmap * dmask; GdkBitmap * fmask; +static char * get_current_dir_name_utf8( void ) +{ + char * dir, * utf8dir; + dir = get_current_dir_name(); + utf8dir = g_filename_to_utf8( dir, -1, NULL, NULL, NULL ); + if ( !utf8dir ) utf8dir = g_strdup( dir ); + free( dir ); + return utf8dir; +} + static char * Filter( const char * name ) { static char tmp[32]; @@ -171,14 +182,16 @@ static char * Filter( const char * name ) static void clist_append_fname(GtkWidget * list, char *fname, GdkPixmap *pixmap, GdkPixmap *mask) { gint pos; - gchar *str[2]; + gchar *filename, *str[2]; + filename = g_filename_to_utf8(fname, -1, NULL, NULL, NULL); str[0] = NULL; - str[1] = fname; + str[1] = filename ? filename : fname; pos = gtk_clist_append(GTK_CLIST(list), str); gtk_clist_set_pixmap(GTK_CLIST(list), pos, 0, pixmap, mask); + g_free(filename); } -static void CheckDir( GtkWidget * list,char * directory ) +static void CheckDir( GtkWidget * list ) { struct stat fs; int i; @@ -324,7 +337,7 @@ void ShowFileSelect( int type,int modal ) for ( i=0;i < fsPersistant_MaxPos;i++ ) if ( fsHistory[i] ) { fsTopList_items=g_list_append( fsTopList_items,fsHistory[i] ); c=0; } } - if ( c ) fsTopList_items=g_list_append( fsTopList_items,(gchar *)get_current_dir_name() ); + if ( c ) fsTopList_items=g_list_append( fsTopList_items,(gchar *)get_current_dir_name_utf8() ); } if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) ); fsTopList_items=g_list_append( fsTopList_items,"/home" ); @@ -367,7 +380,7 @@ static void fs_fsFilterCombo_activate( GtkEditable * editable, gpointer user_data ) { fsFilter=gtk_entry_get_text( GTK_ENTRY( user_data ) ); - CheckDir( fsFNameList,get_current_dir_name() ); + CheckDir( fsFNameList ); } static void fs_fsFilterCombo_changed( GtkEditable * editable, @@ -407,33 +420,39 @@ static void fs_fsFilterCombo_changed( GtkEditable * editable, break; default: return; } - CheckDir( fsFNameList,get_current_dir_name() ); + CheckDir( fsFNameList ); } static void fs_fsPathCombo_activate( GtkEditable * editable, gpointer user_data ) { const unsigned char * str; + gchar * dirname; str=gtk_entry_get_text( GTK_ENTRY( user_data ) ); - if ( chdir( str ) != -1 ) CheckDir( fsFNameList,get_current_dir_name() ); + dirname = g_filename_from_utf8( str, -1, NULL, NULL, NULL ); + if ( chdir( dirname ? (const unsigned char *)dirname : str ) != -1 ) CheckDir( fsFNameList ); + g_free( dirname ); } static void fs_fsPathCombo_changed( GtkEditable * editable, gpointer user_data ) { const unsigned char * str; + gchar * dirname; str=gtk_entry_get_text( GTK_ENTRY( user_data ) ); - if ( chdir( str ) != -1 ) CheckDir( fsFNameList,get_current_dir_name() ); + dirname = g_filename_from_utf8( str, -1, NULL, NULL, NULL ); + if ( chdir( dirname ? (const unsigned char *)dirname : str ) != -1 ) CheckDir( fsFNameList ); + g_free( dirname ); } static void fs_Up_released( GtkButton * button, gpointer user_data ) { chdir( ".." ); fsSelectedFile=fsThatDir; - CheckDir( fsFNameList,get_current_dir_name() ); - gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name() ); + CheckDir( fsFNameList ); + gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name_utf8() ); return; } @@ -448,8 +467,8 @@ static void fs_Ok_released( GtkButton * button, gpointer user_data ) { chdir( fsSelectedFile ); fsSelectedFile=fsThatDir; - CheckDir( fsFNameList,get_current_dir_name() ); - gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name() ); + CheckDir( fsFNameList ); + gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name_utf8() ); return; } @@ -462,7 +481,7 @@ static void fs_Ok_released( GtkButton * button, gpointer user_data ) guiIntfStruct.FilenameChanged=1; sub_fps=0; gfree( (void **)&guiIntfStruct.AudioFile ); gfree( (void **)&guiIntfStruct.Subtitlename ); - fs_PersistantHistory( fsSelectedDirectory ); //totem, write into history + fs_PersistantHistory( get_current_dir_name_utf8() ); //totem, write into history break; case fsSubtitleSelector: guiSetDF( guiIntfStruct.Subtitlename,fsSelectedDirectory,fsSelectedFile ); @@ -489,7 +508,7 @@ static void fs_Ok_released( GtkButton * button, gpointer user_data ) if ( !strcmp( item->data,fsSelectedDirectory ) ) i=0; item=item->next; } - if ( i ) fsTopList_items=g_list_prepend( fsTopList_items,(gchar *)get_current_dir_name() ); + if ( i ) fsTopList_items=g_list_prepend( fsTopList_items,(gchar *)get_current_dir_name_utf8() ); if ( mplMainAutoPlay ) { mplMainAutoPlay=0; mplEventHandling( evPlay,0 ); } else guiGetEvent( guiCEvent,guiSetStop ); } @@ -497,13 +516,16 @@ static void fs_Ok_released( GtkButton * button, gpointer user_data ) static void fs_Cancel_released( GtkButton * button,gpointer user_data ) { HideFileSelect(); - fs_PersistantHistory( get_current_dir_name() ); //totem, write into history file + fs_PersistantHistory( get_current_dir_name_utf8() ); //totem, write into history file } static void fs_fsFNameList_select_row( GtkWidget * widget, gint row, gint column, GdkEventButton *bevent, gpointer user_data) { gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile ); + g_free( fsSelectedFileUtf8 ); + fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL ); + if ( fsSelectedFileUtf8 ) fsSelectedFile = fsSelectedFileUtf8; if( bevent && bevent->type == GDK_BUTTON_PRESS ) gtk_button_released( GTK_BUTTON( fsOk ) ); } @@ -526,6 +548,13 @@ static gboolean on_FileSelect_key_release_event( GtkWidget * widget, return FALSE; } +static void fs_Destroy( void ) +{ + g_free( fsSelectedFileUtf8 ); + fsSelectedFileUtf8 = NULL; + WidgetDestroy( fsFileSelect, &fsFileSelect ); +} + GtkWidget * create_FileSelect( void ) { GtkWidget * vbox4; @@ -635,7 +664,7 @@ GtkWidget * create_FileSelect( void ) fsOk=AddButton( MSGTR_Ok,hbuttonbox3 ); fsCancel=AddButton( MSGTR_Cancel,hbuttonbox3 ); - gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&fsFileSelect ); + gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"destroy",GTK_SIGNAL_FUNC( fs_Destroy ), NULL ); gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL ); gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsFilterCombo_changed ),fsFilterCombo ); diff --git a/mplayer/gui/mplayer/gtk/opts.c b/mplayer/gui/mplayer/gtk/opts.c index 6d628ead..14fae9f1 100644 --- a/mplayer/gui/mplayer/gtk/opts.c +++ b/mplayer/gui/mplayer/gtk/opts.c @@ -1557,33 +1557,33 @@ static void audioButton(GtkButton *button, gpointer user_data) { case 1: #ifdef CONFIG_OSS_AUDIO if (strncmp(ao_driver[0], "oss", 3) == 0) { - gfree(>kAOOSSDevice); + gfree((void **) >kAOOSSDevice); gtkAOOSSDevice = gstrdup(getGtkEntryText(CEAudioDevice)); - gfree(>kAOOSSMixer); + gfree((void **) >kAOOSSMixer); gtkAOOSSMixer = gstrdup(getGtkEntryText(CEAudioMixer)); - gfree(>kAOOSSMixerChannel); + gfree((void **) >kAOOSSMixerChannel); gtkAOOSSMixerChannel = gstrdup(getGtkEntryText(CEAudioMixerChannel)); } #endif #ifdef CONFIG_ALSA if (strncmp(ao_driver[0], "alsa", 4) == 0) { - gfree(>kAOALSADevice); + gfree((void **) >kAOALSADevice); gtkAOALSADevice = gstrdup(getGtkEntryText(CEAudioDevice)); - gfree(>kAOALSAMixer); + gfree((void **) >kAOALSAMixer); gtkAOALSAMixer = gstrdup(getGtkEntryText(CEAudioMixer)); - gfree(>kAOALSAMixerChannel); + gfree((void **) >kAOALSAMixerChannel); gtkAOALSAMixerChannel = gstrdup(getGtkEntryText(CEAudioMixerChannel)); } #endif #ifdef CONFIG_SDL if (strncmp(ao_driver[0], "sdl", 3) == 0) { - gfree(>kAOSDLDriver); + gfree((void **) >kAOSDLDriver); gtkAOSDLDriver = gstrdup(getGtkEntryText(CEAudioDevice)); } #endif #ifdef CONFIG_ESD if (strncmp(ao_driver[0], "esd", 3) == 0) { - gfree(>kAOESDDevice); + gfree((void **) >kAOESDDevice); gtkAOESDDevice = gstrdup(getGtkEntryText(CEAudioDevice)); } #endif diff --git a/mplayer/gui/mplayer/gtk/pl.c b/mplayer/gui/mplayer/gtk/pl.c index 6aad6fd3..9e033449 100644 --- a/mplayer/gui/mplayer/gtk/pl.c +++ b/mplayer/gui/mplayer/gtk/pl.c @@ -174,13 +174,18 @@ void ShowPlayList( void ) gtk_clist_clear( GTK_CLIST( CLSelected ) ); if ( plList ) { + gchar * name, * path; plItem * next = plList; while ( next || next->next ) { char * text[1][3]; text[0][2]=""; - text[0][0]=next->name; - text[0][1]=next->path; + name = g_filename_to_utf8( next->name, -1, NULL, NULL, NULL ); + path = g_filename_to_utf8( next->path, -1, NULL, NULL, NULL ); + text[0][0]=name ? name : next->name; + text[0][1]=path ? path : next->path; gtk_clist_append( GTK_CLIST( CLSelected ),text[0] ); + g_free( path ); + g_free( name ); NrOfSelected++; if ( next->next ) next=next->next; else break; } @@ -236,8 +241,10 @@ static void plButtonReleased( GtkButton * button,gpointer user_data ) item=calloc( 1,sizeof( plItem ) ); gtk_clist_get_text( GTK_CLIST( CLSelected ),i,0,&text[0] ); gtk_clist_get_text( GTK_CLIST( CLSelected ),i,1,&text[1] ); - item->name=strdup( text[0] ); - item->path=strdup( text[1] ); + item->name=g_filename_from_utf8( text[0], -1, NULL, NULL, NULL ); + if ( !item->name ) item->name = strdup( text[0] ); + item->path=g_filename_from_utf8( text[1], -1, NULL, NULL, NULL ); + if ( !item->path ) item->path = strdup( text[1] ); gtkSet( gtkAddPlItem,0,(void*)item ); } if ( plCurrent ) @@ -278,19 +285,28 @@ static void plButtonReleased( GtkButton * button,gpointer user_data ) case 3: // add { int i; + void *p; char * itext[1][2]; + gchar * cpath; char * text[1][3]; text[0][2]=""; gtk_clist_freeze( GTK_CLIST( CLSelected ) ); for ( i=0;id_name ); else sprintf( path,"%s/%s",current_path,dirent->d_name ); text=dirent->d_name; + g_free( name ); + name=g_filename_to_utf8( text, -1, NULL, NULL, NULL ); if ( stat( path,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) && dirent->d_name[0] != '.' ) { DirNode=malloc( sizeof( DirNodeType ) ); DirNode->scaned=0; DirNode->path=strdup( path ); subdir=check_for_subdir( path ); - node=gtk_ctree_insert_node( ctree,parent_node,NULL,&text,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,!subdir,FALSE ); + node=gtk_ctree_insert_node( ctree,parent_node,NULL,(name ? &name : &text ),4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,!subdir,FALSE ); gtk_ctree_node_set_row_data_full( ctree,node,DirNode,NULL ); if ( subdir ) node=gtk_ctree_insert_node( ctree,node,NULL,&dummy,4,NULL,NULL,NULL,NULL,FALSE,FALSE ); } @@ -369,6 +387,8 @@ static void plCTree( GtkCTree * ctree,GtkCTreeNode * parent_node,gpointer user_d gtk_ctree_sort_node( ctree,parent_node ); gtk_clist_thaw( GTK_CLIST( ctree ) ); } + + g_free( name ); } static void scan_dir( char * path ) @@ -377,6 +397,7 @@ static void scan_dir( char * path ) char * curr; struct dirent * dirent; struct stat statbuf; + gchar * name; char * text[1][2]; text[0][1]=""; gtk_clist_clear( GTK_CLIST( CLFiles ) ); @@ -388,8 +409,10 @@ static void scan_dir( char * path ) curr=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 ); sprintf( curr,"%s/%s",path,dirent->d_name ); if ( stat( curr,&statbuf ) != -1 && ( S_ISREG( statbuf.st_mode ) || S_ISLNK( statbuf.st_mode ) ) ) { - text[0][0]=dirent->d_name; - gtk_clist_append( GTK_CLIST( CLFiles ),text[0] ); + name=g_filename_to_utf8( dirent->d_name, -1, NULL, NULL, NULL ); + text[0][0]=name ? name : dirent->d_name; + gtk_clist_append( GTK_CLIST( CLFiles ), text[0] ); + g_free( name ); NrOfEntrys++; } free( curr ); diff --git a/mplayer/gui/mplayer/gtk/sb.c b/mplayer/gui/mplayer/gtk/sb.c index e17b17b9..a4321f66 100644 --- a/mplayer/gui/mplayer/gtk/sb.c +++ b/mplayer/gui/mplayer/gtk/sb.c @@ -34,11 +34,8 @@ GtkWidget * SkinList = NULL; char * sbSelectedSkin=NULL; -/* FIXME: Eventually remove the obsolete directory names. */ char * sbMPlayerDirInHome=NULL; -char * sbMPlayerDirInHome_obsolete=NULL; char * sbMPlayerPrefixDir=NULL; -char * sbMPlayerPrefixDir_obsolete=NULL; char * gtkOldSkin=NULL; static char * prev=NULL; @@ -101,7 +98,7 @@ static void prButton( GtkObject * object,gpointer user_data ) if ( strcmp( sbSelectedSkin,gtkOldSkin ) ) ChangeSkin( gtkOldSkin ); break; case 1: // ok - ChangeSkin( sbSelectedSkin ); + ChangeSkin( sbSelectedSkin ); // NOTE TO MYSELF: skin already changed! free( skinName ); skinName=strdup( sbSelectedSkin ); break; @@ -195,12 +192,8 @@ GtkWidget * create_SkinBrowser( void ) gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)1 ); gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)0 ); - if ( ( sbMPlayerDirInHome_obsolete=calloc( 1,strlen( skinDirInHome_obsolete ) + 4 ) ) != NULL ) - { strcpy( sbMPlayerDirInHome_obsolete,skinDirInHome_obsolete ); strcat( sbMPlayerDirInHome_obsolete,"/*" ); } if ( ( sbMPlayerDirInHome=calloc( 1,strlen( skinDirInHome ) + 4 ) ) != NULL ) { strcpy( sbMPlayerDirInHome,skinDirInHome ); strcat( sbMPlayerDirInHome,"/*" ); } - if ( ( sbMPlayerPrefixDir_obsolete=calloc( 1,strlen( skinMPlayerDir ) + 4 ) ) != NULL ) - { strcpy( sbMPlayerPrefixDir_obsolete,skinMPlayerDir ); strcat( sbMPlayerPrefixDir_obsolete,"/*" ); } if ( ( sbMPlayerPrefixDir=calloc( 1,strlen( skinMPlayerDir ) + 4 ) ) != NULL ) { strcpy( sbMPlayerPrefixDir,skinMPlayerDir ); strcat( sbMPlayerPrefixDir,"/*" ); } diff --git a/mplayer/gui/mplayer/gui_common.c b/mplayer/gui/mplayer/gui_common.c index ff7557af..e82375ec 100644 --- a/mplayer/gui/mplayer/gui_common.c +++ b/mplayer/gui/mplayer/gui_common.c @@ -54,6 +54,7 @@ static inline void TranslateFilename( int c,char * tmp,size_t tmplen ) { int i; char * p; + size_t len; switch ( guiIntfStruct.StreamType ) { @@ -67,8 +68,10 @@ static inline void TranslateFilename( int c,char * tmp,size_t tmplen ) av_strlcpy(tmp, p + 1, tmplen); else av_strlcpy(tmp, guiIntfStruct.Filename, tmplen); - if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0; - if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0; + len=strlen( tmp ); + if ( ( len > 3 )&&( tmp[len - 3] == '.' ) ) tmp[len - 3]=0; + else if ( ( len > 4 )&&( tmp[len - 4] == '.' ) ) tmp[len - 4]=0; + else if ( ( len > 5 )&&( tmp[len - 5] == '.' ) ) tmp[len - 5]=0; } else av_strlcpy( tmp,MSGTR_NoFileLoaded,tmplen ); break; #ifdef CONFIG_DVDREAD @@ -259,7 +262,7 @@ void Render( wsTWindow * window,wItem * Items,int nrItems,char * db,int size ) { wItem * item; txSample * image = NULL; - int i; + int i, ofs; image_buffer=db; image_width=window->Width; @@ -267,38 +270,63 @@ void Render( wsTWindow * window,wItem * Items,int nrItems,char * db,int size ) for( i=0;i < nrItems + 1;i++ ) { item=&Items[i]; + ofs = (item->pressed == btnPressed ? 0 : (item->pressed == btnReleased ? 1 : 2)); switch( item->type ) { case itButton: - PutImage( &item->Bitmap,item->x,item->y,3,item->pressed ); + PutImage( &item->Bitmap,item->x,item->y,3,ofs ); break; case itPotmeter: - if (item->phases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f ); - else PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) ); + if (item->numphases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f ); + else PutImage( &item->Bitmap,item->x,item->y,item->numphases,( item->numphases - 1 ) * ( item->value / 100.0f ) ); break; case itHPotmeter: - if (item->phases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f ); - else PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) ); - PutImage( &item->Mask,item->x + (int)( ( item->width - item->psx ) * item->value / 100.0f ),item->y,3,item->pressed ); + if (item->numphases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f ); + else PutImage( &item->Bitmap,item->x,item->y,item->numphases,( item->numphases - 1 ) * ( item->value / 100.0f ) ); + PutImage( &item->Mask,item->x + (int)( ( item->width - item->pwidth ) * item->value / 100.0f ),item->y,3,ofs ); break; case itVPotmeter: PutImage( &item->Bitmap, item->x,item->y, - item->phases, - item->phases * ( 1. - item->value / 100.0f ) ); + item->numphases, + item->numphases * ( 1. - item->value / 100.0f ) ); PutImage( &item->Mask, - item->x,item->y + (int)( ( item->height - item->psy ) * ( 1. - item->value / 100.0f ) ), - 3,item->pressed ); + item->x,item->y + (int)( ( item->height - item->pheight ) * ( 1. - item->value / 100.0f ) ), + 3,ofs ); break; case itSLabel: - image=fntRender( item,0,"%s",item->label ); + image=fntRender( item,0,item->label ); if ( image ) PutImage( image,item->x,item->y,1,0 ); case itDLabel: { + int x; + unsigned int d; char * t = Translate( item->label ); - int l = fntTextWidth( item->fontid,t ); - l=(l?l:item->width); - image=fntRender( item,l-(GetTimerMS() / 20)%l,"%s",t ); + if ( g_strcmp0( item->text, t ) != 0 ) + { + g_free( item->text ); + item->text = g_strdup( t ); + item->textwidth = fntTextWidth( item->fontid, t ); + item->starttime = GetTimerMS(); + item->last_x = 0; + } + d = GetTimerMS() - item->starttime; + if ( d < DELAYTIME ) x = item->last_x; // don't scroll yet + else + { + int l; + char c[2]; + l = (item->textwidth ? item->textwidth : item->width); + x = l - ((d - DELAYTIME) / 20) % l - 1; + c[0] = *item->text; + c[1] = '\0'; + if ( x < (fntTextWidth( item->fontid, c ) + 1) >> 1) + { + item->starttime = GetTimerMS(); // stop again + item->last_x = x; // at current x pos + } + } + image = fntRender( item, x, t ); } if ( image ) PutImage( image,item->x,item->y,1,0 ); break; diff --git a/mplayer/gui/mplayer/gui_common.h b/mplayer/gui/mplayer/gui_common.h index 94336c1c..ffb8b0b3 100644 --- a/mplayer/gui/mplayer/gui_common.h +++ b/mplayer/gui/mplayer/gui_common.h @@ -29,6 +29,8 @@ #include "gui/bitmap.h" #include "gui/wm/ws.h" +#define DELAYTIME 2500 // in milliseconds + char * Translate( char * str ); void PutImage( txSample * bf,int x, int y, int max, int ofs ); void SimplePotmeterPutImage( txSample * bf, int x, int y, float frac ); diff --git a/mplayer/gui/mplayer/menu.c b/mplayer/gui/mplayer/menu.c index d33b8168..cae59cfb 100644 --- a/mplayer/gui/mplayer/menu.c +++ b/mplayer/gui/mplayer/menu.c @@ -52,8 +52,8 @@ static void mplMenuDraw( void ) { buf=(uint32_t *)mplMenuDrawBuffer; drw=(uint32_t *)appMPlayer.menuSelected.Bitmap.Image; - for ( y=appMPlayer.MenuItems[ mplMenuItem ].y; y < appMPlayer.MenuItems[ mplMenuItem ].y + appMPlayer.MenuItems[ mplMenuItem ].height; y++ ) - for ( x=appMPlayer.MenuItems[ mplMenuItem ].x; x < appMPlayer.MenuItems[ mplMenuItem ].x + appMPlayer.MenuItems[ mplMenuItem ].width; x++ ) + for ( y=appMPlayer.menuItems[ mplMenuItem ].y; y < appMPlayer.menuItems[ mplMenuItem ].y + appMPlayer.menuItems[ mplMenuItem ].height; y++ ) + for ( x=appMPlayer.menuItems[ mplMenuItem ].x; x < appMPlayer.menuItems[ mplMenuItem ].x + appMPlayer.menuItems[ mplMenuItem ].width; x++ ) { tmp=drw[ y * appMPlayer.menuSelected.width + x ]; if ( tmp != 0x00ff00ff ) buf[ y * appMPlayer.menuBase.width + x ]=tmp; @@ -82,11 +82,11 @@ void mplMenuMouseHandle( int X,int Y,int RX,int RY ) return; } - for( i=0;i<=appMPlayer.NumberOfMenuItems;i++ ) + for( i=0;i<=appMPlayer.IndexOfMenuItems;i++ ) { if ( wgIsRect( x,y, - appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y, - appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width,appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) ) { mplMenuItem=i; break; } + appMPlayer.menuItems[i].x,appMPlayer.menuItems[i].y, + appMPlayer.menuItems[i].x+appMPlayer.menuItems[i].width,appMPlayer.menuItems[i].y+appMPlayer.menuItems[i].height ) ) { mplMenuItem=i; break; } } wsPostRedisplay( &appMPlayer.menuWindow ); } @@ -130,13 +130,13 @@ void mplHideMenu( int mx,int my,int w ) if ( ( x < 0 ) || ( y < 0 ) ) return; // printf( "---------> %d %d,%d\n",i,x,y ); -// printf( "--------> mi: %d,%d %dx%d\n",appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y,appMPlayer.MenuItems[i].width,appMPlayer.MenuItems[i].height ); +// printf( "--------> mi: %d,%d %dx%d\n",appMPlayer.menuItems[i].x,appMPlayer.menuItems[i].y,appMPlayer.menuItems[i].width,appMPlayer.menuItems[i].height ); if ( wgIsRect( x,y, - appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y, - appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width, - appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) ) + appMPlayer.menuItems[i].x,appMPlayer.menuItems[i].y, + appMPlayer.menuItems[i].x+appMPlayer.menuItems[i].width, + appMPlayer.menuItems[i].y+appMPlayer.menuItems[i].height ) ) { - mplEventHandling( appMPlayer.MenuItems[i].msg,(float)w ); + mplEventHandling( appMPlayer.menuItems[i].message,(float)w ); } } diff --git a/mplayer/gui/mplayer/mw.c b/mplayer/gui/mplayer/mw.c index 4f652a83..316ca6ff 100644 --- a/mplayer/gui/mplayer/mw.c +++ b/mplayer/gui/mplayer/mw.c @@ -31,6 +31,7 @@ #include "gui/skin/font.h" #include "gui/skin/skin.h" #include "gui/wm/ws.h" +#include "gui/wm/wskeys.h" #include "help_mp.h" #include "libvo/x11_common.h" @@ -87,7 +88,7 @@ void mplMainDraw( void ) btnModify( evSetVolume,guiIntfStruct.Volume ); fast_memcpy( mplDrawBuffer,appMPlayer.main.Bitmap.Image,appMPlayer.main.Bitmap.ImageSize ); - Render( &appMPlayer.mainWindow,appMPlayer.Items,appMPlayer.NumberOfItems,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize ); + Render( &appMPlayer.mainWindow,appMPlayer.mainItems,appMPlayer.IndexOfMainItems,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize ); mplMainRender=0; } wsPutImage( &appMPlayer.mainWindow ); @@ -392,9 +393,6 @@ void mplEventHandling( int msg,float param ) } } -#define itPLMButton (itNULL - 1) -#define itPRMButton (itNULL - 2) - void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) { static int itemtype = 0; @@ -405,9 +403,9 @@ void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) static int SelectedItem = -1; int currentselected = -1; - for ( i=0;i < appMPlayer.NumberOfItems + 1;i++ ) - if ( ( appMPlayer.Items[i].pressed != btnDisabled )&& - ( wgIsRect( X,Y,appMPlayer.Items[i].x,appMPlayer.Items[i].y,appMPlayer.Items[i].x+appMPlayer.Items[i].width,appMPlayer.Items[i].y+appMPlayer.Items[i].height ) ) ) + for ( i=0;i <= appMPlayer.IndexOfMainItems;i++ ) + if ( ( appMPlayer.mainItems[i].pressed != btnDisabled )&& + ( wgIsRect( X,Y,appMPlayer.mainItems[i].x,appMPlayer.mainItems[i].y,appMPlayer.mainItems[i].x+appMPlayer.mainItems[i].width,appMPlayer.mainItems[i].y+appMPlayer.mainItems[i].height ) ) ) { currentselected=i; break; } switch ( Button ) @@ -427,22 +425,22 @@ void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) SelectedItem=currentselected; if ( SelectedItem == -1 ) break; boxMoved=0; - item=&appMPlayer.Items[SelectedItem]; + item=&appMPlayer.mainItems[SelectedItem]; itemtype=item->type; item->pressed=btnPressed; switch( item->type ) { case itButton: if ( ( SelectedItem > -1 ) && - ( ( ( item->msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) || - ( ( item->msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) ) + ( ( ( item->message == evPlaySwitchToPause && item->message == evPauseSwitchToPlay ) ) || + ( ( item->message == evPauseSwitchToPlay && item->message == evPlaySwitchToPause ) ) ) ) { item->pressed=btnDisabled; } break; } break; case wsRLMouseButton: boxMoved=0; - item=&appMPlayer.Items[SelectedItem]; + item=&appMPlayer.mainItems[SelectedItem]; item->pressed=btnReleased; SelectedItem=-1; if ( currentselected == - 1 ) { itemtype=0; break; } @@ -451,17 +449,17 @@ void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) { case itPotmeter: case itHPotmeter: - btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f ); - mplEventHandling( item->msg,item->value ); + btnModify( item->message,(float)( X - item->x ) / item->width * 100.0f ); + mplEventHandling( item->message,item->value ); value=item->value; break; case itVPotmeter: - btnModify( item->msg, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f ); - mplEventHandling( item->msg,item->value ); + btnModify( item->message, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f ); + mplEventHandling( item->message,item->value ); value=item->value; break; } - mplEventHandling( item->msg,value ); + mplEventHandling( item->message,value ); itemtype=0; break; @@ -473,18 +471,18 @@ void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) case wsP5MouseButton: value=-2.5f; goto rollerhandled; case wsP4MouseButton: value= 2.5f; rollerhandled: - item=&appMPlayer.Items[currentselected]; + item=&appMPlayer.mainItems[currentselected]; if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) ) { item->value+=value; - btnModify( item->msg,item->value ); - mplEventHandling( item->msg,item->value ); + btnModify( item->message,item->value ); + mplEventHandling( item->message,item->value ); } break; // --- moving case wsMoveMouse: - item=&appMPlayer.Items[SelectedItem]; + item=&appMPlayer.mainItems[SelectedItem]; switch ( itemtype ) { case itPLMButton: @@ -505,7 +503,7 @@ void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) potihandled: if ( item->value > 100.0f ) item->value=100.0f; if ( item->value < 0.0f ) item->value=0.0f; - mplEventHandling( item->msg,item->value ); + mplEventHandling( item->message,item->value ); break; } break; diff --git a/mplayer/gui/mplayer/pb.c b/mplayer/gui/mplayer/pb.c index 2810a0a9..30a9ea80 100644 --- a/mplayer/gui/mplayer/pb.c +++ b/mplayer/gui/mplayer/pb.c @@ -106,15 +106,12 @@ static void mplPBDraw( void ) vo_mouse_autohide=0; fast_memcpy( mplPBDrawBuffer,appMPlayer.bar.Bitmap.Image,appMPlayer.bar.Bitmap.ImageSize ); - Render( &appMPlayer.barWindow,appMPlayer.barItems,appMPlayer.NumberOfBarItems,mplPBDrawBuffer,appMPlayer.bar.Bitmap.ImageSize ); + Render( &appMPlayer.barWindow,appMPlayer.barItems,appMPlayer.IndexOfBarItems,mplPBDrawBuffer,appMPlayer.bar.Bitmap.ImageSize ); wsConvert( &appMPlayer.barWindow,mplPBDrawBuffer,appMPlayer.bar.Bitmap.ImageSize ); } wsPutImage( &appMPlayer.barWindow ); } -#define itPLMButton (itNULL - 1) -#define itPRMButton (itNULL - 2) - static void mplPBMouseHandle( int Button, int X, int Y, int RX, int RY ) { static int itemtype = 0; @@ -125,7 +122,7 @@ static void mplPBMouseHandle( int Button, int X, int Y, int RX, int RY ) static int SelectedItem = -1; int currentselected = -1; - for ( i=0;i < appMPlayer.NumberOfBarItems + 1;i++ ) + for ( i=0;i <= appMPlayer.IndexOfBarItems;i++ ) if ( ( appMPlayer.barItems[i].pressed != btnDisabled )&& ( wgIsRect( X,Y,appMPlayer.barItems[i].x,appMPlayer.barItems[i].y,appMPlayer.barItems[i].x+appMPlayer.barItems[i].width,appMPlayer.barItems[i].y+appMPlayer.barItems[i].height ) ) ) { currentselected=i; break; } @@ -155,8 +152,8 @@ static void mplPBMouseHandle( int Button, int X, int Y, int RX, int RY ) { case itButton: if ( ( SelectedItem > -1 ) && - ( ( ( item->msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) || - ( ( item->msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) ) + ( ( ( item->message == evPlaySwitchToPause && item->message == evPauseSwitchToPlay ) ) || + ( ( item->message == evPauseSwitchToPlay && item->message == evPlaySwitchToPause ) ) ) ) { item->pressed=btnDisabled; } break; } @@ -173,17 +170,17 @@ static void mplPBMouseHandle( int Button, int X, int Y, int RX, int RY ) { case itPotmeter: case itHPotmeter: - btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f ); - mplEventHandling( item->msg,item->value ); + btnModify( item->message,(float)( X - item->x ) / item->width * 100.0f ); + mplEventHandling( item->message,item->value ); value=item->value; break; case itVPotmeter: - btnModify( item->msg, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f ); - mplEventHandling( item->msg,item->value ); + btnModify( item->message, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f ); + mplEventHandling( item->message,item->value ); value=item->value; break; } - mplEventHandling( item->msg,value ); + mplEventHandling( item->message,value ); itemtype=0; break; @@ -195,8 +192,8 @@ static void mplPBMouseHandle( int Button, int X, int Y, int RX, int RY ) if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) ) { item->value+=value; - btnModify( item->msg,item->value ); - mplEventHandling( item->msg,item->value ); + btnModify( item->message,item->value ); + mplEventHandling( item->message,item->value ); } break; // --- @@ -218,7 +215,7 @@ static void mplPBMouseHandle( int Button, int X, int Y, int RX, int RY ) potihandled: if ( item->value > 100.0f ) item->value=100.0f; if ( item->value < 0.0f ) item->value=0.0f; - mplEventHandling( item->msg,item->value ); + mplEventHandling( item->message,item->value ); break; } break; diff --git a/mplayer/gui/mplayer/play.c b/mplayer/gui/mplayer/play.c index c29edb27..c0021c6b 100644 --- a/mplayer/gui/mplayer/play.c +++ b/mplayer/gui/mplayer/play.c @@ -16,371 +16,442 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include #include -#include #include -#include -#include +#include "play.h" +#include "gmplayer.h" +#include "gui/app.h" +#include "gui/interface.h" +#include "gui/skin/font.h" +#include "gui/skin/skin.h" +#include "gui/wm/wsxdnd.h" +#include "widgets.h" #include "config.h" #include "help_mp.h" -#include "mp_core.h" +#include "input/input.h" #include "libmpcodecs/vd.h" -#include "libvo/x11_common.h" #include "libvo/video_out.h" -#include "input/input.h" +#include "mp_core.h" +#include "stream/stream.h" -#include "gui/wm/ws.h" -#include "gui/wm/wsxdnd.h" +int mplGotoTheNext = 1; -#include "gui/app.h" -#include "gui/wm/wskeys.h" -#include "gui/interface.h" +void mplFullScreen(void) +{ + if (guiIntfStruct.NoWindow && guiIntfStruct.Playing) + return; + + if (guiIntfStruct.Playing && appMPlayer.subWindow.isFullScreen) { + appMPlayer.subWindow.OldWidth = guiIntfStruct.MovieWidth; + appMPlayer.subWindow.OldHeight = guiIntfStruct.MovieHeight; + + switch (appMPlayer.sub.x) { + case -1: + appMPlayer.subWindow.OldX = wsMaxX / 2 - appMPlayer.subWindow.OldWidth / 2 + wsOrgX; + break; + + case -2: + appMPlayer.subWindow.OldX = wsMaxX - appMPlayer.subWindow.OldWidth + wsOrgX; + break; + + default: + appMPlayer.subWindow.OldX = appMPlayer.sub.x; + break; + } + + switch (appMPlayer.sub.y) { + case -1: + appMPlayer.subWindow.OldY = wsMaxY / 2 - appMPlayer.subWindow.OldHeight / 2 + wsOrgY; + break; + + case -2: + appMPlayer.subWindow.OldY = wsMaxY - appMPlayer.subWindow.OldHeight + wsOrgY; + break; + + default: + appMPlayer.subWindow.OldY = appMPlayer.sub.y; + break; + } + } -#include "widgets.h" -#include "gmplayer.h" -#include "play.h" + if (guiIntfStruct.Playing || gtkShowVideoWindow) + wsFullScreen(&appMPlayer.subWindow); -#include "gui/skin/skin.h" -#include "gui/skin/font.h" + fullscreen = vo_fs = appMPlayer.subWindow.isFullScreen; + wsSetLayer(wsDisplay, appMPlayer.mainWindow.WindowID, appMPlayer.subWindow.isFullScreen); -#include "stream/stream.h" + if (appMPlayer.menuIsPresent) + wsSetLayer(wsDisplay, appMPlayer.menuWindow.WindowID, appMPlayer.subWindow.isFullScreen); -int mplGotoTheNext = 1; - -void mplFullScreen( void ) -{ - if ( guiIntfStruct.NoWindow && guiIntfStruct.Playing ) return; - - if ( ( guiIntfStruct.Playing )&&( appMPlayer.subWindow.isFullScreen ) ) - { - appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight; - switch ( appMPlayer.sub.x ) - { - case -1: appMPlayer.subWindow.OldX=( wsMaxX / 2 ) - ( appMPlayer.subWindow.OldWidth / 2 ) + wsOrgX; break; - case -2: appMPlayer.subWindow.OldX=wsMaxX - appMPlayer.subWindow.OldWidth + wsOrgX; break; - default: appMPlayer.subWindow.OldX=appMPlayer.sub.x; break; - } - switch ( appMPlayer.sub.y ) - { - case -1: appMPlayer.subWindow.OldY=( wsMaxY / 2 ) - ( appMPlayer.subWindow.OldHeight / 2 ) + wsOrgY; break; - case -2: appMPlayer.subWindow.OldY=wsMaxY - appMPlayer.subWindow.OldHeight + wsOrgY; break; - default: appMPlayer.subWindow.OldY=appMPlayer.sub.y; break; - } - } - if ( guiIntfStruct.Playing || gtkShowVideoWindow ) wsFullScreen( &appMPlayer.subWindow ); - fullscreen=vo_fs=appMPlayer.subWindow.isFullScreen; - wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen ); - if ( appMPlayer.menuIsPresent ) wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen ); - - if ( guiIntfStruct.Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); - else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B ); + if (guiIntfStruct.Playing) + wsSetBackgroundRGB(&appMPlayer.subWindow, 0, 0, 0); + else + wsSetBackgroundRGB(&appMPlayer.subWindow, appMPlayer.sub.R, appMPlayer.sub.G, appMPlayer.sub.B); } -void mplEnd( void ) +void mplEnd(void) { - plItem * next; - - if ( !mplGotoTheNext && guiIntfStruct.Playing) { mplGotoTheNext=1; return; } - - if ( guiIntfStruct.Playing && (next=gtkSet( gtkGetNextPlItem,0,NULL )) && plLastPlayed != next ) - { - plLastPlayed=next; - guiSetDF( guiIntfStruct.Filename,next->path,next->name ); - guiIntfStruct.StreamType=STREAMTYPE_FILE; - guiIntfStruct.FilenameChanged=guiIntfStruct.NewPlay=1; - gfree( (void **)&guiIntfStruct.AudioFile ); - gfree( (void **)&guiIntfStruct.Subtitlename ); - } - else - { - if ( guiIntfStruct.FilenameChanged || guiIntfStruct.NewPlay ) return; - - guiIntfStruct.TimeSec=0; - guiIntfStruct.Position=0; - guiIntfStruct.AudioType=0; - guiIntfStruct.NoWindow=False; + plItem *next; + + if (!mplGotoTheNext && guiIntfStruct.Playing) { + mplGotoTheNext = 1; + return; + } + + if (guiIntfStruct.Playing && (next = gtkSet(gtkGetNextPlItem, 0, NULL)) && (plLastPlayed != next)) { + plLastPlayed = next; + guiSetDF(guiIntfStruct.Filename, next->path, next->name); + guiIntfStruct.StreamType = STREAMTYPE_FILE; + guiIntfStruct.FilenameChanged = guiIntfStruct.NewPlay = 1; + gfree((void **)&guiIntfStruct.AudioFile); + gfree((void **)&guiIntfStruct.Subtitlename); + } else { + if (guiIntfStruct.FilenameChanged || guiIntfStruct.NewPlay) + return; + + guiIntfStruct.TimeSec = 0; + guiIntfStruct.Position = 0; + guiIntfStruct.AudioType = 0; + guiIntfStruct.NoWindow = False; #ifdef CONFIG_DVDREAD - guiIntfStruct.DVD.current_title=1; - guiIntfStruct.DVD.current_chapter=1; - guiIntfStruct.DVD.current_angle=1; + guiIntfStruct.DVD.current_title = 1; + guiIntfStruct.DVD.current_chapter = 1; + guiIntfStruct.DVD.current_angle = 1; #endif - if ( !appMPlayer.subWindow.isFullScreen && gtkShowVideoWindow) - { - wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); - wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); - } - else wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); - guiGetEvent( guiCEvent,guiSetStop ); - mplSubRender=1; - wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B ); - wsClearWindow( appMPlayer.subWindow ); - wsPostRedisplay( &appMPlayer.subWindow ); + if (!appMPlayer.subWindow.isFullScreen && gtkShowVideoWindow) { + wsResizeWindow(&appMPlayer.subWindow, appMPlayer.sub.width, appMPlayer.sub.height); + wsMoveWindow(&appMPlayer.subWindow, True, appMPlayer.sub.x, appMPlayer.sub.y); + } else + wsVisibleWindow(&appMPlayer.subWindow, wsHideWindow); + + guiGetEvent(guiCEvent, guiSetStop); + mplSubRender = 1; + wsSetBackgroundRGB(&appMPlayer.subWindow, appMPlayer.sub.R, appMPlayer.sub.G, appMPlayer.sub.B); + wsClearWindow(appMPlayer.subWindow); + wsPostRedisplay(&appMPlayer.subWindow); } } -void mplPlay( void ) +void mplPlay(void) { - if ( ( !guiIntfStruct.Filename )|| - ( guiIntfStruct.Filename[0] == 0 )|| - ( guiIntfStruct.Playing == 1 ) ) return; - if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; } - guiGetEvent( guiCEvent,(void *)guiSetPlay ); - mplSubRender=0; - wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 ); - wsClearWindow( appMPlayer.subWindow ); + if (!guiIntfStruct.Filename || + (guiIntfStruct.Filename[0] == 0) || + (guiIntfStruct.Playing == 1)) + return; + + if (guiIntfStruct.Playing == 2) { + mplPause(); + return; + } + + guiGetEvent(guiCEvent, (void *)guiSetPlay); + mplSubRender = 0; + wsSetBackgroundRGB(&appMPlayer.subWindow, 0, 0, 0); + wsClearWindow(appMPlayer.subWindow); } -void mplPause( void ) +void mplPause(void) { - if ( !guiIntfStruct.Playing ) return; - if ( guiIntfStruct.Playing == 1 ) - { - mp_cmd_t * cmd = calloc( 1,sizeof( *cmd ) ); - cmd->id=MP_CMD_PAUSE; - cmd->name=strdup("pause"); - mp_input_queue_cmd(cmd); - } else guiIntfStruct.Playing=1; + if (!guiIntfStruct.Playing) + return; + + if (guiIntfStruct.Playing == 1) { + mp_cmd_t *cmd = calloc(1, sizeof(*cmd)); + cmd->id = MP_CMD_PAUSE; + cmd->name = strdup("pause"); + mp_input_queue_cmd(cmd); + } else + guiIntfStruct.Playing = 1; } -void mplState( void ) +void mplState(void) { - if ( ( guiIntfStruct.Playing == 0 )||( guiIntfStruct.Playing == 2 ) ) - { - btnModify( evPlaySwitchToPause,btnReleased ); - btnModify( evPauseSwitchToPlay,btnDisabled ); - } - else - { - btnModify( evPlaySwitchToPause,btnDisabled ); - btnModify( evPauseSwitchToPlay,btnReleased ); - } + if (guiIntfStruct.Playing == 0 || guiIntfStruct.Playing == 2) { + btnModify(evPlaySwitchToPause, btnReleased); + btnModify(evPauseSwitchToPlay, btnDisabled); + } else { + btnModify(evPlaySwitchToPause, btnDisabled); + btnModify(evPauseSwitchToPlay, btnReleased); + } } -float mplGetPosition( void ) -{ // return 0.0 ... 100.0 - return guiIntfStruct.Position; +void mplRelSeek(float s) +{ + rel_seek_secs = s; // -+s + abs_seek_pos = 0; } -void mplRelSeek( float s ) -{ // -+s - rel_seek_secs=s; abs_seek_pos=0; -} +void mplAbsSeek(float s) +{ + if (guiIntfStruct.StreamType == STREAMTYPE_STREAM) + return; -void mplAbsSeek( float s ) -{ // 0.0 ... 100.0 - if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) return; - rel_seek_secs=0.01*s; abs_seek_pos=3; + rel_seek_secs = 0.01 * s; // 0.0..100.0 + abs_seek_pos = 3; } -listItems tmpList; - -void ChangeSkin( char * name ) +void ChangeSkin(char *name) { - int ret; - int prev = appMPlayer.menuIsPresent; - int bprev = appMPlayer.barIsPresent; - - mainVisible=0; - - appInitStruct( &tmpList ); - skinAppMPlayer=&tmpList; - fntFreeFont(); - ret=skinRead( name ); - - appInitStruct( &tmpList ); - skinAppMPlayer=&appMPlayer; - appInitStruct( &appMPlayer ); - if ( ret ) name=skinName; - if ( skinRead( name ) ) - { - mainVisible=1; - return; - } - -// --- reload menu window - - if ( prev && appMPlayer.menuIsPresent ) - { - free( mplMenuDrawBuffer ); - if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) - { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } - wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); - wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); - wsSetShape( &appMPlayer.menuWindow,appMPlayer.menuBase.Mask.Image ); - wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow ); - } else { mplMenuInit(); } - -// --- reload sub window - if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); - if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) ) - { - wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); - wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); - } - if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); - if ( !guiIntfStruct.Playing ) - { - mplSubRender=1; - wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B ); - wsClearWindow( appMPlayer.subWindow ); - wsPostRedisplay( &appMPlayer.subWindow ); - } - -// --- reload play bar - if ( bprev ) wsDestroyWindow( &appMPlayer.barWindow ); - mplPBInit(); - -// --- reload main window - free( mplDrawBuffer ); - if ( ( mplDrawBuffer = calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) - { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } - - wsDestroyWindow( &appMPlayer.mainWindow ); - - wsCreateWindow( &appMPlayer.mainWindow, - appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, - wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsMaxSize|wsHideWindow,"MPlayer" ); - wsCreateImage( &appMPlayer.mainWindow,appMPlayer.main.Bitmap.Width,appMPlayer.main.Bitmap.Height ); - wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); - wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask ); - - appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw; - appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; - appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; - appMPlayer.mainWindow.DandDHandler=mplDandDHandler; - - wsXDNDMakeAwareness( &appMPlayer.mainWindow ); - if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 ); - wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); - mainVisible=1; -// --- - - btnModify( evSetVolume,guiIntfStruct.Volume ); - btnModify( evSetBalance,guiIntfStruct.Balance ); - btnModify( evSetMoviePosition,guiIntfStruct.Position ); - btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen ); - - wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen ); - wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen ); + int prev, bprev; + + prev = appMPlayer.menuIsPresent; + bprev = appMPlayer.barIsPresent; + + mainVisible = 0; + + if (skinRead(name) != 0) { + if (skinRead(skinName) != 0) { + mainVisible = 1; + return; + } + } + + // reload menu window + + if (prev && appMPlayer.menuIsPresent) { + free(mplMenuDrawBuffer); + mplMenuDrawBuffer = calloc(1, appMPlayer.menuBase.Bitmap.ImageSize); + + if (!mplMenuDrawBuffer) { + mp_msg(MSGT_GPLAYER, MSGL_STATUS, MSGTR_NEMDB); + return; + } + + wsResizeWindow(&appMPlayer.menuWindow, appMPlayer.menuBase.width, appMPlayer.menuBase.height); + wsResizeImage(&appMPlayer.menuWindow, appMPlayer.menuBase.width, appMPlayer.menuBase.height); + wsSetShape(&appMPlayer.menuWindow, appMPlayer.menuBase.Mask.Image); + wsVisibleWindow(&appMPlayer.menuWindow, wsHideWindow); + } else + mplMenuInit(); + + // reload sub window + + if (appMPlayer.sub.Bitmap.Image) + wsResizeImage(&appMPlayer.subWindow, appMPlayer.sub.Bitmap.Width, appMPlayer.sub.Bitmap.Height); + + if (!appMPlayer.subWindow.isFullScreen && !guiIntfStruct.Playing) { + wsResizeWindow(&appMPlayer.subWindow, appMPlayer.sub.width, appMPlayer.sub.height); + wsMoveWindow(&appMPlayer.subWindow, True, appMPlayer.sub.x, appMPlayer.sub.y); + } + + if (appMPlayer.sub.Bitmap.Image) + wsConvert(&appMPlayer.subWindow, appMPlayer.sub.Bitmap.Image, appMPlayer.sub.Bitmap.ImageSize); + if (!guiIntfStruct.Playing) { + mplSubRender = 1; + wsSetBackgroundRGB(&appMPlayer.subWindow, appMPlayer.sub.R, appMPlayer.sub.G, appMPlayer.sub.B); + wsClearWindow(appMPlayer.subWindow); + wsPostRedisplay(&appMPlayer.subWindow); + } + + // reload play bar + + if (bprev) + wsDestroyWindow(&appMPlayer.barWindow); + + mplPBInit(); + + // reload main window + + free(mplDrawBuffer); + mplDrawBuffer = calloc(1, appMPlayer.main.Bitmap.ImageSize); + + if (!mplDrawBuffer) { + mp_msg(MSGT_GPLAYER, MSGL_STATUS, MSGTR_NEMDB); + return; + } + + wsDestroyWindow(&appMPlayer.mainWindow); + + wsCreateWindow(&appMPlayer.mainWindow, appMPlayer.main.x, appMPlayer.main.y, appMPlayer.main.width, appMPlayer.main.height, wsNoBorder, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, wsShowFrame | wsMaxSize | wsHideWindow, "MPlayer"); + wsCreateImage(&appMPlayer.mainWindow, appMPlayer.main.Bitmap.Width, appMPlayer.main.Bitmap.Height); + wsSetShape(&appMPlayer.mainWindow, appMPlayer.main.Mask.Image); + wsSetIcon(wsDisplay, appMPlayer.mainWindow.WindowID, guiIcon, guiIconMask); + + appMPlayer.mainWindow.ReDraw = (void *)mplMainDraw; + appMPlayer.mainWindow.MouseHandler = mplMainMouseHandle; + appMPlayer.mainWindow.KeyHandler = mplMainKeyHandle; + appMPlayer.mainWindow.DandDHandler = mplDandDHandler; + + wsXDNDMakeAwareness(&appMPlayer.mainWindow); + + if (!appMPlayer.mainDecoration) + wsWindowDecoration(&appMPlayer.mainWindow, 0); + + wsVisibleWindow(&appMPlayer.mainWindow, wsShowWindow); + mainVisible = 1; + + btnModify(evSetVolume, guiIntfStruct.Volume); + btnModify(evSetBalance, guiIntfStruct.Balance); + btnModify(evSetMoviePosition, guiIntfStruct.Position); + btnModify(evFullScreen, !appMPlayer.subWindow.isFullScreen); + + wsSetLayer(wsDisplay, appMPlayer.mainWindow.WindowID, appMPlayer.subWindow.isFullScreen); + wsSetLayer(wsDisplay, appMPlayer.menuWindow.WindowID, appMPlayer.subWindow.isFullScreen); } -void mplSetFileName( char * dir,char * name,int type ) +void mplSetFileName(char *dir, char *name, int type) { - if ( !name ) return; + if (!name) + return; - if ( !dir ) guiSetFilename( guiIntfStruct.Filename,name ) - else guiSetDF( guiIntfStruct.Filename,dir,name ); + if (!dir) + guiSetFilename(guiIntfStruct.Filename, name) + else + guiSetDF(guiIntfStruct.Filename, dir, name) -// filename=guiIntfStruct.Filename; - guiIntfStruct.StreamType=type; - gfree( (void **)&guiIntfStruct.AudioFile ); - gfree( (void **)&guiIntfStruct.Subtitlename ); + guiIntfStruct.StreamType = type; + gfree((void **)&guiIntfStruct.AudioFile); + gfree((void **)&guiIntfStruct.Subtitlename); } -void mplCurr( void ) +void mplCurr(void) { - plItem * curr; - int stop = 0; + plItem *curr; + int stop = 0; - if ( guiIntfStruct.Playing == 2 ) return; - switch ( guiIntfStruct.StreamType ) - { + if (guiIntfStruct.Playing == 2) + return; + + switch (guiIntfStruct.StreamType) { #ifdef CONFIG_DVDREAD - case STREAMTYPE_DVD: - break; + case STREAMTYPE_DVD: + break; + #endif #ifdef CONFIG_VCD - case STREAMTYPE_VCD: - break; + case STREAMTYPE_VCD: + break; + #endif - default: - if ( (curr=gtkSet( gtkGetCurrPlItem,0,NULL)) ) - { - mplSetFileName( curr->path,curr->name,STREAMTYPE_FILE ); - mplGotoTheNext=0; - break; - } - return; - } - if ( stop ) mplEventHandling( evStop,0 ); - if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 ); -} + default: + + curr = gtkSet(gtkGetCurrPlItem, 0, NULL); + + if (curr) { + mplSetFileName(curr->path, curr->name, STREAMTYPE_FILE); + mplGotoTheNext = 0; + break; + } + + return; + } + + if (stop) + mplEventHandling(evStop, 0); + if (guiIntfStruct.Playing == 1) + mplEventHandling(evPlay, 0); +} -void mplPrev( void ) +void mplPrev(void) { - plItem * prev; - int stop = 0; + plItem *prev; + int stop = 0; + + if (guiIntfStruct.Playing == 2) + return; - if ( guiIntfStruct.Playing == 2 ) return; - switch ( guiIntfStruct.StreamType ) - { + switch (guiIntfStruct.StreamType) { #ifdef CONFIG_DVDREAD - case STREAMTYPE_DVD: - if ( --guiIntfStruct.DVD.current_chapter == 0 ) - { - guiIntfStruct.DVD.current_chapter=1; - if ( --guiIntfStruct.DVD.current_title <= 0 ) { guiIntfStruct.DVD.current_title=1; stop=1; } - } - guiIntfStruct.Track=guiIntfStruct.DVD.current_title; - break; + case STREAMTYPE_DVD: + + if (--guiIntfStruct.DVD.current_chapter == 0) { + guiIntfStruct.DVD.current_chapter = 1; + + if (--guiIntfStruct.DVD.current_title <= 0) { + guiIntfStruct.DVD.current_title = 1; + stop = 1; + } + } + + guiIntfStruct.Track = guiIntfStruct.DVD.current_title; + break; + #endif #ifdef CONFIG_VCD - case STREAMTYPE_VCD: - if ( --guiIntfStruct.Track == 0 ) { guiIntfStruct.Track=1; stop=1; } - break; + case STREAMTYPE_VCD: + if (--guiIntfStruct.Track == 0) { + guiIntfStruct.Track = 1; + stop = 1; + } + break; + #endif - default: - if ( (prev=gtkSet( gtkGetPrevPlItem,0,NULL)) ) - { - mplSetFileName( prev->path,prev->name,STREAMTYPE_FILE ); - mplGotoTheNext=0; - break; - } - return; - } - if ( stop ) mplEventHandling( evStop,0 ); - if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 ); + default: + + prev = gtkSet(gtkGetPrevPlItem, 0, NULL); + + if (prev) { + mplSetFileName(prev->path, prev->name, STREAMTYPE_FILE); + mplGotoTheNext = 0; + break; + } + + return; + } + + if (stop) + mplEventHandling(evStop, 0); + + if (guiIntfStruct.Playing == 1) + mplEventHandling(evPlay, 0); } -void mplNext( void ) +void mplNext(void) { - int stop = 0; - plItem * next; + int stop = 0; + plItem *next; - if ( guiIntfStruct.Playing == 2 ) return; - switch ( guiIntfStruct.StreamType ) - { + if (guiIntfStruct.Playing == 2) + return; + + switch (guiIntfStruct.StreamType) { #ifdef CONFIG_DVDREAD - case STREAMTYPE_DVD: - if ( guiIntfStruct.DVD.current_chapter++ == guiIntfStruct.DVD.chapters ) - { - guiIntfStruct.DVD.current_chapter=1; - if ( ++guiIntfStruct.DVD.current_title > guiIntfStruct.DVD.titles ) { guiIntfStruct.DVD.current_title=guiIntfStruct.DVD.titles; stop=1; } - } - guiIntfStruct.Track=guiIntfStruct.DVD.current_title; - break; + case STREAMTYPE_DVD: + + if (guiIntfStruct.DVD.current_chapter++ == guiIntfStruct.DVD.chapters) { + guiIntfStruct.DVD.current_chapter = 1; + + if (++guiIntfStruct.DVD.current_title > guiIntfStruct.DVD.titles) { + guiIntfStruct.DVD.current_title = guiIntfStruct.DVD.titles; + stop = 1; + } + } + + guiIntfStruct.Track = guiIntfStruct.DVD.current_title; + break; + #endif #ifdef CONFIG_VCD - case STREAMTYPE_VCD: - if ( ++guiIntfStruct.Track > guiIntfStruct.VCDTracks ) { guiIntfStruct.Track=guiIntfStruct.VCDTracks; stop=1; } - break; + case STREAMTYPE_VCD: + if (++guiIntfStruct.Track > guiIntfStruct.VCDTracks) { + guiIntfStruct.Track = guiIntfStruct.VCDTracks; + stop = 1; + } + break; + #endif - default: - if ( (next=gtkSet( gtkGetNextPlItem,0,NULL)) ) - { - mplSetFileName( next->path,next->name,STREAMTYPE_FILE ); - mplGotoTheNext=0; - break; - } - return; - } - if ( stop ) mplEventHandling( evStop,0 ); - if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 ); + default: + + next = gtkSet(gtkGetNextPlItem, 0, NULL); + + if (next) { + mplSetFileName(next->path, next->name, STREAMTYPE_FILE); + mplGotoTheNext = 0; + break; + } + + return; + } + + if (stop) + mplEventHandling(evStop, 0); + + if (guiIntfStruct.Playing == 1) + mplEventHandling(evPlay, 0); } diff --git a/mplayer/gui/mplayer/play.h b/mplayer/gui/mplayer/play.h index 8d41a085..38c92f2f 100644 --- a/mplayer/gui/mplayer/play.h +++ b/mplayer/gui/mplayer/play.h @@ -21,29 +21,17 @@ extern int mplGotoTheNext; -void mplEnd( void ); -void mplFullScreen( void ); -void mplPlay( void ); -void mplPause( void ); -void mplState( void ); -void mplPrev( void ); -void mplNext( void ); -void mplCurr( void ); - -void mplIncAudioBufDelay( void ); -void mplDecAudioBufDelay( void ); - -void mplRelSeek( float s ); -void mplAbsSeek( float s ); -float mplGetPosition( void ); - -void mplPlayFork( void ); -void mplSigHandler( int s ); -void mplPlayerThread( void ); - -void ChangeSkin( char * name ); -void EventHandling( void ); - -void mplSetFileName( char * dir, char * name, int type ); +void ChangeSkin(char *); +void mplAbsSeek(float); +void mplCurr(void); +void mplEnd(void); +void mplFullScreen(void); +void mplNext(void); +void mplPause(void); +void mplPlay(void); +void mplPrev(void); +void mplRelSeek(float); +void mplSetFileName(char *, char *, int); +void mplState(void); #endif /* MPLAYER_GUI_PLAY_H */ diff --git a/mplayer/gui/mplayer/widgets.c b/mplayer/gui/mplayer/widgets.c index abfc46f1..9eac5583 100644 --- a/mplayer/gui/mplayer/widgets.c +++ b/mplayer/gui/mplayer/widgets.c @@ -86,7 +86,7 @@ void gtkInit( void ) win=gtk_window_new( GTK_WINDOW_TOPLEVEL ); if ( !gtkIcon ) - gtkIcon=gdk_pixmap_colormap_create_from_xpm_d( win->window,gdk_colormap_get_system(),>kIconMask,&win->style->bg[GTK_STATE_NORMAL],MPlayer_mini_xpm ); + gtkIcon=gdk_pixmap_colormap_create_from_xpm_d( win->window,gdk_colormap_get_system(),>kIconMask,&win->style->bg[GTK_STATE_NORMAL],(gchar **) MPlayer_mini_xpm ); guiIcon=GDK_WINDOW_XWINDOW( gtkIcon ); guiIconMask=GDK_WINDOW_XWINDOW( gtkIconMask ); @@ -185,9 +185,7 @@ void gtkShow( int type,char * param ) ShowSkinBrowser(); // gtkClearList( SkinList ); if ( gtkFillSkinList( sbMPlayerPrefixDir ) && - gtkFillSkinList( sbMPlayerPrefixDir_obsolete ) && - gtkFillSkinList( sbMPlayerDirInHome ) && - gtkFillSkinList( sbMPlayerDirInHome_obsolete ) ) + gtkFillSkinList( sbMPlayerDirInHome ) ) { gtkSetDefaultToCList( SkinList,param ); gtk_clist_sort( GTK_CLIST( SkinList ) ); diff --git a/mplayer/gui/mplayer/widgets.h b/mplayer/gui/mplayer/widgets.h index 3fb178de..46cc20ba 100644 --- a/mplayer/gui/mplayer/widgets.h +++ b/mplayer/gui/mplayer/widgets.h @@ -52,8 +52,6 @@ extern int gtkPopupMenuParam; extern char * sbMPlayerDirInHome; extern char * sbMPlayerPrefixDir; -extern char * sbMPlayerDirInHome_obsolete; -extern char * sbMPlayerPrefixDir_obsolete; extern GdkPixmap * gtkIcon; extern GdkBitmap * gtkIconMask; diff --git a/mplayer/gui/skin/cut.c b/mplayer/gui/skin/cut.c index 536b1720..b1bda822 100644 --- a/mplayer/gui/skin/cut.c +++ b/mplayer/gui/skin/cut.c @@ -16,39 +16,33 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include #include +#include #include "cut.h" -void cutItem( char * in,char * out,char sep,int num ) +void cutItemString(char *in, char *out, char sep, int num, size_t maxout) { - int i,n,c; - for ( c=0,n=0,i=0;i= num && in[i] != sep ) out[c++]=in[i]; - if ( n >= num && in[i+1] == sep ) { out[c]=0; return; } - } - out[c]=0; -} + int n; + unsigned int i, c; -int cutItemToInt( char * in,char sep,int num ) -{ - char tmp[512]; - cutItem( in,tmp,sep,num ); - return atoi( tmp ); -} + for (c = 0, n = 0, i = 0; i < strlen(in); i++) { + if (in[i] == sep) + n++; + if (n >= num && in[i] != sep && c + 1 < maxout) + out[c++] = in[i]; + if (n >= num && in[i + 1] == sep) + break; + } -float cutItemToFloat( char * in,char sep,int num ) -{ - char tmp[512]; - cutItem( in,tmp,sep,num ); - return atof( tmp ); + if (c < maxout) + out[c] = 0; } -void cutChunk( char * in,char * s1 ) +int cutItemToInt(char *in, char sep, int num) { - cutItem( in,s1,'=',0 ); - memmove( in,strchr( in,'=' )+1,strlen( in ) - strlen( s1 ) ); + char tmp[64]; + + cutItem(in, tmp, sep, num); + return atoi(tmp); } diff --git a/mplayer/gui/skin/cut.h b/mplayer/gui/skin/cut.h index 5aff48d8..172db7e3 100644 --- a/mplayer/gui/skin/cut.h +++ b/mplayer/gui/skin/cut.h @@ -19,9 +19,11 @@ #ifndef MPLAYER_GUI_CUT_H #define MPLAYER_GUI_CUT_H -void cutItem( char * in, char * out, char sep, int num ); -int cutItemToInt( char * in, char sep, int num ); -float cutItemToFloat( char * in, char sep, int num ); -void cutChunk( char * in, char * s1 ); +#include + +#define cutItem(in, out, sep, num) cutItemString(in, out, sep, num, sizeof(out)) + +void cutItemString(char *, char *, char, int, size_t); +int cutItemToInt(char *, char, int); #endif /* MPLAYER_GUI_CUT_H */ diff --git a/mplayer/gui/skin/font.c b/mplayer/gui/skin/font.c index 74322d4c..4ae4b3a1 100644 --- a/mplayer/gui/skin/font.c +++ b/mplayer/gui/skin/font.c @@ -16,254 +16,391 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include +#include #include -#include -#include #include -#include -#include "gui/app.h" -#include "skin.h" #include "font.h" #include "cut.h" -#include "mp_msg.h" -#include "libavutil/avstring.h" +#include "gui/interface.h" +#include "skin.h" -int items; +#include "libavutil/avstring.h" +#include "mp_msg.h" -bmpFont * Fonts[26] = { NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL }; +static bmpFont *Fonts[MAX_FONTS]; -int fntAddNewFont( char * name ) +static int fntAddNewFont(char *name) { - int id; - int i; + int id, i; + + for (id = 0; id < MAX_FONTS; id++) + if (!Fonts[id]) + break; - for( id=0;id<26;id++ ) - if ( !Fonts[id] ) break; + if (id == MAX_FONTS) + return -2; - if ( id == 25 ) return -2; + Fonts[id] = calloc(1, sizeof(*Fonts[id])); - if ( ( Fonts[id]=calloc( 1,sizeof( bmpFont ) ) ) == NULL ) return -1; + if (!Fonts[id]) + return -1; - av_strlcpy( Fonts[id]->name,name,128 ); // FIXME: as defined in font.h - for ( i=0;i<256;i++ ) - Fonts[id]->Fnt[i].x=Fonts[id]->Fnt[i].y=Fonts[id]->Fnt[i].sx=Fonts[id]->Fnt[i].sy=-1; + av_strlcpy(Fonts[id]->name, name, MAX_FONT_NAME); - return id; + for (i = 0; i < ASCII_CHRS + EXTRA_CHRS; i++) { + Fonts[id]->Fnt[i].x = -1; + Fonts[id]->Fnt[i].y = -1; + Fonts[id]->Fnt[i].sx = -1; + Fonts[id]->Fnt[i].sy = -1; + } + + return id; } -void fntFreeFont( void ) +void fntFreeFont(void) { - int i; - for( i=0;i < 25;i++ ) - { - if ( Fonts[i] ) - { - free( Fonts[i]->Bitmap.Image ); - free( Fonts[i] ); - Fonts[i]=NULL; + int i; + + for (i = 0; i < MAX_FONTS; i++) { + if (Fonts[i]) { + bpFree(&Fonts[i]->Bitmap); + gfree((void **)&Fonts[i]); + } } - } } -int fntRead( char * path,char * fname ) +int fntRead(char *path, char *fname) { - FILE * f; - unsigned char tmp[512]; - unsigned char * ptmp; - unsigned char command[32]; - unsigned char param[256]; - int c,linenumber = 0; - int id = fntAddNewFont( fname ); - - if ( id < 0 ) return id; - - av_strlcpy( tmp,path,sizeof( tmp ) ); - av_strlcat( tmp,fname,sizeof( tmp ) ); av_strlcat( tmp,".fnt",sizeof( tmp ) ); - if ( ( f=fopen( tmp,"rt" ) ) == NULL ) - { free( Fonts[id] ); return -3; } - - while ( fgets( tmp,255,f ) ) - { - linenumber++; - - // remove any kind of newline, if any - tmp[strcspn(tmp, "\n\r")] = 0; - for ( c=0;c < (int)strlen( tmp );c++ ) - if ( tmp[c] == ';' ) { tmp[c]=0; break; } - if ( !tmp[0] ) continue; - ptmp=trimleft( tmp ); - if ( !tmp[0] ) continue; - ptmp=strswap( ptmp,'\t',' ' ); - ptmp=trim( ptmp ); - cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 ); - if ( command[0] == '"' ) - { - int i; - cutItem( command,command,'"',1 ); - i=(int)command[0]; - cutItem( param,tmp,',',0 ); Fonts[id]->Fnt[i].x=atoi( tmp ); - cutItem( param,tmp,',',1 ); Fonts[id]->Fnt[i].y=atoi( tmp ); - cutItem( param,tmp,',',2 ); Fonts[id]->Fnt[i].sx=atoi( tmp ); - cutItem( param,tmp,',',3 ); Fonts[id]->Fnt[i].sy=atoi( tmp ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[font] char: '%s' params: %d,%d %dx%d\n",command,Fonts[id]->Fnt[i].x,Fonts[id]->Fnt[i].y,Fonts[id]->Fnt[i].sx,Fonts[id]->Fnt[i].sy ); + FILE *f; + unsigned char tmp[512]; + unsigned char *ptmp; + unsigned char command[32]; + unsigned char param[256]; + int id, n, i; + + id = fntAddNewFont(fname); + + if (id < 0) + return id; + + av_strlcpy(tmp, path, sizeof(tmp)); + av_strlcat(tmp, fname, sizeof(tmp)); + av_strlcat(tmp, ".fnt", sizeof(tmp)); + f = fopen(tmp, "rt"); + + if (!f) { + gfree((void **)&Fonts[id]); + return -3; + } + + while (fgets(tmp, sizeof(tmp), f)) { + tmp[strcspn(tmp, "\n\r")] = 0; // remove any kind of newline, if any + strswap(tmp, '\t', ' '); + trim(tmp); + ptmp = strchr(tmp, ';'); + + if (ptmp && !(ptmp == tmp + 1 && tmp[0] == '"' && tmp[2] == '"')) + *ptmp = 0; + + if (!*tmp) + continue; + + n = (strncmp(tmp, "\"=", 2) == 0 ? 1 : 0); + cutItem(tmp, command, '=', n); + cutItem(tmp, param, '=', n + 1); + + if (command[0] == '"') { + if (!command[1]) + command[0] = '='; + else if (command[1] == '"') + command[1] = 0; + else + cutItem(command, command, '"', 1); + + if (command[0] & 0x80) { + for (i = 0; i < EXTRA_CHRS; i++) { + if (!Fonts[id]->nonASCIIidx[i][0]) { + strncpy(Fonts[id]->nonASCIIidx[i], command, UTF8LENGTH); + break; + } + } + + if (i == EXTRA_CHRS) + continue; + + i += ASCII_CHRS; + } else + i = command[0]; + + cutItem(param, tmp, ',', 0); + Fonts[id]->Fnt[i].x = atoi(tmp); + + cutItem(param, tmp, ',', 1); + Fonts[id]->Fnt[i].y = atoi(tmp); + + cutItem(param, tmp, ',', 2); + Fonts[id]->Fnt[i].sx = atoi(tmp); + + cutItem(param, tmp, ',', 3); + Fonts[id]->Fnt[i].sy = atoi(tmp); + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[font] char: '%s' params: %d,%d %dx%d\n", command, Fonts[id]->Fnt[i].x, Fonts[id]->Fnt[i].y, Fonts[id]->Fnt[i].sx, Fonts[id]->Fnt[i].sy); + } else if (!strcmp(command, "image")) { + av_strlcpy(tmp, path, sizeof(tmp)); + av_strlcat(tmp, param, sizeof(tmp)); + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[font] image file: %s\n", tmp); + + if (skinBPRead(tmp, &Fonts[id]->Bitmap) != 0) { + bpFree(&Fonts[id]->Bitmap); + gfree((void **)&Fonts[id]); + fclose(f); + return -4; + } + } } - else - { - if ( !strcmp( command,"image" ) ) - { - av_strlcpy( tmp,path,sizeof( tmp ) ); av_strlcat( tmp,param,sizeof( tmp ) ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[font] font imagefile: %s\n",tmp ); - if ( skinBPRead( tmp,&Fonts[id]->Bitmap ) ) return -4; - } - } - } - - return 0; + + fclose(f); + return 0; } -int fntFindID( char * name ) +int fntFindID(char *name) { - int i; - for ( i=0;i < 25;i++ ) - if ( Fonts[i] ) - if ( !strcmp( name,Fonts[i]->name ) ) return i; - return -1; + int i; + + for (i = 0; i < MAX_FONTS; i++) + if (Fonts[i]) + if (!strcmp(name, Fonts[i]->name)) + return i; + + return -1; } -int fntTextWidth( int id,char * str ) +// get Fnt index of character (utf8 or normal one) *str points to, +// then move pointer to next/previous character +static int fntGetCharIndex(int id, unsigned char **str, gboolean utf8, int direction) { - int size = 0; - int i; - - if ( ( !Fonts[id] )||( !str[0] ) ) return 0; - - for ( i=0;i < (int)strlen( str );i++ ) - { - unsigned char c = (unsigned char)str[i]; - if ( Fonts[id]->Fnt[c].sx == -1 ) c = ' '; - size+= Fonts[id]->Fnt[ c ].sx; - } - return size; + unsigned char *p, uchar[6] = ""; // glib implements 31-bit UTF-8 + int i, c = -1; + + if (**str & 0x80) { + if (utf8) { + p = *str; + *str = g_utf8_next_char(*str); + strncpy(uchar, p, *str - p); + + if (direction < 0) + *str = g_utf8_prev_char(p); + } else { + uchar[0] = **str; + *str += direction; + } + + for (i = 0; (i < EXTRA_CHRS) && Fonts[id]->nonASCIIidx[i][0]; i++) { + if (strncmp(Fonts[id]->nonASCIIidx[i], uchar, UTF8LENGTH) == 0) + return i + ASCII_CHRS; + + if (!utf8 && + (Fonts[id]->nonASCIIidx[i][0] == (*uchar >> 6 | 0xc0) && + Fonts[id]->nonASCIIidx[i][1] == ((*uchar & 0x3f) | 0x80) && + Fonts[id]->nonASCIIidx[i][2] == 0)) + c = i + ASCII_CHRS; + } + } else { + c = **str; + + if (utf8 && (direction < 0)) + *str = g_utf8_prev_char(*str); + else + *str += direction; + } + + return c; } -int fntTextHeight( int id,char * str ) +int fntTextWidth(int id, char *str) { - int max = 0,i; - - if ( ( !Fonts[id] )||( !str[0] ) ) return 0; - - for ( i=0;i < (int)strlen( str );i++ ) - { - int h; - unsigned char c = (unsigned char)str[i]; - if ( Fonts[id]->Fnt[c].sx == -1 ) c = ' '; - h = Fonts[id]->Fnt[c].sy; - if ( h > max ) max=h; - } - return max; + int size = 0, c; + gboolean utf8; + unsigned char *p; + + utf8 = g_utf8_validate(str, -1, NULL); + p = str; + + while (*p) { + c = fntGetCharIndex(id, &p, utf8, 1); + + if (c == -1 || Fonts[id]->Fnt[c].sx == -1) + c = ' '; + + if (Fonts[id]->Fnt[c].sx != -1) + size += Fonts[id]->Fnt[c].sx; + } + + return size; } -txSample * fntRender( wItem * item,int px,const char * fmt,... ) +static int fntTextHeight(int id, char *str) { - va_list ap; - unsigned char p[512]; - unsigned int c; - int i, dx = 0, tw, fbw, iw, id, ofs; - int x,y,fh,fw,fyc,yc; - uint32_t * ibuf; - uint32_t * obuf; - - va_start( ap,fmt ); - vsnprintf( p,512,fmt,ap ); - va_end( ap ); - - iw=item->width; - id=item->fontid; - - if ( ( !item )|| - ( !Fonts[id] )|| - ( !p[0] )|| - ( !fntTextWidth( id,p ) ) ) return NULL; - - tw=fntTextWidth( id,p ); - fbw=Fonts[id]->Bitmap.Width; - - if ( item->Bitmap.Image == NULL ) - { - item->Bitmap.Height=item->height=fntTextHeight( id,p ); - item->Bitmap.Width=item->width=iw; - item->Bitmap.ImageSize=item->height * iw * 4; - if ( !item->Bitmap.ImageSize ) return NULL; - item->Bitmap.BPP=32; - item->Bitmap.Image=malloc( item->Bitmap.ImageSize ); - } - - obuf=(uint32_t *)item->Bitmap.Image; - ibuf=(uint32_t *)Fonts[id]->Bitmap.Image; - - for ( i=0;i < item->Bitmap.ImageSize / 4;i++ ) obuf[i]=0xff00ff; - - if ( tw <= iw ) - { - switch ( item->align ) - { - default: - case fntAlignLeft: dx=0; break; - case fntAlignCenter: dx=( iw - fntTextWidth( id,p ) ) / 2; break; - case fntAlignRight: dx=iw - fntTextWidth( id,p ); break; + int max = 0, c, h; + gboolean utf8; + unsigned char *p; + + utf8 = g_utf8_validate(str, -1, NULL); + p = str; + + while (*p) { + c = fntGetCharIndex(id, &p, utf8, 1); + + if (c == -1 || Fonts[id]->Fnt[c].sx == -1) + c = ' '; + + h = Fonts[id]->Fnt[c].sy; + + if (h > max) + max = h; } - } else dx+=px; - - ofs=dx; - - for ( i=0;i < (int)strlen( p );i++ ) - { - c=(unsigned int)p[i]; - fw=Fonts[id]->Fnt[c].sx; - - if ( fw == -1 ) { c=32; fw=Fonts[id]->Fnt[c].sx; } - - fh=Fonts[id]->Fnt[c].sy; - fyc=Fonts[id]->Fnt[c].y * fbw + Fonts[id]->Fnt[c].x; - yc=dx; - - if ( dx >= 0 ) - for ( y=0;y < fh;y++ ) - { - for ( x=0; x < fw;x++ ) - if ( dx + x >= 0 && dx + x < iw ) obuf[yc + x]=ibuf[ fyc + x ]; - fyc+=fbw; - yc+=iw; - } - dx+=fw; - } - - if ( ofs > 0 && tw > item->width ) - { - dx=ofs; - for ( i=(int)strlen( p );i > 0;i-- ) - { - c=(unsigned int)p[i]; - fw=Fonts[id]->Fnt[c].sx; - - if ( fw == -1 ) { c=32; fw=Fonts[id]->Fnt[c].sx; } - - fh=Fonts[id]->Fnt[c].sy; - fyc=Fonts[id]->Fnt[c].y * fbw + Fonts[id]->Fnt[c].x; - - dx-=fw; yc=dx; - if ( dx >= 0 ) - for ( y=0;y < fh;y++ ) - { - for ( x=fw - 1;x >= 0;x-- ) - if ( dx + x >= 0 && dx + x < iw ) obuf[yc + x]=ibuf[fyc + x]; - fyc+=fbw; - yc+=iw; - } + return max; +} + +txSample *fntRender(wItem *item, int px, char *txt) +{ + unsigned char *u; + unsigned int i; + int c, dx, tw, th, fbw, iw, id, ofs; + int x, y, fh, fw, fyc, yc; + uint32_t *ibuf; + uint32_t *obuf; + gboolean utf8; + + id = item->fontid; + tw = fntTextWidth(id, txt); + + if (!tw) + return NULL; + + iw = item->width; + fbw = Fonts[id]->Bitmap.Width; + th = fntTextHeight(id, txt); + + if (item->height != th) + bpFree(&item->Bitmap); + + if (!item->Bitmap.Image) { + item->Bitmap.Height = item->height = th; + item->Bitmap.Width = item->width = iw; + item->Bitmap.ImageSize = item->height * iw * 4; + + if (!item->Bitmap.ImageSize) + return NULL; + + item->Bitmap.BPP = 32; + item->Bitmap.Image = malloc(item->Bitmap.ImageSize); + + if (!item->Bitmap.Image) + return NULL; + } + + obuf = (uint32_t *)item->Bitmap.Image; + ibuf = (uint32_t *)Fonts[id]->Bitmap.Image; + + for (i = 0; i < item->Bitmap.ImageSize / 4; i++) + obuf[i] = 0x00ff00ff; + + if (tw <= iw) { + switch (item->align) { + default: + case fntAlignLeft: + dx = 0; + break; + + case fntAlignCenter: + dx = (iw - tw) / 2; + break; + + case fntAlignRight: + dx = iw - tw; + break; + } + } else + dx = px; + + ofs = dx; + + utf8 = g_utf8_validate(txt, -1, NULL); + u = txt; + + while (*u) { + c = fntGetCharIndex(id, &u, utf8, 1); + + if (c != -1) + fw = Fonts[id]->Fnt[c].sx; + + if (c == -1 || fw == -1) { + c = ' '; + fw = Fonts[id]->Fnt[c].sx; + } + + if (fw == -1) + continue; + + fh = Fonts[id]->Fnt[c].sy; + fyc = Fonts[id]->Fnt[c].y * fbw + Fonts[id]->Fnt[c].x; + yc = dx; + + if (dx >= 0) { + for (y = 0; y < fh; y++) { + for (x = 0; x < fw; x++) + if (dx + x >= 0 && dx + x < iw) + obuf[yc + x] = ibuf[fyc + x]; + + fyc += fbw; + yc += iw; + } + } + + dx += fw; + } + + if (ofs > 0 && tw > item->width) { + dx = ofs; + u = txt + strlen(txt); + + while (u > (unsigned char *)txt) { + c = fntGetCharIndex(id, &u, utf8, -1); + + if (c != -1) + fw = Fonts[id]->Fnt[c].sx; + + if (c == -1 || fw == -1) { + c = ' '; + fw = Fonts[id]->Fnt[c].sx; + } + + if (fw == -1) + continue; + + fh = Fonts[id]->Fnt[c].sy; + fyc = Fonts[id]->Fnt[c].y * fbw + Fonts[id]->Fnt[c].x; + + dx -= fw; + yc = dx; + + if (dx >= 0) { + for (y = 0; y < fh; y++) { + for (x = fw - 1; x >= 0; x--) + if (dx + x >= 0 && dx + x < iw) + obuf[yc + x] = ibuf[fyc + x]; + + fyc += fbw; + yc += iw; + } + } + } } - } - return &item->Bitmap; + return &item->Bitmap; } diff --git a/mplayer/gui/skin/font.h b/mplayer/gui/skin/font.h index 2fcf92cc..ecc1f3c2 100644 --- a/mplayer/gui/skin/font.h +++ b/mplayer/gui/skin/font.h @@ -19,36 +19,36 @@ #ifndef MPLAYER_GUI_FONT_H #define MPLAYER_GUI_FONT_H -#include "gui/bitmap.h" #include "gui/app.h" +#include "gui/bitmap.h" + +#define ASCII_CHRS 128 // number of ASCII characters +#define EXTRA_CHRS 128 // (arbitrary) number of non-ASCII characters +#define UTF8LENGTH 4 // length of an UTF-8 encoding according to RFC 3629 + +#define MAX_FONT_NAME 128 +#define MAX_FONTS 25 #define fntAlignLeft 0 #define fntAlignCenter 1 #define fntAlignRight 2 -typedef struct -{ - int x,y; // location - int sx,sy; // size +typedef struct { + int x, y; // location + int sx, sy; // size } fntChar; -typedef struct -{ - fntChar Fnt[256]; - txSample Bitmap; - char name[128]; +typedef struct { + fntChar Fnt[ASCII_CHRS + EXTRA_CHRS]; + unsigned char nonASCIIidx[EXTRA_CHRS][UTF8LENGTH]; + txSample Bitmap; + char name[MAX_FONT_NAME]; } bmpFont; -extern txSample Bitmap; -extern bmpFont * Fonts[26]; - -int fntAddNewFont( char * name ); -void fntFreeFont( void ); -int fntFindID( char * name ); -int fntTextHeight( int id, char * str ); -int fntTextWidth( int id, char * str ); - -int fntRead( char * path, char * fname ); -txSample * fntRender( wItem * item, int px, const char * fmt, ... ); +int fntFindID(char *); +void fntFreeFont(void); +int fntRead(char *, char *); +txSample *fntRender(wItem *, int, char *); +int fntTextWidth(int, char *); #endif /* MPLAYER_GUI_FONT_H */ diff --git a/mplayer/gui/skin/skin.c b/mplayer/gui/skin/skin.c index 6599cae4..ad8e5db3 100644 --- a/mplayer/gui/skin/skin.c +++ b/mplayer/gui/skin/skin.c @@ -17,730 +17,906 @@ */ #include -#include #include +#include "skin.h" #include "cut.h" #include "font.h" -#include "skin.h" #include "gui/app.h" +#include "gui/mplayer/widgets.h" #include "config.h" -#include "mp_msg.h" #include "help_mp.h" -#include "gui/mplayer/widgets.h" #include "libavutil/avstring.h" +#include "mp_msg.h" -//#define MSGL_DBG2 MSGL_STATUS - -listItems * skinAppMPlayer = &appMPlayer; +typedef struct { + const char *name; + int (*func)(char *in); +} _item; -// --- +static listItems *defList; -static int linenumber; +static int linenumber; +static unsigned char path[512]; +static unsigned char window_name[32]; -static unsigned char path[512],fn[512]; +static wItem *currSection; +static int *currSubItem; +static wItem *currSubItems; -static listItems * defList = NULL; -static unsigned char window_name[32] = ""; +static void ERRORMESSAGE(const char *format, ...) +{ + char p[512]; + char tmp[512]; + va_list ap; -static wItem * currSection = NULL; -static int * currSubItem = NULL; -static wItem * currSubItems = NULL; + va_start(ap, format); + vsnprintf(p, sizeof(p), format, ap); + va_end(ap); -#include + mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_SKIN_ERRORMESSAGE, linenumber, p); -static void ERRORMESSAGE( const char * format, ... ) -{ - char p[512]; - char tmp[512]; - va_list ap; - va_start( ap,format ); - vsnprintf( p,512,format,ap ); - va_end( ap ); - mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_ERRORMESSAGE,linenumber,p ); - snprintf( tmp,512,MSGTR_SKIN_ERRORMESSAGE,linenumber,p ); - gtkMessageBox( GTK_MB_FATAL,tmp ); + if (mp_msg_test(MSGT_GPLAYER, MSGL_ERR)) { + snprintf(tmp, sizeof(tmp), MSGTR_SKIN_ERRORMESSAGE, linenumber, p); + gtkMessageBox(GTK_MB_FATAL, tmp); + } } -#define CHECKDEFLIST( str ) \ -{ \ - if ( defList == NULL ) \ - { \ - mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING1,linenumber,str ); \ - return 1; \ - } \ -} +#define CHECKDEFLIST(str) \ + { \ + if (defList == NULL) \ + { \ + ERRORMESSAGE(MSGTR_SKIN_ERROR_SECTION, str); \ + return 1; \ + } \ + } -#define CHECKWINLIST( str ) \ -{ \ - if ( !window_name[0] ) \ - { \ - mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING2,linenumber,str ); \ - return 1; \ - } \ -} +#define CHECKWINLIST(str) \ + { \ + if (!window_name[0]) \ + { \ + ERRORMESSAGE(MSGTR_SKIN_ERROR_WINDOW, str); \ + return 1; \ + } \ + } -#define CHECK( name ) \ -{ \ - if ( !strcmp( window_name,name ) ) \ - { \ - mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING3,linenumber,name ); \ - return 1; \ - } \ -} +#define CHECK(name) \ + { \ + if (!strcmp(window_name, name)) \ + { \ + ERRORMESSAGE(MSGTR_SKIN_ERROR_IN_WINDOW, name); \ + return 1; \ + } \ + } -static char * strlower( char * in ) +static char *strlower(char *in) { - int i; - for( i=0;i<(int)strlen( in );i++ ) in[i]=( in[i] >= 'A' ? ( in[i] <= 'Z' ? in[i]+='A' : in[i] ) : in[i] ); - return in; + char *p = in; + + while (*p) { + if (*p >= 'A' && *p <= 'Z') + *p += 'a' - 'A'; + + p++; + } + + return in; } -int skinBPRead( char * fname, txSample * bf ) +int skinBPRead(char *fname, txSample *bf) { - int i=bpRead( fname,bf ); - switch ( i ) - { - case -1: ERRORMESSAGE( MSGTR_SKIN_BITMAP_16bit,fname ); break; - case -2: ERRORMESSAGE( MSGTR_SKIN_BITMAP_FileNotFound,fname ); break; - case -3: ERRORMESSAGE( MSGTR_SKIN_BITMAP_BMPReadError,fname ); break; - case -4: ERRORMESSAGE( MSGTR_SKIN_BITMAP_TGAReadError,fname ); break; - case -5: ERRORMESSAGE( MSGTR_SKIN_BITMAP_PNGReadError,fname ); break; - case -6: ERRORMESSAGE( MSGTR_SKIN_BITMAP_RLENotSupported,fname ); break; - case -7: ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownFileType,fname ); break; - case -8: ERRORMESSAGE( MSGTR_SKIN_BITMAP_ConversionError,fname ); break; - } - return i; + int i = bpRead(fname, bf); + + switch (i) { + case -1: + ERRORMESSAGE(MSGTR_SKIN_BITMAP_16bit, fname); + break; + + case -2: + ERRORMESSAGE(MSGTR_SKIN_BITMAP_FileNotFound, fname); + break; + + case -3: + ERRORMESSAGE(MSGTR_SKIN_BITMAP_BMPReadError, fname); + break; + + case -4: + ERRORMESSAGE(MSGTR_SKIN_BITMAP_TGAReadError, fname); + break; + + case -5: + ERRORMESSAGE(MSGTR_SKIN_BITMAP_PNGReadError, fname); + break; + + case -6: + ERRORMESSAGE(MSGTR_SKIN_BITMAP_RLENotSupported, fname); + break; + + case -7: + ERRORMESSAGE(MSGTR_SKIN_BITMAP_UnknownFileType, fname); + break; + + case -8: + ERRORMESSAGE(MSGTR_SKIN_BITMAP_ConversionError, fname); + break; + } + + return i; } -static int cmd_section( char * in ) +// section=movieplayer +static int cmd_section(char *in) { - strlower( in ); - defList=NULL; - if ( !strcmp( in,"movieplayer" ) ) defList=skinAppMPlayer; - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] sectionname: %s\n",in ); - return 0; + strlower(in); + defList = NULL; + + if (!strcmp(in, "movieplayer")) + defList = &appMPlayer; + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] sectionname: %s\n", in); + + return 0; } -static int cmd_end( char * in ) +// end +static int cmd_end(char *in) { - if ( strlen( window_name ) ) { window_name[0]=0; currSection=NULL; currSubItem=NULL; currSubItems=NULL; } - else defList=NULL; - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] end section\n" ); - return 0; + (void)in; + + if (strlen(window_name)) { + window_name[0] = 0; + currSection = NULL; + currSubItem = NULL; + currSubItems = NULL; + } else + defList = NULL; + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] end section\n"); + + return 0; } -static int cmd_window( char * in ) +// window=main|sub|playbar|menu +static int cmd_window(char *in) { - CHECKDEFLIST( "window" ); - - av_strlcpy( window_name,strlower( in ),sizeof( window_name ) ); - if ( !strncmp( in,"main",4 ) ) { currSection=&skinAppMPlayer->main; currSubItem=&skinAppMPlayer->NumberOfItems; currSubItems=skinAppMPlayer->Items; } - else if ( !strncmp( in,"sub",3 ) ) currSection=&skinAppMPlayer->sub; - else if ( !strncmp( in,"playbar",7 ) ) { currSection=&skinAppMPlayer->bar; currSubItem=&skinAppMPlayer->NumberOfBarItems; currSubItems=skinAppMPlayer->barItems; } - else if ( !strncmp( in,"menu",4 ) ) { currSection=&skinAppMPlayer->menuBase; currSubItem=&skinAppMPlayer->NumberOfMenuItems; currSubItems=skinAppMPlayer->MenuItems; } - else ERRORMESSAGE( MSGTR_UNKNOWNWINDOWTYPE ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window: %s\n",window_name ); - return 0; + CHECKDEFLIST("window"); + + av_strlcpy(window_name, strlower(in), sizeof(window_name)); + + if (!strncmp(in, "main", 4)) { + currSection = &appMPlayer.main; + currSubItem = &appMPlayer.IndexOfMainItems; + currSubItems = appMPlayer.mainItems; + } else if (!strncmp(in, "sub", 3)) + currSection = &appMPlayer.sub; + else if (!strncmp(in, "playbar", 7)) { + currSection = &appMPlayer.bar; + currSubItem = &appMPlayer.IndexOfBarItems; + currSubItems = appMPlayer.barItems; + } else if (!strncmp(in, "menu", 4)) { + currSection = &appMPlayer.menuBase; + currSubItem = &appMPlayer.IndexOfMenuItems; + currSubItems = appMPlayer.menuItems; + } else + ERRORMESSAGE(MSGTR_UNKNOWNWINDOWTYPE); + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] window: %s\n", window_name); + + return 0; } -static int cmd_base( char * in ) +// base=image,x,y[,width,height] +static int cmd_base(char *in) { - unsigned char fname[512]; - unsigned char tmp[512]; - int x,y; - int sx=0,sy=0; - - CHECKDEFLIST( "base" ); - CHECKWINLIST( "base" ); - - cutItem( in,fname,',',0 ); - x=cutItemToInt( in,',',1 ); - y=cutItemToInt( in,',',2 ); - sx=cutItemToInt( in,',',3 ); - sy=cutItemToInt( in,',',4 ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] base: %s x: %d y: %d ( %dx%d )\n",fname,x,y,sx,sy ); - if ( !strcmp( window_name,"main" ) ) - { - defList->main.x=x; - defList->main.y=y; - defList->main.type=itBase; - av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp )); - if ( skinBPRead( tmp,&defList->main.Bitmap ) ) return 1; - defList->main.width=defList->main.Bitmap.Width; - defList->main.height=defList->main.Bitmap.Height; + unsigned char fname[512]; + unsigned char tmp[512]; + int x, y; + int sx = 0, sy = 0; + + CHECKDEFLIST("base"); + CHECKWINLIST("base"); + + cutItem(in, fname, ',', 0); + x = cutItemToInt(in, ',', 1); + y = cutItemToInt(in, ',', 2); + sx = cutItemToInt(in, ',', 3); + sy = cutItemToInt(in, ',', 4); + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] base: %s x: %d y: %d ( %dx%d )\n", fname, x, y, sx, sy); + + if (!strcmp(window_name, "main")) { + defList->main.x = x; + defList->main.y = y; + defList->main.type = itBase; + + av_strlcpy(tmp, path, sizeof(tmp)); + av_strlcat(tmp, fname, sizeof(tmp)); + + if (skinBPRead(tmp, &defList->main.Bitmap) != 0) + return 1; + + defList->main.width = defList->main.Bitmap.Width; + defList->main.height = defList->main.Bitmap.Height; + #ifdef CONFIG_XSHAPE - Convert32to1( &defList->main.Bitmap,&defList->main.Mask,0x00ff00ff ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->main.Mask.Width,defList->main.Mask.Height ); + Convert32to1(&defList->main.Bitmap, &defList->main.Mask, 0x00ff00ff); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] mask: %lux%lu\n", defList->main.Mask.Width, defList->main.Mask.Height); #else - defList->main.Mask.Image=NULL; + defList->main.Mask.Image = NULL; #endif - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->main.width,defList->main.height ); - } - if ( !strcmp( window_name,"sub" ) ) - { - defList->sub.type=itBase; - av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp )); - if ( skinBPRead( tmp,&defList->sub.Bitmap ) ) return 1; - defList->sub.x=x; - defList->sub.y=y; - defList->sub.width=defList->sub.Bitmap.Width; - defList->sub.height=defList->sub.Bitmap.Height; - if ( sx && sy ) - { - defList->sub.width=sx; - defList->sub.height=sy; + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] width: %d height: %d\n", defList->main.width, defList->main.height); } - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] %d,%d %dx%d\n",defList->sub.x,defList->sub.y,defList->sub.width,defList->sub.height ); - } - if ( !strcmp( window_name,"menu" ) ) - { - defList->menuIsPresent=1; - defList->menuBase.type=itBase; - av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp )); - if ( skinBPRead( tmp,&defList->menuBase.Bitmap ) ) return 1; - defList->menuBase.width=defList->menuBase.Bitmap.Width; - defList->menuBase.height=defList->menuBase.Bitmap.Height; + + if (!strcmp(window_name, "sub")) { + defList->sub.type = itBase; + + av_strlcpy(tmp, path, sizeof(tmp)); + av_strlcat(tmp, fname, sizeof(tmp)); + + if (skinBPRead(tmp, &defList->sub.Bitmap) != 0) + return 1; + + defList->sub.x = x; + defList->sub.y = y; + defList->sub.width = defList->sub.Bitmap.Width; + defList->sub.height = defList->sub.Bitmap.Height; + + if (sx && sy) { + defList->sub.width = sx; + defList->sub.height = sy; + } + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] %d,%d %dx%d\n", defList->sub.x, defList->sub.y, defList->sub.width, defList->sub.height); + } + + if (!strcmp(window_name, "menu")) { + defList->menuIsPresent = 1; + defList->menuBase.type = itBase; + + av_strlcpy(tmp, path, sizeof(tmp)); + av_strlcat(tmp, fname, sizeof(tmp)); + + if (skinBPRead(tmp, &defList->menuBase.Bitmap) != 0) + return 1; + + defList->menuBase.width = defList->menuBase.Bitmap.Width; + defList->menuBase.height = defList->menuBase.Bitmap.Height; + #ifdef CONFIG_XSHAPE - Convert32to1( &defList->menuBase.Bitmap,&defList->menuBase.Mask,0x00ff00ff ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->menuBase.Mask.Width,defList->menuBase.Mask.Height ); + Convert32to1(&defList->menuBase.Bitmap, &defList->menuBase.Mask, 0x00ff00ff); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] mask: %lux%lu\n", defList->menuBase.Mask.Width, defList->menuBase.Mask.Height); #else - defList->menuBase.Mask.Image=NULL; + defList->menuBase.Mask.Image = NULL; #endif - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuBase.width,defList->menuBase.height ); - } - if ( !strcmp( window_name,"playbar" ) ) - { - defList->barIsPresent=1; - defList->bar.x=x; - defList->bar.y=y; - defList->bar.type=itBase; - av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp )); - if ( skinBPRead( tmp,&defList->bar.Bitmap ) ) return 1; - defList->bar.width=defList->bar.Bitmap.Width; - defList->bar.height=defList->bar.Bitmap.Height; + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] width: %d height: %d\n", defList->menuBase.width, defList->menuBase.height); + } + + if (!strcmp(window_name, "playbar")) { + defList->barIsPresent = 1; + defList->bar.x = x; + defList->bar.y = y; + defList->bar.type = itBase; + + av_strlcpy(tmp, path, sizeof(tmp)); + av_strlcat(tmp, fname, sizeof(tmp)); + + if (skinBPRead(tmp, &defList->bar.Bitmap) != 0) + return 1; + + defList->bar.width = defList->bar.Bitmap.Width; + defList->bar.height = defList->bar.Bitmap.Height; + #ifdef CONFIG_XSHAPE - Convert32to1( &defList->bar.Bitmap,&defList->bar.Mask,0x00ff00ff ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->bar.Mask.Width,defList->bar.Mask.Height ); + Convert32to1(&defList->bar.Bitmap, &defList->bar.Mask, 0x00ff00ff); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] mask: %lux%lu\n", defList->bar.Mask.Width, defList->bar.Mask.Height); #else - defList->bar.Mask.Image=NULL; + defList->bar.Mask.Image = NULL; #endif - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->bar.width,defList->bar.height ); - } - return 0; + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] width: %d height: %d\n", defList->bar.width, defList->bar.height); + } + + return 0; } -static int cmd_background( char * in ) +// background=R,G,B +static int cmd_background(char *in) { - CHECKDEFLIST( "background" ); - CHECKWINLIST( "background" ); + CHECKDEFLIST("background"); + CHECKWINLIST("background"); + + CHECK("menu"); + CHECK("main"); - CHECK( "menu" ); - CHECK( "main" ); + currSection->R = cutItemToInt(in, ',', 0); + currSection->G = cutItemToInt(in, ',', 1); + currSection->B = cutItemToInt(in, ',', 2); - currSection->R=cutItemToInt( in,',',0 ); - currSection->G=cutItemToInt( in,',',1 ); - currSection->B=cutItemToInt( in,',',2 ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] background color is #%x%x%x.\n",currSection->R,currSection->G,currSection->B ); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] background color is #%x%x%x.\n", currSection->R, currSection->G, currSection->B); - return 0; + return 0; } -static int cmd_button( char * in ) +// button=image,x,y,width,height,message +static int cmd_button(char *in) { - unsigned char fname[512]; - unsigned char tmp[512]; - int x,y,sx,sy; - char msg[32]; - - CHECKDEFLIST( "button" ); - CHECKWINLIST( "button" ); - - CHECK( "sub" ); - CHECK( "menu" ); - - cutItem( in,fname,',',0 ); - x=cutItemToInt( in,',',1 ); - y=cutItemToInt( in,',',2 ); - sx=cutItemToInt( in,',',3 ); - sy=cutItemToInt( in,',',4 ); - cutItem( in,msg,',',5 ); - - (*currSubItem)++; - currSubItems[ *currSubItem ].type=itButton; - currSubItems[ *currSubItem ].x=x; - currSubItems[ *currSubItem ].y=y; - currSubItems[ *currSubItem ].width=sx; - currSubItems[ *currSubItem ].height=sy; - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] button: fname: %s\n",fname ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); - - if ( ( currSubItems[ *currSubItem ].msg=appFindMessage( msg ) ) == -1 ) - { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 0; } - currSubItems[ *currSubItem ].pressed=btnReleased; - if ( currSubItems[ *currSubItem ].msg == evPauseSwitchToPlay ) currSubItems[ *currSubItem ].pressed=btnDisabled; - currSubItems[ *currSubItem ].tmp=1; - - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",currSubItems[ *currSubItem ].msg ); - - currSubItems[ *currSubItem ].Bitmap.Image=NULL; - if ( strcmp( fname,"NULL" ) ) - { - av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp )); - if ( skinBPRead( tmp,&currSubItems[ *currSubItem ].Bitmap ) ) return 1; - } - - return 0; + unsigned char fname[512]; + unsigned char tmp[512]; + int x, y, sx, sy; + char msg[32]; + + CHECKDEFLIST("button"); + CHECKWINLIST("button"); + + CHECK("sub"); + CHECK("menu"); + + cutItem(in, fname, ',', 0); + x = cutItemToInt(in, ',', 1); + y = cutItemToInt(in, ',', 2); + sx = cutItemToInt(in, ',', 3); + sy = cutItemToInt(in, ',', 4); + cutItem(in, msg, ',', 5); + + (*currSubItem)++; + currSubItems[*currSubItem].type = itButton; + currSubItems[*currSubItem].x = x; + currSubItems[*currSubItem].y = y; + currSubItems[*currSubItem].width = sx; + currSubItems[*currSubItem].height = sy; + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] button: fname: %s\n", fname); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] x: %d y: %d sx: %d sy: %d\n", x, y, sx, sy); + + if ((currSubItems[*currSubItem].message = appFindMessage(msg)) == -1) { + ERRORMESSAGE(MSGTR_SKIN_BITMAP_UnknownMessage, msg); + return 0; + } + + currSubItems[*currSubItem].pressed = btnReleased; + + if (currSubItems[*currSubItem].message == evPauseSwitchToPlay) + currSubItems[*currSubItem].pressed = btnDisabled; + + currSubItems[*currSubItem].tmp = 1; + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %d\n", currSubItems[*currSubItem].message); + + currSubItems[*currSubItem].Bitmap.Image = NULL; + + if (strcmp(fname, "NULL") != 0) { + av_strlcpy(tmp, path, sizeof(tmp)); + av_strlcat(tmp, fname, sizeof(tmp)); + + if (skinBPRead(tmp, &currSubItems[*currSubItem].Bitmap) != 0) + return 1; + } + + return 0; } -static int cmd_selected( char * in ) +// selected=image +static int cmd_selected(char *in) { - unsigned char fname[512]; - unsigned char tmp[512]; - - CHECKDEFLIST( "selected" ); - CHECKWINLIST( "selected" ); - - CHECK( "main" ); - CHECK( "sub" ); - CHECK( "playbar" ); - - cutItem( in,fname,',',0 ); - defList->menuSelected.type=itBase; - av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp )); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] selected: %s\n",fname ); - if ( skinBPRead( tmp,&defList->menuSelected.Bitmap ) ) return 1; - defList->menuSelected.width=defList->menuSelected.Bitmap.Width; - defList->menuSelected.height=defList->menuSelected.Bitmap.Height; - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuSelected.width,defList->menuSelected.height ); - return 0; -} + unsigned char fname[512]; + unsigned char tmp[512]; -static int cmd_menu( char * in ) -{ // menu = number,x,y,sx,sy,msg - int x,y,sx,sy,msg; - unsigned char tmp[64]; + CHECKDEFLIST("selected"); + CHECKWINLIST("selected"); - CHECKDEFLIST( "menu" ); - CHECKWINLIST( "menu" ); + CHECK("main"); + CHECK("sub"); + CHECK("playbar"); - CHECK( "main" ); - CHECK( "sub" ); - CHECK( "playbar" ); + cutItem(in, fname, ',', 0); - x=cutItemToInt( in,',',0 ); - y=cutItemToInt( in,',',1 ); - sx=cutItemToInt( in,',',2 ); - sy=cutItemToInt( in,',',3 ); - cutItem( in,tmp,',',4 ); msg=appFindMessage( tmp ); + defList->menuSelected.type = itBase; - defList->NumberOfMenuItems++; - defList->MenuItems[ defList->NumberOfMenuItems ].x=x; - defList->MenuItems[ defList->NumberOfMenuItems ].y=y; - defList->MenuItems[ defList->NumberOfMenuItems ].width=sx; - defList->MenuItems[ defList->NumberOfMenuItems ].height=sy; + av_strlcpy(tmp, path, sizeof(tmp)); + av_strlcat(tmp, fname, sizeof(tmp)); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] menuitem: %d\n",defList->NumberOfMenuItems ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] selected: %s\n", fname); - if ( ( defList->MenuItems[ defList->NumberOfMenuItems ].msg=msg ) == -1 ) - ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,tmp ); + if (skinBPRead(tmp, &defList->menuSelected.Bitmap) != 0) + return 1; - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg ); + defList->menuSelected.width = defList->menuSelected.Bitmap.Width; + defList->menuSelected.height = defList->menuSelected.Bitmap.Height; - defList->MenuItems[ defList->NumberOfMenuItems ].Bitmap.Image=NULL; - return 0; + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] width: %d height: %d\n", defList->menuSelected.width, defList->menuSelected.height); + + return 0; } -static int cmd_hpotmeter( char * in ) -{ // hpotmeter=buttonbitmaps,sx,sy,phasebitmaps,phases,default value,x,y,sx,sy,msg - int x,y,psx,psy,ph,sx,sy,msg,d; - unsigned char tmp[512]; - unsigned char pfname[512]; - unsigned char phfname[512]; - wItem * item; - - CHECKDEFLIST( "hpotmeter" ); - CHECKWINLIST( "hpotmeter" ); - - CHECK( "sub" ); - CHECK( "menu" ); - - cutItem( in,pfname,',',0 ); - psx=cutItemToInt( in,',',1 ); - psy=cutItemToInt( in,',',2 ); - cutItem( in,phfname,',',3 ); - ph=cutItemToInt( in,',',4 ); - d=cutItemToInt( in,',',5 ); - x=cutItemToInt( in,',',6 ); - y=cutItemToInt( in,',',7 ); - sx=cutItemToInt( in,',',8 ); - sy=cutItemToInt( in,',',9 ); - cutItem( in,tmp,',',10 ); msg=appFindMessage( tmp ); - - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] h/v potmeter: pointer filename: '%s'\n",pfname ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pointer size is %dx%d\n",psx,psy ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phasebitmaps filename: '%s'\n",phfname ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg ); - - (*currSubItem)++; - item=&currSubItems[ *currSubItem ]; - - item->type=itHPotmeter; - item->x=x; item->y=y; item->width=sx; item->height=sy; - item->phases=ph; - item->psx=psx; item->psy=psy; - item->msg=msg; - item->value=(float)d; - item->pressed=btnReleased; - - item->Bitmap.Image=NULL; - if ( strcmp( phfname,"NULL" ) ) - { - av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, phfname, sizeof( tmp )); - if ( skinBPRead( tmp,&item->Bitmap ) ) return 1; - } - - item->Mask.Image=NULL; - if ( strcmp( pfname,"NULL" ) ) - { - av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, pfname, sizeof( tmp )); - if ( skinBPRead( tmp,&item->Mask ) ) return 1; - } - return 0; +// menu=x,y,width,height,message +static int cmd_menu(char *in) +{ + int x, y, sx, sy, message; + unsigned char tmp[64]; + + CHECKDEFLIST("menu"); + CHECKWINLIST("menu"); + + CHECK("main"); + CHECK("sub"); + CHECK("playbar"); + + x = cutItemToInt(in, ',', 0); + y = cutItemToInt(in, ',', 1); + sx = cutItemToInt(in, ',', 2); + sy = cutItemToInt(in, ',', 3); + cutItem(in, tmp, ',', 4); + + message = appFindMessage(tmp); + + defList->IndexOfMenuItems++; + defList->menuItems[defList->IndexOfMenuItems].x = x; + defList->menuItems[defList->IndexOfMenuItems].y = y; + defList->menuItems[defList->IndexOfMenuItems].width = sx; + defList->menuItems[defList->IndexOfMenuItems].height = sy; + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] menuitem: %d\n", defList->IndexOfMenuItems); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] x: %d y: %d sx: %d sy: %d\n", x, y, sx, sy); + + if ((defList->menuItems[defList->IndexOfMenuItems].message = message) == -1) + ERRORMESSAGE(MSGTR_SKIN_BITMAP_UnknownMessage, tmp); + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %d\n", defList->mainItems[defList->IndexOfMainItems].message); + + defList->menuItems[defList->IndexOfMenuItems].Bitmap.Image = NULL; + return 0; } -static int cmd_vpotmeter( char * in ) +// hpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message +static int cmd_hpotmeter(char *in) { - int r = cmd_hpotmeter( in ); - wItem * item; + int x, y, pwidth, pheight, ph, sx, sy, message, d; + unsigned char tmp[512]; + unsigned char pfname[512]; + unsigned char phfname[512]; + wItem *item; + + CHECKDEFLIST("hpotmeter"); + CHECKWINLIST("hpotmeter"); + + CHECK("sub"); + CHECK("menu"); + + cutItem(in, pfname, ',', 0); + pwidth = cutItemToInt(in, ',', 1); + pheight = cutItemToInt(in, ',', 2); + cutItem(in, phfname, ',', 3); + ph = cutItemToInt(in, ',', 4); + d = cutItemToInt(in, ',', 5); + x = cutItemToInt(in, ',', 6); + y = cutItemToInt(in, ',', 7); + sx = cutItemToInt(in, ',', 8); + sy = cutItemToInt(in, ',', 9); + cutItem(in, tmp, ',', 10); + + message = appFindMessage(tmp); + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] h/v potmeter: pointer filename: '%s'\n", pfname); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] pointer size is %dx%d\n", pwidth, pheight); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] phasebitmaps filename: '%s'\n", phfname); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] position: %d,%d %dx%d\n", x, y, sx, sy); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] default value: %d\n", d); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %d\n", message); + + (*currSubItem)++; + item = &currSubItems[*currSubItem]; + item->type = itHPotmeter; + item->x = x; + item->y = y; + item->width = sx; + item->height = sy; + item->numphases = ph; + item->pwidth = pwidth; + item->pheight = pheight; + item->message = message; + item->value = (float)d; + item->pressed = btnReleased; + item->Bitmap.Image = NULL; + + if (strcmp(phfname, "NULL") != 0) { + av_strlcpy(tmp, path, sizeof(tmp)); + av_strlcat(tmp, phfname, sizeof(tmp)); + + if (skinBPRead(tmp, &item->Bitmap) != 0) + return 1; + } + + item->Mask.Image = NULL; + + if (strcmp(pfname, "NULL") != 0) { + av_strlcpy(tmp, path, sizeof(tmp)); + av_strlcat(tmp, pfname, sizeof(tmp)); - item=&currSubItems[ *currSubItem ]; - item->type=itVPotmeter; - return r; + if (skinBPRead(tmp, &item->Mask) != 0) + return 1; + } + + return 0; } -static int cmd_potmeter( char * in ) -{ // potmeter=phasebitmaps,phases,default value,x,y,sx,sy,msg - int x,y,ph,sx,sy,msg,d; - unsigned char tmp[512]; - unsigned char phfname[512]; - wItem * item; - - CHECKDEFLIST( "potmeter" ); - CHECKWINLIST( "potmeter" ); - - CHECK( "sub" ); - CHECK( "menu" ); - - cutItem( in,phfname,',',0 ); - ph=cutItemToInt( in,',',1 ); - d=cutItemToInt( in,',',2 ); - x=cutItemToInt( in,',',3 ); - y=cutItemToInt( in,',',4 ); - sx=cutItemToInt( in,',',5 ); - sy=cutItemToInt( in,',',6 ); - cutItem( in,tmp,',',7 ); msg=appFindMessage( tmp ); - - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] potmeter: phases filename: '%s'\n",phfname ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phases: %d\n",ph ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg ); - - (*currSubItem)++; - item=&currSubItems[ *currSubItem ]; - - item->type=itPotmeter; - item->x=x; item->y=y; - item->width=sx; item->height=sy; - item->phases=ph; - item->msg=msg; - item->value=(float)d; - - item->Bitmap.Image=NULL; - if ( strcmp( phfname,"NULL" ) ) - { - av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, phfname, sizeof( tmp )); - if ( skinBPRead( tmp,&item->Bitmap ) ) return 1; - } - return 0; +// vpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message +static int cmd_vpotmeter(char *in) +{ + int r = cmd_hpotmeter(in); + wItem *item; + + item = &currSubItems[*currSubItem]; + item->type = itVPotmeter; + return r; } -static int cmd_font( char * in ) -{ // font=fontname,fontid - char name[512]; - char id[512]; - wItem * item; - - CHECKDEFLIST( "font" ); - CHECKWINLIST( "font" ); - - CHECK( "sub" ); - CHECK( "menu" ); - - cutItem( in,name,',',0 ); - cutItem( in,id,',',1 ); - - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] font\n" ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] name: %s\n",name ); - - (*currSubItem)++; - item=&currSubItems[ *currSubItem ]; - - item->type=itFont; - item->fontid=fntRead( path,name ); - switch ( item->fontid ) - { - case -1: ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; - case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_TooManyFontsDeclared ); return 1; - case -3: ERRORMESSAGE( MSGTR_SKIN_FONT_FontFileNotFound ); return 1; - case -4: ERRORMESSAGE( MSGTR_SKIN_FONT_FontImageNotFound ); return 1; - } - return 0; +// potmeter=phases,numphases,default,x,y,width,height,message +static int cmd_potmeter(char *in) +{ + int x, y, ph, sx, sy, message, d; + unsigned char tmp[512]; + unsigned char phfname[512]; + wItem *item; + + CHECKDEFLIST("potmeter"); + CHECKWINLIST("potmeter"); + + CHECK("sub"); + CHECK("menu"); + + cutItem(in, phfname, ',', 0); + ph = cutItemToInt(in, ',', 1); + d = cutItemToInt(in, ',', 2); + x = cutItemToInt(in, ',', 3); + y = cutItemToInt(in, ',', 4); + sx = cutItemToInt(in, ',', 5); + sy = cutItemToInt(in, ',', 6); + cutItem(in, tmp, ',', 7); + + message = appFindMessage(tmp); + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] potmeter: phases filename: '%s'\n", phfname); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] position: %d,%d %dx%d\n", x, y, sx, sy); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] numphases: %d\n", ph); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] default value: %d\n", d); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %d\n", message); + + (*currSubItem)++; + item = &currSubItems[*currSubItem]; + item->type = itPotmeter; + item->x = x; + item->y = y; + item->width = sx; + item->height = sy; + item->numphases = ph; + item->message = message; + item->value = (float)d; + item->Bitmap.Image = NULL; + + if (strcmp(phfname, "NULL") != 0) { + av_strlcpy(tmp, path, sizeof(tmp)); + av_strlcat(tmp, phfname, sizeof(tmp)); + + if (skinBPRead(tmp, &item->Bitmap) != 0) + return 1; + } + + return 0; } -static int cmd_slabel( char * in ) +// font=fontfile +static int cmd_font(char *in) { - char tmp[512]; - char sid[63]; - int x,y,id; - wItem * item; + char name[512]; + wItem *item; + + CHECKDEFLIST("font"); + CHECKWINLIST("font"); - CHECKDEFLIST( "slabel" ); - CHECKWINLIST( "slabel" ); + CHECK("sub"); + CHECK("menu"); - CHECK( "sub" ); - CHECK( "menu" ); + cutItem(in, name, ',', 0); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] slabel\n" ); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] font\n"); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] name: %s\n", name); - x=cutItemToInt( in,',',0 ); - y=cutItemToInt( in,',',1 ); - cutItem( in,sid,',',2 ); id=fntFindID( sid ); - if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; } - cutItem( in,tmp,',',3 ); cutItem( tmp,tmp,'"',1 ); + (*currSubItem)++; + item = &currSubItems[*currSubItem]; + item->type = itFont; + item->fontid = fntRead(path, name); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d\n",x,y ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp ); + switch (item->fontid) { + case -1: + ERRORMESSAGE(MSGTR_SKIN_FONT_NotEnoughtMemory); + return 1; - (*currSubItem)++; - item=&currSubItems[ *currSubItem ]; + case -2: + ERRORMESSAGE(MSGTR_SKIN_FONT_TooManyFontsDeclared); + return 1; - item->type=itSLabel; - item->fontid=id; - item->x=x; item->y=y; - item->width=-1; item->height=-1; - if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; } - strcpy( item->label,tmp ); + case -3: + ERRORMESSAGE(MSGTR_SKIN_FONT_FontFileNotFound); + return 1; + + case -4: + ERRORMESSAGE(MSGTR_SKIN_FONT_FontImageNotFound); + return 1; + } - return 0; + return 0; } -static int cmd_dlabel( char * in ) -{ // dlabel=x,y,sx,align,fontid,string ... - char tmp[512]; - char sid[63]; - int x,y,sx,id,a; - wItem * item; +// slabel=x,y,fontfile,"text" +static int cmd_slabel(char *in) +{ + char tmp[512]; + char sid[64]; + int x, y, id; + wItem *item; - CHECKDEFLIST( "dlabel" ); - CHECKWINLIST( "dlabel" ); + CHECKDEFLIST("slabel"); + CHECKWINLIST("slabel"); - CHECK( "sub" ); - CHECK( "menu" ); + CHECK("sub"); + CHECK("menu"); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] dlabel\n" ); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] slabel\n"); - x=cutItemToInt( in,',',0 ); - y=cutItemToInt( in,',',1 ); - sx=cutItemToInt( in,',',2 ); - a=cutItemToInt( in,',',3 ); - cutItem( in,sid,',',4 ); id=fntFindID( sid ); - if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; } - cutItem( in,tmp,',',5 ); cutItem( tmp,tmp,'"',1 ); + x = cutItemToInt(in, ',', 0); + y = cutItemToInt(in, ',', 1); + cutItem(in, sid, ',', 2); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d width: %d align: %d\n",x,y,sx,a ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp ); + id = fntFindID(sid); - (*currSubItem)++; - item=&currSubItems[ *currSubItem ]; + if (id < 0) { + ERRORMESSAGE(MSGTR_SKIN_FONT_NonExistentFontID, sid); + return 1; + } - item->type=itDLabel; - item->fontid=id; item->align=a; - item->x=x; item->y=y; - item->width=sx; item->height=-1; - if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; } - strcpy( item->label,tmp ); + cutItem(in, tmp, ',', 3); + cutItem(tmp, tmp, '"', 1); + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] pos: %d,%d\n", x, y); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] id: %s ( %d )\n", sid, id); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] str: '%s'\n", tmp); + + (*currSubItem)++; + item = &currSubItems[*currSubItem]; + item->type = itSLabel; + item->fontid = id; + item->x = x; + item->y = y; + item->width = -1; + item->height = -1; + + if ((item->label = malloc(strlen(tmp) + 1)) == NULL) { + ERRORMESSAGE(MSGTR_SKIN_FONT_NotEnoughtMemory); + return 1; + } - return 0; + strcpy(item->label, tmp); + + return 0; } -static int cmd_decoration( char * in ) +// dlabel=x,y,width,align,fontfile,"text" +static int cmd_dlabel(char *in) { - char tmp[512]; + char tmp[512]; + char sid[64]; + int x, y, sx, id, a; + wItem *item; + + CHECKDEFLIST("dlabel"); + CHECKWINLIST("dlabel"); - CHECKDEFLIST( "decoration" ); - CHECKWINLIST( "decoration" ); + CHECK("sub"); + CHECK("menu"); - CHECK( "sub" ); - CHECK( "menu" ); - CHECK( "playbar" ); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] dlabel\n"); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",in ); - strlower( in ); - cutItem( in,tmp,',',0 ); - if ( strcmp( tmp,"enable" )&&strcmp( tmp,"disable" ) ) { ERRORMESSAGE( MSGTR_SKIN_UnknownParameter,tmp ); return 1; } - if ( strcmp( tmp,"enable" ) ) defList->mainDecoration=0; - else defList->mainDecoration=1; + x = cutItemToInt(in, ',', 0); + y = cutItemToInt(in, ',', 1); + sx = cutItemToInt(in, ',', 2); + a = cutItemToInt(in, ',', 3); + cutItem(in, sid, ',', 4); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",(defList->mainDecoration?"enabled":"disabled") ); - return 0; + id = fntFindID(sid); + + if (id < 0) { + ERRORMESSAGE(MSGTR_SKIN_FONT_NonExistentFontID, sid); + return 1; + } + + cutItem(in, tmp, ',', 5); + cutItem(tmp, tmp, '"', 1); + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] pos: %d,%d width: %d align: %d\n", x, y, sx, a); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] id: %s ( %d )\n", sid, id); + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] str: '%s'\n", tmp); + + (*currSubItem)++; + item = &currSubItems[*currSubItem]; + item->type = itDLabel; + item->fontid = id; + item->align = a; + item->x = x; + item->y = y; + item->width = sx; + item->height = -1; + + if ((item->label = malloc(strlen(tmp) + 1)) == NULL) { + ERRORMESSAGE(MSGTR_SKIN_FONT_NotEnoughtMemory); + return 1; + } + + strcpy(item->label, tmp); + + return 0; } -typedef struct +// decoration=enable|disable +static int cmd_decoration(char *in) { - const char * name; - int (*func)( char * in ); -} _item; + char tmp[512]; -_item skinItem[] = - { - { "section", cmd_section }, - { "end", cmd_end }, - { "window", cmd_window }, - { "base", cmd_base }, - { "button", cmd_button }, - { "selected", cmd_selected }, - { "background", cmd_background }, - { "vpotmeter", cmd_vpotmeter }, - { "hpotmeter", cmd_hpotmeter }, - { "potmeter", cmd_potmeter }, - { "font", cmd_font }, - { "slabel", cmd_slabel }, - { "dlabel", cmd_dlabel }, - { "decoration", cmd_decoration }, - { "menu", cmd_menu } - }; - -#define ITEMS (int)( sizeof( skinItem )/sizeof( _item ) ) - -char * trimleft( char * in ) -{ - int c = 0; - char * out; - if ( strlen( in ) == 0 ) return NULL; - while ( in[c] == ' ' ) c++; - if ( c != 0 ) - { - out=malloc( strlen( in ) - c + 1 ); - memcpy( out,&in[c],strlen( in ) - c + 1 ); - } - else out=in; - return out; + CHECKDEFLIST("decoration"); + CHECKWINLIST("decoration"); + + CHECK("sub"); + CHECK("menu"); + CHECK("playbar"); + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] window decoration is %s\n", in); + + strlower(in); + cutItem(in, tmp, ',', 0); + + if (strcmp(tmp, "enable") != 0 && strcmp(tmp, "disable") != 0) { + ERRORMESSAGE(MSGTR_SKIN_UnknownParameter, tmp); + return 1; + } + + if (strcmp(tmp, "enable") != 0) + defList->mainDecoration = 0; + else + defList->mainDecoration = 1; + + mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] window decoration is %s\n", (defList->mainDecoration ? "enabled" : "disabled")); + + return 0; } -char * strswap( char * in,char what,char whereof ) +static _item skinItem[] = { + { "section", cmd_section }, + { "end", cmd_end }, + { "window", cmd_window }, + { "base", cmd_base }, + { "button", cmd_button }, + { "selected", cmd_selected }, + { "background", cmd_background }, + { "vpotmeter", cmd_vpotmeter }, + { "hpotmeter", cmd_hpotmeter }, + { "potmeter", cmd_potmeter }, + { "font", cmd_font }, + { "slabel", cmd_slabel }, + { "dlabel", cmd_dlabel }, + { "decoration", cmd_decoration }, + { "menu", cmd_menu } +}; + +static const int ITEMS = sizeof(skinItem) / sizeof(_item); + +char *strswap(char *in, char what, char whereof) { - int i; - if ( strlen( in ) == 0 ) return NULL; - for ( i=0;i<(int)strlen( in );i++ ) - if ( in[i] == what ) in[i]=whereof; - return in; + int i; + + if (strlen(in) == 0) + return NULL; + + for (i = 0; i < (int)strlen(in); i++) + if (in[i] == what) + in[i] = whereof; + + return in; } -char * trim( char * in ) +char *trim(char *in) { - int c = 0,i = 0,id = 0; - if ( strlen( in ) == 0 ) return NULL; - while ( c != (int)strlen( in ) ) - { - if ( in[c] == '"' ) id=!id; - if ( ( in[c] == ' ' )&&( !id ) ) - { - for ( i=0;i<(int)strlen( in ) - c; i++ ) in[c+i]=in[c+i+1]; - continue; + int c = 0, id = 0, i; + + if (strlen(in) == 0) + return NULL; + + while (c != (int)strlen(in)) { + if (in[c] == '"') + id = !id; + + if ((in[c] == ' ') && (!id)) { + for (i = 0; i < (int)strlen(in) - c; i++) + in[c + i] = in[c + i + 1]; + continue; + } + + c++; } - c++; - } - return in; -} -FILE * skinFile; + return in; +} -static void setname( char * item1, char * item2 ) +static char *setname(char *item1, char *item2) { - av_strlcpy(fn, item1, sizeof( fn )); - av_strlcat(fn, "/", sizeof( fn )); av_strlcat(fn, item2, sizeof( fn )); - av_strlcpy(path, fn, sizeof( path )); av_strlcat(path, "/", sizeof( path )); - av_strlcat(fn, "/skin", sizeof( fn )); + static char fn[512]; + + av_strlcpy(fn, item1, sizeof(fn)); + av_strlcat(fn, "/", sizeof(fn)); + av_strlcat(fn, item2, sizeof(fn)); + av_strlcpy(path, fn, sizeof(path)); + av_strlcat(path, "/", sizeof(path)); + av_strlcat(fn, "/skin", sizeof(fn)); + + return fn; } -int skinRead( char * dname ) +int skinRead(char *dname) { - unsigned char tmp[255]; - unsigned char * ptmp; - unsigned char command[32]; - unsigned char param[256]; - int c,i; - - setname( skinDirInHome,dname ); - if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) - { - setname( skinMPlayerDir,dname ); - if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) - { - setname( skinDirInHome_obsolete,dname ); - if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) - { - setname( skinMPlayerDir_obsolete,dname ); - if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) - { - setname( skinMPlayerDir,dname ); - mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_SkinFileNotFound,fn ); - return -1; + char *fn; + FILE *skinFile; + unsigned char tmp[256]; + unsigned char *ptmp; + unsigned char command[32]; + unsigned char param[256]; + int i; + + fn = setname(skinDirInHome, dname); + + if ((skinFile = fopen(fn, "rt")) == NULL) { + fn = setname(skinMPlayerDir, dname); + + if ((skinFile = fopen(fn, "rt")) == NULL) { + mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_SKIN_SkinFileNotFound, fn); + return -1; } - } } - } - - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] file: %s\n",fn ); - - appInitStruct( skinAppMPlayer ); - - linenumber=0; - while (fgets(tmp, 255, skinFile)) - { - linenumber++; - - // remove any kind of newline, if any - tmp[strcspn(tmp, "\n\r")] = 0; - for ( c=0;c<(int)strlen( tmp );c++ ) - if ( tmp[c] == ';' ) - { - tmp[c]=0; - break; - } - if ( strlen( tmp ) == 0 ) continue; - ptmp=trimleft( tmp ); - if ( strlen( ptmp ) == 0 ) continue; - ptmp=strswap( ptmp,'\t',' ' ); - ptmp=trim( ptmp ); - - cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 ); - strlower( command ); - for( i=0;ixImage->bits_per_pixel) { case 32: { - uint32_t *d = win->ImageData; + uint32_t *d = (uint32_t *) win->ImageData; for (i = 0; i < win->xImage->width * win->xImage->height; i++) d[i] = bswap_32(d[i]); break; @@ -847,7 +847,7 @@ void wsConvert( wsTWindow * win,unsigned char * Image,unsigned int Size ) case 16: case 15: { - uint16_t *d = win->ImageData; + uint16_t *d = (uint16_t *) win->ImageData; for (i = 0; i < win->xImage->width * win->xImage->height; i++) d[i] = bswap_16(d[i]); break; diff --git a/mplayer/help/help_mp-bg.h b/mplayer/help/help_mp-bg.h index 25c9aab8..ea1e9303 100644 --- a/mplayer/help/help_mp-bg.h +++ b/mplayer/help/help_mp-bg.h @@ -119,7 +119,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Наложен аудио кодек: %s\n" #define MSGTR_Video_NoVideo "Видео: няма видео\n" #define MSGTR_NotInitializeVOPorVO "\nФАТАЛНО: Видео филтъра (-vf) или изхода (-vo) не могат да бъдат инициализирани.\n" -#define MSGTR_Paused "\n ===== ПАУЗА =====\r" // no more than 23 characters (status line for audio files) +#define MSGTR_Paused " ===== ПАУЗА =====" // no more than 23 characters (status line for audio files) #define MSGTR_PlaylistLoadUnable "\nPlaylist-ът не може да бъде зареден %s.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer катастрофира заради 'Невалидна инструкция'.\n"\ diff --git a/mplayer/help/help_mp-cs.h b/mplayer/help/help_mp-cs.h index 5ac9d332..3a9e266a 100644 --- a/mplayer/help/help_mp-cs.h +++ b/mplayer/help/help_mp-cs.h @@ -118,7 +118,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Vynucen audio kodek: %s\n" #define MSGTR_Video_NoVideo "Video: Žádné video\n" #define MSGTR_NotInitializeVOPorVO "\nKritická chyba: Nemohu inicializovat video filtry (-vf) nebo video výstup (-vo)!\n" -#define MSGTR_Paused "\n===== POZASTAVENO =====\r" +#define MSGTR_Paused "===== POZASTAVENO =====" #define MSGTR_PlaylistLoadUnable "\nNemohu načíst playlist %s.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer havaroval kvůli 'Illegal Instruction'.\n"\ @@ -190,7 +190,6 @@ static const char help_text[]= #define MSGTR_EdloutBadStop "EDL: Vynechání zrušeno, poslední start > stop\n" #define MSGTR_EdloutStartSkip "EDL: Začátek vynechaného bloku, stiskněte znovu 'i' pro ukončení bloku.\n" #define MSGTR_EdloutEndSkip "EDL: Konec vynechaného bloku, řádek zapsán.\n" -#define MSGTR_MPEndposNoSizeBased "Volba -endpos v MPlayeru zatím nepodporuje rozměrové jednotky.\n" // mplayer.c OSD #define MSGTR_OSDenabled "zapnuto" @@ -564,9 +563,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[témata] chyba v konfiguračním souboru témat na řádce %d: %s" -#define MSGTR_SKIN_WARNING1 "[témata] varování v konfiguračním souboru témat na řádce %d:\nwidget nalezen ale před ním nebyla nalezena žádná \"section\" (%s)" -#define MSGTR_SKIN_WARNING2 "[témata] varování v konfiguračním souboru témat na řádce %d:\nwidget nalezen ale před ním nebyla nalezena žádná \"subsection\" (%s)" -#define MSGTR_SKIN_WARNING3 "[témata] varování v konfiguračním souboru témat na řádce %d:\nwidget (%s) nepodporuje tuto subsekci" #define MSGTR_SKIN_SkinFileNotFound "[témata] soubor ( %s ) nenalezen.\n" #define MSGTR_SKIN_SkinFileNotReadable "[témata] soubor ( %s ) nelze přečíst.\n" #define MSGTR_SKIN_BITMAP_16bit "Bitmapy s hloubkou 16 bitů a méně nejsou podporovány (%s).\n" diff --git a/mplayer/help/help_mp-de.h b/mplayer/help/help_mp-de.h index aea9feb9..b6d5fc0e 100644 --- a/mplayer/help/help_mp-de.h +++ b/mplayer/help/help_mp-de.h @@ -131,7 +131,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Erzwungener Audiocodec: %s\n" #define MSGTR_Video_NoVideo "Video: kein Video\n" #define MSGTR_NotInitializeVOPorVO "\nFATAL: Konnte Videofilter (-vf) oder -ausgabetreiber (-vo) nicht initialisieren.\n" -#define MSGTR_Paused "\n ===== PAUSE =====\r" +#define MSGTR_Paused " ===== PAUSE =====" #define MSGTR_PlaylistLoadUnable "\nKann Playlist %s nicht laden.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer stürzte aufgrund einer 'ungültigen Anweisung' ab.\n"\ @@ -207,7 +207,6 @@ static const char help_text[]= #define MSGTR_EdloutBadStop "EDL-Sprung abgebrochen, letzter Start > Stop\n" #define MSGTR_EdloutStartSkip "EDL-Sprung begonnen, drücke 'i' erneut, um den Block zu beenden.\n" #define MSGTR_EdloutEndSkip "EDL-Sprung beendet, Zeile geschrieben.\n" -#define MSGTR_MPEndposNoSizeBased "Die Option -endpos unterstützt für MPlayer noch keine Größenangaben.\n" // mplayer.c OSD #define MSGTR_OSDenabled "aktiviert" @@ -773,12 +772,12 @@ static const char help_text[]= #define MSGTR_UNKNOWNWINDOWTYPE "Unbekannten Fenstertyp gefunden ..." // --- skin loader error messages -#define MSGTR_SKIN_ERRORMESSAGE "[Skin] Fehler in Skin-Konfigurationsdatei in Zeile %d: %s" -#define MSGTR_SKIN_WARNING1 "[Skin] Warnung: in Skin-Konfigurationsdatei in Zeile %d:\nWidget (%s) gefunden, aber davor wurde \"section\" nicht gefunden" -#define MSGTR_SKIN_WARNING2 "[Skin] Warnung: in Skin-Konfigurationsdatei in Zeile %d:\nWidget (%s) gefunden, aber davor wurde \"subsection\" nicht gefunden." -#define MSGTR_SKIN_WARNING3 "[skin] Warnung: in Skin-Konfigurationsdatei in Zeile %d:\nDiese Untersektion wird vom Widget nicht unterstützt (%s)." -#define MSGTR_SKIN_SkinFileNotFound "[skin] Datei ( %s ) nicht gefunden.\n" -#define MSGTR_SKIN_SkinFileNotReadable "[skin] Datei ( %s ) nicht lesbar.\n" +#define MSGTR_SKIN_ERRORMESSAGE "Fehler in Skin-Konfigurationsdatei in Zeile %d: %s" +#define MSGTR_SKIN_ERROR_SECTION "Für '%s' wurde kein Abschnitt angegeben.\n" +#define MSGTR_SKIN_ERROR_WINDOW "Für '%s' wurde kein Fenster angegeben.\n" +#define MSGTR_SKIN_ERROR_IN_WINDOW "Dieses Element wird in '%s' nicht unterstützt.\n" +#define MSGTR_SKIN_SkinFileNotFound "Skin-Datei %s nicht gefunden.\n" +#define MSGTR_SKIN_SkinFileNotReadable "Skin-Datei %s nicht lesbar.\n" #define MSGTR_SKIN_BITMAP_16bit "Bitmaps mit 16 Bits oder weniger werden nicht unterstützt (%s).\n" #define MSGTR_SKIN_BITMAP_FileNotFound "Datei nicht gefunden (%s)\n" #define MSGTR_SKIN_BITMAP_BMPReadError "BMP-Lesefehler (%s)\n" @@ -795,7 +794,7 @@ static const char help_text[]= #define MSGTR_SKIN_FONT_NonExistentFontID "nicht existierende Schriftbezeichnung (%s)\n" #define MSGTR_SKIN_UnknownParameter "unbekannter Parameter (%s)\n" #define MSGTR_SKIN_SKINCFG_SkinNotFound "Skin nicht gefunden (%s).\n" -#define MSGTR_SKIN_SKINCFG_SelectedSkinNotFound "Ausgewähltes Skin ( %s ) wurde nicht gefunden, versuche 'Standard'...\n" +#define MSGTR_SKIN_SKINCFG_SelectedSkinNotFound "Ausgewähltes Skin '%s' nicht gefunden, Skin 'default' wird versucht ...\n" #define MSGTR_SKIN_SKINCFG_SkinCfgReadError "Skin-Konfigurationsdatei: Lesefehler (%s)\n" #define MSGTR_SKIN_LABEL "Skins:" @@ -2175,7 +2174,7 @@ static const char help_text[]= #define MSGTR_TVI_DS_UnableTerminateVPPin "tvi_dshow: Kann VideoPort-Pin mit keinem Filter des Graphen terminieren. Fehler:0x%x\n" #define MSGTR_TVI_DS_UnableBuildVideoSubGraph "tvi_dshow: Kann Videokette des Capture-Graphen nicht erstellen. Fehler:0x%x\n" #define MSGTR_TVI_DS_UnableBuildAudioSubGraph "tvi_dshow: Kann Audiokette des Capture-Graphen nicht erstellen. Fehler:0x%x\n" -#define MSGTR_TVI_DS_UnableBuildVBISubGraph "tvi_dshow: Kann VBI-Kette des Capture-Graphen nicht erstellen. Fehler:0x%x\n"" +#define MSGTR_TVI_DS_UnableBuildVBISubGraph "tvi_dshow: Kann VBI-Kette des Capture-Graphen nicht erstellen. Fehler:0x%x\n" #define MSGTR_TVI_DS_GraphInitFailure "tvi_dshow: Initialisierung des Directshow-Graph fehlgeschlagen.\n" #define MSGTR_TVI_DS_NoVideoCaptureDevice "tvi_dshow: Kein Gerät für Videoerfassung gefunden\n" #define MSGTR_TVI_DS_NoAudioCaptureDevice "tvi_dshow: Kein Gerät für Audioerfassung gefunden\n" diff --git a/mplayer/help/help_mp-dk.h b/mplayer/help/help_mp-dk.h index b47727c0..8ba81798 100644 --- a/mplayer/help/help_mp-dk.h +++ b/mplayer/help/help_mp-dk.h @@ -118,7 +118,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Gennemtvunget lyd-codec: %s\n" #define MSGTR_Video_NoVideo "Video: ingen video\n" #define MSGTR_NotInitializeVOPorVO "\nFATALT: Kunne ikke initialisere videofiltre (-vf) eller videodriver (-vo)!\n" -#define MSGTR_Paused "\n ===== PAUSE =====\r" +#define MSGTR_Paused " ===== PAUSE =====" #define MSGTR_PlaylistLoadUnable "\nKunne ikke indlæse afspilningslisten %s\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer fik en alvorlig fejl af typen 'ulovlig instruktion'.\n"\ @@ -367,9 +367,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[tema] fejl i konfigurationsfilen til temaet på linje %d: %s" -#define MSGTR_SKIN_WARNING1 "[tema] advarsel i konfigurationsfilen til temaet på linje %d: widget fundet men før \"section\" ikke fundet (%s)" -#define MSGTR_SKIN_WARNING2 "[tema] advarsel i konfigurationsfilen til temaet på linje %d: widget fundet men før \"subsection\" ikke fundet (%s)" -#define MSGTR_SKIN_WARNING3 "[tema] advarsel i konfigurationsfilen til temaet på linje %d: denne undersektion er ikke understøttet af dette widget (%s)" #define MSGTR_SKIN_BITMAP_16bit "16 bits eller mindre ikke understøttet (%s).\n" #define MSGTR_SKIN_BITMAP_FileNotFound "filen ikke fundet (%s)\n" #define MSGTR_SKIN_BITMAP_BMPReadError "BMP læse fejl (%s)\n" diff --git a/mplayer/help/help_mp-el.h b/mplayer/help/help_mp-el.h index 949003dd..e4bb1cf6 100644 --- a/mplayer/help/help_mp-el.h +++ b/mplayer/help/help_mp-el.h @@ -116,7 +116,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Εξαναγκασμός χρήσης του codec ήχου: %s\n" #define MSGTR_Video_NoVideo "Βίντεο: δεν υπάρχει βίντεο!!!\n" #define MSGTR_NotInitializeVOPorVO "\n Σφάλμα: Αδύνατη η αρχικοποίηση του φίλτρου βίντεο (-vf) ή της εξόδου βίντεο (-vo)!\n" -#define MSGTR_Paused "\n ===== ΠΑΥΣΗ =====\r" +#define MSGTR_Paused " ===== ΠΑΥΣΗ =====" #define MSGTR_PlaylistLoadUnable "\n Αδύνατη η φόρτωση της λίστας αναπαραγωγής %s\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- Το MPlayer κατέρρευσε από ένα 'Illegal Instruction'.\n"\ @@ -376,9 +376,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[skin] σφάλμα στο αρχείο προτιμήσεων του skin στη γραμμή %d: %s" -#define MSGTR_SKIN_WARNING1 "[skin] προειδοποίηση στο αρχείο προτιμήσεων του skin στη γραμμή %d: το widget βρέθηκε αλλά πριν το \"section\" δεν βρέθηκε (%s)" -#define MSGTR_SKIN_WARNING2 "[skin] προειδοποίηση στο αρχείο προτιμήσεων του skin στη γραμμή %d: το widget βρέθηκε αλλά πριν το \"subsection\" δεν βρέθηκε (%s)" -#define MSGTR_SKIN_WARNING3 "[skin] προειδοποίηση στο αρχείο προτιμήσεων του skin στη γραμμή %d: αυτό το subsection δεν υποστηρίζεται από αυτό το widget (%s)" #define MSGTR_SKIN_BITMAP_16bit "το βάθος χρώματος εικόνας των 16 bits ή λιγότερο δεν υποστηρίζεται (%s).\n" #define MSGTR_SKIN_BITMAP_FileNotFound "το αρχείο (%s) δεν βρέθηκε\n" #define MSGTR_SKIN_BITMAP_BMPReadError "σφάλμα κατά την ανάγνωση του BMP (%s)\n" diff --git a/mplayer/help/help_mp-en.h b/mplayer/help/help_mp-en.h index 94304ffb..68b7deb9 100644 --- a/mplayer/help/help_mp-en.h +++ b/mplayer/help/help_mp-en.h @@ -1,4 +1,4 @@ -// $Revision: 32526 $ +// $Revision: 32964 $ // MASTER FILE. Use this file as base for translations. // Translated files should be sent to the mplayer-DOCS mailing list or // to the help messages maintainer, see DOCS/tech/MAINTAINERS. @@ -123,7 +123,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Forced audio codec: %s\n" #define MSGTR_Video_NoVideo "Video: no video\n" #define MSGTR_NotInitializeVOPorVO "\nFATAL: Could not initialize video filters (-vf) or video output (-vo).\n" -#define MSGTR_Paused "\n ===== PAUSE =====\r" // no more than 23 characters (status line for audio files) +#define MSGTR_Paused " ===== PAUSE =====" // no more than 23 characters (status line for audio files) #define MSGTR_PlaylistLoadUnable "\nUnable to load playlist %s.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer crashed by an 'Illegal Instruction'.\n"\ @@ -199,7 +199,6 @@ static const char help_text[]= #define MSGTR_EdloutBadStop "EDL skip canceled, last start > stop\n" #define MSGTR_EdloutStartSkip "EDL skip start, press 'i' again to end block.\n" #define MSGTR_EdloutEndSkip "EDL skip end, line written.\n" -#define MSGTR_MPEndposNoSizeBased "Option -endpos in MPlayer does not yet support size units.\n" // mplayer.c OSD #define MSGTR_OSDenabled "enabled" @@ -576,12 +575,12 @@ static const char help_text[]= #define MSGTR_UNKNOWNWINDOWTYPE "Unknown window type found ..." // --- skin loader error messages -#define MSGTR_SKIN_ERRORMESSAGE "[skin] error in skin config file on line %d: %s" -#define MSGTR_SKIN_WARNING1 "[skin] warning: in config file line %d:\nwidget (%s) found but no \"section\" found before" -#define MSGTR_SKIN_WARNING2 "[skin] warning: in config file line %d:\nwidget (%s) found but no \"subsection\" found before" -#define MSGTR_SKIN_WARNING3 "[skin] warning: in config file line %d:\nthis subsection is not supported by widget (%s)" -#define MSGTR_SKIN_SkinFileNotFound "[skin] file ( %s ) not found.\n" -#define MSGTR_SKIN_SkinFileNotReadable "[skin] file ( %s ) not readable.\n" +#define MSGTR_SKIN_ERRORMESSAGE "Error in skin config file on line %d: %s" +#define MSGTR_SKIN_ERROR_SECTION "No section specified for '%s'.\n" +#define MSGTR_SKIN_ERROR_WINDOW "No window specified for '%s'.\n" +#define MSGTR_SKIN_ERROR_IN_WINDOW "This item is not supported by '%s'.\n" +#define MSGTR_SKIN_SkinFileNotFound "Skin file %s not found.\n" +#define MSGTR_SKIN_SkinFileNotReadable "Skin file %s not readable.\n" #define MSGTR_SKIN_BITMAP_16bit "Bitmaps of 16 bits or less depth not supported (%s).\n" #define MSGTR_SKIN_BITMAP_FileNotFound "File not found (%s)\n" #define MSGTR_SKIN_BITMAP_BMPReadError "BMP read error (%s)\n" @@ -598,7 +597,7 @@ static const char help_text[]= #define MSGTR_SKIN_FONT_NonExistentFontID "non-existent font identifier (%s)\n" #define MSGTR_SKIN_UnknownParameter "unknown parameter (%s)\n" #define MSGTR_SKIN_SKINCFG_SkinNotFound "Skin not found (%s).\n" -#define MSGTR_SKIN_SKINCFG_SelectedSkinNotFound "Selected skin ( %s ) not found, trying 'default'...\n" +#define MSGTR_SKIN_SKINCFG_SelectedSkinNotFound "Selected skin '%s' not found, trying skin 'default'...\n" #define MSGTR_SKIN_SKINCFG_SkinCfgReadError "skin config file read error (%s)\n" #define MSGTR_SKIN_LABEL "Skins:" diff --git a/mplayer/help/help_mp-es.h b/mplayer/help/help_mp-es.h index d9843c13..7a5fa343 100644 --- a/mplayer/help/help_mp-es.h +++ b/mplayer/help/help_mp-es.h @@ -129,7 +129,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Codec de audio forzado: %s\n" #define MSGTR_Video_NoVideo "Vídeo: no hay video!\n" #define MSGTR_NotInitializeVOPorVO "\nFATAL: No fue posible inicializar los filtros (-vf) o la salida de video (-vo)!\n" -#define MSGTR_Paused "\n ===== PAUSA =====\r" +#define MSGTR_Paused " ===== PAUSA =====" #define MSGTR_PlaylistLoadUnable "\nNo fue posible cargar la lista de reproducción %s.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer se detuvo por una 'Instrucción Ilegal'.\n"\ @@ -206,7 +206,6 @@ static const char help_text[]= #define MSGTR_EdloutBadStop "EDL skip cancelado, último comienzo > parada\n" #define MSGTR_EdloutStartSkip "EDL skip comenzado, presione 'i' denuevo para terminar con el bloque.\n" #define MSGTR_EdloutEndSkip "EDL skip terminado, operación guardada.\n" -#define MSGTR_MPEndposNoSizeBased "La opción -endpos en MPlayer aun no soporta unidades de tamaño.\n" // mplayer.c OSD #define MSGTR_OSDenabled "habilitado" @@ -583,9 +582,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[skin] error en configuración de skin en la línea %d: %s" -#define MSGTR_SKIN_WARNING1 "[skin] advertencia en archivo de configuración en la línea %d:\n control (%s) encontrado pero no se encontro \"section\" antes" -#define MSGTR_SKIN_WARNING2 "[skin] advertencia en archivo de configuración en la línea %d:\n control (%s) encontrado pero no se encontro \"subsection\" antes" -#define MSGTR_SKIN_WARNING3 "[skin] advertencia en archivo de configuración en la linea %d:\nesta subsección no esta soportada por control (%s)" #define MSGTR_SKIN_SkinFileNotFound "[skin] no se encontró archivo ( %s ).\n" #define MSGTR_SKIN_SkinFileNotReadable "[skin] file no leible ( %s ).\n" #define MSGTR_SKIN_BITMAP_16bit "Mapa de bits de 16 bits o menos no soportado (%s).\n" diff --git a/mplayer/help/help_mp-fr.h b/mplayer/help/help_mp-fr.h index ef0084d1..e2aac729 100644 --- a/mplayer/help/help_mp-fr.h +++ b/mplayer/help/help_mp-fr.h @@ -123,7 +123,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Codec audio forcé : %s\n" #define MSGTR_Video_NoVideo "Vidéo : pas de vidéo\n" #define MSGTR_NotInitializeVOPorVO "\nFATAL : impossible d'initialiser filtres vidéo (-vf) ou sortie vidéo (-vo).\n" -#define MSGTR_Paused "\n ===== PAUSE =====\r" // pas plus de 23 caractères (ligne pour les fichiers audio) +#define MSGTR_Paused " ===== PAUSE =====" // pas plus de 23 caractères (ligne pour les fichiers audio) #define MSGTR_PlaylistLoadUnable "\nImpossible de charger la liste de lecture %s.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer a planté à cause d'une 'Instruction Illégale'.\n"\ @@ -194,7 +194,6 @@ static const char help_text[]= #define MSGTR_EdloutBadStop "Saut EDL annulé, dernier début > arrêt\n" #define MSGTR_EdloutStartSkip "EDL saute le début, presse 'i' encore une fois pour fin du bloc.\n" #define MSGTR_EdloutEndSkip "EDL saute la fin, ligne écrite.\n" -#define MSGTR_MPEndposNoSizeBased "Option -endpos dans MPlayer ne supporte pas encore les unités de taille.\n" // mplayer.c OSD @@ -746,9 +745,6 @@ static const char help_text[]= // --- messages d'erreurs du chargement de peau --- #define MSGTR_SKIN_ERRORMESSAGE "[Peau] erreur à la ligne %d du fichier de config de peau : %s" -#define MSGTR_SKIN_WARNING1 "[Peau] attention à la ligne %d du fichier de config de peau : Widget (%s) trouvé mais aucune \"section\" trouvé avant lui." -#define MSGTR_SKIN_WARNING2 "[Peau] attention à la ligne %d du fichier de config de peau : Widget (%s) trouvé mais aucune \"subsection\" trouvé avant lui." -#define MSGTR_SKIN_WARNING3 "[Peau] attention à la ligne %d du fichier de config de peau : cette sous-section n'est pas supporté par le widget (%s)" #define MSGTR_SKIN_SkinFileNotFound "[peau] fichier ( %s ) non trouvé.\n" #define MSGTR_SKIN_SkinFileNotReadable "[peau] fichier ( %s ) non lisible.\n" #define MSGTR_SKIN_BITMAP_16bit "les images bitmaps 16 bits ou moins ne sont pas supportées ( %s ).\n" diff --git a/mplayer/help/help_mp-hu.h b/mplayer/help/help_mp-hu.h index 8d13551d..b577a5be 100644 --- a/mplayer/help/help_mp-hu.h +++ b/mplayer/help/help_mp-hu.h @@ -121,7 +121,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Kényszerített audio codec: %s\n" #define MSGTR_Video_NoVideo "Video: nincs video!!!\n" #define MSGTR_NotInitializeVOPorVO "\nHIBA: Nem sikerült a video filterek (-vf) vagy a video kimenet (-vo) inicializálása!\n" -#define MSGTR_Paused "\n ===== SZÜNET =====\r" +#define MSGTR_Paused " ===== SZÜNET =====" #define MSGTR_PlaylistLoadUnable "\nLejátszási lista (%s) betöltése sikertelen.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- Az MPlayer egy 'illegális utasítást' hajtott végre.\n"\ @@ -199,7 +199,6 @@ static const char help_text[]= #define MSGTR_EdloutBadStop "EDL skip visszavonva, az utolsó start > stop\n" #define MSGTR_EdloutStartSkip "EDL skip eleje, nyomd meg az 'i'-t a blokk befejezéséhez.\n" #define MSGTR_EdloutEndSkip "EDL skip vége, a sor kiírva.\n" -#define MSGTR_MPEndposNoSizeBased "Az MPlayer -endpos opciója jelenleg még nem támogatja a méretbeli megadást.\n" // mplayer.c OSD #define MSGTR_OSDenabled "bekapcsolva" @@ -577,9 +576,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[skin] hiba a skin konfigurációs fájljának %d. sorában: %s" -#define MSGTR_SKIN_WARNING1 "[skin] figyelmeztetés: a skin konfigurációs fájljának %d. sorában: widget (%s) megvan, de nincs előtte \"section\"" -#define MSGTR_SKIN_WARNING2 "[skin] figyelmeztetés: a skin konfigurációs fájljának %d. sorában: widget (%s) megvan, de nincs előtte \"subsection\"" -#define MSGTR_SKIN_WARNING3 "[skin] figyelmeztetés: a skin konfigurációs fájljának %d. sorában: ez az elem nem használható ebben az alrészben (%s)" #define MSGTR_SKIN_SkinFileNotFound "[skin] a fájl ( %s ) nem található.\n" #define MSGTR_SKIN_SkinFileNotReadable "[skin] fájl ( %s ) nem olvasható.\n" #define MSGTR_SKIN_BITMAP_16bit "16 vagy kevesebb bites bitmap nem támogatott (%s).\n" diff --git a/mplayer/help/help_mp-it.h b/mplayer/help/help_mp-it.h index 4be29f90..52eb0b86 100644 --- a/mplayer/help/help_mp-it.h +++ b/mplayer/help/help_mp-it.h @@ -118,7 +118,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Codec audio forzato: %s\n" #define MSGTR_Video_NoVideo "Video: nessun video!!!\n" #define MSGTR_NotInitializeVOPorVO "\nFATALE: Impossibile inizializzare i filtri video (-vf) o l'output video (-vo)!\n" -#define MSGTR_Paused "\n ===== PAUSA =====\r" +#define MSGTR_Paused " ===== PAUSA =====" #define MSGTR_PlaylistLoadUnable "\nImpossibile caricare la playlist %s\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer è stato interrotto dal segnale 'Istruzione illegale'.\n"\ @@ -197,7 +197,6 @@ static const char help_text[]= #define MSGTR_EdloutBadStop "Salto EDL ingnorato, ultimo start > stop\n" #define MSGTR_EdloutStartSkip "Tempo di start EDL impostato, ripremere 'i' per impostare lo stop.\n" #define MSGTR_EdloutEndSkip "Fine del blocco EDL, riga scritta.\n" -#define MSGTR_MPEndposNoSizeBased "L'opzione -endpos in MPlayer non supporta ancora unità di mis. di dimensione.\n" // mplayer.c OSD #define MSGTR_OSDenabled "abilitat" @@ -572,9 +571,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[skin] errore nel file di configurazione della skin alla riga %d: %s" -#define MSGTR_SKIN_WARNING1 "[skin] attenzione: nel file di configurazione della skin alla riga %d:\nwidget trovato ma non trovata prima la \"section\" (%s)" -#define MSGTR_SKIN_WARNING2 "[skin] attenzione: nel file di configurazione della skin alla riga %d:\nwidget trovato ma non trovata prima la \"subsection\" (%s)" -#define MSGTR_SKIN_WARNING3 "[skin] attenzione: nel file di configurazione della skin alla riga %d:\nquesta sottosezione non è supportata dal widget (%s)" #define MSGTR_SKIN_SkinFileNotFound "[skin] file ( %s ) non trovato.\n" #define MSGTR_SKIN_SkinFileNotReadable "[skin] file ( %s ) non leggibile.\n" #define MSGTR_SKIN_BITMAP_16bit "Bitmap con profondità di 16 bit o inferiore non supportate (%s).\n" diff --git a/mplayer/help/help_mp-ja.h b/mplayer/help/help_mp-ja.h index 245153c0..7ffc4fe2 100644 --- a/mplayer/help/help_mp-ja.h +++ b/mplayer/help/help_mp-ja.h @@ -113,7 +113,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "指定された音声コーデック: %s\n" #define MSGTR_Video_NoVideo "Video: 映像がありません\n" #define MSGTR_NotInitializeVOPorVO "\nFATAL: 画像フィルター(-vf)か画像出力(-vo)の初期化に失敗しました.\n" -#define MSGTR_Paused "\n ===== 停止 =====\r" // no more than 23 characters (status line for audio files) +#define MSGTR_Paused " ===== 停止 =====" // no more than 23 characters (status line for audio files) #define MSGTR_PlaylistLoadUnable "\nプレイリストの読み込みが出来ません %s.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayerは不正な命令(Illegal Instruction)によりクラッシュしました\n"\ @@ -303,9 +303,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[skin] エラー: スキン設定ファイル %d 行: %s" -#define MSGTR_SKIN_WARNING1 "[skin] 警告: スキン設定ファイル %d 行: widget found but before \"section\" not found ( %s )" -#define MSGTR_SKIN_WARNING2 "[skin] 警告: スキン設定ファイル %d 行: widget found but before \"subsection\" not found (%s)" -#define MSGTR_SKIN_WARNING3 "[skin] 警告: スキン設定ファイル %d 行: this subsection not supported by this widget (%s)" #define MSGTR_SKIN_BITMAP_16bit "16 ビット以下の解消度はサポートされていません (%s).\n" #define MSGTR_SKIN_BITMAP_FileNotFound "ファイルが存在しません (%s)\n" #define MSGTR_SKIN_BITMAP_BMPReadError "bmp 読み込みエラー (%s)\n" diff --git a/mplayer/help/help_mp-ko.h b/mplayer/help/help_mp-ko.h index 67767fce..8edd9ac5 100644 --- a/mplayer/help/help_mp-ko.h +++ b/mplayer/help/help_mp-ko.h @@ -115,7 +115,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "강제로 사용된 오디오 코덱: %s\n" #define MSGTR_Video_NoVideo "비디오: 비디오 없음\n" #define MSGTR_NotInitializeVOPorVO "\n치명적 오류: 비디오 필터(-vf) 또는 비디오 출력(-vo)을 초기화할 수 없습니다.\n" -#define MSGTR_Paused "\n ===== 잠시멈춤 =====\r" +#define MSGTR_Paused " ===== 잠시멈춤 =====" #define MSGTR_PlaylistLoadUnable "\n재생목록 %s을(를) 열 수 없습니다.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer가 '잘못된 연산'으로 종료되었습니다.\n"\ @@ -369,9 +369,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[스킨] 스킨 설정파일의 %d번째 줄에 오류가 있습니다.: %s" -#define MSGTR_SKIN_WARNING1 "[스킨] 설정파일의 %d번째 줄 경고:\n위젯(%s)을 찾았지만 그 앞에 \"section\"을 찾을 수 없습니다." -#define MSGTR_SKIN_WARNING2 "[스킨] 설정파일의 %d번째 줄 경고:\n위젯(%s)을 찾았지만 그 앞에 \"subsection\"을 찾을 수 없습니다." -#define MSGTR_SKIN_WARNING3 "[스킨] 설정파일의 %d번째 줄 경고:\n이 subsection은 현재 위젯에서 지원되지 않습니다. (%s)" #define MSGTR_SKIN_BITMAP_16bit "16 비트 혹은 더 낮은 품질의 비트맵은 지원되지 않습니다. (%s)\n" #define MSGTR_SKIN_BITMAP_FileNotFound "파일을 찾을 수 없습니다. (%s)\n" #define MSGTR_SKIN_BITMAP_BMPReadError "BMP 읽기 오류입니다. (%s)\n" diff --git a/mplayer/help/help_mp-mk.h b/mplayer/help/help_mp-mk.h index 7447048c..fc369c48 100644 --- a/mplayer/help/help_mp-mk.h +++ b/mplayer/help/help_mp-mk.h @@ -116,7 +116,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Присилен аудио кодек: %s\n" #define MSGTR_Video_NoVideo "Видео: нема слика\n" #define MSGTR_NotInitializeVOPorVO "\nФАТАЛНО: Не може да ги иницијализира видео филтерите (-vf) или видео излезот (-vo).\n" -#define MSGTR_Paused "\n ===== ПАУЗА =====\r" // не повеќе од 23 карактери (статус линија за аудио датотеките) +#define MSGTR_Paused " ===== ПАУЗА =====" // не повеќе од 23 карактери (статус линија за аудио датотеките) #define MSGTR_PlaylistLoadUnable "\nНе може да ја вчита плејлистата %s.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer падна од 'Нелегална Инструкција'.\n"\ @@ -367,9 +367,6 @@ static const char help_text[]= // --- пораки со грешка при вчитување на скинови #define MSGTR_SKIN_ERRORMESSAGE "[скин] грешка во конфигурационата датотека за скинови, линија %d: %s" -#define MSGTR_SKIN_WARNING1 "[скин] предупредување во конфигурационата датотека за скинови, линија %d: пронајден е widget но не е пронајден пред \"секцијата\" ( %s )" -#define MSGTR_SKIN_WARNING2 "[скин] предупредување во конфигурационата датотека за скинови, линија %d: пронајден е widget но не е пронајден пред \"под секцијата\" (%s)" -#define MSGTR_SKIN_WARNING3 "[скин] предупредување во конфигурационата датотека за скинови, линија %d: оваа под секција не е подржана од овој widget (%s)" #define MSGTR_SKIN_BITMAP_16bit "Не е подржана 16 битна или помала длабочина на битмапата ( %s ).\n" #define MSGTR_SKIN_BITMAP_FileNotFound "датотеката не е пронајдена ( %s )\n" #define MSGTR_SKIN_BITMAP_BMPReadError "BMP грешка во читањето ( %s )\n" diff --git a/mplayer/help/help_mp-nb.h b/mplayer/help/help_mp-nb.h index 23d91764..ed850c9a 100644 --- a/mplayer/help/help_mp-nb.h +++ b/mplayer/help/help_mp-nb.h @@ -184,8 +184,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[skin] feil i skin konfigurasjonsfil linje %d: %s" -#define MSGTR_SKIN_WARNING1 "[skin] advarsel i skin konfigurasjonsfil linje %d: widget funnet, men før \"section\" ikke funnet %s)" -#define MSGTR_SKIN_WARNING2 "[skin] advarsel i skin konfigurasjonsfil linje %d: widget funnet, men før \"subsection\" ikke funnet (%s)" #define MSGTR_SKIN_BITMAP_16bit "16 bits eller minde bitmap ikke støttet (%s).\n" #define MSGTR_SKIN_BITMAP_FileNotFound "finner ikke filen (%s)\n" #define MSGTR_SKIN_BITMAP_BMPReadError "BMP lesefeil (%s)\n" diff --git a/mplayer/help/help_mp-nl.h b/mplayer/help/help_mp-nl.h index 0944e3e5..73483401 100644 --- a/mplayer/help/help_mp-nl.h +++ b/mplayer/help/help_mp-nl.h @@ -116,7 +116,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Gedwongen audio codec: %s\n" #define MSGTR_Video_NoVideo "Video: geen video!!!\n" #define MSGTR_NotInitializeVOPorVO "\nFATAAL: Kon de video filters (-vf) of de video uitvoer (-vo) niet initialiseren!\n" -#define MSGTR_Paused "\n------ GEPAUZEERD -------\r" +#define MSGTR_Paused "------ GEPAUZEERD -------" #define MSGTR_PlaylistLoadUnable "\nKon de playlist %s niet laden\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer crashte door een 'Illegale Instructie'.\n"\ @@ -585,9 +585,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[skin] fout in skin configuratie bestand op regel %d: %s" -#define MSGTR_SKIN_WARNING1 "[skin] waarschuwing in skin configuratie bestand op regel %d: widget gevonden maar voordien \"section\" niet gevonden (%s)" -#define MSGTR_SKIN_WARNING2 "[skin] waarschuwing in skin configuratie bestand op regel %d: widget gevonden maar voordien \"subsection\" niet gevonden (%s)" -#define MSGTR_SKIN_WARNING3 "[skin] waarschuwing in skin configuratie bestand op regel %d: deze onderverdeling is niet ondersteund door deze widget (%s)" #define MSGTR_SKIN_BITMAP_16bit "16 bits of minder kleurendiepte bitmap niet ondersteund (%s).\n" #define MSGTR_SKIN_BITMAP_FileNotFound "bestand niet gevonden (%s)\n" #define MSGTR_SKIN_BITMAP_BMPReadError "BMP lees fout (%s)\n" diff --git a/mplayer/help/help_mp-pl.h b/mplayer/help/help_mp-pl.h index 947bb683..ccf09f7b 100644 --- a/mplayer/help/help_mp-pl.h +++ b/mplayer/help/help_mp-pl.h @@ -120,7 +120,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Wymuszam kodek audio: %s\n" #define MSGTR_Video_NoVideo "Wideo: brak obrazu\n" #define MSGTR_NotInitializeVOPorVO "\nBłąd krytyczny: Nie mogę zainicjalizować filtrów (-vf) lub wyjścia video (-vo).\n" -#define MSGTR_Paused "\n ===== PAUZA =====\r" // no more than 23 characters (status line for audio files) +#define MSGTR_Paused " ===== PAUZA =====" // no more than 23 characters (status line for audio files) #define MSGTR_PlaylistLoadUnable "\nNie mogę wczytać listy odtwarzania %s.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer zakończył prace z powodu błędu 'Niedozwolona Instrukcja'.\n"\ @@ -189,7 +189,6 @@ static const char help_text[]= #define MSGTR_EdloutBadStop "Pominięcie EDL odwołane, ostatni start > stop\n" #define MSGTR_EdloutStartSkip "Pominięcie EDL rozpoczęte, wciśnij ponownie 'i' by zakończyć blok.\n" #define MSGTR_EdloutEndSkip "Pominięcie EDL zakończone, wiersz zapisany.\n" -#define MSGTR_MPEndposNoSizeBased "Opcja MPlayer -endpos nie obsługuje jeszcze jednostek rozmiaru.\n" // mplayer.c OSD diff --git a/mplayer/help/help_mp-pt_BR.h b/mplayer/help/help_mp-pt_BR.h index bcf9f6ba..e5acdfbe 100644 --- a/mplayer/help/help_mp-pt_BR.h +++ b/mplayer/help/help_mp-pt_BR.h @@ -124,7 +124,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Codec de audio forçado: %s\n" #define MSGTR_Video_NoVideo "Vídeo: sem vídeo\n" #define MSGTR_NotInitializeVOPorVO "\nFATAL: Impossível inicializar os filtros de vídeo (-vf) ou a saída de vídeo (-vo)!\n" -#define MSGTR_Paused "\n================= PAUSADO =================\r" +#define MSGTR_Paused "================= PAUSADO =================" #define MSGTR_PlaylistLoadUnable "\nIncapaz de carregar a lista de reprodução %s.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer falhou por uma 'Instrução Ilegal'.\n"\ @@ -372,9 +372,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[skin] erro no arquivo de configuração do skin na linha %d: %s" -#define MSGTR_SKIN_WARNING1 "[skin] aviso no arquivo de configuração do skin na linha %d: widget encontrado mas antes de \"section\" não encontrado (%s)" -#define MSGTR_SKIN_WARNING2 "[skin] aviso no arquivo de configuração do skin na linha %d: widget encontrado mas antes de \"subsection\" não encontrtado (%s)" -#define MSGTR_SKIN_WARNING3 "[skin] aviso no arquivo de configuração do skin na linha %d: esta sub-seção não é suportada por este widget (%s)" #define MSGTR_SKIN_BITMAP_16bit "16 bit ou menor profundidade de cores não suportado (%s).\n" #define MSGTR_SKIN_BITMAP_FileNotFound "arquivo não encontrado (%s)\n" #define MSGTR_SKIN_BITMAP_BMPReadError "erro na leitura do BMP (%s)\n" diff --git a/mplayer/help/help_mp-ro.h b/mplayer/help/help_mp-ro.h index d4e2cdf5..7b33f930 100644 --- a/mplayer/help/help_mp-ro.h +++ b/mplayer/help/help_mp-ro.h @@ -1,5 +1,5 @@ // FIXME: This needs to be redone properly. -// Partially sync'ed with help_mp-en.h $Revision: 31579 $ +// Partially sync'ed with help_mp-en.h $Revision: 32817 $ // This is a retranslation of the file by Bogdan Butnaru , // based on the previous translation by Codre Adrian // (address bounces). @@ -120,7 +120,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Codec audio forþat: %s\n" #define MSGTR_Video_NoVideo "Video: nu existã video\n" #define MSGTR_NotInitializeVOPorVO "\nFATAL: Nu pot iniþializa filtrele video (-vf) sau ieºirea video (-vo).\n" -#define MSGTR_Paused "\n ===== PAUZÃ =====\r" // no more than 23 characters (status line for audio files) +#define MSGTR_Paused " ===== PAUZÃ =====" // no more than 23 characters (status line for audio files) #define MSGTR_PlaylistLoadUnable "\nNu pot sã încarc playlistul %s.\n" #define MSGTR_Exit_SIGCRASH \ "- MPlayer a murit. Nu ar trebui sã se întâmple asta.\n"\ diff --git a/mplayer/help/help_mp-ru.h b/mplayer/help/help_mp-ru.h index 93cfef32..87ef4ab3 100644 --- a/mplayer/help/help_mp-ru.h +++ b/mplayer/help/help_mp-ru.h @@ -119,7 +119,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Форсирован аудиокодек: %s\n" #define MSGTR_Video_NoVideo "Видео: нет видео\n" #define MSGTR_NotInitializeVOPorVO "\nФАТАЛЬНАЯ ОШИБКА: Не могу инициализировать видеофильтры (-vf) или видеовывод (-vo).\n" -#define MSGTR_Paused "\n=== ПРИОСТАНОВЛЕНО ===\r" // no more than 23 characters (status line for audio files) +#define MSGTR_Paused "=== ПРИОСТАНОВЛЕНО ===" // no more than 23 characters (status line for audio files) #define MSGTR_PlaylistLoadUnable "\nНе могу загрузить список воспроизведения (плейлист) %s.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer рухнул из-за 'Неправильной Инструкции'.\n"\ @@ -191,7 +191,6 @@ static const char help_text[]= #define MSGTR_EdloutBadStop "EDL пропуск отменён, последний start > stop\n" #define MSGTR_EdloutStartSkip "Начало EDL пропуска, нажмите 'i' ещё раз для завершения блока.\n" #define MSGTR_EdloutEndSkip "Конец EDL пропуска, строка записана.\n" -#define MSGTR_MPEndposNoSizeBased "В MPlayer опция -endpos пока не поддерживает единицы размера.\n" // mplayer.c OSD #define MSGTR_OSDenabled "включено" @@ -566,9 +565,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[скин] ошибка в файле конфигурации шкуры на строке %d: %s" -#define MSGTR_SKIN_WARNING1 "[скин] предупреждение: в файле конфигурации шкуры на строке %d:\nэлемент GUI найден, но до этого не найдено \"section\" (%s)" -#define MSGTR_SKIN_WARNING2 "[скин] предупреждение: в файле конфигурации шкуры на строке %d:\nэлемент GUI найден, но до этого не найдено \"subsection\" (%s)" -#define MSGTR_SKIN_WARNING3 "[скин] предупреждение: в файле конфигурации шкуры на строке %d:\nэта подсекция не поддерживается этим элементом GUI (%s)" #define MSGTR_SKIN_SkinFileNotFound "[скин] файл '%s' не найден.\n" #define MSGTR_SKIN_SkinFileNotReadable "[скин] файл ( %s ) не читаем.\n" #define MSGTR_SKIN_BITMAP_16bit "Глубина битовой матрицы в 16 бит и меньше не поддерживается (%s).\n" diff --git a/mplayer/help/help_mp-sk.h b/mplayer/help/help_mp-sk.h index c9a1ccc4..f335dc84 100644 --- a/mplayer/help/help_mp-sk.h +++ b/mplayer/help/help_mp-sk.h @@ -119,7 +119,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Vnútený video kodek: %s\n" #define MSGTR_Video_NoVideo "Video: žiadne video!!!\n" #define MSGTR_NotInitializeVOPorVO "\nFATAL: Nemôžem inicializovať video filtre (-vf) alebo video výstup (-vo)!\n" -#define MSGTR_Paused "\n ===== PAUZA =====\r" +#define MSGTR_Paused " ===== PAUZA =====" #define MSGTR_PlaylistLoadUnable "\nNemôžem načítať playlist %s\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer zhavaroval na 'Illegal Instruction'.\n"\ @@ -695,9 +695,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[témy] chyba v konfig. súbore tém %d: %s" -#define MSGTR_SKIN_WARNING1 "[témy] varovanie v konfig. súbore tém na riadku %d: widget najdený ale pred \"section\" nenájdený (%s)" -#define MSGTR_SKIN_WARNING2 "[témy] varovanie v konfig. súbore tém na riadku %d: widget najdený ale pred \"subsection\" nenájdený (%s)" -#define MSGTR_SKIN_WARNING3 "[témy] varovanie v konfig. súbore tém na riadku %d: táto subsekcia nie je podporovaná týmto widget (%s)" #define MSGTR_SKIN_SkinFileNotFound "[skin] súbor ( %s ) nenájdený.\n" #define MSGTR_SKIN_SkinFileNotReadable "[skin] súbor ( %s ) sa nedá prečítať.\n" #define MSGTR_SKIN_BITMAP_16bit "bitmapa s hĺbkou 16 bit a menej je nepodporovaná (%s).\n" diff --git a/mplayer/help/help_mp-sv.h b/mplayer/help/help_mp-sv.h index fee630fc..77b319ce 100644 --- a/mplayer/help/help_mp-sv.h +++ b/mplayer/help/help_mp-sv.h @@ -118,7 +118,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Forcerad audiocodec: %s\n" #define MSGTR_Video_NoVideo "Video: ingen video\n" #define MSGTR_NotInitializeVOPorVO "\nFATALT: Kunde inte initiera videofilter (-vf) eller video-ut (-vo).\n" -#define MSGTR_Paused "\n ===== PAUSE =====\r" // no more than 23 characters (status line for audio files) +#define MSGTR_Paused " ===== PAUSE =====" // no more than 23 characters (status line for audio files) #define MSGTR_PlaylistLoadUnable "\nOförmögen att ladda spellista %s.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer krachade av en 'Illegal Instruction'.\n"\ @@ -600,9 +600,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[skin] fel i skinkonfigureringsfil på rad %d: %s" -#define MSGTR_SKIN_WARNING1 "[skin] varning i konfigurationsfil på rad %d:\nwidget (%s) funnen, men ingen \"section\" funnen före" -#define MSGTR_SKIN_WARNING2 "[skin] varning i konfigurationsfil på rad %d:\nwidget (%s) funnen, men ingen \"subsection\" funnen före" -#define MSGTR_SKIN_WARNING3 "[skin] varning i konfigurationsfil på rad %d:\ndenna undersektion stödjs inte av widget (%s)" #define MSGTR_SKIN_BITMAP_16bit "16-bitar eller lägre bitmappar stödjs inte (%s).\n" #define MSGTR_SKIN_BITMAP_FileNotFound "fil ej funnen (%s)\n" #define MSGTR_SKIN_BITMAP_BMPReadError "BMP läsfel (%s)\n" diff --git a/mplayer/help/help_mp-tr.h b/mplayer/help/help_mp-tr.h index 577a4fc9..a3e72f3d 100644 --- a/mplayer/help/help_mp-tr.h +++ b/mplayer/help/help_mp-tr.h @@ -121,7 +121,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Ses kodeği zorlandı: %s\n" #define MSGTR_Video_NoVideo "Video: video yok!!!\n" #define MSGTR_NotInitializeVOPorVO "\nHATA: Video filtreleri (-vf) veya video çıkışı (-vo) başlatılamadı!\n" -#define MSGTR_Paused "\n-------- DURAKLADI --------\r" +#define MSGTR_Paused "-------- DURAKLADI --------" #define MSGTR_PlaylistLoadUnable "\n%s çalma listesi yüklenemedi.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- 'Geçersiz Komut' nedeniyle MPlayer çöktü.\n"\ @@ -194,7 +194,6 @@ static const char help_text[]= #define MSGTR_EdloutStartSkip "EDL atlaması başlangıcı, bloğu bitirmek için\n"\ "'i' tuşuna tekrar basın.\n" #define MSGTR_EdloutEndSkip "EDL atlaması sonu, satır yazıldı.\n" -#define MSGTR_MPEndposNoSizeBased "MPlayer'da -endpos seçeneği henüz boyut birimlerini desteklemiyor.\n" // mplayer.c OSD @@ -757,9 +756,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[arayüz] Hata : arayüz ayar dosyası %d satırı: %s" -#define MSGTR_SKIN_WARNING1 "[arayüz] Uyarı: arayüz ayar dosyası %d satırı: widget (%s) bulundu ama \"section\" bulunamadı" -#define MSGTR_SKIN_WARNING2 "[arayüz] Uyarı: arayüz ayar dosyası %d satırı: widget (%s) bulundu ama \"subsection\" bulunamadı " -#define MSGTR_SKIN_WARNING3 "[arayüz] Uyarı: Ayar dosyasında satır %d\nbu altseçenek widget (%s) tarafından desteklenmiyor." #define MSGTR_SKIN_SkinFileNotFound "[arayüz] ( %s ) dosyası bulunamadı.\n" #define MSGTR_SKIN_SkinFileNotReadable "[arayüz] ( %s ) dosyası okunabilir değil.\n" #define MSGTR_SKIN_BITMAP_16bit "16 bit veya daha az derinlikteki bitmap desteklenmiyor (%s).\n" diff --git a/mplayer/help/help_mp-uk.h b/mplayer/help/help_mp-uk.h index 62317a9e..ffa07f77 100644 --- a/mplayer/help/help_mp-uk.h +++ b/mplayer/help/help_mp-uk.h @@ -113,7 +113,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Примусовий аудіо кодек: %s\n" #define MSGTR_Video_NoVideo "Відео: без відео\n" #define MSGTR_NotInitializeVOPorVO "\nFATAL: Неможливо ініціалізувати відео фільтри (-vf) або відео вивід (-vo).\n" -#define MSGTR_Paused "\n ===== ПАУЗА =====\r" +#define MSGTR_Paused " ===== ПАУЗА =====" #define MSGTR_PlaylistLoadUnable "\nНеможливо завантажити playlist %s.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer зламався через 'Невірні інструкції'.\n"\ @@ -185,7 +185,6 @@ static const char help_text[]= #define MSGTR_EdloutBadStop "Ігнорування EDL відмінено, останній start > stop\n" #define MSGTR_EdloutStartSkip "Старт EDL пропуску, натисніть 'i' знов, щоб завершити блок.\n" #define MSGTR_EdloutEndSkip "Кінець EDL пропуску, рядок записано.\n" -#define MSGTR_MPEndposNoSizeBased "Опція -endpos у MPlayer ще не підтримує одиниці ромзіру.\n" // mplayer.c OSD #define MSGTR_OSDenabled "увімкнено" @@ -560,9 +559,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[скін] помилка у налаштунках скіна у рядку %d: %s" -#define MSGTR_SKIN_WARNING1 "[скін] попередження: у налаштунках у рядку %d:\nвіджет (%s) знайдено але \"секцію\" не знайдено" -#define MSGTR_SKIN_WARNING2 "[скін] попередження: у налаштунках у рядку %d:\nвіджет (%s) знайдено але \"підсекцію\" не знайдено" -#define MSGTR_SKIN_WARNING3 "[скін] попередження: у налаштунках у рядку %d:\nця підсекція не підтримується віджетом (%s)" #define MSGTR_SKIN_SkinFileNotFound "[skin] файл ( %s ) не знайдено.\n" #define MSGTR_SKIN_SkinFileNotReadable "[skin] файл ( %s ) не прочитати.\n" #define MSGTR_SKIN_BITMAP_16bit "Глибина матриці у 16 біт і менше не підтримується (%s).\n" diff --git a/mplayer/help/help_mp-zh_CN.h b/mplayer/help/help_mp-zh_CN.h index 3a672c60..96d29017 100644 --- a/mplayer/help/help_mp-zh_CN.h +++ b/mplayer/help/help_mp-zh_CN.h @@ -120,7 +120,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "强制使用音频编解码器:%s\n" #define MSGTR_Video_NoVideo "视频:没有视频流\n" #define MSGTR_NotInitializeVOPorVO "\n致命错误:无法初始设置视频过滤器(-vf)或视频输出(-vf)。\n" -#define MSGTR_Paused "\n ===== 暂停 =====\r" // no more than 23 characters (status line for audio files) +#define MSGTR_Paused " ===== 暂停 =====" // no more than 23 characters (status line for audio files) #define MSGTR_PlaylistLoadUnable "\n无法装载播放列表 %s\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- “非法指令”导致 MPlayer 崩溃。\n"\ @@ -196,7 +196,6 @@ static const char help_text[]= #define MSGTR_EdloutBadStop "取消 EDL 跳跃,上一个开始位置 > 停止位置\n" #define MSGTR_EdloutStartSkip "开始 EDL 跳跃,再按键‘i’以指定跳过内容的结尾。\n" #define MSGTR_EdloutEndSkip "结束 EDL 跳跃,文本行已写入。\n" -#define MSGTR_MPEndposNoSizeBased "MPlayer 的选项 -endpos 还不支持指定尺寸大小的单位。\n" // mplayer.c OSD #define MSGTR_OSDenabled "已启用" @@ -559,9 +558,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[界面外观] 界面外观配置文件错误,行 %d:%s" -#define MSGTR_SKIN_WARNING1 "[界面外观] 警告:配置文件行 %d:\n找到组件(%s),但在其之前没有找到“section”的内容" -#define MSGTR_SKIN_WARNING2 "[界面外观] 警告: 配置文件行 %d:\n找到组件(%s),但在其之前没有找到“subsection”的内容" -#define MSGTR_SKIN_WARNING3 "[界面外观] 警告: 配置文件行 %d:\n组件(%s)不支持该 subsection" #define MSGTR_SKIN_SkinFileNotFound "[界面外观] 未找到文件(%s)。\n" #define MSGTR_SKIN_SkinFileNotReadable "[界面外观] 无法读取文件(%s)。\n" #define MSGTR_SKIN_BITMAP_16bit "不支持少于或等于 16 比特颜色精度的位图(%s)。\n" diff --git a/mplayer/help/help_mp-zh_TW.h b/mplayer/help/help_mp-zh_TW.h index 9c8f4242..7ee0f239 100644 --- a/mplayer/help/help_mp-zh_TW.h +++ b/mplayer/help/help_mp-zh_TW.h @@ -123,7 +123,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "鎖定的音頻編解碼器: %s\n" #define MSGTR_Video_NoVideo "視頻: 没視頻\n" #define MSGTR_NotInitializeVOPorVO "\n致命錯誤: 無法初始化 (-vf) 視頻過濾器或 (-vo) 視頻輸出。\n" -#define MSGTR_Paused "\n ===== 暫停 =====\r" // no more than 23 characters (status line for audio files) +#define MSGTR_Paused " ===== 暫停 =====" // no more than 23 characters (status line for audio files) #define MSGTR_PlaylistLoadUnable "\n無法裝載播放列表 %s\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- “非法指令”導致 MPlayer 崩潰。\n"\ @@ -193,7 +193,6 @@ static const char help_text[]= #define MSGTR_EdloutBadStop "EDL 跳躍已取消, 上次開始位置 > 停止位置\n" #define MSGTR_EdloutStartSkip "EDL 跳躍開始, 再按鍵 'i' 以停止。\n" #define MSGTR_EdloutEndSkip "EDL 跳躍結束, 綫已寫入。\n" -#define MSGTR_MPEndposNoSizeBased "MPlayer 的選項 -endpos 還不支持大小單位。\n" // mplayer.c OSD @@ -730,9 +729,6 @@ static const char help_text[]= // --- skin loader error messages #define MSGTR_SKIN_ERRORMESSAGE "[skin] 皮膚配置文件的 %d: %s行出錯" -#define MSGTR_SKIN_WARNING1 "[skin] 警告: 在配置文件的 %d行:\n找到組件 (%s) 但在這之前没有找到 \"section\"" -#define MSGTR_SKIN_WARNING2 "[skin] 警告: 在配置文件的 %d行:\n找到組件 (%s) 但在這之前没有找到 \"subsection\"" -#define MSGTR_SKIN_WARNING3 "[skin] 警告: 在配置文件的 %d行:\n組件 (%s) 不支持此 subsection" #define MSGTR_SKIN_SkinFileNotFound "[skin] 文件 (%s) 没找到。\n" #define MSGTR_SKIN_SkinFileNotReadable "[skin] 文件 (%s) 不可讀。\n" #define MSGTR_SKIN_BITMAP_16bit "不支持少于 16 比特色深的位圖 (%s)。\n" diff --git a/mplayer/help_mp.h b/mplayer/help_mp.h index 10f4aa4d..b9d8c731 100644 --- a/mplayer/help_mp.h +++ b/mplayer/help_mp.h @@ -4,7 +4,7 @@ #ifndef MPLAYER_HELP_MP_H #define MPLAYER_HELP_MP_H -// $Revision: 32526 $ +// $Revision: 32964 $ // MASTER FILE. Use this file as base for translations. // Translated files should be sent to the mplayer-DOCS mailing list or // to the help messages maintainer, see DOCS/tech/MAINTAINERS. @@ -129,7 +129,7 @@ static const char help_text[]= #define MSGTR_ForcedAudioCodec "Forced audio codec: %s\n" #define MSGTR_Video_NoVideo "Video: no video\n" #define MSGTR_NotInitializeVOPorVO "\nFATAL: Could not initialize video filters (-vf) or video output (-vo).\n" -#define MSGTR_Paused "\n ===== PAUSE =====\r" // no more than 23 characters (status line for audio files) +#define MSGTR_Paused " ===== PAUSE =====" // no more than 23 characters (status line for audio files) #define MSGTR_PlaylistLoadUnable "\nUnable to load playlist %s.\n" #define MSGTR_Exit_SIGILL_RTCpuSel \ "- MPlayer crashed by an 'Illegal Instruction'.\n"\ @@ -205,7 +205,6 @@ static const char help_text[]= #define MSGTR_EdloutBadStop "EDL skip canceled, last start > stop\n" #define MSGTR_EdloutStartSkip "EDL skip start, press 'i' again to end block.\n" #define MSGTR_EdloutEndSkip "EDL skip end, line written.\n" -#define MSGTR_MPEndposNoSizeBased "Option -endpos in MPlayer does not yet support size units.\n" // mplayer.c OSD #define MSGTR_OSDenabled "enabled" @@ -582,12 +581,12 @@ static const char help_text[]= #define MSGTR_UNKNOWNWINDOWTYPE "Unknown window type found ..." // --- skin loader error messages -#define MSGTR_SKIN_ERRORMESSAGE "[skin] error in skin config file on line %d: %s" -#define MSGTR_SKIN_WARNING1 "[skin] warning: in config file line %d:\nwidget (%s) found but no \"section\" found before" -#define MSGTR_SKIN_WARNING2 "[skin] warning: in config file line %d:\nwidget (%s) found but no \"subsection\" found before" -#define MSGTR_SKIN_WARNING3 "[skin] warning: in config file line %d:\nthis subsection is not supported by widget (%s)" -#define MSGTR_SKIN_SkinFileNotFound "[skin] file ( %s ) not found.\n" -#define MSGTR_SKIN_SkinFileNotReadable "[skin] file ( %s ) not readable.\n" +#define MSGTR_SKIN_ERRORMESSAGE "Error in skin config file on line %d: %s" +#define MSGTR_SKIN_ERROR_SECTION "No section specified for '%s'.\n" +#define MSGTR_SKIN_ERROR_WINDOW "No window specified for '%s'.\n" +#define MSGTR_SKIN_ERROR_IN_WINDOW "This item is not supported by '%s'.\n" +#define MSGTR_SKIN_SkinFileNotFound "Skin file %s not found.\n" +#define MSGTR_SKIN_SkinFileNotReadable "Skin file %s not readable.\n" #define MSGTR_SKIN_BITMAP_16bit "Bitmaps of 16 bits or less depth not supported (%s).\n" #define MSGTR_SKIN_BITMAP_FileNotFound "File not found (%s)\n" #define MSGTR_SKIN_BITMAP_BMPReadError "BMP read error (%s)\n" @@ -604,7 +603,7 @@ static const char help_text[]= #define MSGTR_SKIN_FONT_NonExistentFontID "non-existent font identifier (%s)\n" #define MSGTR_SKIN_UnknownParameter "unknown parameter (%s)\n" #define MSGTR_SKIN_SKINCFG_SkinNotFound "Skin not found (%s).\n" -#define MSGTR_SKIN_SKINCFG_SelectedSkinNotFound "Selected skin ( %s ) not found, trying 'default'...\n" +#define MSGTR_SKIN_SKINCFG_SelectedSkinNotFound "Selected skin '%s' not found, trying skin 'default'...\n" #define MSGTR_SKIN_SKINCFG_SkinCfgReadError "skin config file read error (%s)\n" #define MSGTR_SKIN_LABEL "Skins:" diff --git a/mplayer/libaf/af_lavcac3enc.c b/mplayer/libaf/af_lavcac3enc.c index 0be811f9..a4cb4cf2 100644 --- a/mplayer/libaf/af_lavcac3enc.c +++ b/mplayer/libaf/af_lavcac3enc.c @@ -98,7 +98,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) s->lavc_actx->bit_rate = bit_rate; if(avcodec_open(s->lavc_actx, s->lavc_acodec) < 0) { - mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_CouldntOpenCodec, "ac3", bit_rate); + mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_CouldntOpenCodec, "ac3_fixed", bit_rate); return AF_ERROR; } } @@ -274,9 +274,9 @@ static int af_open(af_instance_t* af){ init_avcodec(); - s->lavc_acodec = avcodec_find_encoder_by_name("ac3"); + s->lavc_acodec = avcodec_find_encoder_by_name("ac3_fixed"); if (!s->lavc_acodec) { - mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_LavcAudioCodecNotFound, "ac3"); + mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_LavcAudioCodecNotFound, "ac3_fixed"); return AF_ERROR; } diff --git a/mplayer/libao2/ao_coreaudio.c b/mplayer/libao2/ao_coreaudio.c index ee7db574..a773837e 100644 --- a/mplayer/libao2/ao_coreaudio.c +++ b/mplayer/libao2/ao_coreaudio.c @@ -68,6 +68,21 @@ LIBAO_EXTERN(coreaudio) /* Prefix for all mp_msg() calls */ #define ao_msg(a, b, c...) mp_msg(a, b, "AO: [coreaudio] " c) +#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1040 +/* AudioDeviceIOProcID does not exist in Mac OS X 10.4. We can emulate + * this by using AudioDeviceAddIOProc() and AudioDeviceRemoveIOProc(). */ +#define AudioDeviceIOProcID AudioDeviceIOProc +#define AudioDeviceDestroyIOProcID AudioDeviceRemoveIOProc +static OSStatus AudioDeviceCreateIOProcID(AudioDeviceID dev, + AudioDeviceIOProc proc, + void *data, + AudioDeviceIOProcID *procid) +{ + *procid = proc; + return AudioDeviceAddIOProc(dev, proc, data); +} +#endif + typedef struct ao_coreaudio_s { AudioDeviceID i_selected_dev; /* Keeps DeviceID of the selected device. */ diff --git a/mplayer/libao2/ao_dxr2.c b/mplayer/libao2/ao_dxr2.c index 5aba1be6..ec9a5b8b 100644 --- a/mplayer/libao2/ao_dxr2.c +++ b/mplayer/libao2/ao_dxr2.c @@ -177,7 +177,6 @@ static int get_space(void){ static void dxr2_send_lpcm_packet(unsigned char* data,int len,int id,unsigned int timestamp,int freq_id) { - int write_dxr2(const unsigned char *data, int len); if(dxr2_fd < 0) { mp_msg(MSGT_AO,MSGL_ERR,"DXR2 fd is not valid\n"); @@ -196,7 +195,6 @@ static void dxr2_send_lpcm_packet(unsigned char* data,int len,int id,unsigned in // it should round it down to outburst*n // return: number of bytes played static int play(void* data,int len,int flags){ - int write_dxr2(const unsigned char *data, int len); // MPEG and AC3 don't work :-( if(ao_data.format==AF_FORMAT_MPEG2) diff --git a/mplayer/libdvdcss/css.c b/mplayer/libdvdcss/css.c index c8bf4d81..fba0a44e 100644 --- a/mplayer/libdvdcss/css.c +++ b/mplayer/libdvdcss/css.c @@ -1126,6 +1126,45 @@ static int investigate( unsigned char *hash, unsigned char *ckey ) return memcmp( key, ckey, KEY_SIZE ); } +#ifdef GEKKO +static unsigned int tablestart; + +int BigTable(int testval) +{ + register int tmp, i, j, tmp2; + unsigned char out2[5]; + +again: + + for (i = tablestart; i < 16777216; i++) + { + tmp = ((i + i) & 0x1fffff0) | 0x8 | (i & 0x7); + + for (j = 0; j < 5; j++) + { + tmp2 = (((((((tmp >> 3) ^ tmp) >> 1) ^ tmp) >> 8) ^ tmp) >> 5) & 0xff; + tmp = (tmp << 8) | tmp2; + out2[j] = p_css_tab4[tmp2]; + } + + j = (out2[0] << 16) | (out2[1] << 8) | out2[4]; + if (j == testval) + { + return i; + } + if (j & 0x0F != testval & 0x0f) + i += 7; + if (i > 16777214 && tablestart > 0) + { + tablestart = 0; + goto again; + } + } + printf("css.c: Error in BigTable\n"); + return 0; +} +#endif + static int CrackDiscKey( dvdcss_t dvdcss, uint8_t *p_disc_key ) { unsigned char B[5] = { 0,0,0,0,0 }; /* Second Stage of mangle cipher */ @@ -1144,15 +1183,16 @@ static int CrackDiscKey( dvdcss_t dvdcss, uint8_t *p_disc_key ) unsigned int nTry; /* iterator for K[1] possibilities */ unsigned int nPossibleK1; /* #of possible K[1] values */ unsigned char* K1table; /* Lookup table for possible K[1] */ +#ifndef GEKKO unsigned int* BigTable; /* LFSR2 startstate indexed by * 1,2,5 output byte */ - +#else + tablestart=0; +#endif /* * Prepare tables for hash reversal */ -#ifdef GEKKO - return -1; -#endif + /* initialize lookup tables for k[1] */ K1table = malloc( 65536 * K1TABLEWIDTH ); if( K1table == NULL ) @@ -1185,12 +1225,11 @@ static int CrackDiscKey( dvdcss_t dvdcss, uint8_t *p_disc_key ) K1table[ K1TABLEWIDTH * ( 256 * j + tmp3 ) ] = tmp4; } } - +#ifndef GEKKO /* Initing our Really big table */ - BigTable = malloc( 16777216 * sizeof(int) ); // 64MB (not enoug mem for the wii) + BigTable = malloc( 16777216 * sizeof(int) ); if( BigTable == NULL ) { - printf("css.c: error creating BigTable\n"); free(K1table); return -1; } @@ -1215,7 +1254,7 @@ static int CrackDiscKey( dvdcss_t dvdcss, uint8_t *p_disc_key ) j = ( out2[0] << 16 ) | ( out2[1] << 8 ) | out2[4]; BigTable[j] = i; } - +#endif /* * We are done initing, now reverse hash */ @@ -1268,7 +1307,11 @@ static int CrackDiscKey( dvdcss_t dvdcss, uint8_t *p_disc_key ) /* test first possible out2[4] */ tmp4 = ( out2[0] << 16 ) | ( out2[1] << 8 ) | out2[4]; + #ifdef GEKKO + tmp4 = BigTable(tmp4); + #else tmp4 = BigTable[ tmp4 ]; + #endif C[2] = tmp4 & 0xff; C[3] = ( tmp4 >> 8 ) & 0xff; C[4] = ( tmp4 >> 16 ) & 0xff; @@ -1288,7 +1331,11 @@ static int CrackDiscKey( dvdcss_t dvdcss, uint8_t *p_disc_key ) /* Test second possible out2[4] */ out2[4] = ( out2[4] + 0xff ) & 0xff; tmp4 = ( out2[0] << 16 ) | ( out2[1] << 8 ) | out2[4]; + #ifdef GEKKO + tmp4 = BigTable(tmp4); + #else tmp4 = BigTable[ tmp4 ]; + #endif C[2] = tmp4 & 0xff; C[3] = ( tmp4 >> 8 ) & 0xff; C[4] = ( tmp4 >> 16 ) & 0xff; @@ -1313,8 +1360,9 @@ static int CrackDiscKey( dvdcss_t dvdcss, uint8_t *p_disc_key ) memcpy( p_disc_key, &C[0], KEY_SIZE ); free( K1table ); +#ifndef GEKKO free( BigTable ); - +#endif return 0; } diff --git a/mplayer/libdvdcss/ioctl.c b/mplayer/libdvdcss/ioctl.c index 2f6e6860..d1c6e9b1 100644 --- a/mplayer/libdvdcss/ioctl.c +++ b/mplayer/libdvdcss/ioctl.c @@ -270,7 +270,8 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright ) *pi_copyright = p_buffer[ 4 ]; #elif defined( GEKKO ) - return -1; + i_ret = -1; + #else # error "DVD ioctls are unavailable on this system" @@ -445,7 +446,8 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key ) memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE ); #elif defined( GEKKO ) - return -1; + i_ret = -1; + #else # error "DVD ioctls are unavailable on this system" @@ -611,7 +613,8 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key ) memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE ); #elif defined( GEKKO ) - return -1; + i_ret = -1; + #else # error "DVD ioctls are unavailable on this system" @@ -737,7 +740,8 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid ) *pi_agid = p_buffer[ 7 ] >> 6; #elif defined( GEKKO ) - return -1; + i_ret = -1; + #else # error "DVD ioctls are unavailable on this system" @@ -873,7 +877,8 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge ) memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE ); #elif defined( GEKKO ) - return -1; + i_ret = -1; + #else # error "DVD ioctls are unavailable on this system" @@ -1008,7 +1013,8 @@ int ioctl_ReportASF( int i_fd, int *pi_remove_me, int *pi_asf ) *pi_asf = p_buffer[ 7 ] & 1; #elif defined( GEKKO ) - return -1; + i_ret = -1; + #else # error "DVD ioctls are unavailable on this system" @@ -1139,7 +1145,8 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key ) memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE ); #elif defined( GEKKO ) - return -1; + i_ret = -1; + #else # error "DVD ioctls are unavailable on this system" @@ -1252,7 +1259,8 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid ) &sdc, sizeof(sdc), &ulParamLen, NULL, 0, &ulDataLen); #elif defined( GEKKO ) - return -1; + i_ret = -1; + #else # error "DVD ioctls are unavailable on this system" @@ -1391,7 +1399,8 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge ) p_buffer, sizeof(p_buffer), &ulDataLen ); #elif defined( GEKKO ) - return -1; + i_ret = -1; + #else # error "DVD ioctls are unavailable on this system" @@ -1530,7 +1539,8 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key ) p_buffer, sizeof(p_buffer), &ulDataLen ); #elif defined( GEKKO ) - return -1; + i_ret = -1; + #else # error "DVD ioctls are unavailable on this system" @@ -1687,7 +1697,8 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme ) *p_scheme = p_buffer[ 6 ]; #elif defined( GEKKO ) - return -1; + i_ret = -1; + #else # error "DVD ioctls are unavailable on this system" @@ -1816,7 +1827,8 @@ int ioctl_SendRPC( int i_fd, int i_pdrc ) p_buffer, sizeof(p_buffer), &ulDataLen ); #elif defined( GEKKO ) - return -1; + i_ret = -1; + #else # error "DVD ioctls are unavailable on this system" diff --git a/mplayer/libdvdnav/dvdnav/dvdnav.h b/mplayer/libdvdnav/dvdnav/dvdnav.h index 85c67045..26013412 100644 --- a/mplayer/libdvdnav/dvdnav/dvdnav.h +++ b/mplayer/libdvdnav/dvdnav/dvdnav.h @@ -180,7 +180,7 @@ dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *self, int32_t *pgc_bas *********************************************************************/ /* - * These functions are used to poll the playback enginge and actually get data + * These functions are used to poll the playback engine and actually get data * off the DVD. */ @@ -204,7 +204,7 @@ dvdnav_status_t dvdnav_get_next_block(dvdnav_t *self, uint8_t *buf, /* * This basically does the same as dvdnav_get_next_block. The only difference is * that it avoids a memcopy, when the requested block was found in the cache. - * I such a case (cache hit) this function will return a different pointer than + * In such a case (cache hit) this function will return a different pointer than * the one handed in, pointing directly into the relevant block in the cache. * Those pointers must _never_ be freed but instead returned to the library via * dvdnav_free_cache_block(). @@ -318,7 +318,7 @@ dvdnav_status_t dvdnav_menu_call(dvdnav_t *self, DVDMenuID_t menu); /* * Return the title number and part currently being played. - * A title of 0 indicates, we are in a menu. In this case, part + * A title of 0 indicates we are in a menu. In this case, part * is set to the current menu's ID. */ dvdnav_status_t dvdnav_current_title_info(dvdnav_t *self, int32_t *title, @@ -360,7 +360,7 @@ dvdnav_status_t dvdnav_part_search(dvdnav_t *self, int32_t part); * VOBU boundary before the given sector. The sector number is not * meant to be an absolute physical DVD sector, but a relative sector * in the current program. This function cannot leave the current - * program and will fail, if asked to do so. + * program and will fail if asked to do so. * * If program chain based positioning is enabled * (see dvdnav_set_PGC_positioning_flag()), this will seek to the relative @@ -389,7 +389,7 @@ dvdnav_status_t dvdnav_time_search(dvdnav_t *self, /* * Stop playing current position and play the "GoUp"-program chain. - * (which generally leads to the title menu or a higer-level menu). + * (which generally leads to the title menu or a higher-level menu). */ dvdnav_status_t dvdnav_go_up(dvdnav_t *self); @@ -429,12 +429,12 @@ dvdnav_status_t dvdnav_get_position(dvdnav_t *self, uint32_t *pos, /* * Most functions related to highlights take a NAV PCI packet as a parameter. - * While you can get the such a packet from libdvdnav, for players with internal - * FIFOs, this will result in errors, because due to the FIFO length, libdvdnav will - * be ahead in the stream compared to what the user is seeing on screen. - * Therefore, player applications who have a NAV packet available, which is - * better in sync with the actual playback should always pass this one to these - * functions. + * While you can get such a packet from libdvdnav, this will result in + * errors for players with internal FIFOs because due to the FIFO length, + * libdvdnav will be ahead in the stream compared to what the user is + * seeing on screen. Therefore, player applications who have a NAV + * packet available, which is better in sync with the actual playback, + * should always pass this one to these functions. */ /* @@ -491,7 +491,7 @@ dvdnav_status_t dvdnav_button_select(dvdnav_t *self, pci_t *pci, int32_t button) dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *self, pci_t *pci, int32_t button); /* - * Activate (press) a button and execute specified command. + * Activate ("press") a button and execute specified command. */ dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *self, int32_t button, vm_cmd_t *cmd); @@ -541,7 +541,7 @@ dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *self, /* * Return a string describing the title of the DVD. * This is an ID string encoded on the disc by the author. In many cases - * this is a descriptive string such as `THE_MATRIX' but sometimes is sigularly + * this is a descriptive string such as `THE_MATRIX' but sometimes is singularly * uninformative such as `PDVD-011421'. Some DVD authors even forget to set this, * so you may also read the default of the authoring software they used, like * `DVDVolume'. @@ -591,7 +591,7 @@ uint16_t dvdnav_audio_stream_to_lang(dvdnav_t *self, uint8_t stream); uint16_t dvdnav_audio_stream_format(dvdnav_t *self, uint8_t stream); /* - * Returns number of channelsn in *logical* audio stream 'stream' + * Returns number of channels in *logical* audio stream 'stream' * (returns 0xffff if no such stream). */ uint16_t dvdnav_audio_stream_channels(dvdnav_t *self, uint8_t stream); @@ -660,7 +660,7 @@ user_ops_t dvdnav_get_restrictions(dvdnav_t *self); */ /* - * Sets the current angle. If you try to follow a non existant angle + * Sets the current angle. If you try to follow a non existent angle * the call fails. */ dvdnav_status_t dvdnav_angle_change(dvdnav_t *self, int32_t angle); diff --git a/mplayer/libdvdread4/dvd_reader.c b/mplayer/libdvdread4/dvd_reader.c index 23b34cfd..3ed3e21b 100644 --- a/mplayer/libdvdread4/dvd_reader.c +++ b/mplayer/libdvdread4/dvd_reader.c @@ -377,7 +377,7 @@ dvd_reader_t *DVDOpen( const char *ppath ) return ret_val; } -#ifdef GEKKO +#if defined(GEKKO) if (!strcmp(path, "/dev/di")) { ret_val = DVDOpenImageFile( path, have_css ); free(path); diff --git a/mplayer/libdvdread4/dvdread/ifo_types.h b/mplayer/libdvdread4/dvdread/ifo_types.h index 38792bf2..e6a9bcbb 100644 --- a/mplayer/libdvdread4/dvdread/ifo_types.h +++ b/mplayer/libdvdread4/dvdread/ifo_types.h @@ -475,7 +475,8 @@ typedef struct { * Parental Management Information Unit Table. * Level 1 (US: G), ..., 7 (US: NC-17), 8 */ -typedef uint16_t pf_level_t[8]; +#define PTL_MAIT_NUM_LEVEL 8 +typedef uint16_t pf_level_t[PTL_MAIT_NUM_LEVEL]; /** * Parental Management Information Unit Table. diff --git a/mplayer/libdvdread4/ifo_read.c b/mplayer/libdvdread4/ifo_read.c index e805bb1c..ccf23a25 100644 --- a/mplayer/libdvdread4/ifo_read.c +++ b/mplayer/libdvdread4/ifo_read.c @@ -1325,6 +1325,9 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) { ifofile->ptl_mait = 0; return 0; } + for(i = 0; i < ptl_mait->nr_of_countries; i++) { + ptl_mait->countries[i].pf_ptl_mai = NULL; + } for(i = 0; i < ptl_mait->nr_of_countries; i++) { if(!(DVDReadBytes(ifofile->file, &ptl_mait->countries[i], PTL_MAIT_COUNTRY_SIZE))) { @@ -1345,7 +1348,7 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) { CHECK_ZERO(ptl_mait->countries[i].zero_1); CHECK_ZERO(ptl_mait->countries[i].zero_2); CHECK_VALUE(ptl_mait->countries[i].pf_ptl_mai_start_byte - + 8*2 * (ptl_mait->nr_of_vtss + 1) <= ptl_mait->last_byte + 1); + + sizeof(pf_level_t) * (ptl_mait->nr_of_vtss + 1) <= ptl_mait->last_byte + 1); } for(i = 0; i < ptl_mait->nr_of_countries; i++) { @@ -1354,21 +1357,24 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) { if(!DVDFileSeek_(ifofile->file, ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN + ptl_mait->countries[i].pf_ptl_mai_start_byte)) { - fprintf(stderr, "libdvdread: Unable to seek PTL_MAIT table.\n"); + fprintf(stderr, "libdvdread: Unable to seek PTL_MAIT table at index %d.\n",i); free(ptl_mait->countries); free(ptl_mait); + ifofile->ptl_mait = NULL; return 0; } info_length = (ptl_mait->nr_of_vtss + 1) * sizeof(pf_level_t); pf_temp = (uint16_t *)malloc(info_length); if(!pf_temp) { free_ptl_mait(ptl_mait, i); + ifofile->ptl_mait = NULL; return 0; } if(!(DVDReadBytes(ifofile->file, pf_temp, info_length))) { - fprintf(stderr, "libdvdread: Unable to read PTL_MAIT table.\n"); + fprintf(stderr, "libdvdread: Unable to read PTL_MAIT table at index %d.\n",i); free(pf_temp); free_ptl_mait(ptl_mait, i); + ifofile->ptl_mait = NULL; return 0; } for (j = 0; j < ((ptl_mait->nr_of_vtss + 1) * 8); j++) { @@ -1378,11 +1384,12 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) { if(!ptl_mait->countries[i].pf_ptl_mai) { free(pf_temp); free_ptl_mait(ptl_mait, i); + ifofile->ptl_mait = NULL; return 0; } { /* Transpose the array so we can use C indexing. */ int level, vts; - for(level = 0; level < 8; level++) { + for(level = 0; level < PTL_MAIT_NUM_LEVEL; level++) { for(vts = 0; vts <= ptl_mait->nr_of_vtss; vts++) { ptl_mait->countries[i].pf_ptl_mai[vts][level] = pf_temp[(7-level)*(ptl_mait->nr_of_vtss+1) + vts]; diff --git a/mplayer/libfaad2/analysis.h b/mplayer/libfaad2/analysis.h deleted file mode 100644 index c40b8b9d..00000000 --- a/mplayer/libfaad2/analysis.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: analysis.h,v 1.14 2004/09/04 14:56:27 menno Exp $ -**/ - -#ifndef __ANALYSIS_H__ -#define __ANALYSIS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef ANALYSIS -#define DEBUGDEC ,uint8_t print,uint16_t var,uint8_t *dbg -#define DEBUGVAR(A,B,C) ,A,B,C -extern uint16_t dbg_count; -#else -#define DEBUGDEC -#define DEBUGVAR(A,B,C) -#endif - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/bits.c b/mplayer/libfaad2/bits.c deleted file mode 100644 index 711a489e..00000000 --- a/mplayer/libfaad2/bits.c +++ /dev/null @@ -1,213 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: bits.c,v 1.39 2004/09/04 14:56:27 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#include -#include -#include "bits.h" - -/* initialize buffer, call once before first getbits or showbits */ -void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size) -{ - uint32_t tmp; - - if (ld == NULL) - return; - - memset(ld, 0, sizeof(bitfile)); - - if (buffer_size == 0 || _buffer == NULL) - { - ld->error = 1; - ld->no_more_reading = 1; - return; - } - - ld->buffer = faad_malloc((buffer_size+12)*sizeof(uint8_t)); - memset(ld->buffer, 0, (buffer_size+12)*sizeof(uint8_t)); - memcpy(ld->buffer, _buffer, buffer_size*sizeof(uint8_t)); - - ld->buffer_size = buffer_size; - - tmp = getdword((uint32_t*)ld->buffer); - ld->bufa = tmp; - - tmp = getdword((uint32_t*)ld->buffer + 1); - ld->bufb = tmp; - - ld->start = (uint32_t*)ld->buffer; - ld->tail = ((uint32_t*)ld->buffer + 2); - - ld->bits_left = 32; - - ld->bytes_used = 0; - ld->no_more_reading = 0; - ld->error = 0; -} - -void faad_endbits(bitfile *ld) -{ - if (ld) - { - if (ld->buffer) - { - faad_free(ld->buffer); - ld->buffer = NULL; - } - } -} - -uint32_t faad_get_processed_bits(bitfile *ld) -{ - return (uint32_t)(8 * (4*(ld->tail - ld->start) - 4) - (ld->bits_left)); -} - -uint8_t faad_byte_align(bitfile *ld) -{ - uint8_t remainder = (uint8_t)((32 - ld->bits_left) % 8); - - if (remainder) - { - faad_flushbits(ld, 8 - remainder); - return (8 - remainder); - } - return 0; -} - -void faad_flushbits_ex(bitfile *ld, uint32_t bits) -{ - uint32_t tmp; - - ld->bufa = ld->bufb; - if (ld->no_more_reading == 0) - { - tmp = getdword(ld->tail); - ld->tail++; - } else { - tmp = 0; - } - ld->bufb = tmp; - ld->bits_left += (32 - bits); - ld->bytes_used += 4; - if (ld->bytes_used == ld->buffer_size) - ld->no_more_reading = 1; - if (ld->bytes_used > ld->buffer_size) - ld->error = 1; -} - -/* rewind to beginning */ -void faad_rewindbits(bitfile *ld) -{ - uint32_t tmp; - - tmp = ld->start[0]; -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif - ld->bufa = tmp; - - tmp = ld->start[1]; -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif - ld->bufb = tmp; - ld->bits_left = 32; - ld->tail = &ld->start[2]; - ld->bytes_used = 0; - ld->no_more_reading = 0; -} - -uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits - DEBUGDEC) -{ - uint16_t i; - uint8_t temp; - uint16_t bytes = (uint16_t)bits / 8; - uint8_t remainder = (uint8_t)bits % 8; - - uint8_t *buffer = (uint8_t*)faad_malloc((bytes+1)*sizeof(uint8_t)); - - for (i = 0; i < bytes; i++) - { - buffer[i] = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(print,var,dbg)); - } - - if (remainder) - { - temp = (uint8_t)faad_getbits(ld, remainder DEBUGVAR(print,var,dbg)) << (8-remainder); - - buffer[bytes] = temp; - } - - return buffer; -} - -#ifdef DRM -/* return the original data buffer */ -void *faad_origbitbuffer(bitfile *ld) -{ - return (void*)ld->start; -} - -/* return the original data buffer size */ -uint32_t faad_origbitbuffer_size(bitfile *ld) -{ - return ld->buffer_size; -} -#endif - -/* reversed bit reading routines, used for RVLC and HCR */ -void faad_initbits_rev(bitfile *ld, void *buffer, - uint32_t bits_in_buffer) -{ - uint32_t tmp; - int32_t index; - - ld->buffer_size = bit2byte(bits_in_buffer); - - index = (bits_in_buffer+31)/32 - 1; - - ld->start = (uint32_t*)buffer + index - 2; - - tmp = getdword((uint32_t*)buffer + index); - ld->bufa = tmp; - - tmp = getdword((uint32_t*)buffer + index - 1); - ld->bufb = tmp; - - ld->tail = (uint32_t*)buffer + index; - - ld->bits_left = bits_in_buffer % 32; - if (ld->bits_left == 0) - ld->bits_left = 32; - - ld->bytes_used = 0; - ld->no_more_reading = 0; - ld->error = 0; -} diff --git a/mplayer/libfaad2/bits.h b/mplayer/libfaad2/bits.h deleted file mode 100644 index 74e68c09..00000000 --- a/mplayer/libfaad2/bits.h +++ /dev/null @@ -1,385 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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 by Arpad Gereffy on 2003/08/30 -** $Id: bits.h 18786 2006-06-22 13:34:00Z diego $ -** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ -** local_changes.diff contains the exact changes to this file. -**/ - -#ifndef __BITS_H__ -#define __BITS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "analysis.h" -#ifdef ANALYSIS -#include -#endif - -#define BYTE_NUMBIT 8 -#define bit2byte(a) ((a+7)/BYTE_NUMBIT) - -typedef struct _bitfile -{ - /* bit input */ - uint32_t bufa; - uint32_t bufb; - uint32_t bits_left; - uint32_t buffer_size; /* size of the buffer in bytes */ - uint32_t bytes_used; - uint8_t no_more_reading; - uint8_t error; - uint32_t *tail; - uint32_t *start; - void *buffer; -} bitfile; - - -#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) -#define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) -#else -#define BSWAP(a) \ - ((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff)) -#endif - -static uint32_t bitmask[] = { - 0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF, - 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF, - 0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF, - 0x7FFFFF, 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF, - 0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF - /* added bitmask 32, correct?!?!?! */ - , 0xFFFFFFFF -}; - -void faad_initbits(bitfile *ld, const void *buffer, const uint32_t buffer_size); -void faad_endbits(bitfile *ld); -void faad_initbits_rev(bitfile *ld, void *buffer, - uint32_t bits_in_buffer); -uint8_t faad_byte_align(bitfile *ld); -uint32_t faad_get_processed_bits(bitfile *ld); -void faad_flushbits_ex(bitfile *ld, uint32_t bits); -void faad_rewindbits(bitfile *ld); -uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits - DEBUGDEC); -#ifdef DRM -void *faad_origbitbuffer(bitfile *ld); -uint32_t faad_origbitbuffer_size(bitfile *ld); -#endif - -/* circumvent memory alignment errors on ARM */ -static INLINE uint32_t getdword(void *mem) -{ -#ifdef ARM - uint32_t tmp; -#ifndef ARCH_IS_BIG_ENDIAN - ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[3]; - ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2]; - ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1]; - ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0]; -#else - ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0]; - ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1]; - ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2]; - ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[3]; -#endif - - return tmp; -#else - uint32_t tmp; - tmp = *(uint32_t*)mem; -#ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); -#endif - return tmp; -#endif -} - -static INLINE uint32_t faad_showbits(bitfile *ld, uint32_t bits) -{ - if (bits <= ld->bits_left) - { - return (ld->bufa >> (ld->bits_left - bits)) & bitmask[bits]; - } - - bits -= ld->bits_left; - return ((ld->bufa & bitmask[ld->bits_left]) << bits) | (ld->bufb >> (32 - bits)); -} - -static INLINE void faad_flushbits(bitfile *ld, uint32_t bits) -{ - /* do nothing if error */ - if (ld->error != 0) - return; - - if (bits < ld->bits_left) - { - ld->bits_left -= bits; - } else { - faad_flushbits_ex(ld, bits); - } -} - -/* return next n bits (right adjusted) */ -static INLINE uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC) -{ - uint32_t ret; - - if (ld->no_more_reading || n == 0) - return 0; - - ret = faad_showbits(ld, n); - faad_flushbits(ld, n); - -#ifdef ANALYSIS - if (print) - fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg); -#endif - - return ret; -} - -static INLINE uint8_t faad_get1bit(bitfile *ld DEBUGDEC) -{ - uint8_t r; - - if (ld->bits_left > 0) - { - ld->bits_left--; - r = (uint8_t)((ld->bufa >> ld->bits_left) & 1); - return r; - } - - /* bits_left == 0 */ -#if 0 - r = (uint8_t)(ld->bufb >> 31); - faad_flushbits_ex(ld, 1); -#else - r = (uint8_t)faad_getbits(ld, 1); -#endif - return r; -} - -/* reversed bitreading routines */ -static INLINE uint32_t faad_showbits_rev(bitfile *ld, uint32_t bits) -{ - uint8_t i; - uint32_t B = 0; - - if (bits <= ld->bits_left) - { - for (i = 0; i < bits; i++) - { - if (ld->bufa & (1 << (i + (32 - ld->bits_left)))) - B |= (1 << (bits - i - 1)); - } - return B; - } else { - for (i = 0; i < ld->bits_left; i++) - { - if (ld->bufa & (1 << (i + (32 - ld->bits_left)))) - B |= (1 << (bits - i - 1)); - } - for (i = 0; i < bits - ld->bits_left; i++) - { - if (ld->bufb & (1 << (i + (32-ld->bits_left)))) - B |= (1 << (bits - ld->bits_left - i - 1)); - } - return B; - } -} - -static INLINE void faad_flushbits_rev(bitfile *ld, uint32_t bits) -{ - /* do nothing if error */ - if (ld->error != 0) - return; - - if (bits < ld->bits_left) - { - ld->bits_left -= bits; - } else { - uint32_t tmp; - - ld->bufa = ld->bufb; - tmp = getdword(ld->start); - ld->bufb = tmp; - ld->start--; - ld->bits_left += (32 - bits); - - ld->bytes_used += 4; - if (ld->bytes_used == ld->buffer_size) - ld->no_more_reading = 1; - if (ld->bytes_used > ld->buffer_size) - ld->error = 1; - } -} - -static INLINE uint32_t faad_getbits_rev(bitfile *ld, uint32_t n - DEBUGDEC) -{ - uint32_t ret; - - if (ld->no_more_reading) - return 0; - - if (n == 0) - return 0; - - ret = faad_showbits_rev(ld, n); - faad_flushbits_rev(ld, n); - -#ifdef ANALYSIS - if (print) - fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg); -#endif - - return ret; -} - -#ifdef DRM -static uint8_t faad_check_CRC(bitfile *ld, uint16_t len) -{ - uint8_t CRC; - uint16_t r=255; /* Initialize to all ones */ - - /* CRC polynome used x^8 + x^4 + x^3 + x^2 +1 */ -#define GPOLY 0435 - - faad_rewindbits(ld); - - CRC = (uint8_t) ~faad_getbits(ld, 8 - DEBUGVAR(1,999,"faad_check_CRC(): CRC")); /* CRC is stored inverted */ - - for (; len>0; len--) - { - r = ( (r << 1) ^ (( ( faad_get1bit(ld - DEBUGVAR(1,998,"")) & 1) ^ ((r >> 7) & 1)) * GPOLY )) & 0xFF; - } - - if (r != CRC) - { - return 8; - } else { - return 0; - } -} - -static uint8_t tabFlipbits[256] = { - 0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240, - 8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248, - 4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244, - 12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252, - 2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242, - 10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250, - 6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246, - 14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254, - 1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241, - 9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249, - 5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245, - 13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253, - 3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243, - 11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251, - 7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247, - 15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255 -}; -#endif - -#ifdef ERROR_RESILIENCE - -/* Modified bit reading functions for HCR */ - -typedef struct -{ - /* bit input */ - uint32_t bufa; - uint32_t bufb; - int8_t len; -} bits_t; - - -static INLINE uint32_t showbits_hcr(bits_t *ld, uint8_t bits) -{ - if (bits == 0) return 0; - if (ld->len <= 32) - { - /* huffman_spectral_data_2 needs to read more than may be available, bits maybe - > ld->len, deliver 0 than */ - if (ld->len >= bits) - return ((ld->bufa >> (ld->len - bits)) & (0xFFFFFFFF >> (32 - bits))); - else - return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits))); - } else { - if ((ld->len - bits) < 32) - { - return ( (ld->bufb & (0xFFFFFFFF >> (64 - ld->len))) << (bits - ld->len + 32)) | - (ld->bufa >> (ld->len - bits)); - } else { - return ((ld->bufb >> (ld->len - bits - 32)) & (0xFFFFFFFF >> (32 - bits))); - } - } -} - -/* return 1 if position is outside of buffer, 0 otherwise */ -static INLINE int8_t flushbits_hcr( bits_t *ld, uint8_t bits) -{ - ld->len -= bits; - - if (ld->len <0) - { - ld->len = 0; - return 1; - } else { - return 0; - } -} - -static INLINE int8_t getbits_hcr(bits_t *ld, uint8_t n, uint32_t *result) -{ - *result = showbits_hcr(ld, n); - return flushbits_hcr(ld, n); -} - -static INLINE int8_t get1bit_hcr(bits_t *ld, uint8_t *result) -{ - uint32_t res; - int8_t ret; - - ret = getbits_hcr(ld, 1, &res); - *result = (int8_t)(res & 1); - return ret; -} - -#endif - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/cfft.c b/mplayer/libfaad2/cfft.c deleted file mode 100644 index b0c54ef0..00000000 --- a/mplayer/libfaad2/cfft.c +++ /dev/null @@ -1,1002 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: cfft.c,v 1.30 2004/09/08 09:43:11 gcp Exp $ -**/ - -/* - * Algorithmically based on Fortran-77 FFTPACK - * by Paul N. Swarztrauber(Version 4, 1985). - * - * Does even sized fft only - */ - -/* isign is +1 for backward and -1 for forward transforms */ - -#include "common.h" -#include "structs.h" - -#include - -#include "cfft.h" -#include "cfft_tab.h" - - -/* static function declarations */ -static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, - complex_t *ch, const complex_t *wa); -static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, - complex_t *ch, const complex_t *wa); -static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc, - complex_t *ch, const complex_t *wa1, const complex_t *wa2, const int8_t isign); -static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, - const complex_t *wa1, const complex_t *wa2, const complex_t *wa3); -static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, - const complex_t *wa1, const complex_t *wa2, const complex_t *wa3); -static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, - const complex_t *wa1, const complex_t *wa2, const complex_t *wa3, - const complex_t *wa4, const int8_t isign); -INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch, - const uint16_t *ifac, const complex_t *wa, const int8_t isign); -static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac); - - -/*---------------------------------------------------------------------- - passf2, passf3, passf4, passf5. Complex FFT passes fwd and bwd. - ----------------------------------------------------------------------*/ - -static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, - complex_t *ch, const complex_t *wa) -{ - uint16_t i, k, ah, ac; - - if (ido == 1) - { - for (k = 0; k < l1; k++) - { - ah = 2*k; - ac = 4*k; - - RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+1]); - RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]); - IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+1]); - IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]); - } - } else { - for (k = 0; k < l1; k++) - { - ah = k*ido; - ac = 2*k*ido; - - for (i = 0; i < ido; i++) - { - complex_t t2; - - RE(ch[ah+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido]); - RE(t2) = RE(cc[ac+i]) - RE(cc[ac+i+ido]); - - IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]); - IM(t2) = IM(cc[ac+i]) - IM(cc[ac+i+ido]); - -#if 1 - ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]), - IM(t2), RE(t2), RE(wa[i]), IM(wa[i])); -#else - ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]), - RE(t2), IM(t2), RE(wa[i]), IM(wa[i])); -#endif - } - } - } -} - -static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, - complex_t *ch, const complex_t *wa) -{ - uint16_t i, k, ah, ac; - - if (ido == 1) - { - for (k = 0; k < l1; k++) - { - ah = 2*k; - ac = 4*k; - - RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+1]); - RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]); - IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+1]); - IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]); - } - } else { - for (k = 0; k < l1; k++) - { - ah = k*ido; - ac = 2*k*ido; - - for (i = 0; i < ido; i++) - { - complex_t t2; - - RE(ch[ah+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido]); - RE(t2) = RE(cc[ac+i]) - RE(cc[ac+i+ido]); - - IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]); - IM(t2) = IM(cc[ac+i]) - IM(cc[ac+i+ido]); - -#if 1 - ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]), - RE(t2), IM(t2), RE(wa[i]), IM(wa[i])); -#else - ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]), - IM(t2), RE(t2), RE(wa[i]), IM(wa[i])); -#endif - } - } - } -} - - -static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc, - complex_t *ch, const complex_t *wa1, const complex_t *wa2, - const int8_t isign) -{ - static real_t taur = FRAC_CONST(-0.5); - static real_t taui = FRAC_CONST(0.866025403784439); - uint16_t i, k, ac, ah; - complex_t c2, c3, d2, d3, t2; - - if (ido == 1) - { - if (isign == 1) - { - for (k = 0; k < l1; k++) - { - ac = 3*k+1; - ah = k; - - RE(t2) = RE(cc[ac]) + RE(cc[ac+1]); - IM(t2) = IM(cc[ac]) + IM(cc[ac+1]); - RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),taur); - IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),taur); - - RE(ch[ah]) = RE(cc[ac-1]) + RE(t2); - IM(ch[ah]) = IM(cc[ac-1]) + IM(t2); - - RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+1])), taui); - IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+1])), taui); - - RE(ch[ah+l1]) = RE(c2) - IM(c3); - IM(ch[ah+l1]) = IM(c2) + RE(c3); - RE(ch[ah+2*l1]) = RE(c2) + IM(c3); - IM(ch[ah+2*l1]) = IM(c2) - RE(c3); - } - } else { - for (k = 0; k < l1; k++) - { - ac = 3*k+1; - ah = k; - - RE(t2) = RE(cc[ac]) + RE(cc[ac+1]); - IM(t2) = IM(cc[ac]) + IM(cc[ac+1]); - RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),taur); - IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),taur); - - RE(ch[ah]) = RE(cc[ac-1]) + RE(t2); - IM(ch[ah]) = IM(cc[ac-1]) + IM(t2); - - RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+1])), taui); - IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+1])), taui); - - RE(ch[ah+l1]) = RE(c2) + IM(c3); - IM(ch[ah+l1]) = IM(c2) - RE(c3); - RE(ch[ah+2*l1]) = RE(c2) - IM(c3); - IM(ch[ah+2*l1]) = IM(c2) + RE(c3); - } - } - } else { - if (isign == 1) - { - for (k = 0; k < l1; k++) - { - for (i = 0; i < ido; i++) - { - ac = i + (3*k+1)*ido; - ah = i + k * ido; - - RE(t2) = RE(cc[ac]) + RE(cc[ac+ido]); - RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),taur); - IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]); - IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),taur); - - RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2); - IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2); - - RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+ido])), taui); - IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+ido])), taui); - - RE(d2) = RE(c2) - IM(c3); - IM(d3) = IM(c2) - RE(c3); - RE(d3) = RE(c2) + IM(c3); - IM(d2) = IM(c2) + RE(c3); - -#if 1 - ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]), - IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i])); - ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]), - IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i])); -#else - ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]), - RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i])); - ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]), - RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i])); -#endif - } - } - } else { - for (k = 0; k < l1; k++) - { - for (i = 0; i < ido; i++) - { - ac = i + (3*k+1)*ido; - ah = i + k * ido; - - RE(t2) = RE(cc[ac]) + RE(cc[ac+ido]); - RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),taur); - IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]); - IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),taur); - - RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2); - IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2); - - RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+ido])), taui); - IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+ido])), taui); - - RE(d2) = RE(c2) + IM(c3); - IM(d3) = IM(c2) + RE(c3); - RE(d3) = RE(c2) - IM(c3); - IM(d2) = IM(c2) - RE(c3); - -#if 1 - ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]), - RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i])); - ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]), - RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i])); -#else - ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]), - IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i])); - ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]), - IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i])); -#endif - } - } - } - } -} - - -static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, - complex_t *ch, const complex_t *wa1, const complex_t *wa2, - const complex_t *wa3) -{ - uint16_t i, k, ac, ah; - - if (ido == 1) - { - for (k = 0; k < l1; k++) - { - complex_t t1, t2, t3, t4; - - ac = 4*k; - ah = k; - - RE(t2) = RE(cc[ac]) + RE(cc[ac+2]); - RE(t1) = RE(cc[ac]) - RE(cc[ac+2]); - IM(t2) = IM(cc[ac]) + IM(cc[ac+2]); - IM(t1) = IM(cc[ac]) - IM(cc[ac+2]); - RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]); - IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]); - IM(t3) = IM(cc[ac+3]) + IM(cc[ac+1]); - RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]); - - RE(ch[ah]) = RE(t2) + RE(t3); - RE(ch[ah+2*l1]) = RE(t2) - RE(t3); - - IM(ch[ah]) = IM(t2) + IM(t3); - IM(ch[ah+2*l1]) = IM(t2) - IM(t3); - - RE(ch[ah+l1]) = RE(t1) + RE(t4); - RE(ch[ah+3*l1]) = RE(t1) - RE(t4); - - IM(ch[ah+l1]) = IM(t1) + IM(t4); - IM(ch[ah+3*l1]) = IM(t1) - IM(t4); - } - } else { - for (k = 0; k < l1; k++) - { - ac = 4*k*ido; - ah = k*ido; - - for (i = 0; i < ido; i++) - { - complex_t c2, c3, c4, t1, t2, t3, t4; - - RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+2*ido]); - RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+2*ido]); - IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+2*ido]); - IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+2*ido]); - RE(t3) = RE(cc[ac+i+ido]) + RE(cc[ac+i+3*ido]); - IM(t4) = RE(cc[ac+i+ido]) - RE(cc[ac+i+3*ido]); - IM(t3) = IM(cc[ac+i+3*ido]) + IM(cc[ac+i+ido]); - RE(t4) = IM(cc[ac+i+3*ido]) - IM(cc[ac+i+ido]); - - RE(c2) = RE(t1) + RE(t4); - RE(c4) = RE(t1) - RE(t4); - - IM(c2) = IM(t1) + IM(t4); - IM(c4) = IM(t1) - IM(t4); - - RE(ch[ah+i]) = RE(t2) + RE(t3); - RE(c3) = RE(t2) - RE(t3); - - IM(ch[ah+i]) = IM(t2) + IM(t3); - IM(c3) = IM(t2) - IM(t3); - -#if 1 - ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]), - IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i])); - ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]), - IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i])); - ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]), - IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i])); -#else - ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]), - RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i])); - ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]), - RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i])); - ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]), - RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i])); -#endif - } - } - } -} - -static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, - complex_t *ch, const complex_t *wa1, const complex_t *wa2, - const complex_t *wa3) -{ - uint16_t i, k, ac, ah; - - if (ido == 1) - { - for (k = 0; k < l1; k++) - { - complex_t t1, t2, t3, t4; - - ac = 4*k; - ah = k; - - RE(t2) = RE(cc[ac]) + RE(cc[ac+2]); - RE(t1) = RE(cc[ac]) - RE(cc[ac+2]); - IM(t2) = IM(cc[ac]) + IM(cc[ac+2]); - IM(t1) = IM(cc[ac]) - IM(cc[ac+2]); - RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]); - IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]); - IM(t3) = IM(cc[ac+3]) + IM(cc[ac+1]); - RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]); - - RE(ch[ah]) = RE(t2) + RE(t3); - RE(ch[ah+2*l1]) = RE(t2) - RE(t3); - - IM(ch[ah]) = IM(t2) + IM(t3); - IM(ch[ah+2*l1]) = IM(t2) - IM(t3); - - RE(ch[ah+l1]) = RE(t1) - RE(t4); - RE(ch[ah+3*l1]) = RE(t1) + RE(t4); - - IM(ch[ah+l1]) = IM(t1) - IM(t4); - IM(ch[ah+3*l1]) = IM(t1) + IM(t4); - } - } else { - for (k = 0; k < l1; k++) - { - ac = 4*k*ido; - ah = k*ido; - - for (i = 0; i < ido; i++) - { - complex_t c2, c3, c4, t1, t2, t3, t4; - - RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+2*ido]); - RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+2*ido]); - IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+2*ido]); - IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+2*ido]); - RE(t3) = RE(cc[ac+i+ido]) + RE(cc[ac+i+3*ido]); - IM(t4) = RE(cc[ac+i+ido]) - RE(cc[ac+i+3*ido]); - IM(t3) = IM(cc[ac+i+3*ido]) + IM(cc[ac+i+ido]); - RE(t4) = IM(cc[ac+i+3*ido]) - IM(cc[ac+i+ido]); - - RE(c2) = RE(t1) - RE(t4); - RE(c4) = RE(t1) + RE(t4); - - IM(c2) = IM(t1) - IM(t4); - IM(c4) = IM(t1) + IM(t4); - - RE(ch[ah+i]) = RE(t2) + RE(t3); - RE(c3) = RE(t2) - RE(t3); - - IM(ch[ah+i]) = IM(t2) + IM(t3); - IM(c3) = IM(t2) - IM(t3); - -#if 1 - ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]), - RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i])); - ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]), - RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i])); - ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]), - RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i])); -#else - ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]), - IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i])); - ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]), - IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i])); - ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]), - IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i])); -#endif - } - } - } -} - -static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc, - complex_t *ch, const complex_t *wa1, const complex_t *wa2, const complex_t *wa3, - const complex_t *wa4, const int8_t isign) -{ - static real_t tr11 = FRAC_CONST(0.309016994374947); - static real_t ti11 = FRAC_CONST(0.951056516295154); - static real_t tr12 = FRAC_CONST(-0.809016994374947); - static real_t ti12 = FRAC_CONST(0.587785252292473); - uint16_t i, k, ac, ah; - complex_t c2, c3, c4, c5, d3, d4, d5, d2, t2, t3, t4, t5; - - if (ido == 1) - { - if (isign == 1) - { - for (k = 0; k < l1; k++) - { - ac = 5*k + 1; - ah = k; - - RE(t2) = RE(cc[ac]) + RE(cc[ac+3]); - IM(t2) = IM(cc[ac]) + IM(cc[ac+3]); - RE(t3) = RE(cc[ac+1]) + RE(cc[ac+2]); - IM(t3) = IM(cc[ac+1]) + IM(cc[ac+2]); - RE(t4) = RE(cc[ac+1]) - RE(cc[ac+2]); - IM(t4) = IM(cc[ac+1]) - IM(cc[ac+2]); - RE(t5) = RE(cc[ac]) - RE(cc[ac+3]); - IM(t5) = IM(cc[ac]) - IM(cc[ac+3]); - - RE(ch[ah]) = RE(cc[ac-1]) + RE(t2) + RE(t3); - IM(ch[ah]) = IM(cc[ac-1]) + IM(t2) + IM(t3); - - RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12); - IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12); - RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11); - IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11); - - ComplexMult(&RE(c5), &RE(c4), - ti11, ti12, RE(t5), RE(t4)); - ComplexMult(&IM(c5), &IM(c4), - ti11, ti12, IM(t5), IM(t4)); - - RE(ch[ah+l1]) = RE(c2) - IM(c5); - IM(ch[ah+l1]) = IM(c2) + RE(c5); - RE(ch[ah+2*l1]) = RE(c3) - IM(c4); - IM(ch[ah+2*l1]) = IM(c3) + RE(c4); - RE(ch[ah+3*l1]) = RE(c3) + IM(c4); - IM(ch[ah+3*l1]) = IM(c3) - RE(c4); - RE(ch[ah+4*l1]) = RE(c2) + IM(c5); - IM(ch[ah+4*l1]) = IM(c2) - RE(c5); - } - } else { - for (k = 0; k < l1; k++) - { - ac = 5*k + 1; - ah = k; - - RE(t2) = RE(cc[ac]) + RE(cc[ac+3]); - IM(t2) = IM(cc[ac]) + IM(cc[ac+3]); - RE(t3) = RE(cc[ac+1]) + RE(cc[ac+2]); - IM(t3) = IM(cc[ac+1]) + IM(cc[ac+2]); - RE(t4) = RE(cc[ac+1]) - RE(cc[ac+2]); - IM(t4) = IM(cc[ac+1]) - IM(cc[ac+2]); - RE(t5) = RE(cc[ac]) - RE(cc[ac+3]); - IM(t5) = IM(cc[ac]) - IM(cc[ac+3]); - - RE(ch[ah]) = RE(cc[ac-1]) + RE(t2) + RE(t3); - IM(ch[ah]) = IM(cc[ac-1]) + IM(t2) + IM(t3); - - RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12); - IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12); - RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11); - IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11); - - ComplexMult(&RE(c4), &RE(c5), - ti12, ti11, RE(t5), RE(t4)); - ComplexMult(&IM(c4), &IM(c5), - ti12, ti12, IM(t5), IM(t4)); - - RE(ch[ah+l1]) = RE(c2) + IM(c5); - IM(ch[ah+l1]) = IM(c2) - RE(c5); - RE(ch[ah+2*l1]) = RE(c3) + IM(c4); - IM(ch[ah+2*l1]) = IM(c3) - RE(c4); - RE(ch[ah+3*l1]) = RE(c3) - IM(c4); - IM(ch[ah+3*l1]) = IM(c3) + RE(c4); - RE(ch[ah+4*l1]) = RE(c2) - IM(c5); - IM(ch[ah+4*l1]) = IM(c2) + RE(c5); - } - } - } else { - if (isign == 1) - { - for (k = 0; k < l1; k++) - { - for (i = 0; i < ido; i++) - { - ac = i + (k*5 + 1) * ido; - ah = i + k * ido; - - RE(t2) = RE(cc[ac]) + RE(cc[ac+3*ido]); - IM(t2) = IM(cc[ac]) + IM(cc[ac+3*ido]); - RE(t3) = RE(cc[ac+ido]) + RE(cc[ac+2*ido]); - IM(t3) = IM(cc[ac+ido]) + IM(cc[ac+2*ido]); - RE(t4) = RE(cc[ac+ido]) - RE(cc[ac+2*ido]); - IM(t4) = IM(cc[ac+ido]) - IM(cc[ac+2*ido]); - RE(t5) = RE(cc[ac]) - RE(cc[ac+3*ido]); - IM(t5) = IM(cc[ac]) - IM(cc[ac+3*ido]); - - RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2) + RE(t3); - IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2) + IM(t3); - - RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12); - IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12); - RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11); - IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11); - - ComplexMult(&RE(c5), &RE(c4), - ti11, ti12, RE(t5), RE(t4)); - ComplexMult(&IM(c5), &IM(c4), - ti11, ti12, IM(t5), IM(t4)); - - IM(d2) = IM(c2) + RE(c5); - IM(d3) = IM(c3) + RE(c4); - RE(d4) = RE(c3) + IM(c4); - RE(d5) = RE(c2) + IM(c5); - RE(d2) = RE(c2) - IM(c5); - IM(d5) = IM(c2) - RE(c5); - RE(d3) = RE(c3) - IM(c4); - IM(d4) = IM(c3) - RE(c4); - -#if 1 - ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]), - IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i])); - ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]), - IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i])); - ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]), - IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i])); - ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]), - IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i])); -#else - ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]), - RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i])); - ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]), - RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i])); - ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]), - RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i])); - ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]), - RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i])); -#endif - } - } - } else { - for (k = 0; k < l1; k++) - { - for (i = 0; i < ido; i++) - { - ac = i + (k*5 + 1) * ido; - ah = i + k * ido; - - RE(t2) = RE(cc[ac]) + RE(cc[ac+3*ido]); - IM(t2) = IM(cc[ac]) + IM(cc[ac+3*ido]); - RE(t3) = RE(cc[ac+ido]) + RE(cc[ac+2*ido]); - IM(t3) = IM(cc[ac+ido]) + IM(cc[ac+2*ido]); - RE(t4) = RE(cc[ac+ido]) - RE(cc[ac+2*ido]); - IM(t4) = IM(cc[ac+ido]) - IM(cc[ac+2*ido]); - RE(t5) = RE(cc[ac]) - RE(cc[ac+3*ido]); - IM(t5) = IM(cc[ac]) - IM(cc[ac+3*ido]); - - RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2) + RE(t3); - IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2) + IM(t3); - - RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12); - IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12); - RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11); - IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11); - - ComplexMult(&RE(c4), &RE(c5), - ti12, ti11, RE(t5), RE(t4)); - ComplexMult(&IM(c4), &IM(c5), - ti12, ti12, IM(t5), IM(t4)); - - IM(d2) = IM(c2) - RE(c5); - IM(d3) = IM(c3) - RE(c4); - RE(d4) = RE(c3) - IM(c4); - RE(d5) = RE(c2) - IM(c5); - RE(d2) = RE(c2) + IM(c5); - IM(d5) = IM(c2) + RE(c5); - RE(d3) = RE(c3) + IM(c4); - IM(d4) = IM(c3) + RE(c4); - -#if 1 - ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]), - RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i])); - ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]), - RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i])); - ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]), - RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i])); - ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]), - RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i])); -#else - ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]), - IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i])); - ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]), - IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i])); - ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]), - IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i])); - ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]), - IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i])); -#endif - } - } - } - } -} - - -/*---------------------------------------------------------------------- - cfftf1, cfftf, cfftb, cffti1, cffti. Complex FFTs. - ----------------------------------------------------------------------*/ - -static INLINE void cfftf1pos(uint16_t n, complex_t *c, complex_t *ch, - const uint16_t *ifac, const complex_t *wa, - const int8_t isign) -{ - uint16_t i; - uint16_t k1, l1, l2; - uint16_t na, nf, ip, iw, ix2, ix3, ix4, ido, idl1; - - nf = ifac[1]; - na = 0; - l1 = 1; - iw = 0; - - for (k1 = 2; k1 <= nf+1; k1++) - { - ip = ifac[k1]; - l2 = ip*l1; - ido = n / l2; - idl1 = ido*l1; - - switch (ip) - { - case 4: - ix2 = iw + ido; - ix3 = ix2 + ido; - - if (na == 0) - passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]); - else - passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]); - - na = 1 - na; - break; - case 2: - if (na == 0) - passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]); - else - passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]); - - na = 1 - na; - break; - case 3: - ix2 = iw + ido; - - if (na == 0) - passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign); - else - passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign); - - na = 1 - na; - break; - case 5: - ix2 = iw + ido; - ix3 = ix2 + ido; - ix4 = ix3 + ido; - - if (na == 0) - passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); - else - passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); - - na = 1 - na; - break; - } - - l1 = l2; - iw += (ip-1) * ido; - } - - if (na == 0) - return; - - for (i = 0; i < n; i++) - { - RE(c[i]) = RE(ch[i]); - IM(c[i]) = IM(ch[i]); - } -} - -static INLINE void cfftf1neg(uint16_t n, complex_t *c, complex_t *ch, - const uint16_t *ifac, const complex_t *wa, - const int8_t isign) -{ - uint16_t i; - uint16_t k1, l1, l2; - uint16_t na, nf, ip, iw, ix2, ix3, ix4, ido, idl1; - - nf = ifac[1]; - na = 0; - l1 = 1; - iw = 0; - - for (k1 = 2; k1 <= nf+1; k1++) - { - ip = ifac[k1]; - l2 = ip*l1; - ido = n / l2; - idl1 = ido*l1; - - switch (ip) - { - case 4: - ix2 = iw + ido; - ix3 = ix2 + ido; - - if (na == 0) - passf4neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]); - else - passf4neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]); - - na = 1 - na; - break; - case 2: - if (na == 0) - passf2neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]); - else - passf2neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]); - - na = 1 - na; - break; - case 3: - ix2 = iw + ido; - - if (na == 0) - passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign); - else - passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign); - - na = 1 - na; - break; - case 5: - ix2 = iw + ido; - ix3 = ix2 + ido; - ix4 = ix3 + ido; - - if (na == 0) - passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); - else - passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); - - na = 1 - na; - break; - } - - l1 = l2; - iw += (ip-1) * ido; - } - - if (na == 0) - return; - - for (i = 0; i < n; i++) - { - RE(c[i]) = RE(ch[i]); - IM(c[i]) = IM(ch[i]); - } -} - -void cfftf(cfft_info *cfft, complex_t *c) -{ - cfftf1neg(cfft->n, c, cfft->work, (const uint16_t*)cfft->ifac, (const complex_t*)cfft->tab, -1); -} - -void cfftb(cfft_info *cfft, complex_t *c) -{ - cfftf1pos(cfft->n, c, cfft->work, (const uint16_t*)cfft->ifac, (const complex_t*)cfft->tab, +1); -} - -static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac) -{ - static uint16_t ntryh[4] = {3, 4, 2, 5}; -#ifndef FIXED_POINT - real_t arg, argh, argld, fi; - uint16_t ido, ipm; - uint16_t i1, k1, l1, l2; - uint16_t ld, ii, ip; -#endif - uint16_t ntry = 0, i, j; - uint16_t ib; - uint16_t nf, nl, nq, nr; - - nl = n; - nf = 0; - j = 0; - -startloop: - j++; - - if (j <= 4) - ntry = ntryh[j-1]; - else - ntry += 2; - - do - { - nq = nl / ntry; - nr = nl - ntry*nq; - - if (nr != 0) - goto startloop; - - nf++; - ifac[nf+1] = ntry; - nl = nq; - - if (ntry == 2 && nf != 1) - { - for (i = 2; i <= nf; i++) - { - ib = nf - i + 2; - ifac[ib+1] = ifac[ib]; - } - ifac[2] = 2; - } - } while (nl != 1); - - ifac[0] = n; - ifac[1] = nf; - -#ifndef FIXED_POINT - argh = (real_t)2.0*(real_t)M_PI / (real_t)n; - i = 0; - l1 = 1; - - for (k1 = 1; k1 <= nf; k1++) - { - ip = ifac[k1+1]; - ld = 0; - l2 = l1*ip; - ido = n / l2; - ipm = ip - 1; - - for (j = 0; j < ipm; j++) - { - i1 = i; - RE(wa[i]) = 1.0; - IM(wa[i]) = 0.0; - ld += l1; - fi = 0; - argld = ld*argh; - - for (ii = 0; ii < ido; ii++) - { - i++; - fi++; - arg = fi * argld; - RE(wa[i]) = (real_t)cos(arg); -#if 1 - IM(wa[i]) = (real_t)sin(arg); -#else - IM(wa[i]) = (real_t)-sin(arg); -#endif - } - - if (ip > 5) - { - RE(wa[i1]) = RE(wa[i]); - IM(wa[i1]) = IM(wa[i]); - } - } - l1 = l2; - } -#endif -} - -cfft_info *cffti(uint16_t n) -{ - cfft_info *cfft = (cfft_info*)faad_malloc(sizeof(cfft_info)); - - cfft->n = n; - cfft->work = (complex_t*)faad_malloc(n*sizeof(complex_t)); - -#ifndef FIXED_POINT - cfft->tab = (complex_t*)faad_malloc(n*sizeof(complex_t)); - - cffti1(n, cfft->tab, cfft->ifac); -#else - cffti1(n, NULL, cfft->ifac); - - switch (n) - { - case 64: cfft->tab = (complex_t*)cfft_tab_64; break; - case 512: cfft->tab = (complex_t*)cfft_tab_512; break; -#ifdef LD_DEC - case 256: cfft->tab = (complex_t*)cfft_tab_256; break; -#endif - -#ifdef ALLOW_SMALL_FRAMELENGTH - case 60: cfft->tab = (complex_t*)cfft_tab_60; break; - case 480: cfft->tab = (complex_t*)cfft_tab_480; break; -#ifdef LD_DEC - case 240: cfft->tab = (complex_t*)cfft_tab_240; break; -#endif -#endif - case 128: cfft->tab = (complex_t*)cfft_tab_128; break; - } -#endif - - return cfft; -} - -void cfftu(cfft_info *cfft) -{ - if (cfft->work) faad_free(cfft->work); -#ifndef FIXED_POINT - if (cfft->tab) faad_free(cfft->tab); -#endif - - if (cfft) faad_free(cfft); -} - diff --git a/mplayer/libfaad2/cfft.h b/mplayer/libfaad2/cfft.h deleted file mode 100644 index cdde2225..00000000 --- a/mplayer/libfaad2/cfft.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: cfft.h,v 1.20 2004/09/08 09:43:11 gcp Exp $ -**/ - -#ifndef __CFFT_H__ -#define __CFFT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct -{ - uint16_t n; - uint16_t ifac[15]; - complex_t *work; - complex_t *tab; -} cfft_info; - - -void cfftf(cfft_info *cfft, complex_t *c); -void cfftb(cfft_info *cfft, complex_t *c); -cfft_info *cffti(uint16_t n); -void cfftu(cfft_info *cfft); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/cfft_tab.h b/mplayer/libfaad2/cfft_tab.h deleted file mode 100644 index 5d5b45a6..00000000 --- a/mplayer/libfaad2/cfft_tab.h +++ /dev/null @@ -1,1820 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: cfft_tab.h,v 1.17 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __CFFT_TAB_H__ -#define __CFFT_TAB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef FIXED_POINT - -ALIGN static const complex_t cfft_tab_512[] = -{ - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.999924719333649), FRAC_CONST(0.012271538376808) }, - { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) }, - { FRAC_CONST(0.999322354793549), FRAC_CONST(0.036807224154472) }, - { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, - { FRAC_CONST(0.998118102550507), FRAC_CONST(0.061320740729570) }, - { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, - { FRAC_CONST(0.996312618255615), FRAC_CONST(0.085797317326069) }, - { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, - { FRAC_CONST(0.993906974792480), FRAC_CONST(0.110222205519676) }, - { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) }, - { FRAC_CONST(0.990902662277222), FRAC_CONST(0.134580716490746) }, - { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, - { FRAC_CONST(0.987301409244537), FRAC_CONST(0.158858150243759) }, - { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) }, - { FRAC_CONST(0.983105480670929), FRAC_CONST(0.183039888739586) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.978317379951477), FRAC_CONST(0.207111388444901) }, - { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, - { FRAC_CONST(0.972939968109131), FRAC_CONST(0.231058120727539) }, - { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, - { FRAC_CONST(0.966976463794708), FRAC_CONST(0.254865676164627) }, - { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) }, - { FRAC_CONST(0.960430502891541), FRAC_CONST(0.278519690036774) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.953306019306183), FRAC_CONST(0.302005946636200) }, - { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) }, - { FRAC_CONST(0.945607304573059), FRAC_CONST(0.325310319662094) }, - { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, - { FRAC_CONST(0.937339007854462), FRAC_CONST(0.348418682813644) }, - { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, - { FRAC_CONST(0.928506076335907), FRAC_CONST(0.371317207813263) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.919113874435425), FRAC_CONST(0.393992066383362) }, - { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) }, - { FRAC_CONST(0.909167945384979), FRAC_CONST(0.416429579257965) }, - { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, - { FRAC_CONST(0.898674488067627), FRAC_CONST(0.438616245985031) }, - { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) }, - { FRAC_CONST(0.887639641761780), FRAC_CONST(0.460538715124130) }, - { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, - { FRAC_CONST(0.876070082187653), FRAC_CONST(0.482183754444122) }, - { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, - { FRAC_CONST(0.863972842693329), FRAC_CONST(0.503538370132446) }, - { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, - { FRAC_CONST(0.851355195045471), FRAC_CONST(0.524589717388153) }, - { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) }, - { FRAC_CONST(0.838224709033966), FRAC_CONST(0.545324981212616) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.824589252471924), FRAC_CONST(0.565731823444366) }, - { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) }, - { FRAC_CONST(0.810457170009613), FRAC_CONST(0.585797905921936) }, - { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, - { FRAC_CONST(0.795836925506592), FRAC_CONST(0.605511009693146) }, - { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) }, - { FRAC_CONST(0.780737221240997), FRAC_CONST(0.624859511852264) }, - { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, - { FRAC_CONST(0.765167236328125), FRAC_CONST(0.643831551074982) }, - { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) }, - { FRAC_CONST(0.749136388301849), FRAC_CONST(0.662415802478790) }, - { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, - { FRAC_CONST(0.732654273509979), FRAC_CONST(0.680601000785828) }, - { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) }, - { FRAC_CONST(0.715730786323547), FRAC_CONST(0.698376297950745) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.698376238346100), FRAC_CONST(0.715730845928192) }, - { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, - { FRAC_CONST(0.680601000785828), FRAC_CONST(0.732654273509979) }, - { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, - { FRAC_CONST(0.662415742874146), FRAC_CONST(0.749136388301849) }, - { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) }, - { FRAC_CONST(0.643831551074982), FRAC_CONST(0.765167295932770) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.624859452247620), FRAC_CONST(0.780737280845642) }, - { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) }, - { FRAC_CONST(0.605511009693146), FRAC_CONST(0.795836925506592) }, - { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, - { FRAC_CONST(0.585797846317291), FRAC_CONST(0.810457170009613) }, - { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) }, - { FRAC_CONST(0.565731823444366), FRAC_CONST(0.824589312076569) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.545324981212616), FRAC_CONST(0.838224709033966) }, - { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) }, - { FRAC_CONST(0.524589657783508), FRAC_CONST(0.851355195045471) }, - { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, - { FRAC_CONST(0.503538429737091), FRAC_CONST(0.863972842693329) }, - { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) }, - { FRAC_CONST(0.482183724641800), FRAC_CONST(0.876070141792297) }, - { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, - { FRAC_CONST(0.460538715124130), FRAC_CONST(0.887639641761780) }, - { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, - { FRAC_CONST(0.438616186380386), FRAC_CONST(0.898674488067627) }, - { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, - { FRAC_CONST(0.416429549455643), FRAC_CONST(0.909168004989624) }, - { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) }, - { FRAC_CONST(0.393991947174072), FRAC_CONST(0.919113874435425) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.371317148208618), FRAC_CONST(0.928506076335907) }, - { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) }, - { FRAC_CONST(0.348418682813644), FRAC_CONST(0.937339007854462) }, - { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, - { FRAC_CONST(0.325310230255127), FRAC_CONST(0.945607364177704) }, - { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) }, - { FRAC_CONST(0.302005946636200), FRAC_CONST(0.953306019306183) }, - { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, - { FRAC_CONST(0.278519600629807), FRAC_CONST(0.960430562496185) }, - { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) }, - { FRAC_CONST(0.254865646362305), FRAC_CONST(0.966976463794708) }, - { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, - { FRAC_CONST(0.231058135628700), FRAC_CONST(0.972939968109131) }, - { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) }, - { FRAC_CONST(0.207111328840256), FRAC_CONST(0.978317379951477) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(0.183039888739586), FRAC_CONST(0.983105480670929) }, - { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, - { FRAC_CONST(0.158858075737953), FRAC_CONST(0.987301409244537) }, - { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, - { FRAC_CONST(0.134580686688423), FRAC_CONST(0.990902662277222) }, - { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) }, - { FRAC_CONST(0.110222116112709), FRAC_CONST(0.993906974792480) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(0.085797272622585), FRAC_CONST(0.996312618255615) }, - { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) }, - { FRAC_CONST(0.061320748180151), FRAC_CONST(0.998118102550507) }, - { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, - { FRAC_CONST(0.036807164549828), FRAC_CONST(0.999322414398193) }, - { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) }, - { FRAC_CONST(0.012271529063582), FRAC_CONST(0.999924719333649) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.012271616607904), FRAC_CONST(0.999924719333649) }, - { FRAC_CONST(-0.024541223421693), FRAC_CONST(0.999698817729950) }, - { FRAC_CONST(-0.036807250231504), FRAC_CONST(0.999322354793549) }, - { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, - { FRAC_CONST(-0.061320833861828), FRAC_CONST(0.998118102550507) }, - { FRAC_CONST(-0.073564574122429), FRAC_CONST(0.997290432453156) }, - { FRAC_CONST(-0.085797362029552), FRAC_CONST(0.996312618255615) }, - { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(-0.110222205519676), FRAC_CONST(0.993906974792480) }, - { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) }, - { FRAC_CONST(-0.134580776095390), FRAC_CONST(0.990902602672577) }, - { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) }, - { FRAC_CONST(-0.158858165144920), FRAC_CONST(0.987301409244537) }, - { FRAC_CONST(-0.170961946249008), FRAC_CONST(0.985277652740479) }, - { FRAC_CONST(-0.183039978146553), FRAC_CONST(0.983105480670929) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.207111418247223), FRAC_CONST(0.978317379951477) }, - { FRAC_CONST(-0.219101309776306), FRAC_CONST(0.975702106952667) }, - { FRAC_CONST(-0.231058210134506), FRAC_CONST(0.972939908504486) }, - { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) }, - { FRAC_CONST(-0.254865705966949), FRAC_CONST(0.966976463794708) }, - { FRAC_CONST(-0.266712844371796), FRAC_CONST(0.963776051998138) }, - { FRAC_CONST(-0.278519690036774), FRAC_CONST(0.960430502891541) }, - { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) }, - { FRAC_CONST(-0.302006036043167), FRAC_CONST(0.953306019306183) }, - { FRAC_CONST(-0.313681721687317), FRAC_CONST(0.949528157711029) }, - { FRAC_CONST(-0.325310319662094), FRAC_CONST(0.945607304573059) }, - { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) }, - { FRAC_CONST(-0.348418772220612), FRAC_CONST(0.937338948249817) }, - { FRAC_CONST(-0.359895050525665), FRAC_CONST(0.932992815971375) }, - { FRAC_CONST(-0.371317237615585), FRAC_CONST(0.928506076335907) }, - { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.393992036581039), FRAC_CONST(0.919113874435425) }, - { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) }, - { FRAC_CONST(-0.416429519653320), FRAC_CONST(0.909168004989624) }, - { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) }, - { FRAC_CONST(-0.438616245985031), FRAC_CONST(0.898674428462982) }, - { FRAC_CONST(-0.449611365795136), FRAC_CONST(0.893224298954010) }, - { FRAC_CONST(-0.460538804531097), FRAC_CONST(0.887639582157135) }, - { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, - { FRAC_CONST(-0.482183903455734), FRAC_CONST(0.876070022583008) }, - { FRAC_CONST(-0.492898166179657), FRAC_CONST(0.870087027549744) }, - { FRAC_CONST(-0.503538370132446), FRAC_CONST(0.863972842693329) }, - { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) }, - { FRAC_CONST(-0.524589717388153), FRAC_CONST(0.851355135440826) }, - { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) }, - { FRAC_CONST(-0.545325100421906), FRAC_CONST(0.838224649429321) }, - { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, - { FRAC_CONST(-0.565731763839722), FRAC_CONST(0.824589312076569) }, - { FRAC_CONST(-0.575808167457581), FRAC_CONST(0.817584812641144) }, - { FRAC_CONST(-0.585797905921936), FRAC_CONST(0.810457170009613) }, - { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, - { FRAC_CONST(-0.605511128902435), FRAC_CONST(0.795836865901947) }, - { FRAC_CONST(-0.615231692790985), FRAC_CONST(0.788346350193024) }, - { FRAC_CONST(-0.624859631061554), FRAC_CONST(0.780737102031708) }, - { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) }, - { FRAC_CONST(-0.643831551074982), FRAC_CONST(0.765167236328125) }, - { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) }, - { FRAC_CONST(-0.662415802478790), FRAC_CONST(0.749136328697205) }, - { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) }, - { FRAC_CONST(-0.680601119995117), FRAC_CONST(0.732654154300690) }, - { FRAC_CONST(-0.689540684223175), FRAC_CONST(0.724246978759766) }, - { FRAC_CONST(-0.698376238346100), FRAC_CONST(0.715730845928192) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.715730845928192), FRAC_CONST(0.698376238346100) }, - { FRAC_CONST(-0.724247157573700), FRAC_CONST(0.689540505409241) }, - { FRAC_CONST(-0.732654333114624), FRAC_CONST(0.680600941181183) }, - { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) }, - { FRAC_CONST(-0.749136507511139), FRAC_CONST(0.662415623664856) }, - { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) }, - { FRAC_CONST(-0.765167295932770), FRAC_CONST(0.643831551074982) }, - { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) }, - { FRAC_CONST(-0.780737280845642), FRAC_CONST(0.624859452247620) }, - { FRAC_CONST(-0.788346469402313), FRAC_CONST(0.615231513977051) }, - { FRAC_CONST(-0.795836985111237), FRAC_CONST(0.605510950088501) }, - { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) }, - { FRAC_CONST(-0.810457170009613), FRAC_CONST(0.585797846317291) }, - { FRAC_CONST(-0.817584812641144), FRAC_CONST(0.575808167457581) }, - { FRAC_CONST(-0.824589312076569), FRAC_CONST(0.565731763839722) }, - { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, - { FRAC_CONST(-0.838224768638611), FRAC_CONST(0.545324862003326) }, - { FRAC_CONST(-0.844853639602661), FRAC_CONST(0.534997463226318) }, - { FRAC_CONST(-0.851355314254761), FRAC_CONST(0.524589538574219) }, - { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) }, - { FRAC_CONST(-0.863972842693329), FRAC_CONST(0.503538370132446) }, - { FRAC_CONST(-0.870087027549744), FRAC_CONST(0.492898136377335) }, - { FRAC_CONST(-0.876070141792297), FRAC_CONST(0.482183694839478) }, - { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) }, - { FRAC_CONST(-0.887639701366425), FRAC_CONST(0.460538566112518) }, - { FRAC_CONST(-0.893224298954010), FRAC_CONST(0.449611365795136) }, - { FRAC_CONST(-0.898674488067627), FRAC_CONST(0.438616245985031) }, - { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) }, - { FRAC_CONST(-0.909168004989624), FRAC_CONST(0.416429489850998) }, - { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) }, - { FRAC_CONST(-0.919113874435425), FRAC_CONST(0.393991917371750) }, - { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, - { FRAC_CONST(-0.928506076335907), FRAC_CONST(0.371317237615585) }, - { FRAC_CONST(-0.932992815971375), FRAC_CONST(0.359895050525665) }, - { FRAC_CONST(-0.937339007854462), FRAC_CONST(0.348418653011322) }, - { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, - { FRAC_CONST(-0.945607364177704), FRAC_CONST(0.325310200452805) }, - { FRAC_CONST(-0.949528217315674), FRAC_CONST(0.313681602478027) }, - { FRAC_CONST(-0.953306078910828), FRAC_CONST(0.302005797624588) }, - { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) }, - { FRAC_CONST(-0.960430502891541), FRAC_CONST(0.278519690036774) }, - { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) }, - { FRAC_CONST(-0.966976463794708), FRAC_CONST(0.254865586757660) }, - { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) }, - { FRAC_CONST(-0.972939968109131), FRAC_CONST(0.231057971715927) }, - { FRAC_CONST(-0.975702166557312), FRAC_CONST(0.219101071357727) }, - { FRAC_CONST(-0.978317379951477), FRAC_CONST(0.207111403346062) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(-0.983105480670929), FRAC_CONST(0.183039844036102) }, - { FRAC_CONST(-0.985277652740479), FRAC_CONST(0.170961812138557) }, - { FRAC_CONST(-0.987301409244537), FRAC_CONST(0.158858031034470) }, - { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) }, - { FRAC_CONST(-0.990902662277222), FRAC_CONST(0.134580522775650) }, - { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) }, - { FRAC_CONST(-0.993906974792480), FRAC_CONST(0.110222198069096) }, - { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) }, - { FRAC_CONST(-0.996312618255615), FRAC_CONST(0.085797227919102) }, - { FRAC_CONST(-0.997290492057800), FRAC_CONST(0.073564447462559) }, - { FRAC_CONST(-0.998118102550507), FRAC_CONST(0.061320584267378) }, - { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) }, - { FRAC_CONST(-0.999322354793549), FRAC_CONST(0.036807239055634) }, - { FRAC_CONST(-0.999698817729950), FRAC_CONST(0.024541210383177) }, - { FRAC_CONST(-0.999924719333649), FRAC_CONST(0.012271485291421) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) }, - { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, - { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, - { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, - { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) }, - { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, - { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, - { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, - { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) }, - { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, - { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) }, - { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, - { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) }, - { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, - { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, - { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, - { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) }, - { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, - { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) }, - { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, - { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) }, - { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, - { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, - { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, - { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) }, - { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, - { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) }, - { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, - { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) }, - { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, - { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, - { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, - { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) }, - { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, - { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) }, - { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, - { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) }, - { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, - { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, - { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, - { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) }, - { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, - { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, - { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, - { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, - { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, - { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, - { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, - { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, - { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, - { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, - { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, - { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, - { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) }, - { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) }, - { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) }, - { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) }, - { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, - { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) }, - { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, - { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, - { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) }, - { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) }, - { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) }, - { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) }, - { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, - { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) }, - { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) }, - { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) }, - { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, - { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, - { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) }, - { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) }, - { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) }, - { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, - { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, - { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, - { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, - { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.788346469402313), FRAC_CONST(0.615231573581696) }, - { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, - { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.575808227062225), FRAC_CONST(0.817584812641144) }, - { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, - { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.313681751489639), FRAC_CONST(0.949528157711029) }, - { FRAC_CONST(0.242980241775513), FRAC_CONST(0.970031261444092) }, - { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(0.024541255086660), FRAC_CONST(0.999698817729950) }, - { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, - { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.266712725162506), FRAC_CONST(0.963776051998138) }, - { FRAC_CONST(-0.336889803409576), FRAC_CONST(0.941544055938721) }, - { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) }, - { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, - { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) }, - { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, - { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) }, - { FRAC_CONST(-0.803207516670227), FRAC_CONST(0.595699369907379) }, - { FRAC_CONST(-0.844853520393372), FRAC_CONST(0.534997701644897) }, - { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, - { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) }, - { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, - { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) }, - { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067724496126) }, - { FRAC_CONST(-0.999698817729950), FRAC_CONST(-0.024541147053242) }, - { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, - { FRAC_CONST(-0.985277652740479), FRAC_CONST(-0.170961990952492) }, - { FRAC_CONST(-0.970031261444092), FRAC_CONST(-0.242980241775513) }, - { FRAC_CONST(-0.949528157711029), FRAC_CONST(-0.313681781291962) }, - { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, - { FRAC_CONST(-0.893224298954010), FRAC_CONST(-0.449611306190491) }, - { FRAC_CONST(-0.857728660106659), FRAC_CONST(-0.514102697372437) }, - { FRAC_CONST(-0.817584872245789), FRAC_CONST(-0.575808107852936) }, - { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, - { FRAC_CONST(-0.724247038364410), FRAC_CONST(-0.689540624618530) }, - { FRAC_CONST(-0.671558916568756), FRAC_CONST(-0.740951180458069) }, - { FRAC_CONST(-0.615231573581696), FRAC_CONST(-0.788346469402313) }, - { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, - { FRAC_CONST(-0.492898195981979), FRAC_CONST(-0.870086967945099) }, - { FRAC_CONST(-0.427554935216904), FRAC_CONST(-0.903989374637604) }, - { FRAC_CONST(-0.359895110130310), FRAC_CONST(-0.932992756366730) }, - { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, - { FRAC_CONST(-0.219101369380951), FRAC_CONST(-0.975702106952667) }, - { FRAC_CONST(-0.146730408072472), FRAC_CONST(-0.989176511764526) }, - { FRAC_CONST(-0.073564760386944), FRAC_CONST(-0.997290432453156) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, - { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, - { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, - { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, - { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, - { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) } -}; - -#ifdef ALLOW_SMALL_FRAMELENGTH -ALIGN static const complex_t cfft_tab_480[] = -{ - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.999914348125458), FRAC_CONST(0.013089596293867) }, - { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) }, - { FRAC_CONST(0.999229013919830), FRAC_CONST(0.039259817451239) }, - { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, - { FRAC_CONST(0.997858941555023), FRAC_CONST(0.065403133630753) }, - { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, - { FRAC_CONST(0.995804905891418), FRAC_CONST(0.091501623392105) }, - { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, - { FRAC_CONST(0.993068456649780), FRAC_CONST(0.117537401616573) }, - { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) }, - { FRAC_CONST(0.989651381969452), FRAC_CONST(0.143492624163628) }, - { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, - { FRAC_CONST(0.985556066036224), FRAC_CONST(0.169349506497383) }, - { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, - { FRAC_CONST(0.975342333316803), FRAC_CONST(0.220697447657585) }, - { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, - { FRAC_CONST(0.969230890274048), FRAC_CONST(0.246153295040131) }, - { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, - { FRAC_CONST(0.962455213069916), FRAC_CONST(0.271440446376801) }, - { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) }, - { FRAC_CONST(0.955019950866699), FRAC_CONST(0.296541601419449) }, - { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, - { FRAC_CONST(0.946930110454559), FRAC_CONST(0.321439445018768) }, - { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) }, - { FRAC_CONST(0.938191354274750), FRAC_CONST(0.346117079257965) }, - { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, - { FRAC_CONST(0.928809583187103), FRAC_CONST(0.370557427406311) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.918791174888611), FRAC_CONST(0.394743889570236) }, - { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, - { FRAC_CONST(0.908143162727356), FRAC_CONST(0.418659746646881) }, - { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) }, - { FRAC_CONST(0.896872758865356), FRAC_CONST(0.442288726568222) }, - { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, - { FRAC_CONST(0.884987652301788), FRAC_CONST(0.465614527463913) }, - { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) }, - { FRAC_CONST(0.872496008872986), FRAC_CONST(0.488621264696121) }, - { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, - { FRAC_CONST(0.859406411647797), FRAC_CONST(0.511293113231659) }, - { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, - { FRAC_CONST(0.845727801322937), FRAC_CONST(0.533614516258240) }, - { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) }, - { FRAC_CONST(0.816641509532928), FRAC_CONST(0.577145218849182) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.801253795623779), FRAC_CONST(0.598324596881866) }, - { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) }, - { FRAC_CONST(0.785316884517670), FRAC_CONST(0.619093954563141) }, - { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, - { FRAC_CONST(0.768841803073883), FRAC_CONST(0.639438986778259) }, - { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, - { FRAC_CONST(0.751839756965637), FRAC_CONST(0.659345865249634) }, - { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, - { FRAC_CONST(0.734322488307953), FRAC_CONST(0.678800761699677) }, - { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) }, - { FRAC_CONST(0.716301918029785), FRAC_CONST(0.697790503501892) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.697790443897247), FRAC_CONST(0.716301977634430) }, - { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) }, - { FRAC_CONST(0.678800702095032), FRAC_CONST(0.734322547912598) }, - { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, - { FRAC_CONST(0.659345805644989), FRAC_CONST(0.751839816570282) }, - { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, - { FRAC_CONST(0.639438986778259), FRAC_CONST(0.768841862678528) }, - { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, - { FRAC_CONST(0.619093954563141), FRAC_CONST(0.785316944122314) }, - { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) }, - { FRAC_CONST(0.598324596881866), FRAC_CONST(0.801253855228424) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.577145159244537), FRAC_CONST(0.816641569137573) }, - { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, - { FRAC_CONST(0.533614516258240), FRAC_CONST(0.845727801322937) }, - { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, - { FRAC_CONST(0.511293113231659), FRAC_CONST(0.859406411647797) }, - { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, - { FRAC_CONST(0.488621175289154), FRAC_CONST(0.872496068477631) }, - { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) }, - { FRAC_CONST(0.465614467859268), FRAC_CONST(0.884987652301788) }, - { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, - { FRAC_CONST(0.442288666963577), FRAC_CONST(0.896872758865356) }, - { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) }, - { FRAC_CONST(0.418659746646881), FRAC_CONST(0.908143162727356) }, - { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, - { FRAC_CONST(0.394743800163269), FRAC_CONST(0.918791234493256) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.370557397603989), FRAC_CONST(0.928809583187103) }, - { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, - { FRAC_CONST(0.346117049455643), FRAC_CONST(0.938191354274750) }, - { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) }, - { FRAC_CONST(0.321439474821091), FRAC_CONST(0.946930110454559) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(0.296541512012482), FRAC_CONST(0.955019950866699) }, - { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) }, - { FRAC_CONST(0.271440386772156), FRAC_CONST(0.962455272674561) }, - { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, - { FRAC_CONST(0.246153265237808), FRAC_CONST(0.969230890274048) }, - { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, - { FRAC_CONST(0.220697447657585), FRAC_CONST(0.975342333316803) }, - { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) }, - { FRAC_CONST(0.169349446892738), FRAC_CONST(0.985556066036224) }, - { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(0.143492594361305), FRAC_CONST(0.989651381969452) }, - { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) }, - { FRAC_CONST(0.117537401616573), FRAC_CONST(0.993068456649780) }, - { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, - { FRAC_CONST(0.091501533985138), FRAC_CONST(0.995804905891418) }, - { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, - { FRAC_CONST(0.065403074026108), FRAC_CONST(0.997858941555023) }, - { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, - { FRAC_CONST(0.039259787648916), FRAC_CONST(0.999229013919830) }, - { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) }, - { FRAC_CONST(0.013089597225189), FRAC_CONST(0.999914348125458) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.013089684769511), FRAC_CONST(0.999914348125458) }, - { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) }, - { FRAC_CONST(-0.039259877055883), FRAC_CONST(0.999229013919830) }, - { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, - { FRAC_CONST(-0.065403163433075), FRAC_CONST(0.997858941555023) }, - { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, - { FRAC_CONST(-0.091501623392105), FRAC_CONST(0.995804905891418) }, - { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, - { FRAC_CONST(-0.117537491023541), FRAC_CONST(0.993068456649780) }, - { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) }, - { FRAC_CONST(-0.143492683768272), FRAC_CONST(0.989651381969452) }, - { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(-0.169349536299706), FRAC_CONST(0.985556066036224) }, - { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, - { FRAC_CONST(-0.220697522163391), FRAC_CONST(0.975342273712158) }, - { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) }, - { FRAC_CONST(-0.246153354644775), FRAC_CONST(0.969230890274048) }, - { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, - { FRAC_CONST(-0.271440476179123), FRAC_CONST(0.962455213069916) }, - { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) }, - { FRAC_CONST(-0.296541571617126), FRAC_CONST(0.955019950866699) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.321439564228058), FRAC_CONST(0.946930110454559) }, - { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) }, - { FRAC_CONST(-0.346117109060287), FRAC_CONST(0.938191294670105) }, - { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, - { FRAC_CONST(-0.370557487010956), FRAC_CONST(0.928809523582459) }, - { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.394743859767914), FRAC_CONST(0.918791234493256) }, - { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, - { FRAC_CONST(-0.418659836053848), FRAC_CONST(0.908143103122711) }, - { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) }, - { FRAC_CONST(-0.442288637161255), FRAC_CONST(0.896872758865356) }, - { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, - { FRAC_CONST(-0.465614557266235), FRAC_CONST(0.884987592697144) }, - { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) }, - { FRAC_CONST(-0.488621354103088), FRAC_CONST(0.872495949268341) }, - { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) }, - { FRAC_CONST(-0.511293053627014), FRAC_CONST(0.859406411647797) }, - { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) }, - { FRAC_CONST(-0.533614575862885), FRAC_CONST(0.845727801322937) }, - { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) }, - { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, - { FRAC_CONST(-0.566406309604645), FRAC_CONST(0.824126124382019) }, - { FRAC_CONST(-0.577145218849182), FRAC_CONST(0.816641569137573) }, - { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(-0.598324656486511), FRAC_CONST(0.801253736019135) }, - { FRAC_CONST(-0.608761429786682), FRAC_CONST(0.793353319168091) }, - { FRAC_CONST(-0.619093894958496), FRAC_CONST(0.785316944122314) }, - { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) }, - { FRAC_CONST(-0.639439046382904), FRAC_CONST(0.768841803073883) }, - { FRAC_CONST(-0.649448037147522), FRAC_CONST(0.760405957698822) }, - { FRAC_CONST(-0.659345924854279), FRAC_CONST(0.751839697360992) }, - { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) }, - { FRAC_CONST(-0.678800761699677), FRAC_CONST(0.734322488307953) }, - { FRAC_CONST(-0.688354671001434), FRAC_CONST(0.725374281406403) }, - { FRAC_CONST(-0.697790503501892), FRAC_CONST(0.716301858425140) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.716302037239075), FRAC_CONST(0.697790324687958) }, - { FRAC_CONST(-0.725374460220337), FRAC_CONST(0.688354492187500) }, - { FRAC_CONST(-0.734322547912598), FRAC_CONST(0.678800702095032) }, - { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) }, - { FRAC_CONST(-0.751839876174927), FRAC_CONST(0.659345746040344) }, - { FRAC_CONST(-0.760406017303467), FRAC_CONST(0.649448037147522) }, - { FRAC_CONST(-0.768841803073883), FRAC_CONST(0.639439046382904) }, - { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) }, - { FRAC_CONST(-0.785316944122314), FRAC_CONST(0.619093894958496) }, - { FRAC_CONST(-0.793353319168091), FRAC_CONST(0.608761429786682) }, - { FRAC_CONST(-0.801253914833069), FRAC_CONST(0.598324477672577) }, - { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, - { FRAC_CONST(-0.816641569137573), FRAC_CONST(0.577145218849182) }, - { FRAC_CONST(-0.824126303195953), FRAC_CONST(0.566406130790710) }, - { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, - { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) }, - { FRAC_CONST(-0.845727920532227), FRAC_CONST(0.533614337444305) }, - { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) }, - { FRAC_CONST(-0.859406411647797), FRAC_CONST(0.511293053627014) }, - { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) }, - { FRAC_CONST(-0.872496068477631), FRAC_CONST(0.488621145486832) }, - { FRAC_CONST(-0.878817141056061), FRAC_CONST(0.477158725261688) }, - { FRAC_CONST(-0.884987652301788), FRAC_CONST(0.465614557266235) }, - { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, - { FRAC_CONST(-0.896872758865356), FRAC_CONST(0.442288637161255) }, - { FRAC_CONST(-0.902585268020630), FRAC_CONST(0.430511116981506) }, - { FRAC_CONST(-0.908143222332001), FRAC_CONST(0.418659597635269) }, - { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) }, - { FRAC_CONST(-0.918791234493256), FRAC_CONST(0.394743859767914) }, - { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, - { FRAC_CONST(-0.928809583187103), FRAC_CONST(0.370557337999344) }, - { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) }, - { FRAC_CONST(-0.938191413879395), FRAC_CONST(0.346116900444031) }, - { FRAC_CONST(-0.942641556262970), FRAC_CONST(0.333806753158569) }, - { FRAC_CONST(-0.946930170059204), FRAC_CONST(0.321439445018768) }, - { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, - { FRAC_CONST(-0.955020010471344), FRAC_CONST(0.296541452407837) }, - { FRAC_CONST(-0.958819746971130), FRAC_CONST(0.284015297889709) }, - { FRAC_CONST(-0.962455213069916), FRAC_CONST(0.271440476179123) }, - { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) }, - { FRAC_CONST(-0.969230949878693), FRAC_CONST(0.246153235435486) }, - { FRAC_CONST(-0.972369909286499), FRAC_CONST(0.233445376157761) }, - { FRAC_CONST(-0.975342333316803), FRAC_CONST(0.220697283744812) }, - { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(-0.983254909515381), FRAC_CONST(0.182235360145569) }, - { FRAC_CONST(-0.985556066036224), FRAC_CONST(0.169349402189255) }, - { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, - { FRAC_CONST(-0.989651441574097), FRAC_CONST(0.143492430448532) }, - { FRAC_CONST(-0.991444885730743), FRAC_CONST(0.130526080727577) }, - { FRAC_CONST(-0.993068456649780), FRAC_CONST(0.117537356913090) }, - { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) }, - { FRAC_CONST(-0.995804965496063), FRAC_CONST(0.091501489281654) }, - { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) }, - { FRAC_CONST(-0.997858941555023), FRAC_CONST(0.065403148531914) }, - { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) }, - { FRAC_CONST(-0.999229013919830), FRAC_CONST(0.039259742945433) }, - { FRAC_CONST(-0.999657332897186), FRAC_CONST(0.026176951825619) }, - { FRAC_CONST(-0.999914348125458), FRAC_CONST(0.013089434243739) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) }, - { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, - { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, - { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, - { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) }, - { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, - { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) }, - { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, - { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, - { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, - { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) }, - { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, - { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) }, - { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, - { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) }, - { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, - { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) }, - { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, - { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, - { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, - { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) }, - { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, - { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, - { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, - { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) }, - { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, - { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, - { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, - { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) }, - { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, - { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, - { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, - { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) }, - { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, - { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) }, - { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, - { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) }, - { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, - { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, - { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, - { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) }, - { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) }, - { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, - { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, - { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, - { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) }, - { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, - { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, - { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, - { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) }, - { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) }, - { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, - { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) }, - { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, - { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) }, - { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, - { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, - { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) }, - { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, - { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, - { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, - { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, - { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, - { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, - { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, - { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, - { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, - { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, - { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, - { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, - { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, - { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, - { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, - { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, - { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, - { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, - { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, - { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, - { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, - { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, - { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, - { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, - { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, - { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, - { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) }, - { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) }, - { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) }, - { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) }, - { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) }, - { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, - { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) }, - { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) }, - { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, - { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) }, - { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) }, - { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, - { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) }, - { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) }, - { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, - { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) }, - { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) }, - { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) }, - { FRAC_CONST(-0.998629510402679), FRAC_CONST(-0.052335985004902) }, - { FRAC_CONST(-0.994521856307983), FRAC_CONST(-0.104528672993183) }, - { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) }, - { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) }, - { FRAC_CONST(-0.965925812721252), FRAC_CONST(-0.258819073438644) }, - { FRAC_CONST(-0.951056540012360), FRAC_CONST(-0.309016972780228) }, - { FRAC_CONST(-0.933580398559570), FRAC_CONST(-0.358368098735809) }, - { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) }, - { FRAC_CONST(-0.891006529331207), FRAC_CONST(-0.453990548849106) }, - { FRAC_CONST(-0.866025269031525), FRAC_CONST(-0.500000178813934) }, - { FRAC_CONST(-0.838670492172241), FRAC_CONST(-0.544639170169830) }, - { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, - { FRAC_CONST(-0.777145922183990), FRAC_CONST(-0.629320442676544) }, - { FRAC_CONST(-0.743144810199738), FRAC_CONST(-0.669130623340607) }, - { FRAC_CONST(-0.707106649875641), FRAC_CONST(-0.707106888294220) }, - { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) }, - { FRAC_CONST(-0.629320323467255), FRAC_CONST(-0.777145981788635) }, - { FRAC_CONST(-0.587785065174103), FRAC_CONST(-0.809017121791840) }, - { FRAC_CONST(-0.544639110565186), FRAC_CONST(-0.838670551776886) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, - { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, - { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, - { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, - { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, - { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, - { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, - { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, - { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, - { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, - { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, - { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, - { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, - { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, - { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) }, - { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, - { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) }, - { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) }, - { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, - { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, - { FRAC_CONST(-0.649447917938232), FRAC_CONST(-0.760406076908112) }, - { FRAC_CONST(-0.453990221023560), FRAC_CONST(-0.891006648540497) }, - { FRAC_CONST(-0.233445450663567), FRAC_CONST(-0.972369909286499) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, - { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) } -}; -#endif - -ALIGN static const complex_t cfft_tab_64[] = -{ - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, - { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, - { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, - { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, - { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, - { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) } -}; - -#ifdef ALLOW_SMALL_FRAMELENGTH -ALIGN static const complex_t cfft_tab_60[] = -{ - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, - { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, - { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, - { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, - { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, - { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, - { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, - { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, - { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, - { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, - { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, - { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) }, - { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) }, - { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, - { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) }, - { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) }, - { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) }, - { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) }, - { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) }, - { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, - { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, - { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) } -}; -#endif - -#ifdef LD_DEC - -ALIGN static const complex_t cfft_tab_256[] = -{ - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) }, - { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, - { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, - { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, - { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) }, - { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, - { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, - { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, - { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) }, - { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, - { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) }, - { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, - { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) }, - { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, - { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, - { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, - { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) }, - { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, - { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) }, - { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, - { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) }, - { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, - { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, - { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, - { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) }, - { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, - { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) }, - { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, - { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) }, - { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, - { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, - { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, - { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) }, - { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, - { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) }, - { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, - { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) }, - { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, - { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, - { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, - { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) }, - { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, - { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, - { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, - { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, - { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, - { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, - { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, - { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, - { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, - { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, - { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, - { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, - { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) }, - { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) }, - { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) }, - { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) }, - { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, - { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) }, - { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, - { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, - { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) }, - { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) }, - { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) }, - { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) }, - { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, - { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) }, - { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) }, - { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) }, - { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, - { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, - { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) }, - { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) }, - { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) }, - { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, - { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, - { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, - { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, - { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.788346469402313), FRAC_CONST(0.615231573581696) }, - { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, - { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.575808227062225), FRAC_CONST(0.817584812641144) }, - { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, - { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.313681751489639), FRAC_CONST(0.949528157711029) }, - { FRAC_CONST(0.242980241775513), FRAC_CONST(0.970031261444092) }, - { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(0.024541255086660), FRAC_CONST(0.999698817729950) }, - { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, - { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.266712725162506), FRAC_CONST(0.963776051998138) }, - { FRAC_CONST(-0.336889803409576), FRAC_CONST(0.941544055938721) }, - { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) }, - { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, - { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) }, - { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, - { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) }, - { FRAC_CONST(-0.803207516670227), FRAC_CONST(0.595699369907379) }, - { FRAC_CONST(-0.844853520393372), FRAC_CONST(0.534997701644897) }, - { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, - { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) }, - { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, - { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) }, - { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067724496126) }, - { FRAC_CONST(-0.999698817729950), FRAC_CONST(-0.024541147053242) }, - { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, - { FRAC_CONST(-0.985277652740479), FRAC_CONST(-0.170961990952492) }, - { FRAC_CONST(-0.970031261444092), FRAC_CONST(-0.242980241775513) }, - { FRAC_CONST(-0.949528157711029), FRAC_CONST(-0.313681781291962) }, - { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, - { FRAC_CONST(-0.893224298954010), FRAC_CONST(-0.449611306190491) }, - { FRAC_CONST(-0.857728660106659), FRAC_CONST(-0.514102697372437) }, - { FRAC_CONST(-0.817584872245789), FRAC_CONST(-0.575808107852936) }, - { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, - { FRAC_CONST(-0.724247038364410), FRAC_CONST(-0.689540624618530) }, - { FRAC_CONST(-0.671558916568756), FRAC_CONST(-0.740951180458069) }, - { FRAC_CONST(-0.615231573581696), FRAC_CONST(-0.788346469402313) }, - { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, - { FRAC_CONST(-0.492898195981979), FRAC_CONST(-0.870086967945099) }, - { FRAC_CONST(-0.427554935216904), FRAC_CONST(-0.903989374637604) }, - { FRAC_CONST(-0.359895110130310), FRAC_CONST(-0.932992756366730) }, - { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, - { FRAC_CONST(-0.219101369380951), FRAC_CONST(-0.975702106952667) }, - { FRAC_CONST(-0.146730408072472), FRAC_CONST(-0.989176511764526) }, - { FRAC_CONST(-0.073564760386944), FRAC_CONST(-0.997290432453156) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, - { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, - { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, - { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, - { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, - { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) } -}; - -#ifdef ALLOW_SMALL_FRAMELENGTH -ALIGN static const complex_t cfft_tab_240[] = -{ - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) }, - { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, - { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, - { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, - { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) }, - { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, - { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) }, - { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, - { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, - { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, - { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) }, - { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, - { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) }, - { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, - { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) }, - { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, - { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) }, - { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, - { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, - { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, - { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) }, - { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, - { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, - { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, - { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) }, - { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, - { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, - { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, - { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) }, - { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, - { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, - { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, - { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) }, - { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, - { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) }, - { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, - { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) }, - { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, - { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, - { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, - { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) }, - { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) }, - { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, - { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, - { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, - { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) }, - { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, - { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, - { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, - { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) }, - { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) }, - { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, - { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) }, - { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, - { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) }, - { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, - { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, - { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) }, - { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, - { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, - { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, - { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, - { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, - { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, - { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, - { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, - { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, - { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, - { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, - { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, - { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, - { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, - { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, - { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, - { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, - { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, - { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, - { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, - { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, - { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, - { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, - { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, - { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, - { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, - { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) }, - { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) }, - { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) }, - { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) }, - { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) }, - { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, - { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) }, - { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) }, - { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, - { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) }, - { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) }, - { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, - { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) }, - { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) }, - { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, - { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) }, - { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) }, - { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) }, - { FRAC_CONST(-0.998629510402679), FRAC_CONST(-0.052335985004902) }, - { FRAC_CONST(-0.994521856307983), FRAC_CONST(-0.104528672993183) }, - { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) }, - { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) }, - { FRAC_CONST(-0.965925812721252), FRAC_CONST(-0.258819073438644) }, - { FRAC_CONST(-0.951056540012360), FRAC_CONST(-0.309016972780228) }, - { FRAC_CONST(-0.933580398559570), FRAC_CONST(-0.358368098735809) }, - { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) }, - { FRAC_CONST(-0.891006529331207), FRAC_CONST(-0.453990548849106) }, - { FRAC_CONST(-0.866025269031525), FRAC_CONST(-0.500000178813934) }, - { FRAC_CONST(-0.838670492172241), FRAC_CONST(-0.544639170169830) }, - { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, - { FRAC_CONST(-0.777145922183990), FRAC_CONST(-0.629320442676544) }, - { FRAC_CONST(-0.743144810199738), FRAC_CONST(-0.669130623340607) }, - { FRAC_CONST(-0.707106649875641), FRAC_CONST(-0.707106888294220) }, - { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) }, - { FRAC_CONST(-0.629320323467255), FRAC_CONST(-0.777145981788635) }, - { FRAC_CONST(-0.587785065174103), FRAC_CONST(-0.809017121791840) }, - { FRAC_CONST(-0.544639110565186), FRAC_CONST(-0.838670551776886) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, - { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, - { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, - { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, - { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, - { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, - { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, - { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, - { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, - { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, - { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, - { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, - { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, - { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, - { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, - { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) }, - { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, - { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) }, - { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) }, - { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, - { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, - { FRAC_CONST(-0.649447917938232), FRAC_CONST(-0.760406076908112) }, - { FRAC_CONST(-0.453990221023560), FRAC_CONST(-0.891006648540497) }, - { FRAC_CONST(-0.233445450663567), FRAC_CONST(-0.972369909286499) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, - { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, - { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, - { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, - { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) } -}; -#endif - -#endif - -ALIGN static const complex_t cfft_tab_128[] = -{ - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, - { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, - { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, - { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, - { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, - { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, - { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, - { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, - { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, - { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, - { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, - { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) }, - { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) }, - { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) }, - { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) }, - { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, - { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) }, - { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, - { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, - { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) }, - { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) }, - { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) }, - { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) }, - { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, - { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) }, - { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) }, - { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) }, - { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, - { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, - { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) }, - { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) }, - { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) }, - { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, - { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, - { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, - { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, - { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, - { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, - { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, - { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, - { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, - { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, - { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, - { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, - { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, - { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, - { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) } -}; - -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/codebook/hcb.h b/mplayer/libfaad2/codebook/hcb.h deleted file mode 100644 index 5ed78ba8..00000000 --- a/mplayer/libfaad2/codebook/hcb.h +++ /dev/null @@ -1,142 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: hcb.h,v 1.6 2003/09/09 18:12:01 menno Exp $ -**/ - -#ifndef __HCB_H__ -#define __HCB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Optimal huffman decoding for AAC taken from: - * "SELECTING AN OPTIMAL HUFFMAN DECODER FOR AAC" by - * VLADIMIR Z. MESAROVIC , RAGHUNATH RAO, MIROSLAV V. DOKIC, and SACHIN DEO - * AES paper 5436 - * - * 2 methods are used for huffman decoding: - * - binary search - * - 2-step table lookup - * - * The choice of the "optimal" method is based on the fact that if the - * memory size for the Two-step is exorbitantly high then the decision - * is Binary search for that codebook. However, for marginally more memory - * size, if Twostep outperforms even the best case of Binary then the - * decision is Two-step for that codebook. - * - * The following methods are used for the different tables. - * codebook "optimal" method - * HCB_1 2-Step - * HCB_2 2-Step - * HCB_3 Binary - * HCB_4 2-Step - * HCB_5 Binary - * HCB_6 2-Step - * HCB_7 Binary - * HCB_8 2-Step - * HCB_9 Binary - * HCB_10 2-Step - * HCB_11 2-Step - * HCB_SF Binary - * - */ - - -#define ZERO_HCB 0 -#define FIRST_PAIR_HCB 5 -#define ESC_HCB 11 -#define QUAD_LEN 4 -#define PAIR_LEN 2 -#define NOISE_HCB 13 -#define INTENSITY_HCB2 14 -#define INTENSITY_HCB 15 - -/* 1st step table */ -typedef struct -{ - uint8_t offset; - uint8_t extra_bits; -} hcb; - -/* 2nd step table with quadruple data */ -typedef struct -{ - uint8_t bits; - int8_t x; - int8_t y; -} hcb_2_pair; - -typedef struct -{ - uint8_t bits; - int8_t x; - int8_t y; - int8_t v; - int8_t w; -} hcb_2_quad; - -/* binary search table */ -typedef struct -{ - uint8_t is_leaf; - int8_t data[4]; -} hcb_bin_quad; - -typedef struct -{ - uint8_t is_leaf; - int8_t data[2]; -} hcb_bin_pair; - -hcb *hcb_table[]; -hcb_2_quad *hcb_2_quad_table[]; -hcb_2_pair *hcb_2_pair_table[]; -hcb_bin_pair *hcb_bin_table[]; -uint8_t hcbN[]; -uint8_t unsigned_cb[]; -int hcb_2_quad_table_size[]; -int hcb_2_pair_table_size[]; -int hcb_bin_table_size[]; - -#include "codebook/hcb_1.h" -#include "codebook/hcb_2.h" -#include "codebook/hcb_3.h" -#include "codebook/hcb_4.h" -#include "codebook/hcb_5.h" -#include "codebook/hcb_6.h" -#include "codebook/hcb_7.h" -#include "codebook/hcb_8.h" -#include "codebook/hcb_9.h" -#include "codebook/hcb_10.h" -#include "codebook/hcb_11.h" -#include "codebook/hcb_sf.h" - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/codebook/hcb_1.h b/mplayer/libfaad2/codebook/hcb_1.h deleted file mode 100644 index ab2e1ed5..00000000 --- a/mplayer/libfaad2/codebook/hcb_1.h +++ /dev/null @@ -1,183 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: hcb_1.h,v 1.3 2003/09/09 18:12:01 menno Exp $ -**/ - -/* 2-step huffman table HCB_1 */ - - -/* 1st step: 5 bits - * 2^5 = 32 entries - * - * Used to find offset into 2nd step table and number of extra bits to get - */ -static hcb hcb1_1[] = { - { /* 00000 */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* 10000 */ 1, 0 }, - { /* 10001 */ 2, 0 }, - { /* 10010 */ 3, 0 }, - { /* 10011 */ 4, 0 }, - { /* 10100 */ 5, 0 }, - { /* 10101 */ 6, 0 }, - { /* 10110 */ 7, 0 }, - { /* 10111 */ 8, 0 }, - - /* 7 bit codewords */ - { /* 11000 */ 9, 2 }, - { /* 11001 */ 13, 2 }, - { /* 11010 */ 17, 2 }, - { /* 11011 */ 21, 2 }, - { /* 11100 */ 25, 2 }, - { /* 11101 */ 29, 2 }, - - /* 9 bit codewords */ - { /* 11110 */ 33, 4 }, - - /* 9/10/11 bit codewords */ - { /* 11111 */ 49, 6 } -}; - -/* 2nd step table - * - * Gives size of codeword and actual data (x,y,v,w) - */ -static hcb_2_quad hcb1_2[] = { - /* 1 bit codeword */ - { 1, 0, 0, 0, 0 }, - - /* 5 bit codewords */ - { 5, 1, 0, 0, 0 }, - { 5, -1, 0, 0, 0 }, - { 5, 0, 0, 0, -1 }, - { 5, 0, 1, 0, 0 }, - { 5, 0, 0, 0, 1 }, - { 5, 0, 0, -1, 0 }, - { 5, 0, 0, 1, 0 }, - { 5, 0, -1, 0, 0 }, - - /* 7 bit codewords */ - /* first 5 bits: 11000 */ - { 7, 1, -1, 0, 0 }, - { 7, -1, 1, 0, 0 }, - { 7, 0, 0, -1, 1 }, - { 7, 0, 1, -1, 0 }, - /* first 5 bits: 11001 */ - { 7, 0, -1, 1, 0 }, - { 7, 0, 0, 1, -1 }, - { 7, 1, 1, 0, 0 }, - { 7, 0, 0, -1, -1 }, - /* first 5 bits: 11010 */ - { 7, -1, -1, 0, 0 }, - { 7, 0, -1, -1, 0 }, - { 7, 1, 0, -1, 0 }, - { 7, 0, 1, 0, -1 }, - /* first 5 bits: 11011 */ - { 7, -1, 0, 1, 0 }, - { 7, 0, 0, 1, 1 }, - { 7, 1, 0, 1, 0 }, - { 7, 0, -1, 0, 1 }, - /* first 5 bits: 11100 */ - { 7, 0, 1, 1, 0 }, - { 7, 0, 1, 0, 1 }, - { 7, -1, 0, -1, 0 }, - { 7, 1, 0, 0, 1 }, - /* first 5 bits: 11101 */ - { 7, -1, 0, 0, -1 }, - { 7, 1, 0, 0, -1 }, - { 7, -1, 0, 0, 1 }, - { 7, 0, -1, 0, -1 }, - - /* 9 bit codeword */ - /* first 5 bits: 11110 */ - { 9, 1, 1, -1, 0 }, - { 9, -1, 1, -1, 0 }, - { 9, 1, -1, 1, 0 }, - { 9, 0, 1, 1, -1 }, - { 9, 0, 1, -1, 1 }, - { 9, 0, -1, 1, 1 }, - { 9, 0, -1, 1, -1 }, - { 9, 1, -1, -1, 0 }, - { 9, 1, 0, -1, 1 }, - { 9, 0, 1, -1, -1 }, - { 9, -1, 1, 1, 0 }, - { 9, -1, 0, 1, -1 }, - { 9, -1, -1, 1, 0 }, - { 9, 0, -1, -1, 1 }, - { 9, 1, -1, 0, 1 }, - { 9, 1, -1, 0, -1 }, - - /* 9/10/11 bit codewords */ - /* first 5 bits: 11111 */ - /* 9 bit: reading 11 bits -> 2 too much so 4 entries for each codeword */ - { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, - { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, - { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, - { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, - { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, - { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, - { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, - { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, - /* 10 bit: reading 11 bits -> 1 too much so 2 entries for each codeword */ - { 10, -1, -1, 0, 1 }, { 10, -1, -1, 0, 1 }, - { 10, -1, 0, -1, -1 }, { 10, -1, 0, -1, -1 }, - { 10, 1, 1, 0, -1 }, { 10, 1, 1, 0, -1 }, - { 10, 1, 0, -1, -1 }, { 10, 1, 0, -1, -1 }, - { 10, -1, 0, -1, 1 }, { 10, -1, 0, -1, 1 }, - { 10, -1, -1, 0, -1 }, { 10, -1, -1, 0, -1 }, - { 10, -1, 0, 1, 1 }, { 10, -1, 0, 1, 1 }, - { 10, 1, 0, 1, 1 }, { 10, 1, 0, 1, 1 }, - /* 11 bit */ - { 11, 1, -1, 1, -1 }, - { 11, -1, 1, -1, 1 }, - { 11, -1, 1, 1, -1 }, - { 11, 1, -1, -1, 1 }, - { 11, 1, 1, 1, 1 }, - { 11, -1, -1, 1, 1 }, - { 11, 1, 1, -1, -1 }, - { 11, -1, -1, 1, -1 }, - { 11, -1, -1, -1, -1 }, - { 11, 1, 1, -1, 1 }, - { 11, 1, -1, 1, 1 }, - { 11, -1, 1, 1, 1 }, - { 11, -1, 1, -1, -1 }, - { 11, -1, -1, -1, 1 }, - { 11, 1, -1, -1, -1 }, - { 11, 1, 1, 1, -1 } -}; diff --git a/mplayer/libfaad2/codebook/hcb_10.h b/mplayer/libfaad2/codebook/hcb_10.h deleted file mode 100644 index c6309338..00000000 --- a/mplayer/libfaad2/codebook/hcb_10.h +++ /dev/null @@ -1,309 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: hcb_10.h,v 1.3 2003/09/09 18:12:01 menno Exp $ -**/ - -/* 2-step huffman table HCB_10 */ - - -/* 1st step: 6 bits - * 2^6 = 64 entries - * - * Used to find offset into 2nd step table and number of extra bits to get - */ -static hcb hcb10_1[] = { - /* 4 bit codewords */ - { /* 000000 */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* 000100 */ 1, 0 }, - { /* */ 1, 0 }, - { /* */ 1, 0 }, - { /* */ 1, 0 }, - { /* 001000 */ 2, 0 }, - { /* */ 2, 0 }, - { /* */ 2, 0 }, - { /* */ 2, 0 }, - /* 5 bit codewords */ - { /* 001100 */ 3, 0 }, - { /* */ 3, 0 }, - { /* 001110 */ 4, 0 }, - { /* */ 4, 0 }, - { /* 010000 */ 5, 0 }, - { /* */ 5, 0 }, - { /* 010010 */ 6, 0 }, - { /* */ 6, 0 }, - { /* 010100 */ 7, 0 }, - { /* */ 7, 0 }, - { /* 010110 */ 8, 0 }, - { /* */ 8, 0 }, - { /* 011000 */ 9, 0 }, - { /* */ 9, 0 }, - { /* 011010 */ 10, 0 }, - { /* */ 10, 0 }, - /* 6 bit codewords */ - { /* 011100 */ 11, 0 }, - { /* 011101 */ 12, 0 }, - { /* 011110 */ 13, 0 }, - { /* 011111 */ 14, 0 }, - { /* 100000 */ 15, 0 }, - { /* 100001 */ 16, 0 }, - { /* 100010 */ 17, 0 }, - { /* 100011 */ 18, 0 }, - { /* 100100 */ 19, 0 }, - { /* 100101 */ 20, 0 }, - { /* 100110 */ 21, 0 }, - { /* 100111 */ 22, 0 }, - { /* 101000 */ 23, 0 }, - { /* 101001 */ 24, 0 }, - /* 7 bit codewords */ - { /* 101010 */ 25, 1 }, - { /* 101011 */ 27, 1 }, - { /* 101100 */ 29, 1 }, - { /* 101101 */ 31, 1 }, - { /* 101110 */ 33, 1 }, - { /* 101111 */ 35, 1 }, - { /* 110000 */ 37, 1 }, - { /* 110001 */ 39, 1 }, - /* 7/8 bit codewords */ - { /* 110010 */ 41, 2 }, - /* 8 bit codewords */ - { /* 110011 */ 45, 2 }, - { /* 110100 */ 49, 2 }, - { /* 110101 */ 53, 2 }, - { /* 110110 */ 57, 2 }, - { /* 110111 */ 61, 2 }, - /* 8/9 bit codewords */ - { /* 111000 */ 65, 3 }, - /* 9 bit codewords */ - { /* 111001 */ 73, 3 }, - { /* 111010 */ 81, 3 }, - { /* 111011 */ 89, 3 }, - /* 9/10 bit codewords */ - { /* 111100 */ 97, 4 }, - /* 10 bit codewords */ - { /* 111101 */ 113, 4 }, - { /* 111110 */ 129, 4 }, - /* 10/11/12 bit codewords */ - { /* 111111 */ 145, 6 } -}; - -/* 2nd step table - * - * Gives size of codeword and actual data (x,y,v,w) - */ -static hcb_2_pair hcb10_2[] = { - /* 4 bit codewords */ - { 4, 1, 1 }, - { 4, 1, 2 }, - { 4, 2, 1 }, - - /* 5 bit codewords */ - { 5, 2, 2 }, - { 5, 1, 0 }, - { 5, 0, 1 }, - { 5, 1, 3 }, - { 5, 3, 2 }, - { 5, 3, 1 }, - { 5, 2, 3 }, - { 5, 3, 3 }, - - /* 6 bit codewords */ - { 6, 2, 0 }, - { 6, 0, 2 }, - { 6, 2, 4 }, - { 6, 4, 2 }, - { 6, 1, 4 }, - { 6, 4, 1 }, - { 6, 0, 0 }, - { 6, 4, 3 }, - { 6, 3, 4 }, - { 6, 3, 0 }, - { 6, 0, 3 }, - { 6, 4, 4 }, - { 6, 2, 5 }, - { 6, 5, 2 }, - - /* 7 bit codewords */ - { 7, 1, 5 }, - { 7, 5, 1 }, - { 7, 5, 3 }, - { 7, 3, 5 }, - { 7, 5, 4 }, - { 7, 4, 5 }, - { 7, 6, 2 }, - { 7, 2, 6 }, - { 7, 6, 3 }, - { 7, 4, 0 }, - { 7, 6, 1 }, - { 7, 0, 4 }, - { 7, 1, 6 }, - { 7, 3, 6 }, - { 7, 5, 5 }, - { 7, 6, 4 }, - - /* 7/8 bit codewords */ - { 7, 4, 6 }, { 7, 4, 6 }, - { 8, 6, 5 }, - { 8, 7, 2 }, - - /* 8 bit codewords */ - { 8, 3, 7 }, - { 8, 2, 7 }, - { 8, 5, 6 }, - { 8, 8, 2 }, - { 8, 7, 3 }, - { 8, 5, 0 }, - { 8, 7, 1 }, - { 8, 0, 5 }, - { 8, 8, 1 }, - { 8, 1, 7 }, - { 8, 8, 3 }, - { 8, 7, 4 }, - { 8, 4, 7 }, - { 8, 2, 8 }, - { 8, 6, 6 }, - { 8, 7, 5 }, - { 8, 1, 8 }, - { 8, 3, 8 }, - { 8, 8, 4 }, - { 8, 4, 8 }, - - /* 8/9 bit codewords */ - { 8, 5, 7 }, { 8, 5, 7 }, - { 8, 8, 5 }, { 8, 8, 5 }, - { 8, 5, 8 }, { 8, 5, 8 }, - { 9, 7, 6 }, - { 9, 6, 7 }, - - /* 9 bit codewords */ - { 9, 9, 2 }, - { 9, 6, 0 }, - { 9, 6, 8 }, - { 9, 9, 3 }, - { 9, 3, 9 }, - { 9, 9, 1 }, - { 9, 2, 9 }, - { 9, 0, 6 }, - { 9, 8, 6 }, - { 9, 9, 4 }, - { 9, 4, 9 }, - { 9, 10, 2 }, - { 9, 1, 9 }, - { 9, 7, 7 }, - { 9, 8, 7 }, - { 9, 9, 5 }, - { 9, 7, 8 }, - { 9, 10, 3 }, - { 9, 5, 9 }, - { 9, 10, 4 }, - { 9, 2, 10 }, - { 9, 10, 1 }, - { 9, 3, 10 }, - { 9, 9, 6 }, - - /* 9/10 bit codewords */ - { 9, 6, 9 }, { 9, 6, 9 }, - { 9, 8, 0 }, { 9, 8, 0 }, - { 9, 4, 10 }, { 9, 4, 10 }, - { 9, 7, 0 }, { 9, 7, 0 }, - { 9, 11, 2 }, { 9, 11, 2 }, - { 10, 7, 9 }, - { 10, 11, 3 }, - { 10, 10, 6 }, - { 10, 1, 10 }, - { 10, 11, 1 }, - { 10, 9, 7 }, - - /* 10 bit codewords */ - { 10, 0, 7 }, - { 10, 8, 8 }, - { 10, 10, 5 }, - { 10, 3, 11 }, - { 10, 5, 10 }, - { 10, 8, 9 }, - { 10, 11, 5 }, - { 10, 0, 8 }, - { 10, 11, 4 }, - { 10, 2, 11 }, - { 10, 7, 10 }, - { 10, 6, 10 }, - { 10, 10, 7 }, - { 10, 4, 11 }, - { 10, 1, 11 }, - { 10, 12, 2 }, - { 10, 9, 8 }, - { 10, 12, 3 }, - { 10, 11, 6 }, - { 10, 5, 11 }, - { 10, 12, 4 }, - { 10, 11, 7 }, - { 10, 12, 5 }, - { 10, 3, 12 }, - { 10, 6, 11 }, - { 10, 9, 0 }, - { 10, 10, 8 }, - { 10, 10, 0 }, - { 10, 12, 1 }, - { 10, 0, 9 }, - { 10, 4, 12 }, - { 10, 9, 9 }, - - /* 10/11/12 bit codewords */ - { 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 }, - { 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 }, - { 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 }, - { 11, 9, 10 }, { 11, 9, 10 }, - { 11, 1, 12 }, { 11, 1, 12 }, - { 11, 11, 8 }, { 11, 11, 8 }, - { 11, 12, 7 }, { 11, 12, 7 }, - { 11, 7, 11 }, { 11, 7, 11 }, - { 11, 5, 12 }, { 11, 5, 12 }, - { 11, 6, 12 }, { 11, 6, 12 }, - { 11, 10, 9 }, { 11, 10, 9 }, - { 11, 8, 11 }, { 11, 8, 11 }, - { 11, 12, 8 }, { 11, 12, 8 }, - { 11, 0, 10 }, { 11, 0, 10 }, - { 11, 7, 12 }, { 11, 7, 12 }, - { 11, 11, 0 }, { 11, 11, 0 }, - { 11, 10, 10 }, { 11, 10, 10 }, - { 11, 11, 9 }, { 11, 11, 9 }, - { 11, 11, 10 }, { 11, 11, 10 }, - { 11, 0, 11 }, { 11, 0, 11 }, - { 11, 11, 11 }, { 11, 11, 11 }, - { 11, 9, 11 }, { 11, 9, 11 }, - { 11, 10, 11 }, { 11, 10, 11 }, - { 11, 12, 0 }, { 11, 12, 0 }, - { 11, 8, 12 }, { 11, 8, 12 }, - { 12, 12, 9 }, - { 12, 10, 12 }, - { 12, 9, 12 }, - { 12, 11, 12 }, - { 12, 12, 11 }, - { 12, 0, 12 }, - { 12, 12, 10 }, - { 12, 12, 12 } -}; diff --git a/mplayer/libfaad2/codebook/hcb_11.h b/mplayer/libfaad2/codebook/hcb_11.h deleted file mode 100644 index 0defdc37..00000000 --- a/mplayer/libfaad2/codebook/hcb_11.h +++ /dev/null @@ -1,412 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: hcb_11.h,v 1.3 2003/09/09 18:12:01 menno Exp $ -**/ - -/* 2-step huffman table HCB_11 */ - - -/* 1st step: 5 bits - * 2^5 = 32 entries - * - * Used to find offset into 2nd step table and number of extra bits to get - */ -static hcb hcb11_1[] = { - /* 4 bits */ - { /* 00000 */ 0, 0 }, - { /* */ 0, 0 }, - { /* 00010 */ 1, 0 }, - { /* */ 1, 0 }, - - /* 5 bits */ - { /* 00100 */ 2, 0 }, - { /* 00101 */ 3, 0 }, - { /* 00110 */ 4, 0 }, - { /* 00111 */ 5, 0 }, - { /* 01000 */ 6, 0 }, - { /* 01001 */ 7, 0 }, - - /* 6 bits */ - { /* 01010 */ 8, 1 }, - { /* 01011 */ 10, 1 }, - { /* 01100 */ 12, 1 }, - - /* 6/7 bits */ - { /* 01101 */ 14, 2 }, - - /* 7 bits */ - { /* 01110 */ 18, 2 }, - { /* 01111 */ 22, 2 }, - { /* 10000 */ 26, 2 }, - - /* 7/8 bits */ - { /* 10001 */ 30, 3 }, - - /* 8 bits */ - { /* 10010 */ 38, 3 }, - { /* 10011 */ 46, 3 }, - { /* 10100 */ 54, 3 }, - { /* 10101 */ 62, 3 }, - { /* 10110 */ 70, 3 }, - { /* 10111 */ 78, 3 }, - - /* 8/9 bits */ - { /* 11000 */ 86, 4 }, - - /* 9 bits */ - { /* 11001 */ 102, 4 }, - { /* 11010 */ 118, 4 }, - { /* 11011 */ 134, 4 }, - - /* 9/10 bits */ - { /* 11100 */ 150, 5 }, - - /* 10 bits */ - { /* 11101 */ 182, 5 }, - { /* 11110 */ 214, 5 }, - - /* 10/11/12 bits */ - { /* 11111 */ 246, 7 } -}; - -/* 2nd step table - * - * Gives size of codeword and actual data (x,y,v,w) - */ -static hcb_2_pair hcb11_2[] = { - /* 4 */ - { 4, 0, 0 }, - { 4, 1, 1 }, - - /* 5 */ - { 5, 16, 16 }, - { 5, 1, 0 }, - { 5, 0, 1 }, - { 5, 2, 1 }, - { 5, 1, 2 }, - { 5, 2, 2 }, - - /* 6 */ - { 6, 1, 3 }, - { 6, 3, 1 }, - { 6, 3, 2 }, - { 6, 2, 0 }, - { 6, 2, 3 }, - { 6, 0, 2 }, - - /* 6/7 */ - { 6, 3, 3 }, { 6, 3, 3 }, - { 7, 4, 1 }, - { 7, 1, 4 }, - - /* 7 */ - { 7, 4, 2 }, - { 7, 2, 4 }, - { 7, 4, 3 }, - { 7, 3, 4 }, - { 7, 3, 0 }, - { 7, 0, 3 }, - { 7, 5, 1 }, - { 7, 5, 2 }, - { 7, 2, 5 }, - { 7, 4, 4 }, - { 7, 1, 5 }, - { 7, 5, 3 }, - - /* 7/8 */ - { 7, 3, 5 }, { 7, 3, 5 }, - { 7, 5, 4 }, { 7, 5, 4 }, - { 8, 4, 5 }, - { 8, 6, 2 }, - { 8, 2, 6 }, - { 8, 6, 1 }, - - /* 8 */ - { 8, 6, 3 }, - { 8, 3, 6 }, - { 8, 1, 6 }, - { 8, 4, 16 }, - { 8, 3, 16 }, - { 8, 16, 5 }, - { 8, 16, 3 }, - { 8, 16, 4 }, - { 8, 6, 4 }, - { 8, 16, 6 }, - { 8, 4, 0 }, - { 8, 4, 6 }, - { 8, 0, 4 }, - { 8, 2, 16 }, - { 8, 5, 5 }, - { 8, 5, 16 }, - { 8, 16, 7 }, - { 8, 16, 2 }, - { 8, 16, 8 }, - { 8, 2, 7 }, - { 8, 7, 2 }, - { 8, 3, 7 }, - { 8, 6, 5 }, - { 8, 5, 6 }, - { 8, 6, 16 }, - { 8, 16, 10 }, - { 8, 7, 3 }, - { 8, 7, 1 }, - { 8, 16, 9 }, - { 8, 7, 16 }, - { 8, 1, 16 }, - { 8, 1, 7 }, - { 8, 4, 7 }, - { 8, 16, 11 }, - { 8, 7, 4 }, - { 8, 16, 12 }, - { 8, 8, 16 }, - { 8, 16, 1 }, - { 8, 6, 6 }, - { 8, 9, 16 }, - { 8, 2, 8 }, - { 8, 5, 7 }, - { 8, 10, 16 }, - { 8, 16, 13 }, - { 8, 8, 3 }, - { 8, 8, 2 }, - { 8, 3, 8 }, - { 8, 5, 0 }, - - /* 8/9 */ - { 8, 16, 14 }, { 8, 16, 14 }, - { 8, 11, 16 }, { 8, 11, 16 }, - { 8, 7, 5 }, { 8, 7, 5 }, - { 8, 4, 8 }, { 8, 4, 8 }, - { 8, 6, 7 }, { 8, 6, 7 }, - { 8, 7, 6 }, { 8, 7, 6 }, - { 8, 0, 5 }, { 8, 0, 5 }, - { 9, 8, 4 }, - { 9, 16, 15 }, - - /* 9 */ - { 9, 12, 16 }, - { 9, 1, 8 }, - { 9, 8, 1 }, - { 9, 14, 16 }, - { 9, 5, 8 }, - { 9, 13, 16 }, - { 9, 3, 9 }, - { 9, 8, 5 }, - { 9, 7, 7 }, - { 9, 2, 9 }, - { 9, 8, 6 }, - { 9, 9, 2 }, - { 9, 9, 3 }, - { 9, 15, 16 }, - { 9, 4, 9 }, - { 9, 6, 8 }, - { 9, 6, 0 }, - { 9, 9, 4 }, - { 9, 5, 9 }, - { 9, 8, 7 }, - { 9, 7, 8 }, - { 9, 1, 9 }, - { 9, 10, 3 }, - { 9, 0, 6 }, - { 9, 10, 2 }, - { 9, 9, 1 }, - { 9, 9, 5 }, - { 9, 4, 10 }, - { 9, 2, 10 }, - { 9, 9, 6 }, - { 9, 3, 10 }, - { 9, 6, 9 }, - { 9, 10, 4 }, - { 9, 8, 8 }, - { 9, 10, 5 }, - { 9, 9, 7 }, - { 9, 11, 3 }, - { 9, 1, 10 }, - { 9, 7, 0 }, - { 9, 10, 6 }, - { 9, 7, 9 }, - { 9, 3, 11 }, - { 9, 5, 10 }, - { 9, 10, 1 }, - { 9, 4, 11 }, - { 9, 11, 2 }, - { 9, 13, 2 }, - { 9, 6, 10 }, - - /* 9/10 */ - { 9, 13, 3 }, { 9, 13, 3 }, - { 9, 2, 11 }, { 9, 2, 11 }, - { 9, 16, 0 }, { 9, 16, 0 }, - { 9, 5, 11 }, { 9, 5, 11 }, - { 9, 11, 5 }, { 9, 11, 5 }, - { 10, 11, 4 }, - { 10, 9, 8 }, - { 10, 7, 10 }, - { 10, 8, 9 }, - { 10, 0, 16 }, - { 10, 4, 13 }, - { 10, 0, 7 }, - { 10, 3, 13 }, - { 10, 11, 6 }, - { 10, 13, 1 }, - { 10, 13, 4 }, - { 10, 12, 3 }, - { 10, 2, 13 }, - { 10, 13, 5 }, - { 10, 8, 10 }, - { 10, 6, 11 }, - { 10, 10, 8 }, - { 10, 10, 7 }, - { 10, 14, 2 }, - { 10, 12, 4 }, - { 10, 1, 11 }, - { 10, 4, 12 }, - - /* 10 */ - { 10, 11, 1 }, - { 10, 3, 12 }, - { 10, 1, 13 }, - { 10, 12, 2 }, - { 10, 7, 11 }, - { 10, 3, 14 }, - { 10, 5, 12 }, - { 10, 5, 13 }, - { 10, 14, 4 }, - { 10, 4, 14 }, - { 10, 11, 7 }, - { 10, 14, 3 }, - { 10, 12, 5 }, - { 10, 13, 6 }, - { 10, 12, 6 }, - { 10, 8, 0 }, - { 10, 11, 8 }, - { 10, 2, 12 }, - { 10, 9, 9 }, - { 10, 14, 5 }, - { 10, 6, 13 }, - { 10, 10, 10 }, - { 10, 15, 2 }, - { 10, 8, 11 }, - { 10, 9, 10 }, - { 10, 14, 6 }, - { 10, 10, 9 }, - { 10, 5, 14 }, - { 10, 11, 9 }, - { 10, 14, 1 }, - { 10, 2, 14 }, - { 10, 6, 12 }, - { 10, 1, 12 }, - { 10, 13, 8 }, - { 10, 0, 8 }, - { 10, 13, 7 }, - { 10, 7, 12 }, - { 10, 12, 7 }, - { 10, 7, 13 }, - { 10, 15, 3 }, - { 10, 12, 1 }, - { 10, 6, 14 }, - { 10, 2, 15 }, - { 10, 15, 5 }, - { 10, 15, 4 }, - { 10, 1, 14 }, - { 10, 9, 11 }, - { 10, 4, 15 }, - { 10, 14, 7 }, - { 10, 8, 13 }, - { 10, 13, 9 }, - { 10, 8, 12 }, - { 10, 5, 15 }, - { 10, 3, 15 }, - { 10, 10, 11 }, - { 10, 11, 10 }, - { 10, 12, 8 }, - { 10, 15, 6 }, - { 10, 15, 7 }, - { 10, 8, 14 }, - { 10, 15, 1 }, - { 10, 7, 14 }, - { 10, 9, 0 }, - { 10, 0, 9 }, - - /* 10/11/12 */ - { 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 }, - { 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 }, - { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }, - { 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 }, - { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 }, - { 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 }, - { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 }, - { 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 }, - { 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 }, - - { 11, 9, 14 }, { 11, 9, 14 }, - { 11, 15, 8 }, { 11, 15, 8 }, - { 11, 11, 11 }, { 11, 11, 11 }, - { 11, 11, 14 }, { 11, 11, 14 }, - { 11, 1, 15 }, { 11, 1, 15 }, - { 11, 10, 12 }, { 11, 10, 12 }, - { 11, 10, 14 }, { 11, 10, 14 }, - { 11, 13, 11 }, { 11, 13, 11 }, - { 11, 13, 10 }, { 11, 13, 10 }, - { 11, 11, 13 }, { 11, 11, 13 }, - { 11, 11, 12 }, { 11, 11, 12 }, - { 11, 8, 15 }, { 11, 8, 15 }, - { 11, 14, 11 }, { 11, 14, 11 }, - { 11, 13, 12 }, { 11, 13, 12 }, - { 11, 12, 13 }, { 11, 12, 13 }, - { 11, 15, 9 }, { 11, 15, 9 }, - { 11, 14, 10 }, { 11, 14, 10 }, - { 11, 10, 0 }, { 11, 10, 0 }, - { 11, 12, 11 }, { 11, 12, 11 }, - { 11, 9, 15 }, { 11, 9, 15 }, - { 11, 0, 10 }, { 11, 0, 10 }, - { 11, 12, 12 }, { 11, 12, 12 }, - { 11, 11, 0 }, { 11, 11, 0 }, - { 11, 12, 14 }, { 11, 12, 14 }, - { 11, 10, 15 }, { 11, 10, 15 }, - { 11, 13, 13 }, { 11, 13, 13 }, - { 11, 0, 13 }, { 11, 0, 13 }, - { 11, 14, 12 }, { 11, 14, 12 }, - { 11, 15, 10 }, { 11, 15, 10 }, - { 11, 15, 11 }, { 11, 15, 11 }, - { 11, 11, 15 }, { 11, 11, 15 }, - { 11, 14, 13 }, { 11, 14, 13 }, - { 11, 13, 0 }, { 11, 13, 0 }, - { 11, 0, 11 }, { 11, 0, 11 }, - { 11, 13, 14 }, { 11, 13, 14 }, - { 11, 15, 12 }, { 11, 15, 12 }, - { 11, 15, 13 }, { 11, 15, 13 }, - { 11, 12, 15 }, { 11, 12, 15 }, - { 11, 14, 0 }, { 11, 14, 0 }, - { 11, 14, 14 }, { 11, 14, 14 }, - { 11, 13, 15 }, { 11, 13, 15 }, - { 11, 12, 0 }, { 11, 12, 0 }, - { 11, 14, 15 }, { 11, 14, 15 }, - { 12, 0, 14 }, - { 12, 0, 12 }, - { 12, 15, 14 }, - { 12, 15, 0 }, - { 12, 0, 15 }, - { 12, 15, 15 } -}; diff --git a/mplayer/libfaad2/codebook/hcb_2.h b/mplayer/libfaad2/codebook/hcb_2.h deleted file mode 100644 index ccda703e..00000000 --- a/mplayer/libfaad2/codebook/hcb_2.h +++ /dev/null @@ -1,182 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: hcb_2.h,v 1.3 2003/09/09 18:12:01 menno Exp $ -**/ - -/* 2-step huffman table HCB_2 */ - - -/* 1st step: 5 bits - * 2^5 = 32 entries - * - * Used to find offset into 2nd step table and number of extra bits to get - */ -static hcb hcb2_1[] = { - { /* 00000 */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* 00100 */ 1, 0 }, - { /* */ 1, 0 }, - { /* 00110 */ 2, 0 }, - { /* 00111 */ 3, 0 }, - { /* 01000 */ 4, 0 }, - { /* 01001 */ 5, 0 }, - { /* 01010 */ 6, 0 }, - { /* 01011 */ 7, 0 }, - { /* 01100 */ 8, 0 }, - - /* 6 bit codewords */ - { /* 01101 */ 9, 1 }, - { /* 01110 */ 11, 1 }, - { /* 01111 */ 13, 1 }, - { /* 10000 */ 15, 1 }, - { /* 10001 */ 17, 1 }, - { /* 10010 */ 19, 1 }, - { /* 10011 */ 21, 1 }, - { /* 10100 */ 23, 1 }, - { /* 10101 */ 25, 1 }, - { /* 10110 */ 27, 1 }, - { /* 10111 */ 29, 1 }, - { /* 11000 */ 31, 1 }, - - /* 7 bit codewords */ - { /* 11001 */ 33, 2 }, - { /* 11010 */ 37, 2 }, - { /* 11011 */ 41, 2 }, - - /* 7/8 bit codewords */ - { /* 11100 */ 45, 3 }, - - /* 8 bit codewords */ - { /* 11101 */ 53, 3 }, - { /* 11110 */ 61, 3 }, - - /* 8/9 bit codewords */ - { /* 11111 */ 69, 4 } -}; - -/* 2nd step table - * - * Gives size of codeword and actual data (x,y,v,w) - */ -static hcb_2_quad hcb2_2[] = { - /* 3 bit codeword */ - { 3, 0, 0, 0, 0 }, - - /* 4 bit codeword */ - { 4, 1, 0, 0, 0 }, - - /* 5 bit codewords */ - { 5, -1, 0, 0, 0 }, - { 5, 0, 0, 0, 1 }, - { 5, 0, 0, -1, 0 }, - { 5, 0, 0, 0, -1 }, - { 5, 0, -1, 0, 0 }, - { 5, 0, 0, 1, 0 }, - { 5, 0, 1, 0, 0 }, - - /* 6 bit codewords */ - { 6, 0, -1, 1, 0 }, - { 6, -1, 1, 0, 0 }, - { 6, 0, 1, -1, 0 }, - { 6, 0, 0, 1, -1 }, - { 6, 0, 1, 0, -1 }, - { 6, 0, 0, -1, 1 }, - { 6, -1, 0, 0, -1 }, - { 6, 1, -1, 0, 0 }, - { 6, 1, 0, -1, 0 }, - { 6, -1, -1, 0, 0 }, - { 6, 0, 0, -1, -1 }, - { 6, 1, 0, 1, 0 }, - { 6, 1, 0, 0, 1 }, - { 6, 0, -1, 0, 1 }, - { 6, -1, 0, 1, 0 }, - { 6, 0, 1, 0, 1 }, - { 6, 0, -1, -1, 0 }, - { 6, -1, 0, 0, 1 }, - { 6, 0, -1, 0, -1 }, - { 6, -1, 0, -1, 0 }, - { 6, 1, 1, 0, 0 }, - { 6, 0, 1, 1, 0 }, - { 6, 0, 0, 1, 1 }, - { 6, 1, 0, 0, -1 }, - - /* 7 bit codewords */ - { 7, 0, 1, -1, 1 }, - { 7, 1, 0, -1, 1 }, - { 7, -1, 1, -1, 0 }, - { 7, 0, -1, 1, -1 }, - { 7, 1, -1, 1, 0 }, - { 7, 1, 1, 0, -1 }, - { 7, 1, 0, 1, 1 }, - { 7, -1, 1, 1, 0 }, - { 7, 0, -1, -1, 1 }, - { 7, 1, 1, 1, 0 }, - { 7, -1, 0, 1, -1 }, - { 7, -1, -1, -1, 0 }, - - /* 7/8 bit codewords */ - { 7, -1, 0, -1, 1 }, { 7, -1, 0, -1, 1 }, - { 7, 1, -1, -1, 0 }, { 7, 1, -1, -1, 0 }, - { 7, 1, 1, -1, 0 }, { 7, 1, 1, -1, 0 }, - { 8, 1, -1, 0, 1 }, - { 8, -1, 1, 0, -1 }, - - /* 8 bit codewords */ - { 8, -1, -1, 1, 0 }, - { 8, -1, 0, 1, 1 }, - { 8, -1, -1, 0, 1 }, - { 8, -1, -1, 0, -1 }, - { 8, 0, -1, -1, -1 }, - { 8, 1, 0, 1, -1 }, - { 8, 1, 0, -1, -1 }, - { 8, 0, 1, -1, -1 }, - { 8, 0, 1, 1, 1 }, - { 8, -1, 1, 0, 1 }, - { 8, -1, 0, -1, -1 }, - { 8, 0, 1, 1, -1 }, - { 8, 1, -1, 0, -1 }, - { 8, 0, -1, 1, 1 }, - { 8, 1, 1, 0, 1 }, - { 8, 1, -1, 1, -1 }, - - /* 8/9 bit codewords */ - { 8, -1, 1, -1, 1 }, { 8, -1, 1, -1, 1 }, - { 9, 1, -1, -1, 1 }, - { 9, -1, -1, -1, -1 }, - { 9, -1, 1, 1, -1 }, - { 9, -1, 1, 1, 1 }, - { 9, 1, 1, 1, 1 }, - { 9, -1, -1, 1, -1 }, - { 9, 1, -1, 1, 1 }, - { 9, -1, 1, -1, -1 }, - { 9, -1, -1, 1, 1 }, - { 9, 1, 1, -1, -1 }, - { 9, 1, -1, -1, -1 }, - { 9, -1, -1, -1, 1 }, - { 9, 1, 1, -1, 1 }, - { 9, 1, 1, 1, -1 } -}; diff --git a/mplayer/libfaad2/codebook/hcb_3.h b/mplayer/libfaad2/codebook/hcb_3.h deleted file mode 100644 index 980b4c7b..00000000 --- a/mplayer/libfaad2/codebook/hcb_3.h +++ /dev/null @@ -1,193 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: hcb_3.h,v 1.3 2003/09/09 18:12:01 menno Exp $ -**/ - -/* Binary search huffman table HCB_3 */ - - -static hcb_bin_quad hcb3[] = { - { /* 0 */ 0, { 1, 2, 0, 0 } }, - { /* 1 */ 1, { 0, 0, 0, 0 } }, /* 0 */ - { /* 2 */ 0, { 1, 2, 0, 0 } }, - { /* 3 */ 0, { 2, 3, 0, 0 } }, - { /* 4 */ 0, { 3, 4, 0, 0 } }, - { /* 5 */ 0, { 4, 5, 0, 0 } }, - { /* 6 */ 0, { 5, 6, 0, 0 } }, - { /* 7 */ 0, { 6, 7, 0, 0 } }, - { /* 8 */ 0, { 7, 8, 0, 0 } }, - { /* 9 */ 1, { 1, 0, 0, 0 } }, /* 1000 */ - { /* 10 */ 1, { 0, 0, 0, 1 } }, /* 1001 */ - { /* 11 */ 1, { 0, 1, 0, 0 } }, /* 1010 */ - { /* 12 */ 1, { 0, 0, 1, 0 } }, /* 1011 */ - { /* 13 */ 0, { 4, 5, 0, 0 } }, - { /* 14 */ 0, { 5, 6, 0, 0 } }, - { /* 15 */ 0, { 6, 7, 0, 0 } }, - { /* 16 */ 0, { 7, 8, 0, 0 } }, - { /* 17 */ 1, { 1, 1, 0, 0 } }, - { /* 18 */ 1, { 0, 0, 1, 1 } }, - { /* 19 */ 0, { 6, 7, 0, 0 } }, - { /* 20 */ 0, { 7, 8, 0, 0 } }, - { /* 21 */ 0, { 8, 9, 0, 0 } }, - { /* 22 */ 0, { 9, 10, 0, 0 } }, - { /* 23 */ 0, { 10, 11, 0, 0 } }, - { /* 24 */ 0, { 11, 12, 0, 0 } }, - { /* 25 */ 1, { 0, 1, 1, 0 } }, /* 110100 */ - { /* 26 */ 1, { 0, 1, 0, 1 } }, /* 110101 */ - { /* 27 */ 1, { 1, 0, 1, 0 } }, /* 110110 */ - { /* 28 */ 1, { 0, 1, 1, 1 } }, /* 110111 */ - { /* 29 */ 1, { 1, 0, 0, 1 } }, /* 111000 */ - { /* 30 */ 1, { 1, 1, 1, 0 } }, /* 111001 */ - { /* 31 */ 0, { 6, 7, 0, 0 } }, - { /* 32 */ 0, { 7, 8, 0, 0 } }, - { /* 33 */ 0, { 8, 9, 0, 0 } }, - { /* 34 */ 0, { 9, 10, 0, 0 } }, - { /* 35 */ 0, { 10, 11, 0, 0 } }, - { /* 36 */ 0, { 11, 12, 0, 0 } }, - { /* 37 */ 1, { 1, 1, 1, 1 } }, /* 1110100 */ - { /* 38 */ 1, { 1, 0, 1, 1 } }, /* 1110101 */ - { /* 39 */ 1, { 1, 1, 0, 1 } }, /* 1110110 */ - { /* 40 */ 0, { 9, 10, 0, 0 } }, - { /* 41 */ 0, { 10, 11, 0, 0 } }, - { /* 42 */ 0, { 11, 12, 0, 0 } }, - { /* 43 */ 0, { 12, 13, 0, 0 } }, - { /* 44 */ 0, { 13, 14, 0, 0 } }, - { /* 45 */ 0, { 14, 15, 0, 0 } }, - { /* 46 */ 0, { 15, 16, 0, 0 } }, - { /* 47 */ 0, { 16, 17, 0, 0 } }, - { /* 48 */ 0, { 17, 18, 0, 0 } }, - { /* 49 */ 1, { 2, 0, 0, 0 } }, /* 11101110 */ - { /* 50 */ 1, { 0, 0, 0, 2 } }, /* 11101111 */ - { /* 51 */ 1, { 0, 0, 1, 2 } }, /* 11110000 */ - { /* 52 */ 1, { 2, 1, 0, 0 } }, /* 11110001 */ - { /* 53 */ 1, { 1, 2, 1, 0 } }, /* 11110010 */ - { /* 54 */ 0, { 13, 14, 0, 0 } }, - { /* 55 */ 0, { 14, 15, 0, 0 } }, - { /* 56 */ 0, { 15, 16, 0, 0 } }, - { /* 57 */ 0, { 16, 17, 0, 0 } }, - { /* 58 */ 0, { 17, 18, 0, 0 } }, - { /* 59 */ 0, { 18, 19, 0, 0 } }, - { /* 60 */ 0, { 19, 20, 0, 0 } }, - { /* 61 */ 0, { 20, 21, 0, 0 } }, - { /* 62 */ 0, { 21, 22, 0, 0 } }, - { /* 63 */ 0, { 22, 23, 0, 0 } }, - { /* 64 */ 0, { 23, 24, 0, 0 } }, - { /* 65 */ 0, { 24, 25, 0, 0 } }, - { /* 66 */ 0, { 25, 26, 0, 0 } }, - { /* 67 */ 1, { 0, 0, 2, 1 } }, - { /* 68 */ 1, { 0, 1, 2, 1 } }, - { /* 69 */ 1, { 1, 2, 0, 0 } }, - { /* 70 */ 1, { 0, 1, 1, 2 } }, - { /* 71 */ 1, { 2, 1, 1, 0 } }, - { /* 72 */ 1, { 0, 0, 2, 0 } }, - { /* 73 */ 1, { 0, 2, 1, 0 } }, - { /* 74 */ 1, { 0, 1, 2, 0 } }, - { /* 75 */ 1, { 0, 2, 0, 0 } }, - { /* 76 */ 1, { 0, 1, 0, 2 } }, - { /* 77 */ 1, { 2, 0, 1, 0 } }, - { /* 78 */ 1, { 1, 2, 1, 1 } }, - { /* 79 */ 1, { 0, 2, 1, 1 } }, - { /* 80 */ 1, { 1, 1, 2, 0 } }, - { /* 81 */ 1, { 1, 1, 2, 1 } }, - { /* 82 */ 0, { 11, 12, 0, 0 } }, - { /* 83 */ 0, { 12, 13, 0, 0 } }, - { /* 84 */ 0, { 13, 14, 0, 0 } }, - { /* 85 */ 0, { 14, 15, 0, 0 } }, - { /* 86 */ 0, { 15, 16, 0, 0 } }, - { /* 87 */ 0, { 16, 17, 0, 0 } }, - { /* 88 */ 0, { 17, 18, 0, 0 } }, - { /* 89 */ 0, { 18, 19, 0, 0 } }, - { /* 90 */ 0, { 19, 20, 0, 0 } }, - { /* 91 */ 0, { 20, 21, 0, 0 } }, - { /* 92 */ 0, { 21, 22, 0, 0 } }, - { /* 93 */ 1, { 1, 2, 0, 1 } }, /* 1111101010 */ - { /* 94 */ 1, { 1, 0, 2, 0 } }, /* 1111101011 */ - { /* 95 */ 1, { 1, 0, 2, 1 } }, /* 1111101100 */ - { /* 96 */ 1, { 0, 2, 0, 1 } }, /* 1111101101 */ - { /* 97 */ 1, { 2, 1, 1, 1 } }, /* 1111101110 */ - { /* 98 */ 1, { 1, 1, 1, 2 } }, /* 1111101111 */ - { /* 99 */ 1, { 2, 1, 0, 1 } }, /* 1111110000 */ - { /* 00 */ 1, { 1, 0, 1, 2 } }, /* 1111110001 */ - { /* 01 */ 1, { 0, 0, 2, 2 } }, /* 1111110010 */ - { /* 02 */ 1, { 0, 1, 2, 2 } }, /* 1111110011 */ - { /* 03 */ 1, { 2, 2, 1, 0 } }, /* 1111110100 */ - { /* 04 */ 1, { 1, 2, 2, 0 } }, /* 1111110101 */ - { /* 05 */ 1, { 1, 0, 0, 2 } }, /* 1111110110 */ - { /* 06 */ 1, { 2, 0, 0, 1 } }, /* 1111110111 */ - { /* 07 */ 1, { 0, 2, 2, 1 } }, /* 1111111000 */ - { /* 08 */ 0, { 7, 8, 0, 0 } }, - { /* 09 */ 0, { 8, 9, 0, 0 } }, - { /* 10 */ 0, { 9, 10, 0, 0 } }, - { /* 11 */ 0, { 10, 11, 0, 0 } }, - { /* 12 */ 0, { 11, 12, 0, 0 } }, - { /* 13 */ 0, { 12, 13, 0, 0 } }, - { /* 14 */ 0, { 13, 14, 0, 0 } }, - { /* 15 */ 1, { 2, 2, 0, 0 } }, /* 11111110010 */ - { /* 16 */ 1, { 1, 2, 2, 1 } }, /* 11111110011 */ - { /* 17 */ 1, { 1, 1, 0, 2 } }, /* 11111110100 */ - { /* 18 */ 1, { 2, 0, 1, 1 } }, /* 11111110101 */ - { /* 19 */ 1, { 1, 1, 2, 2 } }, /* 11111110110 */ - { /* 20 */ 1, { 2, 2, 1, 1 } }, /* 11111110111 */ - { /* 21 */ 1, { 0, 2, 2, 0 } }, /* 11111111000 */ - { /* 22 */ 1, { 0, 2, 1, 2 } }, /* 11111111001 */ - { /* 23 */ 0, { 6, 7, 0, 0 } }, - { /* 24 */ 0, { 7, 8, 0, 0 } }, - { /* 25 */ 0, { 8, 9, 0, 0 } }, - { /* 26 */ 0, { 9, 10, 0, 0 } }, - { /* 27 */ 0, { 10, 11, 0, 0 } }, - { /* 28 */ 0, { 11, 12, 0, 0 } }, - { /* 29 */ 1, { 1, 0, 2, 2 } }, /* 111111110100 */ - { /* 30 */ 1, { 2, 2, 0, 1 } }, /* 111111110101 */ - { /* 31 */ 1, { 2, 1, 2, 0 } }, /* 111111110110 */ - { /* 32 */ 1, { 2, 2, 2, 0 } }, /* 111111110111 */ - { /* 33 */ 1, { 0, 2, 2, 2 } }, /* 111111111000 */ - { /* 34 */ 1, { 2, 2, 2, 1 } }, /* 111111111001 */ - { /* 35 */ 1, { 2, 1, 2, 1 } }, /* 111111111010 */ - { /* 36 */ 1, { 1, 2, 1, 2 } }, /* 111111111011 */ - { /* 37 */ 1, { 1, 2, 2, 2 } }, /* 111111111100 */ - { /* 38 */ 0, { 3, 4, 0, 0 } }, - { /* 39 */ 0, { 4, 5, 0, 0 } }, - { /* 40 */ 0, { 5, 6, 0, 0 } }, - { /* 41 */ 1, { 0, 2, 0, 2 } }, /* 1111111111010 */ - { /* 42 */ 1, { 2, 0, 2, 0 } }, /* 1111111111011 */ - { /* 43 */ 1, { 1, 2, 0, 2 } }, /* 1111111111100 */ - { /* 44 */ 0, { 3, 4, 0, 0 } }, - { /* 45 */ 0, { 4, 5, 0, 0 } }, - { /* 46 */ 0, { 5, 6, 0, 0 } }, - { /* 47 */ 1, { 2, 0, 2, 1 } }, /* 11111111111010 */ - { /* 48 */ 1, { 2, 1, 1, 2 } }, /* 11111111111011 */ - { /* 49 */ 1, { 2, 1, 0, 2 } }, /* 11111111111100 */ - { /* 50 */ 0, { 3, 4, 0, 0 } }, - { /* 51 */ 0, { 4, 5, 0, 0 } }, - { /* 52 */ 0, { 5, 6, 0, 0 } }, - { /* 53 */ 1, { 2, 2, 2, 2 } }, /* 111111111111010 */ - { /* 54 */ 1, { 2, 2, 1, 2 } }, /* 111111111111011 */ - { /* 55 */ 1, { 2, 1, 2, 2 } }, /* 111111111111100 */ - { /* 56 */ 1, { 2, 0, 1, 2 } }, /* 111111111111101 */ - { /* 57 */ 1, { 2, 0, 0, 2 } }, /* 111111111111110 */ - { /* 58 */ 0, { 1, 2, 0, 0 } }, - { /* 59 */ 1, { 2, 2, 0, 2 } }, /* 1111111111111110 */ - { /* 60 */ 1, { 2, 0, 2, 2 } } /* 1111111111111111 */ -}; diff --git a/mplayer/libfaad2/codebook/hcb_4.h b/mplayer/libfaad2/codebook/hcb_4.h deleted file mode 100644 index ee1b593b..00000000 --- a/mplayer/libfaad2/codebook/hcb_4.h +++ /dev/null @@ -1,196 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: hcb_4.h,v 1.3 2003/09/09 18:12:01 menno Exp $ -**/ - -/* 2-step huffman table HCB_4 */ - - -/* 1st step: 5 bits - * 2^5 = 32 entries - * - * Used to find offset into 2nd step table and number of extra bits to get - */ -static hcb hcb4_1[] = { - /* 4 bit codewords */ - { /* 00000 */ 0, 0 }, - { /* */ 0, 0 }, - { /* 00010 */ 1, 0 }, - { /* */ 1, 0 }, - { /* 00100 */ 2, 0 }, - { /* */ 2, 0 }, - { /* 00110 */ 3, 0 }, - { /* */ 3, 0 }, - { /* 01000 */ 4, 0 }, - { /* */ 4, 0 }, - { /* 01010 */ 5, 0 }, - { /* */ 5, 0 }, - { /* 01100 */ 6, 0 }, - { /* */ 6, 0 }, - { /* 01110 */ 7, 0 }, - { /* */ 7, 0 }, - { /* 10000 */ 8, 0 }, - { /* */ 8, 0 }, - { /* 10010 */ 9, 0 }, - { /* */ 9, 0 }, - - /* 5 bit codewords */ - { /* 10100 */ 10, 0 }, - { /* 10101 */ 11, 0 }, - { /* 10110 */ 12, 0 }, - { /* 10111 */ 13, 0 }, - { /* 11000 */ 14, 0 }, - { /* 11001 */ 15, 0 }, - - /* 7 bit codewords */ - { /* 11010 */ 16, 2 }, - { /* 11011 */ 20, 2 }, - - /* 7/8 bit codewords */ - { /* 11100 */ 24, 3 }, - - /* 8 bit codewords */ - { /* 11101 */ 32, 3 }, - - /* 8/9 bit codewords */ - { /* 11110 */ 40, 4 }, - - /* 9/10/11/12 bit codewords */ - { /* 11111 */ 56, 7 } -}; - -/* 2nd step table - * - * Gives size of codeword and actual data (x,y,v,w) - */ -static hcb_2_quad hcb4_2[] = { - /* 4 bit codewords */ - { 4, 1, 1, 1, 1 }, - { 4, 0, 1, 1, 1 }, - { 4, 1, 1, 0, 1 }, - { 4, 1, 1, 1, 0 }, - { 4, 1, 0, 1, 1 }, - { 4, 1, 0, 0, 0 }, - { 4, 1, 1, 0, 0 }, - { 4, 0, 0, 0, 0 }, - { 4, 0, 0, 1, 1 }, - { 4, 1, 0, 1, 0 }, - - /* 5 bit codewords */ - { 5, 1, 0, 0, 1 }, - { 5, 0, 1, 1, 0 }, - { 5, 0, 0, 0, 1 }, - { 5, 0, 1, 0, 1 }, - { 5, 0, 0, 1, 0 }, - { 5, 0, 1, 0, 0 }, - - /* 7 bit codewords */ - /* first 5 bits: 11010 */ - { 7, 2, 1, 1, 1 }, - { 7, 1, 1, 2, 1 }, - { 7, 1, 2, 1, 1 }, - { 7, 1, 1, 1, 2 }, - /* first 5 bits: 11011 */ - { 7, 2, 1, 1, 0 }, - { 7, 2, 1, 0, 1 }, - { 7, 1, 2, 1, 0 }, - { 7, 2, 0, 1, 1 }, - - /* 7/8 bit codewords */ - /* first 5 bits: 11100 */ - { 7, 0, 1, 2, 1 }, { 7, 0, 1, 2, 1 }, - { 8, 0, 1, 1, 2 }, - { 8, 1, 1, 2, 0 }, - { 8, 0, 2, 1, 1 }, - { 8, 1, 0, 1, 2 }, - { 8, 1, 2, 0, 1 }, - { 8, 1, 1, 0, 2 }, - - /* 8 bit codewords */ - { 8, 1, 0, 2, 1 }, - { 8, 2, 1, 0, 0 }, - { 8, 2, 0, 1, 0 }, - { 8, 1, 2, 0, 0 }, - { 8, 2, 0, 0, 1 }, - { 8, 0, 1, 0, 2 }, - { 8, 0, 2, 1, 0 }, - { 8, 0, 0, 1, 2 }, - - /* 8/9 bit codewords */ - { 8, 0, 1, 2, 0 }, { 8, 0, 1, 2, 0 }, - { 8, 0, 2, 0, 1 }, { 8, 0, 2, 0, 1 }, - { 8, 1, 0, 0, 2 }, { 8, 1, 0, 0, 2 }, - { 8, 0, 0, 2, 1 }, { 8, 0, 0, 2, 1 }, - { 8, 1, 0, 2, 0 }, { 8, 1, 0, 2, 0 }, - { 8, 2, 0, 0, 0 }, { 8, 2, 0, 0, 0 }, - { 8, 0, 0, 0, 2 }, { 8, 0, 0, 0, 2 }, - { 9, 0, 2, 0, 0 }, - { 9, 0, 0, 2, 0 }, - - /* 9/10/11 bit codewords */ - /* 9 bit codewords repeated 2^3 = 8 times */ - { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, - { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, - { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, - { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, - { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, - { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, - { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, - { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, - { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, - { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, - { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, - { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, - /* 10 bit codewords repeated 2^2 = 4 times */ - { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, - { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, - { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, - { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, - { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, - { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, - { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, - { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, - { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, - { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, - { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, - { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, - { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, - { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, - /* 11 bit codewords repeated 2^1 = 2 times */ - { 11, 2, 1, 2, 2 }, { 11, 2, 1, 2, 2 }, - { 11, 2, 2, 1, 2 }, { 11, 2, 2, 1, 2 }, - { 11, 0, 2, 2, 0 }, { 11, 0, 2, 2, 0 }, - { 11, 2, 2, 0, 0 }, { 11, 2, 2, 0, 0 }, - { 11, 0, 0, 2, 2 }, { 11, 0, 0, 2, 2 }, - { 11, 2, 0, 2, 0 }, { 11, 2, 0, 2, 0 }, - { 11, 0, 2, 0, 2 }, { 11, 0, 2, 0, 2 }, - { 11, 2, 0, 0, 2 }, { 11, 2, 0, 0, 2 }, - { 11, 2, 2, 2, 2 }, { 11, 2, 2, 2, 2 }, - { 11, 0, 2, 2, 2 }, { 11, 0, 2, 2, 2 }, - { 11, 2, 2, 2, 0 }, { 11, 2, 2, 2, 0 }, - /* 12 bit codewords */ - { 12, 2, 2, 0, 2 }, - { 12, 2, 0, 2, 2 }, -}; diff --git a/mplayer/libfaad2/codebook/hcb_5.h b/mplayer/libfaad2/codebook/hcb_5.h deleted file mode 100644 index b816e93c..00000000 --- a/mplayer/libfaad2/codebook/hcb_5.h +++ /dev/null @@ -1,193 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: hcb_5.h,v 1.3 2003/09/09 18:12:01 menno Exp $ -**/ - -/* Binary search huffman table HCB_5 */ - - -static hcb_bin_pair hcb5[] = { - { /* 0 */ 0, { 1, 2 } }, - { /* 1 */ 1, { 0, 0 } }, /* 0 */ - { /* 2 */ 0, { 1, 2 } }, - { /* 3 */ 0, { 2, 3 } }, - { /* 4 */ 0, { 3, 4 } }, - { /* 5 */ 0, { 4, 5 } }, - { /* 6 */ 0, { 5, 6 } }, - { /* 7 */ 0, { 6, 7 } }, - { /* 8 */ 0, { 7, 8 } }, - { /* 9 */ 1, { -1, 0 } }, /* 1000 */ - { /* 10 */ 1, { 1, 0 } }, /* 1001 */ - { /* 11 */ 1, { 0, 1 } }, /* 1010 */ - { /* 12 */ 1, { 0, -1 } }, /* 1011 */ - { /* 13 */ 0, { 4, 5 } }, - { /* 14 */ 0, { 5, 6 } }, - { /* 15 */ 0, { 6, 7 } }, - { /* 16 */ 0, { 7, 8 } }, - { /* 17 */ 1, { 1, -1 } }, - { /* 18 */ 1, { -1, 1 } }, - { /* 19 */ 1, { -1, -1 } }, - { /* 20 */ 1, { 1, 1 } }, - { /* 21 */ 0, { 4, 5 } }, - { /* 22 */ 0, { 5, 6 } }, - { /* 23 */ 0, { 6, 7 } }, - { /* 24 */ 0, { 7, 8 } }, - { /* 25 */ 0, { 8, 9 } }, - { /* 26 */ 0, { 9, 10 } }, - { /* 27 */ 0, { 10, 11 } }, - { /* 28 */ 0, { 11, 12 } }, - { /* 29 */ 0, { 12, 13 } }, - { /* 30 */ 0, { 13, 14 } }, - { /* 31 */ 0, { 14, 15 } }, - { /* 32 */ 0, { 15, 16 } }, - { /* 33 */ 1, { -2, 0 } }, - { /* 34 */ 1, { 0, 2 } }, - { /* 35 */ 1, { 2, 0 } }, - { /* 36 */ 1, { 0, -2 } }, - { /* 37 */ 0, { 12, 13 } }, - { /* 38 */ 0, { 13, 14 } }, - { /* 39 */ 0, { 14, 15 } }, - { /* 40 */ 0, { 15, 16 } }, - { /* 41 */ 0, { 16, 17 } }, - { /* 42 */ 0, { 17, 18 } }, - { /* 43 */ 0, { 18, 19 } }, - { /* 44 */ 0, { 19, 20 } }, - { /* 45 */ 0, { 20, 21 } }, - { /* 46 */ 0, { 21, 22 } }, - { /* 47 */ 0, { 22, 23 } }, - { /* 48 */ 0, { 23, 24 } }, - { /* 49 */ 1, { -2, -1 } }, - { /* 50 */ 1, { 2, 1 } }, - { /* 51 */ 1, { -1, -2 } }, - { /* 52 */ 1, { 1, 2 } }, - { /* 53 */ 1, { -2, 1 } }, - { /* 54 */ 1, { 2, -1 } }, - { /* 55 */ 1, { -1, 2 } }, - { /* 56 */ 1, { 1, -2 } }, - { /* 57 */ 1, { -3, 0 } }, - { /* 58 */ 1, { 3, 0 } }, - { /* 59 */ 1, { 0, -3 } }, - { /* 60 */ 1, { 0, 3 } }, - { /* 61 */ 0, { 12, 13 } }, - { /* 62 */ 0, { 13, 14 } }, - { /* 63 */ 0, { 14, 15 } }, - { /* 64 */ 0, { 15, 16 } }, - { /* 65 */ 0, { 16, 17 } }, - { /* 66 */ 0, { 17, 18 } }, - { /* 67 */ 0, { 18, 19 } }, - { /* 68 */ 0, { 19, 20 } }, - { /* 69 */ 0, { 20, 21 } }, - { /* 70 */ 0, { 21, 22 } }, - { /* 71 */ 0, { 22, 23 } }, - { /* 72 */ 0, { 23, 24 } }, - { /* 73 */ 1, { -3, -1 } }, - { /* 74 */ 1, { 1, 3 } }, - { /* 75 */ 1, { 3, 1 } }, - { /* 76 */ 1, { -1, -3 } }, - { /* 77 */ 1, { -3, 1 } }, - { /* 78 */ 1, { 3, -1 } }, - { /* 79 */ 1, { 1, -3 } }, - { /* 80 */ 1, { -1, 3 } }, - { /* 81 */ 1, { -2, 2 } }, - { /* 82 */ 1, { 2, 2 } }, - { /* 83 */ 1, { -2, -2 } }, - { /* 84 */ 1, { 2, -2 } }, - { /* 85 */ 0, { 12, 13 } }, - { /* 86 */ 0, { 13, 14 } }, - { /* 87 */ 0, { 14, 15 } }, - { /* 88 */ 0, { 15, 16 } }, - { /* 89 */ 0, { 16, 17 } }, - { /* 90 */ 0, { 17, 18 } }, - { /* 91 */ 0, { 18, 19 } }, - { /* 92 */ 0, { 19, 20 } }, - { /* 93 */ 0, { 20, 21 } }, - { /* 94 */ 0, { 21, 22 } }, - { /* 95 */ 0, { 22, 23 } }, - { /* 96 */ 0, { 23, 24 } }, - { /* 97 */ 1, { -3, -2 } }, - { /* 98 */ 1, { 3, -2 } }, - { /* 99 */ 1, { -2, 3 } }, - { /* 00 */ 1, { 2, -3 } }, - { /* 01 */ 1, { 3, 2 } }, - { /* 02 */ 1, { 2, 3 } }, - { /* 03 */ 1, { -3, 2 } }, - { /* 04 */ 1, { -2, -3 } }, - { /* 05 */ 1, { 0, -4 } }, - { /* 06 */ 1, { -4, 0 } }, - { /* 07 */ 1, { 4, 1 } }, - { /* 08 */ 1, { 4, 0 } }, - { /* 09 */ 0, { 12, 13 } }, - { /* 10 */ 0, { 13, 14 } }, - { /* 11 */ 0, { 14, 15 } }, - { /* 12 */ 0, { 15, 16 } }, - { /* 13 */ 0, { 16, 17 } }, - { /* 14 */ 0, { 17, 18 } }, - { /* 15 */ 0, { 18, 19 } }, - { /* 16 */ 0, { 19, 20 } }, - { /* 17 */ 0, { 20, 21 } }, - { /* 18 */ 0, { 21, 22 } }, - { /* 19 */ 0, { 22, 23 } }, - { /* 20 */ 0, { 23, 24 } }, - { /* 21 */ 1, { -4, -1 } }, - { /* 22 */ 1, { 0, 4 } }, - { /* 23 */ 1, { 4, -1 } }, - { /* 24 */ 1, { -1, -4 } }, - { /* 25 */ 1, { 1, 4 } }, - { /* 26 */ 1, { -1, 4 } }, - { /* 27 */ 1, { -4, 1 } }, - { /* 28 */ 1, { 1, -4 } }, - { /* 29 */ 1, { 3, -3 } }, - { /* 30 */ 1, { -3, -3 } }, - { /* 31 */ 1, { -3, 3 } }, - { /* 32 */ 1, { -2, 4 } }, - { /* 33 */ 1, { -4, -2 } }, - { /* 34 */ 1, { 4, 2 } }, - { /* 35 */ 1, { 2, -4 } }, - { /* 36 */ 1, { 2, 4 } }, - { /* 37 */ 1, { 3, 3 } }, - { /* 38 */ 1, { -4, 2 } }, - { /* 39 */ 0, { 6, 7 } }, - { /* 40 */ 0, { 7, 8 } }, - { /* 41 */ 0, { 8, 9 } }, - { /* 42 */ 0, { 9, 10 } }, - { /* 43 */ 0, { 10, 11 } }, - { /* 44 */ 0, { 11, 12 } }, - { /* 45 */ 1, { -2, -4 } }, - { /* 46 */ 1, { 4, -2 } }, - { /* 47 */ 1, { 3, -4 } }, - { /* 48 */ 1, { -4, -3 } }, - { /* 49 */ 1, { -4, 3 } }, - { /* 50 */ 1, { 3, 4 } }, - { /* 51 */ 1, { -3, 4 } }, - { /* 52 */ 1, { 4, 3 } }, - { /* 53 */ 1, { 4, -3 } }, - { /* 54 */ 1, { -3, -4 } }, - { /* 55 */ 0, { 2, 3 } }, - { /* 56 */ 0, { 3, 4 } }, - { /* 57 */ 1, { 4, -4 } }, - { /* 58 */ 1, { -4, 4 } }, - { /* 59 */ 1, { 4, 4 } }, - { /* 60 */ 1, { -4, -4 } } -}; diff --git a/mplayer/libfaad2/codebook/hcb_6.h b/mplayer/libfaad2/codebook/hcb_6.h deleted file mode 100644 index e7fc95ba..00000000 --- a/mplayer/libfaad2/codebook/hcb_6.h +++ /dev/null @@ -1,179 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: hcb_6.h,v 1.3 2003/09/09 18:12:01 menno Exp $ -**/ - -/* 2-step huffman table HCB_6 */ - - -/* 1st step: 5 bits - * 2^5 = 32 entries - * - * Used to find offset into 2nd step table and number of extra bits to get - */ -static hcb hcb6_1[] = { - /* 4 bit codewords */ - { /* 00000 */ 0, 0 }, - { /* */ 0, 0 }, - { /* 00010 */ 1, 0 }, - { /* */ 1, 0 }, - { /* 00100 */ 2, 0 }, - { /* */ 2, 0 }, - { /* 00110 */ 3, 0 }, - { /* */ 3, 0 }, - { /* 01000 */ 4, 0 }, - { /* */ 4, 0 }, - { /* 01010 */ 5, 0 }, - { /* */ 5, 0 }, - { /* 01100 */ 6, 0 }, - { /* */ 6, 0 }, - { /* 01110 */ 7, 0 }, - { /* */ 7, 0 }, - { /* 10000 */ 8, 0 }, - { /* */ 8, 0 }, - - /* 6 bit codewords */ - { /* 10010 */ 9, 1 }, - { /* 10011 */ 11, 1 }, - { /* 10100 */ 13, 1 }, - { /* 10101 */ 15, 1 }, - { /* 10110 */ 17, 1 }, - { /* 10111 */ 19, 1 }, - { /* 11000 */ 21, 1 }, - { /* 11001 */ 23, 1 }, - - /* 7 bit codewords */ - { /* 11010 */ 25, 2 }, - { /* 11011 */ 29, 2 }, - { /* 11100 */ 33, 2 }, - - /* 7/8 bit codewords */ - { /* 11101 */ 37, 3 }, - - /* 8/9 bit codewords */ - { /* 11110 */ 45, 4 }, - - /* 9/10/11 bit codewords */ - { /* 11111 */ 61, 6 } -}; - -/* 2nd step table - * - * Gives size of codeword and actual data (x,y,v,w) - */ -static hcb_2_pair hcb6_2[] = { - /* 4 bit codewords */ - { 4, 0, 0 }, - { 4, 1, 0 }, - { 4, 0, -1 }, - { 4, 0, 1 }, - { 4, -1, 0 }, - { 4, 1, 1 }, - { 4, -1, 1 }, - { 4, 1, -1 }, - { 4, -1, -1 }, - - /* 6 bit codewords */ - { 6, 2, -1 }, - { 6, 2, 1 }, - { 6, -2, 1 }, - { 6, -2, -1 }, - { 6, -2, 0 }, - { 6, -1, 2 }, - { 6, 2, 0 }, - { 6, 1, -2 }, - { 6, 1, 2 }, - { 6, 0, -2 }, - { 6, -1, -2 }, - { 6, 0, 2 }, - { 6, 2, -2 }, - { 6, -2, 2 }, - { 6, -2, -2 }, - { 6, 2, 2 }, - - /* 7 bit codewords */ - { 7, -3, 1 }, - { 7, 3, 1 }, - { 7, 3, -1 }, - { 7, -1, 3 }, - { 7, -3, -1 }, - { 7, 1, 3 }, - { 7, 1, -3 }, - { 7, -1, -3 }, - { 7, 3, 0 }, - { 7, -3, 0 }, - { 7, 0, -3 }, - { 7, 0, 3 }, - - /* 7/8 bit codewords */ - { 7, 3, 2 }, { 7, 3, 2 }, - { 8, -3, -2 }, - { 8, -2, 3 }, - { 8, 2, 3 }, - { 8, 3, -2 }, - { 8, 2, -3 }, - { 8, -2, -3 }, - - /* 8 bit codewords */ - { 8, -3, 2 }, { 8, -3, 2 }, - { 8, 3, 3 }, { 8, 3, 3 }, - { 9, 3, -3 }, - { 9, -3, -3 }, - { 9, -3, 3 }, - { 9, 1, -4 }, - { 9, -1, -4 }, - { 9, 4, 1 }, - { 9, -4, 1 }, - { 9, -4, -1 }, - { 9, 1, 4 }, - { 9, 4, -1 }, - { 9, -1, 4 }, - { 9, 0, -4 }, - - /* 9/10/11 bit codewords */ - { 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 }, - { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 }, - { 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 }, - { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 }, - { 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 }, - { 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 }, - { 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 }, - { 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 }, - { 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 }, - { 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 }, - { 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 }, - { 10, -3, -4 }, { 10, -3, -4 }, - { 10, -3, 4 }, { 10, -3, 4 }, - { 10, 3, -4 }, { 10, 3, -4 }, - { 10, 4, -3 }, { 10, 4, -3 }, - { 10, 3, 4 }, { 10, 3, 4 }, - { 10, 4, 3 }, { 10, 4, 3 }, - { 10, -4, 3 }, { 10, -4, 3 }, - { 10, -4, -3 }, { 10, -4, -3 }, - { 11, 4, 4 }, - { 11, -4, 4 }, - { 11, -4, -4 }, - { 11, 4, -4 } -}; diff --git a/mplayer/libfaad2/codebook/hcb_7.h b/mplayer/libfaad2/codebook/hcb_7.h deleted file mode 100644 index fbe50a88..00000000 --- a/mplayer/libfaad2/codebook/hcb_7.h +++ /dev/null @@ -1,159 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: hcb_7.h,v 1.3 2003/09/09 18:12:01 menno Exp $ -**/ - -/* Binary search huffman table HCB_7 */ - - -static hcb_bin_pair hcb7[] = { - { /* 0 */ 0, { 1, 2 } }, - { /* 1 */ 1, { 0, 0 } }, - { /* 2 */ 0, { 1, 2 } }, - { /* 3 */ 0, { 2, 3 } }, - { /* 4 */ 0, { 3, 4 } }, - { /* 5 */ 1, { 1, 0 } }, - { /* 6 */ 1, { 0, 1 } }, - { /* 7 */ 0, { 2, 3 } }, - { /* 8 */ 0, { 3, 4 } }, - { /* 9 */ 1, { 1, 1 } }, - { /* 10 */ 0, { 3, 4 } }, - { /* 11 */ 0, { 4, 5 } }, - { /* 12 */ 0, { 5, 6 } }, - { /* 13 */ 0, { 6, 7 } }, - { /* 14 */ 0, { 7, 8 } }, - { /* 15 */ 0, { 8, 9 } }, - { /* 16 */ 0, { 9, 10 } }, - { /* 17 */ 0, { 10, 11 } }, - { /* 18 */ 0, { 11, 12 } }, - { /* 19 */ 1, { 2, 1 } }, - { /* 20 */ 1, { 1, 2 } }, - { /* 21 */ 1, { 2, 0 } }, - { /* 22 */ 1, { 0, 2 } }, - { /* 23 */ 0, { 8, 9 } }, - { /* 24 */ 0, { 9, 10 } }, - { /* 25 */ 0, { 10, 11 } }, - { /* 26 */ 0, { 11, 12 } }, - { /* 27 */ 0, { 12, 13 } }, - { /* 28 */ 0, { 13, 14 } }, - { /* 29 */ 0, { 14, 15 } }, - { /* 30 */ 0, { 15, 16 } }, - { /* 31 */ 1, { 3, 1 } }, - { /* 32 */ 1, { 1, 3 } }, - { /* 33 */ 1, { 2, 2 } }, - { /* 34 */ 1, { 3, 0 } }, - { /* 35 */ 1, { 0, 3 } }, - { /* 36 */ 0, { 11, 12 } }, - { /* 37 */ 0, { 12, 13 } }, - { /* 38 */ 0, { 13, 14 } }, - { /* 39 */ 0, { 14, 15 } }, - { /* 40 */ 0, { 15, 16 } }, - { /* 41 */ 0, { 16, 17 } }, - { /* 42 */ 0, { 17, 18 } }, - { /* 43 */ 0, { 18, 19 } }, - { /* 44 */ 0, { 19, 20 } }, - { /* 45 */ 0, { 20, 21 } }, - { /* 46 */ 0, { 21, 22 } }, - { /* 47 */ 1, { 2, 3 } }, - { /* 48 */ 1, { 3, 2 } }, - { /* 49 */ 1, { 1, 4 } }, - { /* 50 */ 1, { 4, 1 } }, - { /* 51 */ 1, { 1, 5 } }, - { /* 52 */ 1, { 5, 1 } }, - { /* 53 */ 1, { 3, 3 } }, - { /* 54 */ 1, { 2, 4 } }, - { /* 55 */ 1, { 0, 4 } }, - { /* 56 */ 1, { 4, 0 } }, - { /* 57 */ 0, { 12, 13 } }, - { /* 58 */ 0, { 13, 14 } }, - { /* 59 */ 0, { 14, 15 } }, - { /* 60 */ 0, { 15, 16 } }, - { /* 61 */ 0, { 16, 17 } }, - { /* 62 */ 0, { 17, 18 } }, - { /* 63 */ 0, { 18, 19 } }, - { /* 64 */ 0, { 19, 20 } }, - { /* 65 */ 0, { 20, 21 } }, - { /* 66 */ 0, { 21, 22 } }, - { /* 67 */ 0, { 22, 23 } }, - { /* 68 */ 0, { 23, 24 } }, - { /* 69 */ 1, { 4, 2 } }, - { /* 70 */ 1, { 2, 5 } }, - { /* 71 */ 1, { 5, 2 } }, - { /* 72 */ 1, { 0, 5 } }, - { /* 73 */ 1, { 6, 1 } }, - { /* 74 */ 1, { 5, 0 } }, - { /* 75 */ 1, { 1, 6 } }, - { /* 76 */ 1, { 4, 3 } }, - { /* 77 */ 1, { 3, 5 } }, - { /* 78 */ 1, { 3, 4 } }, - { /* 79 */ 1, { 5, 3 } }, - { /* 80 */ 1, { 2, 6 } }, - { /* 81 */ 1, { 6, 2 } }, - { /* 82 */ 1, { 1, 7 } }, - { /* 83 */ 0, { 10, 11 } }, - { /* 84 */ 0, { 11, 12 } }, - { /* 85 */ 0, { 12, 13 } }, - { /* 86 */ 0, { 13, 14 } }, - { /* 87 */ 0, { 14, 15 } }, - { /* 88 */ 0, { 15, 16 } }, - { /* 89 */ 0, { 16, 17 } }, - { /* 90 */ 0, { 17, 18 } }, - { /* 91 */ 0, { 18, 19 } }, - { /* 92 */ 0, { 19, 20 } }, - { /* 93 */ 1, { 3, 6 } }, - { /* 94 */ 1, { 0, 6 } }, - { /* 95 */ 1, { 6, 0 } }, - { /* 96 */ 1, { 4, 4 } }, - { /* 97 */ 1, { 7, 1 } }, - { /* 98 */ 1, { 4, 5 } }, - { /* 99 */ 1, { 7, 2 } }, - { /* 00 */ 1, { 5, 4 } }, - { /* 01 */ 1, { 6, 3 } }, - { /* 02 */ 1, { 2, 7 } }, - { /* 03 */ 1, { 7, 3 } }, - { /* 04 */ 1, { 6, 4 } }, - { /* 05 */ 1, { 5, 5 } }, - { /* 06 */ 1, { 4, 6 } }, - { /* 07 */ 1, { 3, 7 } }, - { /* 08 */ 0, { 5, 6 } }, - { /* 09 */ 0, { 6, 7 } }, - { /* 10 */ 0, { 7, 8 } }, - { /* 11 */ 0, { 8, 9 } }, - { /* 12 */ 0, { 9, 10 } }, - { /* 13 */ 1, { 7, 0 } }, - { /* 14 */ 1, { 0, 7 } }, - { /* 15 */ 1, { 6, 5 } }, - { /* 16 */ 1, { 5, 6 } }, - { /* 17 */ 1, { 7, 4 } }, - { /* 18 */ 1, { 4, 7 } }, - { /* 19 */ 1, { 5, 7 } }, - { /* 20 */ 1, { 7, 5 } }, - { /* 21 */ 0, { 2, 3 } }, - { /* 22 */ 0, { 3, 4 } }, - { /* 23 */ 1, { 7, 6 } }, - { /* 24 */ 1, { 6, 6 } }, - { /* 25 */ 1, { 6, 7 } }, - { /* 26 */ 1, { 7, 7 } } -}; diff --git a/mplayer/libfaad2/codebook/hcb_8.h b/mplayer/libfaad2/codebook/hcb_8.h deleted file mode 100644 index 3be59c7a..00000000 --- a/mplayer/libfaad2/codebook/hcb_8.h +++ /dev/null @@ -1,170 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: hcb_8.h,v 1.3 2003/09/09 18:12:01 menno Exp $ -**/ - -/* 2-step huffman table HCB_8 */ - - -/* 1st step: 5 bits - * 2^5 = 32 entries - * - * Used to find offset into 2nd step table and number of extra bits to get - */ -static hcb hcb8_1[] = { - /* 3 bit codeword */ - { /* 00000 */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - { /* */ 0, 0 }, - - /* 4 bit codewords */ - { /* 00100 */ 1, 0 }, - { /* */ 1, 0 }, - { /* 00110 */ 2, 0 }, - { /* */ 2, 0 }, - { /* 01000 */ 3, 0 }, - { /* */ 3, 0 }, - { /* 01010 */ 4, 0 }, - { /* */ 4, 0 }, - { /* 01100 */ 5, 0 }, - { /* */ 5, 0 }, - - /* 5 bit codewords */ - { /* 01110 */ 6, 0 }, - { /* 01111 */ 7, 0 }, - { /* 10000 */ 8, 0 }, - { /* 10001 */ 9, 0 }, - { /* 10010 */ 10, 0 }, - { /* 10011 */ 11, 0 }, - { /* 10100 */ 12, 0 }, - - /* 6 bit codewords */ - { /* 10101 */ 13, 1 }, - { /* 10110 */ 15, 1 }, - { /* 10111 */ 17, 1 }, - { /* 11000 */ 19, 1 }, - { /* 11001 */ 21, 1 }, - - /* 7 bit codewords */ - { /* 11010 */ 23, 2 }, - { /* 11011 */ 27, 2 }, - { /* 11100 */ 31, 2 }, - - /* 7/8 bit codewords */ - { /* 11101 */ 35, 3 }, - - /* 8 bit codewords */ - { /* 11110 */ 43, 3 }, - - /* 8/9/10 bit codewords */ - { /* 11111 */ 51, 5 } -}; - -/* 2nd step table - * - * Gives size of codeword and actual data (x,y,v,w) - */ -static hcb_2_pair hcb8_2[] = { - /* 3 bit codeword */ - { 3, 1, 1 }, - - /* 4 bit codewords */ - { 4, 2, 1 }, - { 4, 1, 0 }, - { 4, 1, 2 }, - { 4, 0, 1 }, - { 4, 2, 2 }, - - /* 5 bit codewords */ - { 5, 0, 0 }, - { 5, 2, 0 }, - { 5, 0, 2 }, - { 5, 3, 1 }, - { 5, 1, 3 }, - { 5, 3, 2 }, - { 5, 2, 3 }, - - /* 6 bit codewords */ - { 6, 3, 3 }, - { 6, 4, 1 }, - { 6, 1, 4 }, - { 6, 4, 2 }, - { 6, 2, 4 }, - { 6, 3, 0 }, - { 6, 0, 3 }, - { 6, 4, 3 }, - { 6, 3, 4 }, - { 6, 5, 2 }, - - /* 7 bit codewords */ - { 7, 5, 1 }, - { 7, 2, 5 }, - { 7, 1, 5 }, - { 7, 5, 3 }, - { 7, 3, 5 }, - { 7, 4, 4 }, - { 7, 5, 4 }, - { 7, 0, 4 }, - { 7, 4, 5 }, - { 7, 4, 0 }, - { 7, 2, 6 }, - { 7, 6, 2 }, - - /* 7/8 bit codewords */ - { 7, 6, 1 }, { 7, 6, 1 }, - { 7, 1, 6 }, { 7, 1, 6 }, - { 8, 3, 6 }, - { 8, 6, 3 }, - { 8, 5, 5 }, - { 8, 5, 0 }, - - /* 8 bit codewords */ - { 8, 6, 4 }, - { 8, 0, 5 }, - { 8, 4, 6 }, - { 8, 7, 1 }, - { 8, 7, 2 }, - { 8, 2, 7 }, - { 8, 6, 5 }, - { 8, 7, 3 }, - - /* 8/9/10 bit codewords */ - { 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 }, - { 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 }, - { 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 }, - { 9, 6, 6 }, { 9, 6, 6 }, - { 9, 7, 4 }, { 9, 7, 4 }, - { 9, 6, 0 }, { 9, 6, 0 }, - { 9, 4, 7 }, { 9, 4, 7 }, - { 9, 0, 6 }, { 9, 0, 6 }, - { 9, 7, 5 }, { 9, 7, 5 }, - { 9, 7, 6 }, { 9, 7, 6 }, - { 9, 6, 7 }, { 9, 6, 7 }, - { 10, 5, 7 }, - { 10, 7, 0 }, - { 10, 0, 7 }, - { 10, 7, 7 } -}; diff --git a/mplayer/libfaad2/codebook/hcb_9.h b/mplayer/libfaad2/codebook/hcb_9.h deleted file mode 100644 index 92bab150..00000000 --- a/mplayer/libfaad2/codebook/hcb_9.h +++ /dev/null @@ -1,369 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: hcb_9.h,v 1.3 2003/09/09 18:12:01 menno Exp $ -**/ - -/* Binary search huffman table HCB_9 */ - - -static hcb_bin_pair hcb9[] = { - { /* 0 */ 0, { 1, 2 } }, - { /* 1 */ 1, { 0, 0 } }, - { /* 2 */ 0, { 1, 2 } }, - { /* 3 */ 0, { 2, 3 } }, - { /* 4 */ 0, { 3, 4 } }, - { /* 5 */ 1, { 1, 0 } }, - { /* 6 */ 1, { 0, 1 } }, - { /* 7 */ 0, { 2, 3 } }, - { /* 8 */ 0, { 3, 4 } }, - { /* 9 */ 1, { 1, 1 } }, - { /* 10 */ 0, { 3, 4 } }, - { /* 11 */ 0, { 4, 5 } }, - { /* 12 */ 0, { 5, 6 } }, - { /* 13 */ 0, { 6, 7 } }, - { /* 14 */ 0, { 7, 8 } }, - { /* 15 */ 0, { 8, 9 } }, - { /* 16 */ 0, { 9, 10 } }, - { /* 17 */ 0, { 10, 11 } }, - { /* 18 */ 0, { 11, 12 } }, - { /* 19 */ 1, { 2, 1 } }, - { /* 20 */ 1, { 1, 2 } }, - { /* 21 */ 1, { 2, 0 } }, - { /* 22 */ 1, { 0, 2 } }, - { /* 23 */ 0, { 8, 9 } }, - { /* 24 */ 0, { 9, 10 } }, - { /* 25 */ 0, { 10, 11 } }, - { /* 26 */ 0, { 11, 12 } }, - { /* 27 */ 0, { 12, 13 } }, - { /* 28 */ 0, { 13, 14 } }, - { /* 29 */ 0, { 14, 15 } }, - { /* 30 */ 0, { 15, 16 } }, - { /* 31 */ 1, { 3, 1 } }, - { /* 32 */ 1, { 2, 2 } }, - { /* 33 */ 1, { 1, 3 } }, - { /* 34 */ 0, { 13, 14 } }, - { /* 35 */ 0, { 14, 15 } }, - { /* 36 */ 0, { 15, 16 } }, - { /* 37 */ 0, { 16, 17 } }, - { /* 38 */ 0, { 17, 18 } }, - { /* 39 */ 0, { 18, 19 } }, - { /* 40 */ 0, { 19, 20 } }, - { /* 41 */ 0, { 20, 21 } }, - { /* 42 */ 0, { 21, 22 } }, - { /* 43 */ 0, { 22, 23 } }, - { /* 44 */ 0, { 23, 24 } }, - { /* 45 */ 0, { 24, 25 } }, - { /* 46 */ 0, { 25, 26 } }, - { /* 47 */ 1, { 3, 0 } }, - { /* 48 */ 1, { 0, 3 } }, - { /* 49 */ 1, { 2, 3 } }, - { /* 50 */ 1, { 3, 2 } }, - { /* 51 */ 1, { 1, 4 } }, - { /* 52 */ 1, { 4, 1 } }, - { /* 53 */ 1, { 2, 4 } }, - { /* 54 */ 1, { 1, 5 } }, - { /* 55 */ 0, { 18, 19 } }, - { /* 56 */ 0, { 19, 20 } }, - { /* 57 */ 0, { 20, 21 } }, - { /* 58 */ 0, { 21, 22 } }, - { /* 59 */ 0, { 22, 23 } }, - { /* 60 */ 0, { 23, 24 } }, - { /* 61 */ 0, { 24, 25 } }, - { /* 62 */ 0, { 25, 26 } }, - { /* 63 */ 0, { 26, 27 } }, - { /* 64 */ 0, { 27, 28 } }, - { /* 65 */ 0, { 28, 29 } }, - { /* 66 */ 0, { 29, 30 } }, - { /* 67 */ 0, { 30, 31 } }, - { /* 68 */ 0, { 31, 32 } }, - { /* 69 */ 0, { 32, 33 } }, - { /* 70 */ 0, { 33, 34 } }, - { /* 71 */ 0, { 34, 35 } }, - { /* 72 */ 0, { 35, 36 } }, - { /* 73 */ 1, { 4, 2 } }, - { /* 74 */ 1, { 3, 3 } }, - { /* 75 */ 1, { 0, 4 } }, - { /* 76 */ 1, { 4, 0 } }, - { /* 77 */ 1, { 5, 1 } }, - { /* 78 */ 1, { 2, 5 } }, - { /* 79 */ 1, { 1, 6 } }, - { /* 80 */ 1, { 3, 4 } }, - { /* 81 */ 1, { 5, 2 } }, - { /* 82 */ 1, { 6, 1 } }, - { /* 83 */ 1, { 4, 3 } }, - { /* 84 */ 0, { 25, 26 } }, - { /* 85 */ 0, { 26, 27 } }, - { /* 86 */ 0, { 27, 28 } }, - { /* 87 */ 0, { 28, 29 } }, - { /* 88 */ 0, { 29, 30 } }, - { /* 89 */ 0, { 30, 31 } }, - { /* 90 */ 0, { 31, 32 } }, - { /* 91 */ 0, { 32, 33 } }, - { /* 92 */ 0, { 33, 34 } }, - { /* 93 */ 0, { 34, 35 } }, - { /* 94 */ 0, { 35, 36 } }, - { /* 95 */ 0, { 36, 37 } }, - { /* 96 */ 0, { 37, 38 } }, - { /* 97 */ 0, { 38, 39 } }, - { /* 98 */ 0, { 39, 40 } }, - { /* 99 */ 0, { 40, 41 } }, - { /* 00 */ 0, { 41, 42 } }, - { /* 01 */ 0, { 42, 43 } }, - { /* 02 */ 0, { 43, 44 } }, - { /* 03 */ 0, { 44, 45 } }, - { /* 04 */ 0, { 45, 46 } }, - { /* 05 */ 0, { 46, 47 } }, - { /* 06 */ 0, { 47, 48 } }, - { /* 07 */ 0, { 48, 49 } }, - { /* 08 */ 0, { 49, 50 } }, - { /* 09 */ 1, { 0, 5 } }, - { /* 10 */ 1, { 2, 6 } }, - { /* 11 */ 1, { 5, 0 } }, - { /* 12 */ 1, { 1, 7 } }, - { /* 13 */ 1, { 3, 5 } }, - { /* 14 */ 1, { 1, 8 } }, - { /* 15 */ 1, { 8, 1 } }, - { /* 16 */ 1, { 4, 4 } }, - { /* 17 */ 1, { 5, 3 } }, - { /* 18 */ 1, { 6, 2 } }, - { /* 19 */ 1, { 7, 1 } }, - { /* 20 */ 1, { 0, 6 } }, - { /* 21 */ 1, { 8, 2 } }, - { /* 22 */ 1, { 2, 8 } }, - { /* 23 */ 1, { 3, 6 } }, - { /* 24 */ 1, { 2, 7 } }, - { /* 25 */ 1, { 4, 5 } }, - { /* 26 */ 1, { 9, 1 } }, - { /* 27 */ 1, { 1, 9 } }, - { /* 28 */ 1, { 7, 2 } }, - { /* 29 */ 0, { 30, 31 } }, - { /* 30 */ 0, { 31, 32 } }, - { /* 31 */ 0, { 32, 33 } }, - { /* 32 */ 0, { 33, 34 } }, - { /* 33 */ 0, { 34, 35 } }, - { /* 34 */ 0, { 35, 36 } }, - { /* 35 */ 0, { 36, 37 } }, - { /* 36 */ 0, { 37, 38 } }, - { /* 37 */ 0, { 38, 39 } }, - { /* 38 */ 0, { 39, 40 } }, - { /* 39 */ 0, { 40, 41 } }, - { /* 40 */ 0, { 41, 42 } }, - { /* 41 */ 0, { 42, 43 } }, - { /* 42 */ 0, { 43, 44 } }, - { /* 43 */ 0, { 44, 45 } }, - { /* 44 */ 0, { 45, 46 } }, - { /* 45 */ 0, { 46, 47 } }, - { /* 46 */ 0, { 47, 48 } }, - { /* 47 */ 0, { 48, 49 } }, - { /* 48 */ 0, { 49, 50 } }, - { /* 49 */ 0, { 50, 51 } }, - { /* 50 */ 0, { 51, 52 } }, - { /* 51 */ 0, { 52, 53 } }, - { /* 52 */ 0, { 53, 54 } }, - { /* 53 */ 0, { 54, 55 } }, - { /* 54 */ 0, { 55, 56 } }, - { /* 55 */ 0, { 56, 57 } }, - { /* 56 */ 0, { 57, 58 } }, - { /* 57 */ 0, { 58, 59 } }, - { /* 58 */ 0, { 59, 60 } }, - { /* 59 */ 1, { 6, 0 } }, - { /* 60 */ 1, { 5, 4 } }, - { /* 61 */ 1, { 6, 3 } }, - { /* 62 */ 1, { 8, 3 } }, - { /* 63 */ 1, { 0, 7 } }, - { /* 64 */ 1, { 9, 2 } }, - { /* 65 */ 1, { 3, 8 } }, - { /* 66 */ 1, { 4, 6 } }, - { /* 67 */ 1, { 3, 7 } }, - { /* 68 */ 1, { 0, 8 } }, - { /* 69 */ 1, { 10, 1 } }, - { /* 70 */ 1, { 6, 4 } }, - { /* 71 */ 1, { 2, 9 } }, - { /* 72 */ 1, { 5, 5 } }, - { /* 73 */ 1, { 8, 0 } }, - { /* 74 */ 1, { 7, 0 } }, - { /* 75 */ 1, { 7, 3 } }, - { /* 76 */ 1, { 10, 2 } }, - { /* 77 */ 1, { 9, 3 } }, - { /* 78 */ 1, { 8, 4 } }, - { /* 79 */ 1, { 1, 10 } }, - { /* 80 */ 1, { 7, 4 } }, - { /* 81 */ 1, { 6, 5 } }, - { /* 82 */ 1, { 5, 6 } }, - { /* 83 */ 1, { 4, 8 } }, - { /* 84 */ 1, { 4, 7 } }, - { /* 85 */ 1, { 3, 9 } }, - { /* 86 */ 1, { 11, 1 } }, - { /* 87 */ 1, { 5, 8 } }, - { /* 88 */ 1, { 9, 0 } }, - { /* 89 */ 1, { 8, 5 } }, - { /* 90 */ 0, { 29, 30 } }, - { /* 91 */ 0, { 30, 31 } }, - { /* 92 */ 0, { 31, 32 } }, - { /* 93 */ 0, { 32, 33 } }, - { /* 94 */ 0, { 33, 34 } }, - { /* 95 */ 0, { 34, 35 } }, - { /* 96 */ 0, { 35, 36 } }, - { /* 97 */ 0, { 36, 37 } }, - { /* 98 */ 0, { 37, 38 } }, - { /* 99 */ 0, { 38, 39 } }, - { /* 00 */ 0, { 39, 40 } }, - { /* 01 */ 0, { 40, 41 } }, - { /* 02 */ 0, { 41, 42 } }, - { /* 03 */ 0, { 42, 43 } }, - { /* 04 */ 0, { 43, 44 } }, - { /* 05 */ 0, { 44, 45 } }, - { /* 06 */ 0, { 45, 46 } }, - { /* 07 */ 0, { 46, 47 } }, - { /* 08 */ 0, { 47, 48 } }, - { /* 09 */ 0, { 48, 49 } }, - { /* 10 */ 0, { 49, 50 } }, - { /* 11 */ 0, { 50, 51 } }, - { /* 12 */ 0, { 51, 52 } }, - { /* 13 */ 0, { 52, 53 } }, - { /* 14 */ 0, { 53, 54 } }, - { /* 15 */ 0, { 54, 55 } }, - { /* 16 */ 0, { 55, 56 } }, - { /* 17 */ 0, { 56, 57 } }, - { /* 18 */ 0, { 57, 58 } }, - { /* 19 */ 1, { 10, 3 } }, - { /* 20 */ 1, { 2, 10 } }, - { /* 21 */ 1, { 0, 9 } }, - { /* 22 */ 1, { 11, 2 } }, - { /* 23 */ 1, { 9, 4 } }, - { /* 24 */ 1, { 6, 6 } }, - { /* 25 */ 1, { 12, 1 } }, - { /* 26 */ 1, { 4, 9 } }, - { /* 27 */ 1, { 8, 6 } }, - { /* 28 */ 1, { 1, 11 } }, - { /* 29 */ 1, { 9, 5 } }, - { /* 30 */ 1, { 10, 4 } }, - { /* 31 */ 1, { 5, 7 } }, - { /* 32 */ 1, { 7, 5 } }, - { /* 33 */ 1, { 2, 11 } }, - { /* 34 */ 1, { 1, 12 } }, - { /* 35 */ 1, { 12, 2 } }, - { /* 36 */ 1, { 11, 3 } }, - { /* 37 */ 1, { 3, 10 } }, - { /* 38 */ 1, { 5, 9 } }, - { /* 39 */ 1, { 6, 7 } }, - { /* 40 */ 1, { 8, 7 } }, - { /* 41 */ 1, { 11, 4 } }, - { /* 42 */ 1, { 0, 10 } }, - { /* 43 */ 1, { 7, 6 } }, - { /* 44 */ 1, { 12, 3 } }, - { /* 45 */ 1, { 10, 0 } }, - { /* 46 */ 1, { 10, 5 } }, - { /* 47 */ 1, { 4, 10 } }, - { /* 48 */ 1, { 6, 8 } }, - { /* 49 */ 1, { 2, 12 } }, - { /* 50 */ 1, { 9, 6 } }, - { /* 51 */ 1, { 9, 7 } }, - { /* 52 */ 1, { 4, 11 } }, - { /* 53 */ 1, { 11, 0 } }, - { /* 54 */ 1, { 6, 9 } }, - { /* 55 */ 1, { 3, 11 } }, - { /* 56 */ 1, { 5, 10 } }, - { /* 57 */ 0, { 20, 21 } }, - { /* 58 */ 0, { 21, 22 } }, - { /* 59 */ 0, { 22, 23 } }, - { /* 60 */ 0, { 23, 24 } }, - { /* 61 */ 0, { 24, 25 } }, - { /* 62 */ 0, { 25, 26 } }, - { /* 63 */ 0, { 26, 27 } }, - { /* 64 */ 0, { 27, 28 } }, - { /* 65 */ 0, { 28, 29 } }, - { /* 66 */ 0, { 29, 30 } }, - { /* 67 */ 0, { 30, 31 } }, - { /* 68 */ 0, { 31, 32 } }, - { /* 69 */ 0, { 32, 33 } }, - { /* 70 */ 0, { 33, 34 } }, - { /* 71 */ 0, { 34, 35 } }, - { /* 72 */ 0, { 35, 36 } }, - { /* 73 */ 0, { 36, 37 } }, - { /* 74 */ 0, { 37, 38 } }, - { /* 75 */ 0, { 38, 39 } }, - { /* 76 */ 0, { 39, 40 } }, - { /* 77 */ 1, { 8, 8 } }, - { /* 78 */ 1, { 7, 8 } }, - { /* 79 */ 1, { 12, 5 } }, - { /* 80 */ 1, { 3, 12 } }, - { /* 81 */ 1, { 11, 5 } }, - { /* 82 */ 1, { 7, 7 } }, - { /* 83 */ 1, { 12, 4 } }, - { /* 84 */ 1, { 11, 6 } }, - { /* 85 */ 1, { 10, 6 } }, - { /* 86 */ 1, { 4, 12 } }, - { /* 87 */ 1, { 7, 9 } }, - { /* 88 */ 1, { 5, 11 } }, - { /* 89 */ 1, { 0, 11 } }, - { /* 90 */ 1, { 12, 6 } }, - { /* 91 */ 1, { 6, 10 } }, - { /* 92 */ 1, { 12, 0 } }, - { /* 93 */ 1, { 10, 7 } }, - { /* 94 */ 1, { 5, 12 } }, - { /* 95 */ 1, { 7, 10 } }, - { /* 96 */ 1, { 9, 8 } }, - { /* 97 */ 1, { 0, 12 } }, - { /* 98 */ 1, { 11, 7 } }, - { /* 99 */ 1, { 8, 9 } }, - { /* 00 */ 1, { 9, 9 } }, - { /* 01 */ 1, { 10, 8 } }, - { /* 02 */ 1, { 7, 11 } }, - { /* 03 */ 1, { 12, 7 } }, - { /* 04 */ 1, { 6, 11 } }, - { /* 05 */ 1, { 8, 11 } }, - { /* 06 */ 1, { 11, 8 } }, - { /* 07 */ 1, { 7, 12 } }, - { /* 08 */ 1, { 6, 12 } }, - { /* 09 */ 0, { 8, 9 } }, - { /* 10 */ 0, { 9, 10 } }, - { /* 11 */ 0, { 10, 11 } }, - { /* 12 */ 0, { 11, 12 } }, - { /* 13 */ 0, { 12, 13 } }, - { /* 14 */ 0, { 13, 14 } }, - { /* 15 */ 0, { 14, 15 } }, - { /* 16 */ 0, { 15, 16 } }, - { /* 17 */ 1, { 8, 10 } }, - { /* 18 */ 1, { 10, 9 } }, - { /* 19 */ 1, { 8, 12 } }, - { /* 20 */ 1, { 9, 10 } }, - { /* 21 */ 1, { 9, 11 } }, - { /* 22 */ 1, { 9, 12 } }, - { /* 23 */ 1, { 10, 11 } }, - { /* 24 */ 1, { 12, 9 } }, - { /* 25 */ 1, { 10, 10 } }, - { /* 26 */ 1, { 11, 9 } }, - { /* 27 */ 1, { 12, 8 } }, - { /* 28 */ 1, { 11, 10 } }, - { /* 29 */ 1, { 12, 10 } }, - { /* 30 */ 1, { 12, 11 } }, - { /* 31 */ 0, { 2, 3 } }, - { /* 32 */ 0, { 3, 4 } }, - { /* 33 */ 1, { 10, 12 } }, - { /* 34 */ 1, { 11, 11 } }, - { /* 35 */ 1, { 11, 12 } }, - { /* 36 */ 1, { 12, 12 } } -}; diff --git a/mplayer/libfaad2/codebook/hcb_sf.h b/mplayer/libfaad2/codebook/hcb_sf.h deleted file mode 100644 index 978342ba..00000000 --- a/mplayer/libfaad2/codebook/hcb_sf.h +++ /dev/null @@ -1,273 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: hcb_sf.h,v 1.5 2004/02/04 19:55:02 menno Exp $ -**/ - -/* Binary search huffman table HCB_SF */ - - -static uint8_t hcb_sf[][2] = { - { /* 0 */ 1, 2 }, - { /* 1 */ 60, 0 }, - { /* 2 */ 1, 2 }, - { /* 3 */ 2, 3 }, - { /* 4 */ 3, 4 }, - { /* 5 */ 59, 0 }, - { /* 6 */ 3, 4 }, - { /* 7 */ 4, 5 }, - { /* 8 */ 5, 6 }, - { /* 9 */ 61, 0 }, - { /* 10 */ 58, 0 }, - { /* 11 */ 62, 0 }, - { /* 12 */ 3, 4 }, - { /* 13 */ 4, 5 }, - { /* 14 */ 5, 6 }, - { /* 15 */ 57, 0 }, - { /* 16 */ 63, 0 }, - { /* 17 */ 4, 5 }, - { /* 18 */ 5, 6 }, - { /* 19 */ 6, 7 }, - { /* 20 */ 7, 8 }, - { /* 21 */ 56, 0 }, - { /* 22 */ 64, 0 }, - { /* 23 */ 55, 0 }, - { /* 24 */ 65, 0 }, - { /* 25 */ 4, 5 }, - { /* 26 */ 5, 6 }, - { /* 27 */ 6, 7 }, - { /* 28 */ 7, 8 }, - { /* 29 */ 66, 0 }, - { /* 30 */ 54, 0 }, - { /* 31 */ 67, 0 }, - { /* 32 */ 5, 6 }, - { /* 33 */ 6, 7 }, - { /* 34 */ 7, 8 }, - { /* 35 */ 8, 9 }, - { /* 36 */ 9, 10 }, - { /* 37 */ 53, 0 }, - { /* 38 */ 68, 0 }, - { /* 39 */ 52, 0 }, - { /* 40 */ 69, 0 }, - { /* 41 */ 51, 0 }, - { /* 42 */ 5, 6 }, - { /* 43 */ 6, 7 }, - { /* 44 */ 7, 8 }, - { /* 45 */ 8, 9 }, - { /* 46 */ 9, 10 }, - { /* 47 */ 70, 0 }, - { /* 48 */ 50, 0 }, - { /* 49 */ 49, 0 }, - { /* 50 */ 71, 0 }, - { /* 51 */ 6, 7 }, - { /* 52 */ 7, 8 }, - { /* 53 */ 8, 9 }, - { /* 54 */ 9, 10 }, - { /* 55 */ 10, 11 }, - { /* 56 */ 11, 12 }, - { /* 57 */ 72, 0 }, - { /* 58 */ 48, 0 }, - { /* 59 */ 73, 0 }, - { /* 60 */ 47, 0 }, - { /* 61 */ 74, 0 }, - { /* 62 */ 46, 0 }, - { /* 63 */ 6, 7 }, - { /* 64 */ 7, 8 }, - { /* 65 */ 8, 9 }, - { /* 66 */ 9, 10 }, - { /* 67 */ 10, 11 }, - { /* 68 */ 11, 12 }, - { /* 69 */ 76, 0 }, - { /* 70 */ 75, 0 }, - { /* 71 */ 77, 0 }, - { /* 72 */ 78, 0 }, - { /* 73 */ 45, 0 }, - { /* 74 */ 43, 0 }, - { /* 75 */ 6, 7 }, - { /* 76 */ 7, 8 }, - { /* 77 */ 8, 9 }, - { /* 78 */ 9, 10 }, - { /* 79 */ 10, 11 }, - { /* 80 */ 11, 12 }, - { /* 81 */ 44, 0 }, - { /* 82 */ 79, 0 }, - { /* 83 */ 42, 0 }, - { /* 84 */ 41, 0 }, - { /* 85 */ 80, 0 }, - { /* 86 */ 40, 0 }, - { /* 87 */ 6, 7 }, - { /* 88 */ 7, 8 }, - { /* 89 */ 8, 9 }, - { /* 90 */ 9, 10 }, - { /* 91 */ 10, 11 }, - { /* 92 */ 11, 12 }, - { /* 93 */ 81, 0 }, - { /* 94 */ 39, 0 }, - { /* 95 */ 82, 0 }, - { /* 96 */ 38, 0 }, - { /* 97 */ 83, 0 }, - { /* 98 */ 7, 8 }, - { /* 99 */ 8, 9 }, - { /* 00 */ 9, 10 }, - { /* 01 */ 10, 11 }, - { /* 02 */ 11, 12 }, - { /* 03 */ 12, 13 }, - { /* 04 */ 13, 14 }, - { /* 05 */ 37, 0 }, - { /* 06 */ 35, 0 }, - { /* 07 */ 85, 0 }, - { /* 08 */ 33, 0 }, - { /* 09 */ 36, 0 }, - { /* 10 */ 34, 0 }, - { /* 11 */ 84, 0 }, - { /* 12 */ 32, 0 }, - { /* 13 */ 6, 7 }, - { /* 14 */ 7, 8 }, - { /* 15 */ 8, 9 }, - { /* 16 */ 9, 10 }, - { /* 17 */ 10, 11 }, - { /* 18 */ 11, 12 }, - { /* 19 */ 87, 0 }, - { /* 20 */ 89, 0 }, - { /* 21 */ 30, 0 }, - { /* 22 */ 31, 0 }, - { /* 23 */ 8, 9 }, - { /* 24 */ 9, 10 }, - { /* 25 */ 10, 11 }, - { /* 26 */ 11, 12 }, - { /* 27 */ 12, 13 }, - { /* 28 */ 13, 14 }, - { /* 29 */ 14, 15 }, - { /* 30 */ 15, 16 }, - { /* 31 */ 86, 0 }, - { /* 32 */ 29, 0 }, - { /* 33 */ 26, 0 }, - { /* 34 */ 27, 0 }, - { /* 35 */ 28, 0 }, - { /* 36 */ 24, 0 }, - { /* 37 */ 88, 0 }, - { /* 38 */ 9, 10 }, - { /* 39 */ 10, 11 }, - { /* 40 */ 11, 12 }, - { /* 41 */ 12, 13 }, - { /* 42 */ 13, 14 }, - { /* 43 */ 14, 15 }, - { /* 44 */ 15, 16 }, - { /* 45 */ 16, 17 }, - { /* 46 */ 17, 18 }, - { /* 47 */ 25, 0 }, - { /* 48 */ 22, 0 }, - { /* 49 */ 23, 0 }, - { /* 50 */ 15, 16 }, - { /* 51 */ 16, 17 }, - { /* 52 */ 17, 18 }, - { /* 53 */ 18, 19 }, - { /* 54 */ 19, 20 }, - { /* 55 */ 20, 21 }, - { /* 56 */ 21, 22 }, - { /* 57 */ 22, 23 }, - { /* 58 */ 23, 24 }, - { /* 59 */ 24, 25 }, - { /* 60 */ 25, 26 }, - { /* 61 */ 26, 27 }, - { /* 62 */ 27, 28 }, - { /* 63 */ 28, 29 }, - { /* 64 */ 29, 30 }, - { /* 65 */ 90, 0 }, - { /* 66 */ 21, 0 }, - { /* 67 */ 19, 0 }, - { /* 68 */ 3, 0 }, - { /* 69 */ 1, 0 }, - { /* 70 */ 2, 0 }, - { /* 71 */ 0, 0 }, - { /* 72 */ 23, 24 }, - { /* 73 */ 24, 25 }, - { /* 74 */ 25, 26 }, - { /* 75 */ 26, 27 }, - { /* 76 */ 27, 28 }, - { /* 77 */ 28, 29 }, - { /* 78 */ 29, 30 }, - { /* 79 */ 30, 31 }, - { /* 80 */ 31, 32 }, - { /* 81 */ 32, 33 }, - { /* 82 */ 33, 34 }, - { /* 83 */ 34, 35 }, - { /* 84 */ 35, 36 }, - { /* 85 */ 36, 37 }, - { /* 86 */ 37, 38 }, - { /* 87 */ 38, 39 }, - { /* 88 */ 39, 40 }, - { /* 89 */ 40, 41 }, - { /* 90 */ 41, 42 }, - { /* 91 */ 42, 43 }, - { /* 92 */ 43, 44 }, - { /* 93 */ 44, 45 }, - { /* 94 */ 45, 46 }, - { /* 95 */ 98, 0 }, - { /* 96 */ 99, 0 }, - { /* 97 */ 100, 0 }, - { /* 98 */ 101, 0 }, - { /* 99 */ 102, 0 }, - { /* 00 */ 117, 0 }, - { /* 01 */ 97, 0 }, - { /* 02 */ 91, 0 }, - { /* 03 */ 92, 0 }, - { /* 04 */ 93, 0 }, - { /* 05 */ 94, 0 }, - { /* 06 */ 95, 0 }, - { /* 07 */ 96, 0 }, - { /* 08 */ 104, 0 }, - { /* 09 */ 111, 0 }, - { /* 10 */ 112, 0 }, - { /* 11 */ 113, 0 }, - { /* 12 */ 114, 0 }, - { /* 13 */ 115, 0 }, - { /* 14 */ 116, 0 }, - { /* 15 */ 110, 0 }, - { /* 16 */ 105, 0 }, - { /* 17 */ 106, 0 }, - { /* 18 */ 107, 0 }, - { /* 19 */ 108, 0 }, - { /* 20 */ 109, 0 }, - { /* 21 */ 118, 0 }, - { /* 22 */ 6, 0 }, - { /* 23 */ 8, 0 }, - { /* 24 */ 9, 0 }, - { /* 25 */ 10, 0 }, - { /* 26 */ 5, 0 }, - { /* 27 */ 103, 0 }, - { /* 28 */ 120, 0 }, - { /* 29 */ 119, 0 }, - { /* 30 */ 4, 0 }, - { /* 31 */ 7, 0 }, - { /* 32 */ 15, 0 }, - { /* 33 */ 16, 0 }, - { /* 34 */ 18, 0 }, - { /* 35 */ 20, 0 }, - { /* 36 */ 17, 0 }, - { /* 37 */ 11, 0 }, - { /* 38 */ 12, 0 }, - { /* 39 */ 14, 0 }, - { /* 40 */ 13, 0 } -}; diff --git a/mplayer/libfaad2/common.c b/mplayer/libfaad2/common.c deleted file mode 100644 index a53d9694..00000000 --- a/mplayer/libfaad2/common.c +++ /dev/null @@ -1,519 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: common.c,v 1.22 2004/09/08 09:43:11 gcp Exp $ -**/ - -/* just some common functions that could be used anywhere */ - -#include "common.h" -#include "structs.h" - -#include -#include "syntax.h" - - -/* Returns the sample rate index based on the samplerate */ -uint8_t get_sr_index(const uint32_t samplerate) -{ - if (92017 <= samplerate) return 0; - if (75132 <= samplerate) return 1; - if (55426 <= samplerate) return 2; - if (46009 <= samplerate) return 3; - if (37566 <= samplerate) return 4; - if (27713 <= samplerate) return 5; - if (23004 <= samplerate) return 6; - if (18783 <= samplerate) return 7; - if (13856 <= samplerate) return 8; - if (11502 <= samplerate) return 9; - if (9391 <= samplerate) return 10; - if (16428320 <= samplerate) return 11; - - return 11; -} - -/* Returns the sample rate based on the sample rate index */ -uint32_t get_sample_rate(const uint8_t sr_index) -{ - static const uint32_t sample_rates[] = - { - 96000, 88200, 64000, 48000, 44100, 32000, - 24000, 22050, 16000, 12000, 11025, 8000 - }; - - if (sr_index < 12) - return sample_rates[sr_index]; - - return 0; -} - -uint8_t max_pred_sfb(const uint8_t sr_index) -{ - static const uint8_t pred_sfb_max[] = - { - 33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34 - }; - - - if (sr_index < 12) - return pred_sfb_max[sr_index]; - - return 0; -} - -uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type, - const uint8_t is_short) -{ - /* entry for each sampling rate - * 1 Main/LC long window - * 2 Main/LC short window - * 3 SSR long window - * 4 SSR short window - */ - static const uint8_t tns_sbf_max[][4] = - { - {31, 9, 28, 7}, /* 96000 */ - {31, 9, 28, 7}, /* 88200 */ - {34, 10, 27, 7}, /* 64000 */ - {40, 14, 26, 6}, /* 48000 */ - {42, 14, 26, 6}, /* 44100 */ - {51, 14, 26, 6}, /* 32000 */ - {46, 14, 29, 7}, /* 24000 */ - {46, 14, 29, 7}, /* 22050 */ - {42, 14, 23, 8}, /* 16000 */ - {42, 14, 23, 8}, /* 12000 */ - {42, 14, 23, 8}, /* 11025 */ - {39, 14, 19, 7}, /* 8000 */ - {39, 14, 19, 7}, /* 7350 */ - {0,0,0,0}, - {0,0,0,0}, - {0,0,0,0} - }; - uint8_t i = 0; - - if (is_short) i++; - if (object_type == SSR) i += 2; - - return tns_sbf_max[sr_index][i]; -} - -/* Returns 0 if an object type is decodable, otherwise returns -1 */ -int8_t can_decode_ot(const uint8_t object_type) -{ - switch (object_type) - { - case LC: - return 0; - case MAIN: -#ifdef MAIN_DEC - return 0; -#else - return -1; -#endif - case SSR: -#ifdef SSR_DEC - return 0; -#else - return -1; -#endif - case LTP: -#ifdef LTP_DEC - return 0; -#else - return -1; -#endif - - /* ER object types */ -#ifdef ERROR_RESILIENCE - case ER_LC: -#ifdef DRM - case DRM_ER_LC: -#endif - return 0; - case ER_LTP: -#ifdef LTP_DEC - return 0; -#else - return -1; -#endif - case LD: -#ifdef LD_DEC - return 0; -#else - return -1; -#endif -#endif - } - - return -1; -} - -void *faad_malloc(size_t size) -{ -#if 0 // defined(_WIN32) && !defined(_WIN32_WCE) - return _aligned_malloc(size, 16); -#else // #ifdef 0 - return malloc(size); -#endif // #ifdef 0 -} - -/* common free function */ -void faad_free(void *b) -{ -#if 0 // defined(_WIN32) && !defined(_WIN32_WCE) - _aligned_free(b); -#else - free(b); -} -#endif - -static const uint8_t Parity [256] = { // parity - 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, - 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, - 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, - 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, - 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, - 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, - 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, - 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0 -}; - -static uint32_t __r1 = 1; -static uint32_t __r2 = 1; - - -/* - * This is a simple random number generator with good quality for audio purposes. - * It consists of two polycounters with opposite rotation direction and different - * periods. The periods are coprime, so the total period is the product of both. - * - * ------------------------------------------------------------------------------------------------- - * +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| - * | ------------------------------------------------------------------------------------------------- - * | | | | | | | - * | +--+--+--+-XOR-+--------+ - * | | - * +--------------------------------------------------------------------------------------+ - * - * ------------------------------------------------------------------------------------------------- - * |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+ - * ------------------------------------------------------------------------------------------------- | - * | | | | | - * +--+----XOR----+--+ | - * | | - * +----------------------------------------------------------------------------------------+ - * - * - * The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481, - * which gives a period of 18.410.713.077.675.721.215. The result is the - * XORed values of both generators. - */ -uint32_t random_int(void) -{ - uint32_t t1, t2, t3, t4; - - t3 = t1 = __r1; t4 = t2 = __r2; // Parity calculation is done via table lookup, this is also available - t1 &= 0xF5; t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable - t1 = Parity [t1]; t2 &= 0x63; // jumps and slow rotate through the carry flag operations. - t1 <<= 31; t2 = Parity [t2]; - - return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 ); -} - -uint32_t ones32(uint32_t x) -{ - x -= ((x >> 1) & 0x55555555); - x = (((x >> 2) & 0x33333333) + (x & 0x33333333)); - x = (((x >> 4) + x) & 0x0f0f0f0f); - x += (x >> 8); - x += (x >> 16); - - return (x & 0x0000003f); -} - -uint32_t floor_log2(uint32_t x) -{ -#if 1 - x |= (x >> 1); - x |= (x >> 2); - x |= (x >> 4); - x |= (x >> 8); - x |= (x >> 16); - - return (ones32(x) - 1); -#else - uint32_t count = 0; - - while (x >>= 1) - count++; - - return count; -#endif -} - -/* returns position of first bit that is not 0 from msb, - * starting count at lsb */ -uint32_t wl_min_lzc(uint32_t x) -{ -#if 1 - x |= (x >> 1); - x |= (x >> 2); - x |= (x >> 4); - x |= (x >> 8); - x |= (x >> 16); - - return (ones32(x)); -#else - uint32_t count = 0; - - while (x >>= 1) - count++; - - return (count + 1); -#endif -} - -#ifdef FIXED_POINT - -#define TABLE_BITS 6 -/* just take the maximum number of bits for interpolation */ -#define INTERP_BITS (REAL_BITS-TABLE_BITS) - -static const real_t pow2_tab[] = { - REAL_CONST(1.000000000000000), REAL_CONST(1.010889286051701), REAL_CONST(1.021897148654117), - REAL_CONST(1.033024879021228), REAL_CONST(1.044273782427414), REAL_CONST(1.055645178360557), - REAL_CONST(1.067140400676824), REAL_CONST(1.078760797757120), REAL_CONST(1.090507732665258), - REAL_CONST(1.102382583307841), REAL_CONST(1.114386742595892), REAL_CONST(1.126521618608242), - REAL_CONST(1.138788634756692), REAL_CONST(1.151189229952983), REAL_CONST(1.163724858777578), - REAL_CONST(1.176396991650281), REAL_CONST(1.189207115002721), REAL_CONST(1.202156731452703), - REAL_CONST(1.215247359980469), REAL_CONST(1.228480536106870), REAL_CONST(1.241857812073484), - REAL_CONST(1.255380757024691), REAL_CONST(1.269050957191733), REAL_CONST(1.282870016078778), - REAL_CONST(1.296839554651010), REAL_CONST(1.310961211524764), REAL_CONST(1.325236643159741), - REAL_CONST(1.339667524053303), REAL_CONST(1.354255546936893), REAL_CONST(1.369002422974591), - REAL_CONST(1.383909881963832), REAL_CONST(1.398979672538311), REAL_CONST(1.414213562373095), - REAL_CONST(1.429613338391970), REAL_CONST(1.445180806977047), REAL_CONST(1.460917794180647), - REAL_CONST(1.476826145939499), REAL_CONST(1.492907728291265), REAL_CONST(1.509164427593423), - REAL_CONST(1.525598150744538), REAL_CONST(1.542210825407941), REAL_CONST(1.559004400237837), - REAL_CONST(1.575980845107887), REAL_CONST(1.593142151342267), REAL_CONST(1.610490331949254), - REAL_CONST(1.628027421857348), REAL_CONST(1.645755478153965), REAL_CONST(1.663676580326736), - REAL_CONST(1.681792830507429), REAL_CONST(1.700106353718524), REAL_CONST(1.718619298122478), - REAL_CONST(1.737333835273706), REAL_CONST(1.756252160373300), REAL_CONST(1.775376492526521), - REAL_CONST(1.794709075003107), REAL_CONST(1.814252175500399), REAL_CONST(1.834008086409342), - REAL_CONST(1.853979125083386), REAL_CONST(1.874167634110300), REAL_CONST(1.894575981586966), - REAL_CONST(1.915206561397147), REAL_CONST(1.936061793492294), REAL_CONST(1.957144124175400), - REAL_CONST(1.978456026387951), REAL_CONST(2.000000000000000) -}; - -static const real_t log2_tab[] = { - REAL_CONST(0.000000000000000), REAL_CONST(0.022367813028455), REAL_CONST(0.044394119358453), - REAL_CONST(0.066089190457772), REAL_CONST(0.087462841250339), REAL_CONST(0.108524456778169), - REAL_CONST(0.129283016944966), REAL_CONST(0.149747119504682), REAL_CONST(0.169925001442312), - REAL_CONST(0.189824558880017), REAL_CONST(0.209453365628950), REAL_CONST(0.228818690495881), - REAL_CONST(0.247927513443585), REAL_CONST(0.266786540694901), REAL_CONST(0.285402218862248), - REAL_CONST(0.303780748177103), REAL_CONST(0.321928094887362), REAL_CONST(0.339850002884625), - REAL_CONST(0.357552004618084), REAL_CONST(0.375039431346925), REAL_CONST(0.392317422778760), - REAL_CONST(0.409390936137702), REAL_CONST(0.426264754702098), REAL_CONST(0.442943495848728), - REAL_CONST(0.459431618637297), REAL_CONST(0.475733430966398), REAL_CONST(0.491853096329675), - REAL_CONST(0.507794640198696), REAL_CONST(0.523561956057013), REAL_CONST(0.539158811108031), - REAL_CONST(0.554588851677637), REAL_CONST(0.569855608330948), REAL_CONST(0.584962500721156), - REAL_CONST(0.599912842187128), REAL_CONST(0.614709844115208), REAL_CONST(0.629356620079610), - REAL_CONST(0.643856189774725), REAL_CONST(0.658211482751795), REAL_CONST(0.672425341971496), - REAL_CONST(0.686500527183218), REAL_CONST(0.700439718141092), REAL_CONST(0.714245517666123), - REAL_CONST(0.727920454563199), REAL_CONST(0.741466986401147), REAL_CONST(0.754887502163469), - REAL_CONST(0.768184324776926), REAL_CONST(0.781359713524660), REAL_CONST(0.794415866350106), - REAL_CONST(0.807354922057604), REAL_CONST(0.820178962415188), REAL_CONST(0.832890014164742), - REAL_CONST(0.845490050944375), REAL_CONST(0.857980995127572), REAL_CONST(0.870364719583405), - REAL_CONST(0.882643049361841), REAL_CONST(0.894817763307943), REAL_CONST(0.906890595608519), - REAL_CONST(0.918863237274595), REAL_CONST(0.930737337562886), REAL_CONST(0.942514505339240), - REAL_CONST(0.954196310386875), REAL_CONST(0.965784284662087), REAL_CONST(0.977279923499917), - REAL_CONST(0.988684686772166), REAL_CONST(1.000000000000000) -}; - -real_t pow2_fix(real_t val) -{ - uint32_t x1, x2; - uint32_t errcorr; - uint32_t index_frac; - real_t retval; - int32_t whole = (val >> REAL_BITS); - - /* rest = [0..1] */ - int32_t rest = val - (whole << REAL_BITS); - - /* index into pow2_tab */ - int32_t index = rest >> (REAL_BITS-TABLE_BITS); - - - if (val == 0) - return (1<> (REAL_BITS-TABLE_BITS-INTERP_BITS); - index_frac = index_frac & ((1< 0) - { - retval = 1 << whole; - } else { - retval = REAL_CONST(1) >> -whole; - } - - x1 = pow2_tab[index & ((1<> INTERP_BITS; - - if (whole > 0) - { - retval = retval * (errcorr + x1); - } else { - retval = MUL_R(retval, (errcorr + x1)); - } - - return retval; -} - -int32_t pow2_int(real_t val) -{ - uint32_t x1, x2; - uint32_t errcorr; - uint32_t index_frac; - real_t retval; - int32_t whole = (val >> REAL_BITS); - - /* rest = [0..1] */ - int32_t rest = val - (whole << REAL_BITS); - - /* index into pow2_tab */ - int32_t index = rest >> (REAL_BITS-TABLE_BITS); - - - if (val == 0) - return 1; - - /* leave INTERP_BITS bits */ - index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS); - index_frac = index_frac & ((1< 0) - retval = 1 << whole; - else - retval = 0; - - x1 = pow2_tab[index & ((1<> INTERP_BITS; - - retval = MUL_R(retval, (errcorr + x1)); - - return retval; -} - -/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */ -int32_t log2_int(uint32_t val) -{ - uint32_t frac; - uint32_t whole = (val); - int32_t exp = 0; - uint32_t index; - uint32_t index_frac; - uint32_t x1, x2; - uint32_t errcorr; - - /* error */ - if (val == 0) - return -10000; - - exp = floor_log2(val); - exp -= REAL_BITS; - - /* frac = [1..2] */ - if (exp >= 0) - frac = val >> exp; - else - frac = val << -exp; - - /* index in the log2 table */ - index = frac >> (REAL_BITS-TABLE_BITS); - - /* leftover part for linear interpolation */ - index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1); - - /* leave INTERP_BITS bits */ - index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS); - - x1 = log2_tab[index & ((1<> INTERP_BITS; - - return ((exp+REAL_BITS) << REAL_BITS) + errcorr + x1; -} - -/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */ -real_t log2_fix(uint32_t val) -{ - uint32_t frac; - uint32_t whole = (val >> REAL_BITS); - int8_t exp = 0; - uint32_t index; - uint32_t index_frac; - uint32_t x1, x2; - uint32_t errcorr; - - /* error */ - if (val == 0) - return -100000; - - exp = floor_log2(val); - exp -= REAL_BITS; - - /* frac = [1..2] */ - if (exp >= 0) - frac = val >> exp; - else - frac = val << -exp; - - /* index in the log2 table */ - index = frac >> (REAL_BITS-TABLE_BITS); - - /* leftover part for linear interpolation */ - index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1); - - /* leave INTERP_BITS bits */ - index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS); - - x1 = log2_tab[index & ((1<> INTERP_BITS; - - return (exp << REAL_BITS) + errcorr + x1; -} -#endif diff --git a/mplayer/libfaad2/common.h b/mplayer/libfaad2/common.h deleted file mode 100644 index ad24f20a..00000000 --- a/mplayer/libfaad2/common.h +++ /dev/null @@ -1,441 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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 by Arpad Gereffy on 2003/08/30 -** $Id: common.h 32391 2010-09-27 18:37:43Z reimar $ -** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ -** local_changes.diff contains the exact changes to this file. -**/ - -#ifndef __COMMON_H__ -#define __COMMON_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif - -/* Allow build on Cygwin*/ -#if defined(__CYGWIN__) -#define __STRICT_ANSI__ -#endif - -#define INLINE __inline -#if 0 //defined(_WIN32) && !defined(_WIN32_WCE) -#define ALIGN __declspec(align(16)) -#else -#define ALIGN -#endif - -#ifndef max -#define max(a, b) (((a) > (b)) ? (a) : (b)) -#endif -#ifndef min -#define min(a, b) (((a) < (b)) ? (a) : (b)) -#endif - -/* COMPILE TIME DEFINITIONS */ - -/* use double precision */ -/* #define USE_DOUBLE_PRECISION */ -/* use fixed point reals */ -//#define FIXED_POINT -//#define BIG_IQ_TABLE - -/* Use if target platform has address generators with autoincrement */ -//#define PREFER_POINTERS - -#if defined(_WIN32_WCE) || defined(__arm__) || defined(__avr32__) -#define FIXED_POINT -#endif - - -#define ERROR_RESILIENCE - - -/* Allow decoding of MAIN profile AAC */ -#define MAIN_DEC -/* Allow decoding of SSR profile AAC */ -//#define SSR_DEC -/* Allow decoding of LTP profile AAC */ -#define LTP_DEC -/* Allow decoding of LD profile AAC */ -#define LD_DEC -/* Allow decoding of scalable profiles */ -//#define SCALABLE_DEC -/* Allow decoding of Digital Radio Mondiale (DRM) */ -//#define DRM -//#define DRM_PS - -/* LD can't do without LTP */ -#ifdef LD_DEC -#ifndef ERROR_RESILIENCE -#define ERROR_RESILIENCE -#endif -#ifndef LTP_DEC -#define LTP_DEC -#endif -#endif - -#define ALLOW_SMALL_FRAMELENGTH - - -// Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC and PS_DEC) -//#define LC_ONLY_DECODER -#ifdef LC_ONLY_DECODER - #undef LD_DEC - #undef LTP_DEC - #undef MAIN_DEC - #undef SSR_DEC - #undef DRM - #undef ALLOW_SMALL_FRAMELENGTH - #undef ERROR_RESILIENCE -#endif - -#define SBR_DEC -//#define SBR_LOW_POWER -#define PS_DEC - -/* FIXED POINT: No MAIN decoding */ -#ifdef FIXED_POINT -# ifdef MAIN_DEC -# undef MAIN_DEC -# endif -# ifdef SBR_DEC -# undef SBR_DEC -# endif -#endif // FIXED_POINT - -#ifdef DRM -# ifndef SCALABLE_DEC -# define SCALABLE_DEC -# endif -#endif - - -#ifdef FIXED_POINT -#define DIV_R(A, B) (((int64_t)A << REAL_BITS)/B) -#define DIV_C(A, B) (((int64_t)A << COEF_BITS)/B) -#else -#define DIV_R(A, B) ((A)/(B)) -#define DIV_C(A, B) ((A)/(B)) -#endif - -#ifndef SBR_LOW_POWER -#define qmf_t complex_t -#define QMF_RE(A) RE(A) -#define QMF_IM(A) IM(A) -#else -#define qmf_t real_t -#define QMF_RE(A) (A) -#define QMF_IM(A) -#endif - - -/* END COMPILE TIME DEFINITIONS */ - -#if defined(_WIN32) && !defined(__MINGW32__) - -#include - -#if 0 -typedef unsigned __int64 uint64_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int8 uint8_t; -typedef __int64 int64_t; -typedef __int32 int32_t; -typedef __int16 int16_t; -typedef __int8 int8_t; -#else -#include -#endif - -typedef float float32_t; - - -#else - -#include -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_STAT_H -# include -#endif -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# else -/* we need these... */ -typedef unsigned long long uint64_t; -typedef unsigned long uint32_t; -typedef unsigned short uint16_t; -typedef unsigned char uint8_t; -typedef long long int64_t; -typedef long int32_t; -typedef short int16_t; -typedef char int8_t; -# endif -#endif -#if HAVE_UNISTD_H -# include -#endif - -#ifndef HAVE_FLOAT32_T -typedef float float32_t; -#endif - -#if STDC_HEADERS -# include -#else -# if !HAVE_STRCHR -# define strchr index -# define strrchr rindex -# endif -char *strchr(), *strrchr(); -# if !HAVE_MEMCPY -# define memcpy(d, s, n) bcopy((s), (d), (n)) -# define memmove(d, s, n) bcopy((s), (d), (n)) -# endif -#endif - -#endif - -#if HAVE_BIGENDIAN -#define ARCH_IS_BIG_ENDIAN -#endif - -/* FIXED_POINT doesn't work with MAIN and SSR yet */ -#ifdef FIXED_POINT - #undef MAIN_DEC - #undef SSR_DEC -#endif - - -#if defined(FIXED_POINT) - - #include "fixed.h" - -#elif defined(USE_DOUBLE_PRECISION) - - typedef double real_t; - - #include - - #define MUL_R(A,B) ((A)*(B)) - #define MUL_C(A,B) ((A)*(B)) - #define MUL_F(A,B) ((A)*(B)) - - /* Complex multiplication */ - static INLINE void ComplexMult(real_t *y1, real_t *y2, - real_t x1, real_t x2, real_t c1, real_t c2) - { - *y1 = MUL_F(x1, c1) + MUL_F(x2, c2); - *y2 = MUL_F(x2, c1) - MUL_F(x1, c2); - } - - #define REAL_CONST(A) ((real_t)(A)) - #define COEF_CONST(A) ((real_t)(A)) - #define Q2_CONST(A) ((real_t)(A)) - #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */ - -#else /* Normal floating point operation */ - - typedef float real_t; - - #define MUL_R(A,B) ((A)*(B)) - #define MUL_C(A,B) ((A)*(B)) - #define MUL_F(A,B) ((A)*(B)) - - #define REAL_CONST(A) ((real_t)(A)) - #define COEF_CONST(A) ((real_t)(A)) - #define Q2_CONST(A) ((real_t)(A)) - #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */ - - /* Complex multiplication */ - static INLINE void ComplexMult(real_t *y1, real_t *y2, - real_t x1, real_t x2, real_t c1, real_t c2) - { - *y1 = MUL_F(x1, c1) + MUL_F(x2, c2); - *y2 = MUL_F(x2, c1) - MUL_F(x1, c2); - } - - - #if defined(_WIN32) && !defined(__MINGW32__) - #define HAS_LRINTF - static INLINE int lrintf(float f) - { - int i; - __asm - { - fld f - fistp i - } - return i; - } - #elif (defined(__i386__) && defined(__GNUC__)) && __STDC_VERSION__ < 199901L - #define HAS_LRINTF - // from http://www.stereopsis.com/FPU.html - static INLINE int lrintf(float f) - { - int i; - __asm__ __volatile__ ( - "flds %1 \n\t" - "fistpl %0 \n\t" - : "=m" (i) - : "m" (f)); - return i; - } - #endif - - - #ifdef __ICL /* only Intel C compiler has fmath ??? */ - - #include - - #define sin sinf - #define cos cosf - #define log logf - #define floor floorf - #define ceil ceilf - #define sqrt sqrtf - - #else - -#include - -#ifdef HAVE_LRINTF -# define HAS_LRINTF -# define _ISOC9X_SOURCE 1 -# define _ISOC99_SOURCE 1 -# define __USE_ISOC9X 1 -# define __USE_ISOC99 1 -#endif - -#ifdef HAVE_SINF -# define sin sinf -#error -#endif -#ifdef HAVE_COSF -# define cos cosf -#endif -#ifdef HAVE_LOGF -# define log logf -#endif -#ifdef HAVE_EXPF -# define exp expf -#endif -#ifdef HAVE_FLOORF -# define floor floorf -#endif -#ifdef HAVE_CEILF -# define ceil ceilf -#endif -#ifdef HAVE_SQRTF -# define sqrt sqrtf -#endif - - #endif - -#endif - -#ifndef HAS_LRINTF -/* standard cast */ -#define lrintf(f) ((int32_t)(f)) -#endif - -typedef real_t complex_t[2]; -#define RE(A) A[0] -#define IM(A) A[1] - - -/* common functions */ -uint8_t cpu_has_sse(void); -uint32_t random_int(void); -uint32_t ones32(uint32_t x); -uint32_t floor_log2(uint32_t x); -uint32_t wl_min_lzc(uint32_t x); -#ifdef FIXED_POINT -#define LOG2_MIN_INF REAL_CONST(-10000) -int32_t log2_int(uint32_t val); -int32_t log2_fix(uint32_t val); -int32_t pow2_int(real_t val); -real_t pow2_fix(real_t val); -#endif -uint8_t get_sr_index(const uint32_t samplerate); -uint8_t max_pred_sfb(const uint8_t sr_index); -uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type, - const uint8_t is_short); -uint32_t get_sample_rate(const uint8_t sr_index); -int8_t can_decode_ot(const uint8_t object_type); - -void *faad_malloc(size_t size); -void faad_free(void *b); - -//#define PROFILE -#ifdef PROFILE -static int64_t faad_get_ts() -{ - __asm - { - rdtsc - } -} -#endif - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif -#ifndef M_PI_2 /* PI/2 */ -#define M_PI_2 1.57079632679489661923 -#endif - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/decoder.c b/mplayer/libfaad2/decoder.c deleted file mode 100644 index e52c27da..00000000 --- a/mplayer/libfaad2/decoder.c +++ /dev/null @@ -1,1095 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: decoder.c,v 1.107 2004/09/08 09:43:11 gcp Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#include -#include - -#include "decoder.h" -#include "mp4.h" -#include "syntax.h" -#include "error.h" -#include "output.h" -#include "filtbank.h" -#include "drc.h" -#ifdef SBR_DEC -#include "sbr_dec.h" -#include "sbr_syntax.h" -#endif -#ifdef SSR_DEC -#include "ssr.h" -#endif - -#ifdef ANALYSIS -uint16_t dbg_count; -#endif - -/* static function declarations */ -static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, - uint8_t *buffer, uint32_t buffer_size, - void **sample_buffer, uint32_t sample_buffer_size); -static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo); - - -char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode) -{ - if (errcode >= NUM_ERROR_MESSAGES) - return NULL; - return err_msg[errcode]; -} - -uint32_t NEAACDECAPI NeAACDecGetCapabilities(void) -{ - uint32_t cap = 0; - - /* can't do without it */ - cap += LC_DEC_CAP; - -#ifdef MAIN_DEC - cap += MAIN_DEC_CAP; -#endif -#ifdef LTP_DEC - cap += LTP_DEC_CAP; -#endif -#ifdef LD_DEC - cap += LD_DEC_CAP; -#endif -#ifdef ERROR_RESILIENCE - cap += ERROR_RESILIENCE_CAP; -#endif -#ifdef FIXED_POINT - cap += FIXED_POINT_CAP; -#endif - - return cap; -} - -NeAACDecHandle NEAACDECAPI NeAACDecOpen(void) -{ - uint8_t i; - NeAACDecHandle hDecoder = NULL; - - if ((hDecoder = (NeAACDecHandle)faad_malloc(sizeof(NeAACDecStruct))) == NULL) - return NULL; - - memset(hDecoder, 0, sizeof(NeAACDecStruct)); - - hDecoder->config.outputFormat = FAAD_FMT_16BIT; - hDecoder->config.defObjectType = MAIN; - hDecoder->config.defSampleRate = 44100; /* Default: 44.1kHz */ - hDecoder->config.downMatrix = 0; - hDecoder->adts_header_present = 0; - hDecoder->adif_header_present = 0; - hDecoder->latm_header_present = 0; -#ifdef ERROR_RESILIENCE - hDecoder->aacSectionDataResilienceFlag = 0; - hDecoder->aacScalefactorDataResilienceFlag = 0; - hDecoder->aacSpectralDataResilienceFlag = 0; -#endif - hDecoder->frameLength = 1024; - - hDecoder->frame = 0; - hDecoder->sample_buffer = NULL; - - for (i = 0; i < MAX_CHANNELS; i++) - { - hDecoder->window_shape_prev[i] = 0; - hDecoder->time_out[i] = NULL; - hDecoder->fb_intermed[i] = NULL; -#ifdef SSR_DEC - hDecoder->ssr_overlap[i] = NULL; - hDecoder->prev_fmd[i] = NULL; -#endif -#ifdef MAIN_DEC - hDecoder->pred_stat[i] = NULL; -#endif -#ifdef LTP_DEC - hDecoder->ltp_lag[i] = 0; - hDecoder->lt_pred_stat[i] = NULL; -#endif - } - -#ifdef SBR_DEC - for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++) - { - hDecoder->sbr[i] = NULL; - } -#endif - - hDecoder->drc = drc_init(REAL_CONST(1.0), REAL_CONST(1.0)); - - return hDecoder; -} - -NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder) -{ - if (hDecoder) - { - NeAACDecConfigurationPtr config = &(hDecoder->config); - - return config; - } - - return NULL; -} - -uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder, - NeAACDecConfigurationPtr config) -{ - if (hDecoder && config) - { - /* check if we can decode this object type */ - if (can_decode_ot(config->defObjectType) < 0) - return 0; - hDecoder->config.defObjectType = config->defObjectType; - - /* samplerate: anything but 0 should be possible */ - if (config->defSampleRate == 0) - return 0; - hDecoder->config.defSampleRate = config->defSampleRate; - - /* check output format */ -#ifdef FIXED_POINT - if ((config->outputFormat < 1) || (config->outputFormat > 4)) - return 0; -#else - if ((config->outputFormat < 1) || (config->outputFormat > 5)) - return 0; -#endif - hDecoder->config.outputFormat = config->outputFormat; - - if (config->downMatrix > 1) - return 0; - hDecoder->config.downMatrix = config->downMatrix; - - /* OK */ - return 1; - } - - return 0; -} - -static int latmCheck(latm_header *latm, bitfile *ld) -{ - uint32_t good=0, bad=0, bits, m; - - while(!ld->error && !ld->no_more_reading) - { - bits = faad_latm_frame(latm, ld); - if(bits==-1U) - bad++; - else - { - good++; - while(bits>0) - { - m = min(bits, 8); - faad_getbits(ld, m); - bits -= m; - } - } - } - - return (good>0); -} - - -int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, uint8_t *buffer, - uint32_t buffer_size, - uint32_t *samplerate, uint8_t *channels, int latm_stream) -{ - uint32_t bits = 0; - bitfile ld; - adif_header adif; - adts_header adts; - - if ((hDecoder == NULL) || (samplerate == NULL) || (channels == NULL)) - return -1; - - hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate); - hDecoder->object_type = hDecoder->config.defObjectType; - *samplerate = get_sample_rate(hDecoder->sf_index); - *channels = 1; - - if (buffer != NULL) - { - int is_latm; - latm_header *l = &hDecoder->latm_config; - faad_initbits(&ld, buffer, buffer_size); - - memset(l, 0, sizeof(latm_header)); - is_latm = latmCheck(l, &ld); - l->inited = 0; - l->frameLength = 0; - faad_rewindbits(&ld); - if(is_latm && l->ASCbits>0) - { - int32_t x; - hDecoder->latm_header_present = 1; - x = NeAACDecInit2(hDecoder, &l->ASC, (l->ASCbits+7)/8, samplerate, channels); - if(x!=0) - hDecoder->latm_header_present = 0; - return x; - } - else if (latm_stream) { - return -1; - } - else - /* Check if an ADIF header is present */ - if ((buffer[0] == 'A') && (buffer[1] == 'D') && - (buffer[2] == 'I') && (buffer[3] == 'F')) - { - hDecoder->adif_header_present = 1; - - get_adif_header(&adif, &ld); - faad_byte_align(&ld); - - hDecoder->sf_index = adif.pce[0].sf_index; - hDecoder->object_type = adif.pce[0].object_type + 1; - - *samplerate = get_sample_rate(hDecoder->sf_index); - *channels = adif.pce[0].channels; - - memcpy(&(hDecoder->pce), &(adif.pce[0]), sizeof(program_config)); - hDecoder->pce_set = 1; - - bits = bit2byte(faad_get_processed_bits(&ld)); - - /* Check if an ADTS header is present */ - } else if (faad_showbits(&ld, 12) == 0xfff) { - hDecoder->adts_header_present = 1; - - adts.old_format = hDecoder->config.useOldADTSFormat; - adts_frame(&adts, &ld); - - hDecoder->sf_index = adts.sf_index; - hDecoder->object_type = adts.profile + 1; - - *samplerate = get_sample_rate(hDecoder->sf_index); - *channels = (adts.channel_configuration > 6) ? - 2 : adts.channel_configuration; - } - - if (ld.error) - { - faad_endbits(&ld); - return -1; - } - faad_endbits(&ld); - } - hDecoder->channelConfiguration = *channels; - -#if (defined(PS_DEC) || defined(DRM_PS)) - /* check if we have a mono file */ - if (*channels == 1) - { - /* upMatrix to 2 channels for implicit signalling of PS */ - *channels = 2; - } -#endif - -#ifdef SBR_DEC - /* implicit signalling */ - if (*samplerate <= 24000 && !(hDecoder->config.dontUpSampleImplicitSBR)) - { - *samplerate *= 2; - hDecoder->forceUpSampling = 1; - } else if (*samplerate > 24000 && !(hDecoder->config.dontUpSampleImplicitSBR)) { - hDecoder->downSampledSBR = 1; - } -#endif - - /* must be done before frameLength is divided by 2 for LD */ -#ifdef SSR_DEC - if (hDecoder->object_type == SSR) - hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS); - else -#endif - hDecoder->fb = filter_bank_init(hDecoder->frameLength); - -#ifdef LD_DEC - if (hDecoder->object_type == LD) - hDecoder->frameLength >>= 1; -#endif - - if (can_decode_ot(hDecoder->object_type) < 0) - return -1; - - return bits; -} - -/* Init the library using a DecoderSpecificInfo */ -int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer, - uint32_t SizeOfDecoderSpecificInfo, - uint32_t *samplerate, uint8_t *channels) -{ - int8_t rc; - mp4AudioSpecificConfig mp4ASC; - - if((hDecoder == NULL) - || (pBuffer == NULL) - || (SizeOfDecoderSpecificInfo < 2) - || (samplerate == NULL) - || (channels == NULL)) - { - return -1; - } - - hDecoder->adif_header_present = 0; - hDecoder->adts_header_present = 0; - - /* decode the audio specific config */ - rc = AudioSpecificConfig2(pBuffer, SizeOfDecoderSpecificInfo, &mp4ASC, - &(hDecoder->pce), hDecoder->latm_header_present); - - /* copy the relevant info to the decoder handle */ - *samplerate = mp4ASC.samplingFrequency; - if (mp4ASC.channelsConfiguration) - { - *channels = mp4ASC.channelsConfiguration; - } else { - *channels = hDecoder->pce.channels; - hDecoder->pce_set = 1; - } -#if (defined(PS_DEC) || defined(DRM_PS)) - /* check if we have a mono file */ - if (*channels == 1) - { - /* upMatrix to 2 channels for implicit signalling of PS */ - *channels = 2; - } -#endif - hDecoder->sf_index = mp4ASC.samplingFrequencyIndex; - hDecoder->object_type = mp4ASC.objectTypeIndex; -#ifdef ERROR_RESILIENCE - hDecoder->aacSectionDataResilienceFlag = mp4ASC.aacSectionDataResilienceFlag; - hDecoder->aacScalefactorDataResilienceFlag = mp4ASC.aacScalefactorDataResilienceFlag; - hDecoder->aacSpectralDataResilienceFlag = mp4ASC.aacSpectralDataResilienceFlag; -#endif -#ifdef SBR_DEC - hDecoder->sbr_present_flag = mp4ASC.sbr_present_flag; - hDecoder->downSampledSBR = mp4ASC.downSampledSBR; - if (hDecoder->config.dontUpSampleImplicitSBR == 0) - hDecoder->forceUpSampling = mp4ASC.forceUpSampling; - else - hDecoder->forceUpSampling = 0; - - /* AAC core decoder samplerate is 2 times as low */ - if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || hDecoder->forceUpSampling == 1) - { - hDecoder->sf_index = get_sr_index(mp4ASC.samplingFrequency / 2); - } -#endif - - if (rc != 0) - { - return rc; - } - hDecoder->channelConfiguration = mp4ASC.channelsConfiguration; - if (mp4ASC.frameLengthFlag) -#ifdef ALLOW_SMALL_FRAMELENGTH - hDecoder->frameLength = 960; -#else - return -1; -#endif - - /* must be done before frameLength is divided by 2 for LD */ -#ifdef SSR_DEC - if (hDecoder->object_type == SSR) - hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS); - else -#endif - hDecoder->fb = filter_bank_init(hDecoder->frameLength); - -#ifdef LD_DEC - if (hDecoder->object_type == LD) - hDecoder->frameLength >>= 1; -#endif - - return 0; -} - -#ifdef DRM -int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate, - uint8_t channels) -{ - if (hDecoder == NULL) - return 1; /* error */ - - NeAACDecClose(*hDecoder); - - *hDecoder = NeAACDecOpen(); - - /* Special object type defined for DRM */ - (*hDecoder)->config.defObjectType = DRM_ER_LC; - - (*hDecoder)->config.defSampleRate = samplerate; -#ifdef ERROR_RESILIENCE // This shoudl always be defined for DRM - (*hDecoder)->aacSectionDataResilienceFlag = 1; /* VCB11 */ - (*hDecoder)->aacScalefactorDataResilienceFlag = 0; /* no RVLC */ - (*hDecoder)->aacSpectralDataResilienceFlag = 1; /* HCR */ -#endif - (*hDecoder)->frameLength = 960; - (*hDecoder)->sf_index = get_sr_index((*hDecoder)->config.defSampleRate); - (*hDecoder)->object_type = (*hDecoder)->config.defObjectType; - - if ((channels == DRMCH_STEREO) || (channels == DRMCH_SBR_STEREO)) - (*hDecoder)->channelConfiguration = 2; - else - (*hDecoder)->channelConfiguration = 1; - -#ifdef SBR_DEC - if ((channels == DRMCH_MONO) || (channels == DRMCH_STEREO)) - (*hDecoder)->sbr_present_flag = 0; - else - (*hDecoder)->sbr_present_flag = 1; -#endif - - (*hDecoder)->fb = filter_bank_init((*hDecoder)->frameLength); - - return 0; -} -#endif - -void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder) -{ - uint8_t i; - - if (hDecoder == NULL) - return; - -#ifdef PROFILE - printf("AAC decoder total: %I64d cycles\n", hDecoder->cycles); - printf("requant: %I64d cycles\n", hDecoder->requant_cycles); - printf("spectral_data: %I64d cycles\n", hDecoder->spectral_cycles); - printf("scalefactors: %I64d cycles\n", hDecoder->scalefac_cycles); - printf("output: %I64d cycles\n", hDecoder->output_cycles); -#endif - - for (i = 0; i < MAX_CHANNELS; i++) - { - if (hDecoder->time_out[i]) faad_free(hDecoder->time_out[i]); - if (hDecoder->fb_intermed[i]) faad_free(hDecoder->fb_intermed[i]); -#ifdef SSR_DEC - if (hDecoder->ssr_overlap[i]) faad_free(hDecoder->ssr_overlap[i]); - if (hDecoder->prev_fmd[i]) faad_free(hDecoder->prev_fmd[i]); -#endif -#ifdef MAIN_DEC - if (hDecoder->pred_stat[i]) faad_free(hDecoder->pred_stat[i]); -#endif -#ifdef LTP_DEC - if (hDecoder->lt_pred_stat[i]) faad_free(hDecoder->lt_pred_stat[i]); -#endif - } - -#ifdef SSR_DEC - if (hDecoder->object_type == SSR) - ssr_filter_bank_end(hDecoder->fb); - else -#endif - filter_bank_end(hDecoder->fb); - - drc_end(hDecoder->drc); - - if (hDecoder->sample_buffer) faad_free(hDecoder->sample_buffer); - -#ifdef SBR_DEC - for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++) - { - if (hDecoder->sbr[i]) - sbrDecodeEnd(hDecoder->sbr[i]); - } -#endif - - if (hDecoder) faad_free(hDecoder); -} - -void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame) -{ - if (hDecoder) - { - hDecoder->postSeekResetFlag = 1; - - if (frame != -1) - hDecoder->frame = frame; - } -} - -static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo) -{ - hInfo->num_front_channels = 0; - hInfo->num_side_channels = 0; - hInfo->num_back_channels = 0; - hInfo->num_lfe_channels = 0; - memset(hInfo->channel_position, 0, MAX_CHANNELS*sizeof(uint8_t)); - - if (hDecoder->downMatrix) - { - hInfo->num_front_channels = 2; - hInfo->channel_position[0] = FRONT_CHANNEL_LEFT; - hInfo->channel_position[1] = FRONT_CHANNEL_RIGHT; - return; - } - - /* check if there is a PCE */ - if (hDecoder->pce_set) - { - uint8_t i, chpos = 0; - uint8_t chdir, back_center = 0; - - hInfo->num_front_channels = hDecoder->pce.num_front_channels; - hInfo->num_side_channels = hDecoder->pce.num_side_channels; - hInfo->num_back_channels = hDecoder->pce.num_back_channels; - hInfo->num_lfe_channels = hDecoder->pce.num_lfe_channels; - - chdir = hInfo->num_front_channels; - if (chdir & 1) - { - hInfo->channel_position[chpos++] = FRONT_CHANNEL_CENTER; - chdir--; - } - for (i = 0; i < chdir; i += 2) - { - hInfo->channel_position[chpos++] = FRONT_CHANNEL_LEFT; - hInfo->channel_position[chpos++] = FRONT_CHANNEL_RIGHT; - } - - for (i = 0; i < hInfo->num_side_channels; i += 2) - { - hInfo->channel_position[chpos++] = SIDE_CHANNEL_LEFT; - hInfo->channel_position[chpos++] = SIDE_CHANNEL_RIGHT; - } - - chdir = hInfo->num_back_channels; - if (chdir & 1) - { - back_center = 1; - chdir--; - } - for (i = 0; i < chdir; i += 2) - { - hInfo->channel_position[chpos++] = BACK_CHANNEL_LEFT; - hInfo->channel_position[chpos++] = BACK_CHANNEL_RIGHT; - } - if (back_center) - { - hInfo->channel_position[chpos++] = BACK_CHANNEL_CENTER; - } - - for (i = 0; i < hInfo->num_lfe_channels; i++) - { - hInfo->channel_position[chpos++] = LFE_CHANNEL; - } - - } else { - switch (hDecoder->channelConfiguration) - { - case 1: - hInfo->num_front_channels = 1; - hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; - break; - case 2: - hInfo->num_front_channels = 2; - hInfo->channel_position[0] = FRONT_CHANNEL_LEFT; - hInfo->channel_position[1] = FRONT_CHANNEL_RIGHT; - break; - case 3: - hInfo->num_front_channels = 3; - hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; - hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; - hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; - break; - case 4: - hInfo->num_front_channels = 3; - hInfo->num_back_channels = 1; - hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; - hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; - hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; - hInfo->channel_position[3] = BACK_CHANNEL_CENTER; - break; - case 5: - hInfo->num_front_channels = 3; - hInfo->num_back_channels = 2; - hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; - hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; - hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; - hInfo->channel_position[3] = BACK_CHANNEL_LEFT; - hInfo->channel_position[4] = BACK_CHANNEL_RIGHT; - break; - case 6: - hInfo->num_front_channels = 3; - hInfo->num_back_channels = 2; - hInfo->num_lfe_channels = 1; - hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; - hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; - hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; - hInfo->channel_position[3] = BACK_CHANNEL_LEFT; - hInfo->channel_position[4] = BACK_CHANNEL_RIGHT; - hInfo->channel_position[5] = LFE_CHANNEL; - break; - case 7: - hInfo->num_front_channels = 3; - hInfo->num_side_channels = 2; - hInfo->num_back_channels = 2; - hInfo->num_lfe_channels = 1; - hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; - hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; - hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; - hInfo->channel_position[3] = SIDE_CHANNEL_LEFT; - hInfo->channel_position[4] = SIDE_CHANNEL_RIGHT; - hInfo->channel_position[5] = BACK_CHANNEL_LEFT; - hInfo->channel_position[6] = BACK_CHANNEL_RIGHT; - hInfo->channel_position[7] = LFE_CHANNEL; - break; - default: /* channelConfiguration == 0 || channelConfiguration > 7 */ - { - uint8_t i; - uint8_t ch = hDecoder->fr_channels - hDecoder->has_lfe; - if (ch & 1) /* there's either a center front or a center back channel */ - { - uint8_t ch1 = (ch-1)/2; - if (hDecoder->first_syn_ele == ID_SCE) - { - hInfo->num_front_channels = ch1 + 1; - hInfo->num_back_channels = ch1; - hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; - for (i = 1; i <= ch1; i+=2) - { - hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; - hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; - } - for (i = ch1+1; i < ch; i+=2) - { - hInfo->channel_position[i] = BACK_CHANNEL_LEFT; - hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; - } - } else { - hInfo->num_front_channels = ch1; - hInfo->num_back_channels = ch1 + 1; - for (i = 0; i < ch1; i+=2) - { - hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; - hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; - } - for (i = ch1; i < ch-1; i+=2) - { - hInfo->channel_position[i] = BACK_CHANNEL_LEFT; - hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; - } - hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER; - } - } else { - uint8_t ch1 = (ch)/2; - hInfo->num_front_channels = ch1; - hInfo->num_back_channels = ch1; - if (ch1 & 1) - { - hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; - for (i = 1; i <= ch1; i+=2) - { - hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; - hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; - } - for (i = ch1+1; i < ch-1; i+=2) - { - hInfo->channel_position[i] = BACK_CHANNEL_LEFT; - hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; - } - hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER; - } else { - for (i = 0; i < ch1; i+=2) - { - hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; - hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; - } - for (i = ch1; i < ch; i+=2) - { - hInfo->channel_position[i] = BACK_CHANNEL_LEFT; - hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; - } - } - } - hInfo->num_lfe_channels = hDecoder->has_lfe; - for (i = ch; i < hDecoder->fr_channels; i++) - { - hInfo->channel_position[i] = LFE_CHANNEL; - } - } - break; - } - } -} - -void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder, - NeAACDecFrameInfo *hInfo, - uint8_t *buffer, uint32_t buffer_size) -{ - return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, NULL, 0); -} - -void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder, - NeAACDecFrameInfo *hInfo, - uint8_t *buffer, uint32_t buffer_size, - void **sample_buffer, uint32_t sample_buffer_size) -{ - if ((sample_buffer == NULL) || (sample_buffer_size == 0)) - { - hInfo->error = 27; - return NULL; - } - - return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, - sample_buffer, sample_buffer_size); -} - -static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, - uint8_t *buffer, uint32_t buffer_size, - void **sample_buffer2, uint32_t sample_buffer_size) -{ - uint8_t channels = 0; - uint8_t output_channels = 0; - bitfile ld; - uint32_t bitsconsumed; - uint16_t frame_len; - void *sample_buffer; - uint32_t startbit=0, endbit=0, payload_bits=0; - -#ifdef PROFILE - int64_t count = faad_get_ts(); -#endif - - /* safety checks */ - if ((hDecoder == NULL) || (hInfo == NULL) || (buffer == NULL)) - { - return NULL; - } - -#if 0 - printf("%d\n", buffer_size*8); -#endif - - frame_len = hDecoder->frameLength; - - - memset(hInfo, 0, sizeof(NeAACDecFrameInfo)); - memset(hDecoder->internal_channel, 0, MAX_CHANNELS*sizeof(hDecoder->internal_channel[0])); - - /* initialize the bitstream */ - faad_initbits(&ld, buffer, buffer_size); - -#if 0 - { - int i; - for (i = 0; i < ((buffer_size+3)>>2); i++) - { - uint8_t *buf; - uint32_t temp = 0; - buf = faad_getbitbuffer(&ld, 32); - //temp = getdword((void*)buf); - temp = *((uint32_t*)buf); - printf("0x%.8X\n", temp); - free(buf); - } - faad_endbits(&ld); - faad_initbits(&ld, buffer, buffer_size); - } -#endif - - if(hDecoder->latm_header_present) - { - payload_bits = faad_latm_frame(&hDecoder->latm_config, &ld); - startbit = faad_get_processed_bits(&ld); - if(payload_bits == -1U) - { - hInfo->error = 1; - goto error; - } - } - -#ifdef DRM - if (hDecoder->object_type == DRM_ER_LC) - { - /* We do not support stereo right now */ - if (0) //(hDecoder->channelConfiguration == 2) - { - hInfo->error = 8; // Throw CRC error - goto error; - } - - faad_getbits(&ld, 8 - DEBUGVAR(1,1,"NeAACDecDecode(): skip CRC")); - } -#endif - - if (hDecoder->adts_header_present) - { - adts_header adts; - - adts.old_format = hDecoder->config.useOldADTSFormat; - if ((hInfo->error = adts_frame(&adts, &ld)) > 0) - goto error; - - /* MPEG2 does byte_alignment() here, - * but ADTS header is always multiple of 8 bits in MPEG2 - * so not needed to actually do it. - */ - } - -#ifdef ANALYSIS - dbg_count = 0; -#endif - - /* decode the complete bitstream */ -#ifdef SCALABLE_DEC - if ((hDecoder->object_type == 6) || (hDecoder->object_type == DRM_ER_LC)) - { - aac_scalable_main_element(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc); - } else { -#endif - raw_data_block(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc); -#ifdef SCALABLE_DEC - } -#endif - - if(hDecoder->latm_header_present) - { - endbit = faad_get_processed_bits(&ld); - if(endbit-startbit > payload_bits) - fprintf(stderr, "\r\nERROR, too many payload bits read: %u > %d. Please. report with a link to a sample\n", - endbit-startbit, payload_bits); - if(hDecoder->latm_config.otherDataLenBits > 0) - faad_getbits(&ld, hDecoder->latm_config.otherDataLenBits); - faad_byte_align(&ld); - } - - channels = hDecoder->fr_channels; - - if (hInfo->error > 0) - goto error; - - /* safety check */ - if (channels == 0 || channels > MAX_CHANNELS) - { - /* invalid number of channels */ - hInfo->error = 12; - goto error; - } - - /* no more bit reading after this */ - bitsconsumed = faad_get_processed_bits(&ld); - hInfo->bytesconsumed = bit2byte(bitsconsumed); - if (ld.error) - { - hInfo->error = 14; - goto error; - } - faad_endbits(&ld); - - - if (!hDecoder->adts_header_present && !hDecoder->adif_header_present && !hDecoder->latm_header_present) - { - if (hDecoder->channelConfiguration == 0) - hDecoder->channelConfiguration = channels; - - if (channels == 8) /* 7.1 */ - hDecoder->channelConfiguration = 7; - if (channels == 7) /* not a standard channelConfiguration */ - hDecoder->channelConfiguration = 0; - } - - if ((channels == 5 || channels == 6) && hDecoder->config.downMatrix) - { - hDecoder->downMatrix = 1; - output_channels = 2; - } else { - output_channels = channels; - } - -#if (defined(PS_DEC) || defined(DRM_PS)) - hDecoder->upMatrix = 0; - /* check if we have a mono file */ - if (output_channels == 1) - { - /* upMatrix to 2 channels for implicit signalling of PS */ - hDecoder->upMatrix = 1; - output_channels = 2; - } -#endif - - /* Make a channel configuration based on either a PCE or a channelConfiguration */ - create_channel_config(hDecoder, hInfo); - - /* number of samples in this frame */ - hInfo->samples = frame_len*output_channels; - /* number of channels in this frame */ - hInfo->channels = output_channels; - /* samplerate */ - hInfo->samplerate = get_sample_rate(hDecoder->sf_index); - /* object type */ - hInfo->object_type = hDecoder->object_type; - /* sbr */ - hInfo->sbr = NO_SBR; - /* header type */ - hInfo->header_type = RAW; - if (hDecoder->adif_header_present) - hInfo->header_type = ADIF; - if (hDecoder->adts_header_present) - hInfo->header_type = ADTS; - if (hDecoder->latm_header_present) - hInfo->header_type = LATM; -#if (defined(PS_DEC) || defined(DRM_PS)) - hInfo->ps = hDecoder->ps_used_global; -#endif - - /* check if frame has channel elements */ - if (channels == 0) - { - hDecoder->frame++; - return NULL; - } - - /* allocate the buffer for the final samples */ - if ((hDecoder->sample_buffer == NULL) || - (hDecoder->alloced_channels != output_channels)) - { - static const uint8_t str[] = { sizeof(int16_t), sizeof(int32_t), sizeof(int32_t), - sizeof(float32_t), sizeof(double), sizeof(int16_t), sizeof(int16_t), - sizeof(int16_t), sizeof(int16_t), 0, 0, 0 - }; - uint8_t stride = str[hDecoder->config.outputFormat-1]; -#ifdef SBR_DEC - if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || (hDecoder->forceUpSampling == 1)) - { - stride = 2 * stride; - } -#endif - /* check if we want to use internal sample_buffer */ - if (sample_buffer_size == 0) - { - if (hDecoder->sample_buffer) - faad_free(hDecoder->sample_buffer); - hDecoder->sample_buffer = NULL; - hDecoder->sample_buffer = faad_malloc(frame_len*output_channels*stride); - } else if (sample_buffer_size < frame_len*output_channels*stride) { - /* provided sample buffer is not big enough */ - hInfo->error = 27; - return NULL; - } - hDecoder->alloced_channels = output_channels; - } - - if (sample_buffer_size == 0) - { - sample_buffer = hDecoder->sample_buffer; - } else { - sample_buffer = *sample_buffer2; - } - -#ifdef SBR_DEC - if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) - { - uint8_t ele; - - /* this data is different when SBR is used or when the data is upsampled */ - if (!hDecoder->downSampledSBR) - { - frame_len *= 2; - hInfo->samples *= 2; - hInfo->samplerate *= 2; - } - - /* check if every element was provided with SBR data */ - for (ele = 0; ele < hDecoder->fr_ch_ele; ele++) - { - if (hDecoder->sbr[ele] == NULL) - { - hInfo->error = 25; - goto error; - } - } - - /* sbr */ - if (hDecoder->sbr_present_flag == 1) - { - hInfo->object_type = HE_AAC; - hInfo->sbr = SBR_UPSAMPLED; - } else { - hInfo->sbr = NO_SBR_UPSAMPLED; - } - if (hDecoder->downSampledSBR) - { - hInfo->sbr = SBR_DOWNSAMPLED; - } - } -#endif - - sample_buffer = output_to_PCM(hDecoder, hDecoder->time_out, sample_buffer, - output_channels, frame_len, hDecoder->config.outputFormat); - - - hDecoder->postSeekResetFlag = 0; - - hDecoder->frame++; -#ifdef LD_DEC - if (hDecoder->object_type != LD) - { -#endif - if (hDecoder->frame <= 1) - hInfo->samples = 0; -#ifdef LD_DEC - } else { - /* LD encoders will give lower delay */ - if (hDecoder->frame <= 0) - hInfo->samples = 0; - } -#endif - - /* cleanup */ -#ifdef ANALYSIS - fflush(stdout); -#endif - -#ifdef PROFILE - count = faad_get_ts() - count; - hDecoder->cycles += count; -#endif - - return sample_buffer; - -error: - - faad_endbits(&ld); - - /* cleanup */ -#ifdef ANALYSIS - fflush(stdout); -#endif - - return NULL; -} diff --git a/mplayer/libfaad2/decoder.h b/mplayer/libfaad2/decoder.h deleted file mode 100644 index 1dbffc87..00000000 --- a/mplayer/libfaad2/decoder.h +++ /dev/null @@ -1,122 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: decoder.h,v 1.44 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __DECODER_H__ -#define __DECODER_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _WIN32 - #pragma pack(push, 8) - #ifndef NEAACDECAPI - #define NEAACDECAPI __cdecl - #endif -#else - #ifndef NEAACDECAPI - #define NEAACDECAPI - #endif -#endif - - -/* library output formats */ -#define FAAD_FMT_16BIT 1 -#define FAAD_FMT_24BIT 2 -#define FAAD_FMT_32BIT 3 -#define FAAD_FMT_FLOAT 4 -#define FAAD_FMT_FIXED FAAD_FMT_FLOAT -#define FAAD_FMT_DOUBLE 5 - -#define LC_DEC_CAP (1<<0) -#define MAIN_DEC_CAP (1<<1) -#define LTP_DEC_CAP (1<<2) -#define LD_DEC_CAP (1<<3) -#define ERROR_RESILIENCE_CAP (1<<4) -#define FIXED_POINT_CAP (1<<5) - -#define FRONT_CHANNEL_CENTER (1) -#define FRONT_CHANNEL_LEFT (2) -#define FRONT_CHANNEL_RIGHT (3) -#define SIDE_CHANNEL_LEFT (4) -#define SIDE_CHANNEL_RIGHT (5) -#define BACK_CHANNEL_LEFT (6) -#define BACK_CHANNEL_RIGHT (7) -#define BACK_CHANNEL_CENTER (8) -#define LFE_CHANNEL (9) -#define UNKNOWN_CHANNEL (0) - -char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode); - -uint32_t NEAACDECAPI NeAACDecGetCapabilities(void); - -NeAACDecHandle NEAACDECAPI NeAACDecOpen(void); - -NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder); - -uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder, - NeAACDecConfigurationPtr config); - -/* Init the library based on info from the AAC file (ADTS/ADIF) */ -int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, - uint8_t *buffer, - uint32_t buffer_size, - uint32_t *samplerate, - uint8_t *channels, - int latm_stream); - -/* Init the library using a DecoderSpecificInfo */ -int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer, - uint32_t SizeOfDecoderSpecificInfo, - uint32_t *samplerate, uint8_t *channels); - -/* Init the library for DRM */ -int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate, - uint8_t channels); - -void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder); - -void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame); - -void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder, - NeAACDecFrameInfo *hInfo, - uint8_t *buffer, - uint32_t buffer_size); - -void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder, - NeAACDecFrameInfo *hInfo, - uint8_t *buffer, uint32_t buffer_size, - void **sample_buffer, uint32_t sample_buffer_size); - -#ifdef _WIN32 - #pragma pack(pop) -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/drc.c b/mplayer/libfaad2/drc.c deleted file mode 100644 index 232831d3..00000000 --- a/mplayer/libfaad2/drc.c +++ /dev/null @@ -1,170 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: drc.c,v 1.24 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#include -#include -#include "syntax.h" -#include "drc.h" - -drc_info *drc_init(real_t cut, real_t boost) -{ - drc_info *drc = (drc_info*)faad_malloc(sizeof(drc_info)); - memset(drc, 0, sizeof(drc_info)); - - drc->ctrl1 = cut; - drc->ctrl2 = boost; - - drc->num_bands = 1; - drc->band_top[0] = 1024/4 - 1; - drc->dyn_rng_sgn[0] = 1; - drc->dyn_rng_ctl[0] = 0; - - return drc; -} - -void drc_end(drc_info *drc) -{ - if (drc) faad_free(drc); -} - -#ifdef FIXED_POINT -static real_t drc_pow2_table[] = -{ - COEF_CONST(0.5146511183), - COEF_CONST(0.5297315472), - COEF_CONST(0.5452538663), - COEF_CONST(0.5612310242), - COEF_CONST(0.5776763484), - COEF_CONST(0.5946035575), - COEF_CONST(0.6120267717), - COEF_CONST(0.6299605249), - COEF_CONST(0.6484197773), - COEF_CONST(0.6674199271), - COEF_CONST(0.6869768237), - COEF_CONST(0.7071067812), - COEF_CONST(0.7278265914), - COEF_CONST(0.7491535384), - COEF_CONST(0.7711054127), - COEF_CONST(0.7937005260), - COEF_CONST(0.8169577266), - COEF_CONST(0.8408964153), - COEF_CONST(0.8655365610), - COEF_CONST(0.8908987181), - COEF_CONST(0.9170040432), - COEF_CONST(0.9438743127), - COEF_CONST(0.9715319412), - COEF_CONST(1.0000000000), - COEF_CONST(1.0293022366), - COEF_CONST(1.0594630944), - COEF_CONST(1.0905077327), - COEF_CONST(1.1224620483), - COEF_CONST(1.1553526969), - COEF_CONST(1.1892071150), - COEF_CONST(1.2240535433), - COEF_CONST(1.2599210499), - COEF_CONST(1.2968395547), - COEF_CONST(1.3348398542), - COEF_CONST(1.3739536475), - COEF_CONST(1.4142135624), - COEF_CONST(1.4556531828), - COEF_CONST(1.4983070769), - COEF_CONST(1.5422108254), - COEF_CONST(1.5874010520), - COEF_CONST(1.6339154532), - COEF_CONST(1.6817928305), - COEF_CONST(1.7310731220), - COEF_CONST(1.7817974363), - COEF_CONST(1.8340080864), - COEF_CONST(1.8877486254), - COEF_CONST(1.9430638823) -}; -#endif - -void drc_decode(drc_info *drc, real_t *spec) -{ - uint16_t i, bd, top; -#ifdef FIXED_POINT - int32_t exp, frac; -#else - real_t factor, exp; -#endif - uint16_t bottom = 0; - - if (drc->num_bands == 1) - drc->band_top[0] = 1024/4 - 1; - - for (bd = 0; bd < drc->num_bands; bd++) - { - top = 4 * (drc->band_top[bd] + 1); - -#ifndef FIXED_POINT - /* Decode DRC gain factor */ - if (drc->dyn_rng_sgn[bd]) /* compress */ - exp = -drc->ctrl1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0); - else /* boost */ - exp = drc->ctrl2 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0); - factor = (real_t)pow(2.0, exp); - - /* Apply gain factor */ - for (i = bottom; i < top; i++) - spec[i] *= factor; -#else - /* Decode DRC gain factor */ - if (drc->dyn_rng_sgn[bd]) /* compress */ - { - exp = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24; - frac = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24; - } else { /* boost */ - exp = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24; - frac = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24; - } - - /* Apply gain factor */ - if (exp < 0) - { - for (i = bottom; i < top; i++) - { - spec[i] >>= -exp; - if (frac) - spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]); - } - } else { - for (i = bottom; i < top; i++) - { - spec[i] <<= exp; - if (frac) - spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]); - } - } -#endif - - bottom = top; - } -} diff --git a/mplayer/libfaad2/drc.h b/mplayer/libfaad2/drc.h deleted file mode 100644 index d7dcdb4e..00000000 --- a/mplayer/libfaad2/drc.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: drc.h,v 1.18 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __DRC_H__ -#define __DRC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#define DRC_REF_LEVEL 20*4 /* -20 dB */ - - -drc_info *drc_init(real_t cut, real_t boost); -void drc_end(drc_info *drc); -void drc_decode(drc_info *drc, real_t *spec); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/drm_dec.c b/mplayer/libfaad2/drm_dec.c deleted file mode 100644 index 0c5f29a0..00000000 --- a/mplayer/libfaad2/drm_dec.c +++ /dev/null @@ -1,990 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR and PS decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: drm_dec.c 29306 2009-05-13 15:22:13Z bircoph $ -**/ - -#include -#include -#include -#include -#include "common.h" - -#ifdef DRM - -#include "sbr_dec.h" -#include "drm_dec.h" -#include "bits.h" - -/* constants */ -#define DECAY_CUTOFF 3 -#define DECAY_SLOPE 0.05f - -/* type definitaions */ -typedef const int8_t (*drm_ps_huff_tab)[2]; - - -/* binary search huffman tables */ -static const int8_t f_huffman_sa[][2] = -{ - { /*0*/ -15, 1 }, /* index 0: 1 bits: x */ - { 2, 3 }, /* index 1: 2 bits: 1x */ - { /*7*/ -8, 4 }, /* index 2: 3 bits: 10x */ - { 5, 6 }, /* index 3: 3 bits: 11x */ - { /*1*/ -14, /*-1*/ -16 }, /* index 4: 4 bits: 101x */ - { /*-2*/ -17, 7 }, /* index 5: 4 bits: 110x */ - { 8, 9 }, /* index 6: 4 bits: 111x */ - { /*2*/ -13, /*-3*/ -18 }, /* index 7: 5 bits: 1101x */ - { /*3*/ -12, 10 }, /* index 8: 5 bits: 1110x */ - { 11, 12 }, /* index 9: 5 bits: 1111x */ - { /*4*/ -11, /*5*/ -10 }, /* index 10: 6 bits: 11101x */ - { /*-4*/ -19, /*-5*/ -20 }, /* index 11: 6 bits: 11110x */ - { /*6*/ -9, 13 }, /* index 12: 6 bits: 11111x */ - { /*-7*/ -22, /*-6*/ -21 } /* index 13: 7 bits: 111111x */ -}; - -static const int8_t t_huffman_sa[][2] = -{ - { /*0*/ -15, 1 }, /* index 0: 1 bits: x */ - { 2, 3 }, /* index 1: 2 bits: 1x */ - { /*-1*/ -16, /*1*/ -14 }, /* index 2: 3 bits: 10x */ - { 4, 5 }, /* index 3: 3 bits: 11x */ - { /*-2*/ -17, /*2*/ -13 }, /* index 4: 4 bits: 110x */ - { 6, 7 }, /* index 5: 4 bits: 111x */ - { /*-3*/ -18, /*3*/ -12 }, /* index 6: 5 bits: 1110x */ - { 8, 9 }, /* index 7: 5 bits: 1111x */ - { /*-4*/ -19, /*4*/ -11 }, /* index 8: 6 bits: 11110x */ - { 10, 11 }, /* index 9: 6 bits: 11111x */ - { /*-5*/ -20, /*5*/ -10 }, /* index 10: 7 bits: 111110x */ - { /*-6*/ -21, 12 }, /* index 11: 7 bits: 111111x */ - { /*-7*/ -22, 13 }, /* index 12: 8 bits: 1111111x */ - { /*6*/ -9, /*7*/ -8 } /* index 13: 9 bits: 11111111x */ -}; - -static const int8_t f_huffman_pan[][2] = -{ - { /*0*/ -15, 1 }, /* index 0: 1 bits: x */ - { /*-1*/ -16, 2 }, /* index 1: 2 bits: 1x */ - { /*1*/ -14, 3 }, /* index 2: 3 bits: 11x */ - { 4, 5 }, /* index 3: 4 bits: 111x */ - { /*-2*/ -17, /*2*/ -13 }, /* index 4: 5 bits: 1110x */ - { 6, 7 }, /* index 5: 5 bits: 1111x */ - { /*-3*/ -18, /*3*/ -12 }, /* index 6: 6 bits: 11110x */ - { 8, 9 }, /* index 7: 6 bits: 11111x */ - { /*-4*/ -19, /*4*/ -11 }, /* index 8: 7 bits: 111110x */ - { 10, 11 }, /* index 9: 7 bits: 111111x */ - { /*-5*/ -20, /*5*/ -10 }, /* index 10: 8 bits: 1111110x */ - { 12, 13 }, /* index 11: 8 bits: 1111111x */ - { /*-6*/ -21, /*6*/ -9 }, /* index 12: 9 bits: 11111110x */ - { /*-7*/ -22, 14 }, /* index 13: 9 bits: 11111111x */ - { /*7*/ -8, 15 }, /* index 14: 10 bits: 111111111x */ - { 16, 17 }, /* index 15: 11 bits: 1111111111x */ - { /*-8*/ -23, /*8*/ -7 }, /* index 16: 12 bits: 11111111110x */ - { 18, 19 }, /* index 17: 12 bits: 11111111111x */ - { /*-10*/ -25, 20 }, /* index 18: 13 bits: 111111111110x */ - { 21, 22 }, /* index 19: 13 bits: 111111111111x */ - { /*-9*/ -24, /*9*/ -6 }, /* index 20: 14 bits: 1111111111101x */ - { /*10*/ -5, 23 }, /* index 21: 14 bits: 1111111111110x */ - { 24, 25 }, /* index 22: 14 bits: 1111111111111x */ - { /*-13*/ -28, /*-11*/ -26 }, /* index 23: 15 bits: 11111111111101x */ - { /*11*/ -4, /*13*/ -2 }, /* index 24: 15 bits: 11111111111110x */ - { 26, 27 }, /* index 25: 15 bits: 11111111111111x */ - { /*-14*/ -29, /*-12*/ -27 }, /* index 26: 16 bits: 111111111111110x */ - { /*12*/ -3, /*14*/ -1 } /* index 27: 16 bits: 111111111111111x */ -}; - -static const int8_t t_huffman_pan[][2] = -{ - { /*0*/ -15, 1 }, /* index 0: 1 bits: x */ - { /*-1*/ -16, 2 }, /* index 1: 2 bits: 1x */ - { /*1*/ -14, 3 }, /* index 2: 3 bits: 11x */ - { /*-2*/ -17, 4 }, /* index 3: 4 bits: 111x */ - { /*2*/ -13, 5 }, /* index 4: 5 bits: 1111x */ - { /*-3*/ -18, 6 }, /* index 5: 6 bits: 11111x */ - { /*3*/ -12, 7 }, /* index 6: 7 bits: 111111x */ - { /*-4*/ -19, 8 }, /* index 7: 8 bits: 1111111x */ - { /*4*/ -11, 9 }, /* index 8: 9 bits: 11111111x */ - { 10, 11 }, /* index 9: 10 bits: 111111111x */ - { /*-5*/ -20, /*5*/ -10 }, /* index 10: 11 bits: 1111111110x */ - { 12, 13 }, /* index 11: 11 bits: 1111111111x */ - { /*-6*/ -21, /*6*/ -9 }, /* index 12: 12 bits: 11111111110x */ - { 14, 15 }, /* index 13: 12 bits: 11111111111x */ - { /*-7*/ -22, /*7*/ -8 }, /* index 14: 13 bits: 111111111110x */ - { 16, 17 }, /* index 15: 13 bits: 111111111111x */ - { /*-8*/ -23, /*8*/ -7 }, /* index 16: 14 bits: 1111111111110x */ - { 18, 19 }, /* index 17: 14 bits: 1111111111111x */ - { /*-10*/ -25, /*10*/ -5 }, /* index 18: 15 bits: 11111111111110x */ - { 20, 21 }, /* index 19: 15 bits: 11111111111111x */ - { /*-9*/ -24, /*9*/ -6 }, /* index 20: 16 bits: 111111111111110x */ - { 22, 23 }, /* index 21: 16 bits: 111111111111111x */ - { 24, 25 }, /* index 22: 17 bits: 1111111111111110x */ - { 26, 27 }, /* index 23: 17 bits: 1111111111111111x */ - { /*-14*/ -29, /*-13*/ -28 }, /* index 24: 18 bits: 11111111111111100x */ - { /*-12*/ -27, /*-11*/ -26 }, /* index 25: 18 bits: 11111111111111101x */ - { /*11*/ -4, /*12*/ -3 }, /* index 26: 18 bits: 11111111111111110x */ - { /*13*/ -2, /*14*/ -1 } /* index 27: 18 bits: 11111111111111111x */ -}; - -/* There are 3 classes in the standard but the last 2 are identical */ -static const real_t sa_quant[8][2] = -{ - { FRAC_CONST(0.0000), FRAC_CONST(0.0000) }, - { FRAC_CONST(0.0501), FRAC_CONST(0.1778) }, - { FRAC_CONST(0.0706), FRAC_CONST(0.2818) }, - { FRAC_CONST(0.0995), FRAC_CONST(0.4467) }, - { FRAC_CONST(0.1399), FRAC_CONST(0.5623) }, - { FRAC_CONST(0.1957), FRAC_CONST(0.7079) }, - { FRAC_CONST(0.2713), FRAC_CONST(0.8913) }, - { FRAC_CONST(0.3699), FRAC_CONST(1.0000) }, -}; - -/* We don't need the actual quantizer values */ -#if 0 -static const real_t pan_quant[8][5] = -{ - { COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000) }, - { COEF_CONST(0.1661), COEF_CONST(0.1661), COEF_CONST(0.3322), COEF_CONST(0.3322), COEF_CONST(0.3322) }, - { COEF_CONST(0.3322), COEF_CONST(0.3322), COEF_CONST(0.6644), COEF_CONST(0.8305), COEF_CONST(0.8305) }, - { COEF_CONST(0.4983), COEF_CONST(0.6644), COEF_CONST(0.9966), COEF_CONST(1.4949), COEF_CONST(1.6610) }, - { COEF_CONST(0.6644), COEF_CONST(0.9966), COEF_CONST(1.4949), COEF_CONST(2.1593), COEF_CONST(2.4914) }, - { COEF_CONST(0.8305), COEF_CONST(1.3288), COEF_CONST(2.1593), COEF_CONST(2.9897), COEF_CONST(3.4880) }, - { COEF_CONST(0.9966), COEF_CONST(1.8271), COEF_CONST(2.8236), COEF_CONST(3.8202), COEF_CONST(4.6507) }, - { COEF_CONST(1.3288), COEF_CONST(2.3253), COEF_CONST(3.4880), COEF_CONST(4.6507), COEF_CONST(5.8134) }, -}; -#endif - -/* 2^(pan_quant[x][y] */ -static const real_t pan_pow_2_pos[8][5] = { - { REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000) }, - { REAL_CONST(1.1220021), REAL_CONST(1.1220021), REAL_CONST(1.2589312), REAL_CONST(1.2589312), REAL_CONST(1.2589312) }, - { REAL_CONST(1.2589312), REAL_CONST(1.2589312), REAL_CONST(1.5849090), REAL_CONST(1.7783016), REAL_CONST(1.7783016) }, - { REAL_CONST(1.4125481), REAL_CONST(1.5849090), REAL_CONST(1.9952921), REAL_CONST(2.8184461), REAL_CONST(3.1623565) }, - { REAL_CONST(1.5849090), REAL_CONST(1.9952922), REAL_CONST(2.8184461), REAL_CONST(4.4669806), REAL_CONST(5.6232337) }, - { REAL_CONST(1.7783016), REAL_CONST(2.5119365), REAL_CONST(4.4669806), REAL_CONST(7.9430881), REAL_CONST(11.219994) }, - { REAL_CONST(1.9952921), REAL_CONST(3.5482312), REAL_CONST(7.0792671), REAL_CONST(14.125206), REAL_CONST(25.118876) }, - { REAL_CONST(2.5119365), REAL_CONST(5.0116998), REAL_CONST(11.219994), REAL_CONST(25.118876), REAL_CONST(56.235140) } -}; - -/* 2^(-pan_quant[x][y] */ -static const real_t pan_pow_2_neg[8][5] = { - { REAL_CONST(1), REAL_CONST(1), REAL_CONST(1), REAL_CONST(1), REAL_CONST(1) }, - { REAL_CONST(0.8912487), REAL_CONST(0.8912487), REAL_CONST(0.7943242), REAL_CONST(0.7943242), REAL_CONST(0.7943242) }, - { REAL_CONST(0.7943242), REAL_CONST(0.7943242), REAL_CONST(0.6309511), REAL_CONST(0.5623344), REAL_CONST(0.5623344) }, - { REAL_CONST(0.7079405), REAL_CONST(0.6309511), REAL_CONST(0.5011797), REAL_CONST(0.3548054), REAL_CONST(0.3162199) }, - { REAL_CONST(0.6309511), REAL_CONST(0.5011797), REAL_CONST(0.3548054), REAL_CONST(0.2238649), REAL_CONST(0.1778336) }, - { REAL_CONST(0.5623343), REAL_CONST(0.3980992), REAL_CONST(0.2238649), REAL_CONST(0.1258956), REAL_CONST(0.0891266) }, - { REAL_CONST(0.5011797), REAL_CONST(0.2818306), REAL_CONST(0.1412576), REAL_CONST(0.0707954), REAL_CONST(0.0398107) }, - { REAL_CONST(0.3980992), REAL_CONST(0.1995331), REAL_CONST(0.0891267), REAL_CONST(0.0398107), REAL_CONST(0.0177825) } -}; - -/* 2^(pan_quant[x][y]/30) */ -static const real_t pan_pow_2_30_pos[8][5] = { - { COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) }, - { COEF_CONST(1.003845098), COEF_CONST(1.003845098), COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.007704982) }, - { COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.01546933), COEF_CONST(1.019373909), COEF_CONST(1.019373909) }, - { COEF_CONST(1.011579706), COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.039123167) }, - { COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.051155908), COEF_CONST(1.059252598) }, - { COEF_CONST(1.019373909), COEF_CONST(1.03117796), COEF_CONST(1.051155908), COEF_CONST(1.071518432), COEF_CONST(1.0839263) }, - { COEF_CONST(1.023293502), COEF_CONST(1.043118698), COEF_CONST(1.067414119), COEF_CONST(1.092277933), COEF_CONST(1.113439626) }, - { COEF_CONST(1.03117796), COEF_CONST(1.055195268), COEF_CONST(1.0839263), COEF_CONST(1.113439626), COEF_CONST(1.143756546) } -}; - -/* 2^(-pan_quant[x][y]/30) */ -static const real_t pan_pow_2_30_neg[8][5] = { - { COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) }, - { COEF_CONST(0.99616963), COEF_CONST(0.99616963), COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.99235393) }, - { COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.984766325), COEF_CONST(0.980994305), COEF_CONST(0.980994305) }, - { COEF_CONST(0.988552848), COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.962349827) }, - { COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.951333663), COEF_CONST(0.944061881) }, - { COEF_CONST(0.980994305), COEF_CONST(0.969764715), COEF_CONST(0.951333663), COEF_CONST(0.933255062), COEF_CONST(0.922571949) }, - { COEF_CONST(0.977236734), COEF_CONST(0.958663671), COEF_CONST(0.936843519), COEF_CONST(0.915517901), COEF_CONST(0.898117847) }, - { COEF_CONST(0.969764715), COEF_CONST(0.947691892), COEF_CONST(0.922571949), COEF_CONST(0.898117847), COEF_CONST(0.874311936) } -}; - -static const real_t g_decayslope[MAX_SA_BAND] = { - FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.95),FRAC_CONST(0.9), FRAC_CONST(0.85), FRAC_CONST(0.8), - FRAC_CONST(0.75),FRAC_CONST(0.7), FRAC_CONST(0.65),FRAC_CONST(0.6), FRAC_CONST(0.55),FRAC_CONST(0.5), FRAC_CONST(0.45), - FRAC_CONST(0.4), FRAC_CONST(0.35),FRAC_CONST(0.3), FRAC_CONST(0.25),FRAC_CONST(0.2), FRAC_CONST(0.15), FRAC_CONST(0.1), - FRAC_CONST(0.05),FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), - FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), - FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), - FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0) -}; - -static const real_t sa_sqrt_1_minus[8][2] = { - { FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(0.998744206), FRAC_CONST(0.984066644) }, - { FRAC_CONST(0.997504707), FRAC_CONST(0.959473168) }, - { FRAC_CONST(0.995037562), FRAC_CONST(0.894683804) }, - { FRAC_CONST(0.990165638), FRAC_CONST(0.826933317) }, - { FRAC_CONST(0.980663811), FRAC_CONST(0.706312672) }, - { FRAC_CONST(0.962494836), FRAC_CONST(0.45341406) }, - { FRAC_CONST(0.929071574), FRAC_CONST(0) } -}; - -static const uint8_t sa_freq_scale[9][2] = -{ - { 0, 0}, - { 1, 1}, - { 2, 2}, - { 3, 3}, - { 5, 5}, - { 7, 7}, - {10,10}, - {13,13}, - {46,23} -}; - -static const uint8_t pan_freq_scale[21] = -{ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 18, 22, 26, 32, 64 -}; - -static const uint8_t pan_quant_class[20] = -{ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 3, 3, 3, 4, 4, 4 -}; - -/* Inverse mapping lookup */ -static const uint8_t pan_inv_freq[64] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19 -}; - -static const uint8_t sa_inv_freq[MAX_SA_BAND] = { - 0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7 -}; - -static const real_t filter_coeff[] = -{ - FRAC_CONST(0.65143905754106), - FRAC_CONST(0.56471812200776), - FRAC_CONST(0.48954165955695) -}; - -static const uint8_t delay_length[][2] = -{ - { 1, 3 }, { 2, 4 }, { 3, 5 } -}; - -static const real_t delay_fraction[] = -{ - FRAC_CONST(0.43), FRAC_CONST(0.75), FRAC_CONST(0.347) -}; - -static const real_t peak_decay[2] = -{ - FRAC_CONST(0.58664621951003), FRAC_CONST(0.76592833836465) -}; - -static const real_t smooth_coeff[2] = -{ - FRAC_CONST(0.6), FRAC_CONST(0.25) -}; - -/* Please note that these are the same tables as in plain PS */ -static const complex_t Q_Fract_allpass_Qmf[][3] = { - { { FRAC_CONST(0.7804303765), FRAC_CONST(0.6252426505) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.8550928831), FRAC_CONST(0.5184748173) } }, - { { FRAC_CONST(-0.4399392009), FRAC_CONST(0.8980275393) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.0643581524), FRAC_CONST(0.9979268909) } }, - { { FRAC_CONST(-0.9723699093), FRAC_CONST(-0.2334454209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.9146071672), FRAC_CONST(0.4043435752) } }, - { { FRAC_CONST(0.0157073960), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7814115286), FRAC_CONST(-0.6240159869) } }, - { { FRAC_CONST(0.9792228341), FRAC_CONST(-0.2027871907) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.1920081824), FRAC_CONST(-0.9813933372) } }, - { { FRAC_CONST(0.4115142524), FRAC_CONST(0.9114032984) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9589683414), FRAC_CONST(-0.2835132182) } }, - { { FRAC_CONST(-0.7996847630), FRAC_CONST(0.6004201174) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.6947838664), FRAC_CONST(0.7192186117) } }, - { { FRAC_CONST(-0.7604058385), FRAC_CONST(-0.6494481564) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3164770305), FRAC_CONST(0.9486001730) } }, - { { FRAC_CONST(0.4679299891), FRAC_CONST(-0.8837655187) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9874414206), FRAC_CONST(0.1579856575) } }, - { { FRAC_CONST(0.9645573497), FRAC_CONST(0.2638732493) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.5966450572), FRAC_CONST(-0.8025052547) } }, - { { FRAC_CONST(-0.0471066870), FRAC_CONST(0.9988898635) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.4357025325), FRAC_CONST(-0.9000906944) } }, - { { FRAC_CONST(-0.9851093888), FRAC_CONST(0.1719288528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9995546937), FRAC_CONST(-0.0298405960) } }, - { { FRAC_CONST(-0.3826831877), FRAC_CONST(-0.9238796234) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.4886211455), FRAC_CONST(0.8724960685) } }, - { { FRAC_CONST(0.8181498647), FRAC_CONST(-0.5750049949) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.5477093458), FRAC_CONST(0.8366686702) } }, - { { FRAC_CONST(0.7396308780), FRAC_CONST(0.6730127335) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9951074123), FRAC_CONST(-0.0987988561) } }, - { { FRAC_CONST(-0.4954589605), FRAC_CONST(0.8686313629) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3725017905), FRAC_CONST(-0.9280315042) } }, - { { FRAC_CONST(-0.9557929039), FRAC_CONST(-0.2940406799) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.6506417990), FRAC_CONST(-0.7593847513) } }, - { { FRAC_CONST(0.0784594864), FRAC_CONST(-0.9969173074) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9741733670), FRAC_CONST(0.2258014232) } }, - { { FRAC_CONST(0.9900237322), FRAC_CONST(-0.1409008205) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.2502108514), FRAC_CONST(0.9681913853) } }, - { { FRAC_CONST(0.3534744382), FRAC_CONST(0.9354441762) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7427945137), FRAC_CONST(0.6695194840) } }, - { { FRAC_CONST(-0.8358076215), FRAC_CONST(0.5490224361) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9370992780), FRAC_CONST(-0.3490629196) } }, - { { FRAC_CONST(-0.7181259394), FRAC_CONST(-0.6959131360) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.1237744763), FRAC_CONST(-0.9923103452) } }, - { { FRAC_CONST(0.5224990249), FRAC_CONST(-0.8526399136) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.8226406574), FRAC_CONST(-0.5685616732) } }, - { { FRAC_CONST(0.9460852146), FRAC_CONST(0.3239179254) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.8844994903), FRAC_CONST(0.4665412009) } }, - { { FRAC_CONST(-0.1097348556), FRAC_CONST(0.9939609170) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.0047125919), FRAC_CONST(0.9999889135) } }, - { { FRAC_CONST(-0.9939610362), FRAC_CONST(0.1097337380) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8888573647), FRAC_CONST(0.4581840038) } }, - { { FRAC_CONST(-0.3239168525), FRAC_CONST(-0.9460855722) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8172453642), FRAC_CONST(-0.5762898922) } }, - { { FRAC_CONST(0.8526405096), FRAC_CONST(-0.5224980116) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.1331215799), FRAC_CONST(-0.9910997152) } }, - { { FRAC_CONST(0.6959123611), FRAC_CONST(0.7181267142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9403476119), FRAC_CONST(-0.3402152061) } }, - { { FRAC_CONST(-0.5490233898), FRAC_CONST(0.8358070254) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7364512086), FRAC_CONST(0.6764906645) } }, - { { FRAC_CONST(-0.9354437590), FRAC_CONST(-0.3534754813) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2593250275), FRAC_CONST(0.9657900929) } }, - { { FRAC_CONST(0.1409019381), FRAC_CONST(-0.9900235534) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9762582779), FRAC_CONST(0.2166097313) } }, - { { FRAC_CONST(0.9969173670), FRAC_CONST(-0.0784583688) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.6434556246), FRAC_CONST(-0.7654833794) } }, - { { FRAC_CONST(0.2940396070), FRAC_CONST(0.9557932615) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3812320232), FRAC_CONST(-0.9244794250) } }, - { { FRAC_CONST(-0.8686318994), FRAC_CONST(0.4954580069) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9959943891), FRAC_CONST(-0.0894154981) } }, - { { FRAC_CONST(-0.6730118990), FRAC_CONST(-0.7396316528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.5397993922), FRAC_CONST(0.8417937160) } }, - { { FRAC_CONST(0.5750059485), FRAC_CONST(-0.8181492686) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.4968227744), FRAC_CONST(0.8678520322) } }, - { { FRAC_CONST(0.9238792062), FRAC_CONST(0.3826842010) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9992290139), FRAC_CONST(-0.0392601527) } }, - { { FRAC_CONST(-0.1719299555), FRAC_CONST(0.9851091504) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4271997511), FRAC_CONST(-0.9041572809) } }, - { { FRAC_CONST(-0.9988899231), FRAC_CONST(0.0471055657) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.6041822433), FRAC_CONST(-0.7968461514) } }, - { { FRAC_CONST(-0.2638721764), FRAC_CONST(-0.9645576477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9859085083), FRAC_CONST(0.1672853529) } }, - { { FRAC_CONST(0.8837660551), FRAC_CONST(-0.4679289758) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3075223565), FRAC_CONST(0.9515408874) } }, - { { FRAC_CONST(0.6494473219), FRAC_CONST(0.7604066133) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.7015317082), FRAC_CONST(0.7126382589) } }, - { { FRAC_CONST(-0.6004210114), FRAC_CONST(0.7996840477) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9562535882), FRAC_CONST(-0.2925389707) } }, - { { FRAC_CONST(-0.9114028811), FRAC_CONST(-0.4115152657) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.1827499419), FRAC_CONST(-0.9831594229) } }, - { { FRAC_CONST(0.2027882934), FRAC_CONST(-0.9792225957) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7872582674), FRAC_CONST(-0.6166234016) } }, - { { FRAC_CONST(0.9998766780), FRAC_CONST(-0.0157062728) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9107555747), FRAC_CONST(0.4129458666) } }, - { { FRAC_CONST(0.2334443331), FRAC_CONST(0.9723701477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.0549497530), FRAC_CONST(0.9984891415) } }, - { { FRAC_CONST(-0.8980280757), FRAC_CONST(0.4399381876) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.8599416018), FRAC_CONST(0.5103924870) } }, - { { FRAC_CONST(-0.6252418160), FRAC_CONST(-0.7804310918) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8501682281), FRAC_CONST(-0.5265110731) } }, - { { FRAC_CONST(0.6252435446), FRAC_CONST(-0.7804297209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.0737608299), FRAC_CONST(-0.9972759485) } }, - { { FRAC_CONST(0.8980270624), FRAC_CONST(0.4399402142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9183775187), FRAC_CONST(-0.3957053721) } }, - { { FRAC_CONST(-0.2334465086), FRAC_CONST(0.9723696709) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.7754954696), FRAC_CONST(0.6313531399) } }, - { { FRAC_CONST(-0.9998766184), FRAC_CONST(-0.0157085191) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2012493610), FRAC_CONST(0.9795400500) } }, - { { FRAC_CONST(-0.2027861029), FRAC_CONST(-0.9792230725) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9615978599), FRAC_CONST(0.2744622827) } }, - { { FRAC_CONST(0.9114037752), FRAC_CONST(-0.4115132093) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.6879743338), FRAC_CONST(-0.7257350087) } }, - { { FRAC_CONST(0.6004192233), FRAC_CONST(0.7996854186) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.3254036009), FRAC_CONST(-0.9455752373) } }, - { { FRAC_CONST(-0.6494490504), FRAC_CONST(0.7604051232) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9888865948), FRAC_CONST(-0.1486719251) } }, - { { FRAC_CONST(-0.8837650418), FRAC_CONST(-0.4679309726) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.5890548825), FRAC_CONST(0.8080930114) } }, - { { FRAC_CONST(0.2638743520), FRAC_CONST(-0.9645570517) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.4441666007), FRAC_CONST(0.8959442377) } }, - { { FRAC_CONST(0.9988898039), FRAC_CONST(0.0471078083) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9997915030), FRAC_CONST(0.0204183888) } }, - { { FRAC_CONST(0.1719277352), FRAC_CONST(0.9851095676) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4803760946), FRAC_CONST(-0.8770626187) } }, - { { FRAC_CONST(-0.9238800406), FRAC_CONST(0.3826821446) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.5555707216), FRAC_CONST(-0.8314692974) } }, - { { FRAC_CONST(-0.5750041008), FRAC_CONST(-0.8181505203) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9941320419), FRAC_CONST(0.1081734300) } } -}; - -static const complex_t Phi_Fract_Qmf[] = { - { FRAC_CONST(0.8181497455), FRAC_CONST(0.5750052333) }, - { FRAC_CONST(-0.2638730407), FRAC_CONST(0.9645574093) }, - { FRAC_CONST(-0.9969173074), FRAC_CONST(0.0784590989) }, - { FRAC_CONST(-0.4115143716), FRAC_CONST(-0.9114032984) }, - { FRAC_CONST(0.7181262970), FRAC_CONST(-0.6959127784) }, - { FRAC_CONST(0.8980275989), FRAC_CONST(0.4399391711) }, - { FRAC_CONST(-0.1097343117), FRAC_CONST(0.9939609766) }, - { FRAC_CONST(-0.9723699093), FRAC_CONST(0.2334453613) }, - { FRAC_CONST(-0.5490227938), FRAC_CONST(-0.8358073831) }, - { FRAC_CONST(0.6004202366), FRAC_CONST(-0.7996846437) }, - { FRAC_CONST(0.9557930231), FRAC_CONST(0.2940403223) }, - { FRAC_CONST(0.0471064523), FRAC_CONST(0.9988898635) }, - { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, - { FRAC_CONST(-0.6730124950), FRAC_CONST(-0.7396311164) }, - { FRAC_CONST(0.4679298103), FRAC_CONST(-0.8837656379) }, - { FRAC_CONST(0.9900236726), FRAC_CONST(0.1409012377) }, - { FRAC_CONST(0.2027872950), FRAC_CONST(0.9792228341) }, - { FRAC_CONST(-0.8526401520), FRAC_CONST(0.5224985480) }, - { FRAC_CONST(-0.7804304361), FRAC_CONST(-0.6252426505) }, - { FRAC_CONST(0.3239174187), FRAC_CONST(-0.9460853338) }, - { FRAC_CONST(0.9998766184), FRAC_CONST(-0.0157073177) }, - { FRAC_CONST(0.3534748554), FRAC_CONST(0.9354440570) }, - { FRAC_CONST(-0.7604059577), FRAC_CONST(0.6494480371) }, - { FRAC_CONST(-0.8686315417), FRAC_CONST(-0.4954586625) }, - { FRAC_CONST(0.1719291061), FRAC_CONST(-0.9851093292) }, - { FRAC_CONST(0.9851093292), FRAC_CONST(-0.1719291061) }, - { FRAC_CONST(0.4954586625), FRAC_CONST(0.8686315417) }, - { FRAC_CONST(-0.6494480371), FRAC_CONST(0.7604059577) }, - { FRAC_CONST(-0.9354440570), FRAC_CONST(-0.3534748554) }, - { FRAC_CONST(0.0157073177), FRAC_CONST(-0.9998766184) }, - { FRAC_CONST(0.9460853338), FRAC_CONST(-0.3239174187) }, - { FRAC_CONST(0.6252426505), FRAC_CONST(0.7804304361) }, - { FRAC_CONST(-0.5224985480), FRAC_CONST(0.8526401520) }, - { FRAC_CONST(-0.9792228341), FRAC_CONST(-0.2027872950) }, - { FRAC_CONST(-0.1409012377), FRAC_CONST(-0.9900236726) }, - { FRAC_CONST(0.8837656379), FRAC_CONST(-0.4679298103) }, - { FRAC_CONST(0.7396311164), FRAC_CONST(0.6730124950) }, - { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, - { FRAC_CONST(-0.9988898635), FRAC_CONST(-0.0471064523) }, - { FRAC_CONST(-0.2940403223), FRAC_CONST(-0.9557930231) }, - { FRAC_CONST(0.7996846437), FRAC_CONST(-0.6004202366) }, - { FRAC_CONST(0.8358073831), FRAC_CONST(0.5490227938) }, - { FRAC_CONST(-0.2334453613), FRAC_CONST(0.9723699093) }, - { FRAC_CONST(-0.9939609766), FRAC_CONST(0.1097343117) }, - { FRAC_CONST(-0.4399391711), FRAC_CONST(-0.8980275989) }, - { FRAC_CONST(0.6959127784), FRAC_CONST(-0.7181262970) }, - { FRAC_CONST(0.9114032984), FRAC_CONST(0.4115143716) }, - { FRAC_CONST(-0.0784590989), FRAC_CONST(0.9969173074) }, - { FRAC_CONST(-0.9645574093), FRAC_CONST(0.2638730407) }, - { FRAC_CONST(-0.5750052333), FRAC_CONST(-0.8181497455) }, - { FRAC_CONST(0.5750052333), FRAC_CONST(-0.8181497455) }, - { FRAC_CONST(0.9645574093), FRAC_CONST(0.2638730407) }, - { FRAC_CONST(0.0784590989), FRAC_CONST(0.9969173074) }, - { FRAC_CONST(-0.9114032984), FRAC_CONST(0.4115143716) }, - { FRAC_CONST(-0.6959127784), FRAC_CONST(-0.7181262970) }, - { FRAC_CONST(0.4399391711), FRAC_CONST(-0.8980275989) }, - { FRAC_CONST(0.9939609766), FRAC_CONST(0.1097343117) }, - { FRAC_CONST(0.2334453613), FRAC_CONST(0.9723699093) }, - { FRAC_CONST(-0.8358073831), FRAC_CONST(0.5490227938) }, - { FRAC_CONST(-0.7996846437), FRAC_CONST(-0.6004202366) }, - { FRAC_CONST(0.2940403223), FRAC_CONST(-0.9557930231) }, - { FRAC_CONST(0.9988898635), FRAC_CONST(-0.0471064523) }, - { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, - { FRAC_CONST(-0.7396311164), FRAC_CONST(0.6730124950) } -}; - - -/* static function declarations */ -static void drm_ps_sa_element(drm_ps_info *ps, bitfile *ld); -static void drm_ps_pan_element(drm_ps_info *ps, bitfile *ld); -static int8_t huff_dec(bitfile *ld, drm_ps_huff_tab huff); - - -uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld) -{ - uint16_t bits = (uint16_t)faad_get_processed_bits(ld); - - ps->drm_ps_data_available = 1; - - ps->bs_enable_sa = faad_get1bit(ld); - ps->bs_enable_pan = faad_get1bit(ld); - - if (ps->bs_enable_sa) - { - drm_ps_sa_element(ps, ld); - } - - if (ps->bs_enable_pan) - { - drm_ps_pan_element(ps, ld); - } - - bits = (uint16_t)faad_get_processed_bits(ld) - bits; - - return bits; -} - -static void drm_ps_sa_element(drm_ps_info *ps, bitfile *ld) -{ - drm_ps_huff_tab huff; - uint8_t band; - - ps->bs_sa_dt_flag = faad_get1bit(ld); - if (ps->bs_sa_dt_flag) - { - huff = t_huffman_sa; - } else { - huff = f_huffman_sa; - } - - for (band = 0; band < DRM_NUM_SA_BANDS; band++) - { - ps->bs_sa_data[band] = huff_dec(ld, huff); - } -} - -static void drm_ps_pan_element(drm_ps_info *ps, bitfile *ld) -{ - drm_ps_huff_tab huff; - uint8_t band; - - ps->bs_pan_dt_flag = faad_get1bit(ld); - if (ps->bs_pan_dt_flag) - { - huff = t_huffman_pan; - } else { - huff = f_huffman_pan; - } - - for (band = 0; band < DRM_NUM_PAN_BANDS; band++) - { - ps->bs_pan_data[band] = huff_dec(ld, huff); - } -} - -/* binary search huffman decoding */ -static int8_t huff_dec(bitfile *ld, drm_ps_huff_tab huff) -{ - uint8_t bit; - int16_t index = 0; - - while (index >= 0) - { - bit = (uint8_t)faad_get1bit(ld); - index = huff[index][bit]; - } - - return index + 15; -} - - -static int8_t sa_delta_clip(drm_ps_info *ps, int8_t i) -{ - if (i < 0) { - /* printf(" SAminclip %d", i); */ - ps->sa_decode_error = 1; - return 0; - } else if (i > 7) { - /* printf(" SAmaxclip %d", i); */ - ps->sa_decode_error = 1; - return 7; - } else - return i; -} - -static int8_t pan_delta_clip(drm_ps_info *ps, int8_t i) -{ - if (i < -7) { - /* printf(" PANminclip %d", i); */ - ps->pan_decode_error = 1; - return -7; - } else if (i > 7) { - /* printf(" PANmaxclip %d", i); */ - ps->pan_decode_error = 1; - return 7; - } else - return i; -} - -static void drm_ps_delta_decode(drm_ps_info *ps) -{ - uint8_t band; - - if (ps->bs_enable_sa) - { - if (ps->bs_sa_dt_flag && !ps->g_last_had_sa) - { - for (band = 0; band < DRM_NUM_SA_BANDS; band++) - { - ps->g_prev_sa_index[band] = 0; - } - } - if (ps->bs_sa_dt_flag) - { - ps->g_sa_index[0] = sa_delta_clip(ps, ps->g_prev_sa_index[0]+ps->bs_sa_data[0]); - - } else { - ps->g_sa_index[0] = sa_delta_clip(ps,ps->bs_sa_data[0]); - } - - for (band = 1; band < DRM_NUM_SA_BANDS; band++) - { - if (ps->bs_sa_dt_flag) - { - ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_prev_sa_index[band] + ps->bs_sa_data[band]); - } else { - ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_sa_index[band-1] + ps->bs_sa_data[band]); - } - } - } - - /* An error during SA decoding implies PAN data will be undecodable, too */ - /* Also, we don't like on/off switching in PS, so we force to last settings */ - if (ps->sa_decode_error) { - ps->pan_decode_error = 1; - ps->bs_enable_pan = ps->g_last_had_pan; - ps->bs_enable_sa = ps->g_last_had_sa; - } - - - if (ps->bs_enable_sa) - { - if (ps->sa_decode_error) { - for (band = 0; band < DRM_NUM_SA_BANDS; band++) - { - ps->g_sa_index[band] = ps->g_last_good_sa_index[band]; - } - } else { - for (band = 0; band < DRM_NUM_SA_BANDS; band++) - { - ps->g_last_good_sa_index[band] = ps->g_sa_index[band]; - } - } - } - - if (ps->bs_enable_pan) - { - if (ps->bs_pan_dt_flag && !ps->g_last_had_pan) - { -/* The DRM PS spec doesn't say anything about this case. (deltacoded in time without a previous frame) - AAC PS spec you must tread previous frame as 0, so that's what we try. -*/ - for (band = 0; band < DRM_NUM_PAN_BANDS; band++) - { - ps->g_prev_pan_index[band] = 0; - } - } - - if (ps->bs_pan_dt_flag) - { - ps->g_pan_index[0] = pan_delta_clip(ps, ps->g_prev_pan_index[0]+ps->bs_pan_data[0]); - } else { - ps->g_pan_index[0] = pan_delta_clip(ps, ps->bs_pan_data[0]); - } - - for (band = 1; band < DRM_NUM_PAN_BANDS; band++) - { - if (ps->bs_pan_dt_flag) - { - ps->g_pan_index[band] = pan_delta_clip(ps, ps->g_prev_pan_index[band] + ps->bs_pan_data[band]); - } else { - ps->g_pan_index[band] = pan_delta_clip(ps, ps->g_pan_index[band-1] + ps->bs_pan_data[band]); - } - } - - if (ps->pan_decode_error) { - for (band = 0; band < DRM_NUM_PAN_BANDS; band++) - { - ps->g_pan_index[band] = ps->g_last_good_pan_index[band]; - } - } else { - for (band = 0; band < DRM_NUM_PAN_BANDS; band++) - { - ps->g_last_good_pan_index[band] = ps->g_pan_index[band]; - } - } - } -} - -static void drm_calc_sa_side_signal(drm_ps_info *ps, qmf_t X[38][64], uint8_t rateselect) -{ - uint8_t s, b, k; - complex_t qfrac, tmp0, tmp, in, R0; - real_t peakdiff; - real_t nrg; - real_t power; - real_t transratio; - real_t new_delay_slopes[NUM_OF_LINKS]; - uint8_t temp_delay_ser[NUM_OF_LINKS]; - complex_t Phi_Fract; -#ifdef FIXED_POINT - uint32_t in_re, in_im; -#endif - - for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS][rateselect]; b++) - { - /* set delay indices */ - for (k = 0; k < NUM_OF_LINKS; k++) - temp_delay_ser[k] = ps->delay_buf_index_ser[k]; - - RE(Phi_Fract) = RE(Phi_Fract_Qmf[b]); - IM(Phi_Fract) = IM(Phi_Fract_Qmf[b]); - - for (s = 0; s < NUM_OF_SUBSAMPLES; s++) - { - const real_t gamma = REAL_CONST(1.5); - const real_t sigma = REAL_CONST(1.5625); - - RE(in) = QMF_RE(X[s][b]); - IM(in) = QMF_IM(X[s][b]); - -#ifdef FIXED_POINT - /* NOTE: all input is scaled by 2^(-5) because of fixed point QMF - * meaning that P will be scaled by 2^(-10) compared to floating point version - */ - in_re = ((abs(RE(in))+(1<<(REAL_BITS-1)))>>REAL_BITS); - in_im = ((abs(IM(in))+(1<<(REAL_BITS-1)))>>REAL_BITS); - power = in_re*in_re + in_im*in_im; -#else - power = MUL_R(RE(in),RE(in)) + MUL_R(IM(in),IM(in)); -#endif - - ps->peakdecay_fast[b] = MUL_F(ps->peakdecay_fast[b], peak_decay[rateselect]); - if (ps->peakdecay_fast[b] < power) - ps->peakdecay_fast[b] = power; - - peakdiff = ps->prev_peakdiff[b]; - peakdiff += MUL_F((ps->peakdecay_fast[b] - power - ps->prev_peakdiff[b]), smooth_coeff[rateselect]); - ps->prev_peakdiff[b] = peakdiff; - - nrg = ps->prev_nrg[b]; - nrg += MUL_F((power - ps->prev_nrg[b]), smooth_coeff[rateselect]); - ps->prev_nrg[b] = nrg; - - if (MUL_R(peakdiff, gamma) <= nrg) { - transratio = sigma; - } else { - transratio = MUL_R(DIV_R(nrg, MUL_R(peakdiff, gamma)), sigma); - } - - for (k = 0; k < NUM_OF_LINKS; k++) - { - new_delay_slopes[k] = MUL_F(g_decayslope[b], filter_coeff[k]); - } - - RE(tmp0) = RE(ps->d_buff[0][b]); - IM(tmp0) = IM(ps->d_buff[0][b]); - - RE(ps->d_buff[0][b]) = RE(ps->d_buff[1][b]); - IM(ps->d_buff[0][b]) = IM(ps->d_buff[1][b]); - - RE(ps->d_buff[1][b]) = RE(in); - IM(ps->d_buff[1][b]) = IM(in); - - ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Phi_Fract), IM(Phi_Fract)); - - RE(R0) = RE(tmp); - IM(R0) = IM(tmp); - - for (k = 0; k < NUM_OF_LINKS; k++) - { - RE(qfrac) = RE(Q_Fract_allpass_Qmf[b][k]); - IM(qfrac) = IM(Q_Fract_allpass_Qmf[b][k]); - - RE(tmp0) = RE(ps->d2_buff[k][temp_delay_ser[k]][b]); - IM(tmp0) = IM(ps->d2_buff[k][temp_delay_ser[k]][b]); - - ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(qfrac), IM(qfrac)); - - RE(tmp) += -MUL_F(new_delay_slopes[k], RE(R0)); - IM(tmp) += -MUL_F(new_delay_slopes[k], IM(R0)); - - RE(ps->d2_buff[k][temp_delay_ser[k]][b]) = RE(R0) + MUL_F(new_delay_slopes[k], RE(tmp)); - IM(ps->d2_buff[k][temp_delay_ser[k]][b]) = IM(R0) + MUL_F(new_delay_slopes[k], IM(tmp)); - - RE(R0) = RE(tmp); - IM(R0) = IM(tmp); - } - - QMF_RE(ps->SA[s][b]) = MUL_R(RE(R0), transratio); - QMF_IM(ps->SA[s][b]) = MUL_R(IM(R0), transratio); - - for (k = 0; k < NUM_OF_LINKS; k++) - { - if (++temp_delay_ser[k] >= delay_length[k][rateselect]) - temp_delay_ser[k] = 0; - } - } - } - - for (k = 0; k < NUM_OF_LINKS; k++) - ps->delay_buf_index_ser[k] = temp_delay_ser[k]; -} - -static void drm_add_ambiance(drm_ps_info *ps, uint8_t rateselect, qmf_t X_left[38][64], qmf_t X_right[38][64]) -{ - uint8_t s, b, ifreq, qclass; - real_t sa_map[MAX_SA_BAND], sa_dir_map[MAX_SA_BAND], k_sa_map[MAX_SA_BAND], k_sa_dir_map[MAX_SA_BAND]; - real_t new_dir_map, new_sa_map; - - if (ps->bs_enable_sa) - { - /* Instead of dequantization and mapping, we use an inverse mapping - to look up all the values we need */ - for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS][rateselect]; b++) - { - const real_t inv_f_num_of_subsamples = FRAC_CONST(0.03333333333); - - ifreq = sa_inv_freq[b]; - qclass = (b != 0); - - sa_map[b] = sa_quant[ps->g_prev_sa_index[ifreq]][qclass]; - new_sa_map = sa_quant[ps->g_sa_index[ifreq]][qclass]; - - k_sa_map[b] = MUL_F(inv_f_num_of_subsamples, (new_sa_map - sa_map[b])); - - sa_dir_map[b] = sa_sqrt_1_minus[ps->g_prev_sa_index[ifreq]][qclass]; - new_dir_map = sa_sqrt_1_minus[ps->g_sa_index[ifreq]][qclass]; - - k_sa_dir_map[b] = MUL_F(inv_f_num_of_subsamples, (new_dir_map - sa_dir_map[b])); - - } - - for (s = 0; s < NUM_OF_SUBSAMPLES; s++) - { - for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS][rateselect]; b++) - { - QMF_RE(X_right[s][b]) = MUL_F(QMF_RE(X_left[s][b]), sa_dir_map[b]) - MUL_F(QMF_RE(ps->SA[s][b]), sa_map[b]); - QMF_IM(X_right[s][b]) = MUL_F(QMF_IM(X_left[s][b]), sa_dir_map[b]) - MUL_F(QMF_IM(ps->SA[s][b]), sa_map[b]); - QMF_RE(X_left[s][b]) = MUL_F(QMF_RE(X_left[s][b]), sa_dir_map[b]) + MUL_F(QMF_RE(ps->SA[s][b]), sa_map[b]); - QMF_IM(X_left[s][b]) = MUL_F(QMF_IM(X_left[s][b]), sa_dir_map[b]) + MUL_F(QMF_IM(ps->SA[s][b]), sa_map[b]); - - sa_map[b] += k_sa_map[b]; - sa_dir_map[b] += k_sa_dir_map[b]; - } - for (b = sa_freq_scale[DRM_NUM_SA_BANDS][rateselect]; b < NUM_OF_QMF_CHANNELS; b++) - { - QMF_RE(X_right[s][b]) = QMF_RE(X_left[s][b]); - QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]); - } - } - } - else { - for (s = 0; s < NUM_OF_SUBSAMPLES; s++) - { - for (b = 0; b < NUM_OF_QMF_CHANNELS; b++) - { - QMF_RE(X_right[s][b]) = QMF_RE(X_left[s][b]); - QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]); - } - } - } -} - -static void drm_add_pan(drm_ps_info *ps, uint8_t rateselect, qmf_t X_left[38][64], qmf_t X_right[38][64]) -{ - uint8_t s, b, qclass, ifreq; - real_t tmp, coeff1, coeff2; - real_t pan_base[MAX_PAN_BAND]; - real_t pan_delta[MAX_PAN_BAND]; - qmf_t temp_l, temp_r; - - if (ps->bs_enable_pan) - { - for (b = 0; b < NUM_OF_QMF_CHANNELS; b++) - { - /* Instead of dequantization, 20->64 mapping and 2^G(x,y) we do an - inverse mapping 64->20 and look up the 2^G(x,y) values directly */ - ifreq = pan_inv_freq[b]; - qclass = pan_quant_class[ifreq]; - - if (ps->g_prev_pan_index[ifreq] >= 0) - { - pan_base[b] = pan_pow_2_pos[ps->g_prev_pan_index[ifreq]][qclass]; - } else { - pan_base[b] = pan_pow_2_neg[-ps->g_prev_pan_index[ifreq]][qclass]; - } - - /* 2^((a-b)/30) = 2^(a/30) * 1/(2^(b/30)) */ - /* a en b can be negative so we may need to inverse parts */ - if (ps->g_pan_index[ifreq] >= 0) - { - if (ps->g_prev_pan_index[ifreq] >= 0) - { - pan_delta[b] = MUL_C(pan_pow_2_30_pos[ps->g_pan_index[ifreq]][qclass], - pan_pow_2_30_neg[ps->g_prev_pan_index[ifreq]][qclass]); - } else { - pan_delta[b] = MUL_C(pan_pow_2_30_pos[ps->g_pan_index[ifreq]][qclass], - pan_pow_2_30_pos[-ps->g_prev_pan_index[ifreq]][qclass]); - } - } else { - if (ps->g_prev_pan_index[ifreq] >= 0) - { - pan_delta[b] = MUL_C(pan_pow_2_30_neg[-ps->g_pan_index[ifreq]][qclass], - pan_pow_2_30_neg[ps->g_prev_pan_index[ifreq]][qclass]); - } else { - pan_delta[b] = MUL_C(pan_pow_2_30_neg[-ps->g_pan_index[ifreq]][qclass], - pan_pow_2_30_pos[-ps->g_prev_pan_index[ifreq]][qclass]); - } - } - } - - for (s = 0; s < NUM_OF_SUBSAMPLES; s++) - { - /* PAN always uses all 64 channels */ - for (b = 0; b < NUM_OF_QMF_CHANNELS; b++) - { - tmp = pan_base[b]; - - coeff2 = DIV_R(REAL_CONST(2.0), (REAL_CONST(1.0) + tmp)); - coeff1 = MUL_R(coeff2, tmp); - - QMF_RE(temp_l) = QMF_RE(X_left[s][b]); - QMF_IM(temp_l) = QMF_IM(X_left[s][b]); - QMF_RE(temp_r) = QMF_RE(X_right[s][b]); - QMF_IM(temp_r) = QMF_IM(X_right[s][b]); - - QMF_RE(X_left[s][b]) = MUL_R(QMF_RE(temp_l), coeff1); - QMF_IM(X_left[s][b]) = MUL_R(QMF_IM(temp_l), coeff1); - QMF_RE(X_right[s][b]) = MUL_R(QMF_RE(temp_r), coeff2); - QMF_IM(X_right[s][b]) = MUL_R(QMF_IM(temp_r), coeff2); - - /* 2^(a+k*b) = 2^a * 2^b * ... * 2^b */ - /* ^^^^^^^^^^^^^^^ k times */ - pan_base[b] = MUL_C(pan_base[b], pan_delta[b]); - } - } - } -} - -drm_ps_info *drm_ps_init(void) -{ - drm_ps_info *ps = (drm_ps_info*)faad_malloc(sizeof(drm_ps_info)); - - memset(ps, 0, sizeof(drm_ps_info)); - - return ps; -} - -void drm_ps_free(drm_ps_info *ps) -{ - faad_free(ps); -} - -/* main DRM PS decoding function */ -uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, uint32_t samplerate, qmf_t X_left[38][64], qmf_t X_right[38][64]) -{ - uint8_t rateselect = (samplerate >= 24000); - - if (ps == NULL) - { - memcpy(X_right, X_left, sizeof(qmf_t)*30*64); - return 0; - } - - if (!ps->drm_ps_data_available && !guess) - { - memcpy(X_right, X_left, sizeof(qmf_t)*30*64); - memset(ps->g_prev_sa_index, 0, sizeof(ps->g_prev_sa_index)); - memset(ps->g_prev_pan_index, 0, sizeof(ps->g_prev_pan_index)); - return 0; - } - - /* if SBR CRC doesn't match out, we can assume decode errors to start with, - and we'll guess what the parameters should be */ - if (!guess) - { - ps->sa_decode_error = 0; - ps->pan_decode_error = 0; - drm_ps_delta_decode(ps); - } else - { - ps->sa_decode_error = 1; - ps->pan_decode_error = 1; - /* don't even bother decoding */ - } - - ps->drm_ps_data_available = 0; - - drm_calc_sa_side_signal(ps, X_left, rateselect); - drm_add_ambiance(ps, rateselect, X_left, X_right); - - if (ps->bs_enable_sa) - { - ps->g_last_had_sa = 1; - - memcpy(ps->g_prev_sa_index, ps->g_sa_index, sizeof(int8_t) * DRM_NUM_SA_BANDS); - - } else { - ps->g_last_had_sa = 0; - } - - if (ps->bs_enable_pan) - { - drm_add_pan(ps, rateselect, X_left, X_right); - - ps->g_last_had_pan = 1; - - memcpy(ps->g_prev_pan_index, ps->g_pan_index, sizeof(int8_t) * DRM_NUM_PAN_BANDS); - - } else { - ps->g_last_had_pan = 0; - } - - - return 0; -} - -#endif diff --git a/mplayer/libfaad2/drm_dec.h b/mplayer/libfaad2/drm_dec.h deleted file mode 100644 index 8e8f100a..00000000 --- a/mplayer/libfaad2/drm_dec.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: drm_dec.h 29306 2009-05-13 15:22:13Z bircoph $ -**/ - -#ifndef __DRM_DEC_H__ -#define __DRM_DEC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "bits.h" - -#define DRM_PARAMETRIC_STEREO 0 -#define DRM_NUM_SA_BANDS 8 -#define DRM_NUM_PAN_BANDS 20 -#define NUM_OF_LINKS 3 -#define NUM_OF_QMF_CHANNELS 64 -#define NUM_OF_SUBSAMPLES 30 -#define MAX_SA_BAND 46 -#define MAX_PAN_BAND 64 -#define MAX_DELAY 5 - -typedef struct -{ - uint8_t drm_ps_data_available; - uint8_t bs_enable_sa; - uint8_t bs_enable_pan; - - uint8_t bs_sa_dt_flag; - uint8_t bs_pan_dt_flag; - - uint8_t g_last_had_sa; - uint8_t g_last_had_pan; - - int8_t bs_sa_data[DRM_NUM_SA_BANDS]; - int8_t bs_pan_data[DRM_NUM_PAN_BANDS]; - - int8_t g_sa_index[DRM_NUM_SA_BANDS]; - int8_t g_pan_index[DRM_NUM_PAN_BANDS]; - int8_t g_prev_sa_index[DRM_NUM_SA_BANDS]; - int8_t g_prev_pan_index[DRM_NUM_PAN_BANDS]; - - int8_t sa_decode_error; - int8_t pan_decode_error; - - int8_t g_last_good_sa_index[DRM_NUM_SA_BANDS]; - int8_t g_last_good_pan_index[DRM_NUM_PAN_BANDS]; - - qmf_t SA[NUM_OF_SUBSAMPLES][MAX_SA_BAND]; - - complex_t d_buff[2][MAX_SA_BAND]; - complex_t d2_buff[NUM_OF_LINKS][MAX_DELAY][MAX_SA_BAND]; - - uint8_t delay_buf_index_ser[NUM_OF_LINKS]; - - real_t prev_nrg[MAX_SA_BAND]; - real_t prev_peakdiff[MAX_SA_BAND]; - real_t peakdecay_fast[MAX_SA_BAND]; -} drm_ps_info; - - -uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld); - -drm_ps_info *drm_ps_init(void); -void drm_ps_free(drm_ps_info *ps); - -uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, uint32_t samplerate, qmf_t X_left[38][64], qmf_t X_right[38][64]); - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/mplayer/libfaad2/error.c b/mplayer/libfaad2/error.c deleted file mode 100644 index e13f037c..00000000 --- a/mplayer/libfaad2/error.c +++ /dev/null @@ -1,61 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: error.c,v 1.28 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" -#include "error.h" - -char *err_msg[] = { - "No error", - "Gain control not yet implemented", - "Pulse coding not allowed in short blocks", - "Invalid huffman codebook", - "Scalefactor out of range", - "Unable to find ADTS syncword", - "Channel coupling not yet implemented", - "Channel configuration not allowed in error resilient frame", - "Bit error in error resilient scalefactor decoding", - "Error decoding huffman scalefactor (bitstream error)", - "Error decoding huffman codeword (bitstream error)", - "Non existent huffman codebook number found", - "Invalid number of channels", - "Maximum number of bitstream elements exceeded", - "Input data buffer too small", - "Array index out of range", - "Maximum number of scalefactor bands exceeded", - "Quantised value out of range", - "LTP lag out of range", - "Invalid SBR parameter decoded", - "SBR called without being initialised", - "Unexpected channel configuration change", - "Error in program_config_element", - "First SBR frame is not the same as first AAC frame", - "Unexpected fill element with SBR data", - "Not all elements were provided with SBR data", - "LTP decoding not available", - "Output data buffer too small" -}; - diff --git a/mplayer/libfaad2/error.h b/mplayer/libfaad2/error.h deleted file mode 100644 index 5bb18eb0..00000000 --- a/mplayer/libfaad2/error.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: error.h,v 1.22 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __ERROR_H__ -#define __ERROR_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#define NUM_ERROR_MESSAGES 28 -extern char *err_msg[]; - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/faad.h b/mplayer/libfaad2/faad.h deleted file mode 100644 index 7ca6c4cf..00000000 --- a/mplayer/libfaad2/faad.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: faad.h,v 1.47 2004/04/03 19:08:37 menno Exp $ -**/ - -/* warn people for update */ -#pragma message("please update faad2 include filename and function names!") - -/* Backwards compatible link */ -#include "neaacdec.h" diff --git a/mplayer/libfaad2/filtbank.c b/mplayer/libfaad2/filtbank.c deleted file mode 100644 index 6be48a08..00000000 --- a/mplayer/libfaad2/filtbank.c +++ /dev/null @@ -1,404 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: filtbank.c,v 1.41 2004/09/08 09:43:11 gcp Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#include -#include -#ifdef _WIN32_WCE -#define assert(x) -#else -#include -#endif - -#include "filtbank.h" -#include "decoder.h" -#include "syntax.h" -#include "kbd_win.h" -#include "sine_win.h" -#include "mdct.h" - - -fb_info *filter_bank_init(uint16_t frame_len) -{ - uint16_t nshort = frame_len/8; -#ifdef LD_DEC - uint16_t frame_len_ld = frame_len/2; -#endif - - fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info)); - memset(fb, 0, sizeof(fb_info)); - - /* normal */ - fb->mdct256 = faad_mdct_init(2*nshort); - fb->mdct2048 = faad_mdct_init(2*frame_len); -#ifdef LD_DEC - /* LD */ - fb->mdct1024 = faad_mdct_init(2*frame_len_ld); -#endif - -#ifdef ALLOW_SMALL_FRAMELENGTH - if (frame_len == 1024) - { -#endif - fb->long_window[0] = sine_long_1024; - fb->short_window[0] = sine_short_128; - fb->long_window[1] = kbd_long_1024; - fb->short_window[1] = kbd_short_128; -#ifdef LD_DEC - fb->ld_window[0] = sine_mid_512; - fb->ld_window[1] = ld_mid_512; -#endif -#ifdef ALLOW_SMALL_FRAMELENGTH - } else /* (frame_len == 960) */ { - fb->long_window[0] = sine_long_960; - fb->short_window[0] = sine_short_120; - fb->long_window[1] = kbd_long_960; - fb->short_window[1] = kbd_short_120; -#ifdef LD_DEC - fb->ld_window[0] = sine_mid_480; - fb->ld_window[1] = ld_mid_480; -#endif - } -#endif - - return fb; -} - -void filter_bank_end(fb_info *fb) -{ - if (fb != NULL) - { -#ifdef PROFILE - printf("FB: %I64d cycles\n", fb->cycles); -#endif - - faad_mdct_end(fb->mdct256); - faad_mdct_end(fb->mdct2048); -#ifdef LD_DEC - faad_mdct_end(fb->mdct1024); -#endif - - faad_free(fb); - } -} - -static INLINE void imdct_long(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len) -{ -#ifdef LD_DEC - mdct_info *mdct = NULL; - - switch (len) - { - case 2048: - case 1920: - mdct = fb->mdct2048; - break; - case 1024: - case 960: - mdct = fb->mdct1024; - break; - } - - faad_imdct(mdct, in_data, out_data); -#else - faad_imdct(fb->mdct2048, in_data, out_data); -#endif -} - - -#ifdef LTP_DEC -static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len) -{ - mdct_info *mdct = NULL; - - switch (len) - { - case 2048: - case 1920: - mdct = fb->mdct2048; - break; - case 256: - case 240: - mdct = fb->mdct256; - break; -#ifdef LD_DEC - case 1024: - case 960: - mdct = fb->mdct1024; - break; -#endif - } - - faad_mdct(mdct, in_data, out_data); -} -#endif - -void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, - uint8_t window_shape_prev, real_t *freq_in, - real_t *time_out, real_t *overlap, - uint8_t object_type, uint16_t frame_len) -{ - int16_t i; - ALIGN real_t transf_buf[2*1024] = {0}; - - const real_t *window_long = NULL; - const real_t *window_long_prev = NULL; - const real_t *window_short = NULL; - const real_t *window_short_prev = NULL; - - uint16_t nlong = frame_len; - uint16_t nshort = frame_len/8; - uint16_t trans = nshort/2; - - uint16_t nflat_ls = (nlong-nshort)/2; - -#ifdef PROFILE - int64_t count = faad_get_ts(); -#endif - - /* select windows of current frame and previous frame (Sine or KBD) */ -#ifdef LD_DEC - if (object_type == LD) - { - window_long = fb->ld_window[window_shape]; - window_long_prev = fb->ld_window[window_shape_prev]; - } else { -#endif - window_long = fb->long_window[window_shape]; - window_long_prev = fb->long_window[window_shape_prev]; - window_short = fb->short_window[window_shape]; - window_short_prev = fb->short_window[window_shape_prev]; -#ifdef LD_DEC - } -#endif - -#if 0 - for (i = 0; i < 1024; i++) - { - printf("%d\n", freq_in[i]); - } -#endif - -#if 0 - printf("%d %d\n", window_sequence, window_shape); -#endif - - switch (window_sequence) - { - case ONLY_LONG_SEQUENCE: - /* perform iMDCT */ - imdct_long(fb, freq_in, transf_buf, 2*nlong); - - /* add second half output of previous frame to windowed output of current frame */ - for (i = 0; i < nlong; i+=4) - { - time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]); - time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]); - time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]); - time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]); - } - - /* window the second half and save as overlap for next frame */ - for (i = 0; i < nlong; i+=4) - { - overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]); - overlap[i+1] = MUL_F(transf_buf[nlong+i+1],window_long[nlong-2-i]); - overlap[i+2] = MUL_F(transf_buf[nlong+i+2],window_long[nlong-3-i]); - overlap[i+3] = MUL_F(transf_buf[nlong+i+3],window_long[nlong-4-i]); - } - break; - - case LONG_START_SEQUENCE: - /* perform iMDCT */ - imdct_long(fb, freq_in, transf_buf, 2*nlong); - - /* add second half output of previous frame to windowed output of current frame */ - for (i = 0; i < nlong; i+=4) - { - time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]); - time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]); - time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]); - time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]); - } - - /* window the second half and save as overlap for next frame */ - /* construct second half window using padding with 1's and 0's */ - for (i = 0; i < nflat_ls; i++) - overlap[i] = transf_buf[nlong+i]; - for (i = 0; i < nshort; i++) - overlap[nflat_ls+i] = MUL_F(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]); - for (i = 0; i < nflat_ls; i++) - overlap[nflat_ls+nshort+i] = 0; - break; - - case EIGHT_SHORT_SEQUENCE: - /* perform iMDCT for each short block */ - faad_imdct(fb->mdct256, freq_in+0*nshort, transf_buf+2*nshort*0); - faad_imdct(fb->mdct256, freq_in+1*nshort, transf_buf+2*nshort*1); - faad_imdct(fb->mdct256, freq_in+2*nshort, transf_buf+2*nshort*2); - faad_imdct(fb->mdct256, freq_in+3*nshort, transf_buf+2*nshort*3); - faad_imdct(fb->mdct256, freq_in+4*nshort, transf_buf+2*nshort*4); - faad_imdct(fb->mdct256, freq_in+5*nshort, transf_buf+2*nshort*5); - faad_imdct(fb->mdct256, freq_in+6*nshort, transf_buf+2*nshort*6); - faad_imdct(fb->mdct256, freq_in+7*nshort, transf_buf+2*nshort*7); - - /* add second half output of previous frame to windowed output of current frame */ - for (i = 0; i < nflat_ls; i++) - time_out[i] = overlap[i]; - for(i = 0; i < nshort; i++) - { - time_out[nflat_ls+ i] = overlap[nflat_ls+ i] + MUL_F(transf_buf[nshort*0+i],window_short_prev[i]); - time_out[nflat_ls+1*nshort+i] = overlap[nflat_ls+nshort*1+i] + MUL_F(transf_buf[nshort*1+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*2+i],window_short[i]); - time_out[nflat_ls+2*nshort+i] = overlap[nflat_ls+nshort*2+i] + MUL_F(transf_buf[nshort*3+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*4+i],window_short[i]); - time_out[nflat_ls+3*nshort+i] = overlap[nflat_ls+nshort*3+i] + MUL_F(transf_buf[nshort*5+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*6+i],window_short[i]); - if (i < trans) - time_out[nflat_ls+4*nshort+i] = overlap[nflat_ls+nshort*4+i] + MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]); - } - - /* window the second half and save as overlap for next frame */ - for(i = 0; i < nshort; i++) - { - if (i >= trans) - overlap[nflat_ls+4*nshort+i-nlong] = MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]); - overlap[nflat_ls+5*nshort+i-nlong] = MUL_F(transf_buf[nshort*9+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*10+i],window_short[i]); - overlap[nflat_ls+6*nshort+i-nlong] = MUL_F(transf_buf[nshort*11+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*12+i],window_short[i]); - overlap[nflat_ls+7*nshort+i-nlong] = MUL_F(transf_buf[nshort*13+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*14+i],window_short[i]); - overlap[nflat_ls+8*nshort+i-nlong] = MUL_F(transf_buf[nshort*15+i],window_short[nshort-1-i]); - } - for (i = 0; i < nflat_ls; i++) - overlap[nflat_ls+nshort+i] = 0; - break; - - case LONG_STOP_SEQUENCE: - /* perform iMDCT */ - imdct_long(fb, freq_in, transf_buf, 2*nlong); - - /* add second half output of previous frame to windowed output of current frame */ - /* construct first half window using padding with 1's and 0's */ - for (i = 0; i < nflat_ls; i++) - time_out[i] = overlap[i]; - for (i = 0; i < nshort; i++) - time_out[nflat_ls+i] = overlap[nflat_ls+i] + MUL_F(transf_buf[nflat_ls+i],window_short_prev[i]); - for (i = 0; i < nflat_ls; i++) - time_out[nflat_ls+nshort+i] = overlap[nflat_ls+nshort+i] + transf_buf[nflat_ls+nshort+i]; - - /* window the second half and save as overlap for next frame */ - for (i = 0; i < nlong; i++) - overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]); - break; - } - -#if 0 - for (i = 0; i < 1024; i++) - { - printf("%d\n", time_out[i]); - //printf("0x%.8X\n", time_out[i]); - } -#endif - - -#ifdef PROFILE - count = faad_get_ts() - count; - fb->cycles += count; -#endif -} - - -#ifdef LTP_DEC -/* only works for LTP -> no overlapping, no short blocks */ -void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, - uint8_t window_shape_prev, real_t *in_data, real_t *out_mdct, - uint8_t object_type, uint16_t frame_len) -{ - int16_t i; - ALIGN real_t windowed_buf[2*1024] = {0}; - - const real_t *window_long = NULL; - const real_t *window_long_prev = NULL; - const real_t *window_short = NULL; - const real_t *window_short_prev = NULL; - - uint16_t nlong = frame_len; - uint16_t nshort = frame_len/8; - uint16_t nflat_ls = (nlong-nshort)/2; - - assert(window_sequence != EIGHT_SHORT_SEQUENCE); - -#ifdef LD_DEC - if (object_type == LD) - { - window_long = fb->ld_window[window_shape]; - window_long_prev = fb->ld_window[window_shape_prev]; - } else { -#endif - window_long = fb->long_window[window_shape]; - window_long_prev = fb->long_window[window_shape_prev]; - window_short = fb->short_window[window_shape]; - window_short_prev = fb->short_window[window_shape_prev]; -#ifdef LD_DEC - } -#endif - - switch(window_sequence) - { - case ONLY_LONG_SEQUENCE: - for (i = nlong-1; i >= 0; i--) - { - windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]); - windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]); - } - mdct(fb, windowed_buf, out_mdct, 2*nlong); - break; - - case LONG_START_SEQUENCE: - for (i = 0; i < nlong; i++) - windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]); - for (i = 0; i < nflat_ls; i++) - windowed_buf[i+nlong] = in_data[i+nlong]; - for (i = 0; i < nshort; i++) - windowed_buf[i+nlong+nflat_ls] = MUL_F(in_data[i+nlong+nflat_ls], window_short[nshort-1-i]); - for (i = 0; i < nflat_ls; i++) - windowed_buf[i+nlong+nflat_ls+nshort] = 0; - mdct(fb, windowed_buf, out_mdct, 2*nlong); - break; - - case LONG_STOP_SEQUENCE: - for (i = 0; i < nflat_ls; i++) - windowed_buf[i] = 0; - for (i = 0; i < nshort; i++) - windowed_buf[i+nflat_ls] = MUL_F(in_data[i+nflat_ls], window_short_prev[i]); - for (i = 0; i < nflat_ls; i++) - windowed_buf[i+nflat_ls+nshort] = in_data[i+nflat_ls+nshort]; - for (i = 0; i < nlong; i++) - windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]); - mdct(fb, windowed_buf, out_mdct, 2*nlong); - break; - } -} -#endif diff --git a/mplayer/libfaad2/filtbank.h b/mplayer/libfaad2/filtbank.h deleted file mode 100644 index ade1d6a2..00000000 --- a/mplayer/libfaad2/filtbank.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: filtbank.h,v 1.23 2004/09/08 09:43:11 gcp Exp $ -**/ - -#ifndef __FILTBANK_H__ -#define __FILTBANK_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -fb_info *filter_bank_init(uint16_t frame_len); -void filter_bank_end(fb_info *fb); - -#ifdef LTP_DEC -void filter_bank_ltp(fb_info *fb, - uint8_t window_sequence, - uint8_t window_shape, - uint8_t window_shape_prev, - real_t *in_data, - real_t *out_mdct, - uint8_t object_type, - uint16_t frame_len); -#endif - -void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, - uint8_t window_shape_prev, real_t *freq_in, - real_t *time_out, real_t *overlap, - uint8_t object_type, uint16_t frame_len); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/fixed.h b/mplayer/libfaad2/fixed.h deleted file mode 100644 index 0363e540..00000000 --- a/mplayer/libfaad2/fixed.h +++ /dev/null @@ -1,265 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: fixed.h,v 1.26 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __FIXED_H__ -#define __FIXED_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(_WIN32_WCE) && defined(_ARM_) -#include -#endif - -#define COEF_BITS 28 -#define COEF_PRECISION (1 << COEF_BITS) -#define REAL_BITS 14 // MAXIMUM OF 14 FOR FIXED POINT SBR -#define REAL_PRECISION (1 << REAL_BITS) - -/* FRAC is the fractional only part of the fixed point number [0.0..1.0) */ -#define FRAC_SIZE 32 /* frac is a 32 bit integer */ -#define FRAC_BITS 31 -#define FRAC_PRECISION ((uint32_t)(1 << FRAC_BITS)) -#define FRAC_MAX 0x7FFFFFFF - -typedef int32_t real_t; - - -#define REAL_CONST(A) (((A) >= 0) ? ((real_t)((A)*(REAL_PRECISION)+0.5)) : ((real_t)((A)*(REAL_PRECISION)-0.5))) -#define COEF_CONST(A) (((A) >= 0) ? ((real_t)((A)*(COEF_PRECISION)+0.5)) : ((real_t)((A)*(COEF_PRECISION)-0.5))) -#define FRAC_CONST(A) (((A) == 1.00) ? ((real_t)FRAC_MAX) : (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5)))) -//#define FRAC_CONST(A) (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5))) - -#define Q2_BITS 22 -#define Q2_PRECISION (1 << Q2_BITS) -#define Q2_CONST(A) (((A) >= 0) ? ((real_t)((A)*(Q2_PRECISION)+0.5)) : ((real_t)((A)*(Q2_PRECISION)-0.5))) - -#if defined(_WIN32) && !defined(_WIN32_WCE) - -/* multiply with real shift */ -static INLINE real_t MUL_R(real_t A, real_t B) -{ - _asm { - mov eax,A - imul B - shrd eax,edx,REAL_BITS - } -} - -/* multiply with coef shift */ -static INLINE real_t MUL_C(real_t A, real_t B) -{ - _asm { - mov eax,A - imul B - shrd eax,edx,COEF_BITS - } -} - -static INLINE real_t MUL_Q2(real_t A, real_t B) -{ - _asm { - mov eax,A - imul B - shrd eax,edx,Q2_BITS - } -} - -static INLINE real_t MUL_SHIFT6(real_t A, real_t B) -{ - _asm { - mov eax,A - imul B - shrd eax,edx,6 - } -} - -static INLINE real_t MUL_SHIFT23(real_t A, real_t B) -{ - _asm { - mov eax,A - imul B - shrd eax,edx,23 - } -} - -#if 1 -static INLINE real_t _MulHigh(real_t A, real_t B) -{ - _asm { - mov eax,A - imul B - mov eax,edx - } -} - -/* multiply with fractional shift */ -static INLINE real_t MUL_F(real_t A, real_t B) -{ - return _MulHigh(A,B) << (FRAC_SIZE-FRAC_BITS); -} - -/* Complex multiplication */ -static INLINE void ComplexMult(real_t *y1, real_t *y2, - real_t x1, real_t x2, real_t c1, real_t c2) -{ - *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS); - *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS); -} -#else -static INLINE real_t MUL_F(real_t A, real_t B) -{ - _asm { - mov eax,A - imul B - shrd eax,edx,FRAC_BITS - } -} - -/* Complex multiplication */ -static INLINE void ComplexMult(real_t *y1, real_t *y2, - real_t x1, real_t x2, real_t c1, real_t c2) -{ - *y1 = MUL_F(x1, c1) + MUL_F(x2, c2); - *y2 = MUL_F(x2, c1) - MUL_F(x1, c2); -} -#endif - -#elif defined(__GNUC__) && defined (__arm__) - -/* taken from MAD */ -#define arm_mul(x, y, SCALEBITS) \ -({ \ - uint32_t __hi; \ - uint32_t __lo; \ - uint32_t __result; \ - asm("smull %0, %1, %3, %4\n\t" \ - "movs %0, %0, lsr %5\n\t" \ - "adc %2, %0, %1, lsl %6" \ - : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ - : "%r" (x), "r" (y), \ - "M" (SCALEBITS), "M" (32 - (SCALEBITS)) \ - : "cc"); \ - __result; \ -}) - -static INLINE real_t MUL_R(real_t A, real_t B) -{ - return arm_mul(A, B, REAL_BITS); -} - -static INLINE real_t MUL_C(real_t A, real_t B) -{ - return arm_mul(A, B, COEF_BITS); -} - -static INLINE real_t MUL_Q2(real_t A, real_t B) -{ - return arm_mul(A, B, Q2_BITS); -} - -static INLINE real_t MUL_SHIFT6(real_t A, real_t B) -{ - return arm_mul(A, B, 6); -} - -static INLINE real_t MUL_SHIFT23(real_t A, real_t B) -{ - return arm_mul(A, B, 23); -} - -static INLINE real_t _MulHigh(real_t x, real_t y) -{ - uint32_t __lo; - uint32_t __hi; - asm("smull\t%0, %1, %2, %3" - : "=&r"(__lo),"=&r"(__hi) - : "%r"(x),"r"(y) - : "cc"); - return __hi; -} - -static INLINE real_t MUL_F(real_t A, real_t B) -{ - return _MulHigh(A, B) << (FRAC_SIZE-FRAC_BITS); -} - -/* Complex multiplication */ -static INLINE void ComplexMult(real_t *y1, real_t *y2, - real_t x1, real_t x2, real_t c1, real_t c2) -{ - int32_t tmp, yt1, yt2; - asm("smull %0, %1, %4, %6\n\t" - "smlal %0, %1, %5, %7\n\t" - "rsb %3, %4, #0\n\t" - "smull %0, %2, %5, %6\n\t" - "smlal %0, %2, %3, %7" - : "=&r" (tmp), "=&r" (yt1), "=&r" (yt2), "=r" (x1) - : "3" (x1), "r" (x2), "r" (c1), "r" (c2) - : "cc" ); - *y1 = yt1 << (FRAC_SIZE-FRAC_BITS); - *y2 = yt2 << (FRAC_SIZE-FRAC_BITS); -} - -#else - - /* multiply with real shift */ - #define MUL_R(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (REAL_BITS-1))) >> REAL_BITS) - /* multiply with coef shift */ - #define MUL_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS) - /* multiply with fractional shift */ -#if defined(_WIN32_WCE) && defined(_ARM_) - /* eVC for PocketPC has an intrinsic function that returns only the high 32 bits of a 32x32 bit multiply */ - static INLINE real_t MUL_F(real_t A, real_t B) - { - return _MulHigh(A,B) << (32-FRAC_BITS); - } -#else - #define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE) - #define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS) -#endif - #define MUL_Q2(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (Q2_BITS-1))) >> Q2_BITS) - #define MUL_SHIFT6(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (6-1))) >> 6) - #define MUL_SHIFT23(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (23-1))) >> 23) - -/* Complex multiplication */ -static INLINE void ComplexMult(real_t *y1, real_t *y2, - real_t x1, real_t x2, real_t c1, real_t c2) -{ - *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS); - *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS); -} - -#endif - - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/hcr.c b/mplayer/libfaad2/hcr.c deleted file mode 100644 index de1e1fd2..00000000 --- a/mplayer/libfaad2/hcr.c +++ /dev/null @@ -1,409 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2004 G.C. Pascutto, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: hcr.c,v 1.18 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#include -#include - -#include "specrec.h" -#include "huffman.h" - -/* ISO/IEC 14496-3/Amd.1 - * 8.5.3.3: Huffman Codeword Reordering for AAC spectral data (HCR) - * - * HCR devides the spectral data in known fixed size segments, and - * sorts it by the importance of the data. The importance is firstly - * the (lower) position in the spectrum, and secondly the largest - * value in the used codebook. - * The most important data is written at the start of each segment - * (at known positions), the remaining data is interleaved inbetween, - * with the writing direction alternating. - * Data length is not increased. -*/ - -#ifdef ERROR_RESILIENCE - -/* 8.5.3.3.1 Pre-sorting */ - -#define NUM_CB 6 -#define NUM_CB_ER 22 -#define MAX_CB 32 -#define VCB11_FIRST 16 -#define VCB11_LAST 31 - -static const uint8_t PreSortCB_STD[NUM_CB] = - { 11, 9, 7, 5, 3, 1}; - -static const uint8_t PreSortCB_ER[NUM_CB_ER] = - { 11, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 9, 7, 5, 3, 1}; - -/* 8.5.3.3.2 Derivation of segment width */ - -static const uint8_t maxCwLen[MAX_CB] = {0, 11, 9, 20, 16, 13, 11, 14, 12, 17, 14, 49, - 0, 0, 0, 0, 14, 17, 21, 21, 25, 25, 29, 29, 29, 29, 33, 33, 33, 37, 37, 41}; - -#define segmentWidth(cb) min(maxCwLen[cb], ics->length_of_longest_codeword) - -/* bit-twiddling helpers */ -static const uint8_t S[] = {1, 2, 4, 8, 16}; -static const uint32_t B[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, 0x0000FFFF}; - -typedef struct -{ - uint8_t cb; - uint8_t decoded; - uint16_t sp_offset; - bits_t bits; -} codeword_t; - -/* rewind and reverse */ -/* 32 bit version */ -static uint32_t rewrev_word(uint32_t v, const uint8_t len) -{ - /* 32 bit reverse */ - v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]); - v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]); - v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]); - v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]); - v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]); - - /* shift off low bits */ - v >>= (32 - len); - - return v; -} - -/* 64 bit version */ -static void rewrev_lword(uint32_t *hi, uint32_t *lo, const uint8_t len) -{ - if (len <= 32) { - *hi = 0; - *lo = rewrev_word(*lo, len); - } else - { - uint32_t t = *hi, v = *lo; - - /* double 32 bit reverse */ - v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]); - t = ((t >> S[0]) & B[0]) | ((t << S[0]) & ~B[0]); - v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]); - t = ((t >> S[1]) & B[1]) | ((t << S[1]) & ~B[1]); - v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]); - t = ((t >> S[2]) & B[2]) | ((t << S[2]) & ~B[2]); - v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]); - t = ((t >> S[3]) & B[3]) | ((t << S[3]) & ~B[3]); - v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]); - t = ((t >> S[4]) & B[4]) | ((t << S[4]) & ~B[4]); - - /* last 32<>32 bit swap is implicit below */ - - /* shift off low bits (this is really only one 64 bit shift) */ - *lo = (t >> (64 - len)) | (v << (len - 32)); - *hi = v >> (64 - len); - } -} - - -/* bits_t version */ -static void rewrev_bits(bits_t *bits) -{ - if (bits->len == 0) return; - rewrev_lword(&bits->bufb, &bits->bufa, bits->len); -} - - -/* merge bits of a to b */ -static void concat_bits(bits_t *b, bits_t *a) -{ - uint32_t bl, bh, al, ah; - - if (a->len == 0) return; - - al = a->bufa; - ah = a->bufb; - - if (b->len > 32) - { - /* maskoff superfluous high b bits */ - bl = b->bufa; - bh = b->bufb & ((1 << (b->len-32)) - 1); - /* left shift a b->len bits */ - ah = al << (b->len - 32); - al = 0; - } else { - bl = b->bufa & ((1 << (b->len)) - 1); - bh = 0; - ah = (ah << (b->len)) | (al >> (32 - b->len)); - al = al << b->len; - } - - /* merge */ - b->bufa = bl | al; - b->bufb = bh | ah; - - b->len += a->len; -} - -uint8_t is_good_cb(uint8_t this_CB, uint8_t this_sec_CB) -{ - /* only want spectral data CB's */ - if ((this_sec_CB > ZERO_HCB && this_sec_CB <= ESC_HCB) || (this_sec_CB >= VCB11_FIRST && this_sec_CB <= VCB11_LAST)) - { - if (this_CB < ESC_HCB) - { - /* normal codebook pairs */ - return ((this_sec_CB == this_CB) || (this_sec_CB == this_CB + 1)); - } else - { - /* escape codebook */ - return (this_sec_CB == this_CB); - } - } - return 0; -} - -void read_segment(bits_t *segment, uint8_t segwidth, bitfile *ld) -{ - segment->len = segwidth; - - if (segwidth > 32) - { - segment->bufb = faad_getbits(ld, segwidth - 32); - segment->bufa = faad_getbits(ld, 32); - - } else { - segment->bufa = faad_getbits(ld, segwidth); - segment->bufb = 0; - } -} - -void fill_in_codeword(codeword_t *codeword, uint16_t index, uint16_t sp, uint8_t cb) -{ - codeword[index].sp_offset = sp; - codeword[index].cb = cb; - codeword[index].decoded = 0; - codeword[index].bits.len = 0; -} - -uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, - bitfile *ld, int16_t *spectral_data) -{ - uint16_t PCWs_done; - uint16_t numberOfSegments, numberOfSets, numberOfCodewords; - - codeword_t codeword[512]; - bits_t segment[512]; - - uint16_t sp_offset[8]; - uint16_t g, i, sortloop, set, bitsread; - uint8_t w_idx, sfb, this_CB, last_CB, this_sec_CB; - - const uint16_t nshort = hDecoder->frameLength/8; - const uint16_t sp_data_len = ics->length_of_reordered_spectral_data; - - const uint8_t *PreSortCb; - - /* no data (e.g. silence) */ - if (sp_data_len == 0) - return 0; - - /* since there is spectral data, at least one codeword has nonzero length */ - if (ics->length_of_longest_codeword == 0) - return 10; - - if (sp_data_len < ics->length_of_longest_codeword) - return 10; - - sp_offset[0] = 0; - for (g = 1; g < ics->num_window_groups; g++) - { - sp_offset[g] = sp_offset[g-1] + nshort*ics->window_group_length[g-1]; - } - - PCWs_done = 0; - numberOfSegments = 0; - numberOfCodewords = 0; - bitsread = 0; - - /* VCB11 code books in use */ - if (hDecoder->aacSectionDataResilienceFlag) - { - PreSortCb = PreSortCB_ER; - last_CB = NUM_CB_ER; - } else - { - PreSortCb = PreSortCB_STD; - last_CB = NUM_CB; - } - - /* step 1: decode PCW's (set 0), and stuff data in easier-to-use format */ - for (sortloop = 0; sortloop < last_CB; sortloop++) - { - /* select codebook to process this pass */ - this_CB = PreSortCb[sortloop]; - - /* loop over sfbs */ - for (sfb = 0; sfb < ics->max_sfb; sfb++) - { - /* loop over all in this sfb, 4 lines per loop */ - for (w_idx = 0; 4*w_idx < (ics->swb_offset[sfb+1] - ics->swb_offset[sfb]); w_idx++) - { - for(g = 0; g < ics->num_window_groups; g++) - { - for (i = 0; i < ics->num_sec[g]; i++) - { - /* check whether sfb used here is the one we want to process */ - if ((ics->sect_start[g][i] <= sfb) && (ics->sect_end[g][i] > sfb)) - { - /* check whether codebook used here is the one we want to process */ - this_sec_CB = ics->sect_cb[g][i]; - - if (is_good_cb(this_CB, this_sec_CB)) - { - /* precalculate some stuff */ - uint16_t sect_sfb_size = ics->sect_sfb_offset[g][sfb+1] - ics->sect_sfb_offset[g][sfb]; - uint8_t inc = (this_sec_CB < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN; - uint16_t group_cws_count = (4*ics->window_group_length[g])/inc; - uint8_t segwidth = segmentWidth(this_sec_CB); - uint16_t cws; - - /* read codewords until end of sfb or end of window group (shouldn't only 1 trigger?) */ - for (cws = 0; (cws < group_cws_count) && ((cws + w_idx*group_cws_count) < sect_sfb_size); cws++) - { - uint16_t sp = sp_offset[g] + ics->sect_sfb_offset[g][sfb] + inc * (cws + w_idx*group_cws_count); - - /* read and decode PCW */ - if (!PCWs_done) - { - /* read in normal segments */ - if (bitsread + segwidth <= sp_data_len) - { - read_segment(&segment[numberOfSegments], segwidth, ld); - bitsread += segwidth; - - huffman_spectral_data_2(this_sec_CB, &segment[numberOfSegments], &spectral_data[sp]); - - /* keep leftover bits */ - rewrev_bits(&segment[numberOfSegments]); - - numberOfSegments++; - } else { - /* remaining stuff after last segment, we unfortunately couldn't read - this in earlier because it might not fit in 64 bits. since we already - decoded (and removed) the PCW it is now guaranteed to fit */ - if (bitsread < sp_data_len) - { - const uint8_t additional_bits = sp_data_len - bitsread; - - read_segment(&segment[numberOfSegments], additional_bits, ld); - segment[numberOfSegments].len += segment[numberOfSegments-1].len; - rewrev_bits(&segment[numberOfSegments]); - - if (segment[numberOfSegments-1].len > 32) - { - segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb + - showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len - 32); - segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa + - showbits_hcr(&segment[numberOfSegments-1], 32); - } else { - segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa + - showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len); - segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb; - } - segment[numberOfSegments-1].len += additional_bits; - } - bitsread = sp_data_len; - PCWs_done = 1; - - fill_in_codeword(codeword, 0, sp, this_sec_CB); - } - } else { - fill_in_codeword(codeword, numberOfCodewords - numberOfSegments, sp, this_sec_CB); - } - numberOfCodewords++; - } - } - } - } - } - } - } - } - - if (numberOfSegments == 0) - return 10; - - numberOfSets = numberOfCodewords / numberOfSegments; - - /* step 2: decode nonPCWs */ - for (set = 1; set <= numberOfSets; set++) - { - uint16_t trial; - - for (trial = 0; trial < numberOfSegments; trial++) - { - uint16_t codewordBase; - - for (codewordBase = 0; codewordBase < numberOfSegments; codewordBase++) - { - const uint16_t segment_idx = (trial + codewordBase) % numberOfSegments; - const uint16_t codeword_idx = codewordBase + set*numberOfSegments - numberOfSegments; - - /* data up */ - if (codeword_idx >= numberOfCodewords - numberOfSegments) break; - - if (!codeword[codeword_idx].decoded && segment[segment_idx].len > 0) - { - uint8_t tmplen; - - if (codeword[codeword_idx].bits.len != 0) - concat_bits(&segment[segment_idx], &codeword[codeword_idx].bits); - - tmplen = segment[segment_idx].len; - - if (huffman_spectral_data_2(codeword[codeword_idx].cb, &segment[segment_idx], - &spectral_data[codeword[codeword_idx].sp_offset]) >= 0) - { - codeword[codeword_idx].decoded = 1; - } else - { - codeword[codeword_idx].bits = segment[segment_idx]; - codeword[codeword_idx].bits.len = tmplen; - } - - } - } - } - for (i = 0; i < numberOfSegments; i++) - rewrev_bits(&segment[i]); - } - - return 0; -} -#endif diff --git a/mplayer/libfaad2/huffman.c b/mplayer/libfaad2/huffman.c deleted file mode 100644 index cfeeaf55..00000000 --- a/mplayer/libfaad2/huffman.c +++ /dev/null @@ -1,556 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: huffman.c,v 1.22 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#include -#ifdef ANALYSIS -#include -#endif - -#include "bits.h" -#include "huffman.h" -#include "codebook/hcb.h" - - -/* static function declarations */ -static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len); -static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp); -static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp); -static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp); -static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp); -static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp); -static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp); -static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp); -static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp); -static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp); -static int16_t huffman_codebook(uint8_t i); -static void vcb11_check_LAV(uint8_t cb, int16_t *sp); - -int8_t huffman_scale_factor(bitfile *ld) -{ - uint16_t offset = 0; - - while (hcb_sf[offset][1]) - { - uint8_t b = faad_get1bit(ld - DEBUGVAR(1,255,"huffman_scale_factor()")); - offset += hcb_sf[offset][b]; - - if (offset > 240) - { - /* printf("ERROR: offset into hcb_sf = %d >240!\n", offset); */ - return -1; - } - } - - return hcb_sf[offset][0]; -} - - -hcb *hcb_table[] = { - 0, hcb1_1, hcb2_1, 0, hcb4_1, 0, hcb6_1, 0, hcb8_1, 0, hcb10_1, hcb11_1 -}; - -hcb_2_quad *hcb_2_quad_table[] = { - 0, hcb1_2, hcb2_2, 0, hcb4_2, 0, 0, 0, 0, 0, 0, 0 -}; - -hcb_2_pair *hcb_2_pair_table[] = { - 0, 0, 0, 0, 0, 0, hcb6_2, 0, hcb8_2, 0, hcb10_2, hcb11_2 -}; - -hcb_bin_pair *hcb_bin_table[] = { - 0, 0, 0, 0, 0, hcb5, 0, hcb7, 0, hcb9, 0, 0 -}; - -uint8_t hcbN[] = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 }; - -/* defines whether a huffman codebook is unsigned or not */ -/* Table 4.6.2 */ -uint8_t unsigned_cb[] = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, - /* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 -}; - -int hcb_2_quad_table_size[] = { 0, 114, 86, 0, 185, 0, 0, 0, 0, 0, 0, 0 }; -int hcb_2_pair_table_size[] = { 0, 0, 0, 0, 0, 0, 126, 0, 83, 0, 210, 373 }; -int hcb_bin_table_size[] = { 0, 0, 0, 161, 0, 161, 0, 127, 0, 337, 0, 0 }; - -static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len) -{ - uint8_t i; - - for (i = 0; i < len; i++) - { - if(sp[i]) - { - if(faad_get1bit(ld - DEBUGVAR(1,5,"huffman_sign_bits(): sign bit")) & 1) - { - sp[i] = -sp[i]; - } - } - } -} - -static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp) -{ - uint8_t neg, i; - int16_t j; - int16_t off; - - if (sp < 0) - { - if (sp != -16) - return sp; - neg = 1; - } else { - if (sp != 16) - return sp; - neg = 0; - } - - for (i = 4; ; i++) - { - if (faad_get1bit(ld - DEBUGVAR(1,6,"huffman_getescape(): escape size")) == 0) - { - break; - } - } - - off = (int16_t)faad_getbits(ld, i - DEBUGVAR(1,9,"huffman_getescape(): escape")); - - j = off | (1< hcb_2_quad_table_size[cb]) - { - /* printf("ERROR: offset into hcb_2_quad_table = %d >%d!\n", offset, - hcb_2_quad_table_size[cb]); */ - return 10; - } - - sp[0] = hcb_2_quad_table[cb][offset].x; - sp[1] = hcb_2_quad_table[cb][offset].y; - sp[2] = hcb_2_quad_table[cb][offset].v; - sp[3] = hcb_2_quad_table[cb][offset].w; - - return 0; -} - -static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp) -{ - uint8_t err = huffman_2step_quad(cb, ld, sp); - huffman_sign_bits(ld, sp, QUAD_LEN); - - return err; -} - -static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp) -{ - uint32_t cw; - uint16_t offset = 0; - uint8_t extra_bits; - - cw = faad_showbits(ld, hcbN[cb]); - offset = hcb_table[cb][cw].offset; - extra_bits = hcb_table[cb][cw].extra_bits; - - if (extra_bits) - { - /* we know for sure it's more than hcbN[cb] bits long */ - faad_flushbits(ld, hcbN[cb]); - offset += (uint16_t)faad_showbits(ld, extra_bits); - faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]); - } else { - faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits); - } - - if (offset > hcb_2_pair_table_size[cb]) - { - /* printf("ERROR: offset into hcb_2_pair_table = %d >%d!\n", offset, - hcb_2_pair_table_size[cb]); */ - return 10; - } - - sp[0] = hcb_2_pair_table[cb][offset].x; - sp[1] = hcb_2_pair_table[cb][offset].y; - - return 0; -} - -static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp) -{ - uint8_t err = huffman_2step_pair(cb, ld, sp); - huffman_sign_bits(ld, sp, PAIR_LEN); - - return err; -} - -static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp) -{ - uint16_t offset = 0; - - while (!hcb3[offset].is_leaf) - { - uint8_t b = faad_get1bit(ld - DEBUGVAR(1,255,"huffman_spectral_data():3")); - offset += hcb3[offset].data[b]; - } - - if (offset > hcb_bin_table_size[cb]) - { - /* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset, - hcb_bin_table_size[cb]); */ - return 10; - } - - sp[0] = hcb3[offset].data[0]; - sp[1] = hcb3[offset].data[1]; - sp[2] = hcb3[offset].data[2]; - sp[3] = hcb3[offset].data[3]; - - return 0; -} - -static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp) -{ - uint8_t err = huffman_binary_quad(cb, ld, sp); - huffman_sign_bits(ld, sp, QUAD_LEN); - - return err; -} - -static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp) -{ - uint16_t offset = 0; - - while (!hcb_bin_table[cb][offset].is_leaf) - { - uint8_t b = faad_get1bit(ld - DEBUGVAR(1,255,"huffman_spectral_data():9")); - offset += hcb_bin_table[cb][offset].data[b]; - } - - if (offset > hcb_bin_table_size[cb]) - { - /* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset, - hcb_bin_table_size[cb]); */ - return 10; - } - - sp[0] = hcb_bin_table[cb][offset].data[0]; - sp[1] = hcb_bin_table[cb][offset].data[1]; - - return 0; -} - -static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp) -{ - uint8_t err = huffman_binary_pair(cb, ld, sp); - huffman_sign_bits(ld, sp, PAIR_LEN); - - return err; -} - -static int16_t huffman_codebook(uint8_t i) -{ - static const uint32_t data = 16428320; - if (i == 0) return (int16_t)(data >> 16) & 0xFFFF; - else return (int16_t)data & 0xFFFF; -} - -static void vcb11_check_LAV(uint8_t cb, int16_t *sp) -{ - static const uint16_t vcb11_LAV_tab[] = { - 16, 31, 47, 63, 95, 127, 159, 191, 223, - 255, 319, 383, 511, 767, 1023, 2047 - }; - uint16_t max = 0; - - if (cb < 16 || cb > 31) - return; - - max = vcb11_LAV_tab[cb - 16]; - - if ((abs(sp[0]) > max) || (abs(sp[1]) > max)) - { - sp[0] = 0; - sp[1] = 0; - } -} - -uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp) -{ - switch (cb) - { - case 1: /* 2-step method for data quadruples */ - case 2: - return huffman_2step_quad(cb, ld, sp); - case 3: /* binary search for data quadruples */ - return huffman_binary_quad_sign(cb, ld, sp); - case 4: /* 2-step method for data quadruples */ - return huffman_2step_quad_sign(cb, ld, sp); - case 5: /* binary search for data pairs */ - return huffman_binary_pair(cb, ld, sp); - case 6: /* 2-step method for data pairs */ - return huffman_2step_pair(cb, ld, sp); - case 7: /* binary search for data pairs */ - case 9: - return huffman_binary_pair_sign(cb, ld, sp); - case 8: /* 2-step method for data pairs */ - case 10: - return huffman_2step_pair_sign(cb, ld, sp); - case 12: { - uint8_t err = huffman_2step_pair(11, ld, sp); - sp[0] = huffman_codebook(0); sp[1] = huffman_codebook(1); - return err; } - case 11: - { - uint8_t err = huffman_2step_pair_sign(11, ld, sp); - sp[0] = huffman_getescape(ld, sp[0]); - sp[1] = huffman_getescape(ld, sp[1]); - return err; - } -#ifdef ERROR_RESILIENCE - /* VCB11 uses codebook 11 */ - case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: - case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: - { - uint8_t err = huffman_2step_pair_sign(11, ld, sp); - sp[0] = huffman_getescape(ld, sp[0]); - sp[1] = huffman_getescape(ld, sp[1]); - - /* check LAV (Largest Absolute Value) */ - /* this finds errors in the ESCAPE signal */ - vcb11_check_LAV(cb, sp); - - return err; - } -#endif - default: - /* Non existent codebook number, something went wrong */ - return 11; - } - - return 0; -} - - -#ifdef ERROR_RESILIENCE - -/* Special version of huffman_spectral_data -Will not read from a bitfile but a bits_t structure. -Will keep track of the bits decoded and return the number of bits remaining. -Do not read more than ld->len, return -1 if codeword would be longer */ - -int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp) -{ - uint32_t cw; - uint16_t offset = 0; - uint8_t extra_bits; - uint8_t i, vcb11 = 0; - - - switch (cb) - { - case 1: /* 2-step method for data quadruples */ - case 2: - case 4: - - cw = showbits_hcr(ld, hcbN[cb]); - offset = hcb_table[cb][cw].offset; - extra_bits = hcb_table[cb][cw].extra_bits; - - if (extra_bits) - { - /* we know for sure it's more than hcbN[cb] bits long */ - if ( flushbits_hcr(ld, hcbN[cb]) ) return -1; - offset += (uint16_t)showbits_hcr(ld, extra_bits); - if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]) ) return -1; - } else { - if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits) ) return -1; - } - - sp[0] = hcb_2_quad_table[cb][offset].x; - sp[1] = hcb_2_quad_table[cb][offset].y; - sp[2] = hcb_2_quad_table[cb][offset].v; - sp[3] = hcb_2_quad_table[cb][offset].w; - break; - - case 6: /* 2-step method for data pairs */ - case 8: - case 10: - case 11: - /* VCB11 uses codebook 11 */ - case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: - case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: - - if (cb >= 16) - { - /* store the virtual codebook */ - vcb11 = cb; - cb = 11; - } - - cw = showbits_hcr(ld, hcbN[cb]); - offset = hcb_table[cb][cw].offset; - extra_bits = hcb_table[cb][cw].extra_bits; - - if (extra_bits) - { - /* we know for sure it's more than hcbN[cb] bits long */ - if ( flushbits_hcr(ld, hcbN[cb]) ) return -1; - offset += (uint16_t)showbits_hcr(ld, extra_bits); - if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]) ) return -1; - } else { - if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits) ) return -1; - } - sp[0] = hcb_2_pair_table[cb][offset].x; - sp[1] = hcb_2_pair_table[cb][offset].y; - break; - - case 3: /* binary search for data quadruples */ - - while (!hcb3[offset].is_leaf) - { - uint8_t b; - - if ( get1bit_hcr(ld, &b) ) return -1; - offset += hcb3[offset].data[b]; - } - - sp[0] = hcb3[offset].data[0]; - sp[1] = hcb3[offset].data[1]; - sp[2] = hcb3[offset].data[2]; - sp[3] = hcb3[offset].data[3]; - - break; - - case 5: /* binary search for data pairs */ - case 7: - case 9: - - while (!hcb_bin_table[cb][offset].is_leaf) - { - uint8_t b; - - if (get1bit_hcr(ld, &b) ) return -1; - offset += hcb_bin_table[cb][offset].data[b]; - } - - sp[0] = hcb_bin_table[cb][offset].data[0]; - sp[1] = hcb_bin_table[cb][offset].data[1]; - - break; - } - - /* decode sign bits */ - if (unsigned_cb[cb]) - { - for(i = 0; i < ((cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN); i++) - { - if(sp[i]) - { - uint8_t b; - if ( get1bit_hcr(ld, &b) ) return -1; - if (b != 0) { - sp[i] = -sp[i]; - } - } - } - } - - /* decode huffman escape bits */ - if ((cb == ESC_HCB) || (cb >= 16)) - { - uint8_t k; - for (k = 0; k < 2; k++) - { - if ((sp[k] == 16) || (sp[k] == -16)) - { - uint8_t neg, i; - int32_t j; - uint32_t off; - - neg = (sp[k] < 0) ? 1 : 0; - - for (i = 4; ; i++) - { - uint8_t b; - if (get1bit_hcr(ld, &b)) - return -1; - if (b == 0) - break; - } - - if (getbits_hcr(ld, i, &off)) - return -1; - j = off + (1<len; -} - -#endif - diff --git a/mplayer/libfaad2/huffman.h b/mplayer/libfaad2/huffman.h deleted file mode 100644 index b916ab03..00000000 --- a/mplayer/libfaad2/huffman.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: huffman.h,v 1.24 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __HUFFMAN_H__ -#define __HUFFMAN_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -int8_t huffman_scale_factor(bitfile *ld); -uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp); -#ifdef ERROR_RESILIENCE -int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp); -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/ic_predict.c b/mplayer/libfaad2/ic_predict.c deleted file mode 100644 index 022e9e2a..00000000 --- a/mplayer/libfaad2/ic_predict.c +++ /dev/null @@ -1,267 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: ic_predict.c,v 1.23 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#ifdef MAIN_DEC - -#include "syntax.h" -#include "ic_predict.h" -#include "pns.h" - - -static void flt_round(float32_t *pf) -{ - int32_t flg; - uint32_t tmp, tmp1, tmp2; - - tmp = *(uint32_t*)pf; - flg = tmp & (uint32_t)0x00008000; - tmp &= (uint32_t)0xffff0000; - tmp1 = tmp; - /* round 1/2 lsb toward infinity */ - if (flg) - { - tmp &= (uint32_t)0xff800000; /* extract exponent and sign */ - tmp |= (uint32_t)0x00010000; /* insert 1 lsb */ - tmp2 = tmp; /* add 1 lsb and elided one */ - tmp &= (uint32_t)0xff800000; /* extract exponent and sign */ - - *pf = *(float32_t*)&tmp1 + *(float32_t*)&tmp2 - *(float32_t*)&tmp; - } else { - *pf = *(float32_t*)&tmp; - } -} - -static int16_t quant_pred(float32_t x) -{ - int16_t q; - uint32_t *tmp = (uint32_t*)&x; - - q = (int16_t)(*tmp>>16); - - return q; -} - -static float32_t inv_quant_pred(int16_t q) -{ - float32_t x; - uint32_t *tmp = (uint32_t*)&x; - *tmp = ((uint32_t)q)<<16; - - return x; -} - -static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t pred) -{ - uint16_t tmp; - int16_t i, j; - real_t dr1, predictedvalue; - real_t e0, e1; - real_t k1, k2; - - real_t r[2]; - real_t COR[2]; - real_t VAR[2]; - - r[0] = inv_quant_pred(state->r[0]); - r[1] = inv_quant_pred(state->r[1]); - COR[0] = inv_quant_pred(state->COR[0]); - COR[1] = inv_quant_pred(state->COR[1]); - VAR[0] = inv_quant_pred(state->VAR[0]); - VAR[1] = inv_quant_pred(state->VAR[1]); - - -#if 1 - tmp = state->VAR[0]; - j = (tmp >> 7); - i = tmp & 0x7f; - if (j >= 128) - { - j -= 128; - k1 = COR[0] * exp_table[j] * mnt_table[i]; - } else { - k1 = REAL_CONST(0); - } -#else - - { -#define B 0.953125 - real_t c = COR[0]; - real_t v = VAR[0]; - real_t tmp; - if (c == 0 || v <= 1) - { - k1 = 0; - } else { - tmp = B / v; - flt_round(&tmp); - k1 = c * tmp; - } - } -#endif - - if (pred) - { -#if 1 - tmp = state->VAR[1]; - j = (tmp >> 7); - i = tmp & 0x7f; - if (j >= 128) - { - j -= 128; - k2 = COR[1] * exp_table[j] * mnt_table[i]; - } else { - k2 = REAL_CONST(0); - } -#else - -#define B 0.953125 - real_t c = COR[1]; - real_t v = VAR[1]; - real_t tmp; - if (c == 0 || v <= 1) - { - k2 = 0; - } else { - tmp = B / v; - flt_round(&tmp); - k2 = c * tmp; - } -#endif - - predictedvalue = k1*r[0] + k2*r[1]; - flt_round(&predictedvalue); - *output = input + predictedvalue; - } - - /* calculate new state data */ - e0 = *output; - e1 = e0 - k1*r[0]; - dr1 = k1*e0; - - VAR[0] = ALPHA*VAR[0] + 0.5f * (r[0]*r[0] + e0*e0); - COR[0] = ALPHA*COR[0] + r[0]*e0; - VAR[1] = ALPHA*VAR[1] + 0.5f * (r[1]*r[1] + e1*e1); - COR[1] = ALPHA*COR[1] + r[1]*e1; - - r[1] = A * (r[0]-dr1); - r[0] = A * e0; - - state->r[0] = quant_pred(r[0]); - state->r[1] = quant_pred(r[1]); - state->COR[0] = quant_pred(COR[0]); - state->COR[1] = quant_pred(COR[1]); - state->VAR[0] = quant_pred(VAR[0]); - state->VAR[1] = quant_pred(VAR[1]); -} - -static void reset_pred_state(pred_state *state) -{ - state->r[0] = 0; - state->r[1] = 0; - state->COR[0] = 0; - state->COR[1] = 0; - state->VAR[0] = 0x3F80; - state->VAR[1] = 0x3F80; -} - -void pns_reset_pred_state(ic_stream *ics, pred_state *state) -{ - uint8_t sfb, g, b; - uint16_t i, offs, offs2; - - /* prediction only for long blocks */ - if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) - return; - - for (g = 0; g < ics->num_window_groups; g++) - { - for (b = 0; b < ics->window_group_length[g]; b++) - { - for (sfb = 0; sfb < ics->max_sfb; sfb++) - { - if (is_noise(ics, g, sfb)) - { - offs = ics->swb_offset[sfb]; - offs2 = ics->swb_offset[sfb+1]; - - for (i = offs; i < offs2; i++) - reset_pred_state(&state[i]); - } - } - } - } -} - -void reset_all_predictors(pred_state *state, uint16_t frame_len) -{ - uint16_t i; - - for (i = 0; i < frame_len; i++) - reset_pred_state(&state[i]); -} - -/* intra channel prediction */ -void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state, - uint16_t frame_len, uint8_t sf_index) -{ - uint8_t sfb; - uint16_t bin; - - if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) - { - reset_all_predictors(state, frame_len); - } else { - for (sfb = 0; sfb < max_pred_sfb(sf_index); sfb++) - { - uint16_t low = ics->swb_offset[sfb]; - uint16_t high = ics->swb_offset[sfb+1]; - - for (bin = low; bin < high; bin++) - { - ic_predict(&state[bin], spec[bin], &spec[bin], - (ics->predictor_data_present && ics->pred.prediction_used[sfb])); - } - } - - if (ics->predictor_data_present) - { - if (ics->pred.predictor_reset) - { - for (bin = ics->pred.predictor_reset_group_number - 1; - bin < frame_len; bin += 30) - { - reset_pred_state(&state[bin]); - } - } - } - } -} - -#endif diff --git a/mplayer/libfaad2/ic_predict.h b/mplayer/libfaad2/ic_predict.h deleted file mode 100644 index a79a0981..00000000 --- a/mplayer/libfaad2/ic_predict.h +++ /dev/null @@ -1,249 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: ic_predict.h,v 1.19 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifdef MAIN_DEC - -#ifndef __IC_PREDICT_H__ -#define __IC_PREDICT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#define ALPHA REAL_CONST(0.90625) -#define A REAL_CONST(0.953125) - - -void pns_reset_pred_state(ic_stream *ics, pred_state *state); -void reset_all_predictors(pred_state *state, uint16_t frame_len); -void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state, - uint16_t frame_len, uint8_t sf_index); - -ALIGN static const real_t mnt_table[128] = { - COEF_CONST(0.9531250000), COEF_CONST(0.9453125000), - COEF_CONST(0.9375000000), COEF_CONST(0.9296875000), - COEF_CONST(0.9257812500), COEF_CONST(0.9179687500), - COEF_CONST(0.9101562500), COEF_CONST(0.9023437500), - COEF_CONST(0.8984375000), COEF_CONST(0.8906250000), - COEF_CONST(0.8828125000), COEF_CONST(0.8789062500), - COEF_CONST(0.8710937500), COEF_CONST(0.8671875000), - COEF_CONST(0.8593750000), COEF_CONST(0.8515625000), - COEF_CONST(0.8476562500), COEF_CONST(0.8398437500), - COEF_CONST(0.8359375000), COEF_CONST(0.8281250000), - COEF_CONST(0.8242187500), COEF_CONST(0.8203125000), - COEF_CONST(0.8125000000), COEF_CONST(0.8085937500), - COEF_CONST(0.8007812500), COEF_CONST(0.7968750000), - COEF_CONST(0.7929687500), COEF_CONST(0.7851562500), - COEF_CONST(0.7812500000), COEF_CONST(0.7773437500), - COEF_CONST(0.7734375000), COEF_CONST(0.7656250000), - COEF_CONST(0.7617187500), COEF_CONST(0.7578125000), - COEF_CONST(0.7539062500), COEF_CONST(0.7500000000), - COEF_CONST(0.7421875000), COEF_CONST(0.7382812500), - COEF_CONST(0.7343750000), COEF_CONST(0.7304687500), - COEF_CONST(0.7265625000), COEF_CONST(0.7226562500), - COEF_CONST(0.7187500000), COEF_CONST(0.7148437500), - COEF_CONST(0.7109375000), COEF_CONST(0.7070312500), - COEF_CONST(0.6992187500), COEF_CONST(0.6953125000), - COEF_CONST(0.6914062500), COEF_CONST(0.6875000000), - COEF_CONST(0.6835937500), COEF_CONST(0.6796875000), - COEF_CONST(0.6796875000), COEF_CONST(0.6757812500), - COEF_CONST(0.6718750000), COEF_CONST(0.6679687500), - COEF_CONST(0.6640625000), COEF_CONST(0.6601562500), - COEF_CONST(0.6562500000), COEF_CONST(0.6523437500), - COEF_CONST(0.6484375000), COEF_CONST(0.6445312500), - COEF_CONST(0.6406250000), COEF_CONST(0.6406250000), - COEF_CONST(0.6367187500), COEF_CONST(0.6328125000), - COEF_CONST(0.6289062500), COEF_CONST(0.6250000000), - COEF_CONST(0.6210937500), COEF_CONST(0.6210937500), - COEF_CONST(0.6171875000), COEF_CONST(0.6132812500), - COEF_CONST(0.6093750000), COEF_CONST(0.6054687500), - COEF_CONST(0.6054687500), COEF_CONST(0.6015625000), - COEF_CONST(0.5976562500), COEF_CONST(0.5937500000), - COEF_CONST(0.5937500000), COEF_CONST(0.5898437500), - COEF_CONST(0.5859375000), COEF_CONST(0.5820312500), - COEF_CONST(0.5820312500), COEF_CONST(0.5781250000), - COEF_CONST(0.5742187500), COEF_CONST(0.5742187500), - COEF_CONST(0.5703125000), COEF_CONST(0.5664062500), - COEF_CONST(0.5664062500), COEF_CONST(0.5625000000), - COEF_CONST(0.5585937500), COEF_CONST(0.5585937500), - COEF_CONST(0.5546875000), COEF_CONST(0.5507812500), - COEF_CONST(0.5507812500), COEF_CONST(0.5468750000), - COEF_CONST(0.5429687500), COEF_CONST(0.5429687500), - COEF_CONST(0.5390625000), COEF_CONST(0.5390625000), - COEF_CONST(0.5351562500), COEF_CONST(0.5312500000), - COEF_CONST(0.5312500000), COEF_CONST(0.5273437500), - COEF_CONST(0.5273437500), COEF_CONST(0.5234375000), - COEF_CONST(0.5195312500), COEF_CONST(0.5195312500), - COEF_CONST(0.5156250000), COEF_CONST(0.5156250000), - COEF_CONST(0.5117187500), COEF_CONST(0.5117187500), - COEF_CONST(0.5078125000), COEF_CONST(0.5078125000), - COEF_CONST(0.5039062500), COEF_CONST(0.5039062500), - COEF_CONST(0.5000000000), COEF_CONST(0.4980468750), - COEF_CONST(0.4960937500), COEF_CONST(0.4941406250), - COEF_CONST(0.4921875000), COEF_CONST(0.4902343750), - COEF_CONST(0.4882812500), COEF_CONST(0.4863281250), - COEF_CONST(0.4843750000), COEF_CONST(0.4824218750), - COEF_CONST(0.4804687500), COEF_CONST(0.4785156250) -}; - -ALIGN static const real_t exp_table[128] = { - COEF_CONST(0.50000000000000000000000000000000000000000000000000), - COEF_CONST(0.25000000000000000000000000000000000000000000000000), - COEF_CONST(0.12500000000000000000000000000000000000000000000000), - COEF_CONST(0.06250000000000000000000000000000000000000000000000), - COEF_CONST(0.03125000000000000000000000000000000000000000000000), - COEF_CONST(0.01562500000000000000000000000000000000000000000000), - COEF_CONST(0.00781250000000000000000000000000000000000000000000), - COEF_CONST(0.00390625000000000000000000000000000000000000000000), - COEF_CONST(0.00195312500000000000000000000000000000000000000000), - COEF_CONST(0.00097656250000000000000000000000000000000000000000), - COEF_CONST(0.00048828125000000000000000000000000000000000000000), - COEF_CONST(0.00024414062500000000000000000000000000000000000000), - COEF_CONST(0.00012207031250000000000000000000000000000000000000), - COEF_CONST(0.00006103515625000000000000000000000000000000000000), - COEF_CONST(0.00003051757812500000000000000000000000000000000000), - COEF_CONST(0.00001525878906250000000000000000000000000000000000), - COEF_CONST(0.00000762939453125000000000000000000000000000000000), - COEF_CONST(0.00000381469726562500000000000000000000000000000000), - COEF_CONST(0.00000190734863281250000000000000000000000000000000), - COEF_CONST(0.00000095367431640625000000000000000000000000000000), - COEF_CONST(0.00000047683715820312500000000000000000000000000000), - COEF_CONST(0.00000023841857910156250000000000000000000000000000), - COEF_CONST(0.00000011920928955078125000000000000000000000000000), - COEF_CONST(0.00000005960464477539062500000000000000000000000000), - COEF_CONST(0.00000002980232238769531300000000000000000000000000), - COEF_CONST(0.00000001490116119384765600000000000000000000000000), - COEF_CONST(0.00000000745058059692382810000000000000000000000000), - COEF_CONST(0.00000000372529029846191410000000000000000000000000), - COEF_CONST(0.00000000186264514923095700000000000000000000000000), - COEF_CONST(0.00000000093132257461547852000000000000000000000000), - COEF_CONST(0.00000000046566128730773926000000000000000000000000), - COEF_CONST(0.00000000023283064365386963000000000000000000000000), - COEF_CONST(0.00000000011641532182693481000000000000000000000000), - COEF_CONST(0.00000000005820766091346740700000000000000000000000), - COEF_CONST(0.00000000002910383045673370400000000000000000000000), - COEF_CONST(0.00000000001455191522836685200000000000000000000000), - COEF_CONST(0.00000000000727595761418342590000000000000000000000), - COEF_CONST(0.00000000000363797880709171300000000000000000000000), - COEF_CONST(0.00000000000181898940354585650000000000000000000000), - COEF_CONST(0.00000000000090949470177292824000000000000000000000), - COEF_CONST(0.00000000000045474735088646412000000000000000000000), - COEF_CONST(0.00000000000022737367544323206000000000000000000000), - COEF_CONST(0.00000000000011368683772161603000000000000000000000), - COEF_CONST(0.00000000000005684341886080801500000000000000000000), - COEF_CONST(0.00000000000002842170943040400700000000000000000000), - COEF_CONST(0.00000000000001421085471520200400000000000000000000), - COEF_CONST(0.00000000000000710542735760100190000000000000000000), - COEF_CONST(0.00000000000000355271367880050090000000000000000000), - COEF_CONST(0.00000000000000177635683940025050000000000000000000), - COEF_CONST(0.00000000000000088817841970012523000000000000000000), - COEF_CONST(0.00000000000000044408920985006262000000000000000000), - COEF_CONST(0.00000000000000022204460492503131000000000000000000), - COEF_CONST(0.00000000000000011102230246251565000000000000000000), - COEF_CONST(0.00000000000000005551115123125782700000000000000000), - COEF_CONST(0.00000000000000002775557561562891400000000000000000), - COEF_CONST(0.00000000000000001387778780781445700000000000000000), - COEF_CONST(0.00000000000000000693889390390722840000000000000000), - COEF_CONST(0.00000000000000000346944695195361420000000000000000), - COEF_CONST(0.00000000000000000173472347597680710000000000000000), - COEF_CONST(0.00000000000000000086736173798840355000000000000000), - COEF_CONST(0.00000000000000000043368086899420177000000000000000), - COEF_CONST(0.00000000000000000021684043449710089000000000000000), - COEF_CONST(0.00000000000000000010842021724855044000000000000000), - COEF_CONST(0.00000000000000000005421010862427522200000000000000), - COEF_CONST(0.00000000000000000002710505431213761100000000000000), - COEF_CONST(0.00000000000000000001355252715606880500000000000000), - COEF_CONST(0.00000000000000000000677626357803440270000000000000), - COEF_CONST(0.00000000000000000000338813178901720140000000000000), - COEF_CONST(0.00000000000000000000169406589450860070000000000000), - COEF_CONST(0.00000000000000000000084703294725430034000000000000), - COEF_CONST(0.00000000000000000000042351647362715017000000000000), - COEF_CONST(0.00000000000000000000021175823681357508000000000000), - COEF_CONST(0.00000000000000000000010587911840678754000000000000), - COEF_CONST(0.00000000000000000000005293955920339377100000000000), - COEF_CONST(0.00000000000000000000002646977960169688600000000000), - COEF_CONST(0.00000000000000000000001323488980084844300000000000), - COEF_CONST(0.00000000000000000000000661744490042422140000000000), - COEF_CONST(0.00000000000000000000000330872245021211070000000000), - COEF_CONST(0.00000000000000000000000165436122510605530000000000), - COEF_CONST(0.00000000000000000000000082718061255302767000000000), - COEF_CONST(0.00000000000000000000000041359030627651384000000000), - COEF_CONST(0.00000000000000000000000020679515313825692000000000), - COEF_CONST(0.00000000000000000000000010339757656912846000000000), - COEF_CONST(0.00000000000000000000000005169878828456423000000000), - COEF_CONST(0.00000000000000000000000002584939414228211500000000), - COEF_CONST(0.00000000000000000000000001292469707114105700000000), - COEF_CONST(0.00000000000000000000000000646234853557052870000000), - COEF_CONST(0.00000000000000000000000000323117426778526440000000), - COEF_CONST(0.00000000000000000000000000161558713389263220000000), - COEF_CONST(0.00000000000000000000000000080779356694631609000000), - COEF_CONST(0.00000000000000000000000000040389678347315804000000), - COEF_CONST(0.00000000000000000000000000020194839173657902000000), - COEF_CONST(0.00000000000000000000000000010097419586828951000000), - COEF_CONST(0.00000000000000000000000000005048709793414475600000), - COEF_CONST(0.00000000000000000000000000002524354896707237800000), - COEF_CONST(0.00000000000000000000000000001262177448353618900000), - COEF_CONST(0.00000000000000000000000000000631088724176809440000), - COEF_CONST(0.00000000000000000000000000000315544362088404720000), - COEF_CONST(0.00000000000000000000000000000157772181044202360000), - COEF_CONST(0.00000000000000000000000000000078886090522101181000), - COEF_CONST(0.00000000000000000000000000000039443045261050590000), - COEF_CONST(0.00000000000000000000000000000019721522630525295000), - COEF_CONST(0.00000000000000000000000000000009860761315262647600), - COEF_CONST(0.00000000000000000000000000000004930380657631323800), - COEF_CONST(0.00000000000000000000000000000002465190328815661900), - COEF_CONST(0.00000000000000000000000000000001232595164407830900), - COEF_CONST(0.00000000000000000000000000000000616297582203915470), - COEF_CONST(0.00000000000000000000000000000000308148791101957740), - COEF_CONST(0.00000000000000000000000000000000154074395550978870), - COEF_CONST(0.00000000000000000000000000000000077037197775489434), - COEF_CONST(0.00000000000000000000000000000000038518598887744717), - COEF_CONST(0.00000000000000000000000000000000019259299443872359), - COEF_CONST(0.00000000000000000000000000000000009629649721936179), - COEF_CONST(0.00000000000000000000000000000000004814824860968090), - COEF_CONST(0.00000000000000000000000000000000002407412430484045), - COEF_CONST(0.00000000000000000000000000000000001203706215242022), - COEF_CONST(0.00000000000000000000000000000000000601853107621011), - COEF_CONST(0.00000000000000000000000000000000000300926553810506), - COEF_CONST(0.00000000000000000000000000000000000150463276905253), - COEF_CONST(0.00000000000000000000000000000000000075231638452626), - COEF_CONST(0.00000000000000000000000000000000000037615819226313), - COEF_CONST(0.00000000000000000000000000000000000018807909613157), - COEF_CONST(0.00000000000000000000000000000000000009403954806578), - COEF_CONST(0.00000000000000000000000000000000000004701977403289), - COEF_CONST(0.00000000000000000000000000000000000002350988701645), - COEF_CONST(0.00000000000000000000000000000000000001175494350822), - COEF_CONST(0.0 /* 0000000000000000000000000000000000000587747175411 "floating point underflow" */), - COEF_CONST(0.0) -}; - -#ifdef __cplusplus -} -#endif -#endif - -#endif diff --git a/mplayer/libfaad2/iq_table.h b/mplayer/libfaad2/iq_table.h deleted file mode 100644 index 80aca803..00000000 --- a/mplayer/libfaad2/iq_table.h +++ /dev/null @@ -1,16455 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: iq_table.h,v 1.16 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef IQ_TABLE_H__ -#define IQ_TABLE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -/* !!!DON'T CHANGE IQ_TABLE_SIZE!!! */ - - -#ifndef FIXED_POINT - -#define IQ_TABLE_SIZE 8192 - -#ifdef _MSC_VER -#pragma warning(disable:4305) -#pragma warning(disable:4244) -#endif - -ALIGN static const real_t iq_table[IQ_TABLE_SIZE] = -{ - 0, - 1, - 2.5198420997897464, - 4.3267487109222245, - 6.3496042078727974, - 8.5498797333834844, - 10.902723556992836, - 13.390518279406722, - 15.999999999999998, - 18.720754407467133, - 21.544346900318832, - 24.463780996262464, - 27.47314182127996, - 30.567350940369842, - 33.741991698453212, - 36.993181114957046, - 40.317473596635935, - 43.711787041189993, - 47.173345095760126, - 50.699631325716943, - 54.288352331898118, - 57.937407704003519, - 61.6448652744185, - 65.408940536585988, - 69.227979374755591, - 73.100443455321638, - 77.024897778591622, - 80.999999999999986, - 85.024491212518527, - 89.097187944889555, - 93.216975178615741, - 97.382800224133163, - 101.59366732596474, - 105.84863288986224, - 110.14680124343441, - 114.4873208566006, - 118.86938096020653, - 123.29220851090024, - 127.75506545836058, - 132.25724627755247, - 136.79807573413572, - 141.37690685569191, - 145.99311908523086, - 150.6461165966291, - 155.33532675434674, - 160.06019870205279, - 164.82020206673349, - 169.61482576651861, - 174.44357691188537, - 179.30597979112557, - 184.20157493201927, - 189.12991823257562, - 194.09058015449685, - 199.08314497371677, - 204.1072100829694, - 209.16238534187647, - 214.24829247050752, - 219.36456448277784, - 224.51084515641216, - 229.6867885365223, - 234.89205847013176, - 240.12632816923249, - 245.38927980018505, - 250.68060409747261, - 255.99999999999991, - 261.34717430828869, - 266.72184136106449, - 272.12372272986045, - 277.55254693037961, - 283.0080491494619, - 288.48997098659891, - 293.99806020902247, - 299.53207051947408, - 305.0917613358298, - 310.67689758182206, - 316.28724948815585, - 321.92259240337177, - 327.58270661385535, - 333.26737717243742, - 338.97639373507025, - 344.70955040510125, - 350.46664558470013, - 356.24748183302603, - 362.05186573075139, - 367.87960775058258, - 373.73052213344511, - 379.60442677002078, - 385.50114308734607, - 391.42049594019937, - 397.36231350702371, - 403.32642719014467, - 409.31267152006262, - 415.32088406360799, - 421.35090533576471, - 427.40257871497619, - 433.4757503617617, - 439.5702691404793, - 445.68598654408271, - 451.82275662172759, - 457.98043590909128, - 464.15888336127773, - 470.35796028818726, - 476.5775302922363, - 482.81745920832043, - 489.07761504591741, - 495.35786793323581, - 501.65809006331688, - 507.97815564200368, - 514.31794083769648, - 520.67732373281672, - 527.05618427690604, - 533.45440424129174, - 539.87186717525128, - 546.30845836361505, - 552.76406478574609, - 559.23857507584194, - 565.73187948450413, - 572.24386984152341, - 578.77443951983378, - 585.32348340058843, - 591.89089783931263, - 598.47658063309257, - 605.08043098876044, - 611.70234949203643, - 618.3422380775919, - 624.99999999999977, - 631.67553980553748, - 638.36876330481164, - 645.07957754617485, - 651.80789078990415, - 658.55361248311499, - 665.31665323538357, - 672.09692479505225, - 678.8943400261943, - 685.70881288621433, - 692.540258404062, - 699.38859265903977, - 706.25373276018058, - 713.13559682617972, - 720.03410396586037, - 726.94917425915435, - 733.88072873858209, - 740.82868937121543, - 747.79297904110535, - 754.77352153216191, - 761.77024151147043, - 768.78306451302956, - 775.81191692189896, - 782.85672595874246, - 789.91741966475445, - 796.99392688695798, - 804.08617726386274, - 811.19410121147098, - 818.31762990962227, - 825.45669528866563, - 832.61123001644864, - 839.78116748561604, - 846.96644180120552, - 854.16698776853514, - 861.38274088137143, - 868.61363731036977, - 875.85961389178203, - 883.12060811641959, - 890.39655811886757, - 897.68740266694181, - 904.99308115138172, - 912.31353357577188, - 919.64870054668756, - 926.99852326405619, - 934.36294351172899, - 941.74190364825859, - 949.13534659787422, - 956.54321584165211, - 963.96545540887348, - 971.40200986856541, - 978.85282432122176, - 986.31784439069588, - 993.7970162162635, - 1001.29028644485, - 1008.797602223418, - 1016.3189111915103, - 1023.8541614739464, - 1031.4033016736653, - 1038.9662808647138, - 1046.5430485853758, - 1054.1335548314366, - 1061.7377500495838, - 1069.3555851309357, - 1076.9870114046978, - 1084.6319806319441, - 1092.2904449995174, - 1099.9623571140482, - 1107.6476699960892, - 1115.3463370743607, - 1123.058312180106, - 1130.7835495415541, - 1138.5220037784854, - 1146.273629896901, - 1154.0383832837879, - 1161.816219701986, - 1169.607095285146, - 1177.4109665327808, - 1185.2277903054078, - 1193.0575238197798, - 1200.9001246442001, - 1208.7555506939248, - 1216.6237602266442, - 1224.5047118380478, - 1232.3983644574657, - 1240.3046773435874, - 1248.2236100802568, - 1256.1551225723395, - 1264.099175041662, - 1272.0557280230228, - 1280.0247423602691, - 1288.0061792024444, - 1295.9999999999995, - 1304.006166501068, - 1312.0246407478062, - 1320.0553850727929, - 1328.0983620954903, - 1336.1535347187651, - 1344.2208661254647, - 1352.3003197750522, - 1360.3918594002962, - 1368.4954490040145, - 1376.6110528558709, - 1384.7386354892244, - 1392.8781616980295, - 1401.0295965337855, - 1409.1929053025353, - 1417.3680535619119, - 1425.5550071182327, - 1433.7537320236374, - 1441.9641945732744, - 1450.1863613025282, - 1458.4201989842913, - 1466.6656746262797, - 1474.9227554683875, - 1483.1914089800841, - 1491.4716028578516, - 1499.7633050226596, - 1508.0664836174794, - 1516.3811070048375, - 1524.7071437644029, - 1533.0445626906128, - 1541.3933327903342, - 1549.7534232805581, - 1558.1248035861302, - 1566.507443337515, - 1574.9013123685909, - 1583.3063807144795, - 1591.7226186094069, - 1600.1499964845941, - 1608.58848496618, - 1617.0380548731737, - 1625.4986772154357, - 1633.9703231916887, - 1642.4529641875577, - 1650.9465717736346, - 1659.4511177035752, - 1667.9665739122186, - 1676.4929125137353, - 1685.030105799801, - 1693.5781262377957, - 1702.136946469027, - 1710.7065393069795, - 1719.2868777355877, - 1727.8779349075323, - 1736.4796841425596, - 1745.092098925825, - 1753.7151529062583, - 1762.3488198949503, - 1770.9930738635628, - 1779.6478889427597, - 1788.3132394206564, - 1796.9890997412947, - 1805.6754445031333, - 1814.3722484575621, - 1823.0794865074322, - 1831.7971337056094, - 1840.5251652535437, - 1849.2635564998579, - 1858.0122829389563, - 1866.7713202096493, - 1875.5406440937966, - 1884.3202305149687, - 1893.110055537124, - 1901.9100953633042, - 1910.7203263343454, - 1919.5407249276057, - 1928.3712677557098, - 1937.2119315653083, - 1946.0626932358525, - 1954.923529778386, - 1963.79441833435, - 1972.6753361744036, - 1981.5662606972594, - 1990.467169428533, - 1999.3780400196069, - 2008.2988502465078, - 2017.2295780087982, - 2026.1702013284819, - 2035.1206983489212, - 2044.0810473337688, - 2053.0512266659125, - 2062.0312148464309, - 2071.0209904935646, - 2080.0205323416958, - 2089.0298192403443, - 2098.0488301531714, - 2107.0775441569995, - 2116.115940440839, - 2125.1639983049317, - 2134.2216971597995, - 2143.2890165253098, - 2152.3659360297484, - 2161.4524354089031, - 2170.5484945051617, - 2179.6540932666144, - 2188.7692117461711, - 2197.8938301006888, - 2207.0279285901042, - 2216.1714875765838, - 2225.324487523676, - 2234.4869089954782, - 2243.6587326558101, - 2252.8399392673982, - 2262.0305096910702, - 2271.2304248849537, - 2280.4396659036897, - 2289.6582138976523, - 2298.8860501121762, - 2308.1231558867926, - 2317.3695126544767, - 2326.6251019409005, - 2335.8899053636933, - 2345.1639046317132, - 2354.4470815443233, - 2363.7394179906792, - 2373.0408959490205, - 2382.3514974859731, - 2391.6712047558558, - 2400.9999999999991, - 2410.3378655460651, - 2419.6847838073813, - 2429.0407372822747, - 2438.4057085534191, - 2447.7796802871858, - 2457.1626352330004, - 2466.5545562227112, - 2475.9554261699564, - 2485.3652280695474, - 2494.7839449968492, - 2504.2115601071737, - 2513.6480566351788, - 2523.0934178942675, - 2532.5476272760025, - 2542.0106682495189, - 2551.482524360948, - 2560.9631792328441, - 2570.4526165636184, - 2579.9508201269791, - 2589.4577737713744, - 2598.9734614194458, - 2608.4978670674823, - 2618.0309747848837, - 2627.5727687136259, - 2637.1232330677353, - 2646.6823521327647, - 2656.2501102652768, - 2665.8264918923328, - 2675.4114815109842, - 2685.0050636877722, - 2694.6072230582295, - 2704.2179443263894, - 2713.8372122642972, - 2723.4650117115279, - 2733.1013275747096, - 2742.7461448270483, - 2752.3994485078601, - 2762.0612237221085, - 2771.7314556399419, - 2781.4101294962406, - 2791.0972305901655, - 2800.7927442847094, - 2810.4966560062589, - 2820.2089512441521, - 2829.9296155502466, - 2839.6586345384894, - 2849.3959938844923, - 2859.1416793251065, - 2868.8956766580086, - 2878.6579717412847, - 2888.4285504930212, - 2898.2073988908974, - 2907.9945029717837, - 2917.789848831344, - 2927.5934226236377, - 2937.4052105607311, - 2947.2251989123079, - 2957.0533740052865, - 2966.8897222234368, - 2976.734230007005, - 2986.5868838523397, - 2996.4476703115197, - 3006.3165759919889, - 3016.1935875561908, - 3026.0786917212095, - 3035.9718752584108, - 3045.8731249930906, - 3055.7824278041207, - 3065.6997706236039, - 3075.625140436528, - 3085.5585242804245, - 3095.4999092450298, - 3105.4492824719491, - 3115.4066311543256, - 3125.3719425365089, - 3135.3452039137287, - 3145.3264026317715, - 3155.3155260866592, - 3165.3125617243295, - 3175.3174970403229, - 3185.3303195794679, - 3195.35101693557, - 3205.3795767511078, - 3215.4159867169251, - 3225.460234571929, - 3235.5123081027928, - 3245.5721951436558, - 3255.63988357583, - 3265.7153613275095, - 3275.7986163734795, - 3285.8896367348289, - 3295.9884104786665, - 3306.0949257178395, - 3316.2091706106517, - 3326.331133360588, - 3336.4608022160378, - 3346.5981654700231, - 3356.7432114599264, - 3366.8959285672249, - 3377.0563052172211, - 3387.2243298787821, - 3397.3999910640764, - 3407.5832773283128, - 3417.7741772694862, - 3427.9726795281199, - 3438.1787727870123, - 3448.3924457709873, - 3458.6136872466445, - 3468.8424860221107, - 3479.0788309467976, - 3489.3227109111554, - 3499.5741148464344, - 3509.8330317244445, - 3520.0994505573185, - 3530.3733603972751, - 3540.6547503363886, - 3550.9436095063534, - 3561.239927078258, - 3571.5436922623535, - 3581.8548943078308, - 3592.1735225025936, - 3602.4995661730372, - 3612.8330146838275, - 3623.1738574376814, - 3633.5220838751502, - 3643.8776834744031, - 3654.2406457510142, - 3664.6109602577494, - 3674.9886165843564, - 3685.3736043573545, - 3695.7659132398294, - 3706.1655329312248, - 3716.5724531671399, - 3726.9866637191262, - 3737.4081543944876, - 3747.8369150360782, - 3758.2729355221072, - 3768.7162057659411, - 3779.1667157159077, - 3789.6244553551055, - 3800.0894147012082, - 3810.5615838062768, - 3821.0409527565694, - 3831.5275116723533, - 3842.0212507077194, - 3852.522160050396, - 3863.0302299215673, - 3873.5454505756893, - 3884.0678123003108, - 3894.5973054158922, - 3905.1339202756285, - 3915.6776472652732, - 3926.2284768029604, - 3936.7863993390338, - 3947.3514053558706, - 3957.9234853677135, - 3968.5026299204969, - 3979.0888295916798, - 3989.6820749900776, - 4000.2823567556948, - 4010.8896655595613, - 4021.5039921035655, - 4032.1253271202945, - 4042.7536613728694, - 4053.3889856547858, - 4064.0312907897551, - 4074.6805676315448, - 4085.3368070638221, - 4095.9999999999982, - 4106.6701373830711, - 4117.347210185475, - 4128.0312094089259, - 4138.722126084268, - 4149.4199512713267, - 4160.1246760587583, - 4170.8362915638982, - 4181.5547889326181, - 4192.2801593391769, - 4203.0123939860741, - 4213.7514841039101, - 4224.4974209512384, - 4235.2501958144258, - 4246.0098000075095, - 4256.7762248720574, - 4267.549461777031, - 4278.3295021186423, - 4289.1163373202198, - 4299.9099588320714, - 4310.7103581313495, - 4321.5175267219138, - 4332.3314561342004, - 4343.152137925088, - 4353.9795636777671, - 4364.8137250016052, - 4375.6546135320223, - 4386.5022209303588, - 4397.3565388837469, - 4408.2175591049827, - 4419.0852733324018, - 4429.9596733297531, - 4440.8407508860728, - 4451.7284978155603, - 4462.6229059574571, - 4473.5239671759227, - 4484.4316733599126, - 4495.3460164230582, - 4506.2669883035496, - 4517.1945809640119, - 4528.1287863913894, - 4539.069596596828, - 4550.0170036155587, - 4560.9709995067806, - 4571.931576353546, - 4582.898726262647, - 4593.8724413645004, - 4604.8527138130348, - 4615.8395357855816, - 4626.8328994827571, - 4637.8327971283588, - 4648.8392209692511, - 4659.8521632752563, - 4670.8716163390473, - 4681.8975724760394, - 4692.9300240242837, - 4703.9689633443595, - 4715.0143828192668, - 4726.0662748543255, - 4737.1246318770682, - 4748.1894463371373, - 4759.2607107061804, - 4770.3384174777493, - 4781.4225591671993, - 4792.5131283115852, - 4803.6101174695614, - 4814.7135192212854, - 4825.8233261683154, - 4836.9395309335096, - 4848.0621261609349, - 4859.1911045157631, - 4870.3264586841779, - 4881.4681813732768, - 4892.6162653109768, - 4903.7707032459193, - 4914.931487947375, - 4926.0986122051509, - 4937.2720688294967, - 4948.4518506510112, - 4959.637950520555, - 4970.8303613091521, - 4982.0290759079044, - 4993.2340872278974, - 5004.4453882001153, - 5015.6629717753467, - 5026.8868309241007, - 5038.1169586365131, - 5049.353347922266, - 5060.5959918104927, - 5071.8448833496996, - 5083.1000156076734, - 5094.3613816713996, - 5105.6289746469747, - 5116.9027876595246, - 5128.18281385312, - 5139.4690463906918, - 5150.7614784539473, - 5162.0601032432933, - 5173.3649139777472, - 5184.6759038948594, - 5195.9930662506322, - 5207.3163943194386, - 5218.6458813939435, - 5229.9815207850224, - 5241.3233058216847, - 5252.6712298509919, - 5264.025286237983, - 5275.3854683655954, - 5286.7517696345885, - 5298.1241834634639, - 5309.5027032883945, - 5320.887322563146, - 5332.2780347589978, - 5343.6748333646756, - 5355.0777118862716, - 5366.4866638471722, - 5377.901682787985, - 5389.3227622664635, - 5400.749895857437, - 5412.1830771527357, - 5423.622299761123, - 5435.067557308219, - 5446.5188434364318, - 5457.9761518048872, - 5469.4394760893592, - 5480.9088099821975, - 5492.3841471922606, - 5503.8654814448455, - 5515.3528064816201, - 5526.846116060552, - 5538.3454039558474, - 5549.8506639578736, - 5561.3618898731029, - 5572.8790755240361, - 5584.4022147491451, - 5595.9313014027975, - 5607.4663293552012, - 5619.0072924923297, - 5630.5541847158656, - 5642.1069999431284, - 5653.665732107017, - 5665.230375155943, - 5676.8009230537655, - 5688.3773697797333, - 5699.9597093284156, - 5711.5479357096474, - 5723.1420429484588, - 5734.7420250850209, - 5746.347876174581, - 5757.9595902874016, - 5769.5771615087006, - 5781.2005839385911, - 5792.8298516920213, - 5804.4649588987149, - 5816.1058997031105, - 5827.7526682643065, - 5839.4052587559972, - 5851.0636653664196, - 5862.7278822982908, - 5874.3979037687541, - 5886.0737240093204, - 5897.7553372658094, - 5909.4427377982956, - 5921.1359198810505, - 5932.8348778024874, - 5944.5396058651031, - 5956.2500983854261, - 5967.9663496939575, - 5979.6883541351208, - 5991.4161060672022, - 6003.1495998623004, - 6014.8888299062692, - 6026.6337905986684, - 6038.3844763527022, - 6050.1408815951781, - 6061.9030007664414, - 6073.6708283203316, - 6085.4443587241267, - 6097.2235864584891, - 6109.0085060174197, - 6120.7991119081998, - 6132.595398651345, - 6144.3973607805519, - 6156.2049928426459, - 6168.0182893975361, - 6179.8372450181578, - 6191.6618542904307, - 6203.4921118132024, - 6215.3280121982016, - 6227.1695500699925, - 6239.0167200659189, - 6250.8695168360628, - 6262.7279350431891, - 6274.5919693627056, - 6286.4616144826068, - 6298.3368651034316, - 6310.2177159382172, - 6322.1041617124456, - 6333.9961971640032, - 6345.8938170431311, - 6357.7970161123785, - 6369.7057891465583, - 6381.6201309327007, - 6393.5400362700075, - 6405.4654999698032, - 6417.3965168554978, - 6429.3330817625329, - 6441.2751895383453, - 6453.2228350423138, - 6465.176013145724, - 6477.134718731716, - 6489.0989466952469, - 6501.0686919430445, - 6513.0439493935628, - 6525.0247139769417, - 6537.010980634961, - 6549.002744321001, - 6560.9999999999973, - 6573.0027426483985, - 6585.0109672541284, - 6597.0246688165371, - 6609.0438423463656, - 6621.0684828657004, - 6633.0985854079354, - 6645.134145017727, - 6657.1751567509573, - 6669.2216156746908, - 6681.2735168671343, - 6693.3308554176001, - 6705.3936264264594, - 6717.461825005108, - 6729.535446275926, - 6741.6144853722335, - 6753.6989374382601, - 6765.7887976290967, - 6777.8840611106634, - 6789.9847230596661, - 6802.0907786635626, - 6814.2022231205201, - 6826.3190516393797, - 6838.4412594396181, - 6850.5688417513074, - 6862.701793815083, - 6874.840110882099, - 6886.9837882139991, - 6899.1328210828724, - 6911.2872047712199, - 6923.4469345719199, - 6935.6120057881863, - 6947.7824137335365, - 6959.9581537317536, - 6972.1392211168532, - 6984.3256112330409, - 6996.5173194346862, - 7008.7143410862773, - 7020.9166715623942, - 7033.1243062476678, - 7045.3372405367481, - 7057.5554698342685, - 7069.7789895548103, - 7082.0077951228714, - 7094.2418819728273, - 7106.4812455489018, - 7118.7258813051285, - 7130.9757847053224, - 7143.2309512230404, - 7155.4913763415516, - 7167.7570555538041, - 7180.0279843623894, - 7192.3041582795131, - 7204.5855728269571, - 7216.8722235360519, - 7229.1641059476406, - 7241.4612156120484, - 7253.7635480890503, - 7266.0710989478375, - 7278.3838637669869, - 7290.7018381344296, - 7303.0250176474174, - 7315.3533979124932, - 7327.6869745454596, - 7340.0257431713462, - 7352.3696994243801, - 7364.7188389479543, - 7377.0731573945968, - 7389.4326504259407, - 7401.7973137126937, - 7414.1671429346061, - 7426.5421337804428, - 7438.922281947951, - 7451.3075831438346, - 7463.6980330837177, - 7476.0936274921214, - 7488.4943621024304, - 7500.9002326568652, - 7513.3112349064522, - 7525.7273646109943, - 7538.1486175390446, - 7550.5749894678729, - 7563.0064761834419, - 7575.4430734803736, - 7587.8847771619248, - 7600.3315830399597, - 7612.7834869349153, - 7625.24048467578, - 7637.7025721000637, - 7650.1697450537677, - 7662.6419993913596, - 7675.1193309757446, - 7687.6017356782404, - 7700.0892093785433, - 7712.5817479647112, - 7725.079347333125, - 7737.5820033884729, - 7750.0897120437139, - 7762.6024692200581, - 7775.1202708469355, - 7787.6431128619733, - 7800.1709912109645, - 7812.7039018478481, - 7825.2418407346768, - 7837.7848038415968, - 7850.3327871468155, - 7862.8857866365806, - 7875.4437983051539, - 7888.006818154784, - 7900.5748421956796, - 7913.1478664459901, - 7925.725886931772, - 7938.3088996869719, - 7950.8969007533951, - 7963.4898861806851, - 7976.0878520262959, - 7988.6907943554688, - 8001.2987092412086, - 8013.911592764257, - 8026.5294410130691, - 8039.1522500837891, - 8051.7800160802271, - 8064.412735113835, - 8077.0504033036796, - 8089.6930167764222, - 8102.3405716662946, - 8114.9930641150731, - 8127.6504902720571, - 8140.3128462940449, - 8152.9801283453098, - 8165.6523325975786, - 8178.3294552300049, - 8191.0114924291529, - 8203.6984403889655, - 8216.3902953107463, - 8229.0870534031419, - 8241.7887108821069, - 8254.4952639708936, - 8267.2067089000211, - 8279.9230419072574, - 8292.6442592375952, - 8305.3703571432306, - 8318.101331883543, - 8330.8371797250657, - 8343.577896941475, - 8356.3234798135582, - 8369.0739246291978, - 8381.8292276833508, - 8394.5893852780209, - 8407.3543937222421, - 8420.1242493320569, - 8432.8989484304948, - 8445.6784873475499, - 8458.4628624201578, - 8471.2520699921806, - 8484.0461064143838, - 8496.8449680444082, - 8509.6486512467636, - 8522.4571523927953, - 8535.270467860666, - 8548.0885940353437, - 8560.9115273085663, - 8573.7392640788403, - 8586.5718007514006, - 8599.4091337382069, - 8612.2512594579148, - 8625.0981743358552, - 8637.9498748040205, - 8650.8063573010386, - 8663.6676182721567, - 8676.533654169225, - 8689.4044614506638, - 8702.2800365814601, - 8715.1603760331418, - 8728.0454762837508, - 8740.9353338178389, - 8753.8299451264356, - 8766.7293067070332, - 8779.6334150635721, - 8792.5422667064158, - 8805.4558581523324, - 8818.3741859244819, - 8831.2972465523908, - 8844.2250365719356, - 8857.1575525253265, - 8870.0947909610859, - 8883.0367484340295, - 8895.9834215052524, - 8908.934806742107, - 8921.8909007181846, - 8934.8517000132997, - 8947.817201213471, - 8960.7874009109, - 8973.7622957039603, - 8986.7418821971733, - 8999.7261570011924, - 9012.7151167327884, - 9025.7087580148236, - 9038.7070774762469, - 9051.7100717520643, - 9064.7177374833282, - 9077.7300713171153, - 9090.7470699065179, - 9103.7687299106146, - 9116.7950479944648, - 9129.8260208290812, - 9142.8616450914233, - 9155.9019174643727, - 9168.9468346367157, - 9181.9963933031358, - 9195.0505901641845, - 9208.1094219262741, - 9221.1728853016557, - 9234.240977008405, - 9247.3136937704076, - 9260.3910323173386, - 9273.472989384647, - 9286.5595617135423, - 9299.6507460509747, - 9312.7465391496207, - 9325.8469377678684, - 9338.9519386698012, - 9352.0615386251757, - 9365.1757344094131, - 9378.2945228035842, - 9391.4179005943843, - 9404.5458645741273, - 9417.6784115407263, - 9430.8155382976747, - 9443.9572416540359, - 9457.1035184244265, - 9470.2543654290002, - 9483.4097794934296, - 9496.5697574488931, - 9509.7342961320664, - 9522.9033923850911, - 9536.0770430555804, - 9549.2552449965824, - 9562.4379950665825, - 9575.6252901294793, - 9588.8171270545736, - 9602.0135027165488, - 9615.2144139954635, - 9628.4198577767274, - 9641.629830951093, - 9654.844330414644, - 9668.0633530687719, - 9681.286895820167, - 9694.5149555808002, - 9707.7475292679192, - 9720.9846138040157, - 9734.2262061168276, - 9747.4723031393187, - 9760.7229018096641, - 9773.9779990712323, - 9787.2375918725811, - 9800.5016771674327, - 9813.7702519146696, - 9827.0433130783094, - 9840.3208576275028, - 9853.602882536512, - 9866.8893847846994, - 9880.1803613565116, - 9893.4758092414686, - 9906.7757254341523, - 9920.0801069341851, - 9933.3889507462245, - 9946.7022538799429, - 9960.0200133500221, - 9973.3422261761298, - 9986.6688893829159, - 9999.9999999999945, - 10013.335555061929, - 10026.675551608221, - 10040.019986683301, - 10053.368857336509, - 10066.722160622081, - 10080.079893599144, - 10093.442053331697, - 10106.808636888598, - 10120.179641343551, - 10133.555063775095, - 10146.934901266595, - 10160.31915090622, - 10173.707809786936, - 10187.100875006496, - 10200.498343667417, - 10213.900212876984, - 10227.306479747222, - 10240.717141394889, - 10254.132194941467, - 10267.551637513146, - 10280.975466240814, - 10294.40367826004, - 10307.836270711066, - 10321.273240738796, - 10334.71458549278, - 10348.160302127204, - 10361.610387800878, - 10375.064839677221, - 10388.523654924258, - 10401.986830714593, - 10415.454364225412, - 10428.926252638465, - 10442.402493140049, - 10455.883082921007, - 10469.368019176709, - 10482.85729910704, - 10496.350919916393, - 10509.848878813653, - 10523.351173012188, - 10536.857799729838, - 10550.3687561889, - 10563.884039616123, - 10577.403647242685, - 10590.927576304197, - 10604.455824040679, - 10617.988387696556, - 10631.525264520642, - 10645.066451766135, - 10658.611946690598, - 10672.161746555956, - 10685.715848628475, - 10699.274250178762, - 10712.836948481747, - 10726.403940816675, - 10739.975224467091, - 10753.550796720834, - 10767.130654870027, - 10780.714796211059, - 10794.303218044579, - 10807.895917675487, - 10821.492892412922, - 10835.094139570248, - 10848.699656465047, - 10862.309440419107, - 10875.923488758415, - 10889.541798813138, - 10903.16436791762, - 10916.791193410372, - 10930.422272634056, - 10944.05760293548, - 10957.697181665582, - 10971.341006179427, - 10984.98907383619, - 10998.641381999149, - 11012.297928035676, - 11025.958709317223, - 11039.623723219316, - 11053.292967121541, - 11066.966438407539, - 11080.64413446499, - 11094.326052685608, - 11108.012190465128, - 11121.702545203296, - 11135.397114303863, - 11149.095895174571, - 11162.798885227143, - 11176.506081877278, - 11190.217482544635, - 11203.933084652828, - 11217.652885629415, - 11231.376882905886, - 11245.105073917659, - 11258.837456104062, - 11272.574026908333, - 11286.314783777601, - 11300.059724162888, - 11313.808845519083, - 11327.562145304952, - 11341.319620983111, - 11355.081270020033, - 11368.847089886023, - 11382.617078055218, - 11396.391232005579, - 11410.169549218874, - 11423.952027180676, - 11437.738663380349, - 11451.529455311042, - 11465.324400469679, - 11479.123496356951, - 11492.926740477304, - 11506.734130338931, - 11520.545663453764, - 11534.361337337466, - 11548.181149509423, - 11562.005097492724, - 11575.83317881417, - 11589.665391004253, - 11603.501731597149, - 11617.342198130715, - 11631.186788146468, - 11645.035499189589, - 11658.888328808911, - 11672.745274556904, - 11686.606333989675, - 11700.471504666955, - 11714.340784152086, - 11728.214170012021, - 11742.091659817312, - 11755.973251142101, - 11769.858941564111, - 11783.748728664636, - 11797.642610028539, - 11811.540583244237, - 11825.442645903697, - 11839.34879560242, - 11853.259029939445, - 11867.173346517333, - 11881.091742942155, - 11895.014216823492, - 11908.940765774427, - 11922.871387411526, - 11936.806079354839, - 11950.744839227897, - 11964.687664657684, - 11978.634553274653, - 11992.585502712702, - 12006.540510609168, - 12020.499574604828, - 12034.462692343877, - 12048.429861473938, - 12062.401079646032, - 12076.376344514589, - 12090.355653737433, - 12104.339004975769, - 12118.326395894188, - 12132.317824160644, - 12146.313287446457, - 12160.312783426305, - 12174.316309778205, - 12188.323864183525, - 12202.335444326955, - 12216.351047896511, - 12230.370672583531, - 12244.394316082657, - 12258.421976091831, - 12272.453650312296, - 12286.489336448574, - 12300.529032208471, - 12314.572735303058, - 12328.620443446678, - 12342.672154356922, - 12356.727865754638, - 12370.787575363909, - 12384.851280912055, - 12398.918980129623, - 12412.990670750381, - 12427.066350511306, - 12441.146017152583, - 12455.229668417589, - 12469.317302052901, - 12483.40891580827, - 12497.50450743663, - 12511.604074694078, - 12525.707615339878, - 12539.815127136444, - 12553.926607849342, - 12568.042055247275, - 12582.161467102082, - 12596.284841188726, - 12610.41217528529, - 12624.543467172971, - 12638.678714636069, - 12652.817915461985, - 12666.961067441209, - 12681.108168367316, - 12695.259216036962, - 12709.414208249869, - 12723.573142808827, - 12737.736017519681, - 12751.902830191326, - 12766.073578635704, - 12780.248260667788, - 12794.426874105588, - 12808.609416770132, - 12822.795886485468, - 12836.986281078653, - 12851.180598379744, - 12865.378836221802, - 12879.580992440871, - 12893.787064875984, - 12907.997051369144, - 12922.210949765335, - 12936.428757912496, - 12950.650473661524, - 12964.876094866273, - 12979.105619383534, - 12993.339045073039, - 13007.576369797454, - 13021.817591422368, - 13036.062707816285, - 13050.311716850629, - 13064.564616399723, - 13078.821404340792, - 13093.082078553954, - 13107.346636922217, - 13121.615077331464, - 13135.887397670458, - 13150.163595830827, - 13164.44366970706, - 13178.727617196502, - 13193.015436199352, - 13207.307124618648, - 13221.602680360265, - 13235.902101332911, - 13250.205385448118, - 13264.512530620239, - 13278.823534766434, - 13293.138395806676, - 13307.457111663734, - 13321.779680263176, - 13336.106099533356, - 13350.436367405409, - 13364.77048181325, - 13379.108440693562, - 13393.450241985796, - 13407.795883632158, - 13422.145363577607, - 13436.498679769853, - 13450.855830159346, - 13465.216812699266, - 13479.581625345529, - 13493.950266056772, - 13508.32273279435, - 13522.699023522329, - 13537.079136207483, - 13551.463068819286, - 13565.850819329906, - 13580.2423857142, - 13594.63776594971, - 13609.036958016657, - 13623.439959897927, - 13637.846769579081, - 13652.257385048335, - 13666.67180429656, - 13681.090025317284, - 13695.512046106669, - 13709.937864663521, - 13724.367478989278, - 13738.800887088004, - 13753.238086966385, - 13767.679076633727, - 13782.123854101939, - 13796.572417385545, - 13811.024764501659, - 13825.480893469998, - 13839.94080231286, - 13854.404489055134, - 13868.871951724283, - 13883.34318835034, - 13897.818196965914, - 13912.296975606168, - 13926.779522308825, - 13941.26583511416, - 13955.755912064991, - 13970.249751206682, - 13984.747350587126, - 13999.248708256751, - 14013.753822268511, - 14028.262690677873, - 14042.775311542828, - 14057.291682923867, - 14071.811802883994, - 14086.335669488704, - 14100.863280805994, - 14115.394634906341, - 14129.92972986271, - 14144.468563750548, - 14159.01113464777, - 14173.55744063476, - 14188.107479794369, - 14202.661250211901, - 14217.218749975118, - 14231.779977174227, - 14246.344929901879, - 14260.913606253163, - 14275.486004325601, - 14290.062122219146, - 14304.641958036171, - 14319.225509881464, - 14333.812775862236, - 14348.403754088098, - 14362.998442671067, - 14377.59683972556, - 14392.198943368388, - 14406.804751718748, - 14421.414262898223, - 14436.027475030774, - 14450.64438624274, - 14465.264994662828, - 14479.889298422106, - 14494.517295654005, - 14509.148984494313, - 14523.784363081166, - 14538.423429555049, - 14553.066182058781, - 14567.712618737527, - 14582.362737738777, - 14597.016537212348, - 14611.674015310382, - 14626.33517018734, - 14640.999999999993, - 14655.668502907418, - 14670.340677071003, - 14685.016520654426, - 14699.696031823671, - 14714.379208746999, - 14729.066049594967, - 14743.756552540408, - 14758.45071575843, - 14773.148537426418, - 14787.850015724018, - 14802.555148833142, - 14817.263934937961, - 14831.976372224897, - 14846.692458882624, - 14861.41219310206, - 14876.135573076363, - 14890.862597000923, - 14905.593263073371, - 14920.327569493558, - 14935.065514463557, - 14949.807096187662, - 14964.552312872382, - 14979.301162726431, - 14994.053643960735, - 15008.809754788414, - 15023.569493424788, - 15038.332858087369, - 15053.099846995858, - 15067.870458372134, - 15082.644690440264, - 15097.422541426484, - 15112.204009559202, - 15126.989093068994, - 15141.777790188597, - 15156.570099152905, - 15171.366018198967, - 15186.165545565986, - 15200.968679495301, - 15215.775418230402, - 15230.585760016909, - 15245.399703102579, - 15260.217245737298, - 15275.038386173073, - 15289.863122664035, - 15304.691453466432, - 15319.523376838621, - 15334.358891041069, - 15349.197994336346, - 15364.040684989128, - 15378.886961266177, - 15393.736821436356, - 15408.590263770609, - 15423.447286541972, - 15438.307888025554, - 15453.172066498542, - 15468.039820240196, - 15482.91114753184, - 15497.786046656869, - 15512.664515900733, - 15527.546553550939, - 15542.432157897045, - 15557.32132723066, - 15572.214059845435, - 15587.110354037064, - 15602.010208103273, - 15616.913620343823, - 15631.820589060506, - 15646.731112557136, - 15661.645189139546, - 15676.562817115593, - 15691.483994795139, - 15706.408720490062, - 15721.336992514242, - 15736.268809183561, - 15751.204168815901, - 15766.143069731135, - 15781.085510251132, - 15796.03148869974, - 15810.981003402798, - 15825.934052688119, - 15840.890634885489, - 15855.850748326673, - 15870.814391345401, - 15885.781562277361, - 15900.752259460214, - 15915.726481233565, - 15930.704225938984, - 15945.685491919978, - 15960.670277522009, - 15975.658581092481, - 15990.65040098073, - 16005.645735538035, - 16020.644583117599, - 16035.646942074556, - 16050.652810765967, - 16065.662187550806, - 16080.675070789974, - 16095.691458846273, - 16110.711350084424, - 16125.734742871053, - 16140.761635574685, - 16155.792026565747, - 16170.825914216561, - 16185.863296901338, - 16200.904172996183, - 16215.948540879079, - 16230.996398929899, - 16246.047745530386, - 16261.102579064163, - 16276.160897916721, - 16291.22270047542, - 16306.287985129484, - 16321.356750269995, - 16336.428994289896, - 16351.504715583982, - 16366.5839125489, - 16381.666583583141, - 16396.752727087041, - 16411.842341462776, - 16426.935425114363, - 16442.031976447644, - 16457.131993870298, - 16472.235475791829, - 16487.342420623561, - 16502.452826778641, - 16517.566692672033, - 16532.684016720516, - 16547.804797342676, - 16562.929032958902, - 16578.056721991394, - 16593.18786286415, - 16608.322454002962, - 16623.460493835417, - 16638.601980790896, - 16653.746913300558, - 16668.895289797354, - 16684.047108716015, - 16699.202368493046, - 16714.361067566726, - 16729.523204377107, - 16744.688777366009, - 16759.857784977012, - 16775.030225655464, - 16790.206097848466, - 16805.385400004874, - 16820.568130575302, - 16835.754288012104, - 16850.943870769381, - 16866.136877302983, - 16881.333306070494, - 16896.53315553123, - 16911.736424146249, - 16926.943110378332, - 16942.153212691992, - 16957.366729553454, - 16972.583659430682, - 16987.804000793338, - 17003.027752112816, - 17018.254911862205, - 17033.485478516312, - 17048.719450551645, - 17063.956826446421, - 17079.197604680547, - 17094.44178373563, - 17109.689362094967, - 17124.940338243552, - 17140.194710668064, - 17155.452477856852, - 17170.713638299967, - 17185.978190489128, - 17201.246132917724, - 17216.517464080825, - 17231.792182475165, - 17247.070286599141, - 17262.351774952826, - 17277.636646037936, - 17292.924898357855, - 17308.216530417623, - 17323.511540723921, - 17338.809927785089, - 17354.111690111105, - 17369.416826213594, - 17384.725334605821, - 17400.037213802683, - 17415.352462320716, - 17430.67107867809, - 17445.993061394587, - 17461.318408991636, - 17476.647119992274, - 17491.979192921168, - 17507.314626304586, - 17522.653418670423, - 17537.995568548187, - 17553.341074468986, - 17568.689934965536, - 17584.042148572156, - 17599.397713824768, - 17614.75662926089, - 17630.118893419625, - 17645.484504841683, - 17660.853462069354, - 17676.225763646511, - 17691.601408118619, - 17706.980394032718, - 17722.362719937424, - 17737.748384382936, - 17753.137385921014, - 17768.529723104999, - 17783.92539448979, - 17799.324398631856, - 17814.726734089225, - 17830.13239942148, - 17845.541393189767, - 17860.95371395678, - 17876.369360286772, - 17891.788330745527, - 17907.210623900395, - 17922.636238320254, - 17938.065172575527, - 17953.497425238176, - 17968.932994881692, - 17984.371880081104, - 17999.814079412972, - 18015.259591455371, - 18030.708414787914, - 18046.160547991731, - 18061.615989649465, - 18077.074738345284, - 18092.536792664861, - 18108.002151195393, - 18123.470812525571, - 18138.942775245599, - 18154.418037947191, - 18169.896599223546, - 18185.37845766938, - 18200.863611880886, - 18216.352060455767, - 18231.843801993204, - 18247.338835093873, - 18262.837158359936, - 18278.338770395032, - 18293.84366980429, - 18309.351855194309, - 18324.863325173166, - 18340.378078350412, - 18355.896113337069, - 18371.417428745623, - 18386.942023190033, - 18402.469895285718, - 18418.00104364955, - 18433.53546689987, - 18449.073163656474, - 18464.614132540602, - 18480.158372174956, - 18495.705881183676, - 18511.256658192357, - 18526.810701828035, - 18542.368010719183, - 18557.928583495715, - 18573.492418788985, - 18589.059515231773, - 18604.629871458303, - 18620.203486104212, - 18635.78035780658, - 18651.360485203899, - 18666.943866936086, - 18682.53050164448, - 18698.120387971841, - 18713.713524562332, - 18729.30991006154, - 18744.909543116457, - 18760.512422375479, - 18776.118546488418, - 18791.727914106479, - 18807.340523882274, - 18822.95637446981, - 18838.575464524489, - 18854.197792703111, - 18869.823357663863, - 18885.452158066328, - 18901.08419257147, - 18916.719459841639, - 18932.357958540564, - 18947.999687333362, - 18963.644644886521, - 18979.292829867907, - 18994.944240946759, - 19010.598876793687, - 19026.256736080668, - 19041.917817481048, - 19057.582119669532, - 19073.2496413222, - 19088.920381116473, - 19104.594337731145, - 19120.271509846356, - 19135.951896143604, - 19151.635495305738, - 19167.322306016948, - 19183.012326962784, - 19198.705556830122, - 19214.401994307198, - 19230.101638083579, - 19245.804486850167, - 19261.510539299208, - 19277.219794124274, - 19292.932250020265, - 19308.647905683421, - 19324.366759811302, - 19340.088811102793, - 19355.8140582581, - 19371.542499978754, - 19387.2741349676, - 19403.008961928797, - 19418.746979567823, - 19434.488186591469, - 19450.232581707827, - 19465.980163626304, - 19481.730931057613, - 19497.484882713761, - 19513.242017308068, - 19529.002333555141, - 19544.765830170898, - 19560.532505872539, - 19576.302359378566, - 19592.075389408761, - 19607.851594684209, - 19623.630973927269, - 19639.41352586159, - 19655.199249212103, - 19670.988142705017, - 19686.780205067826, - 19702.575435029288, - 19718.373831319448, - 19734.175392669615, - 19749.980117812371, - 19765.788005481569, - 19781.599054412323, - 19797.413263341008, - 19813.230631005274, - 19829.051156144014, - 19844.874837497395, - 19860.701673806827, - 19876.531663814985, - 19892.364806265789, - 19908.201099904403, - 19924.040543477258, - 19939.883135732012, - 19955.728875417579, - 19971.577761284105, - 19987.429792082985, - 20003.284966566847, - 20019.14328348956, - 20035.004741606219, - 20050.869339673161, - 20066.737076447946, - 20082.607950689362, - 20098.481961157428, - 20114.359106613385, - 20130.239385819699, - 20146.122797540058, - 20162.009340539353, - 20177.899013583716, - 20193.791815440476, - 20209.687744878182, - 20225.586800666591, - 20241.488981576669, - 20257.394286380597, - 20273.302713851754, - 20289.214262764715, - 20305.128931895277, - 20321.046720020415, - 20336.967625918318, - 20352.891648368361, - 20368.818786151114, - 20384.749038048347, - 20400.682402843009, - 20416.618879319249, - 20432.558466262391, - 20448.501162458953, - 20464.446966696629, - 20480.395877764302, - 20496.347894452025, - 20512.303015551031, - 20528.261239853735, - 20544.22256615372, - 20560.186993245738, - 20576.15451992572, - 20592.125144990758, - 20608.098867239107, - 20624.075685470198, - 20640.055598484618, - 20656.038605084115, - 20672.024704071595, - 20688.013894251126, - 20704.006174427926, - 20720.001543408373, - 20735.999999999989, - 20752.001543011454, - 20768.006171252597, - 20784.013883534382, - 20800.024678668931, - 20816.038555469506, - 20832.055512750507, - 20848.075549327474, - 20864.098664017085, - 20880.124855637161, - 20896.154123006647, - 20912.186464945626, - 20928.221880275312, - 20944.260367818049, - 20960.301926397311, - 20976.346554837684, - 20992.394251964895, - 21008.445016605787, - 21024.498847588318, - 21040.555743741574, - 21056.615703895754, - 21072.678726882168, - 21088.744811533252, - 21104.813956682538, - 21120.886161164683, - 21136.961423815443, - 21153.039743471683, - 21169.121118971379, - 21185.205549153605, - 21201.293032858535, - 21217.383568927453, - 21233.477156202731, - 21249.573793527841, - 21265.673479747358, - 21281.776213706937, - 21297.881994253334, - 21313.990820234398, - 21330.102690499054, - 21346.21760389733, - 21362.335559280327, - 21378.456555500241, - 21394.580591410333, - 21410.707665864964, - 21426.83777771956, - 21442.970925830628, - 21459.107109055756, - 21475.246326253604, - 21491.388576283895, - 21507.533858007431, - 21523.682170286087, - 21539.833511982797, - 21555.987881961566, - 21572.145279087465, - 21588.305702226615, - 21604.469150246216, - 21620.635622014521, - 21636.805116400832, - 21652.977632275521, - 21669.153168510009, - 21685.331723976764, - 21701.513297549318, - 21717.697888102244, - 21733.885494511167, - 21750.076115652759, - 21766.269750404736, - 21782.466397645861, - 21798.666056255934, - 21814.868725115801, - 21831.074403107345, - 21847.283089113484, - 21863.494782018177, - 21879.709480706417, - 21895.927184064229, - 21912.147890978667, - 21928.371600337818, - 21944.598311030797, - 21960.828021947746, - 21977.060731979829, - 21993.296440019243, - 22009.535144959198, - 22025.77684569393, - 22042.021541118691, - 22058.269230129757, - 22074.519911624411, - 22090.773584500959, - 22107.030247658717, - 22123.289899998013, - 22139.552540420187, - 22155.818167827587, - 22172.086781123569, - 22188.358379212495, - 22204.632960999726, - 22220.910525391639, - 22237.191071295601, - 22253.474597619981, - 22269.761103274148, - 22286.050587168469, - 22302.343048214312, - 22318.638485324027, - 22334.936897410968, - 22351.23828338947, - 22367.542642174871, - 22383.849972683485, - 22400.160273832618, - 22416.473544540564, - 22432.789783726603, - 22449.108990310986, - 22465.431163214958, - 22481.75630136074, - 22498.084403671528, - 22514.415469071497, - 22530.749496485802, - 22547.086484840562, - 22563.426433062879, - 22579.769340080824, - 22596.115204823436, - 22612.464026220721, - 22628.815803203655, - 22645.170534704179, - 22661.5282196552, - 22677.888856990587, - 22694.252445645168, - 22710.618984554734, - 22726.988472656034, - 22743.360908886778, - 22759.736292185622, - 22776.114621492186, - 22792.495895747044, - 22808.880113891719, - 22825.267274868678, - 22841.657377621348, - 22858.050421094096, - 22874.446404232243, - 22890.845325982053, - 22907.247185290722, - 22923.651981106406, - 22940.059712378195, - 22956.470378056114, - 22972.883977091129, - 22989.300508435153, - 23005.719971041017, - 23022.142363862498, - 23038.567685854305, - 23054.995935972078, - 23071.427113172387, - 23087.86121641273, - 23104.298244651531, - 23120.738196848146, - 23137.181071962848, - 23153.626868956846, - 23170.075586792263, - 23186.527224432142, - 23202.981780840448, - 23219.439254982066, - 23235.899645822796, - 23252.362952329357, - 23268.829173469378, - 23285.298308211408, - 23301.770355524899, - 23318.245314380223, - 23334.723183748658, - 23351.203962602387, - 23367.687649914504, - 23384.174244659007, - 23400.663745810798, - 23417.15615234568, - 23433.651463240367, - 23450.149677472462, - 23466.650794020472, - 23483.154811863806, - 23499.661729982763, - 23516.171547358543, - 23532.684262973235, - 23549.199875809823, - 23565.718384852185, - 23582.239789085092, - 23598.764087494197, - 23615.291279066041, - 23631.821362788058, - 23648.354337648565, - 23664.890202636761, - 23681.428956742733, - 23697.970598957443, - 23714.515128272738, - 23731.062543681343, - 23747.612844176863, - 23764.166028753778, - 23780.72209640744, - 23797.281046134085, - 23813.842876930816, - 23830.407587795606, - 23846.975177727301, - 23863.545645725622, - 23880.11899079115, - 23896.695211925336, - 23913.274308130498, - 23929.856278409821, - 23946.441121767348, - 23963.028837207989, - 23979.619423737513, - 23996.212880362549, - 24012.809206090584, - 24029.408399929966, - 24046.010460889898, - 24062.615387980433, - 24079.223180212492, - 24095.833836597827, - 24112.447356149063, - 24129.063737879667, - 24145.682980803951, - 24162.305083937081, - 24178.930046295067, - 24195.557866894767, - 24212.188544753884, - 24228.822078890964, - 24245.458468325389, - 24262.097712077397, - 24278.739809168052, - 24295.384758619261, - 24312.032559453768, - 24328.683210695162, - 24345.336711367858, - 24361.993060497109, - 24378.652257108995, - 24395.314300230442, - 24411.979188889192, - 24428.646922113825, - 24445.317498933746, - 24461.990918379193, - 24478.667179481225, - 24495.346281271726, - 24512.028222783407, - 24528.713003049801, - 24545.400621105266, - 24562.091075984976, - 24578.784366724925, - 24595.480492361927, - 24612.179451933614, - 24628.881244478438, - 24645.585869035654, - 24662.293324645343, - 24679.003610348394, - 24695.716725186514, - 24712.432668202211, - 24729.151438438807, - 24745.873034940436, - 24762.597456752032, - 24779.324702919344, - 24796.054772488926, - 24812.787664508123, - 24829.5233780251, - 24846.261912088819, - 24863.003265749034, - 24879.747438056307, - 24896.494428062004, - 24913.244234818278, - 24929.996857378079, - 24946.752294795166, - 24963.510546124078, - 24980.271610420157, - 24997.035486739525, - 25013.802174139113, - 25030.571671676629, - 25047.343978410572, - 25064.119093400237, - 25080.897015705697, - 25097.677744387816, - 25114.461278508239, - 25131.2476171294, - 25148.036759314517, - 25164.828704127583, - 25181.623450633375, - 25198.42099789745, - 25215.221344986145, - 25232.024490966574, - 25248.830434906627, - 25265.639175874974, - 25282.450712941049, - 25299.265045175071, - 25316.082171648024, - 25332.902091431668, - 25349.724803598532, - 25366.550307221914, - 25383.378601375884, - 25400.209685135269, - 25417.043557575678, - 25433.880217773472, - 25450.719664805783, - 25467.561897750507, - 25484.406915686297, - 25501.254717692573, - 25518.105302849512, - 25534.958670238051, - 25551.814818939893, - 25568.67374803748, - 25585.535456614027, - 25602.399943753502, - 25619.267208540619, - 25636.137250060852, - 25653.010067400432, - 25669.885659646327, - 25686.76402588627, - 25703.645165208734, - 25720.529076702944, - 25737.415759458876, - 25754.305212567244, - 25771.197435119517, - 25788.092426207899, - 25804.990184925344, - 25821.890710365547, - 25838.794001622944, - 25855.700057792714, - 25872.608877970775, - 25889.520461253778, - 25906.434806739118, - 25923.351913524923, - 25940.271780710063, - 25957.194407394138, - 25974.11979267748, - 25991.047935661154, - 26007.978835446964, - 26024.912491137442, - 26041.848901835841, - 26058.788066646157, - 26075.729984673108, - 26092.674655022136, - 26109.622076799409, - 26126.572249111829, - 26143.525171067016, - 26160.480841773315, - 26177.43926033979, - 26194.400425876229, - 26211.364337493149, - 26228.330994301767, - 26245.30039541404, - 26262.272539942627, - 26279.247427000919, - 26296.225055703002, - 26313.205425163702, - 26330.188534498539, - 26347.174382823756, - 26364.162969256304, - 26381.154292913852, - 26398.148352914774, - 26415.145148378149, - 26432.144678423778, - 26449.146942172156, - 26466.151938744493, - 26483.159667262702, - 26500.170126849403, - 26517.183316627921, - 26534.199235722277, - 26551.217883257199, - 26568.239258358124, - 26585.263360151173, - 26602.290187763181, - 26619.319740321676, - 26636.352016954883, - 26653.387016791727, - 26670.424738961825, - 26687.465182595493, - 26704.508346823739, - 26721.554230778267, - 26738.602833591467, - 26755.65415439643, - 26772.708192326929, - 26789.764946517433, - 26806.824416103096, - 26823.886600219761, - 26840.95149800396, - 26858.019108592915, - 26875.089431124517, - 26892.162464737365, - 26909.238208570721, - 26926.316661764544, - 26943.397823459472, - 26960.481692796813, - 26977.568268918571, - 26994.657550967422, - 27011.749538086722, - 27028.844229420498, - 27045.941624113464, - 27063.041721311005, - 27080.144520159181, - 27097.250019804727, - 27114.35821939505, - 27131.469118078236, - 27148.582715003027, - 27165.699009318858, - 27182.818000175819, - 27199.939686724665, - 27217.064068116837, - 27234.191143504428, - 27251.320912040203, - 27268.453372877593, - 27285.588525170693, - 27302.726368074269, - 27319.866900743735, - 27337.010122335181, - 27354.156032005358, - 27371.304628911668, - 27388.455912212183, - 27405.609881065626, - 27422.766534631384, - 27439.925872069507, - 27457.087892540683, - 27474.252595206275, - 27491.419979228293, - 27508.5900437694, - 27525.762787992917, - 27542.93821106281, - 27560.116312143706, - 27577.297090400876, - 27594.480545000242, - 27611.666675108383, - 27628.855479892518, - 27646.046958520514, - 27663.241110160889, - 27680.437933982801, - 27697.637429156068, - 27714.839594851132, - 27732.04443023909, - 27749.251934491687, - 27766.462106781299, - 27783.674946280949, - 27800.890452164302, - 27818.108623605654, - 27835.329459779954, - 27852.55295986278, - 27869.779123030345, - 27887.007948459504, - 27904.239435327745, - 27921.473582813196, - 27938.710390094613, - 27955.949856351392, - 27973.19198076355, - 27990.436762511745, - 28007.684200777272, - 28024.934294742041, - 28042.187043588601, - 28059.442446500128, - 28076.700502660427, - 28093.961211253929, - 28111.224571465693, - 28128.490582481401, - 28145.759243487362, - 28163.030553670509, - 28180.304512218394, - 28197.581118319198, - 28214.860371161725, - 28232.14226993539, - 28249.42681383024, - 28266.71400203693, - 28284.003833746745, - 28301.296308151585, - 28318.591424443959, - 28335.889181817001, - 28353.189579464462, - 28370.492616580705, - 28387.798292360701, - 28405.106606000048, - 28422.417556694945, - 28439.731143642206, - 28457.047366039264, - 28474.366223084147, - 28491.687713975512, - 28509.011837912611, - 28526.338594095305, - 28543.667981724069, - 28560.999999999982, - 28578.334648124732, - 28595.671925300605, - 28613.011830730498, - 28630.354363617909, - 28647.699523166943, - 28665.0473085823, - 28682.397719069289, - 28699.750753833818, - 28717.10641208239, - 28734.464693022121, - 28751.825595860708, - 28769.189119806462, - 28786.55526406828, - 28803.924027855664, - 28821.295410378701, - 28838.669410848088, - 28856.046028475103, - 28873.425262471628, - 28890.80711205013, - 28908.191576423673, - 28925.578654805915, - 28942.968346411097, - 28960.360650454055, - 28977.755566150216, - 28995.153092715591, - 29012.553229366786, - 29029.955975320987, - 29047.361329795975, - 29064.769292010107, - 29082.179861182336, - 29099.593036532187, - 29117.00881727978, - 29134.427202645813, - 29151.848191851568, - 29169.271784118911, - 29186.697978670283, - 29204.126774728706, - 29221.55817151779, - 29238.992168261717, - 29256.42876418525, - 29273.867958513725, - 29291.309750473058, - 29308.754139289747, - 29326.201124190855, - 29343.65070440403, - 29361.102879157483, - 29378.557647680012, - 29396.015009200975, - 29413.474962950309, - 29430.937508158524, - 29448.402644056692, - 29465.870369876469, - 29483.340684850071, - 29500.81358821028, - 29518.289079190454, - 29535.767157024511, - 29553.247820946945, - 29570.731070192807, - 29588.216903997723, - 29605.70532159787, - 29623.19632223, - 29640.689905131429, - 29658.186069540028, - 29675.684814694236, - 29693.186139833047, - 29710.690044196028, - 29728.196527023298, - 29745.705587555527, - 29763.217225033964, - 29780.731438700397, - 29798.248227797183, - 29815.76759156723, - 29833.289529254005, - 29850.81404010153, - 29868.341123354381, - 29885.870778257693, - 29903.403004057145, - 29920.937799998974, - 29938.475165329975, - 29956.015099297485, - 29973.557601149394, - 29991.102670134147, - 30008.650305500738, - 30026.200506498706, - 30043.753272378144, - 30061.308602389683, - 30078.866495784507, - 30096.426951814352, - 30113.989969731494, - 30131.55554878875, - 30149.123688239491, - 30166.694387337629, - 30184.267645337608, - 30201.843461494434, - 30219.42183506364, - 30237.002765301309, - 30254.586251464058, - 30272.172292809046, - 30289.760888593977, - 30307.35203807709, - 30324.94574051716, - 30342.541995173502, - 30360.140801305966, - 30377.742158174944, - 30395.346065041358, - 30412.952521166666, - 30430.561525812864, - 30448.173078242475, - 30465.787177718561, - 30483.403823504719, - 30501.02301486507, - 30518.644751064272, - 30536.269031367516, - 30553.895855040515, - 30571.525221349519, - 30589.157129561307, - 30606.791578943175, - 30624.428568762964, - 30642.06809828903, - 30659.710166790261, - 30677.35477353607, - 30695.001917796391, - 30712.651598841687, - 30730.303815942945, - 30747.958568371676, - 30765.615855399912, - 30783.275676300211, - 30800.938030345646, - 30818.602916809814, - 30836.270334966837, - 30853.940284091354, - 30871.612763458521, - 30889.287772344011, - 30906.965310024025, - 30924.645375775272, - 30942.327968874983, - 30960.013088600903, - 30977.700734231294, - 30995.390905044929, - 31013.083600321101, - 31030.778819339619, - 31048.476561380798, - 31066.17682572547, - 31083.879611654978, - 31101.584918451179, - 31119.29274539644, - 31137.003091773637, - 31154.715956866155, - 31172.431339957893, - 31190.14924033326, - 31207.869657277162, - 31225.592590075023, - 31243.318038012771, - 31261.046000376838, - 31278.776476454172, - 31296.50946553221, - 31314.24496689891, - 31331.98297984272, - 31349.7235036526, - 31367.466537618013, - 31385.212081028923, - 31402.960133175795, - 31420.710693349596, - 31438.463760841791, - 31456.219334944351, - 31473.977414949743, - 31491.738000150934, - 31509.501089841389, - 31527.266683315069, - 31545.034779866437, - 31562.80537879045, - 31580.578479382562, - 31598.35408093872, - 31616.132182755369, - 31633.91278412945, - 31651.695884358396, - 31669.481482740131, - 31687.269578573076, - 31705.060171156143, - 31722.853259788735, - 31740.648843770748, - 31758.446922402567, - 31776.247494985066, - 31794.050560819614, - 31811.85611920806, - 31829.664169452753, - 31847.474710856521, - 31865.287742722685, - 31883.103264355046, - 31900.921275057899, - 31918.741774136019, - 31936.564760894671, - 31954.390234639599, - 31972.21819467704, - 31990.048640313704, - 32007.881570856793, - 32025.716985613984, - 32043.554883893445, - 32061.395265003815, - 32079.238128254223, - 32097.083472954269, - 32114.931298414049, - 32132.781603944117, - 32150.634388855524, - 32168.48965245979, - 32186.347394068915, - 32204.207612995371, - 32222.07030855212, - 32239.935480052583, - 32257.803126810672, - 32275.673248140767, - 32293.545843357719, - 32311.420911776862, - 32329.298452713996, - 32347.178465485395, - 32365.060949407813, - 32382.945903798463, - 32400.83332797504, - 32418.723221255706, - 32436.615582959093, - 32454.510412404306, - 32472.407708910916, - 32490.307471798966, - 32508.209700388961, - 32526.114394001877, - 32544.021551959166, - 32561.931173582732, - 32579.843258194956, - 32597.757805118679, - 32615.674813677211, - 32633.594283194328, - 32651.516212994258, - 32669.440602401712, - 32687.367450741847, - 32705.296757340297, - 32723.228521523146, - 32741.162742616943, - 32759.099419948703, - 32777.038552845901, - 32794.980140636464, - 32812.924182648792, - 32830.87067821173, - 32848.819626654593, - 32866.77102730715, - 32884.724879499619, - 32902.681182562686, - 32920.639935827494, - 32938.601138625643, - 32956.56479028918, - 32974.530890150607, - 32992.499437542894, - 33010.470431799447, - 33028.443872254145, - 33046.419758241311, - 33064.39808909571, - 33082.378864152583, - 33100.36208274759, - 33118.347744216881, - 33136.335847897026, - 33154.326393125062, - 33172.31937923847, - 33190.314805575174, - 33208.312671473555, - 33226.312976272442, - 33244.315719311111, - 33262.320899929284, - 33280.328517467125, - 33298.33857126526, - 33316.351060664747, - 33334.365985007091, - 33352.383343634239, - 33370.403135888591, - 33388.42536111299, - 33406.450018650721, - 33424.477107845501, - 33442.506628041512, - 33460.53857858335, - 33478.572958816083, - 33496.609768085189, - 33514.649005736617, - 33532.690671116739, - 33550.734763572356, - 33568.781282450735, - 33586.830227099563, - 33604.881596866973, - 33622.935391101528, - 33640.991609152239, - 33659.050250368542, - 33677.111314100322, - 33695.174799697881, - 33713.240706511984, - 33731.309033893805, - 33749.37978119497, - 33767.452947767531, - 33785.528532963974, - 33803.606536137209, - 33821.686956640602, - 33839.769793827938, - 33857.855047053425, - 33875.942715671707, - 33894.032799037872, - 33912.125296507431, - 33930.220207436316, - 33948.317531180888, - 33966.417267097961, - 33984.519414544746, - 34002.623972878901, - 34020.730941458511, - 34038.840319642077, - 34056.952106788536, - 34075.066302257255, - 34093.182905408015, - 34111.301915601027, - 34129.42333219693, - 34147.547154556785, - 34165.673382042078, - 34183.80201401472, - 34201.933049837033, - 34220.06648887178, - 34238.202330482141, - 34256.340574031703, - 34274.481218884495, - 34292.624264404949, - 34310.769709957938, - 34328.91755490873, - 34347.067798623029, - 34365.220440466954, - 34383.375479807051, - 34401.532916010263, - 34419.692748443973, - 34437.854976475966, - 34456.01959947445, - 34474.18661680806, - 34492.356027845817, - 34510.527831957188, - 34528.702028512052, - 34546.878616880676, - 34565.05759643377, - 34583.238966542449, - 34601.422726578232, - 34619.608875913065, - 34637.797413919296, - 34655.988339969692, - 34674.181653437423, - 34692.37735369608, - 34710.575440119668, - 34728.775912082579, - 34746.978768959649, - 34765.184010126082, - 34783.391634957537, - 34801.60164283005, - 34819.814033120063, - 34838.028805204456, - 34856.24595846048, - 34874.465492265823, - 34892.687405998557, - 34910.911699037177, - 34929.138370760564, - 34947.367420548027, - 34965.598847779271, - 34983.832651834389, - 35002.068832093908, - 35020.307387938738, - 35038.548318750189, - 35056.79162390998, - 35075.03730280025, - 35093.285354803513, - 35111.535779302685, - 35129.788575681116, - 35148.043743322516, - 35166.301281611013, - 35184.561189931141, - 35202.823467667826, - 35221.088114206388, - 35239.355128932555, - 35257.624511232447, - 35275.896260492584, - 35294.170376099886, - 35312.446857441668, - 35330.725703905628, - 35349.006914879887, - 35367.290489752944, - 35385.576427913686, - 35403.864728751418, - 35422.155391655811, - 35440.448416016967, - 35458.743801225341, - 35477.041546671804, - 35495.341651747622, - 35513.644115844436, - 35531.948938354304, - 35550.256118669655, - 35568.565656183309, - 35586.877550288496, - 35605.191800378816, - 35623.508405848268, - 35641.827366091238, - 35660.148680502505, - 35678.472348477233, - 35696.798369410979, - 35715.126742699678, - 35733.457467739659, - 35751.790543927644, - 35770.125970660738, - 35788.46374733642, - 35806.803873352568, - 35825.146348107453, - 35843.49117099971, - 35861.838341428367, - 35880.187858792851, - 35898.539722492955, - 35916.893931928862, - 35935.250486501129, - 35953.609385610718, - 35971.970628658957, - 35990.334215047558, - 36008.700144178612, - 36027.068415454596, - 36045.439028278372, - 36063.811982053165, - 36082.187276182609, - 36100.564910070694, - 36118.944883121789, - 36137.327194740654, - 36155.711844332429, - 36174.098831302617, - 36192.488155057115, - 36210.87981500219, - 36229.273810544473, - 36247.670141091003, - 36266.068806049167, - 36284.469804826738, - 36302.873136831862, - 36321.278801473069, - 36339.686798159251, - 36358.097126299683, - 36376.509785304013, - 36394.924774582258, - 36413.342093544816, - 36431.761741602444, - 36450.183718166292, - 36468.608022647859, - 36487.034654459028, - 36505.463613012063, - 36523.894897719583, - 36542.328507994578, - 36560.764443250409, - 36579.202702900831, - 36597.643286359926, - 36616.086193042182, - 36634.531422362437, - 36652.978973735895, - 36671.428846578143, - 36689.881040305125, - 36708.335554333149, - 36726.792388078902, - 36745.251540959427, - 36763.713012392138, - 36782.176801794812, - 36800.642908585593, - 36819.111332182983, - 36837.582072005869, - 36856.055127473483, - 36874.530498005421, - 36893.008183021651, - 36911.488181942506, - 36929.970494188674, - 36948.455119181206, - 36966.942056341519, - 36985.431305091392, - 37003.922864852961, - 37022.416735048733, - 37040.912915101559, - 37059.411404434657, - 37077.91220247162, - 37096.415308636388, - 37114.920722353243, - 37133.428443046862, - 37151.938470142253, - 37170.450803064785, - 37188.965441240209, - 37207.482384094597, - 37226.001631054402, - 37244.523181546429, - 37263.047034997842, - 37281.573190836149, - 37300.101648489224, - 37318.632407385296, - 37337.165466952945, - 37355.700826621112, - 37374.238485819085, - 37392.778443976509, - 37411.320700523385, - 37429.865254890057, - 37448.412106507232, - 37466.961254805974, - 37485.512699217681, - 37504.066439174116, - 37522.622474107404, - 37541.180803449992, - 37559.741426634704, - 37578.304343094693, - 37596.869552263488, - 37615.43705357494, - 37634.006846463279, - 37652.578930363044, - 37671.153304709165, - 37689.729968936896, - 37708.308922481847, - 37726.890164779965, - 37745.473695267559, - 37764.059513381275, - 37782.647618558112, - 37801.238010235415, - 37819.830687850859, - 37838.425650842495, - 37857.022898648691, - 37875.622430708172, - 37894.224246460013, - 37912.828345343616, - 37931.434726798747, - 37950.043390265506, - 37968.654335184328, - 37987.267560995999, - 38005.883067141665, - 38024.500853062775, - 38043.120918201159, - 38061.743261998963, - 38080.367883898682, - 38098.994783343158, - 38117.623959775563, - 38136.255412639417, - 38154.889141378575, - 38173.525145437234, - 38192.163424259939, - 38210.803977291551, - 38229.446803977284, - 38248.091903762703, - 38266.739276093685, - 38285.388920416466, - 38304.040836177606, - 38322.695022824002, - 38341.351479802899, - 38360.010206561863, - 38378.671202548816, - 38397.334467211993, - 38415.999999999978, - 38434.667800361683, - 38453.33786774637, - 38472.010201603611, - 38490.684801383337, - 38509.361666535784, - 38528.040796511552, - 38546.722190761553, - 38565.405848737035, - 38584.091769889594, - 38602.779953671132, - 38621.470399533908, - 38640.163106930493, - 38658.858075313794, - 38677.555304137059, - 38696.254792853862, - 38714.956540918094, - 38733.660547783991, - 38752.366812906112, - 38771.075335739348, - 38789.78611573892, - 38808.499152360368, - 38827.214445059573, - 38845.931993292739, - 38864.651796516388, - 38883.373854187383, - 38902.098165762916, - 38920.824730700486, - 38939.553548457938, - 38958.284618493431, - 38977.017940265461, - 38995.753513232834, - 39014.491336854699, - 39033.231410590517, - 39051.973733900079, - 39070.718306243485, - 39089.465127081188, - 39108.214195873945, - 39126.965512082832, - 39145.719075169261, - 39164.474884594965, - 39183.232939821988, - 39201.99324031271, - 39220.755785529815, - 39239.52057493633, - 39258.287607995589, - 39277.056884171245, - 39295.828402927284, - 39314.602163728006, - 39333.378166038019, - 39352.15640932227, - 39370.936893046004, - 39389.719616674811, - 39408.504579674584, - 39427.291781511522, - 39446.081221652174, - 39464.872899563372, - 39483.666814712291, - 39502.462966566411, - 39521.261354593538, - 39540.06197826178, - 39558.864837039568, - 39577.669930395656, - 39596.47725779911, - 39615.286818719302, - 39634.098612625923, - 39652.912638988993, - 39671.728897278823, - 39690.547386966064, - 39709.368107521652, - 39728.191058416858, - 39747.016239123259, - 39765.84364911275, - 39784.673287857528, - 39803.505154830105, - 39822.339249503319, - 39841.175571350293, - 39860.014119844491, - 39878.854894459677, - 39897.697894669909, - 39916.54311994958, - 39935.390569773372, - 39954.240243616303, - 39973.092140953675, - 39991.946261261117, - 40010.802604014549, - 40029.661168690225, - 40048.521954764678, - 40067.384961714779, - 40086.250189017679, - 40105.117636150855, - 40123.98730259209, - 40142.859187819471, - 40161.733291311379, - 40180.609612546526, - 40199.488151003912, - 40218.368906162854, - 40237.25187750296, - 40256.137064504153, - 40275.024466646668, - 40293.914083411029, - 40312.805914278084, - 40331.699958728961, - 40350.596216245103, - 40369.494686308273, - 40388.39536840051, - 40407.298262004173, - 40426.20336660192, - 40445.110681676706, - 40464.020206711793, - 40482.931941190756, - 40501.845884597446, - 40520.762036416032, - 40539.680396130985, - 40558.600963227072, - 40577.523737189367, - 40596.448717503234, - 40615.375903654342, - 40634.305295128659, - 40653.236891412453, - 40672.170691992294, - 40691.106696355047, - 40710.044903987873, - 40728.985314378238, - 40747.927927013901, - 40766.872741382918, - 40785.819756973651, - 40804.768973274746, - 40823.720389775161, - 40842.674005964131, - 40861.629821331211, - 40880.587835366234, - 40899.548047559321, - 40918.510457400931, - 40937.475064381761, - 40956.441867992849, - 40975.410867725499, - 40994.382063071331, - 41013.355453522236, - 41032.331038570417, - 41051.308817708363, - 41070.288790428858, - 41089.270956224987, - 41108.255314590111, - 41127.241865017888, - 41146.23060700229, - 41165.221540037543, - 41184.214663618193, - 41203.209977239079, - 41222.207480395307, - 41241.207172582297, - 41260.209053295752, - 41279.213122031659, - 41298.219378286303, - 41317.227821556255, - 41336.23845133838, - 41355.251267129832, - 41374.266268428037, - 41393.283454730743, - 41412.302825535953, - 41431.324380341983, - 41450.348118647416, - 41469.374039951144, - 41488.402143752326, - 41507.432429550427, - 41526.464896845187, - 41545.499545136627, - 41564.536373925075, - 41583.575382711126, - 41602.616570995662, - 41621.659938279874, - 41640.705484065205, - 41659.753207853406, - 41678.803109146495, - 41697.855187446803, - 41716.909442256911, - 41735.965873079709, - 41755.02447941836, - 41774.085260776315, - 41793.148216657297, - 41812.213346565331, - 41831.280650004708, - 41850.350126480014, - 41869.421775496106, - 41888.495596558132, - 41907.571589171515, - 41926.649752841957, - 41945.730087075463, - 41964.812591378286, - 41983.897265256979, - 42002.984108218378, - 42022.073119769593, - 42041.164299418015, - 42060.257646671307, - 42079.353161037419, - 42098.450842024591, - 42117.550689141324, - 42136.652701896404, - 42155.756879798893, - 42174.863222358137, - 42193.971729083758, - 42213.082399485655, - 42232.195233074002, - 42251.310229359246, - 42270.427387852127, - 42289.546708063644, - 42308.668189505079, - 42327.791831687995, - 42346.917634124227, - 42366.045596325886, - 42385.175717805352, - 42404.307998075295, - 42423.442436648642, - 42442.579033038608, - 42461.717786758672, - 42480.858697322597, - 42500.001764244422, - 42519.146987038446, - 42538.294365219248, - 42557.443898301688, - 42576.595585800882, - 42595.749427232236, - 42614.90542211142, - 42634.063569954378, - 42653.223870277317, - 42672.386322596729, - 42691.55092642938, - 42710.717681292292, - 42729.886586702756, - 42749.057642178363, - 42768.23084723694, - 42787.406201396603, - 42806.58370417574, - 42825.76335509299, - 42844.945153667286, - 42864.129099417805, - 42883.315191864014, - 42902.503430525649, - 42921.693814922692, - 42940.88634457541, - 42960.081019004348, - 42979.277837730297, - 42998.476800274322, - 43017.677906157769, - 43036.881154902228, - 43056.086546029583, - 43075.294079061961, - 43094.503753521763, - 43113.715568931671, - 43132.929524814601, - 43152.145620693766, - 43171.363856092619, - 43190.584230534907, - 43209.806743544621, - 43229.031394646016, - 43248.258183363621, - 43267.487109222224, - 43286.718171746885, - 43305.951370462906, - 43325.186704895881, - 43344.42417457165, - 43363.663779016322, - 43382.905517756262, - 43402.149390318104, - 43421.395396228749, - 43440.643535015348, - 43459.89380620532, - 43479.146209326354, - 43498.400743906379, - 43517.657409473606, - 43536.916205556496, - 43556.177131683784, - 43575.44018738444, - 43594.705372187724, - 43613.972685623135, - 43633.242127220445, - 43652.513696509668, - 43671.787393021099, - 43691.063216285271, - 43710.341165833001, - 43729.621241195346, - 43748.903441903625, - 43768.187767489413, - 43787.474217484552, - 43806.762791421126, - 43826.053488831501, - 43845.346309248278, - 43864.641252204325, - 43883.938317232765, - 43903.237503866971, - 43922.538811640596, - 43941.842240087513, - 43961.147788741881, - 43980.455457138101, - 43999.765244810835, - 44019.077151295001, - 44038.391176125755, - 44057.70731883854, - 44077.02557896902, - 44096.345956053141, - 44115.668449627083, - 44134.993059227287, - 44154.319784390456, - 44173.648624653535, - 44192.979579553728, - 44212.312648628489, - 44231.647831415532, - 44250.985127452805, - 44270.324536278538, - 44289.666057431183, - 44309.009690449464, - 44328.355434872348, - 44347.703290239064, - 44367.053256089079, - 44386.405331962109, - 44405.759517398139, - 44425.115811937387, - 44444.474215120332, - 44463.834726487694, - 44483.197345580462, - 44502.562071939843, - 44521.928905107328, - 44541.297844624634, - 44560.668890033732, - 44580.042040876848, - 44599.417296696454, - 44618.794657035272, - 44638.174121436256, - 44657.555689442641, - 44676.939360597877, - 44696.325134445673, - 44715.713010530002, - 44735.102988395054, - 44754.495067585296, - 44773.88924764542, - 44793.285528120374, - 44812.683908555344, - 44832.084388495779, - 44851.486967487363, - 44870.891645076015, - 44890.298420807922, - 44909.707294229491, - 44929.118264887409, - 44948.531332328566, - 44967.946496100136, - 44987.363755749502, - 45006.783110824319, - 45026.204560872473, - 45045.628105442098, - 45065.053744081561, - 45084.48147633949, - 45103.911301764747, - 45123.343219906426, - 45142.777230313885, - 45162.21333253671, - 45181.651526124733, - 45201.091810628037, - 45220.534185596924, - 45239.978650581965, - 45259.425205133957, - 45278.873848803938, - 45298.324581143192, - 45317.777401703235, - 45337.232310035848, - 45356.68930569302, - 45376.148388226997, - 45395.60955719027, - 45415.072812135557, - 45434.538152615823, - 45454.005578184282, - 45473.475088394356, - 45492.946682799746, - 45512.420360954362, - 45531.896122412363, - 45551.373966728155, - 45570.853893456362, - 45590.33590215187, - 45609.819992369776, - 45629.306163665438, - 45648.794415594442, - 45668.284747712612, - 45687.777159576006, - 45707.27165074092, - 45726.768220763894, - 45746.266869201696, - 45765.767595611323, - 45785.270399550034, - 45804.775280575297, - 45824.282238244828, - 45843.79127211657, - 45863.302381748719, - 45882.815566699683, - 45902.33082652813, - 45921.848160792935, - 45941.367569053225, - 45960.889050868354, - 45980.41260579793, - 45999.938233401757, - 46019.465933239902, - 46038.995704872657, - 46058.527547860547, - 46078.06146176433, - 46097.597446144995, - 46117.135500563774, - 46136.675624582109, - 46156.217817761702, - 46175.762079664462, - 46195.308409852543, - 46214.856807888333, - 46234.407273334444, - 46253.959805753715, - 46273.51440470924, - 46293.071069764315, - 46312.629800482478, - 46332.190596427499, - 46351.753457163381, - 46371.318382254351, - 46390.885371264863, - 46410.45442375962, - 46430.025539303526, - 46449.598717461733, - 46469.17395779962, - 46488.751259882782, - 46508.33062327707, - 46527.912047548532, - 46547.495532263471, - 46567.081076988397, - 46586.668681290059, - 46606.258344735434, - 46625.850066891719, - 46645.443847326351, - 46665.039685606986, - 46684.637581301497, - 46704.237533978005, - 46723.839543204842, - 46743.443608550573, - 46763.049729583989, - 46782.657905874104, - 46802.268136990162, - 46821.880422501628, - 46841.494761978196, - 46861.111154989776, - 46880.729601106526, - 46900.350099898795, - 46919.97265093719, - 46939.597253792526, - 46959.223908035841, - 46978.852613238392, - 46998.483368971691, - 47018.11617480743, - 47037.751030317551, - 47057.387935074221, - 47077.026888649809, - 47096.66789061694, - 47116.310940548428, - 47135.956038017328, - 47155.603182596918, - 47175.252373860698, - 47194.903611382375, - 47214.556894735892, - 47234.212223495422, - 47253.869597235338, - 47273.52901553025, - 47293.19047795498, - 47312.853984084577, - 47332.519533494306, - 47352.187125759658, - 47371.856760456343, - 47391.528437160297, - 47411.202155447652, - 47430.877914894787, - 47450.555715078299, - 47470.235555574982, - 47489.917435961863, - 47509.601355816201, - 47529.287314715453, - 47548.975312237308, - 47568.665347959672, - 47588.357421460656, - 47608.051532318605, - 47627.747680112072, - 47647.445864419846, - 47667.14608482091, - 47686.848340894474, - 47706.552632219973, - 47726.258958377046, - 47745.967318945557, - 47765.677713505589, - 47785.390141637428, - 47805.104602921601, - 47824.821096938824, - 47844.539623270044, - 47864.260181496429, - 47883.982771199349, - 47903.707391960394, - 47923.434043361369, - 47943.162724984308, - 47962.893436411439, - 47982.626177225218, - 48002.36094700831, - 48022.097745343599, - 48041.836571814172, - 48061.57742600335, - 48081.32030749465, - 48101.065215871815, - 48120.81215071879, - 48140.56111161974, - 48160.312098159047, - 48180.065109921306, - 48199.820146491307, - 48219.577207454073, - 48239.336292394844, - 48259.097400899045, - 48278.860532552339, - 48298.625686940592, - 48318.392863649875, - 48338.162062266485, - 48357.933282376915, - 48377.706523567889, - 48397.481785426316, - 48417.259067539344, - 48437.038369494308, - 48456.819690878765, - 48476.603031280487, - 48496.388390287451, - 48516.175767487839, - 48535.965162470042, - 48555.756574822684, - 48575.550004134566, - 48595.345449994718, - 48615.142911992378, - 48634.942389716991, - 48654.743882758201, - 48674.547390705877, - 48694.352913150084, - 48714.160449681112, - 48733.969999889443, - 48753.781563365759, - 48773.595139700978, - 48793.410728486211, - 48813.228329312769, - 48833.047941772187, - 48852.869565456189, - 48872.693199956717, - 48892.518844865925, - 48912.346499776155, - 48932.176164279976, - 48952.007837970152, - 48971.841520439666, - 48991.677211281676, - 49011.514910089587, - 49031.354616456978, - 49051.196329977654, - 49071.04005024561, - 49090.885776855059, - 49110.733509400408, - 49130.583247476279, - 49150.434990677488, - 49170.288738599062, - 49190.144490836232, - 49210.002246984441, - 49229.86200663932, - 49249.723769396718, - 49269.587534852675, - 49289.453302603448, - 49309.32107224549, - 49329.190843375451, - 49349.062615590192, - 49368.936388486785, - 49388.812161662492, - 49408.689934714785, - 49428.569707241324, - 49448.45147883999, - 49468.335249108866, - 49488.22101764621, - 49508.108784050521, - 49527.99854792047, - 49547.890308854934, - 49567.784066453009, - 49587.679820313977, - 49607.57757003732, - 49627.477315222721, - 49647.379055470075, - 49667.28279037946, - 49687.188519551179, - 49707.096242585707, - 49727.005959083741, - 49746.917668646165, - 49766.831370874068, - 49786.747065368734, - 49806.66475173166, - 49826.584429564515, - 49846.506098469203, - 49866.429758047794, - 49886.355407902578, - 49906.283047636032, - 49926.212676850846, - 49946.144295149883, - 49966.077902136225, - 49986.013497413151, - 50005.951080584135, - 50025.890651252834, - 50045.832209023123, - 50065.775753499074, - 50085.721284284933, - 50105.668800985164, - 50125.618303204428, - 50145.569790547575, - 50165.523262619652, - 50185.478719025901, - 50205.436159371769, - 50225.395583262893, - 50245.356990305103, - 50265.320380104429, - 50285.285752267104, - 50305.253106399534, - 50325.222442108337, - 50345.193759000336, - 50365.16705668252, - 50385.142334762102, - 50405.119592846473, - 50425.098830543218, - 50445.080047460127, - 50465.063243205179, - 50485.048417386541, - 50505.035569612577, - 50525.024699491856, - 50545.015806633128, - 50565.008890645338, - 50585.003951137631, - 50605.00098771933, - 50624.999999999971, - 50645.000987589265, - 50665.003950097132, - 50685.008887133677, - 50705.015798309192, - 50725.024683234165, - 50745.035541519283, - 50765.048372775411, - 50785.063176613621, - 50805.079952645159, - 50825.098700481489, - 50845.119419734241, - 50865.142110015244, - 50885.166770936521, - 50905.193402110279, - 50925.222003148934, - 50945.252573665071, - 50965.285113271471, - 50985.319621581119, - 51005.356098207172, - 51025.394542762981, - 51045.434954862096, - 51065.477334118244, - 51085.521680145357, - 51105.567992557546, - 51125.616270969113, - 51145.66651499454, - 51165.718724248516, - 51185.772898345916, - 51205.829036901778, - 51225.887139531362, - 51245.947205850105, - 51266.009235473619, - 51286.073228017718, - 51306.139183098399, - 51326.207100331856, - 51346.276979334456, - 51366.348819722756, - 51386.42262111351, - 51406.498383123653, - 51426.57610537031, - 51446.655787470787, - 51466.737429042587, - 51486.82102970338, - 51506.906589071048, - 51526.994106763632, - 51547.083582399391, - 51567.175015596738, - 51587.268405974297, - 51607.363753150858, - 51627.461056745415, - 51647.56031637713, - 51667.661531665362, - 51687.764702229651, - 51707.869827689727, - 51727.976907665499, - 51748.085941777055, - 51768.196929644677, - 51788.309870888836, - 51808.42476513017, - 51828.541611989524, - 51848.660411087905, - 51868.781162046515, - 51888.90386448674, - 51909.028518030143, - 51929.155122298485, - 51949.283676913685, - 51969.414181497872, - 51989.546635673345, - 52009.681039062583, - 52029.817391288263, - 52049.955691973213, - 52070.095940740481, - 52090.238137213273, - 52110.382281014987, - 52130.5283717692, - 52150.676409099666, - 52170.826392630333, - 52190.97832198532, - 52211.132196788931, - 52231.288016665654, - 52251.445781240145, - 52271.60549013727, - 52291.76714298204, - 52311.930739399664, - 52332.096279015546, - 52352.263761455244, - 52372.433186344519, - 52392.604553309284, - 52412.777861975665, - 52432.953111969946, - 52453.130302918595, - 52473.309434448267, - 52493.490506185793, - 52513.67351775818, - 52533.858468792605, - 52554.045358916446, - 52574.234187757254, - 52594.42495494274, - 52614.617660100812, - 52634.812302859558, - 52655.008882847229, - 52675.20739969227, - 52695.407853023295, - 52715.610242469098, - 52735.814567658657, - 52756.02082822111, - 52776.229023785803, - 52796.439153982225, - 52816.651218440056, - 52836.865216789171, - 52857.081148659599, - 52877.29901368155, - 52897.518811485425, - 52917.740541701773, - 52937.964203961354, - 52958.18979789508, - 52978.417323134046, - 52998.646779309529, - 53018.878166052978, - 53039.111482996006, - 53059.346729770419, - 53079.583906008193, - 53099.823011341483, - 53120.0640454026, - 53140.307007824063, - 53160.551898238533, - 53180.79871627887, - 53201.047461578091, - 53221.2981337694, - 53241.550732486176, - 53261.805257361964, - 53282.061708030487, - 53302.32008412564, - 53322.580385281493, - 53342.842611132299, - 53363.106761312469, - 53383.372835456597, - 53403.640833199453, - 53423.910754175973, - 53444.18259802126, - 53464.456364370613, - 53484.732052859479, - 53505.009663123499, - 53525.289194798468, - 53545.570647520362, - 53565.854020925333, - 53586.139314649699, - 53606.426528329954, - 53626.715661602764, - 53647.006714104959, - 53667.299685473547, - 53687.59457534572, - 53707.891383358816, - 53728.190109150361, - 53748.490752358055, - 53768.793312619753, - 53789.09778957349, - 53809.404182857485, - 53829.712492110106, - 53850.022716969899, - 53870.334857075584, - 53890.648912066055, - 53910.964881580367, - 53931.28276525774, - 53951.602562737586, - 53971.924273659461, - 53992.24789766311, - 54012.57343438844, - 54032.90088347553, - 54053.23024456462, - 54073.561517296133, - 54093.894701310644, - 54114.22979624891, - 54134.566801751855, - 54154.90571746057, - 54175.246543016314, - 54195.589278060506, - 54215.933922234755, - 54236.280475180814, - 54256.628936540626, - 54276.97930595628, - 54297.331583070045, - 54317.685767524359, - 54338.041858961828, - 54358.399857025215, - 54378.759761357462, - 54399.121571601667, - 54419.485287401105, - 54439.850908399218, - 54460.218434239614, - 54480.587864566056, - 54500.95919902248, - 54521.332437252997, - 54541.707578901878, - 54562.084623613555, - 54582.46357103264, - 54602.844420803893, - 54623.227172572246, - 54643.611825982807, - 54663.998380680838, - 54684.386836311773, - 54704.777192521207, - 54725.169448954897, - 54745.563605258772, - 54765.959661078923, - 54786.357616061614, - 54806.757469853255, - 54827.159222100439, - 54847.562872449904, - 54867.968420548583, - 54888.375866043534, - 54908.785208582012, - 54929.196447811417, - 54949.609583379322, - 54970.024614933463, - 54990.441542121727, - 55010.86036459219, - 55031.28108199306, - 55051.703693972733, - 55072.128200179759, - 55092.554600262847, - 55112.982893870874, - 55133.413080652877, - 55153.845160258061, - 55174.279132335789, - 55194.714996535586, - 55215.152752507143, - 55235.592399900306, - 55256.033938365079, - 55276.477367551655, - 55296.92268711036, - 55317.369896691685, - 55337.818995946305, - 55358.269984525024, - 55378.72286207883, - 55399.177628258869, - 55419.634282716441, - 55440.092825103013, - 55460.553255070205, - 55481.015572269804, - 55501.479776353764, - 55521.945866974187, - 55542.413843783339, - 55562.883706433655, - 55583.355454577715, - 55603.82908786826, - 55624.304605958219, - 55644.782008500639, - 55665.261295148754, - 55685.742465555952, - 55706.225519375774, - 55726.710456261928, - 55747.197275868275, - 55767.685977848843, - 55788.176561857814, - 55808.669027549528, - 55829.163374578478, - 55849.659602599328, - 55870.157711266889, - 55890.657700236145, - 55911.159569162221, - 55931.663317700411, - 55952.168945506164, - 55972.676452235086, - 55993.185837542944, - 56013.697101085651, - 56034.210242519301, - 56054.72526150012, - 56075.242157684508, - 56095.760930729011, - 56116.281580290342, - 56136.804106025367, - 56157.328507591104, - 56177.85478464474, - 56198.382936843598, - 56218.912963845185, - 56239.444865307138, - 56259.978640887268, - 56280.514290243525, - 56301.051813034042, - 56321.591208917082, - 56342.13247755108, - 56362.675618594607, - 56383.220631706419, - 56403.767516545398, - 56424.316272770608, - 56444.866900041241, - 56465.419398016667, - 56485.973766356394, - 56506.530004720102, - 56527.088112767611, - 56547.648090158902, - 56568.209936554107, - 56588.773651613519, - 56609.339234997584, - 56629.9066863669, - 56650.47600538221, - 56671.04719170442, - 56691.620244994599, - 56712.195164913959, - 56732.771951123868, - 56753.350603285835, - 56773.931121061541, - 56794.513504112823, - 56815.097752101647, - 56835.683864690152, - 56856.271841540627, - 56876.86168231551, - 56897.453386677393, - 56918.046954289028, - 56938.642384813298, - 56959.239677913261, - 56979.838833252121, - 57000.439850493225, - 57021.04272930009, - 57041.647469336371, - 57062.254070265873, - 57082.862531752558, - 57103.472853460553, - 57124.085035054108, - 57144.699076197649, - 57165.314976555739, - 57185.932735793103, - 57206.552353574611, - 57227.173829565276, - 57247.797163430281, - 57268.42235483494, - 57289.049403444733, - 57309.678308925286, - 57330.30907094237, - 57350.941689161911, - 57371.576163249985, - 57392.212492872815, - 57412.850677696784, - 57433.490717388406, - 57454.132611614368, - 57474.776360041491, - 57495.421962336746, - 57516.069418167266, - 57536.718727200314, - 57557.36988910332, - 57578.022903543861, - 57598.677770189643, - 57619.334488708548, - 57639.993058768589, - 57660.653480037938, - 57681.315752184906, - 57701.979874877965, - 57722.64584778573, - 57743.31367057695, - 57763.983342920546, - 57784.654864485572, - 57805.328234941233, - 57826.003453956881, - 57846.680521202026, - 57867.359436346305, - 57888.040199059527, - 57908.722809011633, - 57929.407265872709, - 57950.093569313001, - 57970.781719002895, - 57991.471714612911, - 58012.16355581375, - 58032.857242276223, - 58053.552773671312, - 58074.25014967013, - 58094.949369943948, - 58115.650434164185, - 58136.353342002389, - 58157.058093130276, - 58177.764687219693, - 58198.47312394264, - 58219.183402971255, - 58239.895523977837, - 58260.609486634821, - 58281.325290614775, - 58302.042935590434, - 58322.762421234678, - 58343.483747220511, - 58364.206913221096, - 58384.931918909751, - 58405.658763959924, - 58426.3874480452, - 58447.117970839339, - 58467.85033201622, - 58488.584531249864, - 58509.320568214462, - 58530.058442584334, - 58550.798154033931, - 58571.539702237875, - 58592.283086870906, - 58613.028307607929, - 58633.775364123983, - 58654.52425609425, - 58675.274983194053, - 58696.027545098877, - 58716.781941484325, - 58737.538172026158, - 58758.296236400274, - 58779.056134282728, - 58799.817865349694, - 58820.581429277503, - 58841.346825742643, - 58862.114054421712, - 58882.883114991484, - 58903.654007128847, - 58924.426730510851, - 58945.201284814684, - 58965.977669717664, - 58986.755884897269, - 59007.535930031117, - 59028.317804796949, - 59049.101508872664, - 59069.887041936301, - 59090.674403666046, - 59111.463593740213, - 59132.254611837263, - 59153.047457635803, - 59173.84213081457, - 59194.638631052461, - 59215.436958028506, - 59236.237111421855, - 59257.039090911829, - 59277.842896177877, - 59298.648526899589, - 59319.455982756685, - 59340.26526342905, - 59361.076368596696, - 59381.889297939757, - 59402.704051138542, - 59423.520627873484, - 59444.339027825139, - 59465.159250674224, - 59485.9812961016, - 59506.805163788253, - 59527.630853415307, - 59548.458364664046, - 59569.287697215863, - 59590.118850752311, - 59610.951824955089, - 59631.786619506012, - 59652.623234087048, - 59673.461668380311, - 59694.301922068029, - 59715.143994832593, - 59735.987886356525, - 59756.833596322482, - 59777.681124413255, - 59798.530470311794, - 59819.381633701159, - 59840.234614264569, - 59861.089411685381, - 59881.94602564707, - 59902.804455833269, - 59923.664701927737, - 59944.526763614384, - 59965.390640577243, - 59986.256332500488, - 60007.123839068438, - 60027.993159965539, - 60048.864294876381, - 60069.737243485688, - 60090.612005478324, - 60111.488580539284, - 60132.366968353708, - 60153.247168606867, - 60174.129180984164, - 60195.013005171153, - 60215.898640853513, - 60236.786087717061, - 60257.675345447751, - 60278.566413731671, - 60299.459292255044, - 60320.353980704247, - 60341.25047876576, - 60362.148786126229, - 60383.048902472423, - 60403.950827491237, - 60424.854560869717, - 60445.76010229504, - 60466.667451454516, - 60487.57660803559, - 60508.487571725847, - 60529.400342212997, - 60550.314919184893, - 60571.231302329521, - 60592.149491335003, - 60613.069485889588, - 60633.991285681674, - 60654.914890399785, - 60675.840299732568, - 60696.767513368832, - 60717.696530997484, - 60738.627352307602, - 60759.55997698837, - 60780.494404729128, - 60801.430635219323, - 60822.368668148556, - 60843.308503206565, - 60864.250140083204, - 60885.193578468468, - 60906.138818052495, - 60927.085858525541, - 60948.034699578006, - 60968.985340900421, - 60989.937782183442, - 61010.892023117864, - 61031.848063394616, - 61052.805902704764, - 61073.765540739492, - 61094.726977190134, - 61115.690211748137, - 61136.655244105103, - 61157.622073952742, - 61178.590700982917, - 61199.561124887616, - 61220.533345358948, - 61241.507362089171, - 61262.483174770663, - 61283.460783095943, - 61304.440186757645, - 61325.421385448557, - 61346.404378861582, - 61367.389166689762, - 61388.375748626262, - 61409.364124364387, - 61430.354293597571, - 61451.346256019373, - 61472.340011323497, - 61493.335559203762, - 61514.332899354122, - 61535.332031468672, - 61556.332955241618, - 61577.335670367313, - 61598.340176540238, - 61619.346473454993, - 61640.354560806329, - 61661.3644382891, - 61682.376105598312, - 61703.389562429089, - 61724.404808476691, - 61745.42184343651, - 61766.440667004063, - 61787.461278874987, - 61808.483678745069, - 61829.507866310203, - 61850.533841266435, - 61871.561603309929, - 61892.591152136971, - 61913.622487443987, - 61934.655608927525, - 61955.690516284267, - 61976.727209211022, - 61997.765687404724, - 62018.805950562448, - 62039.847998381381, - 62060.891830558845, - 62081.93744679229, - 62102.984846779298, - 62124.034030217575, - 62145.084996804966, - 62166.137746239416, - 62187.19227821903, - 62208.248592442025, - 62229.306688606739, - 62250.366566411656, - 62271.428225555377, - 62292.491665736627, - 62313.556886654267, - 62334.623888007271, - 62355.692669494762, - 62376.763230815974, - 62397.835571670272, - 62418.909691757144, - 62439.98559077621, - 62461.063268427228, - 62482.142724410049, - 62503.223958424685, - 62524.306970171267, - 62545.39175935003, - 62566.478325661366, - 62587.566668805768, - 62608.656788483881, - 62629.748684396451, - 62650.842356244357, - 62671.937803728622, - 62693.035026550366, - 62714.134024410858, - 62735.234797011479, - 62756.337344053733, - 62777.441665239276, - 62798.547760269852, - 62819.655628847358, - 62840.765270673801, - 62861.876685451323, - 62882.989872882186, - 62904.104832668774, - 62925.221564513602, - 62946.340068119309, - 62967.460343188657, - 62988.582389424526, - 63009.70620652994, - 63030.831794208025, - 63051.959152162039, - 63073.08828009537, - 63094.219177711529, - 63115.351844714154, - 63136.486280806988, - 63157.622485693922, - 63178.760459078956, - 63199.900200666219, - 63221.041710159967, - 63242.184987264569, - 63263.330031684534, - 63284.476843124474, - 63305.625421289144, - 63326.775765883409, - 63347.927876612259, - 63369.081753180813, - 63390.237395294316, - 63411.39480265812, - 63432.553974977716, - 63453.714911958712, - 63474.877613306839, - 63496.042078727944, - 63517.208307927998, - 63538.376300613119, - 63559.546056489504, - 63580.717575263516, - 63601.890856641607, - 63623.065900330374, - 63644.242706036515, - 63665.421273466869, - 63686.601602328381, - 63707.783692328136, - 63728.967543173334, - 63750.153154571279, - 63771.340526229418, - 63792.529657855317, - 63813.720549156649, - 63834.913199841227, - 63856.107609616978, - 63877.303778191941, - 63898.501705274284, - 63919.7013905723, - 63940.902833794404, - 63962.106034649114, - 63983.310992845094, - 64004.517708091109, - 64025.726180096048, - 64046.936408568938, - 64068.1483932189, - 64089.362133755196, - 64110.577629887193, - 64131.794881324393, - 64153.013887776404, - 64174.234648952966, - 64195.457164563937, - 64216.681434319289, - 64237.907457929112, - 64259.135235103626, - 64280.36476555316, - 64301.596048988169, - 64322.829085119236, - 64344.06387365704, - 64365.300414312398, - 64386.538706796251, - 64407.778750819634, - 64429.020546093721, - 64450.26409232981, - 64471.509389239291, - 64492.756436533709, - 64514.005233924705, - 64535.255781124033, - 64556.50807784358, - 64577.762123795357, - 64599.017918691468, - 64620.275462244172, - 64641.534754165805, - 64662.795794168844, - 64684.058581965895, - 64705.323117269661, - 64726.589399792974, - 64747.857429248776, - 64769.127205350138, - 64790.398727810236, - 64811.671996342375, - 64832.947010659969, - 64854.223770476558, - 64875.502275505794, - 64896.782525461451, - 64918.064520057414, - 64939.348259007682, - 64960.633742026388, - 64981.920968827762, - 65003.209939126165, - 65024.500652636067, - 65045.793109072067, - 65067.087308148861, - 65088.383249581282, - 65109.680933084259, - 65130.980358372864, - 65152.28152516226, - 65173.584433167736, - 65194.889082104703, - 65216.195471688683, - 65237.503601635319, - 65258.813471660353, - 65280.125081479666, - 65301.438430809241, - 65322.753519365178, - 65344.070346863708, - 65365.388913021146, - 65386.709217553958, - 65408.031260178701, - 65429.355040612056, - 65450.680558570821, - 65472.00781377191, - 65493.336805932355, - 65514.66753476928, - 65535.999999999956, - 65557.334201341757, - 65578.670138512171, - 65600.007811228788, - 65621.347219209332, - 65642.688362171626, - 65664.031239833639, - 65685.375851913413, - 65706.722198129137, - 65728.070278199084, - 65749.420091841661, - 65770.771638775404, - 65792.124918718939, - 65813.479931391004, - 65834.836676510458, - 65856.195153796303, - 65877.5553629676, - 65898.917303743554, - 65920.280975843489, - 65941.646378986843, - 65963.013512893158, - 65984.382377282076, - 66005.752971873386, - 66027.125296386963, - 66048.499350542799, - 66069.875134061018, - 66091.252646661844, - 66112.631888065618, - 66134.01285799277, - 66155.395556163887, - 66176.779982299631, - 66198.166136120795, - 66219.554017348273, - 66240.943625703105, - 66262.334960906388, - 66283.728022679396, - 66305.122810743444, - 66326.519324820023, - 66347.917564630698, - 66369.317529897162, - 66390.719220341227, - 66412.122635684791, - 66433.527775649884, - 66454.934639958636, - 66476.343228333324, - 66497.753540496284, - 66519.165576169995, - 66540.57933507704, - 66561.994816940118, - 66583.412021482043, - 66604.830948425733, - 66626.251597494222, - 66647.673968410629, - 66669.098060898235, - 66690.523874680381, - 66711.951409480564, - 66733.380665022371, - 66754.811641029475, - 66776.244337225711, - 66797.678753334985, - 66819.11488908132, - 66840.552744188884, - 66861.992318381905, - 66883.433611384738, - 66904.876622921889, - 66926.321352717903, - 66947.767800497502, - 66969.215965985466, - 66990.665848906734, - 67012.117448986304, - 67033.570765949335, - 67055.025799521056, - 67076.482549426815, - 67097.941015392076, - 67119.401197142433, - 67140.863094403554, - 67162.326706901222, - 67183.792034361351, - 67205.259076509959, - 67226.72783307315, - 67248.198303777172, - 67269.670488348347, - 67291.144386513144, - 67312.619997998088, - 67334.09732252988, - 67355.576359835293, - 67377.057109641188, - 67398.53957167457, - 67420.023745662547, - 67441.50963133233, - 67462.99722841123, - 67484.486536626689, - 67505.977555706224, - 67527.470285377494, - 67548.964725368263, - 67570.460875406367, - 67591.9587352198, - 67613.458304536631, - 67634.95958308503, - 67656.462570593329, - 67677.967266789899, - 67699.473671403248, - 67720.981784162024, - 67742.491604794923, - 67764.003133030797, - 67785.516368598575, - 67807.031311227314, - 67828.547960646174, - 67850.066316584402, - 67871.58637877139, - 67893.108146936589, - 67914.63162080961, - 67936.156800120138, - 67957.683684597971, - 67979.212273973011, - 68000.742567975263, - 68022.274566334876, - 68043.808268782057, - 68065.343675047145, - 68086.880784860579, - 68108.419597952918, - 68129.960114054789, - 68151.502332896969, - 68173.04625421032, - 68194.591877725834, - 68216.139203174564, - 68237.688230287706, - 68259.238958796544, - 68280.791388432481, - 68302.345518927032, - 68323.901350011787, - 68345.458881418483, - 68367.018112878912, - 68388.579044125028, - 68410.141674888844, - 68431.706004902502, - 68453.272033898262, - 68474.839761608455, - 68496.409187765545, - 68517.980312102081, - 68539.553134350732, - 68561.127654244279, - 68582.70387151558, - 68604.281785897634, - 68625.861397123503, - 68647.44270492639, - 68669.025709039604, - 68690.610409196524, - 68712.196805130661, - 68733.784896575627, - 68755.374683265123, - 68776.966164932994, - 68798.559341313128, - 68820.154212139591, - 68841.750777146473, - 68863.349036068044, - 68884.948988638629, - 68906.550634592684, - 68928.153973664739, - 68949.75900558944, - 68971.365730101577, - 68992.974146935987, - 69014.584255827634, - 69036.196056511588, - 69057.809548723017, - 69079.424732197207, - 69101.041606669532, - 69122.660171875468, - 69144.280427550606, - 69165.902373430625, - 69187.526009251334, - 69209.151334748618, - 69230.778349658474, - 69252.40705371699, - 69274.037446660412, - 69295.669528225, - 69317.303298147192, - 69338.938756163494, - 69360.575902010532, - 69382.214735425005, - 69403.855256143754, - 69425.497463903681, - 69447.141358441833, - 69468.78693949533, - 69490.434206801394, - 69512.083160097391, - 69533.733799120717, - 69555.386123608929, - 69577.04013329967, - 69598.695827930685, - 69620.353207239794, - 69642.012270964973, - 69663.67301884426, - 69685.335450615792, - 69706.999566017839, - 69728.665364788743, - 69750.332846666963, - 69772.002011391058, - 69793.672858699691, - 69815.345388331611, - 69837.019600025669, - 69858.695493520849, - 69880.373068556204, - 69902.052324870907, - 69923.733262204216, - 69945.415880295492, - 69967.100178884211, - 69988.786157709939, - 70010.473816512356, - 70032.163155031216, - 70053.854173006403, - 70075.546870177874, - 70097.241246285717, - 70118.937301070109, - 70140.635034271298, - 70162.334445629691, - 70184.035534885741, - 70205.738301780017, - 70227.442746053217, - 70249.1488674461, - 70270.856665699539, - 70292.566140554511, - 70314.277291752107, - 70335.990119033493, - 70357.704622139936, - 70379.420800812819, - 70401.138654793613, - 70422.85818382389, - 70444.579387645339, - 70466.302265999722, - 70488.026818628918, - 70509.753045274876, - 70531.480945679708, - 70553.210519585555, - 70574.941766734701, - 70596.674686869505, - 70618.409279732456, - 70640.145545066101, - 70661.883482613106, - 70683.623092116264, - 70705.364373318414, - 70727.107325962526, - 70748.851949791671, - 70770.598244549008, - 70792.346209977783, - 70814.095845821372, - 70835.847151823225, - 70857.600127726895, - 70879.354773276034, - 70901.111088214413, - 70922.869072285859, - 70944.628725234332, - 70966.390046803877, - 70988.153036738629, - 71009.917694782853, - 71031.684020680885, - 71053.45201417715, - 71075.221675016204, - 71096.993002942661, - 71118.765997701266, - 71140.540659036851, - 71162.316986694335, - 71184.09498041874, - 71205.874639955218, - 71227.655965048951, - 71249.438955445294, - 71271.223610889632, - 71293.009931127483, - 71314.797915904477, - 71336.587564966307, - 71358.378878058764, - 71380.171854927772, - 71401.966495319313, - 71423.762798979486, - 71445.560765654489, - 71467.360395090596, - 71489.161687034211, - 71510.964641231811, - 71532.769257429973, - 71554.575535375348, - 71576.383474814749, - 71598.19307549503, - 71620.004337163133, - 71641.817259566145, - 71663.631842451214, - 71685.4480855656, - 71707.26598865664, - 71729.085551471784, - 71750.906773758586, - 71772.729655264673, - 71794.554195737772, - 71816.380394925713, - 71838.208252576442, - 71860.037768437964, - 71881.868942258385, - 71903.701773785942, - 71925.536262768932, - 71947.372408955751, - 71969.210212094898, - 71991.049671934976, - 72012.890788224686, - 72034.73356071279, - 72056.577989148165, - 72078.424073279821, - 72100.271812856794, - 72122.121207628254, - 72143.97225734347, - 72165.824961751801, - 72187.679320602692, - 72209.53533364569, - 72231.393000630429, - 72253.252321306645, - 72275.113295424177, - 72296.975922732949, - 72318.840202982959, - 72340.706135924338, - 72362.573721307272, - 72384.442958882093, - 72406.313848399179, - 72428.186389609036, - 72450.060582262216, - 72471.936426109431, - 72493.813920901433, - 72515.693066389096, - 72537.573862323392, - 72559.456308455352, - 72581.340404536139, - 72603.226150316987, - 72625.113545549248, - 72647.002589984331, - 72668.893283373764, - 72690.785625469172, - 72712.679616022273, - 72734.575254784853, - 72756.472541508803, - 72778.371475946144, - 72800.272057848939, - 72822.174286969355, - 72844.07816305969, - 72865.983685872285, - 72887.890855159596, - 72909.799670674183, - 72931.710132168693, - 72953.622239395845, - 72975.535992108475, - 72997.451390059519, - 73019.368433001961, - 73041.287120688925, - 73063.207452873612, - 73085.129429309294, - 73107.053049749389, - 73128.978313947344, - 73150.905221656736, - 73172.833772631217, - 73194.763966624567, - 73216.695803390612, - 73238.62928268328, - 73260.564404256627, - 73282.501167864757, - 73304.439573261901, - 73326.379620202337, - 73348.321308440485, - 73370.264637730841, - 73392.209607827957, - 73414.156218486532, - 73436.104469461323, - 73458.054360507173, - 73480.005891379056, - 73501.959061831993, - 73523.913871621116, - 73545.870320501665, - 73567.828408228932, - 73589.78813455833, - 73611.749499245358, - 73633.712502045615, - 73655.677142714747, - 73677.643421008557, - 73699.611336682879, - 73721.580889493693, - 73743.552079197019, - 73765.524905548999, - 73787.499368305856, - 73809.475467223907, - 73831.453202059551, - 73853.432572569291, - 73875.413578509717, - 73897.396219637507, - 73919.380495709411, - 73941.36640648231, - 73963.353951713143, - 73985.343131158952, - 74007.333944576865, - 74029.326391724098, - 74051.320472357969, - 74073.316186235883, - 74095.313533115303, - 74117.312512753837, - 74139.313124909138, - 74161.315369338976, - 74183.319245801191, - 74205.324754053727, - 74227.331893854629, - 74249.340664961986, - 74271.351067134034, - 74293.363100129049, - 74315.376763705441, - 74337.392057621662, - 74359.408981636298, - 74381.427535508003, - 74403.447718995507, - 74425.469531857671, - 74447.492973853383, - 74469.518044741693, - 74491.54474428168, - 74513.573072232539, - 74535.603028353551, - 74557.634612404087, - 74579.667824143602, - 74601.702663331642, - 74623.739129727837, - 74645.777223091936, - 74667.816943183716, - 74689.858289763113, - 74711.901262590094, - 74733.945861424741, - 74755.992086027225, - 74778.039936157802, - 74800.089411576817, - 74822.140512044702, - 74844.193237321961, - 74866.24758716923, - 74888.303561347187, - 74910.36115961663, - 74932.420381738411, - 74954.481227473516, - 74976.543696582972, - 74998.607788827925, - 75020.673503969607, - 75042.740841769322, - 75064.809801988464, - 75086.88038438854, - 75108.952588731103, - 75131.026414777836, - 75153.101862290467, - 75175.178931030852, - 75197.257620760924, - 75219.33793124267, - 75241.419862238225, - 75263.503413509738, - 75285.588584819503, - 75307.675375929874, - 75329.763786603318, - 75351.853816602365, - 75373.945465689612, - 75396.038733627807, - 75418.133620179724, - 75440.230125108254, - 75462.32824817636, - 75484.427989147109, - 75506.529347783653, - 75528.63232384919, - 75550.736917107075, - 75572.843127320695, - 75594.950954253538, - 75617.060397669193, - 75639.171457331307, - 75661.284133003646, - 75683.398424450032, - 75705.514331434402, - 75727.631853720741, - 75749.750991073175, - 75771.871743255862, - 75793.994110033076, - 75816.118091169177, - 75838.243686428585, - 75860.370895575848, - 75882.499718375562, - 75904.630154592422, - 75926.762203991224, - 75948.895866336825, - 75971.031141394182, - 75993.168028928325, - 76015.306528704401, - 76037.4466404876, - 76059.588364043215, - 76081.731699136653, - 76103.876645533353, - 76126.023202998884, - 76148.171371298871, - 76170.321150199044, - 76192.472539465205, - 76214.625538863256, - 76236.780148159174, - 76258.936367119008, - 76281.094195508922, - 76303.253633095141, - 76325.414679643975, - 76347.577334921851, - 76369.741598695226, - 76391.907470730686, - 76414.074950794879, - 76436.244038654564, - 76458.414734076548, - 76480.587036827754, - 76502.760946675175, - 76524.936463385893, - 76547.11358672705, - 76569.292316465915, - 76591.472652369819, - 76613.654594206164, - 76635.838141742468, - 76658.023294746308, - 76680.210052985349, - 76702.398416227341, - 76724.588384240138, - 76746.779956791637, - 76768.973133649866, - 76791.167914582897, - 76813.364299358902, - 76835.562287746157, - 76857.761879512967, - 76879.963074427797, - 76902.165872259109, - 76924.37027277553, - 76946.576275745727, - 76968.783880938441, - 76990.993088122515, - 77013.203897066895, - 77035.416307540567, - 77057.630319312622, - 77079.845932152239, - 77102.063145828695, - 77124.281960111301, - 77146.50237476948, - 77168.724389572759, - 77190.948004290723, - 77213.173218693031, - 77235.400032549442, - 77257.628445629802, - 77279.858457704031, - 77302.090068542122, - 77324.323277914169, - 77346.558085590339, - 77368.794491340886, - 77391.032494936138, - 77413.272096146524, - 77435.51329474253, - 77457.756090494731, - 77480.000483173804, - 77502.246472550498, - 77524.494058395634, - 77546.743240480107, - 77568.994018574944, - 77591.246392451198, - 77613.500361880026, - 77635.755926632657, - 77658.013086480438, - 77680.271841194757, - 77702.532190547092, - 77724.794134309021, - 77747.057672252195, - 77769.322804148323, - 77791.589529769248, - 77813.857848886837, - 77836.127761273063, - 77858.399266699998, - 77880.67236493979, - 77902.947055764627, - 77925.223338946831, - 77947.50121425878, - 77969.780681472927, - 77992.061740361838, - 78014.344390698127, - 78036.628632254491, - 78058.914464803747, - 78081.201888118725, - 78103.490901972415, - 78125.781506137821, - 78148.073700388064, - 78170.367484496339, - 78192.662858235926, - 78214.959821380166, - 78237.258373702498, - 78259.558514976452, - 78281.860244975614, - 78304.163563473659, - 78326.468470244363, - 78348.77496506153, - 78371.083047699125, - 78393.392717931114, - 78415.703975531578, - 78438.016820274701, - 78460.331251934695, - 78482.647270285903, - 78504.964875102727, - 78527.284066159627, - 78549.604843231195, - 78571.927206092048, - 78594.251154516911, - 78616.576688280606, - 78638.903807157985, - 78661.232510924034, - 78683.562799353778, - 78705.894672222363, - 78728.228129304945, - 78750.563170376859, - 78772.899795213423, - 78795.238003590101, - 78817.577795282399, - 78839.919170065928, - 78862.262127716356, - 78884.606668009452, - 78906.952790721043, - 78929.300495627045, - 78951.64978250346, - 78974.000651126378, - 78996.353101271932, - 79018.707132716358, - 79041.062745235977, - 79063.41993860717, - 79085.778712606436, - 79108.139067010285, - 79130.501001595389, - 79152.864516138419, - 79175.22961041618, - 79197.596284205531, - 79219.96453728342, - 79242.33436942687, - 79264.705780412987, - 79287.078770018954, - 79309.453338022009, - 79331.829484199508, - 79354.207208328866, - 79376.586510187582, - 79398.967389553218, - 79421.349846203433, - 79443.733879915948, - 79466.119490468584, - 79488.50667763922, - 79510.895441205823, - 79533.285780946433, - 79555.677696639163, - 79578.071188062226, - 79600.466254993895, - 79622.862897212515, - 79645.261114496549, - 79667.660906624471, - 79690.062273374875, - 79712.465214526455, - 79734.869729857935, - 79757.275819148126, - 79779.683482175955, - 79802.092718720378, - 79824.503528560454, - 79846.915911475327, - 79869.329867244203, - 79891.745395646343, - 79914.162496461155, - 79936.581169468045, - 79959.001414446553, - 79981.423231176261, - 80003.846619436852, - 80026.271579008084, - 80048.698109669771, - 80071.12621120183, - 80093.555883384237, - 80115.987125997053, - 80138.419938820414, - 80160.854321634528, - 80183.290274219689, - 80205.727796356281, - 80228.166887824715, - 80250.607548405547, - 80273.049777879336, - 80295.493576026798, - 80317.938942628651, - 80340.385877465727, - 80362.834380318949, - 80385.28445096928, - 80407.736089197788, - 80430.189294785596, - 80452.644067513917, - 80475.100407164035, - 80497.558313517322, - 80520.017786355209, - 80542.478825459213, - 80564.941430610925, - 80587.405601592007, - 80609.871338184195, - 80632.338640169342, - 80654.8075073293, - 80677.277939446067, - 80699.749936301683, - 80722.223497678278, - 80744.698623358039, - 80767.17531312324, - 80789.653566756242, - 80812.133384039465, - 80834.614764755403, - 80857.097708686648, - 80879.582215615854, - 80902.068285325731, - 80924.555917599093, - 80947.045112218824, - 80969.535868967869, - 80992.028187629272, - 81014.522067986123, - 81037.017509821613, - 81059.514512919006, - 81082.013077061609, - 81104.513202032831, - 81127.014887616184, - 81149.518133595193, - 81172.022939753486, - 81194.529305874807, - 81217.037231742899, - 81239.546717141639, - 81262.057761854958, - 81284.570365666848, - 81307.084528361403, - 81329.600249722775, - 81352.117529535186, - 81374.636367582949, - 81397.156763650448, - 81419.678717522125, - 81442.202228982511, - 81464.727297816222, - 81487.253923807933, - 81509.782106742379, - 81532.311846404409, - 81554.843142578902, - 81577.375995050839, - 81599.910403605274, - 81622.446368027333, - 81644.983888102215, - 81667.522963615178, - 81690.063594351581, - 81712.605780096841, - 81735.149520636449, - 81757.694815755967, - 81780.241665241047, - 81802.79006887741, - 81825.340026450824, - 81847.891537747171, - 81870.444602552379, - 81892.999220652477, - 81915.555391833506, - 81938.113115881672, - 81960.672392583176, - 81983.233221724338, - 82005.795603091537, - 82028.359536471224, - 82050.925021649906, - 82073.492058414209, - 82096.060646550788, - 82118.630785846399, - 82141.202476087841, - 82163.775717062032, - 82186.35050855593, - 82208.926850356569, - 82231.504742251054, - 82254.084184026578, - 82276.665175470393, - 82299.24771636985, - 82321.831806512317, - 82344.417445685307, - 82367.004633676348, - 82389.593370273054, - 82412.183655263143, - 82434.775488434374, - 82457.368869574595, - 82479.963798471697, - 82502.560274913689, - 82525.158298688606, - 82547.757869584602, - 82570.35898738986, - 82592.961651892678, - 82615.565862881398, - 82638.171620144421, - 82660.778923470265, - 82683.387772647475, - 82705.998167464713, - 82728.610107710658, - 82751.223593174116, - 82773.83862364394, - 82796.45519890904, - 82819.073318758441, - 82841.692982981185, - 82864.314191366429, - 82886.936943703375, - 82909.561239781324, - 82932.187079389638, - 82954.814462317736, - 82977.443388355125, - 83000.073857291369, - 83022.70586891612, - 83045.339423019104, - 83067.974519390089, - 83090.611157818959, - 83113.249338095629, - 83135.8890600101, - 83158.530323352461, - 83181.173127912858, - 83203.817473481497, - 83226.463359848669, - 83249.11078680474, - 83271.759754140134, - 83294.410261645375, - 83317.062309111003, - 83339.715896327703, - 83362.371023086147, - 83385.027689177165, - 83407.685894391587, - 83430.345638520361, - 83453.006921354478, - 83475.669742685001, - 83498.334102303095, - 83520.999999999942, - 83543.667435566866, - 83566.336408795192, - 83589.006919476349, - 83611.678967401851, - 83634.352552363242, - 83657.027674152167, - 83679.704332560359, - 83702.382527379552, - 83725.062258401638, - 83747.743525418511, - 83770.42632822218, - 83793.110666604684, - 83815.796540358162, - 83838.483949274829, - 83861.172893146941, - 83883.863371766842, - 83906.555384926964, - 83929.248932419752, - 83951.944014037799, - 83974.640629573696, - 83997.338778820151, - 84020.038461569929, - 84042.739677615857, - 84065.442426750829, - 84088.146708767847, - 84110.852523459922, - 84133.559870620171, - 84156.268750041796, - 84178.979161518029, - 84201.691104842204, - 84224.404579807713, - 84247.119586208006, - 84269.83612383662, - 84292.55419248715, - 84315.273791953281, - 84337.994922028738, - 84360.717582507335, - 84383.441773182945, - 84406.167493849513, - 84428.894744301069, - 84451.623524331691, - 84474.353833735542, - 84497.085672306828, - 84519.819039839858, - 84542.553936128999, - 84565.290360968676, - 84588.028314153402, - 84610.767795477717, - 84633.508804736295, - 84656.251341723822, - 84678.995406235073, - 84701.740998064924, - 84724.488117008252, - 84747.236762860062, - 84769.986935415407, - 84792.73863446941, - 84815.491859817252, - 84838.246611254188, - 84861.002888575575, - 84883.760691576768, - 84906.520020053256, - 84929.28087380057, - 84952.043252614312, - 84974.807156290146, - 84997.572584623806, - 85020.339537411113, - 85043.108014447949, - 85065.878015530237, - 85088.649540453989, - 85111.422589015303, - 85134.197161010321, - 85156.973256235244, - 85179.750874486374, - 85202.530015560071, - 85225.310679252725, - 85248.092865360857, - 85270.876573681016, - 85293.661804009811, - 85316.448556143951, - 85339.236829880188, - 85362.026625015351, - 85384.817941346351, - 85407.610778670132, - 85430.405136783724, - 85453.201015484257, - 85475.998414568865, - 85498.797333834795, - 85521.597773079353, - 85544.399732099904, - 85567.203210693886, - 85590.008208658808, - 85612.814725792239, - 85635.62276189182, - 85658.432316755265, - 85681.243390180331, - 85704.055981964877, - 85726.870091906807, - 85749.685719804082, - 85772.502865454764, - 85795.321528656961, - 85818.141709208852, - 85840.963406908675, - 85863.78662155474, - 85886.611352945445, - 85909.437600879217, - 85932.26536515457, - 85955.094645570091, - 85977.92544192441, - 86000.757754016275, - 86023.591581644432, - 86046.426924607746, - 86069.263782705122, - 86092.102155735556, - 86114.942043498071, - 86137.783445791807, - 86160.626362415918, - 86183.470793169676, - 86206.316737852379, - 86229.164196263402, - 86252.013168202204, - 86274.863653468303, - 86297.715651861261, - 86320.569163180728, - 86343.424187226425, - 86366.280723798132, - 86389.138772695675, - 86411.998333718977, - 86434.859406668009, - 86457.721991342827, - 86480.586087543532, - 86503.451695070296, - 86526.318813723352, - 86549.187443303032, - 86572.057583609683, - 86594.929234443756, - 86617.802395605773, - 86640.677066896271, - 86663.553248115903, - 86686.43093906538, - 86709.310139545443, - 86732.190849356964, - 86755.073068300815, - 86777.956796177954, - 86800.842032789442, - 86823.728777936354, - 86846.617031419853, - 86869.506793041175, - 86892.398062601613, - 86915.290839902518, - 86938.185124745316, - 86961.080916931489, - 86983.978216262592, - 87006.87702254027, - 87029.777335566177, - 87052.67915514209, - 87075.582481069796, - 87098.487313151185, - 87121.39365118822, - 87144.301494982894, - 87167.210844337285, - 87190.121699053532, - 87213.034058933845, - 87235.947923780506, - 87258.863293395829, - 87281.780167582241, - 87304.698546142172, - 87327.618428878181, - 87350.539815592856, - 87373.462706088845, - 87396.387100168897, - 87419.312997635774, - 87442.240398292357, - 87465.16930194154, - 87488.099708386319, - 87511.031617429733, - 87533.965028874911, - 87556.899942525008, - 87579.836358183282, - 87602.774275653021, - 87625.713694737613, - 87648.654615240492, - 87671.597036965148, - 87694.540959715145, - 87717.486383294105, - 87740.433307505737, - 87763.381732153779, - 87786.331657042057, - 87809.283081974456, - 87832.236006754916, - 87855.190431187453, - 87878.146355076155, - 87901.103778225151, - 87924.062700438633, - 87947.023121520891, - 87969.985041276246, - 87992.948459509105, - 88015.913376023906, - 88038.879790625171, - 88061.847703117513, - 88084.817113305573, - 88107.788020994049, - 88130.760425987726, - 88153.734328091465, - 88176.709727110137, - 88199.686622848749, - 88222.665015112303, - 88245.644903705906, - 88268.626288434709, - 88291.609169103947, - 88314.593545518903, - 88337.579417484914, - 88360.566784807408, - 88383.555647291854, - 88406.546004743795, - 88429.537856968818, - 88452.531203772611, - 88475.52604496089, - 88498.522380339447, - 88521.52020971413, - 88544.519532890874, - 88567.520349675644, - 88590.522659874507, - 88613.526463293543, - 88636.531759738922, - 88659.538549016899, - 88682.546830933745, - 88705.556605295846, - 88728.567871909589, - 88751.580630581491, - 88774.594881118086, - 88797.610623325963, - 88820.62785701183, - 88843.646581982393, - 88866.666798044462, - 88889.688505004888, - 88912.711702670611, - 88935.7363908486, - 88958.762569345898, - 88981.790237969632, - 89004.81939652696, - 89027.850044825114, - 89050.882182671412, - 89073.9158098732, - 89096.950926237885, - 89119.987531572973, - 89143.025625686001, - 89166.065208384563, - 89189.106279476357, - 89212.148838769106, - 89235.192886070581, - 89258.238421188667, - 89281.285443931265, - 89304.333954106376, - 89327.383951522017, - 89350.435435986306, - 89373.488407307406, - 89396.542865293537, - 89419.598809753006, - 89442.656240494165, - 89465.715157325409, - 89488.775560055219, - 89511.837448492137, - 89534.900822444746, - 89557.965681721733, - 89581.032026131812, - 89604.099855483742, - 89627.169169586399, - 89650.239968248672, - 89673.312251279538, - 89696.386018488018, - 89719.461269683205, - 89742.53800467425, - 89765.616223270365, - 89788.69592528083, - 89811.777110514988, - 89834.859778782207, - 89857.943929891975, - 89881.029563653807, - 89904.116679877261, - 89927.205278372014, - 89950.29535894774, - 89973.386921414218, - 89996.479965581268, - 90019.574491258769, - 90042.670498256688, - 90065.767986385021, - 90088.866955453836, - 90111.967405273259, - 90135.069335653476, - 90158.172746404758, - 90181.277637337407, - 90204.384008261797, - 90227.49185898836, - 90250.601189327586, - 90273.711999090039, - 90296.824288086325, - 90319.938056127125, - 90343.053303023189, - 90366.170028585286, - 90389.288232624298, - 90412.407914951138, - 90435.529075376777, - 90458.651713712257, - 90481.775829768681, - 90504.901423357209, - 90528.028494289058, - 90551.157042375504, - 90574.287067427911, - 90597.418569257643, - 90620.551547676194, - 90643.686002495073, - 90666.821933525847, - 90689.959340580186, - 90713.098223469773, - 90736.238582006365, - 90759.380416001804, - 90782.523725267951, - 90805.668509616764, - 90828.814768860233, - 90851.962502810435, - 90875.11171127946, - 90898.262394079517, - 90921.414551022855, - 90944.568181921743, - 90967.72328658856, - 90990.879864835719, - 91014.037916475718, - 91037.19744132107, - 91060.358439184391, - 91083.520909878338, - 91106.684853215629, - 91129.850269009039, - 91153.017157071401, - 91176.185517215621, - 91199.355349254649, - 91222.526653001492, - 91245.699428269247, - 91268.873674871036, - 91292.049392620058, - 91315.226581329553, - 91338.405240812834, - 91361.585370883287, - 91384.766971354344, - 91407.950042039476, - 91431.134582752245, - 91454.320593306256, - 91477.508073515171, - 91500.697023192712, - 91523.887442152685, - 91547.07933020893, - 91570.272687175326, - 91593.467512865856, - 91616.663807094534, - 91639.861569675442, - 91663.060800422725, - 91686.261499150554, - 91709.463665673218, - 91732.66729980502, - 91755.872401360321, - 91779.078970153569, - 91802.287005999257, - 91825.49650871192, - 91848.707478106167, - 91871.91991399668, - 91895.133816198169, - 91918.349184525418, - 91941.566018793281, - 91964.784318816659, - 91988.004084410495, - 92011.22531538982, - 92034.448011569708, - 92057.672172765277, - 92080.897798791746, - 92104.124889464365, - 92127.353444598411, - 92150.58346400928, - 92173.814947512379, - 92197.04789492322, - 92220.282306057314, - 92243.518180730272, - 92266.755518757753, - 92289.994319955469, - 92313.234584139194, - 92336.476311124774, - 92359.719500728082, - 92382.964152765067, - 92406.210267051734, - 92429.457843404161, - 92452.706881638471, - 92475.957381570814, - 92499.209343017443, - 92522.462765794655, - 92545.717649718805, - 92568.973994606305, - 92592.231800273614, - 92615.491066537259, - 92638.751793213814, - 92662.01398011994, - 92685.277627072326, - 92708.54273388772, - 92731.809300382942, - 92755.077326374871, - 92778.346811680414, - 92801.617756116568, - 92824.890159500384, - 92848.164021648947, - 92871.439342379424, - 92894.716121509016, - 92917.994358855023, - 92941.274054234746, - 92964.555207465572, - 92987.837818364962, - 93011.121886750407, - 93034.407412439468, - 93057.694395249753, - 93080.982834998955, - 93104.272731504767, - 93127.564084584999, - 93150.856894057491, - 93174.15115974014, - 93197.446881450916, - 93220.744059007804, - 93244.04269222889, - 93267.342780932304, - 93290.644324936235, - 93313.947324058914, - 93337.251778118633, - 93360.557686933767, - 93383.865050322696, - 93407.173868103928, - 93430.484140095941, - 93453.795866117362, - 93477.109045986799, - 93500.423679522952, - 93523.739766544561, - 93547.057306870454, - 93570.376300319491, - 93593.696746710571, - 93617.018645862699, - 93640.341997594893, - 93663.666801726242, - 93686.993058075881, - 93710.320766463032, - 93733.64992670693, - 93756.980538626914, - 93780.312602042337, - 93803.646116772637, - 93826.981082637285, - 93850.317499455836, - 93873.655367047861, - 93896.994685233032, - 93920.335453831038, - 93943.677672661666, - 93967.021341544707, - 93990.366460300051, - 94013.713028747632, - 94037.061046707429, - 94060.410513999494, - 94083.761430443905, - 94107.113795860845, - 94130.467610070496, - 94153.822872893157, - 94177.179584149111, - 94200.537743658759, - 94223.897351242529, - 94247.25840672091, - 94270.620909914433, - 94293.98486064373, - 94317.350258729421, - 94340.71710399224, - 94364.085396252936, - 94387.455135332348, - 94410.82632105134, - 94434.198953230851, - 94457.573031691878, - 94480.948556255447, - 94504.325526742658, - 94527.70394297468, - 94551.083804772716, - 94574.465111958023, - 94597.847864351934, - 94621.232061775823, - 94644.617704051096, - 94668.004790999272, - 94691.393322441872, - 94714.783298200506, - 94738.174718096794, - 94761.567581952477, - 94784.961889589307, - 94808.357640829097, - 94831.754835493703, - 94855.153473405066, - 94878.553554385173, - 94901.955078256055, - 94925.358044839784, - 94948.762453958523, - 94972.168305434476, - 94995.575599089891, - 95018.984334747074, - 95042.394512228391, - 95065.806131356265, - 95089.219191953176, - 95112.633693841635, - 95136.04963684424, - 95159.467020783617, - 95182.885845482466, - 95206.306110763529, - 95229.727816449609, - 95253.150962363579, - 95276.575548328314, - 95300.001574166803, - 95323.429039702052, - 95346.857944757154, - 95370.288289155214, - 95393.720072719429, - 95417.153295273019, - 95440.587956639298, - 95464.024056641589, - 95487.461595103305, - 95510.900571847902, - 95534.340986698866, - 95557.782839479783, - 95581.226130014256, - 95604.670858125959, - 95628.117023638595, - 95651.564626375985, - 95675.013666161918, - 95698.464142820303, - 95721.916056175076, - 95745.369406050231, - 95768.824192269807, - 95792.280414657915, - 95815.738073038709, - 95839.197167236387, - 95862.657697075221, - 95886.11966237954, - 95909.583062973688, - 95933.047898682111, - 95956.514169329268, - 95979.981874739708, - 96003.451014738006, - 96026.921589148798, - 96050.393597796792, - 96073.867040506724, - 96097.341917103375, - 96120.818227411626, - 96144.295971256375, - 96167.775148462577, - 96191.255758855244, - 96214.737802259449, - 96238.221278500292, - 96261.70618740299, - 96285.192528792715, - 96308.680302494788, - 96332.169508334526, - 96355.660146137321, - 96379.152215728609, - 96402.645716933868, - 96426.14064957868, - 96449.637013488609, - 96473.134808489311, - 96496.63403440651, - 96520.134691065963, - 96543.636778293469, - 96567.140295914898, - 96590.645243756153, - 96614.151621643221, - 96637.659429402134, - 96661.168666858954, - 96684.679333839798, - 96708.191430170875, - 96731.70495567839, - 96755.219910188665, - 96778.736293528011, - 96802.254105522836, - 96825.77334599958, - 96849.29401478474, - 96872.816111704873, - 96896.339636586577, - 96919.864589256511, - 96943.390969541389, - 96966.918777267958, - 96990.448012263048, - 97013.978674353522, - 97037.510763366285, - 97061.044279128328, - 97084.579221466673, - 97108.115590208385, - 97131.653385180587, - 97155.19260621049, - 97178.733253125291, - 97202.2753257523, - 97225.81882391886, - 97249.363747452342, - 97272.910096180189, - 97296.457869929916, - 97320.007068529041, - 97343.557691805196, - 97367.109739586012, - 97390.663211699197, - 97414.218107972498, - 97437.774428233737, - 97461.332172310766, - 97484.891340031507, - 97508.451931223899, - 97532.013945715982, - 97555.577383335811, - 97579.142243911512, - 97602.708527271257, - 97626.276233243261, - 97649.845361655811, - 97673.415912337223, - 97696.987885115886, - 97720.561279820206, - 97744.1360962787, - 97767.712334319876, - 97791.289993772341, - 97814.869074464703, - 97838.449576225685, - 97862.031498883996, - 97885.614842268449, - 97909.199606207883, - 97932.785790531183, - 97956.37339506732, - 97979.962419645264, - 98003.552864094076, - 98027.144728242856, - 98050.738011920766, - 98074.332714956996, - 98097.928837180807, - 98121.526378421506, - 98145.125338508456, - 98168.725717271067, - 98192.327514538789, - 98215.930730141132, - 98239.535363907664, - 98263.141415668011, - 98286.748885251814, - 98310.357772488816, - 98333.968077208759, - 98357.579799241488, - 98381.192938416847, - 98404.807494564782, - 98428.42346751524, - 98452.040857098269, - 98475.659663143917, - 98499.27988548232, - 98522.901523943656, - 98546.524578358163, - 98570.149048556093, - 98593.774934367786, - 98617.402235623624, - 98641.030952154048, - 98664.661083789513, - 98688.292630360564, - 98711.925591697771, - 98735.559967631794, - 98759.195757993293, - 98782.832962613014, - 98806.471581321734, - 98830.111613950285, - 98853.753060329575, - 98877.39592029051, - 98901.040193664099, - 98924.68588028138, - 98948.33297997342, - 98971.981492571387, - 98995.63141790645, - 99019.282755809851, - 99042.935506112874, - 99066.589668646877, - 99090.245243243233, - 99113.902229733401, - 99137.560627948857, - 99161.220437721131, - 99184.881658881859, - 99208.544291262631, - 99232.208334695169, - 99255.87378901121, - 99279.540654042547, - 99303.208929621018, - 99326.878615578535, - 99350.549711746993, - 99374.222217958435, - 99397.896134044888, - 99421.571459838422, - 99445.248195171211, - 99468.926339875441, - 99492.605893783344, - 99516.286856727209, - 99539.969228539398, - 99563.653009052287, - 99587.338198098325, - 99611.024795510006, - 99634.712801119866, - 99658.402214760499, - 99682.093036264545, - 99705.785265464699, - 99729.478902193689, - 99753.173946284325, - 99776.870397569437, - 99800.56825588191, - 99824.267521054688, - 99847.968192920773, - 99871.670271313182, - 99895.373756065004, - 99919.078647009388, - 99942.78494397951, - 99966.492646808634, - 99990.20175533001, - 100013.91226937699, - 100037.62418878295, - 100061.33751338134, - 100085.05224300563, - 100108.76837748935, - 100132.4859166661, - 100156.2048603695, - 100179.92520843323, - 100203.64696069101, - 100227.37011697664, - 100251.09467712394, - 100274.82064096678, - 100298.54800833909, - 100322.27677907483, - 100346.00695300807, - 100369.73852997283, - 100393.47150980328, - 100417.20589233354, - 100440.94167739789, - 100464.67886483055, - 100488.41745446586, - 100512.1574461382, - 100535.89883968196, - 100559.64163493161, - 100583.38583172169, - 100607.13142988674, - 100630.87842926137, - 100654.62682968024, - 100678.37663097809, - 100702.12783298964, - 100725.88043554971, - 100749.63443849317, - 100773.38984165489, - 100797.14664486986, - 100820.90484797307, - 100844.66445079957, - 100868.42545318443, - 100892.18785496285, - 100915.95165596998, - 100939.71685604109, - 100963.48345501146, - 100987.25145271645, - 101011.02084899142, - 101034.79164367182, - 101058.56383659317, - 101082.33742759094, - 101106.11241650078, - 101129.88880315828, - 101153.66658739912, - 101177.44576905905, - 101201.22634797383, - 101225.00832397929, - 101248.7916969113, - 101272.57646660579, - 101296.36263289873, - 101320.15019562612, - 101343.93915462404, - 101367.7295097286, - 101391.52126077596, - 101415.31440760233, - 101439.10895004397, - 101462.9048879372, - 101486.70222111834, - 101510.50094942382, - 101534.30107269008, - 101558.10259075361, - 101581.90550345098, - 101605.70981061876, - 101629.5155120936, - 101653.32260771218, - 101677.13109731126, - 101700.9409807276, - 101724.75225779804, - 101748.56492835947, - 101772.37899224881, - 101796.19444930303, - 101820.01129935916, - 101843.82954225427, - 101867.64917782549, - 101891.47020590997, - 101915.29262634492, - 101939.11643896763, - 101962.94164361537, - 101986.76824012553, - 102010.59622833549, - 102034.42560808272, - 102058.25637920471, - 102082.08854153901, - 102105.9220949232, - 102129.75703919494, - 102153.59337419191, - 102177.43109975185, - 102201.27021571253, - 102225.1107219118, - 102248.95261818753, - 102272.79590437764, - 102296.64058032009, - 102320.48664585294, - 102344.33410081422, - 102368.18294504205, - 102392.03317837461, - 102415.88480065008, - 102439.73781170673, - 102463.59221138287, - 102487.44799951684, - 102511.30517594704, - 102535.1637405119, - 102559.02369304992, - 102582.88503339965, - 102606.74776139967, - 102630.61187688859, - 102654.4773797051, - 102678.34426968795, - 102702.21254667587, - 102726.08221050771, - 102749.95326102231, - 102773.8256980586, - 102797.69952145554, - 102821.57473105213, - 102845.45132668741, - 102869.32930820051, - 102893.20867543056, - 102917.08942821674, - 102940.97156639832, - 102964.85508981455, - 102988.73999830478, - 103012.6262917084, - 103036.51396986481, - 103060.40303261351, - 103084.293479794, - 103108.18531124585, - 103132.07852680866, - 103155.97312632212, - 103179.8691096259, - 103203.76647655977, - 103227.66522696352, - 103251.56536067701, - 103275.46687754011, - 103299.36977739276, - 103323.27406007495, - 103347.1797254267, - 103371.0867732881, - 103394.99520349925, - 103418.90501590034, - 103442.81621033157, - 103466.72878663319, - 103490.64274464553, - 103514.55808420894, - 103538.4748051638, - 103562.39290735057, - 103586.31239060973, - 103610.23325478184, - 103634.15549970744, - 103658.07912522719, - 103682.00413118176, - 103705.93051741188, - 103729.85828375829, - 103753.78743006183, - 103777.71795616332, - 103801.64986190372, - 103825.58314712394, - 103849.51781166498, - 103873.4538553679, - 103897.39127807376, - 103921.33007962372, - 103945.27025985894, - 103969.21181862066, - 103993.15475575015, - 104017.0990710887, - 104041.0447644777, - 104064.99183575854, - 104088.94028477269, - 104112.89011136163, - 104136.84131536692, - 104160.79389663014, - 104184.74785499295, - 104208.70319029699, - 104232.65990238401, - 104256.61799109577, - 104280.57745627411, - 104304.53829776087, - 104328.50051539797, - 104352.46410902737, - 104376.42907849104, - 104400.39542363105, - 104424.36314428948, - 104448.33224030846, - 104472.3027115302, - 104496.27455779689, - 104520.24777895081, - 104544.22237483428, - 104568.19834528965, - 104592.17569015936, - 104616.15440928582, - 104640.13450251156, - 104664.1159696791, - 104688.09881063103, - 104712.08302520998, - 104736.06861325864, - 104760.05557461972, - 104784.043909136, - 104808.03361665027, - 104832.0246970054, - 104856.01715004431, - 104880.01097560991, - 104904.00617354522, - 104928.00274369326, - 104952.00068589712, - 104975.99999999993, - 105000.00068584486, - 105024.00274327511, - 105048.00617213396, - 105072.0109722647, - 105096.0171435107, - 105120.02468571534, - 105144.03359872208, - 105168.04388237436, - 105192.05553651576, - 105216.06856098982, - 105240.08295564017, - 105264.09872031047, - 105288.11585484444, - 105312.13435908582, - 105336.1542328784, - 105360.17547606604, - 105384.19808849262, - 105408.22207000206, - 105432.24742043833, - 105456.27413964548, - 105480.30222746753, - 105504.33168374863, - 105528.36250833291, - 105552.39470106458, - 105576.42826178786, - 105600.46319034706, - 105624.49948658649, - 105648.53715035053, - 105672.5761814836, - 105696.61657983017, - 105720.65834523473, - 105744.70147754184, - 105768.7459765961, - 105792.79184224214, - 105816.83907432464, - 105840.88767268835, - 105864.93763717801, - 105888.98896763846, - 105913.04166391456, - 105937.09572585119, - 105961.15115329332, - 105985.20794608595, - 106009.26610407409, - 106033.32562710284, - 106057.38651501729, - 106081.44876766266, - 106105.51238488412, - 106129.57736652695, - 106153.64371243643, - 106177.71142245791, - 106201.78049643678, - 106225.85093421848, - 106249.92273564848, - 106273.99590057228, - 106298.07042883546, - 106322.14632028362, - 106346.22357476239, - 106370.30219211751, - 106394.38217219469, - 106418.46351483969, - 106442.54621989837, - 106466.63028721658, - 106490.71571664025, - 106514.80250801529, - 106538.89066118775, - 106562.98017600364, - 106587.07105230905, - 106611.16328995011, - 106635.25688877302, - 106659.35184862395, - 106683.44816934918, - 106707.54585079502, - 106731.64489280782, - 106755.74529523395, - 106779.84705791986, - 106803.95018071201, - 106828.05466345693, - 106852.16050600118, - 106876.26770819137, - 106900.37626987413, - 106924.48619089619, - 106948.59747110425, - 106972.71011034511, - 106996.82410846559, - 107020.93946531253, - 107045.05618073288, - 107069.17425457356, - 107093.29368668159, - 107117.41447690397, - 107141.53662508781, - 107165.66013108024, - 107189.7849947284, - 107213.91121587952, - 107238.03879438085, - 107262.16773007967, - 107286.29802282334, - 107310.42967245923, - 107334.56267883476, - 107358.69704179741, - 107382.83276119467, - 107406.96983687414, - 107431.10826868335, - 107455.24805646999, - 107479.38920008171, - 107503.53169936626, - 107527.67555417139, - 107551.82076434491, - 107575.96732973469, - 107600.11525018861, - 107624.26452555459, - 107648.41515568066, - 107672.56714041479, - 107696.72047960508, - 107720.87517309963, - 107745.03122074658, - 107769.18862239413, - 107793.34737789053, - 107817.50748708403, - 107841.66894982298, - 107865.83176595572, - 107889.99593533068, - 107914.16145779629, - 107938.32833320105, - 107962.49656139348, - 107986.66614222217, - 108010.83707553572, - 108035.00936118282, - 108059.18299901215, - 108083.35798887245, - 108107.53433061253, - 108131.71202408121, - 108155.89106912735, - 108180.07146559987, - 108204.25321334775, - 108228.43631221994, - 108252.62076206553, - 108276.80656273357, - 108300.99371407321, - 108325.18221593359, - 108349.37206816394, - 108373.56327061349, - 108397.75582313156, - 108421.94972556747, - 108446.1449777706, - 108470.34157959036, - 108494.53953087622, - 108518.73883147769, - 108542.93948124432, - 108567.14148002568, - 108591.34482767139, - 108615.54952403114, - 108639.75556895464, - 108663.96296229165, - 108688.17170389196, - 108712.38179360541, - 108736.59323128188, - 108760.80601677128, - 108785.02014992358, - 108809.23563058881, - 108833.45245861699, - 108857.67063385822, - 108881.89015616261, - 108906.11102538036, - 108930.33324136167, - 108954.55680395682, - 108978.78171301607, - 109003.00796838976, - 109027.23556992831, - 109051.46451748211, - 109075.69481090162, - 109099.92645003737, - 109124.15943473989, - 109148.39376485976, - 109172.62944024763, - 109196.86646075416, - 109221.10482623006, - 109245.34453652608, - 109269.58559149304, - 109293.82799098175, - 109318.07173484311, - 109342.31682292801, - 109366.56325508743, - 109390.81103117237, - 109415.06015103387, - 109439.31061452301, - 109463.56242149093, - 109487.8155717888, - 109512.07006526781, - 109536.3259017792, - 109560.58308117429, - 109584.8416033044, - 109609.1014680209, - 109633.36267517522, - 109657.62522461878, - 109681.88911620311, - 109706.15434977971, - 109730.4209252002, - 109754.68884231619, - 109778.95810097932, - 109803.22870104131, - 109827.50064235389, - 109851.77392476884, - 109876.04854813802, - 109900.32451231324, - 109924.60181714644, - 109948.88046248957, - 109973.1604481946, - 109997.44177411357, - 110021.72444009855, - 110046.00844600165, - 110070.29379167501, - 110094.58047697082, - 110118.86850174134, - 110143.15786583882, - 110167.44856911557, - 110191.74061142397, - 110216.03399261639, - 110240.32871254528, - 110264.62477106311, - 110288.9221680224, - 110313.22090327571, - 110337.52097667565, - 110361.82238807483, - 110386.12513732594, - 110410.42922428172, - 110434.73464879491, - 110459.04141071832, - 110483.34950990479, - 110507.6589462072, - 110531.96971947847, - 110556.28182957157, - 110580.5952763395, - 110604.91005963532, - 110629.22617931209, - 110653.54363522294, - 110677.86242722106, - 110702.18255515963, - 110726.50401889188, - 110750.82681827113, - 110775.1509531507, - 110799.47642338395, - 110823.80322882428, - 110848.13136932514, - 110872.46084474004, - 110896.79165492248, - 110921.12379972603, - 110945.4572790043, - 110969.79209261097, - 110994.12824039967, - 111018.46572222417, - 111042.80453793822, - 111067.14468739564, - 111091.48617045028, - 111115.82898695602, - 111140.1731367668, - 111164.51861973655, - 111188.86543571933, - 111213.21358456917, - 111237.56306614014, - 111261.91388028639, - 111286.26602686207, - 111310.61950572141, - 111334.97431671864, - 111359.33045970804, - 111383.68793454397, - 111408.04674108078, - 111432.40687917286, - 111456.76834867468, - 111481.13114944073, - 111505.49528132551, - 111529.86074418361, - 111554.22753786964, - 111578.59566223821, - 111602.96511714405, - 111627.33590244185, - 111651.7080179864, - 111676.08146363248, - 111700.45623923496, - 111724.8323446487, - 111749.20977972864, - 111773.58854432974, - 111797.96863830699, - 111822.35006151545, - 111846.73281381019, - 111871.11689504632, - 111895.50230507903, - 111919.8890437635, - 111944.27711095495, - 111968.6665065087, - 111993.05723028004, - 112017.44928212435, - 112041.842661897, - 112066.23736945343, - 112090.63340464912, - 112115.03076733962, - 112139.42945738042, - 112163.82947462716, - 112188.23081893545, - 112212.63349016097, - 112237.03748815943, - 112261.44281278658, - 112285.84946389822, - 112310.25744135017, - 112334.66674499828, - 112359.07737469849, - 112383.48933030672, - 112407.90261167898, - 112432.31721867126, - 112456.73315113965, - 112481.15040894024, - 112505.56899192919, - 112529.98889996267, - 112554.41013289688, - 112578.8326905881, - 112603.25657289263, - 112627.68177966679, - 112652.10831076698, - 112676.53616604958, - 112700.96534537108, - 112725.39584858794, - 112749.82767555672, - 112774.26082613398, - 112798.6953001763, - 112823.13109754038, - 112847.56821808286, - 112872.00666166049, - 112896.44642813003, - 112920.88751734827, - 112945.32992917208, - 112969.77366345831, - 112994.21872006389, - 113018.66509884578, - 113043.11279966099, - 113067.56182236652, - 113092.01216681948, - 113116.46383287695, - 113140.9168203961, - 113165.37112923413, - 113189.82675924824, - 113214.28371029573, - 113238.74198223387, - 113263.20157492002, - 113287.66248821157, - 113312.12472196593, - 113336.58827604055, - 113361.05315029295, - 113385.51934458067, - 113409.98685876124, - 113434.45569269233, - 113458.92584623155, - 113483.39731923661, - 113507.87011156522, - 113532.34422307517, - 113556.81965362425, - 113581.2964030703, - 113605.77447127122, - 113630.25385808491, - 113654.73456336933, - 113679.2165869825, - 113703.69992878241, - 113728.18458862718, - 113752.67056637487, - 113777.15786188368, - 113801.64647501177, - 113826.13640561736, - 113850.62765355874, - 113875.12021869418, - 113899.61410088204, - 113924.1092999807, - 113948.60581584855, - 113973.10364834407, - 113997.60279732574, - 114022.1032626521, - 114046.60504418171, - 114071.10814177318, - 114095.61255528514, - 114120.11828457628, - 114144.62532950533, - 114169.13368993104, - 114193.6433657122, - 114218.15435670764, - 114242.66666277625, - 114267.18028377694, - 114291.69521956862, - 114316.21147001031, - 114340.72903496103, - 114365.24791427983, - 114389.7681078258, - 114414.2896154581, - 114438.81243703589, - 114463.33657241837, - 114487.8620214648, - 114512.38878403447, - 114536.91685998671, - 114561.44624918087, - 114585.97695147636, - 114610.5089667326, - 114635.04229480909, - 114659.57693556532, - 114684.11288886084, - 114708.65015455526, - 114733.18873250818, - 114757.72862257928, - 114782.26982462825, - 114806.81233851484, - 114831.35616409882, - 114855.90130123998, - 114880.44774979822, - 114904.99550963337, - 114929.5445806054, - 114954.09496257425, - 114978.64665539992, - 115003.19965894247, - 115027.75397306195, - 115052.30959761847, - 115076.86653247218, - 115101.42477748329, - 115125.984332512, - 115150.54519741859, - 115175.10737206334, - 115199.67085630659, - 115224.23565000873, - 115248.80175303014, - 115273.3691652313, - 115297.93788647266, - 115322.50791661476, - 115347.07925551817, - 115371.65190304347, - 115396.22585905129, - 115420.80112340231, - 115445.37769595724, - 115469.95557657682, - 115494.53476512182, - 115519.11526145306, - 115543.69706543141, - 115568.28017691776, - 115592.86459577303, - 115617.4503218582, - 115642.03735503425, - 115666.62569516223, - 115691.21534210323, - 115715.80629571836, - 115740.39855586876, - 115764.99212241563, - 115789.58699522018, - 115814.18317414368, - 115838.78065904744, - 115863.37944979276, - 115887.97954624105, - 115912.5809482537, - 115937.18365569216, - 115961.78766841792, - 115986.39298629249, - 116010.99960917742, - 116035.60753693432, - 116060.21676942479, - 116084.82730651053, - 116109.43914805322, - 116134.0522939146, - 116158.66674395646, - 116183.2824980406, - 116207.89955602887, - 116232.51791778316, - 116257.13758316539, - 116281.75855203751, - 116306.38082426153, - 116331.00439969949, - 116355.62927821343, - 116380.25545966547, - 116404.88294391775, - 116429.51173083246, - 116454.14182027178, - 116478.77321209799, - 116503.40590617337, - 116528.03990236025, - 116552.67520052097, - 116577.31180051794, - 116601.94970221359, - 116626.5889054704, - 116651.22941015086, - 116675.87121611751, - 116700.51432323294, - 116725.15873135976, - 116749.8044403606, - 116774.45145009817, - 116799.0997604352, - 116823.74937123443, - 116848.40028235866, - 116873.05249367072, - 116897.70600503348, - 116922.36081630984, - 116947.01692736275, - 116971.67433805518, - 116996.33304825013, - 117020.99305781067, - 117045.65436659988, - 117070.31697448085, - 117094.98088131678, - 117119.64608697082, - 117144.31259130624, - 117168.98039418629, - 117193.64949547425, - 117218.31989503348, - 117242.99159272734, - 117267.66458841923, - 117292.33888197262, - 117317.01447325097, - 117341.6913621178, - 117366.36954843666, - 117391.04903207115, - 117415.72981288488, - 117440.41189074152, - 117465.09526550474, - 117489.77993703831, - 117514.46590520597, - 117539.15316987153, - 117563.84173089883, - 117588.53158815173, - 117613.22274149416, - 117637.91519079007, - 117662.60893590341, - 117687.30397669821, - 117712.00031303853, - 117736.69794478847, - 117761.39687181212, - 117786.09709397367, - 117810.7986111373, - 117835.50142316725, - 117860.20552992777, - 117884.91093128319, - 117909.6176270978, - 117934.32561723603, - 117959.03490156225, - 117983.74547994092, - 118008.45735223651, - 118033.17051831353, - 118057.88497803656, - 118082.60073127014, - 118107.31777787894, - 118132.03611772758, - 118156.75575068076, - 118181.47667660323, - 118206.19889535972, - 118230.92240681504, - 118255.64721083404, - 118280.37330728157, - 118305.10069602253, - 118329.82937692189, - 118354.55934984458, - 118379.29061465565, - 118404.02317122012, - 118428.75701940308, - 118453.49215906965, - 118478.22859008498, - 118502.96631231424, - 118527.70532562268, - 118552.44562987552, - 118577.18722493808, - 118601.93011067568, - 118626.67428695368, - 118651.41975363747, - 118676.16651059251, - 118700.91455768423, - 118725.66389477813, - 118750.41452173979, - 118775.16643843475, - 118799.91964472862, - 118824.67414048707, - 118849.42992557574, - 118874.18699986035, - 118898.94536320666, - 118923.70501548045, - 118948.46595654752, - 118973.22818627374, - 118997.99170452499, - 119022.7565111672, - 119047.52260606633, - 119072.28998908834, - 119097.0586600993, - 119121.82861896523, - 119146.59986555226, - 119171.3723997265, - 119196.14622135412, - 119220.92133030134, - 119245.69772643436, - 119270.47540961947, - 119295.25437972297, - 119320.03463661121, - 119344.81618015055, - 119369.5990102074, - 119394.38312664822, - 119419.16852933947, - 119443.95521814766, - 119468.74319293935, - 119493.53245358112, - 119518.32299993958, - 119543.11483188139, - 119567.90794927324, - 119592.70235198183, - 119617.49803987393, - 119642.29501281632, - 119667.09327067583, - 119691.89281331931, - 119716.69364061367, - 119741.49575242582, - 119766.29914862274, - 119791.10382907141, - 119815.90979363887, - 119840.71704219218, - 119865.52557459843, - 119890.33539072477, - 119915.14649043836, - 119939.95887360642, - 119964.77254009615, - 119989.58748977486, - 120014.40372250983, - 120039.22123816841, - 120064.04003661797, - 120088.86011772591, - 120113.6814813597, - 120138.5041273868, - 120163.3280556747, - 120188.15326609099, - 120212.97975850321, - 120237.807532779, - 120262.63658878599, - 120287.46692639188, - 120312.29854546436, - 120337.13144587121, - 120361.9656274802, - 120386.80109015915, - 120411.63783377589, - 120436.47585819835, - 120461.31516329442, - 120486.15574893207, - 120510.99761497928, - 120535.84076130406, - 120560.68518777451, - 120585.53089425867, - 120610.3778806247, - 120635.22614674074, - 120660.07569247499, - 120684.92651769568, - 120709.77862227106, - 120734.63200606944, - 120759.48666895913, - 120784.3426108085, - 120809.19983148595, - 120834.05833085992, - 120858.91810879884, - 120883.77916517125, - 120908.64149984565, - 120933.5051126906, - 120958.37000357473, - 120983.23617236665, - 121008.10361893504, - 121032.97234314861, - 121057.84234487606, - 121082.71362398617, - 121107.58618034775, - 121132.46001382964, - 121157.33512430069, - 121182.21151162982, - 121207.08917568595, - 121231.96811633807, - 121256.84833345517, - 121281.72982690629, - 121306.61259656049, - 121331.49664228689, - 121356.38196395461, - 121381.26856143285, - 121406.15643459078, - 121431.04558329767, - 121455.93600742276, - 121480.82770683538, - 121505.72068140487, - 121530.61493100057, - 121555.51045549192, - 121580.40725474835, - 121605.30532863933, - 121630.20467703436, - 121655.10529980299, - 121680.00719681478, - 121704.91036793934, - 121729.81481304632, - 121754.72053200539, - 121779.62752468624, - 121804.53579095862, - 121829.44533069231, - 121854.3561437571, - 121879.26823002285, - 121904.1815893594, - 121929.09622163669, - 121954.01212672464, - 121978.92930449323, - 122003.84775481246, - 122028.76747755238, - 122053.68847258303, - 122078.61073977455, - 122103.53427899707, - 122128.45909012076, - 122153.38517301581, - 122178.31252755247, - 122203.24115360099, - 122228.17105103172, - 122253.10221971494, - 122278.03465952107, - 122302.96837032049, - 122327.90335198362, - 122352.83960438096, - 122377.777127383, - 122402.71592086025, - 122427.65598468333, - 122452.59731872278, - 122477.53992284928, - 122502.48379693348, - 122527.42894084606, - 122552.37535445779, - 122577.32303763942, - 122602.27199026172, - 122627.22221219557, - 122652.17370331181, - 122677.12646348133, - 122702.08049257506, - 122727.03579046397, - 122751.99235701906, - 122776.95019211136, - 122801.9092956119, - 122826.8696673918, - 122851.83130732219, - 122876.79421527422, - 122901.75839111909, - 122926.72383472799, - 122951.69054597223, - 122976.65852472307, - 123001.62777085182, - 123026.59828422987, - 123051.57006472857, - 123076.54311221937, - 123101.5174265737, - 123126.49300766307, - 123151.46985535898, - 123176.44796953299, - 123201.42735005668, - 123226.40799680166, - 123251.38990963959, - 123276.37308844214, - 123301.35753308103, - 123326.343243428, - 123351.33021935483, - 123376.31846073334, - 123401.30796743535, - 123426.29873933276, - 123451.29077629748, - 123476.28407820144, - 123501.2786449166, - 123526.27447631498, - 123551.27157226863, - 123576.26993264959, - 123601.26955732999, - 123626.27044618195, - 123651.27259907764, - 123676.27601588926, - 123701.28069648903, - 123726.28664074924, - 123751.29384854218, - 123776.30231974016, - 123801.31205421555, - 123826.32305184075, - 123851.33531248817, - 123876.34883603029, - 123901.36362233957, - 123926.37967128855, - 123951.39698274979, - 123976.41555659588, - 124001.43539269941, - 124026.45649093305, - 124051.47885116948, - 124076.50247328142, - 124101.5273571416, - 124126.55350262282, - 124151.58090959788, - 124176.60957793961, - 124201.63950752091, - 124226.67069821467, - 124251.70314989384, - 124276.73686243138, - 124301.7718357003, - 124326.80806957364, - 124351.84556392446, - 124376.88431862585, - 124401.92433355095, - 124426.96560857294, - 124452.00814356498, - 124477.05193840031, - 124502.0969929522, - 124527.14330709392, - 124552.19088069882, - 124577.23971364023, - 124602.28980579154, - 124627.34115702618, - 124652.3937672176, - 124677.44763623926, - 124702.50276396469, - 124727.55915026742, - 124752.61679502104, - 124777.67569809916, - 124802.73585937542, - 124827.79727872348, - 124852.85995601704, - 124877.92389112986, - 124902.98908393568, - 124928.05553430831, - 124953.1232421216, - 124978.19220724938, - 125003.26242956554, - 125028.33390894404, - 125053.40664525882, - 125078.48063838384, - 125103.55588819318, - 125128.63239456083, - 125153.71015736091, - 125178.78917646752, - 125203.86945175481, - 125228.95098309696, - 125254.03377036817, - 125279.1178134427, - 125304.20311219479, - 125329.28966649878, - 125354.37747622898, - 125379.46654125977, - 125404.55686146552, - 125429.6484367207, - 125454.74126689974, - 125479.83535187715, - 125504.93069152744, - 125530.02728572517, - 125555.12513434493, - 125580.22423726133, - 125605.32459434902, - 125630.4262054827, - 125655.52907053704, - 125680.63318938682, - 125705.73856190679, - 125730.84518797178, - 125755.9530674566, - 125781.06220023613, - 125806.17258618528, - 125831.28422517896, - 125856.39711709213, - 125881.51126179981, - 125906.62665917698, - 125931.74330909875, - 125956.86121144016, - 125981.98036607634, - 126007.10077288245, - 126032.22243173365, - 126057.34534250517, - 126082.46950507225, - 126107.59491931014, - 126132.72158509417, - 126157.84950229966, - 126182.97867080198, - 126208.10909047653, - 126233.24076119871, - 126258.37368284403, - 126283.50785528794, - 126308.64327840599, - 126333.77995207369, - 126358.91787616667, - 126384.0570505605, - 126409.19747513086, - 126434.3391497534, - 126459.48207430386, - 126484.62624865794, - 126509.77167269142, - 126534.9183462801, - 126560.06626929982, - 126585.21544162642, - 126610.36586313581, - 126635.51753370393, - 126660.67045320668, - 126685.82462152008, - 126710.98003852014, - 126736.13670408291, - 126761.29461808444, - 126786.45378040087, - 126811.61419090834, - 126836.77584948298, - 126861.93875600102, - 126887.10291033868, - 126912.26831237224, - 126937.43496197795, - 126962.60285903217, - 126987.77200341123, - 127012.94239499152, - 127038.11403364947, - 127063.2869192615, - 127088.46105170409, - 127113.63643085376, - 127138.81305658702, - 127163.99092878048, - 127189.17004731069, - 127214.35041205429, - 127239.53202288797, - 127264.71487968838, - 127289.89898233226, - 127315.08433069635, - 127340.27092465744, - 127365.45876409234, - 127390.64784887788, - 127415.83817889093, - 127441.02975400841, - 127466.22257410725, - 127491.41663906439, - 127516.61194875685, - 127541.80850306165, - 127567.00630185583, - 127592.20534501647, - 127617.4056324207, - 127642.60716394568, - 127667.80993946856, - 127693.01395886653, - 127718.21922201688, - 127743.42572879682, - 127768.63347908368, - 127793.84247275478, - 127819.05270968749, - 127844.26418975917, - 127869.47691284724, - 127894.69087882918, - 127919.90608758242, - 127945.12253898452, - 127970.34023291297, - 127995.55916924537, - 128020.77934785932, - 128046.00076863244, - 128071.22343144237, - 128096.44733616684, - 128121.67248268353, - 128146.89887087021, - 128172.12650060465, - 128197.35537176467, - 128222.5854842281, - 128247.81683787282, - 128273.04943257671, - 128298.28326821771, - 128323.51834467379, - 128348.75466182294, - 128373.99221954317, - 128399.23101771252, - 128424.47105620909, - 128449.71233491098, - 128474.95485369631, - 128500.19861244329, - 128525.44361103009, - 128550.68984933494, - 128575.93732723613, - 128601.18604461191, - 128626.43600134061, - 128651.68719730059, - 128676.93963237021, - 128702.1933064279, - 128727.44821935208, - 128752.70437102125, - 128777.96176131385, - 128803.22039010846, - 128828.48025728362, - 128853.74136271792, - 128879.00370628996, - 128904.26728787841, - 128929.53210736193, - 128954.79816461923, - 128980.06545952905, - 129005.33399197015, - 129030.60376182134, - 129055.87476896142, - 129081.14701326926, - 129106.42049462376, - 129131.6952129038, - 129156.97116798835, - 129182.24835975636, - 129207.52678808685, - 129232.80645285884, - 129258.08735395141, - 129283.36949124365, - 129308.65286461466, - 129333.9374739436, - 129359.22331910966, - 129384.51039999202, - 129409.79871646997, - 129435.08826842274, - 129460.37905572963, - 129485.67107826998, - 129510.96433592314, - 129536.25882856851, - 129561.55455608548, - 129586.85151835352, - 129612.14971525209, - 129637.4491466607, - 129662.74981245887, - 129688.0517125262, - 129713.35484674224, - 129738.65921498663, - 129763.96481713903, - 129789.27165307909, - 129814.57972268655, - 129839.88902584116, - 129865.19956242264, - 129890.51133231082, - 129915.82433538554, - 129941.13857152662, - 129966.45404061397, - 129991.7707425275, - 130017.08867714716, - 130042.4078443529, - 130067.72824402474, - 130093.04987604271, - 130118.37274028687, - 130143.69683663732, - 130169.02216497416, - 130194.34872517755, - 130219.67651712766, - 130245.0055407047, - 130270.33579578891, - 130295.66728226055, - 130320.99999999991, - 130346.33394888733, - 130371.66912880314, - 130397.00553962773, - 130422.34318124152, - 130447.68205352494, - 130473.02215635845, - 130498.36348962256, - 130523.70605319779, - 130549.0498469647, - 130574.39487080388, - 130599.74112459592, - 130625.08860822149, - 130650.43732156123, - 130675.78726449587, - 130701.13843690613, - 130726.49083867275, - 130751.84446967654, - 130777.19932979831, - 130802.5554189189, - 130827.91273691918, - 130853.27128368006, - 130878.63105908247, - 130903.99206300738, - 130929.35429533575, - 130954.71775594862, - 130980.08244472703, - 131005.44836155206, - 131030.81550630482, - 131056.18387886642, - 131081.55347911804, - 131106.92430694087, - 131132.29636221612, - 131157.66964482504, - 131183.0441546489, - 131208.41989156904, - 131233.79685546676, - 131259.17504622342, - 131284.55446372041, - 131309.93510783918, - 131335.31697846117, - 131360.70007546784, - 131386.0843987407, - 131411.46994816128, - 131436.85672361116, - 131462.24472497194, - 131487.63395212521, - 131513.02440495262, - 131538.41608333588, - 131563.80898715663, - 131589.2031162967, - 131614.59847063778, - 131639.9950500617, - 131665.39285445024, - 131690.79188368531, - 131716.19213764873, - 131741.59361622241, - 131766.99631928833, - 131792.40024672839, - 131817.80539842462, - 131843.21177425905, - 131868.61937411371, - 131894.02819787065, - 131919.43824541202, - 131944.84951661993, - 131970.26201137656, - 131995.67572956407, - 132021.09067106468, - 132046.50683576067, - 132071.9242235343, - 132097.34283426782, - 132122.76266784366, - 132148.1837241441, - 132173.60600305157, - 132199.02950444847, - 132224.45422821722, - 132249.88017424036, - 132275.30734240031, - 132300.73573257966, - 132326.16534466096, - 132351.59617852676, - 132377.02823405969, - 132402.46151114244, - 132427.89600965759, - 132453.33172948789, - 132478.76867051609, - 132504.20683262491, - 132529.64621569714, - 132555.08681961559, - 132580.5286442631, - 132605.97168952253, - 132631.41595527678, - 132656.86144140881, - 132682.30814780149, - 132707.75607433787, - 132733.20522090094, - 132758.65558737374, - 132784.10717363929, - 132809.55997958075, - 132835.01400508118, - 132860.46925002377, - 132885.92571429166, - 132911.38339776811, - 132936.84230033628, - 132962.30242187946, - 132987.76376228096, - 133013.22632142407, - 133038.69009919214, - 133064.15509546854, - 133089.62131013666, - 133115.08874307995, - 133140.55739418184, - 133166.02726332581, - 133191.49835039541, - 133216.97065527414, - 133242.44417784561, - 133267.91891799335, - 133293.39487560102, - 133318.87205055228, - 133344.35044273079, - 133369.83005202023, - 133395.31087830439, - 133420.79292146701, - 133446.27618139185, - 133471.76065796276, - 133497.24635106357, - 133522.73326057816, - 133548.22138639039, - 133573.71072838426, - 133599.20128644365, - 133624.69306045261, - 133650.1860502951, - 133675.68025585517, - 133701.1756770169, - 133726.67231366437, - 133752.17016568172, - 133777.66923295305, - 133803.16951536259, - 133828.67101279454, - 133854.17372513309, - 133879.67765226253, - 133905.18279406714, - 133930.68915043125, - 133956.19672123916, - 133981.70550637526, - 134007.21550572399, - 134032.7267191697, - 134058.23914659687, - 134083.75278789, - 134109.26764293358, - 134134.78371161217, - 134160.30099381026, - 134185.8194894125, - 134211.33919830353, - 134236.8601203679, - 134262.38225549037, - 134287.90560355558, - 134313.43016444831, - 134338.95593805326, - 134364.48292425525, - 134390.01112293909, - 134415.54053398955, - 134441.07115729159, - 134466.60299273001, - 134492.1360401898, - 134517.67029955584, - 134543.20577071316, - 134568.74245354676, - 134594.28034794159, - 134619.81945378278, - 134645.35977095537, - 134670.90129934452, - 134696.4440388353, - 134721.98798931291, - 134747.53315066252, - 134773.07952276937, - 134798.62710551871, - 134824.17589879577, - 134849.72590248589, - 134875.27711647438, - 134900.82954064661, - 134926.38317488792, - 134951.93801908373, - 134977.49407311951, - 135003.05133688069, - 135028.60981025276, - 135054.16949312127, - 135079.73038537172, - 135105.29248688967, - 135130.85579756077, - 135156.42031727062, - 135181.98604590484, - 135207.55298334916, - 135233.12112948924, - 135258.69048421088, - 135284.26104739975, - 135309.83281894168, - 135335.4057987225, - 135360.97998662802, - 135386.55538254412, - 135412.13198635669, - 135437.70979795168, - 135463.28881721498, - 135488.86904403262, - 135514.45047829056, - 135540.03311987486, - 135565.61696867159, - 135591.20202456677, - 135616.78828744654, - 135642.37575719706, - 135667.96443370447, - 135693.55431685498, - 135719.14540653475, - 135744.73770263011, - 135770.33120502727, - 135795.92591361253, - 135821.52182827223, - 135847.11894889272, - 135872.7172753604, - 135898.31680756161, - 135923.91754538284, - 135949.51948871053, - 135975.12263743114, - 136000.72699143123, - 136026.33255059729, - 136051.93931481591, - 136077.54728397369, - 136103.15645795723, - 136128.76683665317, - 136154.37841994822, - 136179.99120772901, - 136205.60519988232, - 136231.2203962949, - 136256.83679685349, - 136282.45440144493, - 136308.07320995603, - 136333.69322227367, - 136359.31443828469, - 136384.93685787608, - 136410.56048093468, - 136436.18530734754, - 136461.81133700156, - 136487.43856978384, - 136513.06700558143, - 136538.6966442813, - 136564.32748577066, - 136589.95952993655, - 136615.59277666616, - 136641.22722584667, - 136666.86287736523, - 136692.49973110916, - 136718.13778696564, - 136743.77704482197, - 136769.41750456547, - 136795.05916608346, - 136820.70202926331, - 136846.34609399244, - 136871.99136015819, - 136897.63782764805, - 136923.28549634948, - 136948.93436614997, - 136974.58443693706, - 137000.23570859825, - 137025.88818102115, - 137051.54185409332, - 137077.19672770242, - 137102.85280173609, - 137128.51007608202, - 137154.16855062786, - 137179.82822526142, - 137205.48909987041, - 137231.15117434258, - 137256.8144485658, - 137282.47892242789, - 137308.14459581667, - 137333.81146862009, - 137359.47954072602, - 137385.14881202241, - 137410.81928239719, - 137436.49095173844, - 137462.16381993407, - 137487.83788687221, - 137513.51315244089, - 137539.18961652822, - 137564.86727902229, - 137590.54613981131, - 137616.22619878338, - 137641.90745582676, - 137667.58991082967, - 137693.27356368033, - 137718.95841426702, - 137744.64446247809, - 137770.33170820182, - 137796.02015132661, - 137821.70979174081, - 137847.40062933284, - 137873.09266399115, - 137898.78589560417, - 137924.48032406042, - 137950.17594924837, - 137975.8727710566, - 138001.57078937365, - 138027.27000408815, - 138052.97041508864, - 138078.67202226384, - 138104.3748255024, - 138130.07882469296, - 138155.78401972432, - 138181.49041048516, - 138207.1979968643, - 138232.9067787505, - 138258.61675603263, - 138284.32792859949, - 138310.04029633995, - 138335.75385914298, - 138361.46861689744, - 138387.18456949232, - 138412.90171681659, - 138438.62005875923, - 138464.33959520931, - 138490.06032605586, - 138515.78225118798, - 138541.50537049473, - 138567.2296838653, - 138592.95519118884, - 138618.68189235451, - 138644.40978725153, - 138670.13887576913, - 138695.86915779658, - 138721.60063322316, - 138747.33330193823, - 138773.06716383106, - 138798.80221879104, - 138824.53846670757, - 138850.27590747006, - 138876.01454096794, - 138901.7543670907, - 138927.49538572782, - 138953.2375967688, - 138978.9810001032, - 139004.72559562061, - 139030.47138321059, - 139056.2183627628, - 139081.96653416683, - 139107.71589731239, - 139133.46645208917, - 139159.21819838689, - 139184.97113609532, - 139210.72526510421, - 139236.48058530336, - 139262.23709658257, - 139287.99479883176, - 139313.75369194071, - 139339.51377579942, - 139365.27505029776, - 139391.03751532568, - 139416.80117077316, - 139442.56601653024, - 139468.33205248689, - 139494.09927853322, - 139519.86769455927, - 139545.63730045516, - 139571.408096111, - 139597.18008141697, - 139622.95325626322, - 139648.72762054001, - 139674.5031741375, - 139700.27991694602, - 139726.05784885579, - 139751.83696975713, - 139777.61727954043, - 139803.39877809596, - 139829.18146531415, - 139854.96534108539, - 139880.75040530015, - 139906.53665784886, - 139932.32409862199, - 139958.11272751007, - 139983.90254440365, - 140009.69354919327, - 140035.48574176949, - 140061.27912202294, - 140087.07368984428, - 140112.86944512415, - 140138.66638775321, - 140164.4645176222, - 140190.26383462184, - 140216.06433864293, - 140241.86602957622, - 140267.66890731253, - 140293.47297174268, - 140319.27822275754, - 140345.08466024802, - 140370.89228410498, - 140396.70109421943, - 140422.51109048226, - 140448.32227278448, - 140474.13464101712, - 140499.94819507122, - 140525.76293483781, - 140551.57886020801, - 140577.3959710729, - 140603.21426732364, - 140629.03374885136, - 140654.85441554731, - 140680.67626730262, - 140706.49930400858, - 140732.32352555645, - 140758.1489318375, - 140783.97552274304, - 140809.80329816442, - 140835.63225799298, - 140861.46240212015, - 140887.29373043729, - 140913.12624283586, - 140938.95993920733, - 140964.79481944317, - 140990.63088343487, - 141016.46813107401, - 141042.30656225214, - 141068.14617686081, - 141093.98697479168, - 141119.82895593636, - 141145.6721201865, - 141171.51646743377, - 141197.36199756994, - 141223.20871048668, - 141249.05660607578, - 141274.90568422904, - 141300.75594483822, - 141326.6073877952, - 141352.4600129918, - 141378.31382031992, - 141404.16880967148, - 141430.02498093838, - 141455.8823340126, - 141481.74086878612, - 141507.60058515094, - 141533.46148299909, - 141559.32356222265, - 141585.18682271364, - 141611.05126436421, - 141636.9168870665, - 141662.78369071262, - 141688.65167519479, - 141714.5208404052, - 141740.39118623605, - 141766.26271257963, - 141792.1354193282, - 141818.00930637406, - 141843.88437360956, - 141869.760620927, - 141895.6380482188, - 141921.51665537735, - 141947.39644229505, - 141973.27740886438, - 141999.15955497778, - 142025.04288052776, - 142050.92738540689, - 142076.81306950765, - 142102.69993272264, - 142128.58797494444, - 142154.47719606571, - 142180.36759597904, - 142206.25917457714, - 142232.15193175265, - 142258.04586739838, - 142283.94098140698, - 142309.83727367126, - 142335.73474408401, - 142361.63339253806, - 142387.5332189262, - 142413.43422314132, - 142439.33640507635, - 142465.23976462413, - 142491.14430167765, - 142517.05001612983, - 142542.95690787368, - 142568.86497680223, - 142594.77422280848, - 142620.68464578551, - 142646.5962456264, - 142672.50902222423, - 142698.42297547215, - 142724.33810526333, - 142750.25441149093, - 142776.17189404817, - 142802.09055282827, - 142828.01038772447, - 142853.93139863008, - 142879.85358543837, - 142905.77694804268, - 142931.70148633636, - 142957.62720021277, - 142983.55408956532, - 143009.48215428743, - 143035.41139427255, - 143061.34180941415, - 143087.27339960571, - 143113.20616474075, - 143139.14010471283, - 143165.07521941551, - 143191.01150874238, - 143216.94897258704, - 143242.88761084314, - 143268.82742340435, - 143294.76841016437, - 143320.71057101688, - 143346.65390585564, - 143372.59841457437, - 143398.54409706692, - 143424.49095322701, - 143450.43898294857, - 143476.38818612538, - 143502.33856265133, - 143528.29011242036, - 143554.24283532638, - 143580.19673126334, - 143606.1518001252, - 143632.10804180597, - 143658.06545619969, - 143684.02404320039, - 143709.98380270213, - 143735.944734599, - 143761.90683878519, - 143787.87011515474, - 143813.83456360188, - 143839.8001840208, - 143865.76697630569, - 143891.73494035081, - 143917.7040760504, - 143943.67438329876, - 143969.6458619902, - 143995.61851201905, - 144021.59233327967, - 144047.56732566646, - 144073.54348907378, - 144099.52082339607, - 144125.49932852783, - 144151.4790043635, - 144177.45985079758, - 144203.44186772458, - 144229.42505503909, - 144255.40941263564, - 144281.39494040885, - 144307.38163825331, - 144333.36950606373, - 144359.35854373468, - 144385.34875116093, - 144411.34012823718, - 144437.33267485813, - 144463.32639091855, - 144489.32127631325, - 144515.31733093705, - 144541.31455468474, - 144567.3129474512, - 144593.3125091313, - 144619.31323961995, - 144645.31513881206, - 144671.31820660262, - 144697.32244288657, - 144723.32784755889, - 144749.33442051467, - 144775.34216164888, - 144801.35107085665, - 144827.36114803303, - 144853.37239307314, - 144879.38480587213, - 144905.39838632516, - 144931.41313432742, - 144957.4290497741, - 144983.44613256046, - 145009.46438258173, - 145035.48379973322, - 145061.50438391021, - 145087.52613500805, - 145113.54905292206, - 145139.57313754765, - 145165.59838878017, - 145191.62480651509, - 145217.65239064783, - 145243.68114107384, - 145269.71105768863, - 145295.74214038774, - 145321.77438906668, - 145347.80780362099, - 145373.84238394629, - 145399.87812993818, - 145425.91504149229, - 145451.95311850426, - 145477.9923608698, - 145504.03276848458, - 145530.07434124436, - 145556.11707904484, - 145582.16098178181, - 145608.20604935108, - 145634.25228164849, - 145660.29967856981, - 145686.34824001096, - 145712.39796586783, - 145738.4488560363, - 145764.50091041232, - 145790.55412889185, - 145816.60851137087, - 145842.66405774537, - 145868.72076791141, - 145894.77864176501, - 145920.83767920226, - 145946.89788011924, - 145972.95924441208, - 145999.02177197693, - 146025.08546270995, - 146051.15031650732, - 146077.21633326527, - 146103.28351288004, - 146129.35185524789, - 146155.42136026506, - 146181.49202782792, - 146207.56385783272, - 146233.63685017588, - 146259.71100475377, - 146285.78632146274, - 146311.86280019928, - 146337.94044085976, - 146364.01924334071, - 146390.09920753856, - 146416.18033334985, - 146442.26262067116, - 146468.34606939898, - 146494.43067942993, - 146520.51645066062, - 146546.60338298764, - 146572.69147630769, - 146598.78073051744, - 146624.87114551352, - 146650.96272119274, - 146677.05545745179, - 146703.14935418745, - 146729.2444112965, - 146755.34062867577, - 146781.43800622207, - 146807.53654383228, - 146833.63624140329, - 146859.73709883197, - 146885.83911601527, - 146911.94229285014, - 146938.04662923355, - 146964.15212506248, - 146990.25878023397, - 147016.36659464505, - 147042.47556819281, - 147068.58570077427, - 147094.6969922866, - 147120.80944262692, - 147146.92305169237, - 147173.03781938017, - 147199.15374558745, - 147225.27083021149, - 147251.38907314953, - 147277.50847429881, - 147303.62903355664, - 147329.75075082036, - 147355.87362598727, - 147381.99765895473, - 147408.12284962015, - 147434.24919788091, - 147460.37670363448, - 147486.50536677826, - 147512.63518720976, - 147538.76616482646, - 147564.89829952587, - 147591.03159120557, - 147617.16603976308, - 147643.30164509601, - 147669.43840710199, - 147695.57632567859, - 147721.71540072354, - 147747.85563213445, - 147773.99701980909, - 147800.13956364512, - 147826.28326354033, - 147852.42811939248, - 147878.57413109933, - 147904.72129855872, - 147930.86962166851, - 147957.01910032652, - 147983.16973443062, - 148009.32152387875, - 148035.47446856883, - 148061.62856839882, - 148087.78382326665, - 148113.94023307035, - 148140.09779770792, - 148166.25651707739, - 148192.41639107687, - 148218.57741960438, - 148244.73960255808, - 148270.90293983606, - 148297.0674313365, - 148323.23307695755, - 148349.39987659742, - 148375.56783015432, - 148401.73693752653, - 148427.90719861226, - 148454.07861330983, - 148480.25118151752, - 148506.42490313368, - 148532.59977805667, - 148558.77580618486, - 148584.95298741665, - 148611.13132165043, - 148637.31080878471, - 148663.49144871789, - 148689.6732413485, - 148715.85618657502, - 148742.040284296, - 148768.22553440998, - 148794.41193681557, - 148820.59949141133, - 148846.78819809589, - 148872.97805676793, - 148899.16906732606, - 148925.36122966901, - 148951.55454369547, - 148977.74900930419, - 149003.9446263939, - 149030.1413948634, - 149056.33931461151, - 149082.53838553699, - 149108.73860753875, - 149134.9399805156, - 149161.14250436646, - 149187.34617899026, - 149213.5510042859, - 149239.75698015234, - 149265.96410648854, - 149292.17238319354, - 149318.38181016635, - 149344.59238730598, - 149370.80411451156, - 149397.01699168212, - 149423.23101871679, - 149449.44619551473, - 149475.66252197503, - 149501.87999799693, - 149528.0986234796, - 149554.31839832227, - 149580.53932242419, - 149606.76139568459, - 149632.98461800278, - 149659.20898927809, - 149685.43450940982, - 149711.66117829733, - 149737.88899584001, - 149764.11796193724, - 149790.34807648844, - 149816.57933939309, - 149842.81175055061, - 149869.04530986046, - 149895.28001722222, - 149921.51587253538, - 149947.75287569952, - 149973.99102661415, - 150000.23032517891, - 150026.47077129342, - 150052.71236485732, - 150078.95510577026, - 150105.1989939319, - 150131.444029242, - 150157.69021160025, - 150183.93754090639, - 150210.18601706024, - 150236.43563996154, - 150262.68640951012, - 150288.93832560582, - 150315.19138814852, - 150341.44559703805, - 150367.70095217437, - 150393.95745345735, - 150420.21510078697, - 150446.47389406321, - 150472.73383318601, - 150498.99491805542, - 150525.25714857146, - 150551.52052463419, - 150577.78504614369, - 150604.05071300003, - 150630.31752510337, - 150656.58548235384, - 150682.85458465159, - 150709.1248318968, - 150735.39622398972, - 150761.66876083051, - 150787.9424423195, - 150814.21726835691, - 150840.49323884305, - 150866.77035367821, - 150893.04861276277, - 150919.32801599705, - 150945.60856328148, - 150971.89025451642, - 150998.17308960229, - 151024.45706843957, - 151050.74219092872, - 151077.02845697021, - 151103.31586646455, - 151129.60441931229, - 151155.894115414, - 151182.1849546702, - 151208.47693698155, - 151234.77006224863, - 151261.06433037209, - 151287.35974125259, - 151313.65629479082, - 151339.95399088747, - 151366.25282944329, - 151392.55281035902, - 151418.85393353543, - 151445.1561988733, - 151471.45960627345, - 151497.76415563675, - 151524.06984686397, - 151550.37667985607, - 151576.68465451393, - 151602.99377073845, - 151629.30402843058, - 151655.61542749128, - 151681.92796782157, - 151708.24164932242, - 151734.55647189484, - 151760.87243543993, - 151787.18953985872, - 151813.50778505235, - 151839.82717092187, - 151866.14769736846, - 151892.46936429327, - 151918.79217159748, - 151945.11611918229, - 151971.44120694889, - 151997.76743479856, - 152024.09480263255, - 152050.42331035214, - 152076.75295785864, - 152103.08374505339, - 152129.41567183775, - 152155.74873811303, - 152182.08294378067, - 152208.41828874208, - 152234.75477289871, - 152261.09239615197, - 152287.43115840337, - 152313.77105955439, - 152340.11209950657, - 152366.45427816146, - 152392.79759542056, - 152419.14205118554, - 152445.48764535793, - 152471.8343778394, - 152498.18224853161, - 152524.53125733617, - 152550.88140415482, - 152577.23268888926, - 152603.58511144121, - 152629.93867171241, - 152656.29336960468, - 152682.64920501978, - 152709.00617785956, - 152735.36428802583, - 152761.72353542043, - 152788.08391994529, - 152814.44544150229, - 152840.80809999333, - 152867.17189532038, - 152893.53682738543, - 152919.90289609041, - 152946.27010133737, - 152972.63844302832, - 152999.00792106529, - 153025.37853535041, - 153051.7502857857, - 153078.12317227334, - 153104.4971947154, - 153130.8723530141, - 153157.24864707157, - 153183.62607679001, - 153210.00464207167, - 153236.38434281875, - 153262.76517893354, - 153289.14715031831, - 153315.53025687535, - 153341.91449850702, - 153368.2998751156, - 153394.68638660354, - 153421.07403287315, - 153447.46281382689, - 153473.85272936718, - 153500.24377939643, - 153526.63596381716, - 153553.02928253182, - 153579.42373544298, - 153605.81932245308, - 153632.21604346478, - 153658.61389838057, - 153685.0128871031, - 153711.41300953497, - 153737.81426557881, - 153764.21665513728, - 153790.62017811305, - 153817.02483440886, - 153843.43062392739, - 153869.83754657139, - 153896.24560224367, - 153922.65479084692, - 153949.06511228404, - 153975.4765664578, - 154001.88915327107, - 154028.30287262669, - 154054.71772442761, - 154081.13370857667, - 154107.55082497682, - 154133.96907353101, - 154160.38845414223, - 154186.80896671346, - 154213.23061114774, - 154239.65338734805, - 154266.07729521746, - 154292.50233465908, - 154318.92850557598, - 154345.35580787127, - 154371.7842414481, - 154398.21380620965, - 154424.64450205903, - 154451.07632889951, - 154477.50928663427, - 154503.94337516659, - 154530.37859439969, - 154556.81494423689, - 154583.25242458144, - 154609.69103533673, - 154636.13077640603, - 154662.57164769279, - 154689.01364910032, - 154715.45678053208, - 154741.90104189145, - 154768.34643308193, - 154794.79295400696, - 154821.24060457002, - 154847.68938467462, - 154874.13929422433, - 154900.59033312264, - 154927.04250127316, - 154953.49579857948, - 154979.95022494521, - 155006.40578027396, - 155032.86246446942, - 155059.32027743524, - 155085.77921907514, - 155112.2392892928, - 155138.70048799197, - 155165.16281507642, - 155191.62627044989, - 155218.09085401625, - 155244.55656567923, - 155271.02340534274, - 155297.49137291059, - 155323.96046828668, - 155350.4306913749, - 155376.90204207919, - 155403.37452030348, - 155429.84812595171, - 155456.32285892789, - 155482.79871913602, - 155509.27570648011, - 155535.75382086422, - 155562.23306219239, - 155588.71343036872, - 155615.19492529731, - 155641.67754688227, - 155668.16129502779, - 155694.64616963797, - 155721.13217061706, - 155747.61929786921, - 155774.10755129869, - 155800.59693080973, - 155827.08743630661, - 155853.57906769359, - 155880.07182487496, - 155906.56570775513, - 155933.06071623837, - 155959.55685022907, - 155986.05410963166, - 156012.5524943505, - 156039.05200429002, - 156065.55263935472, - 156092.054399449, - 156118.5572844774, - 156145.06129434443, - 156171.5664289546, - 156198.07268821247, - 156224.5800720226, - 156251.08858028959, - 156277.59821291809, - 156304.10896981266, - 156330.62085087801, - 156357.1338560188, - 156383.64798513969, - 156410.16323814544, - 156436.67961494075, - 156463.1971154304, - 156489.71573951913, - 156516.23548711176, - 156542.75635811311, - 156569.27835242799, - 156595.80146996127, - 156622.32571061782, - 156648.85107430254, - 156675.37756092031, - 156701.90517037612, - 156728.43390257491, - 156754.96375742162, - 156781.49473482129, - 156808.02683467892, - 156834.5600568995, - 156861.09440138817, - 156887.62986804993, - 156914.16645678994, - 156940.70416751326, - 156967.24300012505, - 156993.78295453047, - 157020.32403063469, - 157046.8662283429, - 157073.40954756032, - 157099.9539881922, - 157126.49955014378, - 157153.04623332032, - 157179.59403762716, - 157206.14296296958, - 157232.69300925292, - 157259.24417638258, - 157285.79646426387, - 157312.34987280221, - 157338.90440190304, - 157365.46005147175, - 157392.01682141385, - 157418.57471163478, - 157445.13372204005, - 157471.69385253513, - 157498.25510302564, - 157524.81747341706, - 157551.38096361503, - 157577.9455735251, - 157604.51130305286, - 157631.07815210402, - 157657.64612058419, - 157684.21520839902, - 157710.78541545427, - 157737.35674165559, - 157763.92918690876, - 157790.50275111952, - 157817.07743419363, - 157843.65323603692, - 157870.23015655516, - 157896.80819565422, - 157923.3873532399, - 157949.96762921812, - 157976.54902349479, - 158003.13153597576, - 158029.71516656701, - 158056.29991517449, - 158082.88578170416, - 158109.47276606198, - 158136.06086815402, - 158162.65008788629, - 158189.24042516484, - 158215.83187989573, - 158242.42445198505, - 158269.01814133892, - 158295.61294786347, - 158322.20887146486, - 158348.80591204923, - 158375.4040695228, - 158402.00334379176, - 158428.60373476235, - 158455.2052423408, - 158481.80786643337, - 158508.41160694641, - 158535.01646378616, - 158561.62243685898, - 158588.2295260712, - 158614.8377313292, - 158641.44705253936, - 158668.05748960807, - 158694.66904244179, - 158721.28171094693, - 158747.89549502998, - 158774.5103945974, - 158801.12640955573, - 158827.74353981143, - 158854.36178527112, - 158880.9811458413, - 158907.60162142856, - 158934.22321193956, - 158960.84591728085, - 158987.46973735912, - 159014.09467208097, - 159040.72072135314, - 159067.3478850823, - 159093.97616317519, - 159120.60555553852, - 159147.23606207906, - 159173.8676827036, - 159200.50041731889, - 159227.13426583182, - 159253.76922814918, - 159280.40530417781, - 159307.04249382461, - 159333.68079699649, - 159360.32021360032, - 159386.96074354305, - 159413.60238673165, - 159440.24514307309, - 159466.88901247433, - 159493.53399484244, - 159520.18009008438, - 159546.82729810724, - 159573.47561881805, - 159600.12505212394, - 159626.77559793202, - 159653.42725614941, - 159680.08002668325, - 159706.73390944069, - 159733.38890432892, - 159760.04501125516, - 159786.70223012666, - 159813.36056085059, - 159840.02000333427, - 159866.68055748497, - 159893.34222320997, - 159920.00500041663, - 159946.66888901225, - 159973.33388890422, - 159999.99999999988, - 160026.66722220668, - 160053.33555543202, - 160080.0049995833, - 160106.67555456801, - 160133.3472202936, - 160160.0199966676, - 160186.6938835975, - 160213.36888099083, - 160240.04498875517, - 160266.72220679806, - 160293.40053502709, - 160320.07997334987, - 160346.76052167406, - 160373.44217990729, - 160400.1249479572, - 160426.80882573154, - 160453.49381313793, - 160480.17991008417, - 160506.86711647795, - 160533.55543222709, - 160560.24485723933, - 160586.93539142248, - 160613.62703468435, - 160640.31978693281, - 160667.01364807569, - 160693.70861802087, - 160720.40469667627, - 160747.1018839498, - 160773.80017974938, - 160800.49958398298, - 160827.20009655855, - 160853.90171738411, - 160880.60444636765, - 160907.30828341722, - 160934.01322844089, - 160960.71928134665, - 160987.42644204266, - 161014.13471043704, - 161040.84408643784, - 161067.55456995327, - 161094.26616089148, - 161120.97885916062, - 161147.69266466892, - 161174.40757732463, - 161201.12359703594, - 161227.84072371112, - 161254.55895725847, - 161281.27829758628, - 161307.99874460287, - 161334.72029821656, - 161361.44295833571, - 161388.1667248687, - 161414.89159772391, - 161441.61757680977, - 161468.34466203468, - 161495.07285330712, - 161521.80215053557, - 161548.53255362847, - 161575.26406249436, - 161601.99667704175, - 161628.7303971792, - 161655.46522281526, - 161682.20115385848, - 161708.93819021754, - 161735.67633180099, - 161762.41557851751, - 161789.15593027571, - 161815.89738698432, - 161842.63994855201, - 161869.38361488748, - 161896.1283858995, - 161922.87426149679, - 161949.62124158812, - 161976.36932608229, - 162003.1185148881, - 162029.8688079144, - 162056.62020507001, - 162083.37270626382, - 162110.12631140469, - 162136.88102040152, - 162163.63683316324, - 162190.39374959879, - 162217.15176961714, - 162243.91089312723, - 162270.67112003808, - 162297.43245025873, - 162324.19488369819, - 162350.9584202655, - 162377.72305986975, - 162404.48880242003, - 162431.25564782543, - 162458.02359599507, - 162484.79264683815, - 162511.56280026378, - 162538.33405618116, - 162565.10641449949, - 162591.87987512801, - 162618.65443797593, - 162645.43010295252, - 162672.20686996708, - 162698.98473892888, - 162725.76370974723, - 162752.54378233149, - 162779.32495659095, - 162806.10723243505, - 162832.89060977317, - 162859.67508851466, - 162886.46066856899, - 162913.24734984562, - 162940.03513225398, - 162966.82401570358, - 162993.6140001039, - 163020.40508536444, - 163047.19727139481, - 163073.99055810447, - 163100.78494540305, - 163127.58043320014, - 163154.37702140535, - 163181.17470992831, - 163207.97349867865, - 163234.77338756606, - 163261.57437650024, - 163288.37646539087, - 163315.17965414765, - 163341.98394268038, - 163368.78933089875, - 163395.59581871261, - 163422.40340603172, - 163449.2120927659, - 163476.02187882498, - 163502.83276411882, - 163529.6447485573, - 163556.45783205028, - 163583.2720145077, - 163610.08729583945, - 163636.90367595552, - 163663.72115476584, - 163690.53973218042, - 163717.35940810922, - 163744.18018246227, - 163771.00205514964, - 163797.82502608138, - 163824.64909516752, - 163851.4742623182, - 163878.3005274435, - 163905.12789045356, - 163931.95635125853, - 163958.78590976857, - 163985.61656589387, - 164012.44831954464, - 164039.28117063109, - 164066.11511906344, - 164092.95016475199, - 164119.78630760699, - 164146.62354753874, - 164173.46188445756, - 164200.30131827376, - 164227.14184889771, - 164253.98347623978, - 164280.82620021031, - 164307.67002071979, - 164334.51493767856, - 164361.3609509971, - 164388.20806058586, - 164415.05626635533, - 164441.905568216, - 164468.75596607837, - 164495.607459853, - 164522.4600494504, - 164549.31373478117, - 164576.16851575591, - 164603.02439228518, - 164629.88136427966, - 164656.73943164994, - 164683.59859430668, - 164710.45885216061, - 164737.32020512238, - 164764.1826531027, - 164791.04619601235, - 164817.91083376206, - 164844.77656626256, - 164871.64339342469, - 164898.51131515924, - 164925.38033137703, - 164952.25044198887, - 164979.1216469057, - 165005.9939460383, - 165032.86733929763, - 165059.7418265946, - 165086.61740784015, - 165113.4940829452 -}; - -#else - -#ifdef BIG_IQ_TABLE -#define IQ_TABLE_SIZE 8192 -#else -#define IQ_TABLE_SIZE 1026 -#endif - -ALIGN static const real_t iq_table[IQ_TABLE_SIZE] = -{ - REAL_CONST(0.0), - REAL_CONST(1.0/8.0), - REAL_CONST(2.5198420997897464/8.0), - REAL_CONST(4.3267487109222245/8.0), - REAL_CONST(6.3496042078727974/8.0), - REAL_CONST(8.5498797333834844/8.0), - REAL_CONST(10.902723556992836/8.0), - REAL_CONST(13.390518279406722/8.0), - REAL_CONST(15.999999999999998/8.0), - REAL_CONST(18.720754407467133/8.0), - REAL_CONST(21.544346900318832/8.0), - REAL_CONST(24.463780996262464/8.0), - REAL_CONST(27.47314182127996/8.0), - REAL_CONST(30.567350940369842/8.0), - REAL_CONST(33.741991698453212/8.0), - REAL_CONST(36.993181114957046/8.0), - REAL_CONST(40.317473596635935/8.0), - REAL_CONST(43.711787041189993/8.0), - REAL_CONST(47.173345095760126/8.0), - REAL_CONST(50.699631325716943/8.0), - REAL_CONST(54.288352331898118/8.0), - REAL_CONST(57.937407704003519/8.0), - REAL_CONST(61.6448652744185/8.0), - REAL_CONST(65.408940536585988/8.0), - REAL_CONST(69.227979374755591/8.0), - REAL_CONST(73.100443455321638/8.0), - REAL_CONST(77.024897778591622/8.0), - REAL_CONST(80.999999999999986/8.0), - REAL_CONST(85.024491212518527/8.0), - REAL_CONST(89.097187944889555/8.0), - REAL_CONST(93.216975178615741/8.0), - REAL_CONST(97.382800224133163/8.0), - REAL_CONST(101.59366732596474/8.0), - REAL_CONST(105.84863288986224/8.0), - REAL_CONST(110.14680124343441/8.0), - REAL_CONST(114.4873208566006/8.0), - REAL_CONST(118.86938096020653/8.0), - REAL_CONST(123.29220851090024/8.0), - REAL_CONST(127.75506545836058/8.0), - REAL_CONST(132.25724627755247/8.0), - REAL_CONST(136.79807573413572/8.0), - REAL_CONST(141.37690685569191/8.0), - REAL_CONST(145.99311908523086/8.0), - REAL_CONST(150.6461165966291/8.0), - REAL_CONST(155.33532675434674/8.0), - REAL_CONST(160.06019870205279/8.0), - REAL_CONST(164.82020206673349/8.0), - REAL_CONST(169.61482576651861/8.0), - REAL_CONST(174.44357691188537/8.0), - REAL_CONST(179.30597979112557/8.0), - REAL_CONST(184.20157493201927/8.0), - REAL_CONST(189.12991823257562/8.0), - REAL_CONST(194.09058015449685/8.0), - REAL_CONST(199.08314497371677/8.0), - REAL_CONST(204.1072100829694/8.0), - REAL_CONST(209.16238534187647/8.0), - REAL_CONST(214.24829247050752/8.0), - REAL_CONST(219.36456448277784/8.0), - REAL_CONST(224.51084515641216/8.0), - REAL_CONST(229.6867885365223/8.0), - REAL_CONST(234.89205847013176/8.0), - REAL_CONST(240.12632816923249/8.0), - REAL_CONST(245.38927980018505/8.0), - REAL_CONST(250.68060409747261/8.0), - REAL_CONST(255.99999999999991/8.0), - REAL_CONST(261.34717430828869/8.0), - REAL_CONST(266.72184136106449/8.0), - REAL_CONST(272.12372272986045/8.0), - REAL_CONST(277.55254693037961/8.0), - REAL_CONST(283.0080491494619/8.0), - REAL_CONST(288.48997098659891/8.0), - REAL_CONST(293.99806020902247/8.0), - REAL_CONST(299.53207051947408/8.0), - REAL_CONST(305.0917613358298/8.0), - REAL_CONST(310.67689758182206/8.0), - REAL_CONST(316.28724948815585/8.0), - REAL_CONST(321.92259240337177/8.0), - REAL_CONST(327.58270661385535/8.0), - REAL_CONST(333.26737717243742/8.0), - REAL_CONST(338.97639373507025/8.0), - REAL_CONST(344.70955040510125/8.0), - REAL_CONST(350.46664558470013/8.0), - REAL_CONST(356.24748183302603/8.0), - REAL_CONST(362.05186573075139/8.0), - REAL_CONST(367.87960775058258/8.0), - REAL_CONST(373.73052213344511/8.0), - REAL_CONST(379.60442677002078/8.0), - REAL_CONST(385.50114308734607/8.0), - REAL_CONST(391.42049594019937/8.0), - REAL_CONST(397.36231350702371/8.0), - REAL_CONST(403.32642719014467/8.0), - REAL_CONST(409.31267152006262/8.0), - REAL_CONST(415.32088406360799/8.0), - REAL_CONST(421.35090533576471/8.0), - REAL_CONST(427.40257871497619/8.0), - REAL_CONST(433.4757503617617/8.0), - REAL_CONST(439.5702691404793/8.0), - REAL_CONST(445.68598654408271/8.0), - REAL_CONST(451.82275662172759/8.0), - REAL_CONST(457.98043590909128/8.0), - REAL_CONST(464.15888336127773/8.0), - REAL_CONST(470.35796028818726/8.0), - REAL_CONST(476.5775302922363/8.0), - REAL_CONST(482.81745920832043/8.0), - REAL_CONST(489.07761504591741/8.0), - REAL_CONST(495.35786793323581/8.0), - REAL_CONST(501.65809006331688/8.0), - REAL_CONST(507.97815564200368/8.0), - REAL_CONST(514.31794083769648/8.0), - REAL_CONST(520.67732373281672/8.0), - REAL_CONST(527.05618427690604/8.0), - REAL_CONST(533.45440424129174/8.0), - REAL_CONST(539.87186717525128/8.0), - REAL_CONST(546.30845836361505/8.0), - REAL_CONST(552.76406478574609/8.0), - REAL_CONST(559.23857507584194/8.0), - REAL_CONST(565.73187948450413/8.0), - REAL_CONST(572.24386984152341/8.0), - REAL_CONST(578.77443951983378/8.0), - REAL_CONST(585.32348340058843/8.0), - REAL_CONST(591.89089783931263/8.0), - REAL_CONST(598.47658063309257/8.0), - REAL_CONST(605.08043098876044/8.0), - REAL_CONST(611.70234949203643/8.0), - REAL_CONST(618.3422380775919/8.0), - REAL_CONST(624.99999999999977/8.0), - REAL_CONST(631.67553980553748/8.0), - REAL_CONST(638.36876330481164/8.0), - REAL_CONST(645.07957754617485/8.0), - REAL_CONST(651.80789078990415/8.0), - REAL_CONST(658.55361248311499/8.0), - REAL_CONST(665.31665323538357/8.0), - REAL_CONST(672.09692479505225/8.0), - REAL_CONST(678.8943400261943/8.0), - REAL_CONST(685.70881288621433/8.0), - REAL_CONST(692.540258404062/8.0), - REAL_CONST(699.38859265903977/8.0), - REAL_CONST(706.25373276018058/8.0), - REAL_CONST(713.13559682617972/8.0), - REAL_CONST(720.03410396586037/8.0), - REAL_CONST(726.94917425915435/8.0), - REAL_CONST(733.88072873858209/8.0), - REAL_CONST(740.82868937121543/8.0), - REAL_CONST(747.79297904110535/8.0), - REAL_CONST(754.77352153216191/8.0), - REAL_CONST(761.77024151147043/8.0), - REAL_CONST(768.78306451302956/8.0), - REAL_CONST(775.81191692189896/8.0), - REAL_CONST(782.85672595874246/8.0), - REAL_CONST(789.91741966475445/8.0), - REAL_CONST(796.99392688695798/8.0), - REAL_CONST(804.08617726386274/8.0), - REAL_CONST(811.19410121147098/8.0), - REAL_CONST(818.31762990962227/8.0), - REAL_CONST(825.45669528866563/8.0), - REAL_CONST(832.61123001644864/8.0), - REAL_CONST(839.78116748561604/8.0), - REAL_CONST(846.96644180120552/8.0), - REAL_CONST(854.16698776853514/8.0), - REAL_CONST(861.38274088137143/8.0), - REAL_CONST(868.61363731036977/8.0), - REAL_CONST(875.85961389178203/8.0), - REAL_CONST(883.12060811641959/8.0), - REAL_CONST(890.39655811886757/8.0), - REAL_CONST(897.68740266694181/8.0), - REAL_CONST(904.99308115138172/8.0), - REAL_CONST(912.31353357577188/8.0), - REAL_CONST(919.64870054668756/8.0), - REAL_CONST(926.99852326405619/8.0), - REAL_CONST(934.36294351172899/8.0), - REAL_CONST(941.74190364825859/8.0), - REAL_CONST(949.13534659787422/8.0), - REAL_CONST(956.54321584165211/8.0), - REAL_CONST(963.96545540887348/8.0), - REAL_CONST(971.40200986856541/8.0), - REAL_CONST(978.85282432122176/8.0), - REAL_CONST(986.31784439069588/8.0), - REAL_CONST(993.7970162162635/8.0), - REAL_CONST(1001.29028644485/8.0), - REAL_CONST(1008.797602223418/8.0), - REAL_CONST(1016.3189111915103/8.0), - REAL_CONST(1023.8541614739464/8.0), - REAL_CONST(1031.4033016736653/8.0), - REAL_CONST(1038.9662808647138/8.0), - REAL_CONST(1046.5430485853758/8.0), - REAL_CONST(1054.1335548314366/8.0), - REAL_CONST(1061.7377500495838/8.0), - REAL_CONST(1069.3555851309357/8.0), - REAL_CONST(1076.9870114046978/8.0), - REAL_CONST(1084.6319806319441/8.0), - REAL_CONST(1092.2904449995174/8.0), - REAL_CONST(1099.9623571140482/8.0), - REAL_CONST(1107.6476699960892/8.0), - REAL_CONST(1115.3463370743607/8.0), - REAL_CONST(1123.058312180106/8.0), - REAL_CONST(1130.7835495415541/8.0), - REAL_CONST(1138.5220037784854/8.0), - REAL_CONST(1146.273629896901/8.0), - REAL_CONST(1154.0383832837879/8.0), - REAL_CONST(1161.816219701986/8.0), - REAL_CONST(1169.607095285146/8.0), - REAL_CONST(1177.4109665327808/8.0), - REAL_CONST(1185.2277903054078/8.0), - REAL_CONST(1193.0575238197798/8.0), - REAL_CONST(1200.9001246442001/8.0), - REAL_CONST(1208.7555506939248/8.0), - REAL_CONST(1216.6237602266442/8.0), - REAL_CONST(1224.5047118380478/8.0), - REAL_CONST(1232.3983644574657/8.0), - REAL_CONST(1240.3046773435874/8.0), - REAL_CONST(1248.2236100802568/8.0), - REAL_CONST(1256.1551225723395/8.0), - REAL_CONST(1264.099175041662/8.0), - REAL_CONST(1272.0557280230228/8.0), - REAL_CONST(1280.0247423602691/8.0), - REAL_CONST(1288.0061792024444/8.0), - REAL_CONST(1295.9999999999995/8.0), - REAL_CONST(1304.006166501068/8.0), - REAL_CONST(1312.0246407478062/8.0), - REAL_CONST(1320.0553850727929/8.0), - REAL_CONST(1328.0983620954903/8.0), - REAL_CONST(1336.1535347187651/8.0), - REAL_CONST(1344.2208661254647/8.0), - REAL_CONST(1352.3003197750522/8.0), - REAL_CONST(1360.3918594002962/8.0), - REAL_CONST(1368.4954490040145/8.0), - REAL_CONST(1376.6110528558709/8.0), - REAL_CONST(1384.7386354892244/8.0), - REAL_CONST(1392.8781616980295/8.0), - REAL_CONST(1401.0295965337855/8.0), - REAL_CONST(1409.1929053025353/8.0), - REAL_CONST(1417.3680535619119/8.0), - REAL_CONST(1425.5550071182327/8.0), - REAL_CONST(1433.7537320236374/8.0), - REAL_CONST(1441.9641945732744/8.0), - REAL_CONST(1450.1863613025282/8.0), - REAL_CONST(1458.4201989842913/8.0), - REAL_CONST(1466.6656746262797/8.0), - REAL_CONST(1474.9227554683875/8.0), - REAL_CONST(1483.1914089800841/8.0), - REAL_CONST(1491.4716028578516/8.0), - REAL_CONST(1499.7633050226596/8.0), - REAL_CONST(1508.0664836174794/8.0), - REAL_CONST(1516.3811070048375/8.0), - REAL_CONST(1524.7071437644029/8.0), - REAL_CONST(1533.0445626906128/8.0), - REAL_CONST(1541.3933327903342/8.0), - REAL_CONST(1549.7534232805581/8.0), - REAL_CONST(1558.1248035861302/8.0), - REAL_CONST(1566.507443337515/8.0), - REAL_CONST(1574.9013123685909/8.0), - REAL_CONST(1583.3063807144795/8.0), - REAL_CONST(1591.7226186094069/8.0), - REAL_CONST(1600.1499964845941/8.0), - REAL_CONST(1608.58848496618/8.0), - REAL_CONST(1617.0380548731737/8.0), - REAL_CONST(1625.4986772154357/8.0), - REAL_CONST(1633.9703231916887/8.0), - REAL_CONST(1642.4529641875577/8.0), - REAL_CONST(1650.9465717736346/8.0), - REAL_CONST(1659.4511177035752/8.0), - REAL_CONST(1667.9665739122186/8.0), - REAL_CONST(1676.4929125137353/8.0), - REAL_CONST(1685.030105799801/8.0), - REAL_CONST(1693.5781262377957/8.0), - REAL_CONST(1702.136946469027/8.0), - REAL_CONST(1710.7065393069795/8.0), - REAL_CONST(1719.2868777355877/8.0), - REAL_CONST(1727.8779349075323/8.0), - REAL_CONST(1736.4796841425596/8.0), - REAL_CONST(1745.092098925825/8.0), - REAL_CONST(1753.7151529062583/8.0), - REAL_CONST(1762.3488198949503/8.0), - REAL_CONST(1770.9930738635628/8.0), - REAL_CONST(1779.6478889427597/8.0), - REAL_CONST(1788.3132394206564/8.0), - REAL_CONST(1796.9890997412947/8.0), - REAL_CONST(1805.6754445031333/8.0), - REAL_CONST(1814.3722484575621/8.0), - REAL_CONST(1823.0794865074322/8.0), - REAL_CONST(1831.7971337056094/8.0), - REAL_CONST(1840.5251652535437/8.0), - REAL_CONST(1849.2635564998579/8.0), - REAL_CONST(1858.0122829389563/8.0), - REAL_CONST(1866.7713202096493/8.0), - REAL_CONST(1875.5406440937966/8.0), - REAL_CONST(1884.3202305149687/8.0), - REAL_CONST(1893.110055537124/8.0), - REAL_CONST(1901.9100953633042/8.0), - REAL_CONST(1910.7203263343454/8.0), - REAL_CONST(1919.5407249276057/8.0), - REAL_CONST(1928.3712677557098/8.0), - REAL_CONST(1937.2119315653083/8.0), - REAL_CONST(1946.0626932358525/8.0), - REAL_CONST(1954.923529778386/8.0), - REAL_CONST(1963.79441833435/8.0), - REAL_CONST(1972.6753361744036/8.0), - REAL_CONST(1981.5662606972594/8.0), - REAL_CONST(1990.467169428533/8.0), - REAL_CONST(1999.3780400196069/8.0), - REAL_CONST(2008.2988502465078/8.0), - REAL_CONST(2017.2295780087982/8.0), - REAL_CONST(2026.1702013284819/8.0), - REAL_CONST(2035.1206983489212/8.0), - REAL_CONST(2044.0810473337688/8.0), - REAL_CONST(2053.0512266659125/8.0), - REAL_CONST(2062.0312148464309/8.0), - REAL_CONST(2071.0209904935646/8.0), - REAL_CONST(2080.0205323416958/8.0), - REAL_CONST(2089.0298192403443/8.0), - REAL_CONST(2098.0488301531714/8.0), - REAL_CONST(2107.0775441569995/8.0), - REAL_CONST(2116.115940440839/8.0), - REAL_CONST(2125.1639983049317/8.0), - REAL_CONST(2134.2216971597995/8.0), - REAL_CONST(2143.2890165253098/8.0), - REAL_CONST(2152.3659360297484/8.0), - REAL_CONST(2161.4524354089031/8.0), - REAL_CONST(2170.5484945051617/8.0), - REAL_CONST(2179.6540932666144/8.0), - REAL_CONST(2188.7692117461711/8.0), - REAL_CONST(2197.8938301006888/8.0), - REAL_CONST(2207.0279285901042/8.0), - REAL_CONST(2216.1714875765838/8.0), - REAL_CONST(2225.324487523676/8.0), - REAL_CONST(2234.4869089954782/8.0), - REAL_CONST(2243.6587326558101/8.0), - REAL_CONST(2252.8399392673982/8.0), - REAL_CONST(2262.0305096910702/8.0), - REAL_CONST(2271.2304248849537/8.0), - REAL_CONST(2280.4396659036897/8.0), - REAL_CONST(2289.6582138976523/8.0), - REAL_CONST(2298.8860501121762/8.0), - REAL_CONST(2308.1231558867926/8.0), - REAL_CONST(2317.3695126544767/8.0), - REAL_CONST(2326.6251019409005/8.0), - REAL_CONST(2335.8899053636933/8.0), - REAL_CONST(2345.1639046317132/8.0), - REAL_CONST(2354.4470815443233/8.0), - REAL_CONST(2363.7394179906792/8.0), - REAL_CONST(2373.0408959490205/8.0), - REAL_CONST(2382.3514974859731/8.0), - REAL_CONST(2391.6712047558558/8.0), - REAL_CONST(2400.9999999999991/8.0), - REAL_CONST(2410.3378655460651/8.0), - REAL_CONST(2419.6847838073813/8.0), - REAL_CONST(2429.0407372822747/8.0), - REAL_CONST(2438.4057085534191/8.0), - REAL_CONST(2447.7796802871858/8.0), - REAL_CONST(2457.1626352330004/8.0), - REAL_CONST(2466.5545562227112/8.0), - REAL_CONST(2475.9554261699564/8.0), - REAL_CONST(2485.3652280695474/8.0), - REAL_CONST(2494.7839449968492/8.0), - REAL_CONST(2504.2115601071737/8.0), - REAL_CONST(2513.6480566351788/8.0), - REAL_CONST(2523.0934178942675/8.0), - REAL_CONST(2532.5476272760025/8.0), - REAL_CONST(2542.0106682495189/8.0), - REAL_CONST(2551.482524360948/8.0), - REAL_CONST(2560.9631792328441/8.0), - REAL_CONST(2570.4526165636184/8.0), - REAL_CONST(2579.9508201269791/8.0), - REAL_CONST(2589.4577737713744/8.0), - REAL_CONST(2598.9734614194458/8.0), - REAL_CONST(2608.4978670674823/8.0), - REAL_CONST(2618.0309747848837/8.0), - REAL_CONST(2627.5727687136259/8.0), - REAL_CONST(2637.1232330677353/8.0), - REAL_CONST(2646.6823521327647/8.0), - REAL_CONST(2656.2501102652768/8.0), - REAL_CONST(2665.8264918923328/8.0), - REAL_CONST(2675.4114815109842/8.0), - REAL_CONST(2685.0050636877722/8.0), - REAL_CONST(2694.6072230582295/8.0), - REAL_CONST(2704.2179443263894/8.0), - REAL_CONST(2713.8372122642972/8.0), - REAL_CONST(2723.4650117115279/8.0), - REAL_CONST(2733.1013275747096/8.0), - REAL_CONST(2742.7461448270483/8.0), - REAL_CONST(2752.3994485078601/8.0), - REAL_CONST(2762.0612237221085/8.0), - REAL_CONST(2771.7314556399419/8.0), - REAL_CONST(2781.4101294962406/8.0), - REAL_CONST(2791.0972305901655/8.0), - REAL_CONST(2800.7927442847094/8.0), - REAL_CONST(2810.4966560062589/8.0), - REAL_CONST(2820.2089512441521/8.0), - REAL_CONST(2829.9296155502466/8.0), - REAL_CONST(2839.6586345384894/8.0), - REAL_CONST(2849.3959938844923/8.0), - REAL_CONST(2859.1416793251065/8.0), - REAL_CONST(2868.8956766580086/8.0), - REAL_CONST(2878.6579717412847/8.0), - REAL_CONST(2888.4285504930212/8.0), - REAL_CONST(2898.2073988908974/8.0), - REAL_CONST(2907.9945029717837/8.0), - REAL_CONST(2917.789848831344/8.0), - REAL_CONST(2927.5934226236377/8.0), - REAL_CONST(2937.4052105607311/8.0), - REAL_CONST(2947.2251989123079/8.0), - REAL_CONST(2957.0533740052865/8.0), - REAL_CONST(2966.8897222234368/8.0), - REAL_CONST(2976.734230007005/8.0), - REAL_CONST(2986.5868838523397/8.0), - REAL_CONST(2996.4476703115197/8.0), - REAL_CONST(3006.3165759919889/8.0), - REAL_CONST(3016.1935875561908/8.0), - REAL_CONST(3026.0786917212095/8.0), - REAL_CONST(3035.9718752584108/8.0), - REAL_CONST(3045.8731249930906/8.0), - REAL_CONST(3055.7824278041207/8.0), - REAL_CONST(3065.6997706236039/8.0), - REAL_CONST(3075.625140436528/8.0), - REAL_CONST(3085.5585242804245/8.0), - REAL_CONST(3095.4999092450298/8.0), - REAL_CONST(3105.4492824719491/8.0), - REAL_CONST(3115.4066311543256/8.0), - REAL_CONST(3125.3719425365089/8.0), - REAL_CONST(3135.3452039137287/8.0), - REAL_CONST(3145.3264026317715/8.0), - REAL_CONST(3155.3155260866592/8.0), - REAL_CONST(3165.3125617243295/8.0), - REAL_CONST(3175.3174970403229/8.0), - REAL_CONST(3185.3303195794679/8.0), - REAL_CONST(3195.35101693557/8.0), - REAL_CONST(3205.3795767511078/8.0), - REAL_CONST(3215.4159867169251/8.0), - REAL_CONST(3225.460234571929/8.0), - REAL_CONST(3235.5123081027928/8.0), - REAL_CONST(3245.5721951436558/8.0), - REAL_CONST(3255.63988357583/8.0), - REAL_CONST(3265.7153613275095/8.0), - REAL_CONST(3275.7986163734795/8.0), - REAL_CONST(3285.8896367348289/8.0), - REAL_CONST(3295.9884104786665/8.0), - REAL_CONST(3306.0949257178395/8.0), - REAL_CONST(3316.2091706106517/8.0), - REAL_CONST(3326.331133360588/8.0), - REAL_CONST(3336.4608022160378/8.0), - REAL_CONST(3346.5981654700231/8.0), - REAL_CONST(3356.7432114599264/8.0), - REAL_CONST(3366.8959285672249/8.0), - REAL_CONST(3377.0563052172211/8.0), - REAL_CONST(3387.2243298787821/8.0), - REAL_CONST(3397.3999910640764/8.0), - REAL_CONST(3407.5832773283128/8.0), - REAL_CONST(3417.7741772694862/8.0), - REAL_CONST(3427.9726795281199/8.0), - REAL_CONST(3438.1787727870123/8.0), - REAL_CONST(3448.3924457709873/8.0), - REAL_CONST(3458.6136872466445/8.0), - REAL_CONST(3468.8424860221107/8.0), - REAL_CONST(3479.0788309467976/8.0), - REAL_CONST(3489.3227109111554/8.0), - REAL_CONST(3499.5741148464344/8.0), - REAL_CONST(3509.8330317244445/8.0), - REAL_CONST(3520.0994505573185/8.0), - REAL_CONST(3530.3733603972751/8.0), - REAL_CONST(3540.6547503363886/8.0), - REAL_CONST(3550.9436095063534/8.0), - REAL_CONST(3561.239927078258/8.0), - REAL_CONST(3571.5436922623535/8.0), - REAL_CONST(3581.8548943078308/8.0), - REAL_CONST(3592.1735225025936/8.0), - REAL_CONST(3602.4995661730372/8.0), - REAL_CONST(3612.8330146838275/8.0), - REAL_CONST(3623.1738574376814/8.0), - REAL_CONST(3633.5220838751502/8.0), - REAL_CONST(3643.8776834744031/8.0), - REAL_CONST(3654.2406457510142/8.0), - REAL_CONST(3664.6109602577494/8.0), - REAL_CONST(3674.9886165843564/8.0), - REAL_CONST(3685.3736043573545/8.0), - REAL_CONST(3695.7659132398294/8.0), - REAL_CONST(3706.1655329312248/8.0), - REAL_CONST(3716.5724531671399/8.0), - REAL_CONST(3726.9866637191262/8.0), - REAL_CONST(3737.4081543944876/8.0), - REAL_CONST(3747.8369150360782/8.0), - REAL_CONST(3758.2729355221072/8.0), - REAL_CONST(3768.7162057659411/8.0), - REAL_CONST(3779.1667157159077/8.0), - REAL_CONST(3789.6244553551055/8.0), - REAL_CONST(3800.0894147012082/8.0), - REAL_CONST(3810.5615838062768/8.0), - REAL_CONST(3821.0409527565694/8.0), - REAL_CONST(3831.5275116723533/8.0), - REAL_CONST(3842.0212507077194/8.0), - REAL_CONST(3852.522160050396/8.0), - REAL_CONST(3863.0302299215673/8.0), - REAL_CONST(3873.5454505756893/8.0), - REAL_CONST(3884.0678123003108/8.0), - REAL_CONST(3894.5973054158922/8.0), - REAL_CONST(3905.1339202756285/8.0), - REAL_CONST(3915.6776472652732/8.0), - REAL_CONST(3926.2284768029604/8.0), - REAL_CONST(3936.7863993390338/8.0), - REAL_CONST(3947.3514053558706/8.0), - REAL_CONST(3957.9234853677135/8.0), - REAL_CONST(3968.5026299204969/8.0), - REAL_CONST(3979.0888295916798/8.0), - REAL_CONST(3989.6820749900776/8.0), - REAL_CONST(4000.2823567556948/8.0), - REAL_CONST(4010.8896655595613/8.0), - REAL_CONST(4021.5039921035655/8.0), - REAL_CONST(4032.1253271202945/8.0), - REAL_CONST(4042.7536613728694/8.0), - REAL_CONST(4053.3889856547858/8.0), - REAL_CONST(4064.0312907897551/8.0), - REAL_CONST(4074.6805676315448/8.0), - REAL_CONST(4085.3368070638221/8.0), - REAL_CONST(4095.9999999999982/8.0), - REAL_CONST(4106.6701373830711/8.0), - REAL_CONST(4117.347210185475/8.0), - REAL_CONST(4128.0312094089259/8.0), - REAL_CONST(4138.722126084268/8.0), - REAL_CONST(4149.4199512713267/8.0), - REAL_CONST(4160.1246760587583/8.0), - REAL_CONST(4170.8362915638982/8.0), - REAL_CONST(4181.5547889326181/8.0), - REAL_CONST(4192.2801593391769/8.0), - REAL_CONST(4203.0123939860741/8.0), - REAL_CONST(4213.7514841039101/8.0), - REAL_CONST(4224.4974209512384/8.0), - REAL_CONST(4235.2501958144258/8.0), - REAL_CONST(4246.0098000075095/8.0), - REAL_CONST(4256.7762248720574/8.0), - REAL_CONST(4267.549461777031/8.0), - REAL_CONST(4278.3295021186423/8.0), - REAL_CONST(4289.1163373202198/8.0), - REAL_CONST(4299.9099588320714/8.0), - REAL_CONST(4310.7103581313495/8.0), - REAL_CONST(4321.5175267219138/8.0), - REAL_CONST(4332.3314561342004/8.0), - REAL_CONST(4343.152137925088/8.0), - REAL_CONST(4353.9795636777671/8.0), - REAL_CONST(4364.8137250016052/8.0), - REAL_CONST(4375.6546135320223/8.0), - REAL_CONST(4386.5022209303588/8.0), - REAL_CONST(4397.3565388837469/8.0), - REAL_CONST(4408.2175591049827/8.0), - REAL_CONST(4419.0852733324018/8.0), - REAL_CONST(4429.9596733297531/8.0), - REAL_CONST(4440.8407508860728/8.0), - REAL_CONST(4451.7284978155603/8.0), - REAL_CONST(4462.6229059574571/8.0), - REAL_CONST(4473.5239671759227/8.0), - REAL_CONST(4484.4316733599126/8.0), - REAL_CONST(4495.3460164230582/8.0), - REAL_CONST(4506.2669883035496/8.0), - REAL_CONST(4517.1945809640119/8.0), - REAL_CONST(4528.1287863913894/8.0), - REAL_CONST(4539.069596596828/8.0), - REAL_CONST(4550.0170036155587/8.0), - REAL_CONST(4560.9709995067806/8.0), - REAL_CONST(4571.931576353546/8.0), - REAL_CONST(4582.898726262647/8.0), - REAL_CONST(4593.8724413645004/8.0), - REAL_CONST(4604.8527138130348/8.0), - REAL_CONST(4615.8395357855816/8.0), - REAL_CONST(4626.8328994827571/8.0), - REAL_CONST(4637.8327971283588/8.0), - REAL_CONST(4648.8392209692511/8.0), - REAL_CONST(4659.8521632752563/8.0), - REAL_CONST(4670.8716163390473/8.0), - REAL_CONST(4681.8975724760394/8.0), - REAL_CONST(4692.9300240242837/8.0), - REAL_CONST(4703.9689633443595/8.0), - REAL_CONST(4715.0143828192668/8.0), - REAL_CONST(4726.0662748543255/8.0), - REAL_CONST(4737.1246318770682/8.0), - REAL_CONST(4748.1894463371373/8.0), - REAL_CONST(4759.2607107061804/8.0), - REAL_CONST(4770.3384174777493/8.0), - REAL_CONST(4781.4225591671993/8.0), - REAL_CONST(4792.5131283115852/8.0), - REAL_CONST(4803.6101174695614/8.0), - REAL_CONST(4814.7135192212854/8.0), - REAL_CONST(4825.8233261683154/8.0), - REAL_CONST(4836.9395309335096/8.0), - REAL_CONST(4848.0621261609349/8.0), - REAL_CONST(4859.1911045157631/8.0), - REAL_CONST(4870.3264586841779/8.0), - REAL_CONST(4881.4681813732768/8.0), - REAL_CONST(4892.6162653109768/8.0), - REAL_CONST(4903.7707032459193/8.0), - REAL_CONST(4914.931487947375/8.0), - REAL_CONST(4926.0986122051509/8.0), - REAL_CONST(4937.2720688294967/8.0), - REAL_CONST(4948.4518506510112/8.0), - REAL_CONST(4959.637950520555/8.0), - REAL_CONST(4970.8303613091521/8.0), - REAL_CONST(4982.0290759079044/8.0), - REAL_CONST(4993.2340872278974/8.0), - REAL_CONST(5004.4453882001153/8.0), - REAL_CONST(5015.6629717753467/8.0), - REAL_CONST(5026.8868309241007/8.0), - REAL_CONST(5038.1169586365131/8.0), - REAL_CONST(5049.353347922266/8.0), - REAL_CONST(5060.5959918104927/8.0), - REAL_CONST(5071.8448833496996/8.0), - REAL_CONST(5083.1000156076734/8.0), - REAL_CONST(5094.3613816713996/8.0), - REAL_CONST(5105.6289746469747/8.0), - REAL_CONST(5116.9027876595246/8.0), - REAL_CONST(5128.18281385312/8.0), - REAL_CONST(5139.4690463906918/8.0), - REAL_CONST(5150.7614784539473/8.0), - REAL_CONST(5162.0601032432933/8.0), - REAL_CONST(5173.3649139777472/8.0), - REAL_CONST(5184.6759038948594/8.0), - REAL_CONST(5195.9930662506322/8.0), - REAL_CONST(5207.3163943194386/8.0), - REAL_CONST(5218.6458813939435/8.0), - REAL_CONST(5229.9815207850224/8.0), - REAL_CONST(5241.3233058216847/8.0), - REAL_CONST(5252.6712298509919/8.0), - REAL_CONST(5264.025286237983/8.0), - REAL_CONST(5275.3854683655954/8.0), - REAL_CONST(5286.7517696345885/8.0), - REAL_CONST(5298.1241834634639/8.0), - REAL_CONST(5309.5027032883945/8.0), - REAL_CONST(5320.887322563146/8.0), - REAL_CONST(5332.2780347589978/8.0), - REAL_CONST(5343.6748333646756/8.0), - REAL_CONST(5355.0777118862716/8.0), - REAL_CONST(5366.4866638471722/8.0), - REAL_CONST(5377.901682787985/8.0), - REAL_CONST(5389.3227622664635/8.0), - REAL_CONST(5400.749895857437/8.0), - REAL_CONST(5412.1830771527357/8.0), - REAL_CONST(5423.622299761123/8.0), - REAL_CONST(5435.067557308219/8.0), - REAL_CONST(5446.5188434364318/8.0), - REAL_CONST(5457.9761518048872/8.0), - REAL_CONST(5469.4394760893592/8.0), - REAL_CONST(5480.9088099821975/8.0), - REAL_CONST(5492.3841471922606/8.0), - REAL_CONST(5503.8654814448455/8.0), - REAL_CONST(5515.3528064816201/8.0), - REAL_CONST(5526.846116060552/8.0), - REAL_CONST(5538.3454039558474/8.0), - REAL_CONST(5549.8506639578736/8.0), - REAL_CONST(5561.3618898731029/8.0), - REAL_CONST(5572.8790755240361/8.0), - REAL_CONST(5584.4022147491451/8.0), - REAL_CONST(5595.9313014027975/8.0), - REAL_CONST(5607.4663293552012/8.0), - REAL_CONST(5619.0072924923297/8.0), - REAL_CONST(5630.5541847158656/8.0), - REAL_CONST(5642.1069999431284/8.0), - REAL_CONST(5653.665732107017/8.0), - REAL_CONST(5665.230375155943/8.0), - REAL_CONST(5676.8009230537655/8.0), - REAL_CONST(5688.3773697797333/8.0), - REAL_CONST(5699.9597093284156/8.0), - REAL_CONST(5711.5479357096474/8.0), - REAL_CONST(5723.1420429484588/8.0), - REAL_CONST(5734.7420250850209/8.0), - REAL_CONST(5746.347876174581/8.0), - REAL_CONST(5757.9595902874016/8.0), - REAL_CONST(5769.5771615087006/8.0), - REAL_CONST(5781.2005839385911/8.0), - REAL_CONST(5792.8298516920213/8.0), - REAL_CONST(5804.4649588987149/8.0), - REAL_CONST(5816.1058997031105/8.0), - REAL_CONST(5827.7526682643065/8.0), - REAL_CONST(5839.4052587559972/8.0), - REAL_CONST(5851.0636653664196/8.0), - REAL_CONST(5862.7278822982908/8.0), - REAL_CONST(5874.3979037687541/8.0), - REAL_CONST(5886.0737240093204/8.0), - REAL_CONST(5897.7553372658094/8.0), - REAL_CONST(5909.4427377982956/8.0), - REAL_CONST(5921.1359198810505/8.0), - REAL_CONST(5932.8348778024874/8.0), - REAL_CONST(5944.5396058651031/8.0), - REAL_CONST(5956.2500983854261/8.0), - REAL_CONST(5967.9663496939575/8.0), - REAL_CONST(5979.6883541351208/8.0), - REAL_CONST(5991.4161060672022/8.0), - REAL_CONST(6003.1495998623004/8.0), - REAL_CONST(6014.8888299062692/8.0), - REAL_CONST(6026.6337905986684/8.0), - REAL_CONST(6038.3844763527022/8.0), - REAL_CONST(6050.1408815951781/8.0), - REAL_CONST(6061.9030007664414/8.0), - REAL_CONST(6073.6708283203316/8.0), - REAL_CONST(6085.4443587241267/8.0), - REAL_CONST(6097.2235864584891/8.0), - REAL_CONST(6109.0085060174197/8.0), - REAL_CONST(6120.7991119081998/8.0), - REAL_CONST(6132.595398651345/8.0), - REAL_CONST(6144.3973607805519/8.0), - REAL_CONST(6156.2049928426459/8.0), - REAL_CONST(6168.0182893975361/8.0), - REAL_CONST(6179.8372450181578/8.0), - REAL_CONST(6191.6618542904307/8.0), - REAL_CONST(6203.4921118132024/8.0), - REAL_CONST(6215.3280121982016/8.0), - REAL_CONST(6227.1695500699925/8.0), - REAL_CONST(6239.0167200659189/8.0), - REAL_CONST(6250.8695168360628/8.0), - REAL_CONST(6262.7279350431891/8.0), - REAL_CONST(6274.5919693627056/8.0), - REAL_CONST(6286.4616144826068/8.0), - REAL_CONST(6298.3368651034316/8.0), - REAL_CONST(6310.2177159382172/8.0), - REAL_CONST(6322.1041617124456/8.0), - REAL_CONST(6333.9961971640032/8.0), - REAL_CONST(6345.8938170431311/8.0), - REAL_CONST(6357.7970161123785/8.0), - REAL_CONST(6369.7057891465583/8.0), - REAL_CONST(6381.6201309327007/8.0), - REAL_CONST(6393.5400362700075/8.0), - REAL_CONST(6405.4654999698032/8.0), - REAL_CONST(6417.3965168554978/8.0), - REAL_CONST(6429.3330817625329/8.0), - REAL_CONST(6441.2751895383453/8.0), - REAL_CONST(6453.2228350423138/8.0), - REAL_CONST(6465.176013145724/8.0), - REAL_CONST(6477.134718731716/8.0), - REAL_CONST(6489.0989466952469/8.0), - REAL_CONST(6501.0686919430445/8.0), - REAL_CONST(6513.0439493935628/8.0), - REAL_CONST(6525.0247139769417/8.0), - REAL_CONST(6537.010980634961/8.0), - REAL_CONST(6549.002744321001/8.0), - REAL_CONST(6560.9999999999973/8.0), - REAL_CONST(6573.0027426483985/8.0), - REAL_CONST(6585.0109672541284/8.0), - REAL_CONST(6597.0246688165371/8.0), - REAL_CONST(6609.0438423463656/8.0), - REAL_CONST(6621.0684828657004/8.0), - REAL_CONST(6633.0985854079354/8.0), - REAL_CONST(6645.134145017727/8.0), - REAL_CONST(6657.1751567509573/8.0), - REAL_CONST(6669.2216156746908/8.0), - REAL_CONST(6681.2735168671343/8.0), - REAL_CONST(6693.3308554176001/8.0), - REAL_CONST(6705.3936264264594/8.0), - REAL_CONST(6717.461825005108/8.0), - REAL_CONST(6729.535446275926/8.0), - REAL_CONST(6741.6144853722335/8.0), - REAL_CONST(6753.6989374382601/8.0), - REAL_CONST(6765.7887976290967/8.0), - REAL_CONST(6777.8840611106634/8.0), - REAL_CONST(6789.9847230596661/8.0), - REAL_CONST(6802.0907786635626/8.0), - REAL_CONST(6814.2022231205201/8.0), - REAL_CONST(6826.3190516393797/8.0), - REAL_CONST(6838.4412594396181/8.0), - REAL_CONST(6850.5688417513074/8.0), - REAL_CONST(6862.701793815083/8.0), - REAL_CONST(6874.840110882099/8.0), - REAL_CONST(6886.9837882139991/8.0), - REAL_CONST(6899.1328210828724/8.0), - REAL_CONST(6911.2872047712199/8.0), - REAL_CONST(6923.4469345719199/8.0), - REAL_CONST(6935.6120057881863/8.0), - REAL_CONST(6947.7824137335365/8.0), - REAL_CONST(6959.9581537317536/8.0), - REAL_CONST(6972.1392211168532/8.0), - REAL_CONST(6984.3256112330409/8.0), - REAL_CONST(6996.5173194346862/8.0), - REAL_CONST(7008.7143410862773/8.0), - REAL_CONST(7020.9166715623942/8.0), - REAL_CONST(7033.1243062476678/8.0), - REAL_CONST(7045.3372405367481/8.0), - REAL_CONST(7057.5554698342685/8.0), - REAL_CONST(7069.7789895548103/8.0), - REAL_CONST(7082.0077951228714/8.0), - REAL_CONST(7094.2418819728273/8.0), - REAL_CONST(7106.4812455489018/8.0), - REAL_CONST(7118.7258813051285/8.0), - REAL_CONST(7130.9757847053224/8.0), - REAL_CONST(7143.2309512230404/8.0), - REAL_CONST(7155.4913763415516/8.0), - REAL_CONST(7167.7570555538041/8.0), - REAL_CONST(7180.0279843623894/8.0), - REAL_CONST(7192.3041582795131/8.0), - REAL_CONST(7204.5855728269571/8.0), - REAL_CONST(7216.8722235360519/8.0), - REAL_CONST(7229.1641059476406/8.0), - REAL_CONST(7241.4612156120484/8.0), - REAL_CONST(7253.7635480890503/8.0), - REAL_CONST(7266.0710989478375/8.0), - REAL_CONST(7278.3838637669869/8.0), - REAL_CONST(7290.7018381344296/8.0), - REAL_CONST(7303.0250176474174/8.0), - REAL_CONST(7315.3533979124932/8.0), - REAL_CONST(7327.6869745454596/8.0), - REAL_CONST(7340.0257431713462/8.0), - REAL_CONST(7352.3696994243801/8.0), - REAL_CONST(7364.7188389479543/8.0), - REAL_CONST(7377.0731573945968/8.0), - REAL_CONST(7389.4326504259407/8.0), - REAL_CONST(7401.7973137126937/8.0), - REAL_CONST(7414.1671429346061/8.0), - REAL_CONST(7426.5421337804428/8.0), - REAL_CONST(7438.922281947951/8.0), - REAL_CONST(7451.3075831438346/8.0), - REAL_CONST(7463.6980330837177/8.0), - REAL_CONST(7476.0936274921214/8.0), - REAL_CONST(7488.4943621024304/8.0), - REAL_CONST(7500.9002326568652/8.0), - REAL_CONST(7513.3112349064522/8.0), - REAL_CONST(7525.7273646109943/8.0), - REAL_CONST(7538.1486175390446/8.0), - REAL_CONST(7550.5749894678729/8.0), - REAL_CONST(7563.0064761834419/8.0), - REAL_CONST(7575.4430734803736/8.0), - REAL_CONST(7587.8847771619248/8.0), - REAL_CONST(7600.3315830399597/8.0), - REAL_CONST(7612.7834869349153/8.0), - REAL_CONST(7625.24048467578/8.0), - REAL_CONST(7637.7025721000637/8.0), - REAL_CONST(7650.1697450537677/8.0), - REAL_CONST(7662.6419993913596/8.0), - REAL_CONST(7675.1193309757446/8.0), - REAL_CONST(7687.6017356782404/8.0), - REAL_CONST(7700.0892093785433/8.0), - REAL_CONST(7712.5817479647112/8.0), - REAL_CONST(7725.079347333125/8.0), - REAL_CONST(7737.5820033884729/8.0), - REAL_CONST(7750.0897120437139/8.0), - REAL_CONST(7762.6024692200581/8.0), - REAL_CONST(7775.1202708469355/8.0), - REAL_CONST(7787.6431128619733/8.0), - REAL_CONST(7800.1709912109645/8.0), - REAL_CONST(7812.7039018478481/8.0), - REAL_CONST(7825.2418407346768/8.0), - REAL_CONST(7837.7848038415968/8.0), - REAL_CONST(7850.3327871468155/8.0), - REAL_CONST(7862.8857866365806/8.0), - REAL_CONST(7875.4437983051539/8.0), - REAL_CONST(7888.006818154784/8.0), - REAL_CONST(7900.5748421956796/8.0), - REAL_CONST(7913.1478664459901/8.0), - REAL_CONST(7925.725886931772/8.0), - REAL_CONST(7938.3088996869719/8.0), - REAL_CONST(7950.8969007533951/8.0), - REAL_CONST(7963.4898861806851/8.0), - REAL_CONST(7976.0878520262959/8.0), - REAL_CONST(7988.6907943554688/8.0), - REAL_CONST(8001.2987092412086/8.0), - REAL_CONST(8013.911592764257/8.0), - REAL_CONST(8026.5294410130691/8.0), - REAL_CONST(8039.1522500837891/8.0), - REAL_CONST(8051.7800160802271/8.0), - REAL_CONST(8064.412735113835/8.0), - REAL_CONST(8077.0504033036796/8.0), - REAL_CONST(8089.6930167764222/8.0), - REAL_CONST(8102.3405716662946/8.0), - REAL_CONST(8114.9930641150731/8.0), - REAL_CONST(8127.6504902720571/8.0), - REAL_CONST(8140.3128462940449/8.0), - REAL_CONST(8152.9801283453098/8.0), - REAL_CONST(8165.6523325975786/8.0), - REAL_CONST(8178.3294552300049/8.0), - REAL_CONST(8191.0114924291529/8.0), - REAL_CONST(8203.6984403889655/8.0), - REAL_CONST(8216.3902953107463/8.0), - REAL_CONST(8229.0870534031419/8.0), - REAL_CONST(8241.7887108821069/8.0), - REAL_CONST(8254.4952639708936/8.0), - REAL_CONST(8267.2067089000211/8.0), - REAL_CONST(8279.9230419072574/8.0), - REAL_CONST(8292.6442592375952/8.0), - REAL_CONST(8305.3703571432306/8.0), - REAL_CONST(8318.101331883543/8.0), - REAL_CONST(8330.8371797250657/8.0), - REAL_CONST(8343.577896941475/8.0), - REAL_CONST(8356.3234798135582/8.0), - REAL_CONST(8369.0739246291978/8.0), - REAL_CONST(8381.8292276833508/8.0), - REAL_CONST(8394.5893852780209/8.0), - REAL_CONST(8407.3543937222421/8.0), - REAL_CONST(8420.1242493320569/8.0), - REAL_CONST(8432.8989484304948/8.0), - REAL_CONST(8445.6784873475499/8.0), - REAL_CONST(8458.4628624201578/8.0), - REAL_CONST(8471.2520699921806/8.0), - REAL_CONST(8484.0461064143838/8.0), - REAL_CONST(8496.8449680444082/8.0), - REAL_CONST(8509.6486512467636/8.0), - REAL_CONST(8522.4571523927953/8.0), - REAL_CONST(8535.270467860666/8.0), - REAL_CONST(8548.0885940353437/8.0), - REAL_CONST(8560.9115273085663/8.0), - REAL_CONST(8573.7392640788403/8.0), - REAL_CONST(8586.5718007514006/8.0), - REAL_CONST(8599.4091337382069/8.0), - REAL_CONST(8612.2512594579148/8.0), - REAL_CONST(8625.0981743358552/8.0), - REAL_CONST(8637.9498748040205/8.0), - REAL_CONST(8650.8063573010386/8.0), - REAL_CONST(8663.6676182721567/8.0), - REAL_CONST(8676.533654169225/8.0), - REAL_CONST(8689.4044614506638/8.0), - REAL_CONST(8702.2800365814601/8.0), - REAL_CONST(8715.1603760331418/8.0), - REAL_CONST(8728.0454762837508/8.0), - REAL_CONST(8740.9353338178389/8.0), - REAL_CONST(8753.8299451264356/8.0), - REAL_CONST(8766.7293067070332/8.0), - REAL_CONST(8779.6334150635721/8.0), - REAL_CONST(8792.5422667064158/8.0), - REAL_CONST(8805.4558581523324/8.0), - REAL_CONST(8818.3741859244819/8.0), - REAL_CONST(8831.2972465523908/8.0), - REAL_CONST(8844.2250365719356/8.0), - REAL_CONST(8857.1575525253265/8.0), - REAL_CONST(8870.0947909610859/8.0), - REAL_CONST(8883.0367484340295/8.0), - REAL_CONST(8895.9834215052524/8.0), - REAL_CONST(8908.934806742107/8.0), - REAL_CONST(8921.8909007181846/8.0), - REAL_CONST(8934.8517000132997/8.0), - REAL_CONST(8947.817201213471/8.0), - REAL_CONST(8960.7874009109/8.0), - REAL_CONST(8973.7622957039603/8.0), - REAL_CONST(8986.7418821971733/8.0), - REAL_CONST(8999.7261570011924/8.0), - REAL_CONST(9012.7151167327884/8.0), - REAL_CONST(9025.7087580148236/8.0), - REAL_CONST(9038.7070774762469/8.0), - REAL_CONST(9051.7100717520643/8.0), - REAL_CONST(9064.7177374833282/8.0), - REAL_CONST(9077.7300713171153/8.0), - REAL_CONST(9090.7470699065179/8.0), - REAL_CONST(9103.7687299106146/8.0), - REAL_CONST(9116.7950479944648/8.0), - REAL_CONST(9129.8260208290812/8.0), - REAL_CONST(9142.8616450914233/8.0), - REAL_CONST(9155.9019174643727/8.0), - REAL_CONST(9168.9468346367157/8.0), - REAL_CONST(9181.9963933031358/8.0), - REAL_CONST(9195.0505901641845/8.0), - REAL_CONST(9208.1094219262741/8.0), - REAL_CONST(9221.1728853016557/8.0), - REAL_CONST(9234.240977008405/8.0), - REAL_CONST(9247.3136937704076/8.0), - REAL_CONST(9260.3910323173386/8.0), - REAL_CONST(9273.472989384647/8.0), - REAL_CONST(9286.5595617135423/8.0), - REAL_CONST(9299.6507460509747/8.0), - REAL_CONST(9312.7465391496207/8.0), - REAL_CONST(9325.8469377678684/8.0), - REAL_CONST(9338.9519386698012/8.0), - REAL_CONST(9352.0615386251757/8.0), - REAL_CONST(9365.1757344094131/8.0), - REAL_CONST(9378.2945228035842/8.0), - REAL_CONST(9391.4179005943843/8.0), - REAL_CONST(9404.5458645741273/8.0), - REAL_CONST(9417.6784115407263/8.0), - REAL_CONST(9430.8155382976747/8.0), - REAL_CONST(9443.9572416540359/8.0), - REAL_CONST(9457.1035184244265/8.0), - REAL_CONST(9470.2543654290002/8.0), - REAL_CONST(9483.4097794934296/8.0), - REAL_CONST(9496.5697574488931/8.0), - REAL_CONST(9509.7342961320664/8.0), - REAL_CONST(9522.9033923850911/8.0), - REAL_CONST(9536.0770430555804/8.0), - REAL_CONST(9549.2552449965824/8.0), - REAL_CONST(9562.4379950665825/8.0), - REAL_CONST(9575.6252901294793/8.0), - REAL_CONST(9588.8171270545736/8.0), - REAL_CONST(9602.0135027165488/8.0), - REAL_CONST(9615.2144139954635/8.0), - REAL_CONST(9628.4198577767274/8.0), - REAL_CONST(9641.629830951093/8.0), - REAL_CONST(9654.844330414644/8.0), - REAL_CONST(9668.0633530687719/8.0), - REAL_CONST(9681.286895820167/8.0), - REAL_CONST(9694.5149555808002/8.0), - REAL_CONST(9707.7475292679192/8.0), - REAL_CONST(9720.9846138040157/8.0), - REAL_CONST(9734.2262061168276/8.0), - REAL_CONST(9747.4723031393187/8.0), - REAL_CONST(9760.7229018096641/8.0), - REAL_CONST(9773.9779990712323/8.0), - REAL_CONST(9787.2375918725811/8.0), - REAL_CONST(9800.5016771674327/8.0), - REAL_CONST(9813.7702519146696/8.0), - REAL_CONST(9827.0433130783094/8.0), - REAL_CONST(9840.3208576275028/8.0), - REAL_CONST(9853.602882536512/8.0), - REAL_CONST(9866.8893847846994/8.0), - REAL_CONST(9880.1803613565116/8.0), - REAL_CONST(9893.4758092414686/8.0), - REAL_CONST(9906.7757254341523/8.0), - REAL_CONST(9920.0801069341851/8.0), - REAL_CONST(9933.3889507462245/8.0), - REAL_CONST(9946.7022538799429/8.0), - REAL_CONST(9960.0200133500221/8.0), - REAL_CONST(9973.3422261761298/8.0), - REAL_CONST(9986.6688893829159/8.0), - REAL_CONST(9999.9999999999945/8.0), - REAL_CONST(10013.335555061929/8.0), - REAL_CONST(10026.675551608221/8.0), - REAL_CONST(10040.019986683301/8.0), - REAL_CONST(10053.368857336509/8.0), - REAL_CONST(10066.722160622081/8.0), - REAL_CONST(10080.079893599144/8.0), - REAL_CONST(10093.442053331697/8.0), - REAL_CONST(10106.808636888598/8.0), - REAL_CONST(10120.179641343551/8.0), - REAL_CONST(10133.555063775095/8.0), - REAL_CONST(10146.934901266595/8.0), - REAL_CONST(10160.31915090622/8.0), - REAL_CONST(10173.707809786936/8.0), - REAL_CONST(10187.100875006496/8.0), - REAL_CONST(10200.498343667417/8.0), - REAL_CONST(10213.900212876984/8.0), - REAL_CONST(10227.306479747222/8.0), - REAL_CONST(10240.717141394889/8.0), - REAL_CONST(10254.132194941467/8.0), - REAL_CONST(10267.551637513146/8.0), - REAL_CONST(10280.975466240814/8.0), - REAL_CONST(10294.40367826004/8.0), - REAL_CONST(10307.836270711066/8.0), - REAL_CONST(10321.273240738796/8.0), - REAL_CONST(10334.71458549278/8.0) -#ifdef BIG_IQ_TABLE - ,REAL_CONST(10348.160302127204/8.0), - REAL_CONST(10361.610387800878/8.0), - REAL_CONST(10375.064839677221/8.0), - REAL_CONST(10388.523654924258/8.0), - REAL_CONST(10401.986830714593/8.0), - REAL_CONST(10415.454364225412/8.0), - REAL_CONST(10428.926252638465/8.0), - REAL_CONST(10442.402493140049/8.0), - REAL_CONST(10455.883082921007/8.0), - REAL_CONST(10469.368019176709/8.0), - REAL_CONST(10482.85729910704/8.0), - REAL_CONST(10496.350919916393/8.0), - REAL_CONST(10509.848878813653/8.0), - REAL_CONST(10523.351173012188/8.0), - REAL_CONST(10536.857799729838/8.0), - REAL_CONST(10550.3687561889/8.0), - REAL_CONST(10563.884039616123/8.0), - REAL_CONST(10577.403647242685/8.0), - REAL_CONST(10590.927576304197/8.0), - REAL_CONST(10604.455824040679/8.0), - REAL_CONST(10617.988387696556/8.0), - REAL_CONST(10631.525264520642/8.0), - REAL_CONST(10645.066451766135/8.0), - REAL_CONST(10658.611946690598/8.0), - REAL_CONST(10672.161746555956/8.0), - REAL_CONST(10685.715848628475/8.0), - REAL_CONST(10699.274250178762/8.0), - REAL_CONST(10712.836948481747/8.0), - REAL_CONST(10726.403940816675/8.0), - REAL_CONST(10739.975224467091/8.0), - REAL_CONST(10753.550796720834/8.0), - REAL_CONST(10767.130654870027/8.0), - REAL_CONST(10780.714796211059/8.0), - REAL_CONST(10794.303218044579/8.0), - REAL_CONST(10807.895917675487/8.0), - REAL_CONST(10821.492892412922/8.0), - REAL_CONST(10835.094139570248/8.0), - REAL_CONST(10848.699656465047/8.0), - REAL_CONST(10862.309440419107/8.0), - REAL_CONST(10875.923488758415/8.0), - REAL_CONST(10889.541798813138/8.0), - REAL_CONST(10903.16436791762/8.0), - REAL_CONST(10916.791193410372/8.0), - REAL_CONST(10930.422272634056/8.0), - REAL_CONST(10944.05760293548/8.0), - REAL_CONST(10957.697181665582/8.0), - REAL_CONST(10971.341006179427/8.0), - REAL_CONST(10984.98907383619/8.0), - REAL_CONST(10998.641381999149/8.0), - REAL_CONST(11012.297928035676/8.0), - REAL_CONST(11025.958709317223/8.0), - REAL_CONST(11039.623723219316/8.0), - REAL_CONST(11053.292967121541/8.0), - REAL_CONST(11066.966438407539/8.0), - REAL_CONST(11080.64413446499/8.0), - REAL_CONST(11094.326052685608/8.0), - REAL_CONST(11108.012190465128/8.0), - REAL_CONST(11121.702545203296/8.0), - REAL_CONST(11135.397114303863/8.0), - REAL_CONST(11149.095895174571/8.0), - REAL_CONST(11162.798885227143/8.0), - REAL_CONST(11176.506081877278/8.0), - REAL_CONST(11190.217482544635/8.0), - REAL_CONST(11203.933084652828/8.0), - REAL_CONST(11217.652885629415/8.0), - REAL_CONST(11231.376882905886/8.0), - REAL_CONST(11245.105073917659/8.0), - REAL_CONST(11258.837456104062/8.0), - REAL_CONST(11272.574026908333/8.0), - REAL_CONST(11286.314783777601/8.0), - REAL_CONST(11300.059724162888/8.0), - REAL_CONST(11313.808845519083/8.0), - REAL_CONST(11327.562145304952/8.0), - REAL_CONST(11341.319620983111/8.0), - REAL_CONST(11355.081270020033/8.0), - REAL_CONST(11368.847089886023/8.0), - REAL_CONST(11382.617078055218/8.0), - REAL_CONST(11396.391232005579/8.0), - REAL_CONST(11410.169549218874/8.0), - REAL_CONST(11423.952027180676/8.0), - REAL_CONST(11437.738663380349/8.0), - REAL_CONST(11451.529455311042/8.0), - REAL_CONST(11465.324400469679/8.0), - REAL_CONST(11479.123496356951/8.0), - REAL_CONST(11492.926740477304/8.0), - REAL_CONST(11506.734130338931/8.0), - REAL_CONST(11520.545663453764/8.0), - REAL_CONST(11534.361337337466/8.0), - REAL_CONST(11548.181149509423/8.0), - REAL_CONST(11562.005097492724/8.0), - REAL_CONST(11575.83317881417/8.0), - REAL_CONST(11589.665391004253/8.0), - REAL_CONST(11603.501731597149/8.0), - REAL_CONST(11617.342198130715/8.0), - REAL_CONST(11631.186788146468/8.0), - REAL_CONST(11645.035499189589/8.0), - REAL_CONST(11658.888328808911/8.0), - REAL_CONST(11672.745274556904/8.0), - REAL_CONST(11686.606333989675/8.0), - REAL_CONST(11700.471504666955/8.0), - REAL_CONST(11714.340784152086/8.0), - REAL_CONST(11728.214170012021/8.0), - REAL_CONST(11742.091659817312/8.0), - REAL_CONST(11755.973251142101/8.0), - REAL_CONST(11769.858941564111/8.0), - REAL_CONST(11783.748728664636/8.0), - REAL_CONST(11797.642610028539/8.0), - REAL_CONST(11811.540583244237/8.0), - REAL_CONST(11825.442645903697/8.0), - REAL_CONST(11839.34879560242/8.0), - REAL_CONST(11853.259029939445/8.0), - REAL_CONST(11867.173346517333/8.0), - REAL_CONST(11881.091742942155/8.0), - REAL_CONST(11895.014216823492/8.0), - REAL_CONST(11908.940765774427/8.0), - REAL_CONST(11922.871387411526/8.0), - REAL_CONST(11936.806079354839/8.0), - REAL_CONST(11950.744839227897/8.0), - REAL_CONST(11964.687664657684/8.0), - REAL_CONST(11978.634553274653/8.0), - REAL_CONST(11992.585502712702/8.0), - REAL_CONST(12006.540510609168/8.0), - REAL_CONST(12020.499574604828/8.0), - REAL_CONST(12034.462692343877/8.0), - REAL_CONST(12048.429861473938/8.0), - REAL_CONST(12062.401079646032/8.0), - REAL_CONST(12076.376344514589/8.0), - REAL_CONST(12090.355653737433/8.0), - REAL_CONST(12104.339004975769/8.0), - REAL_CONST(12118.326395894188/8.0), - REAL_CONST(12132.317824160644/8.0), - REAL_CONST(12146.313287446457/8.0), - REAL_CONST(12160.312783426305/8.0), - REAL_CONST(12174.316309778205/8.0), - REAL_CONST(12188.323864183525/8.0), - REAL_CONST(12202.335444326955/8.0), - REAL_CONST(12216.351047896511/8.0), - REAL_CONST(12230.370672583531/8.0), - REAL_CONST(12244.394316082657/8.0), - REAL_CONST(12258.421976091831/8.0), - REAL_CONST(12272.453650312296/8.0), - REAL_CONST(12286.489336448574/8.0), - REAL_CONST(12300.529032208471/8.0), - REAL_CONST(12314.572735303058/8.0), - REAL_CONST(12328.620443446678/8.0), - REAL_CONST(12342.672154356922/8.0), - REAL_CONST(12356.727865754638/8.0), - REAL_CONST(12370.787575363909/8.0), - REAL_CONST(12384.851280912055/8.0), - REAL_CONST(12398.918980129623/8.0), - REAL_CONST(12412.990670750381/8.0), - REAL_CONST(12427.066350511306/8.0), - REAL_CONST(12441.146017152583/8.0), - REAL_CONST(12455.229668417589/8.0), - REAL_CONST(12469.317302052901/8.0), - REAL_CONST(12483.40891580827/8.0), - REAL_CONST(12497.50450743663/8.0), - REAL_CONST(12511.604074694078/8.0), - REAL_CONST(12525.707615339878/8.0), - REAL_CONST(12539.815127136444/8.0), - REAL_CONST(12553.926607849342/8.0), - REAL_CONST(12568.042055247275/8.0), - REAL_CONST(12582.161467102082/8.0), - REAL_CONST(12596.284841188726/8.0), - REAL_CONST(12610.41217528529/8.0), - REAL_CONST(12624.543467172971/8.0), - REAL_CONST(12638.678714636069/8.0), - REAL_CONST(12652.817915461985/8.0), - REAL_CONST(12666.961067441209/8.0), - REAL_CONST(12681.108168367316/8.0), - REAL_CONST(12695.259216036962/8.0), - REAL_CONST(12709.414208249869/8.0), - REAL_CONST(12723.573142808827/8.0), - REAL_CONST(12737.736017519681/8.0), - REAL_CONST(12751.902830191326/8.0), - REAL_CONST(12766.073578635704/8.0), - REAL_CONST(12780.248260667788/8.0), - REAL_CONST(12794.426874105588/8.0), - REAL_CONST(12808.609416770132/8.0), - REAL_CONST(12822.795886485468/8.0), - REAL_CONST(12836.986281078653/8.0), - REAL_CONST(12851.180598379744/8.0), - REAL_CONST(12865.378836221802/8.0), - REAL_CONST(12879.580992440871/8.0), - REAL_CONST(12893.787064875984/8.0), - REAL_CONST(12907.997051369144/8.0), - REAL_CONST(12922.210949765335/8.0), - REAL_CONST(12936.428757912496/8.0), - REAL_CONST(12950.650473661524/8.0), - REAL_CONST(12964.876094866273/8.0), - REAL_CONST(12979.105619383534/8.0), - REAL_CONST(12993.339045073039/8.0), - REAL_CONST(13007.576369797454/8.0), - REAL_CONST(13021.817591422368/8.0), - REAL_CONST(13036.062707816285/8.0), - REAL_CONST(13050.311716850629/8.0), - REAL_CONST(13064.564616399723/8.0), - REAL_CONST(13078.821404340792/8.0), - REAL_CONST(13093.082078553954/8.0), - REAL_CONST(13107.346636922217/8.0), - REAL_CONST(13121.615077331464/8.0), - REAL_CONST(13135.887397670458/8.0), - REAL_CONST(13150.163595830827/8.0), - REAL_CONST(13164.44366970706/8.0), - REAL_CONST(13178.727617196502/8.0), - REAL_CONST(13193.015436199352/8.0), - REAL_CONST(13207.307124618648/8.0), - REAL_CONST(13221.602680360265/8.0), - REAL_CONST(13235.902101332911/8.0), - REAL_CONST(13250.205385448118/8.0), - REAL_CONST(13264.512530620239/8.0), - REAL_CONST(13278.823534766434/8.0), - REAL_CONST(13293.138395806676/8.0), - REAL_CONST(13307.457111663734/8.0), - REAL_CONST(13321.779680263176/8.0), - REAL_CONST(13336.106099533356/8.0), - REAL_CONST(13350.436367405409/8.0), - REAL_CONST(13364.77048181325/8.0), - REAL_CONST(13379.108440693562/8.0), - REAL_CONST(13393.450241985796/8.0), - REAL_CONST(13407.795883632158/8.0), - REAL_CONST(13422.145363577607/8.0), - REAL_CONST(13436.498679769853/8.0), - REAL_CONST(13450.855830159346/8.0), - REAL_CONST(13465.216812699266/8.0), - REAL_CONST(13479.581625345529/8.0), - REAL_CONST(13493.950266056772/8.0), - REAL_CONST(13508.32273279435/8.0), - REAL_CONST(13522.699023522329/8.0), - REAL_CONST(13537.079136207483/8.0), - REAL_CONST(13551.463068819286/8.0), - REAL_CONST(13565.850819329906/8.0), - REAL_CONST(13580.2423857142/8.0), - REAL_CONST(13594.63776594971/8.0), - REAL_CONST(13609.036958016657/8.0), - REAL_CONST(13623.439959897927/8.0), - REAL_CONST(13637.846769579081/8.0), - REAL_CONST(13652.257385048335/8.0), - REAL_CONST(13666.67180429656/8.0), - REAL_CONST(13681.090025317284/8.0), - REAL_CONST(13695.512046106669/8.0), - REAL_CONST(13709.937864663521/8.0), - REAL_CONST(13724.367478989278/8.0), - REAL_CONST(13738.800887088004/8.0), - REAL_CONST(13753.238086966385/8.0), - REAL_CONST(13767.679076633727/8.0), - REAL_CONST(13782.123854101939/8.0), - REAL_CONST(13796.572417385545/8.0), - REAL_CONST(13811.024764501659/8.0), - REAL_CONST(13825.480893469998/8.0), - REAL_CONST(13839.94080231286/8.0), - REAL_CONST(13854.404489055134/8.0), - REAL_CONST(13868.871951724283/8.0), - REAL_CONST(13883.34318835034/8.0), - REAL_CONST(13897.818196965914/8.0), - REAL_CONST(13912.296975606168/8.0), - REAL_CONST(13926.779522308825/8.0), - REAL_CONST(13941.26583511416/8.0), - REAL_CONST(13955.755912064991/8.0), - REAL_CONST(13970.249751206682/8.0), - REAL_CONST(13984.747350587126/8.0), - REAL_CONST(13999.248708256751/8.0), - REAL_CONST(14013.753822268511/8.0), - REAL_CONST(14028.262690677873/8.0), - REAL_CONST(14042.775311542828/8.0), - REAL_CONST(14057.291682923867/8.0), - REAL_CONST(14071.811802883994/8.0), - REAL_CONST(14086.335669488704/8.0), - REAL_CONST(14100.863280805994/8.0), - REAL_CONST(14115.394634906341/8.0), - REAL_CONST(14129.92972986271/8.0), - REAL_CONST(14144.468563750548/8.0), - REAL_CONST(14159.01113464777/8.0), - REAL_CONST(14173.55744063476/8.0), - REAL_CONST(14188.107479794369/8.0), - REAL_CONST(14202.661250211901/8.0), - REAL_CONST(14217.218749975118/8.0), - REAL_CONST(14231.779977174227/8.0), - REAL_CONST(14246.344929901879/8.0), - REAL_CONST(14260.913606253163/8.0), - REAL_CONST(14275.486004325601/8.0), - REAL_CONST(14290.062122219146/8.0), - REAL_CONST(14304.641958036171/8.0), - REAL_CONST(14319.225509881464/8.0), - REAL_CONST(14333.812775862236/8.0), - REAL_CONST(14348.403754088098/8.0), - REAL_CONST(14362.998442671067/8.0), - REAL_CONST(14377.59683972556/8.0), - REAL_CONST(14392.198943368388/8.0), - REAL_CONST(14406.804751718748/8.0), - REAL_CONST(14421.414262898223/8.0), - REAL_CONST(14436.027475030774/8.0), - REAL_CONST(14450.64438624274/8.0), - REAL_CONST(14465.264994662828/8.0), - REAL_CONST(14479.889298422106/8.0), - REAL_CONST(14494.517295654005/8.0), - REAL_CONST(14509.148984494313/8.0), - REAL_CONST(14523.784363081166/8.0), - REAL_CONST(14538.423429555049/8.0), - REAL_CONST(14553.066182058781/8.0), - REAL_CONST(14567.712618737527/8.0), - REAL_CONST(14582.362737738777/8.0), - REAL_CONST(14597.016537212348/8.0), - REAL_CONST(14611.674015310382/8.0), - REAL_CONST(14626.33517018734/8.0), - REAL_CONST(14640.999999999993/8.0), - REAL_CONST(14655.668502907418/8.0), - REAL_CONST(14670.340677071003/8.0), - REAL_CONST(14685.016520654426/8.0), - REAL_CONST(14699.696031823671/8.0), - REAL_CONST(14714.379208746999/8.0), - REAL_CONST(14729.066049594967/8.0), - REAL_CONST(14743.756552540408/8.0), - REAL_CONST(14758.45071575843/8.0), - REAL_CONST(14773.148537426418/8.0), - REAL_CONST(14787.850015724018/8.0), - REAL_CONST(14802.555148833142/8.0), - REAL_CONST(14817.263934937961/8.0), - REAL_CONST(14831.976372224897/8.0), - REAL_CONST(14846.692458882624/8.0), - REAL_CONST(14861.41219310206/8.0), - REAL_CONST(14876.135573076363/8.0), - REAL_CONST(14890.862597000923/8.0), - REAL_CONST(14905.593263073371/8.0), - REAL_CONST(14920.327569493558/8.0), - REAL_CONST(14935.065514463557/8.0), - REAL_CONST(14949.807096187662/8.0), - REAL_CONST(14964.552312872382/8.0), - REAL_CONST(14979.301162726431/8.0), - REAL_CONST(14994.053643960735/8.0), - REAL_CONST(15008.809754788414/8.0), - REAL_CONST(15023.569493424788/8.0), - REAL_CONST(15038.332858087369/8.0), - REAL_CONST(15053.099846995858/8.0), - REAL_CONST(15067.870458372134/8.0), - REAL_CONST(15082.644690440264/8.0), - REAL_CONST(15097.422541426484/8.0), - REAL_CONST(15112.204009559202/8.0), - REAL_CONST(15126.989093068994/8.0), - REAL_CONST(15141.777790188597/8.0), - REAL_CONST(15156.570099152905/8.0), - REAL_CONST(15171.366018198967/8.0), - REAL_CONST(15186.165545565986/8.0), - REAL_CONST(15200.968679495301/8.0), - REAL_CONST(15215.775418230402/8.0), - REAL_CONST(15230.585760016909/8.0), - REAL_CONST(15245.399703102579/8.0), - REAL_CONST(15260.217245737298/8.0), - REAL_CONST(15275.038386173073/8.0), - REAL_CONST(15289.863122664035/8.0), - REAL_CONST(15304.691453466432/8.0), - REAL_CONST(15319.523376838621/8.0), - REAL_CONST(15334.358891041069/8.0), - REAL_CONST(15349.197994336346/8.0), - REAL_CONST(15364.040684989128/8.0), - REAL_CONST(15378.886961266177/8.0), - REAL_CONST(15393.736821436356/8.0), - REAL_CONST(15408.590263770609/8.0), - REAL_CONST(15423.447286541972/8.0), - REAL_CONST(15438.307888025554/8.0), - REAL_CONST(15453.172066498542/8.0), - REAL_CONST(15468.039820240196/8.0), - REAL_CONST(15482.91114753184/8.0), - REAL_CONST(15497.786046656869/8.0), - REAL_CONST(15512.664515900733/8.0), - REAL_CONST(15527.546553550939/8.0), - REAL_CONST(15542.432157897045/8.0), - REAL_CONST(15557.32132723066/8.0), - REAL_CONST(15572.214059845435/8.0), - REAL_CONST(15587.110354037064/8.0), - REAL_CONST(15602.010208103273/8.0), - REAL_CONST(15616.913620343823/8.0), - REAL_CONST(15631.820589060506/8.0), - REAL_CONST(15646.731112557136/8.0), - REAL_CONST(15661.645189139546/8.0), - REAL_CONST(15676.562817115593/8.0), - REAL_CONST(15691.483994795139/8.0), - REAL_CONST(15706.408720490062/8.0), - REAL_CONST(15721.336992514242/8.0), - REAL_CONST(15736.268809183561/8.0), - REAL_CONST(15751.204168815901/8.0), - REAL_CONST(15766.143069731135/8.0), - REAL_CONST(15781.085510251132/8.0), - REAL_CONST(15796.03148869974/8.0), - REAL_CONST(15810.981003402798/8.0), - REAL_CONST(15825.934052688119/8.0), - REAL_CONST(15840.890634885489/8.0), - REAL_CONST(15855.850748326673/8.0), - REAL_CONST(15870.814391345401/8.0), - REAL_CONST(15885.781562277361/8.0), - REAL_CONST(15900.752259460214/8.0), - REAL_CONST(15915.726481233565/8.0), - REAL_CONST(15930.704225938984/8.0), - REAL_CONST(15945.685491919978/8.0), - REAL_CONST(15960.670277522009/8.0), - REAL_CONST(15975.658581092481/8.0), - REAL_CONST(15990.65040098073/8.0), - REAL_CONST(16005.645735538035/8.0), - REAL_CONST(16020.644583117599/8.0), - REAL_CONST(16035.646942074556/8.0), - REAL_CONST(16050.652810765967/8.0), - REAL_CONST(16065.662187550806/8.0), - REAL_CONST(16080.675070789974/8.0), - REAL_CONST(16095.691458846273/8.0), - REAL_CONST(16110.711350084424/8.0), - REAL_CONST(16125.734742871053/8.0), - REAL_CONST(16140.761635574685/8.0), - REAL_CONST(16155.792026565747/8.0), - REAL_CONST(16170.825914216561/8.0), - REAL_CONST(16185.863296901338/8.0), - REAL_CONST(16200.904172996183/8.0), - REAL_CONST(16215.948540879079/8.0), - REAL_CONST(16230.996398929899/8.0), - REAL_CONST(16246.047745530386/8.0), - REAL_CONST(16261.102579064163/8.0), - REAL_CONST(16276.160897916721/8.0), - REAL_CONST(16291.22270047542/8.0), - REAL_CONST(16306.287985129484/8.0), - REAL_CONST(16321.356750269995/8.0), - REAL_CONST(16336.428994289896/8.0), - REAL_CONST(16351.504715583982/8.0), - REAL_CONST(16366.5839125489/8.0), - REAL_CONST(16381.666583583141/8.0), - REAL_CONST(16396.752727087041/8.0), - REAL_CONST(16411.842341462776/8.0), - REAL_CONST(16426.935425114363/8.0), - REAL_CONST(16442.031976447644/8.0), - REAL_CONST(16457.131993870298/8.0), - REAL_CONST(16472.235475791829/8.0), - REAL_CONST(16487.342420623561/8.0), - REAL_CONST(16502.452826778641/8.0), - REAL_CONST(16517.566692672033/8.0), - REAL_CONST(16532.684016720516/8.0), - REAL_CONST(16547.804797342676/8.0), - REAL_CONST(16562.929032958902/8.0), - REAL_CONST(16578.056721991394/8.0), - REAL_CONST(16593.18786286415/8.0), - REAL_CONST(16608.322454002962/8.0), - REAL_CONST(16623.460493835417/8.0), - REAL_CONST(16638.601980790896/8.0), - REAL_CONST(16653.746913300558/8.0), - REAL_CONST(16668.895289797354/8.0), - REAL_CONST(16684.047108716015/8.0), - REAL_CONST(16699.202368493046/8.0), - REAL_CONST(16714.361067566726/8.0), - REAL_CONST(16729.523204377107/8.0), - REAL_CONST(16744.688777366009/8.0), - REAL_CONST(16759.857784977012/8.0), - REAL_CONST(16775.030225655464/8.0), - REAL_CONST(16790.206097848466/8.0), - REAL_CONST(16805.385400004874/8.0), - REAL_CONST(16820.568130575302/8.0), - REAL_CONST(16835.754288012104/8.0), - REAL_CONST(16850.943870769381/8.0), - REAL_CONST(16866.136877302983/8.0), - REAL_CONST(16881.333306070494/8.0), - REAL_CONST(16896.53315553123/8.0), - REAL_CONST(16911.736424146249/8.0), - REAL_CONST(16926.943110378332/8.0), - REAL_CONST(16942.153212691992/8.0), - REAL_CONST(16957.366729553454/8.0), - REAL_CONST(16972.583659430682/8.0), - REAL_CONST(16987.804000793338/8.0), - REAL_CONST(17003.027752112816/8.0), - REAL_CONST(17018.254911862205/8.0), - REAL_CONST(17033.485478516312/8.0), - REAL_CONST(17048.719450551645/8.0), - REAL_CONST(17063.956826446421/8.0), - REAL_CONST(17079.197604680547/8.0), - REAL_CONST(17094.44178373563/8.0), - REAL_CONST(17109.689362094967/8.0), - REAL_CONST(17124.940338243552/8.0), - REAL_CONST(17140.194710668064/8.0), - REAL_CONST(17155.452477856852/8.0), - REAL_CONST(17170.713638299967/8.0), - REAL_CONST(17185.978190489128/8.0), - REAL_CONST(17201.246132917724/8.0), - REAL_CONST(17216.517464080825/8.0), - REAL_CONST(17231.792182475165/8.0), - REAL_CONST(17247.070286599141/8.0), - REAL_CONST(17262.351774952826/8.0), - REAL_CONST(17277.636646037936/8.0), - REAL_CONST(17292.924898357855/8.0), - REAL_CONST(17308.216530417623/8.0), - REAL_CONST(17323.511540723921/8.0), - REAL_CONST(17338.809927785089/8.0), - REAL_CONST(17354.111690111105/8.0), - REAL_CONST(17369.416826213594/8.0), - REAL_CONST(17384.725334605821/8.0), - REAL_CONST(17400.037213802683/8.0), - REAL_CONST(17415.352462320716/8.0), - REAL_CONST(17430.67107867809/8.0), - REAL_CONST(17445.993061394587/8.0), - REAL_CONST(17461.318408991636/8.0), - REAL_CONST(17476.647119992274/8.0), - REAL_CONST(17491.979192921168/8.0), - REAL_CONST(17507.314626304586/8.0), - REAL_CONST(17522.653418670423/8.0), - REAL_CONST(17537.995568548187/8.0), - REAL_CONST(17553.341074468986/8.0), - REAL_CONST(17568.689934965536/8.0), - REAL_CONST(17584.042148572156/8.0), - REAL_CONST(17599.397713824768/8.0), - REAL_CONST(17614.75662926089/8.0), - REAL_CONST(17630.118893419625/8.0), - REAL_CONST(17645.484504841683/8.0), - REAL_CONST(17660.853462069354/8.0), - REAL_CONST(17676.225763646511/8.0), - REAL_CONST(17691.601408118619/8.0), - REAL_CONST(17706.980394032718/8.0), - REAL_CONST(17722.362719937424/8.0), - REAL_CONST(17737.748384382936/8.0), - REAL_CONST(17753.137385921014/8.0), - REAL_CONST(17768.529723104999/8.0), - REAL_CONST(17783.92539448979/8.0), - REAL_CONST(17799.324398631856/8.0), - REAL_CONST(17814.726734089225/8.0), - REAL_CONST(17830.13239942148/8.0), - REAL_CONST(17845.541393189767/8.0), - REAL_CONST(17860.95371395678/8.0), - REAL_CONST(17876.369360286772/8.0), - REAL_CONST(17891.788330745527/8.0), - REAL_CONST(17907.210623900395/8.0), - REAL_CONST(17922.636238320254/8.0), - REAL_CONST(17938.065172575527/8.0), - REAL_CONST(17953.497425238176/8.0), - REAL_CONST(17968.932994881692/8.0), - REAL_CONST(17984.371880081104/8.0), - REAL_CONST(17999.814079412972/8.0), - REAL_CONST(18015.259591455371/8.0), - REAL_CONST(18030.708414787914/8.0), - REAL_CONST(18046.160547991731/8.0), - REAL_CONST(18061.615989649465/8.0), - REAL_CONST(18077.074738345284/8.0), - REAL_CONST(18092.536792664861/8.0), - REAL_CONST(18108.002151195393/8.0), - REAL_CONST(18123.470812525571/8.0), - REAL_CONST(18138.942775245599/8.0), - REAL_CONST(18154.418037947191/8.0), - REAL_CONST(18169.896599223546/8.0), - REAL_CONST(18185.37845766938/8.0), - REAL_CONST(18200.863611880886/8.0), - REAL_CONST(18216.352060455767/8.0), - REAL_CONST(18231.843801993204/8.0), - REAL_CONST(18247.338835093873/8.0), - REAL_CONST(18262.837158359936/8.0), - REAL_CONST(18278.338770395032/8.0), - REAL_CONST(18293.84366980429/8.0), - REAL_CONST(18309.351855194309/8.0), - REAL_CONST(18324.863325173166/8.0), - REAL_CONST(18340.378078350412/8.0), - REAL_CONST(18355.896113337069/8.0), - REAL_CONST(18371.417428745623/8.0), - REAL_CONST(18386.942023190033/8.0), - REAL_CONST(18402.469895285718/8.0), - REAL_CONST(18418.00104364955/8.0), - REAL_CONST(18433.53546689987/8.0), - REAL_CONST(18449.073163656474/8.0), - REAL_CONST(18464.614132540602/8.0), - REAL_CONST(18480.158372174956/8.0), - REAL_CONST(18495.705881183676/8.0), - REAL_CONST(18511.256658192357/8.0), - REAL_CONST(18526.810701828035/8.0), - REAL_CONST(18542.368010719183/8.0), - REAL_CONST(18557.928583495715/8.0), - REAL_CONST(18573.492418788985/8.0), - REAL_CONST(18589.059515231773/8.0), - REAL_CONST(18604.629871458303/8.0), - REAL_CONST(18620.203486104212/8.0), - REAL_CONST(18635.78035780658/8.0), - REAL_CONST(18651.360485203899/8.0), - REAL_CONST(18666.943866936086/8.0), - REAL_CONST(18682.53050164448/8.0), - REAL_CONST(18698.120387971841/8.0), - REAL_CONST(18713.713524562332/8.0), - REAL_CONST(18729.30991006154/8.0), - REAL_CONST(18744.909543116457/8.0), - REAL_CONST(18760.512422375479/8.0), - REAL_CONST(18776.118546488418/8.0), - REAL_CONST(18791.727914106479/8.0), - REAL_CONST(18807.340523882274/8.0), - REAL_CONST(18822.95637446981/8.0), - REAL_CONST(18838.575464524489/8.0), - REAL_CONST(18854.197792703111/8.0), - REAL_CONST(18869.823357663863/8.0), - REAL_CONST(18885.452158066328/8.0), - REAL_CONST(18901.08419257147/8.0), - REAL_CONST(18916.719459841639/8.0), - REAL_CONST(18932.357958540564/8.0), - REAL_CONST(18947.999687333362/8.0), - REAL_CONST(18963.644644886521/8.0), - REAL_CONST(18979.292829867907/8.0), - REAL_CONST(18994.944240946759/8.0), - REAL_CONST(19010.598876793687/8.0), - REAL_CONST(19026.256736080668/8.0), - REAL_CONST(19041.917817481048/8.0), - REAL_CONST(19057.582119669532/8.0), - REAL_CONST(19073.2496413222/8.0), - REAL_CONST(19088.920381116473/8.0), - REAL_CONST(19104.594337731145/8.0), - REAL_CONST(19120.271509846356/8.0), - REAL_CONST(19135.951896143604/8.0), - REAL_CONST(19151.635495305738/8.0), - REAL_CONST(19167.322306016948/8.0), - REAL_CONST(19183.012326962784/8.0), - REAL_CONST(19198.705556830122/8.0), - REAL_CONST(19214.401994307198/8.0), - REAL_CONST(19230.101638083579/8.0), - REAL_CONST(19245.804486850167/8.0), - REAL_CONST(19261.510539299208/8.0), - REAL_CONST(19277.219794124274/8.0), - REAL_CONST(19292.932250020265/8.0), - REAL_CONST(19308.647905683421/8.0), - REAL_CONST(19324.366759811302/8.0), - REAL_CONST(19340.088811102793/8.0), - REAL_CONST(19355.8140582581/8.0), - REAL_CONST(19371.542499978754/8.0), - REAL_CONST(19387.2741349676/8.0), - REAL_CONST(19403.008961928797/8.0), - REAL_CONST(19418.746979567823/8.0), - REAL_CONST(19434.488186591469/8.0), - REAL_CONST(19450.232581707827/8.0), - REAL_CONST(19465.980163626304/8.0), - REAL_CONST(19481.730931057613/8.0), - REAL_CONST(19497.484882713761/8.0), - REAL_CONST(19513.242017308068/8.0), - REAL_CONST(19529.002333555141/8.0), - REAL_CONST(19544.765830170898/8.0), - REAL_CONST(19560.532505872539/8.0), - REAL_CONST(19576.302359378566/8.0), - REAL_CONST(19592.075389408761/8.0), - REAL_CONST(19607.851594684209/8.0), - REAL_CONST(19623.630973927269/8.0), - REAL_CONST(19639.41352586159/8.0), - REAL_CONST(19655.199249212103/8.0), - REAL_CONST(19670.988142705017/8.0), - REAL_CONST(19686.780205067826/8.0), - REAL_CONST(19702.575435029288/8.0), - REAL_CONST(19718.373831319448/8.0), - REAL_CONST(19734.175392669615/8.0), - REAL_CONST(19749.980117812371/8.0), - REAL_CONST(19765.788005481569/8.0), - REAL_CONST(19781.599054412323/8.0), - REAL_CONST(19797.413263341008/8.0), - REAL_CONST(19813.230631005274/8.0), - REAL_CONST(19829.051156144014/8.0), - REAL_CONST(19844.874837497395/8.0), - REAL_CONST(19860.701673806827/8.0), - REAL_CONST(19876.531663814985/8.0), - REAL_CONST(19892.364806265789/8.0), - REAL_CONST(19908.201099904403/8.0), - REAL_CONST(19924.040543477258/8.0), - REAL_CONST(19939.883135732012/8.0), - REAL_CONST(19955.728875417579/8.0), - REAL_CONST(19971.577761284105/8.0), - REAL_CONST(19987.429792082985/8.0), - REAL_CONST(20003.284966566847/8.0), - REAL_CONST(20019.14328348956/8.0), - REAL_CONST(20035.004741606219/8.0), - REAL_CONST(20050.869339673161/8.0), - REAL_CONST(20066.737076447946/8.0), - REAL_CONST(20082.607950689362/8.0), - REAL_CONST(20098.481961157428/8.0), - REAL_CONST(20114.359106613385/8.0), - REAL_CONST(20130.239385819699/8.0), - REAL_CONST(20146.122797540058/8.0), - REAL_CONST(20162.009340539353/8.0), - REAL_CONST(20177.899013583716/8.0), - REAL_CONST(20193.791815440476/8.0), - REAL_CONST(20209.687744878182/8.0), - REAL_CONST(20225.586800666591/8.0), - REAL_CONST(20241.488981576669/8.0), - REAL_CONST(20257.394286380597/8.0), - REAL_CONST(20273.302713851754/8.0), - REAL_CONST(20289.214262764715/8.0), - REAL_CONST(20305.128931895277/8.0), - REAL_CONST(20321.046720020415/8.0), - REAL_CONST(20336.967625918318/8.0), - REAL_CONST(20352.891648368361/8.0), - REAL_CONST(20368.818786151114/8.0), - REAL_CONST(20384.749038048347/8.0), - REAL_CONST(20400.682402843009/8.0), - REAL_CONST(20416.618879319249/8.0), - REAL_CONST(20432.558466262391/8.0), - REAL_CONST(20448.501162458953/8.0), - REAL_CONST(20464.446966696629/8.0), - REAL_CONST(20480.395877764302/8.0), - REAL_CONST(20496.347894452025/8.0), - REAL_CONST(20512.303015551031/8.0), - REAL_CONST(20528.261239853735/8.0), - REAL_CONST(20544.22256615372/8.0), - REAL_CONST(20560.186993245738/8.0), - REAL_CONST(20576.15451992572/8.0), - REAL_CONST(20592.125144990758/8.0), - REAL_CONST(20608.098867239107/8.0), - REAL_CONST(20624.075685470198/8.0), - REAL_CONST(20640.055598484618/8.0), - REAL_CONST(20656.038605084115/8.0), - REAL_CONST(20672.024704071595/8.0), - REAL_CONST(20688.013894251126/8.0), - REAL_CONST(20704.006174427926/8.0), - REAL_CONST(20720.001543408373/8.0), - REAL_CONST(20735.999999999989/8.0), - REAL_CONST(20752.001543011454/8.0), - REAL_CONST(20768.006171252597/8.0), - REAL_CONST(20784.013883534382/8.0), - REAL_CONST(20800.024678668931/8.0), - REAL_CONST(20816.038555469506/8.0), - REAL_CONST(20832.055512750507/8.0), - REAL_CONST(20848.075549327474/8.0), - REAL_CONST(20864.098664017085/8.0), - REAL_CONST(20880.124855637161/8.0), - REAL_CONST(20896.154123006647/8.0), - REAL_CONST(20912.186464945626/8.0), - REAL_CONST(20928.221880275312/8.0), - REAL_CONST(20944.260367818049/8.0), - REAL_CONST(20960.301926397311/8.0), - REAL_CONST(20976.346554837684/8.0), - REAL_CONST(20992.394251964895/8.0), - REAL_CONST(21008.445016605787/8.0), - REAL_CONST(21024.498847588318/8.0), - REAL_CONST(21040.555743741574/8.0), - REAL_CONST(21056.615703895754/8.0), - REAL_CONST(21072.678726882168/8.0), - REAL_CONST(21088.744811533252/8.0), - REAL_CONST(21104.813956682538/8.0), - REAL_CONST(21120.886161164683/8.0), - REAL_CONST(21136.961423815443/8.0), - REAL_CONST(21153.039743471683/8.0), - REAL_CONST(21169.121118971379/8.0), - REAL_CONST(21185.205549153605/8.0), - REAL_CONST(21201.293032858535/8.0), - REAL_CONST(21217.383568927453/8.0), - REAL_CONST(21233.477156202731/8.0), - REAL_CONST(21249.573793527841/8.0), - REAL_CONST(21265.673479747358/8.0), - REAL_CONST(21281.776213706937/8.0), - REAL_CONST(21297.881994253334/8.0), - REAL_CONST(21313.990820234398/8.0), - REAL_CONST(21330.102690499054/8.0), - REAL_CONST(21346.21760389733/8.0), - REAL_CONST(21362.335559280327/8.0), - REAL_CONST(21378.456555500241/8.0), - REAL_CONST(21394.580591410333/8.0), - REAL_CONST(21410.707665864964/8.0), - REAL_CONST(21426.83777771956/8.0), - REAL_CONST(21442.970925830628/8.0), - REAL_CONST(21459.107109055756/8.0), - REAL_CONST(21475.246326253604/8.0), - REAL_CONST(21491.388576283895/8.0), - REAL_CONST(21507.533858007431/8.0), - REAL_CONST(21523.682170286087/8.0), - REAL_CONST(21539.833511982797/8.0), - REAL_CONST(21555.987881961566/8.0), - REAL_CONST(21572.145279087465/8.0), - REAL_CONST(21588.305702226615/8.0), - REAL_CONST(21604.469150246216/8.0), - REAL_CONST(21620.635622014521/8.0), - REAL_CONST(21636.805116400832/8.0), - REAL_CONST(21652.977632275521/8.0), - REAL_CONST(21669.153168510009/8.0), - REAL_CONST(21685.331723976764/8.0), - REAL_CONST(21701.513297549318/8.0), - REAL_CONST(21717.697888102244/8.0), - REAL_CONST(21733.885494511167/8.0), - REAL_CONST(21750.076115652759/8.0), - REAL_CONST(21766.269750404736/8.0), - REAL_CONST(21782.466397645861/8.0), - REAL_CONST(21798.666056255934/8.0), - REAL_CONST(21814.868725115801/8.0), - REAL_CONST(21831.074403107345/8.0), - REAL_CONST(21847.283089113484/8.0), - REAL_CONST(21863.494782018177/8.0), - REAL_CONST(21879.709480706417/8.0), - REAL_CONST(21895.927184064229/8.0), - REAL_CONST(21912.147890978667/8.0), - REAL_CONST(21928.371600337818/8.0), - REAL_CONST(21944.598311030797/8.0), - REAL_CONST(21960.828021947746/8.0), - REAL_CONST(21977.060731979829/8.0), - REAL_CONST(21993.296440019243/8.0), - REAL_CONST(22009.535144959198/8.0), - REAL_CONST(22025.77684569393/8.0), - REAL_CONST(22042.021541118691/8.0), - REAL_CONST(22058.269230129757/8.0), - REAL_CONST(22074.519911624411/8.0), - REAL_CONST(22090.773584500959/8.0), - REAL_CONST(22107.030247658717/8.0), - REAL_CONST(22123.289899998013/8.0), - REAL_CONST(22139.552540420187/8.0), - REAL_CONST(22155.818167827587/8.0), - REAL_CONST(22172.086781123569/8.0), - REAL_CONST(22188.358379212495/8.0), - REAL_CONST(22204.632960999726/8.0), - REAL_CONST(22220.910525391639/8.0), - REAL_CONST(22237.191071295601/8.0), - REAL_CONST(22253.474597619981/8.0), - REAL_CONST(22269.761103274148/8.0), - REAL_CONST(22286.050587168469/8.0), - REAL_CONST(22302.343048214312/8.0), - REAL_CONST(22318.638485324027/8.0), - REAL_CONST(22334.936897410968/8.0), - REAL_CONST(22351.23828338947/8.0), - REAL_CONST(22367.542642174871/8.0), - REAL_CONST(22383.849972683485/8.0), - REAL_CONST(22400.160273832618/8.0), - REAL_CONST(22416.473544540564/8.0), - REAL_CONST(22432.789783726603/8.0), - REAL_CONST(22449.108990310986/8.0), - REAL_CONST(22465.431163214958/8.0), - REAL_CONST(22481.75630136074/8.0), - REAL_CONST(22498.084403671528/8.0), - REAL_CONST(22514.415469071497/8.0), - REAL_CONST(22530.749496485802/8.0), - REAL_CONST(22547.086484840562/8.0), - REAL_CONST(22563.426433062879/8.0), - REAL_CONST(22579.769340080824/8.0), - REAL_CONST(22596.115204823436/8.0), - REAL_CONST(22612.464026220721/8.0), - REAL_CONST(22628.815803203655/8.0), - REAL_CONST(22645.170534704179/8.0), - REAL_CONST(22661.5282196552/8.0), - REAL_CONST(22677.888856990587/8.0), - REAL_CONST(22694.252445645168/8.0), - REAL_CONST(22710.618984554734/8.0), - REAL_CONST(22726.988472656034/8.0), - REAL_CONST(22743.360908886778/8.0), - REAL_CONST(22759.736292185622/8.0), - REAL_CONST(22776.114621492186/8.0), - REAL_CONST(22792.495895747044/8.0), - REAL_CONST(22808.880113891719/8.0), - REAL_CONST(22825.267274868678/8.0), - REAL_CONST(22841.657377621348/8.0), - REAL_CONST(22858.050421094096/8.0), - REAL_CONST(22874.446404232243/8.0), - REAL_CONST(22890.845325982053/8.0), - REAL_CONST(22907.247185290722/8.0), - REAL_CONST(22923.651981106406/8.0), - REAL_CONST(22940.059712378195/8.0), - REAL_CONST(22956.470378056114/8.0), - REAL_CONST(22972.883977091129/8.0), - REAL_CONST(22989.300508435153/8.0), - REAL_CONST(23005.719971041017/8.0), - REAL_CONST(23022.142363862498/8.0), - REAL_CONST(23038.567685854305/8.0), - REAL_CONST(23054.995935972078/8.0), - REAL_CONST(23071.427113172387/8.0), - REAL_CONST(23087.86121641273/8.0), - REAL_CONST(23104.298244651531/8.0), - REAL_CONST(23120.738196848146/8.0), - REAL_CONST(23137.181071962848/8.0), - REAL_CONST(23153.626868956846/8.0), - REAL_CONST(23170.075586792263/8.0), - REAL_CONST(23186.527224432142/8.0), - REAL_CONST(23202.981780840448/8.0), - REAL_CONST(23219.439254982066/8.0), - REAL_CONST(23235.899645822796/8.0), - REAL_CONST(23252.362952329357/8.0), - REAL_CONST(23268.829173469378/8.0), - REAL_CONST(23285.298308211408/8.0), - REAL_CONST(23301.770355524899/8.0), - REAL_CONST(23318.245314380223/8.0), - REAL_CONST(23334.723183748658/8.0), - REAL_CONST(23351.203962602387/8.0), - REAL_CONST(23367.687649914504/8.0), - REAL_CONST(23384.174244659007/8.0), - REAL_CONST(23400.663745810798/8.0), - REAL_CONST(23417.15615234568/8.0), - REAL_CONST(23433.651463240367/8.0), - REAL_CONST(23450.149677472462/8.0), - REAL_CONST(23466.650794020472/8.0), - REAL_CONST(23483.154811863806/8.0), - REAL_CONST(23499.661729982763/8.0), - REAL_CONST(23516.171547358543/8.0), - REAL_CONST(23532.684262973235/8.0), - REAL_CONST(23549.199875809823/8.0), - REAL_CONST(23565.718384852185/8.0), - REAL_CONST(23582.239789085092/8.0), - REAL_CONST(23598.764087494197/8.0), - REAL_CONST(23615.291279066041/8.0), - REAL_CONST(23631.821362788058/8.0), - REAL_CONST(23648.354337648565/8.0), - REAL_CONST(23664.890202636761/8.0), - REAL_CONST(23681.428956742733/8.0), - REAL_CONST(23697.970598957443/8.0), - REAL_CONST(23714.515128272738/8.0), - REAL_CONST(23731.062543681343/8.0), - REAL_CONST(23747.612844176863/8.0), - REAL_CONST(23764.166028753778/8.0), - REAL_CONST(23780.72209640744/8.0), - REAL_CONST(23797.281046134085/8.0), - REAL_CONST(23813.842876930816/8.0), - REAL_CONST(23830.407587795606/8.0), - REAL_CONST(23846.975177727301/8.0), - REAL_CONST(23863.545645725622/8.0), - REAL_CONST(23880.11899079115/8.0), - REAL_CONST(23896.695211925336/8.0), - REAL_CONST(23913.274308130498/8.0), - REAL_CONST(23929.856278409821/8.0), - REAL_CONST(23946.441121767348/8.0), - REAL_CONST(23963.028837207989/8.0), - REAL_CONST(23979.619423737513/8.0), - REAL_CONST(23996.212880362549/8.0), - REAL_CONST(24012.809206090584/8.0), - REAL_CONST(24029.408399929966/8.0), - REAL_CONST(24046.010460889898/8.0), - REAL_CONST(24062.615387980433/8.0), - REAL_CONST(24079.223180212492/8.0), - REAL_CONST(24095.833836597827/8.0), - REAL_CONST(24112.447356149063/8.0), - REAL_CONST(24129.063737879667/8.0), - REAL_CONST(24145.682980803951/8.0), - REAL_CONST(24162.305083937081/8.0), - REAL_CONST(24178.930046295067/8.0), - REAL_CONST(24195.557866894767/8.0), - REAL_CONST(24212.188544753884/8.0), - REAL_CONST(24228.822078890964/8.0), - REAL_CONST(24245.458468325389/8.0), - REAL_CONST(24262.097712077397/8.0), - REAL_CONST(24278.739809168052/8.0), - REAL_CONST(24295.384758619261/8.0), - REAL_CONST(24312.032559453768/8.0), - REAL_CONST(24328.683210695162/8.0), - REAL_CONST(24345.336711367858/8.0), - REAL_CONST(24361.993060497109/8.0), - REAL_CONST(24378.652257108995/8.0), - REAL_CONST(24395.314300230442/8.0), - REAL_CONST(24411.979188889192/8.0), - REAL_CONST(24428.646922113825/8.0), - REAL_CONST(24445.317498933746/8.0), - REAL_CONST(24461.990918379193/8.0), - REAL_CONST(24478.667179481225/8.0), - REAL_CONST(24495.346281271726/8.0), - REAL_CONST(24512.028222783407/8.0), - REAL_CONST(24528.713003049801/8.0), - REAL_CONST(24545.400621105266/8.0), - REAL_CONST(24562.091075984976/8.0), - REAL_CONST(24578.784366724925/8.0), - REAL_CONST(24595.480492361927/8.0), - REAL_CONST(24612.179451933614/8.0), - REAL_CONST(24628.881244478438/8.0), - REAL_CONST(24645.585869035654/8.0), - REAL_CONST(24662.293324645343/8.0), - REAL_CONST(24679.003610348394/8.0), - REAL_CONST(24695.716725186514/8.0), - REAL_CONST(24712.432668202211/8.0), - REAL_CONST(24729.151438438807/8.0), - REAL_CONST(24745.873034940436/8.0), - REAL_CONST(24762.597456752032/8.0), - REAL_CONST(24779.324702919344/8.0), - REAL_CONST(24796.054772488926/8.0), - REAL_CONST(24812.787664508123/8.0), - REAL_CONST(24829.5233780251/8.0), - REAL_CONST(24846.261912088819/8.0), - REAL_CONST(24863.003265749034/8.0), - REAL_CONST(24879.747438056307/8.0), - REAL_CONST(24896.494428062004/8.0), - REAL_CONST(24913.244234818278/8.0), - REAL_CONST(24929.996857378079/8.0), - REAL_CONST(24946.752294795166/8.0), - REAL_CONST(24963.510546124078/8.0), - REAL_CONST(24980.271610420157/8.0), - REAL_CONST(24997.035486739525/8.0), - REAL_CONST(25013.802174139113/8.0), - REAL_CONST(25030.571671676629/8.0), - REAL_CONST(25047.343978410572/8.0), - REAL_CONST(25064.119093400237/8.0), - REAL_CONST(25080.897015705697/8.0), - REAL_CONST(25097.677744387816/8.0), - REAL_CONST(25114.461278508239/8.0), - REAL_CONST(25131.2476171294/8.0), - REAL_CONST(25148.036759314517/8.0), - REAL_CONST(25164.828704127583/8.0), - REAL_CONST(25181.623450633375/8.0), - REAL_CONST(25198.42099789745/8.0), - REAL_CONST(25215.221344986145/8.0), - REAL_CONST(25232.024490966574/8.0), - REAL_CONST(25248.830434906627/8.0), - REAL_CONST(25265.639175874974/8.0), - REAL_CONST(25282.450712941049/8.0), - REAL_CONST(25299.265045175071/8.0), - REAL_CONST(25316.082171648024/8.0), - REAL_CONST(25332.902091431668/8.0), - REAL_CONST(25349.724803598532/8.0), - REAL_CONST(25366.550307221914/8.0), - REAL_CONST(25383.378601375884/8.0), - REAL_CONST(25400.209685135269/8.0), - REAL_CONST(25417.043557575678/8.0), - REAL_CONST(25433.880217773472/8.0), - REAL_CONST(25450.719664805783/8.0), - REAL_CONST(25467.561897750507/8.0), - REAL_CONST(25484.406915686297/8.0), - REAL_CONST(25501.254717692573/8.0), - REAL_CONST(25518.105302849512/8.0), - REAL_CONST(25534.958670238051/8.0), - REAL_CONST(25551.814818939893/8.0), - REAL_CONST(25568.67374803748/8.0), - REAL_CONST(25585.535456614027/8.0), - REAL_CONST(25602.399943753502/8.0), - REAL_CONST(25619.267208540619/8.0), - REAL_CONST(25636.137250060852/8.0), - REAL_CONST(25653.010067400432/8.0), - REAL_CONST(25669.885659646327/8.0), - REAL_CONST(25686.76402588627/8.0), - REAL_CONST(25703.645165208734/8.0), - REAL_CONST(25720.529076702944/8.0), - REAL_CONST(25737.415759458876/8.0), - REAL_CONST(25754.305212567244/8.0), - REAL_CONST(25771.197435119517/8.0), - REAL_CONST(25788.092426207899/8.0), - REAL_CONST(25804.990184925344/8.0), - REAL_CONST(25821.890710365547/8.0), - REAL_CONST(25838.794001622944/8.0), - REAL_CONST(25855.700057792714/8.0), - REAL_CONST(25872.608877970775/8.0), - REAL_CONST(25889.520461253778/8.0), - REAL_CONST(25906.434806739118/8.0), - REAL_CONST(25923.351913524923/8.0), - REAL_CONST(25940.271780710063/8.0), - REAL_CONST(25957.194407394138/8.0), - REAL_CONST(25974.11979267748/8.0), - REAL_CONST(25991.047935661154/8.0), - REAL_CONST(26007.978835446964/8.0), - REAL_CONST(26024.912491137442/8.0), - REAL_CONST(26041.848901835841/8.0), - REAL_CONST(26058.788066646157/8.0), - REAL_CONST(26075.729984673108/8.0), - REAL_CONST(26092.674655022136/8.0), - REAL_CONST(26109.622076799409/8.0), - REAL_CONST(26126.572249111829/8.0), - REAL_CONST(26143.525171067016/8.0), - REAL_CONST(26160.480841773315/8.0), - REAL_CONST(26177.43926033979/8.0), - REAL_CONST(26194.400425876229/8.0), - REAL_CONST(26211.364337493149/8.0), - REAL_CONST(26228.330994301767/8.0), - REAL_CONST(26245.30039541404/8.0), - REAL_CONST(26262.272539942627/8.0), - REAL_CONST(26279.247427000919/8.0), - REAL_CONST(26296.225055703002/8.0), - REAL_CONST(26313.205425163702/8.0), - REAL_CONST(26330.188534498539/8.0), - REAL_CONST(26347.174382823756/8.0), - REAL_CONST(26364.162969256304/8.0), - REAL_CONST(26381.154292913852/8.0), - REAL_CONST(26398.148352914774/8.0), - REAL_CONST(26415.145148378149/8.0), - REAL_CONST(26432.144678423778/8.0), - REAL_CONST(26449.146942172156/8.0), - REAL_CONST(26466.151938744493/8.0), - REAL_CONST(26483.159667262702/8.0), - REAL_CONST(26500.170126849403/8.0), - REAL_CONST(26517.183316627921/8.0), - REAL_CONST(26534.199235722277/8.0), - REAL_CONST(26551.217883257199/8.0), - REAL_CONST(26568.239258358124/8.0), - REAL_CONST(26585.263360151173/8.0), - REAL_CONST(26602.290187763181/8.0), - REAL_CONST(26619.319740321676/8.0), - REAL_CONST(26636.352016954883/8.0), - REAL_CONST(26653.387016791727/8.0), - REAL_CONST(26670.424738961825/8.0), - REAL_CONST(26687.465182595493/8.0), - REAL_CONST(26704.508346823739/8.0), - REAL_CONST(26721.554230778267/8.0), - REAL_CONST(26738.602833591467/8.0), - REAL_CONST(26755.65415439643/8.0), - REAL_CONST(26772.708192326929/8.0), - REAL_CONST(26789.764946517433/8.0), - REAL_CONST(26806.824416103096/8.0), - REAL_CONST(26823.886600219761/8.0), - REAL_CONST(26840.95149800396/8.0), - REAL_CONST(26858.019108592915/8.0), - REAL_CONST(26875.089431124517/8.0), - REAL_CONST(26892.162464737365/8.0), - REAL_CONST(26909.238208570721/8.0), - REAL_CONST(26926.316661764544/8.0), - REAL_CONST(26943.397823459472/8.0), - REAL_CONST(26960.481692796813/8.0), - REAL_CONST(26977.568268918571/8.0), - REAL_CONST(26994.657550967422/8.0), - REAL_CONST(27011.749538086722/8.0), - REAL_CONST(27028.844229420498/8.0), - REAL_CONST(27045.941624113464/8.0), - REAL_CONST(27063.041721311005/8.0), - REAL_CONST(27080.144520159181/8.0), - REAL_CONST(27097.250019804727/8.0), - REAL_CONST(27114.35821939505/8.0), - REAL_CONST(27131.469118078236/8.0), - REAL_CONST(27148.582715003027/8.0), - REAL_CONST(27165.699009318858/8.0), - REAL_CONST(27182.818000175819/8.0), - REAL_CONST(27199.939686724665/8.0), - REAL_CONST(27217.064068116837/8.0), - REAL_CONST(27234.191143504428/8.0), - REAL_CONST(27251.320912040203/8.0), - REAL_CONST(27268.453372877593/8.0), - REAL_CONST(27285.588525170693/8.0), - REAL_CONST(27302.726368074269/8.0), - REAL_CONST(27319.866900743735/8.0), - REAL_CONST(27337.010122335181/8.0), - REAL_CONST(27354.156032005358/8.0), - REAL_CONST(27371.304628911668/8.0), - REAL_CONST(27388.455912212183/8.0), - REAL_CONST(27405.609881065626/8.0), - REAL_CONST(27422.766534631384/8.0), - REAL_CONST(27439.925872069507/8.0), - REAL_CONST(27457.087892540683/8.0), - REAL_CONST(27474.252595206275/8.0), - REAL_CONST(27491.419979228293/8.0), - REAL_CONST(27508.5900437694/8.0), - REAL_CONST(27525.762787992917/8.0), - REAL_CONST(27542.93821106281/8.0), - REAL_CONST(27560.116312143706/8.0), - REAL_CONST(27577.297090400876/8.0), - REAL_CONST(27594.480545000242/8.0), - REAL_CONST(27611.666675108383/8.0), - REAL_CONST(27628.855479892518/8.0), - REAL_CONST(27646.046958520514/8.0), - REAL_CONST(27663.241110160889/8.0), - REAL_CONST(27680.437933982801/8.0), - REAL_CONST(27697.637429156068/8.0), - REAL_CONST(27714.839594851132/8.0), - REAL_CONST(27732.04443023909/8.0), - REAL_CONST(27749.251934491687/8.0), - REAL_CONST(27766.462106781299/8.0), - REAL_CONST(27783.674946280949/8.0), - REAL_CONST(27800.890452164302/8.0), - REAL_CONST(27818.108623605654/8.0), - REAL_CONST(27835.329459779954/8.0), - REAL_CONST(27852.55295986278/8.0), - REAL_CONST(27869.779123030345/8.0), - REAL_CONST(27887.007948459504/8.0), - REAL_CONST(27904.239435327745/8.0), - REAL_CONST(27921.473582813196/8.0), - REAL_CONST(27938.710390094613/8.0), - REAL_CONST(27955.949856351392/8.0), - REAL_CONST(27973.19198076355/8.0), - REAL_CONST(27990.436762511745/8.0), - REAL_CONST(28007.684200777272/8.0), - REAL_CONST(28024.934294742041/8.0), - REAL_CONST(28042.187043588601/8.0), - REAL_CONST(28059.442446500128/8.0), - REAL_CONST(28076.700502660427/8.0), - REAL_CONST(28093.961211253929/8.0), - REAL_CONST(28111.224571465693/8.0), - REAL_CONST(28128.490582481401/8.0), - REAL_CONST(28145.759243487362/8.0), - REAL_CONST(28163.030553670509/8.0), - REAL_CONST(28180.304512218394/8.0), - REAL_CONST(28197.581118319198/8.0), - REAL_CONST(28214.860371161725/8.0), - REAL_CONST(28232.14226993539/8.0), - REAL_CONST(28249.42681383024/8.0), - REAL_CONST(28266.71400203693/8.0), - REAL_CONST(28284.003833746745/8.0), - REAL_CONST(28301.296308151585/8.0), - REAL_CONST(28318.591424443959/8.0), - REAL_CONST(28335.889181817001/8.0), - REAL_CONST(28353.189579464462/8.0), - REAL_CONST(28370.492616580705/8.0), - REAL_CONST(28387.798292360701/8.0), - REAL_CONST(28405.106606000048/8.0), - REAL_CONST(28422.417556694945/8.0), - REAL_CONST(28439.731143642206/8.0), - REAL_CONST(28457.047366039264/8.0), - REAL_CONST(28474.366223084147/8.0), - REAL_CONST(28491.687713975512/8.0), - REAL_CONST(28509.011837912611/8.0), - REAL_CONST(28526.338594095305/8.0), - REAL_CONST(28543.667981724069/8.0), - REAL_CONST(28560.999999999982/8.0), - REAL_CONST(28578.334648124732/8.0), - REAL_CONST(28595.671925300605/8.0), - REAL_CONST(28613.011830730498/8.0), - REAL_CONST(28630.354363617909/8.0), - REAL_CONST(28647.699523166943/8.0), - REAL_CONST(28665.0473085823/8.0), - REAL_CONST(28682.397719069289/8.0), - REAL_CONST(28699.750753833818/8.0), - REAL_CONST(28717.10641208239/8.0), - REAL_CONST(28734.464693022121/8.0), - REAL_CONST(28751.825595860708/8.0), - REAL_CONST(28769.189119806462/8.0), - REAL_CONST(28786.55526406828/8.0), - REAL_CONST(28803.924027855664/8.0), - REAL_CONST(28821.295410378701/8.0), - REAL_CONST(28838.669410848088/8.0), - REAL_CONST(28856.046028475103/8.0), - REAL_CONST(28873.425262471628/8.0), - REAL_CONST(28890.80711205013/8.0), - REAL_CONST(28908.191576423673/8.0), - REAL_CONST(28925.578654805915/8.0), - REAL_CONST(28942.968346411097/8.0), - REAL_CONST(28960.360650454055/8.0), - REAL_CONST(28977.755566150216/8.0), - REAL_CONST(28995.153092715591/8.0), - REAL_CONST(29012.553229366786/8.0), - REAL_CONST(29029.955975320987/8.0), - REAL_CONST(29047.361329795975/8.0), - REAL_CONST(29064.769292010107/8.0), - REAL_CONST(29082.179861182336/8.0), - REAL_CONST(29099.593036532187/8.0), - REAL_CONST(29117.00881727978/8.0), - REAL_CONST(29134.427202645813/8.0), - REAL_CONST(29151.848191851568/8.0), - REAL_CONST(29169.271784118911/8.0), - REAL_CONST(29186.697978670283/8.0), - REAL_CONST(29204.126774728706/8.0), - REAL_CONST(29221.55817151779/8.0), - REAL_CONST(29238.992168261717/8.0), - REAL_CONST(29256.42876418525/8.0), - REAL_CONST(29273.867958513725/8.0), - REAL_CONST(29291.309750473058/8.0), - REAL_CONST(29308.754139289747/8.0), - REAL_CONST(29326.201124190855/8.0), - REAL_CONST(29343.65070440403/8.0), - REAL_CONST(29361.102879157483/8.0), - REAL_CONST(29378.557647680012/8.0), - REAL_CONST(29396.015009200975/8.0), - REAL_CONST(29413.474962950309/8.0), - REAL_CONST(29430.937508158524/8.0), - REAL_CONST(29448.402644056692/8.0), - REAL_CONST(29465.870369876469/8.0), - REAL_CONST(29483.340684850071/8.0), - REAL_CONST(29500.81358821028/8.0), - REAL_CONST(29518.289079190454/8.0), - REAL_CONST(29535.767157024511/8.0), - REAL_CONST(29553.247820946945/8.0), - REAL_CONST(29570.731070192807/8.0), - REAL_CONST(29588.216903997723/8.0), - REAL_CONST(29605.70532159787/8.0), - REAL_CONST(29623.19632223/8.0), - REAL_CONST(29640.689905131429/8.0), - REAL_CONST(29658.186069540028/8.0), - REAL_CONST(29675.684814694236/8.0), - REAL_CONST(29693.186139833047/8.0), - REAL_CONST(29710.690044196028/8.0), - REAL_CONST(29728.196527023298/8.0), - REAL_CONST(29745.705587555527/8.0), - REAL_CONST(29763.217225033964/8.0), - REAL_CONST(29780.731438700397/8.0), - REAL_CONST(29798.248227797183/8.0), - REAL_CONST(29815.76759156723/8.0), - REAL_CONST(29833.289529254005/8.0), - REAL_CONST(29850.81404010153/8.0), - REAL_CONST(29868.341123354381/8.0), - REAL_CONST(29885.870778257693/8.0), - REAL_CONST(29903.403004057145/8.0), - REAL_CONST(29920.937799998974/8.0), - REAL_CONST(29938.475165329975/8.0), - REAL_CONST(29956.015099297485/8.0), - REAL_CONST(29973.557601149394/8.0), - REAL_CONST(29991.102670134147/8.0), - REAL_CONST(30008.650305500738/8.0), - REAL_CONST(30026.200506498706/8.0), - REAL_CONST(30043.753272378144/8.0), - REAL_CONST(30061.308602389683/8.0), - REAL_CONST(30078.866495784507/8.0), - REAL_CONST(30096.426951814352/8.0), - REAL_CONST(30113.989969731494/8.0), - REAL_CONST(30131.55554878875/8.0), - REAL_CONST(30149.123688239491/8.0), - REAL_CONST(30166.694387337629/8.0), - REAL_CONST(30184.267645337608/8.0), - REAL_CONST(30201.843461494434/8.0), - REAL_CONST(30219.42183506364/8.0), - REAL_CONST(30237.002765301309/8.0), - REAL_CONST(30254.586251464058/8.0), - REAL_CONST(30272.172292809046/8.0), - REAL_CONST(30289.760888593977/8.0), - REAL_CONST(30307.35203807709/8.0), - REAL_CONST(30324.94574051716/8.0), - REAL_CONST(30342.541995173502/8.0), - REAL_CONST(30360.140801305966/8.0), - REAL_CONST(30377.742158174944/8.0), - REAL_CONST(30395.346065041358/8.0), - REAL_CONST(30412.952521166666/8.0), - REAL_CONST(30430.561525812864/8.0), - REAL_CONST(30448.173078242475/8.0), - REAL_CONST(30465.787177718561/8.0), - REAL_CONST(30483.403823504719/8.0), - REAL_CONST(30501.02301486507/8.0), - REAL_CONST(30518.644751064272/8.0), - REAL_CONST(30536.269031367516/8.0), - REAL_CONST(30553.895855040515/8.0), - REAL_CONST(30571.525221349519/8.0), - REAL_CONST(30589.157129561307/8.0), - REAL_CONST(30606.791578943175/8.0), - REAL_CONST(30624.428568762964/8.0), - REAL_CONST(30642.06809828903/8.0), - REAL_CONST(30659.710166790261/8.0), - REAL_CONST(30677.35477353607/8.0), - REAL_CONST(30695.001917796391/8.0), - REAL_CONST(30712.651598841687/8.0), - REAL_CONST(30730.303815942945/8.0), - REAL_CONST(30747.958568371676/8.0), - REAL_CONST(30765.615855399912/8.0), - REAL_CONST(30783.275676300211/8.0), - REAL_CONST(30800.938030345646/8.0), - REAL_CONST(30818.602916809814/8.0), - REAL_CONST(30836.270334966837/8.0), - REAL_CONST(30853.940284091354/8.0), - REAL_CONST(30871.612763458521/8.0), - REAL_CONST(30889.287772344011/8.0), - REAL_CONST(30906.965310024025/8.0), - REAL_CONST(30924.645375775272/8.0), - REAL_CONST(30942.327968874983/8.0), - REAL_CONST(30960.013088600903/8.0), - REAL_CONST(30977.700734231294/8.0), - REAL_CONST(30995.390905044929/8.0), - REAL_CONST(31013.083600321101/8.0), - REAL_CONST(31030.778819339619/8.0), - REAL_CONST(31048.476561380798/8.0), - REAL_CONST(31066.17682572547/8.0), - REAL_CONST(31083.879611654978/8.0), - REAL_CONST(31101.584918451179/8.0), - REAL_CONST(31119.29274539644/8.0), - REAL_CONST(31137.003091773637/8.0), - REAL_CONST(31154.715956866155/8.0), - REAL_CONST(31172.431339957893/8.0), - REAL_CONST(31190.14924033326/8.0), - REAL_CONST(31207.869657277162/8.0), - REAL_CONST(31225.592590075023/8.0), - REAL_CONST(31243.318038012771/8.0), - REAL_CONST(31261.046000376838/8.0), - REAL_CONST(31278.776476454172/8.0), - REAL_CONST(31296.50946553221/8.0), - REAL_CONST(31314.24496689891/8.0), - REAL_CONST(31331.98297984272/8.0), - REAL_CONST(31349.7235036526/8.0), - REAL_CONST(31367.466537618013/8.0), - REAL_CONST(31385.212081028923/8.0), - REAL_CONST(31402.960133175795/8.0), - REAL_CONST(31420.710693349596/8.0), - REAL_CONST(31438.463760841791/8.0), - REAL_CONST(31456.219334944351/8.0), - REAL_CONST(31473.977414949743/8.0), - REAL_CONST(31491.738000150934/8.0), - REAL_CONST(31509.501089841389/8.0), - REAL_CONST(31527.266683315069/8.0), - REAL_CONST(31545.034779866437/8.0), - REAL_CONST(31562.80537879045/8.0), - REAL_CONST(31580.578479382562/8.0), - REAL_CONST(31598.35408093872/8.0), - REAL_CONST(31616.132182755369/8.0), - REAL_CONST(31633.91278412945/8.0), - REAL_CONST(31651.695884358396/8.0), - REAL_CONST(31669.481482740131/8.0), - REAL_CONST(31687.269578573076/8.0), - REAL_CONST(31705.060171156143/8.0), - REAL_CONST(31722.853259788735/8.0), - REAL_CONST(31740.648843770748/8.0), - REAL_CONST(31758.446922402567/8.0), - REAL_CONST(31776.247494985066/8.0), - REAL_CONST(31794.050560819614/8.0), - REAL_CONST(31811.85611920806/8.0), - REAL_CONST(31829.664169452753/8.0), - REAL_CONST(31847.474710856521/8.0), - REAL_CONST(31865.287742722685/8.0), - REAL_CONST(31883.103264355046/8.0), - REAL_CONST(31900.921275057899/8.0), - REAL_CONST(31918.741774136019/8.0), - REAL_CONST(31936.564760894671/8.0), - REAL_CONST(31954.390234639599/8.0), - REAL_CONST(31972.21819467704/8.0), - REAL_CONST(31990.048640313704/8.0), - REAL_CONST(32007.881570856793/8.0), - REAL_CONST(32025.716985613984/8.0), - REAL_CONST(32043.554883893445/8.0), - REAL_CONST(32061.395265003815/8.0), - REAL_CONST(32079.238128254223/8.0), - REAL_CONST(32097.083472954269/8.0), - REAL_CONST(32114.931298414049/8.0), - REAL_CONST(32132.781603944117/8.0), - REAL_CONST(32150.634388855524/8.0), - REAL_CONST(32168.48965245979/8.0), - REAL_CONST(32186.347394068915/8.0), - REAL_CONST(32204.207612995371/8.0), - REAL_CONST(32222.07030855212/8.0), - REAL_CONST(32239.935480052583/8.0), - REAL_CONST(32257.803126810672/8.0), - REAL_CONST(32275.673248140767/8.0), - REAL_CONST(32293.545843357719/8.0), - REAL_CONST(32311.420911776862/8.0), - REAL_CONST(32329.298452713996/8.0), - REAL_CONST(32347.178465485395/8.0), - REAL_CONST(32365.060949407813/8.0), - REAL_CONST(32382.945903798463/8.0), - REAL_CONST(32400.83332797504/8.0), - REAL_CONST(32418.723221255706/8.0), - REAL_CONST(32436.615582959093/8.0), - REAL_CONST(32454.510412404306/8.0), - REAL_CONST(32472.407708910916/8.0), - REAL_CONST(32490.307471798966/8.0), - REAL_CONST(32508.209700388961/8.0), - REAL_CONST(32526.114394001877/8.0), - REAL_CONST(32544.021551959166/8.0), - REAL_CONST(32561.931173582732/8.0), - REAL_CONST(32579.843258194956/8.0), - REAL_CONST(32597.757805118679/8.0), - REAL_CONST(32615.674813677211/8.0), - REAL_CONST(32633.594283194328/8.0), - REAL_CONST(32651.516212994258/8.0), - REAL_CONST(32669.440602401712/8.0), - REAL_CONST(32687.367450741847/8.0), - REAL_CONST(32705.296757340297/8.0), - REAL_CONST(32723.228521523146/8.0), - REAL_CONST(32741.162742616943/8.0), - REAL_CONST(32759.099419948703/8.0), - REAL_CONST(32777.038552845901/8.0), - REAL_CONST(32794.980140636464/8.0), - REAL_CONST(32812.924182648792/8.0), - REAL_CONST(32830.87067821173/8.0), - REAL_CONST(32848.819626654593/8.0), - REAL_CONST(32866.77102730715/8.0), - REAL_CONST(32884.724879499619/8.0), - REAL_CONST(32902.681182562686/8.0), - REAL_CONST(32920.639935827494/8.0), - REAL_CONST(32938.601138625643/8.0), - REAL_CONST(32956.56479028918/8.0), - REAL_CONST(32974.530890150607/8.0), - REAL_CONST(32992.499437542894/8.0), - REAL_CONST(33010.470431799447/8.0), - REAL_CONST(33028.443872254145/8.0), - REAL_CONST(33046.419758241311/8.0), - REAL_CONST(33064.39808909571/8.0), - REAL_CONST(33082.378864152583/8.0), - REAL_CONST(33100.36208274759/8.0), - REAL_CONST(33118.347744216881/8.0), - REAL_CONST(33136.335847897026/8.0), - REAL_CONST(33154.326393125062/8.0), - REAL_CONST(33172.31937923847/8.0), - REAL_CONST(33190.314805575174/8.0), - REAL_CONST(33208.312671473555/8.0), - REAL_CONST(33226.312976272442/8.0), - REAL_CONST(33244.315719311111/8.0), - REAL_CONST(33262.320899929284/8.0), - REAL_CONST(33280.328517467125/8.0), - REAL_CONST(33298.33857126526/8.0), - REAL_CONST(33316.351060664747/8.0), - REAL_CONST(33334.365985007091/8.0), - REAL_CONST(33352.383343634239/8.0), - REAL_CONST(33370.403135888591/8.0), - REAL_CONST(33388.42536111299/8.0), - REAL_CONST(33406.450018650721/8.0), - REAL_CONST(33424.477107845501/8.0), - REAL_CONST(33442.506628041512/8.0), - REAL_CONST(33460.53857858335/8.0), - REAL_CONST(33478.572958816083/8.0), - REAL_CONST(33496.609768085189/8.0), - REAL_CONST(33514.649005736617/8.0), - REAL_CONST(33532.690671116739/8.0), - REAL_CONST(33550.734763572356/8.0), - REAL_CONST(33568.781282450735/8.0), - REAL_CONST(33586.830227099563/8.0), - REAL_CONST(33604.881596866973/8.0), - REAL_CONST(33622.935391101528/8.0), - REAL_CONST(33640.991609152239/8.0), - REAL_CONST(33659.050250368542/8.0), - REAL_CONST(33677.111314100322/8.0), - REAL_CONST(33695.174799697881/8.0), - REAL_CONST(33713.240706511984/8.0), - REAL_CONST(33731.309033893805/8.0), - REAL_CONST(33749.37978119497/8.0), - REAL_CONST(33767.452947767531/8.0), - REAL_CONST(33785.528532963974/8.0), - REAL_CONST(33803.606536137209/8.0), - REAL_CONST(33821.686956640602/8.0), - REAL_CONST(33839.769793827938/8.0), - REAL_CONST(33857.855047053425/8.0), - REAL_CONST(33875.942715671707/8.0), - REAL_CONST(33894.032799037872/8.0), - REAL_CONST(33912.125296507431/8.0), - REAL_CONST(33930.220207436316/8.0), - REAL_CONST(33948.317531180888/8.0), - REAL_CONST(33966.417267097961/8.0), - REAL_CONST(33984.519414544746/8.0), - REAL_CONST(34002.623972878901/8.0), - REAL_CONST(34020.730941458511/8.0), - REAL_CONST(34038.840319642077/8.0), - REAL_CONST(34056.952106788536/8.0), - REAL_CONST(34075.066302257255/8.0), - REAL_CONST(34093.182905408015/8.0), - REAL_CONST(34111.301915601027/8.0), - REAL_CONST(34129.42333219693/8.0), - REAL_CONST(34147.547154556785/8.0), - REAL_CONST(34165.673382042078/8.0), - REAL_CONST(34183.80201401472/8.0), - REAL_CONST(34201.933049837033/8.0), - REAL_CONST(34220.06648887178/8.0), - REAL_CONST(34238.202330482141/8.0), - REAL_CONST(34256.340574031703/8.0), - REAL_CONST(34274.481218884495/8.0), - REAL_CONST(34292.624264404949/8.0), - REAL_CONST(34310.769709957938/8.0), - REAL_CONST(34328.91755490873/8.0), - REAL_CONST(34347.067798623029/8.0), - REAL_CONST(34365.220440466954/8.0), - REAL_CONST(34383.375479807051/8.0), - REAL_CONST(34401.532916010263/8.0), - REAL_CONST(34419.692748443973/8.0), - REAL_CONST(34437.854976475966/8.0), - REAL_CONST(34456.01959947445/8.0), - REAL_CONST(34474.18661680806/8.0), - REAL_CONST(34492.356027845817/8.0), - REAL_CONST(34510.527831957188/8.0), - REAL_CONST(34528.702028512052/8.0), - REAL_CONST(34546.878616880676/8.0), - REAL_CONST(34565.05759643377/8.0), - REAL_CONST(34583.238966542449/8.0), - REAL_CONST(34601.422726578232/8.0), - REAL_CONST(34619.608875913065/8.0), - REAL_CONST(34637.797413919296/8.0), - REAL_CONST(34655.988339969692/8.0), - REAL_CONST(34674.181653437423/8.0), - REAL_CONST(34692.37735369608/8.0), - REAL_CONST(34710.575440119668/8.0), - REAL_CONST(34728.775912082579/8.0), - REAL_CONST(34746.978768959649/8.0), - REAL_CONST(34765.184010126082/8.0), - REAL_CONST(34783.391634957537/8.0), - REAL_CONST(34801.60164283005/8.0), - REAL_CONST(34819.814033120063/8.0), - REAL_CONST(34838.028805204456/8.0), - REAL_CONST(34856.24595846048/8.0), - REAL_CONST(34874.465492265823/8.0), - REAL_CONST(34892.687405998557/8.0), - REAL_CONST(34910.911699037177/8.0), - REAL_CONST(34929.138370760564/8.0), - REAL_CONST(34947.367420548027/8.0), - REAL_CONST(34965.598847779271/8.0), - REAL_CONST(34983.832651834389/8.0), - REAL_CONST(35002.068832093908/8.0), - REAL_CONST(35020.307387938738/8.0), - REAL_CONST(35038.548318750189/8.0), - REAL_CONST(35056.79162390998/8.0), - REAL_CONST(35075.03730280025/8.0), - REAL_CONST(35093.285354803513/8.0), - REAL_CONST(35111.535779302685/8.0), - REAL_CONST(35129.788575681116/8.0), - REAL_CONST(35148.043743322516/8.0), - REAL_CONST(35166.301281611013/8.0), - REAL_CONST(35184.561189931141/8.0), - REAL_CONST(35202.823467667826/8.0), - REAL_CONST(35221.088114206388/8.0), - REAL_CONST(35239.355128932555/8.0), - REAL_CONST(35257.624511232447/8.0), - REAL_CONST(35275.896260492584/8.0), - REAL_CONST(35294.170376099886/8.0), - REAL_CONST(35312.446857441668/8.0), - REAL_CONST(35330.725703905628/8.0), - REAL_CONST(35349.006914879887/8.0), - REAL_CONST(35367.290489752944/8.0), - REAL_CONST(35385.576427913686/8.0), - REAL_CONST(35403.864728751418/8.0), - REAL_CONST(35422.155391655811/8.0), - REAL_CONST(35440.448416016967/8.0), - REAL_CONST(35458.743801225341/8.0), - REAL_CONST(35477.041546671804/8.0), - REAL_CONST(35495.341651747622/8.0), - REAL_CONST(35513.644115844436/8.0), - REAL_CONST(35531.948938354304/8.0), - REAL_CONST(35550.256118669655/8.0), - REAL_CONST(35568.565656183309/8.0), - REAL_CONST(35586.877550288496/8.0), - REAL_CONST(35605.191800378816/8.0), - REAL_CONST(35623.508405848268/8.0), - REAL_CONST(35641.827366091238/8.0), - REAL_CONST(35660.148680502505/8.0), - REAL_CONST(35678.472348477233/8.0), - REAL_CONST(35696.798369410979/8.0), - REAL_CONST(35715.126742699678/8.0), - REAL_CONST(35733.457467739659/8.0), - REAL_CONST(35751.790543927644/8.0), - REAL_CONST(35770.125970660738/8.0), - REAL_CONST(35788.46374733642/8.0), - REAL_CONST(35806.803873352568/8.0), - REAL_CONST(35825.146348107453/8.0), - REAL_CONST(35843.49117099971/8.0), - REAL_CONST(35861.838341428367/8.0), - REAL_CONST(35880.187858792851/8.0), - REAL_CONST(35898.539722492955/8.0), - REAL_CONST(35916.893931928862/8.0), - REAL_CONST(35935.250486501129/8.0), - REAL_CONST(35953.609385610718/8.0), - REAL_CONST(35971.970628658957/8.0), - REAL_CONST(35990.334215047558/8.0), - REAL_CONST(36008.700144178612/8.0), - REAL_CONST(36027.068415454596/8.0), - REAL_CONST(36045.439028278372/8.0), - REAL_CONST(36063.811982053165/8.0), - REAL_CONST(36082.187276182609/8.0), - REAL_CONST(36100.564910070694/8.0), - REAL_CONST(36118.944883121789/8.0), - REAL_CONST(36137.327194740654/8.0), - REAL_CONST(36155.711844332429/8.0), - REAL_CONST(36174.098831302617/8.0), - REAL_CONST(36192.488155057115/8.0), - REAL_CONST(36210.87981500219/8.0), - REAL_CONST(36229.273810544473/8.0), - REAL_CONST(36247.670141091003/8.0), - REAL_CONST(36266.068806049167/8.0), - REAL_CONST(36284.469804826738/8.0), - REAL_CONST(36302.873136831862/8.0), - REAL_CONST(36321.278801473069/8.0), - REAL_CONST(36339.686798159251/8.0), - REAL_CONST(36358.097126299683/8.0), - REAL_CONST(36376.509785304013/8.0), - REAL_CONST(36394.924774582258/8.0), - REAL_CONST(36413.342093544816/8.0), - REAL_CONST(36431.761741602444/8.0), - REAL_CONST(36450.183718166292/8.0), - REAL_CONST(36468.608022647859/8.0), - REAL_CONST(36487.034654459028/8.0), - REAL_CONST(36505.463613012063/8.0), - REAL_CONST(36523.894897719583/8.0), - REAL_CONST(36542.328507994578/8.0), - REAL_CONST(36560.764443250409/8.0), - REAL_CONST(36579.202702900831/8.0), - REAL_CONST(36597.643286359926/8.0), - REAL_CONST(36616.086193042182/8.0), - REAL_CONST(36634.531422362437/8.0), - REAL_CONST(36652.978973735895/8.0), - REAL_CONST(36671.428846578143/8.0), - REAL_CONST(36689.881040305125/8.0), - REAL_CONST(36708.335554333149/8.0), - REAL_CONST(36726.792388078902/8.0), - REAL_CONST(36745.251540959427/8.0), - REAL_CONST(36763.713012392138/8.0), - REAL_CONST(36782.176801794812/8.0), - REAL_CONST(36800.642908585593/8.0), - REAL_CONST(36819.111332182983/8.0), - REAL_CONST(36837.582072005869/8.0), - REAL_CONST(36856.055127473483/8.0), - REAL_CONST(36874.530498005421/8.0), - REAL_CONST(36893.008183021651/8.0), - REAL_CONST(36911.488181942506/8.0), - REAL_CONST(36929.970494188674/8.0), - REAL_CONST(36948.455119181206/8.0), - REAL_CONST(36966.942056341519/8.0), - REAL_CONST(36985.431305091392/8.0), - REAL_CONST(37003.922864852961/8.0), - REAL_CONST(37022.416735048733/8.0), - REAL_CONST(37040.912915101559/8.0), - REAL_CONST(37059.411404434657/8.0), - REAL_CONST(37077.91220247162/8.0), - REAL_CONST(37096.415308636388/8.0), - REAL_CONST(37114.920722353243/8.0), - REAL_CONST(37133.428443046862/8.0), - REAL_CONST(37151.938470142253/8.0), - REAL_CONST(37170.450803064785/8.0), - REAL_CONST(37188.965441240209/8.0), - REAL_CONST(37207.482384094597/8.0), - REAL_CONST(37226.001631054402/8.0), - REAL_CONST(37244.523181546429/8.0), - REAL_CONST(37263.047034997842/8.0), - REAL_CONST(37281.573190836149/8.0), - REAL_CONST(37300.101648489224/8.0), - REAL_CONST(37318.632407385296/8.0), - REAL_CONST(37337.165466952945/8.0), - REAL_CONST(37355.700826621112/8.0), - REAL_CONST(37374.238485819085/8.0), - REAL_CONST(37392.778443976509/8.0), - REAL_CONST(37411.320700523385/8.0), - REAL_CONST(37429.865254890057/8.0), - REAL_CONST(37448.412106507232/8.0), - REAL_CONST(37466.961254805974/8.0), - REAL_CONST(37485.512699217681/8.0), - REAL_CONST(37504.066439174116/8.0), - REAL_CONST(37522.622474107404/8.0), - REAL_CONST(37541.180803449992/8.0), - REAL_CONST(37559.741426634704/8.0), - REAL_CONST(37578.304343094693/8.0), - REAL_CONST(37596.869552263488/8.0), - REAL_CONST(37615.43705357494/8.0), - REAL_CONST(37634.006846463279/8.0), - REAL_CONST(37652.578930363044/8.0), - REAL_CONST(37671.153304709165/8.0), - REAL_CONST(37689.729968936896/8.0), - REAL_CONST(37708.308922481847/8.0), - REAL_CONST(37726.890164779965/8.0), - REAL_CONST(37745.473695267559/8.0), - REAL_CONST(37764.059513381275/8.0), - REAL_CONST(37782.647618558112/8.0), - REAL_CONST(37801.238010235415/8.0), - REAL_CONST(37819.830687850859/8.0), - REAL_CONST(37838.425650842495/8.0), - REAL_CONST(37857.022898648691/8.0), - REAL_CONST(37875.622430708172/8.0), - REAL_CONST(37894.224246460013/8.0), - REAL_CONST(37912.828345343616/8.0), - REAL_CONST(37931.434726798747/8.0), - REAL_CONST(37950.043390265506/8.0), - REAL_CONST(37968.654335184328/8.0), - REAL_CONST(37987.267560995999/8.0), - REAL_CONST(38005.883067141665/8.0), - REAL_CONST(38024.500853062775/8.0), - REAL_CONST(38043.120918201159/8.0), - REAL_CONST(38061.743261998963/8.0), - REAL_CONST(38080.367883898682/8.0), - REAL_CONST(38098.994783343158/8.0), - REAL_CONST(38117.623959775563/8.0), - REAL_CONST(38136.255412639417/8.0), - REAL_CONST(38154.889141378575/8.0), - REAL_CONST(38173.525145437234/8.0), - REAL_CONST(38192.163424259939/8.0), - REAL_CONST(38210.803977291551/8.0), - REAL_CONST(38229.446803977284/8.0), - REAL_CONST(38248.091903762703/8.0), - REAL_CONST(38266.739276093685/8.0), - REAL_CONST(38285.388920416466/8.0), - REAL_CONST(38304.040836177606/8.0), - REAL_CONST(38322.695022824002/8.0), - REAL_CONST(38341.351479802899/8.0), - REAL_CONST(38360.010206561863/8.0), - REAL_CONST(38378.671202548816/8.0), - REAL_CONST(38397.334467211993/8.0), - REAL_CONST(38415.999999999978/8.0), - REAL_CONST(38434.667800361683/8.0), - REAL_CONST(38453.33786774637/8.0), - REAL_CONST(38472.010201603611/8.0), - REAL_CONST(38490.684801383337/8.0), - REAL_CONST(38509.361666535784/8.0), - REAL_CONST(38528.040796511552/8.0), - REAL_CONST(38546.722190761553/8.0), - REAL_CONST(38565.405848737035/8.0), - REAL_CONST(38584.091769889594/8.0), - REAL_CONST(38602.779953671132/8.0), - REAL_CONST(38621.470399533908/8.0), - REAL_CONST(38640.163106930493/8.0), - REAL_CONST(38658.858075313794/8.0), - REAL_CONST(38677.555304137059/8.0), - REAL_CONST(38696.254792853862/8.0), - REAL_CONST(38714.956540918094/8.0), - REAL_CONST(38733.660547783991/8.0), - REAL_CONST(38752.366812906112/8.0), - REAL_CONST(38771.075335739348/8.0), - REAL_CONST(38789.78611573892/8.0), - REAL_CONST(38808.499152360368/8.0), - REAL_CONST(38827.214445059573/8.0), - REAL_CONST(38845.931993292739/8.0), - REAL_CONST(38864.651796516388/8.0), - REAL_CONST(38883.373854187383/8.0), - REAL_CONST(38902.098165762916/8.0), - REAL_CONST(38920.824730700486/8.0), - REAL_CONST(38939.553548457938/8.0), - REAL_CONST(38958.284618493431/8.0), - REAL_CONST(38977.017940265461/8.0), - REAL_CONST(38995.753513232834/8.0), - REAL_CONST(39014.491336854699/8.0), - REAL_CONST(39033.231410590517/8.0), - REAL_CONST(39051.973733900079/8.0), - REAL_CONST(39070.718306243485/8.0), - REAL_CONST(39089.465127081188/8.0), - REAL_CONST(39108.214195873945/8.0), - REAL_CONST(39126.965512082832/8.0), - REAL_CONST(39145.719075169261/8.0), - REAL_CONST(39164.474884594965/8.0), - REAL_CONST(39183.232939821988/8.0), - REAL_CONST(39201.99324031271/8.0), - REAL_CONST(39220.755785529815/8.0), - REAL_CONST(39239.52057493633/8.0), - REAL_CONST(39258.287607995589/8.0), - REAL_CONST(39277.056884171245/8.0), - REAL_CONST(39295.828402927284/8.0), - REAL_CONST(39314.602163728006/8.0), - REAL_CONST(39333.378166038019/8.0), - REAL_CONST(39352.15640932227/8.0), - REAL_CONST(39370.936893046004/8.0), - REAL_CONST(39389.719616674811/8.0), - REAL_CONST(39408.504579674584/8.0), - REAL_CONST(39427.291781511522/8.0), - REAL_CONST(39446.081221652174/8.0), - REAL_CONST(39464.872899563372/8.0), - REAL_CONST(39483.666814712291/8.0), - REAL_CONST(39502.462966566411/8.0), - REAL_CONST(39521.261354593538/8.0), - REAL_CONST(39540.06197826178/8.0), - REAL_CONST(39558.864837039568/8.0), - REAL_CONST(39577.669930395656/8.0), - REAL_CONST(39596.47725779911/8.0), - REAL_CONST(39615.286818719302/8.0), - REAL_CONST(39634.098612625923/8.0), - REAL_CONST(39652.912638988993/8.0), - REAL_CONST(39671.728897278823/8.0), - REAL_CONST(39690.547386966064/8.0), - REAL_CONST(39709.368107521652/8.0), - REAL_CONST(39728.191058416858/8.0), - REAL_CONST(39747.016239123259/8.0), - REAL_CONST(39765.84364911275/8.0), - REAL_CONST(39784.673287857528/8.0), - REAL_CONST(39803.505154830105/8.0), - REAL_CONST(39822.339249503319/8.0), - REAL_CONST(39841.175571350293/8.0), - REAL_CONST(39860.014119844491/8.0), - REAL_CONST(39878.854894459677/8.0), - REAL_CONST(39897.697894669909/8.0), - REAL_CONST(39916.54311994958/8.0), - REAL_CONST(39935.390569773372/8.0), - REAL_CONST(39954.240243616303/8.0), - REAL_CONST(39973.092140953675/8.0), - REAL_CONST(39991.946261261117/8.0), - REAL_CONST(40010.802604014549/8.0), - REAL_CONST(40029.661168690225/8.0), - REAL_CONST(40048.521954764678/8.0), - REAL_CONST(40067.384961714779/8.0), - REAL_CONST(40086.250189017679/8.0), - REAL_CONST(40105.117636150855/8.0), - REAL_CONST(40123.98730259209/8.0), - REAL_CONST(40142.859187819471/8.0), - REAL_CONST(40161.733291311379/8.0), - REAL_CONST(40180.609612546526/8.0), - REAL_CONST(40199.488151003912/8.0), - REAL_CONST(40218.368906162854/8.0), - REAL_CONST(40237.25187750296/8.0), - REAL_CONST(40256.137064504153/8.0), - REAL_CONST(40275.024466646668/8.0), - REAL_CONST(40293.914083411029/8.0), - REAL_CONST(40312.805914278084/8.0), - REAL_CONST(40331.699958728961/8.0), - REAL_CONST(40350.596216245103/8.0), - REAL_CONST(40369.494686308273/8.0), - REAL_CONST(40388.39536840051/8.0), - REAL_CONST(40407.298262004173/8.0), - REAL_CONST(40426.20336660192/8.0), - REAL_CONST(40445.110681676706/8.0), - REAL_CONST(40464.020206711793/8.0), - REAL_CONST(40482.931941190756/8.0), - REAL_CONST(40501.845884597446/8.0), - REAL_CONST(40520.762036416032/8.0), - REAL_CONST(40539.680396130985/8.0), - REAL_CONST(40558.600963227072/8.0), - REAL_CONST(40577.523737189367/8.0), - REAL_CONST(40596.448717503234/8.0), - REAL_CONST(40615.375903654342/8.0), - REAL_CONST(40634.305295128659/8.0), - REAL_CONST(40653.236891412453/8.0), - REAL_CONST(40672.170691992294/8.0), - REAL_CONST(40691.106696355047/8.0), - REAL_CONST(40710.044903987873/8.0), - REAL_CONST(40728.985314378238/8.0), - REAL_CONST(40747.927927013901/8.0), - REAL_CONST(40766.872741382918/8.0), - REAL_CONST(40785.819756973651/8.0), - REAL_CONST(40804.768973274746/8.0), - REAL_CONST(40823.720389775161/8.0), - REAL_CONST(40842.674005964131/8.0), - REAL_CONST(40861.629821331211/8.0), - REAL_CONST(40880.587835366234/8.0), - REAL_CONST(40899.548047559321/8.0), - REAL_CONST(40918.510457400931/8.0), - REAL_CONST(40937.475064381761/8.0), - REAL_CONST(40956.441867992849/8.0), - REAL_CONST(40975.410867725499/8.0), - REAL_CONST(40994.382063071331/8.0), - REAL_CONST(41013.355453522236/8.0), - REAL_CONST(41032.331038570417/8.0), - REAL_CONST(41051.308817708363/8.0), - REAL_CONST(41070.288790428858/8.0), - REAL_CONST(41089.270956224987/8.0), - REAL_CONST(41108.255314590111/8.0), - REAL_CONST(41127.241865017888/8.0), - REAL_CONST(41146.23060700229/8.0), - REAL_CONST(41165.221540037543/8.0), - REAL_CONST(41184.214663618193/8.0), - REAL_CONST(41203.209977239079/8.0), - REAL_CONST(41222.207480395307/8.0), - REAL_CONST(41241.207172582297/8.0), - REAL_CONST(41260.209053295752/8.0), - REAL_CONST(41279.213122031659/8.0), - REAL_CONST(41298.219378286303/8.0), - REAL_CONST(41317.227821556255/8.0), - REAL_CONST(41336.23845133838/8.0), - REAL_CONST(41355.251267129832/8.0), - REAL_CONST(41374.266268428037/8.0), - REAL_CONST(41393.283454730743/8.0), - REAL_CONST(41412.302825535953/8.0), - REAL_CONST(41431.324380341983/8.0), - REAL_CONST(41450.348118647416/8.0), - REAL_CONST(41469.374039951144/8.0), - REAL_CONST(41488.402143752326/8.0), - REAL_CONST(41507.432429550427/8.0), - REAL_CONST(41526.464896845187/8.0), - REAL_CONST(41545.499545136627/8.0), - REAL_CONST(41564.536373925075/8.0), - REAL_CONST(41583.575382711126/8.0), - REAL_CONST(41602.616570995662/8.0), - REAL_CONST(41621.659938279874/8.0), - REAL_CONST(41640.705484065205/8.0), - REAL_CONST(41659.753207853406/8.0), - REAL_CONST(41678.803109146495/8.0), - REAL_CONST(41697.855187446803/8.0), - REAL_CONST(41716.909442256911/8.0), - REAL_CONST(41735.965873079709/8.0), - REAL_CONST(41755.02447941836/8.0), - REAL_CONST(41774.085260776315/8.0), - REAL_CONST(41793.148216657297/8.0), - REAL_CONST(41812.213346565331/8.0), - REAL_CONST(41831.280650004708/8.0), - REAL_CONST(41850.350126480014/8.0), - REAL_CONST(41869.421775496106/8.0), - REAL_CONST(41888.495596558132/8.0), - REAL_CONST(41907.571589171515/8.0), - REAL_CONST(41926.649752841957/8.0), - REAL_CONST(41945.730087075463/8.0), - REAL_CONST(41964.812591378286/8.0), - REAL_CONST(41983.897265256979/8.0), - REAL_CONST(42002.984108218378/8.0), - REAL_CONST(42022.073119769593/8.0), - REAL_CONST(42041.164299418015/8.0), - REAL_CONST(42060.257646671307/8.0), - REAL_CONST(42079.353161037419/8.0), - REAL_CONST(42098.450842024591/8.0), - REAL_CONST(42117.550689141324/8.0), - REAL_CONST(42136.652701896404/8.0), - REAL_CONST(42155.756879798893/8.0), - REAL_CONST(42174.863222358137/8.0), - REAL_CONST(42193.971729083758/8.0), - REAL_CONST(42213.082399485655/8.0), - REAL_CONST(42232.195233074002/8.0), - REAL_CONST(42251.310229359246/8.0), - REAL_CONST(42270.427387852127/8.0), - REAL_CONST(42289.546708063644/8.0), - REAL_CONST(42308.668189505079/8.0), - REAL_CONST(42327.791831687995/8.0), - REAL_CONST(42346.917634124227/8.0), - REAL_CONST(42366.045596325886/8.0), - REAL_CONST(42385.175717805352/8.0), - REAL_CONST(42404.307998075295/8.0), - REAL_CONST(42423.442436648642/8.0), - REAL_CONST(42442.579033038608/8.0), - REAL_CONST(42461.717786758672/8.0), - REAL_CONST(42480.858697322597/8.0), - REAL_CONST(42500.001764244422/8.0), - REAL_CONST(42519.146987038446/8.0), - REAL_CONST(42538.294365219248/8.0), - REAL_CONST(42557.443898301688/8.0), - REAL_CONST(42576.595585800882/8.0), - REAL_CONST(42595.749427232236/8.0), - REAL_CONST(42614.90542211142/8.0), - REAL_CONST(42634.063569954378/8.0), - REAL_CONST(42653.223870277317/8.0), - REAL_CONST(42672.386322596729/8.0), - REAL_CONST(42691.55092642938/8.0), - REAL_CONST(42710.717681292292/8.0), - REAL_CONST(42729.886586702756/8.0), - REAL_CONST(42749.057642178363/8.0), - REAL_CONST(42768.23084723694/8.0), - REAL_CONST(42787.406201396603/8.0), - REAL_CONST(42806.58370417574/8.0), - REAL_CONST(42825.76335509299/8.0), - REAL_CONST(42844.945153667286/8.0), - REAL_CONST(42864.129099417805/8.0), - REAL_CONST(42883.315191864014/8.0), - REAL_CONST(42902.503430525649/8.0), - REAL_CONST(42921.693814922692/8.0), - REAL_CONST(42940.88634457541/8.0), - REAL_CONST(42960.081019004348/8.0), - REAL_CONST(42979.277837730297/8.0), - REAL_CONST(42998.476800274322/8.0), - REAL_CONST(43017.677906157769/8.0), - REAL_CONST(43036.881154902228/8.0), - REAL_CONST(43056.086546029583/8.0), - REAL_CONST(43075.294079061961/8.0), - REAL_CONST(43094.503753521763/8.0), - REAL_CONST(43113.715568931671/8.0), - REAL_CONST(43132.929524814601/8.0), - REAL_CONST(43152.145620693766/8.0), - REAL_CONST(43171.363856092619/8.0), - REAL_CONST(43190.584230534907/8.0), - REAL_CONST(43209.806743544621/8.0), - REAL_CONST(43229.031394646016/8.0), - REAL_CONST(43248.258183363621/8.0), - REAL_CONST(43267.487109222224/8.0), - REAL_CONST(43286.718171746885/8.0), - REAL_CONST(43305.951370462906/8.0), - REAL_CONST(43325.186704895881/8.0), - REAL_CONST(43344.42417457165/8.0), - REAL_CONST(43363.663779016322/8.0), - REAL_CONST(43382.905517756262/8.0), - REAL_CONST(43402.149390318104/8.0), - REAL_CONST(43421.395396228749/8.0), - REAL_CONST(43440.643535015348/8.0), - REAL_CONST(43459.89380620532/8.0), - REAL_CONST(43479.146209326354/8.0), - REAL_CONST(43498.400743906379/8.0), - REAL_CONST(43517.657409473606/8.0), - REAL_CONST(43536.916205556496/8.0), - REAL_CONST(43556.177131683784/8.0), - REAL_CONST(43575.44018738444/8.0), - REAL_CONST(43594.705372187724/8.0), - REAL_CONST(43613.972685623135/8.0), - REAL_CONST(43633.242127220445/8.0), - REAL_CONST(43652.513696509668/8.0), - REAL_CONST(43671.787393021099/8.0), - REAL_CONST(43691.063216285271/8.0), - REAL_CONST(43710.341165833001/8.0), - REAL_CONST(43729.621241195346/8.0), - REAL_CONST(43748.903441903625/8.0), - REAL_CONST(43768.187767489413/8.0), - REAL_CONST(43787.474217484552/8.0), - REAL_CONST(43806.762791421126/8.0), - REAL_CONST(43826.053488831501/8.0), - REAL_CONST(43845.346309248278/8.0), - REAL_CONST(43864.641252204325/8.0), - REAL_CONST(43883.938317232765/8.0), - REAL_CONST(43903.237503866971/8.0), - REAL_CONST(43922.538811640596/8.0), - REAL_CONST(43941.842240087513/8.0), - REAL_CONST(43961.147788741881/8.0), - REAL_CONST(43980.455457138101/8.0), - REAL_CONST(43999.765244810835/8.0), - REAL_CONST(44019.077151295001/8.0), - REAL_CONST(44038.391176125755/8.0), - REAL_CONST(44057.70731883854/8.0), - REAL_CONST(44077.02557896902/8.0), - REAL_CONST(44096.345956053141/8.0), - REAL_CONST(44115.668449627083/8.0), - REAL_CONST(44134.993059227287/8.0), - REAL_CONST(44154.319784390456/8.0), - REAL_CONST(44173.648624653535/8.0), - REAL_CONST(44192.979579553728/8.0), - REAL_CONST(44212.312648628489/8.0), - REAL_CONST(44231.647831415532/8.0), - REAL_CONST(44250.985127452805/8.0), - REAL_CONST(44270.324536278538/8.0), - REAL_CONST(44289.666057431183/8.0), - REAL_CONST(44309.009690449464/8.0), - REAL_CONST(44328.355434872348/8.0), - REAL_CONST(44347.703290239064/8.0), - REAL_CONST(44367.053256089079/8.0), - REAL_CONST(44386.405331962109/8.0), - REAL_CONST(44405.759517398139/8.0), - REAL_CONST(44425.115811937387/8.0), - REAL_CONST(44444.474215120332/8.0), - REAL_CONST(44463.834726487694/8.0), - REAL_CONST(44483.197345580462/8.0), - REAL_CONST(44502.562071939843/8.0), - REAL_CONST(44521.928905107328/8.0), - REAL_CONST(44541.297844624634/8.0), - REAL_CONST(44560.668890033732/8.0), - REAL_CONST(44580.042040876848/8.0), - REAL_CONST(44599.417296696454/8.0), - REAL_CONST(44618.794657035272/8.0), - REAL_CONST(44638.174121436256/8.0), - REAL_CONST(44657.555689442641/8.0), - REAL_CONST(44676.939360597877/8.0), - REAL_CONST(44696.325134445673/8.0), - REAL_CONST(44715.713010530002/8.0), - REAL_CONST(44735.102988395054/8.0), - REAL_CONST(44754.495067585296/8.0), - REAL_CONST(44773.88924764542/8.0), - REAL_CONST(44793.285528120374/8.0), - REAL_CONST(44812.683908555344/8.0), - REAL_CONST(44832.084388495779/8.0), - REAL_CONST(44851.486967487363/8.0), - REAL_CONST(44870.891645076015/8.0), - REAL_CONST(44890.298420807922/8.0), - REAL_CONST(44909.707294229491/8.0), - REAL_CONST(44929.118264887409/8.0), - REAL_CONST(44948.531332328566/8.0), - REAL_CONST(44967.946496100136/8.0), - REAL_CONST(44987.363755749502/8.0), - REAL_CONST(45006.783110824319/8.0), - REAL_CONST(45026.204560872473/8.0), - REAL_CONST(45045.628105442098/8.0), - REAL_CONST(45065.053744081561/8.0), - REAL_CONST(45084.48147633949/8.0), - REAL_CONST(45103.911301764747/8.0), - REAL_CONST(45123.343219906426/8.0), - REAL_CONST(45142.777230313885/8.0), - REAL_CONST(45162.21333253671/8.0), - REAL_CONST(45181.651526124733/8.0), - REAL_CONST(45201.091810628037/8.0), - REAL_CONST(45220.534185596924/8.0), - REAL_CONST(45239.978650581965/8.0), - REAL_CONST(45259.425205133957/8.0), - REAL_CONST(45278.873848803938/8.0), - REAL_CONST(45298.324581143192/8.0), - REAL_CONST(45317.777401703235/8.0), - REAL_CONST(45337.232310035848/8.0), - REAL_CONST(45356.68930569302/8.0), - REAL_CONST(45376.148388226997/8.0), - REAL_CONST(45395.60955719027/8.0), - REAL_CONST(45415.072812135557/8.0), - REAL_CONST(45434.538152615823/8.0), - REAL_CONST(45454.005578184282/8.0), - REAL_CONST(45473.475088394356/8.0), - REAL_CONST(45492.946682799746/8.0), - REAL_CONST(45512.420360954362/8.0), - REAL_CONST(45531.896122412363/8.0), - REAL_CONST(45551.373966728155/8.0), - REAL_CONST(45570.853893456362/8.0), - REAL_CONST(45590.33590215187/8.0), - REAL_CONST(45609.819992369776/8.0), - REAL_CONST(45629.306163665438/8.0), - REAL_CONST(45648.794415594442/8.0), - REAL_CONST(45668.284747712612/8.0), - REAL_CONST(45687.777159576006/8.0), - REAL_CONST(45707.27165074092/8.0), - REAL_CONST(45726.768220763894/8.0), - REAL_CONST(45746.266869201696/8.0), - REAL_CONST(45765.767595611323/8.0), - REAL_CONST(45785.270399550034/8.0), - REAL_CONST(45804.775280575297/8.0), - REAL_CONST(45824.282238244828/8.0), - REAL_CONST(45843.79127211657/8.0), - REAL_CONST(45863.302381748719/8.0), - REAL_CONST(45882.815566699683/8.0), - REAL_CONST(45902.33082652813/8.0), - REAL_CONST(45921.848160792935/8.0), - REAL_CONST(45941.367569053225/8.0), - REAL_CONST(45960.889050868354/8.0), - REAL_CONST(45980.41260579793/8.0), - REAL_CONST(45999.938233401757/8.0), - REAL_CONST(46019.465933239902/8.0), - REAL_CONST(46038.995704872657/8.0), - REAL_CONST(46058.527547860547/8.0), - REAL_CONST(46078.06146176433/8.0), - REAL_CONST(46097.597446144995/8.0), - REAL_CONST(46117.135500563774/8.0), - REAL_CONST(46136.675624582109/8.0), - REAL_CONST(46156.217817761702/8.0), - REAL_CONST(46175.762079664462/8.0), - REAL_CONST(46195.308409852543/8.0), - REAL_CONST(46214.856807888333/8.0), - REAL_CONST(46234.407273334444/8.0), - REAL_CONST(46253.959805753715/8.0), - REAL_CONST(46273.51440470924/8.0), - REAL_CONST(46293.071069764315/8.0), - REAL_CONST(46312.629800482478/8.0), - REAL_CONST(46332.190596427499/8.0), - REAL_CONST(46351.753457163381/8.0), - REAL_CONST(46371.318382254351/8.0), - REAL_CONST(46390.885371264863/8.0), - REAL_CONST(46410.45442375962/8.0), - REAL_CONST(46430.025539303526/8.0), - REAL_CONST(46449.598717461733/8.0), - REAL_CONST(46469.17395779962/8.0), - REAL_CONST(46488.751259882782/8.0), - REAL_CONST(46508.33062327707/8.0), - REAL_CONST(46527.912047548532/8.0), - REAL_CONST(46547.495532263471/8.0), - REAL_CONST(46567.081076988397/8.0), - REAL_CONST(46586.668681290059/8.0), - REAL_CONST(46606.258344735434/8.0), - REAL_CONST(46625.850066891719/8.0), - REAL_CONST(46645.443847326351/8.0), - REAL_CONST(46665.039685606986/8.0), - REAL_CONST(46684.637581301497/8.0), - REAL_CONST(46704.237533978005/8.0), - REAL_CONST(46723.839543204842/8.0), - REAL_CONST(46743.443608550573/8.0), - REAL_CONST(46763.049729583989/8.0), - REAL_CONST(46782.657905874104/8.0), - REAL_CONST(46802.268136990162/8.0), - REAL_CONST(46821.880422501628/8.0), - REAL_CONST(46841.494761978196/8.0), - REAL_CONST(46861.111154989776/8.0), - REAL_CONST(46880.729601106526/8.0), - REAL_CONST(46900.350099898795/8.0), - REAL_CONST(46919.97265093719/8.0), - REAL_CONST(46939.597253792526/8.0), - REAL_CONST(46959.223908035841/8.0), - REAL_CONST(46978.852613238392/8.0), - REAL_CONST(46998.483368971691/8.0), - REAL_CONST(47018.11617480743/8.0), - REAL_CONST(47037.751030317551/8.0), - REAL_CONST(47057.387935074221/8.0), - REAL_CONST(47077.026888649809/8.0), - REAL_CONST(47096.66789061694/8.0), - REAL_CONST(47116.310940548428/8.0), - REAL_CONST(47135.956038017328/8.0), - REAL_CONST(47155.603182596918/8.0), - REAL_CONST(47175.252373860698/8.0), - REAL_CONST(47194.903611382375/8.0), - REAL_CONST(47214.556894735892/8.0), - REAL_CONST(47234.212223495422/8.0), - REAL_CONST(47253.869597235338/8.0), - REAL_CONST(47273.52901553025/8.0), - REAL_CONST(47293.19047795498/8.0), - REAL_CONST(47312.853984084577/8.0), - REAL_CONST(47332.519533494306/8.0), - REAL_CONST(47352.187125759658/8.0), - REAL_CONST(47371.856760456343/8.0), - REAL_CONST(47391.528437160297/8.0), - REAL_CONST(47411.202155447652/8.0), - REAL_CONST(47430.877914894787/8.0), - REAL_CONST(47450.555715078299/8.0), - REAL_CONST(47470.235555574982/8.0), - REAL_CONST(47489.917435961863/8.0), - REAL_CONST(47509.601355816201/8.0), - REAL_CONST(47529.287314715453/8.0), - REAL_CONST(47548.975312237308/8.0), - REAL_CONST(47568.665347959672/8.0), - REAL_CONST(47588.357421460656/8.0), - REAL_CONST(47608.051532318605/8.0), - REAL_CONST(47627.747680112072/8.0), - REAL_CONST(47647.445864419846/8.0), - REAL_CONST(47667.14608482091/8.0), - REAL_CONST(47686.848340894474/8.0), - REAL_CONST(47706.552632219973/8.0), - REAL_CONST(47726.258958377046/8.0), - REAL_CONST(47745.967318945557/8.0), - REAL_CONST(47765.677713505589/8.0), - REAL_CONST(47785.390141637428/8.0), - REAL_CONST(47805.104602921601/8.0), - REAL_CONST(47824.821096938824/8.0), - REAL_CONST(47844.539623270044/8.0), - REAL_CONST(47864.260181496429/8.0), - REAL_CONST(47883.982771199349/8.0), - REAL_CONST(47903.707391960394/8.0), - REAL_CONST(47923.434043361369/8.0), - REAL_CONST(47943.162724984308/8.0), - REAL_CONST(47962.893436411439/8.0), - REAL_CONST(47982.626177225218/8.0), - REAL_CONST(48002.36094700831/8.0), - REAL_CONST(48022.097745343599/8.0), - REAL_CONST(48041.836571814172/8.0), - REAL_CONST(48061.57742600335/8.0), - REAL_CONST(48081.32030749465/8.0), - REAL_CONST(48101.065215871815/8.0), - REAL_CONST(48120.81215071879/8.0), - REAL_CONST(48140.56111161974/8.0), - REAL_CONST(48160.312098159047/8.0), - REAL_CONST(48180.065109921306/8.0), - REAL_CONST(48199.820146491307/8.0), - REAL_CONST(48219.577207454073/8.0), - REAL_CONST(48239.336292394844/8.0), - REAL_CONST(48259.097400899045/8.0), - REAL_CONST(48278.860532552339/8.0), - REAL_CONST(48298.625686940592/8.0), - REAL_CONST(48318.392863649875/8.0), - REAL_CONST(48338.162062266485/8.0), - REAL_CONST(48357.933282376915/8.0), - REAL_CONST(48377.706523567889/8.0), - REAL_CONST(48397.481785426316/8.0), - REAL_CONST(48417.259067539344/8.0), - REAL_CONST(48437.038369494308/8.0), - REAL_CONST(48456.819690878765/8.0), - REAL_CONST(48476.603031280487/8.0), - REAL_CONST(48496.388390287451/8.0), - REAL_CONST(48516.175767487839/8.0), - REAL_CONST(48535.965162470042/8.0), - REAL_CONST(48555.756574822684/8.0), - REAL_CONST(48575.550004134566/8.0), - REAL_CONST(48595.345449994718/8.0), - REAL_CONST(48615.142911992378/8.0), - REAL_CONST(48634.942389716991/8.0), - REAL_CONST(48654.743882758201/8.0), - REAL_CONST(48674.547390705877/8.0), - REAL_CONST(48694.352913150084/8.0), - REAL_CONST(48714.160449681112/8.0), - REAL_CONST(48733.969999889443/8.0), - REAL_CONST(48753.781563365759/8.0), - REAL_CONST(48773.595139700978/8.0), - REAL_CONST(48793.410728486211/8.0), - REAL_CONST(48813.228329312769/8.0), - REAL_CONST(48833.047941772187/8.0), - REAL_CONST(48852.869565456189/8.0), - REAL_CONST(48872.693199956717/8.0), - REAL_CONST(48892.518844865925/8.0), - REAL_CONST(48912.346499776155/8.0), - REAL_CONST(48932.176164279976/8.0), - REAL_CONST(48952.007837970152/8.0), - REAL_CONST(48971.841520439666/8.0), - REAL_CONST(48991.677211281676/8.0), - REAL_CONST(49011.514910089587/8.0), - REAL_CONST(49031.354616456978/8.0), - REAL_CONST(49051.196329977654/8.0), - REAL_CONST(49071.04005024561/8.0), - REAL_CONST(49090.885776855059/8.0), - REAL_CONST(49110.733509400408/8.0), - REAL_CONST(49130.583247476279/8.0), - REAL_CONST(49150.434990677488/8.0), - REAL_CONST(49170.288738599062/8.0), - REAL_CONST(49190.144490836232/8.0), - REAL_CONST(49210.002246984441/8.0), - REAL_CONST(49229.86200663932/8.0), - REAL_CONST(49249.723769396718/8.0), - REAL_CONST(49269.587534852675/8.0), - REAL_CONST(49289.453302603448/8.0), - REAL_CONST(49309.32107224549/8.0), - REAL_CONST(49329.190843375451/8.0), - REAL_CONST(49349.062615590192/8.0), - REAL_CONST(49368.936388486785/8.0), - REAL_CONST(49388.812161662492/8.0), - REAL_CONST(49408.689934714785/8.0), - REAL_CONST(49428.569707241324/8.0), - REAL_CONST(49448.45147883999/8.0), - REAL_CONST(49468.335249108866/8.0), - REAL_CONST(49488.22101764621/8.0), - REAL_CONST(49508.108784050521/8.0), - REAL_CONST(49527.99854792047/8.0), - REAL_CONST(49547.890308854934/8.0), - REAL_CONST(49567.784066453009/8.0), - REAL_CONST(49587.679820313977/8.0), - REAL_CONST(49607.57757003732/8.0), - REAL_CONST(49627.477315222721/8.0), - REAL_CONST(49647.379055470075/8.0), - REAL_CONST(49667.28279037946/8.0), - REAL_CONST(49687.188519551179/8.0), - REAL_CONST(49707.096242585707/8.0), - REAL_CONST(49727.005959083741/8.0), - REAL_CONST(49746.917668646165/8.0), - REAL_CONST(49766.831370874068/8.0), - REAL_CONST(49786.747065368734/8.0), - REAL_CONST(49806.66475173166/8.0), - REAL_CONST(49826.584429564515/8.0), - REAL_CONST(49846.506098469203/8.0), - REAL_CONST(49866.429758047794/8.0), - REAL_CONST(49886.355407902578/8.0), - REAL_CONST(49906.283047636032/8.0), - REAL_CONST(49926.212676850846/8.0), - REAL_CONST(49946.144295149883/8.0), - REAL_CONST(49966.077902136225/8.0), - REAL_CONST(49986.013497413151/8.0), - REAL_CONST(50005.951080584135/8.0), - REAL_CONST(50025.890651252834/8.0), - REAL_CONST(50045.832209023123/8.0), - REAL_CONST(50065.775753499074/8.0), - REAL_CONST(50085.721284284933/8.0), - REAL_CONST(50105.668800985164/8.0), - REAL_CONST(50125.618303204428/8.0), - REAL_CONST(50145.569790547575/8.0), - REAL_CONST(50165.523262619652/8.0), - REAL_CONST(50185.478719025901/8.0), - REAL_CONST(50205.436159371769/8.0), - REAL_CONST(50225.395583262893/8.0), - REAL_CONST(50245.356990305103/8.0), - REAL_CONST(50265.320380104429/8.0), - REAL_CONST(50285.285752267104/8.0), - REAL_CONST(50305.253106399534/8.0), - REAL_CONST(50325.222442108337/8.0), - REAL_CONST(50345.193759000336/8.0), - REAL_CONST(50365.16705668252/8.0), - REAL_CONST(50385.142334762102/8.0), - REAL_CONST(50405.119592846473/8.0), - REAL_CONST(50425.098830543218/8.0), - REAL_CONST(50445.080047460127/8.0), - REAL_CONST(50465.063243205179/8.0), - REAL_CONST(50485.048417386541/8.0), - REAL_CONST(50505.035569612577/8.0), - REAL_CONST(50525.024699491856/8.0), - REAL_CONST(50545.015806633128/8.0), - REAL_CONST(50565.008890645338/8.0), - REAL_CONST(50585.003951137631/8.0), - REAL_CONST(50605.00098771933/8.0), - REAL_CONST(50624.999999999971/8.0), - REAL_CONST(50645.000987589265/8.0), - REAL_CONST(50665.003950097132/8.0), - REAL_CONST(50685.008887133677/8.0), - REAL_CONST(50705.015798309192/8.0), - REAL_CONST(50725.024683234165/8.0), - REAL_CONST(50745.035541519283/8.0), - REAL_CONST(50765.048372775411/8.0), - REAL_CONST(50785.063176613621/8.0), - REAL_CONST(50805.079952645159/8.0), - REAL_CONST(50825.098700481489/8.0), - REAL_CONST(50845.119419734241/8.0), - REAL_CONST(50865.142110015244/8.0), - REAL_CONST(50885.166770936521/8.0), - REAL_CONST(50905.193402110279/8.0), - REAL_CONST(50925.222003148934/8.0), - REAL_CONST(50945.252573665071/8.0), - REAL_CONST(50965.285113271471/8.0), - REAL_CONST(50985.319621581119/8.0), - REAL_CONST(51005.356098207172/8.0), - REAL_CONST(51025.394542762981/8.0), - REAL_CONST(51045.434954862096/8.0), - REAL_CONST(51065.477334118244/8.0), - REAL_CONST(51085.521680145357/8.0), - REAL_CONST(51105.567992557546/8.0), - REAL_CONST(51125.616270969113/8.0), - REAL_CONST(51145.66651499454/8.0), - REAL_CONST(51165.718724248516/8.0), - REAL_CONST(51185.772898345916/8.0), - REAL_CONST(51205.829036901778/8.0), - REAL_CONST(51225.887139531362/8.0), - REAL_CONST(51245.947205850105/8.0), - REAL_CONST(51266.009235473619/8.0), - REAL_CONST(51286.073228017718/8.0), - REAL_CONST(51306.139183098399/8.0), - REAL_CONST(51326.207100331856/8.0), - REAL_CONST(51346.276979334456/8.0), - REAL_CONST(51366.348819722756/8.0), - REAL_CONST(51386.42262111351/8.0), - REAL_CONST(51406.498383123653/8.0), - REAL_CONST(51426.57610537031/8.0), - REAL_CONST(51446.655787470787/8.0), - REAL_CONST(51466.737429042587/8.0), - REAL_CONST(51486.82102970338/8.0), - REAL_CONST(51506.906589071048/8.0), - REAL_CONST(51526.994106763632/8.0), - REAL_CONST(51547.083582399391/8.0), - REAL_CONST(51567.175015596738/8.0), - REAL_CONST(51587.268405974297/8.0), - REAL_CONST(51607.363753150858/8.0), - REAL_CONST(51627.461056745415/8.0), - REAL_CONST(51647.56031637713/8.0), - REAL_CONST(51667.661531665362/8.0), - REAL_CONST(51687.764702229651/8.0), - REAL_CONST(51707.869827689727/8.0), - REAL_CONST(51727.976907665499/8.0), - REAL_CONST(51748.085941777055/8.0), - REAL_CONST(51768.196929644677/8.0), - REAL_CONST(51788.309870888836/8.0), - REAL_CONST(51808.42476513017/8.0), - REAL_CONST(51828.541611989524/8.0), - REAL_CONST(51848.660411087905/8.0), - REAL_CONST(51868.781162046515/8.0), - REAL_CONST(51888.90386448674/8.0), - REAL_CONST(51909.028518030143/8.0), - REAL_CONST(51929.155122298485/8.0), - REAL_CONST(51949.283676913685/8.0), - REAL_CONST(51969.414181497872/8.0), - REAL_CONST(51989.546635673345/8.0), - REAL_CONST(52009.681039062583/8.0), - REAL_CONST(52029.817391288263/8.0), - REAL_CONST(52049.955691973213/8.0), - REAL_CONST(52070.095940740481/8.0), - REAL_CONST(52090.238137213273/8.0), - REAL_CONST(52110.382281014987/8.0), - REAL_CONST(52130.5283717692/8.0), - REAL_CONST(52150.676409099666/8.0), - REAL_CONST(52170.826392630333/8.0), - REAL_CONST(52190.97832198532/8.0), - REAL_CONST(52211.132196788931/8.0), - REAL_CONST(52231.288016665654/8.0), - REAL_CONST(52251.445781240145/8.0), - REAL_CONST(52271.60549013727/8.0), - REAL_CONST(52291.76714298204/8.0), - REAL_CONST(52311.930739399664/8.0), - REAL_CONST(52332.096279015546/8.0), - REAL_CONST(52352.263761455244/8.0), - REAL_CONST(52372.433186344519/8.0), - REAL_CONST(52392.604553309284/8.0), - REAL_CONST(52412.777861975665/8.0), - REAL_CONST(52432.953111969946/8.0), - REAL_CONST(52453.130302918595/8.0), - REAL_CONST(52473.309434448267/8.0), - REAL_CONST(52493.490506185793/8.0), - REAL_CONST(52513.67351775818/8.0), - REAL_CONST(52533.858468792605/8.0), - REAL_CONST(52554.045358916446/8.0), - REAL_CONST(52574.234187757254/8.0), - REAL_CONST(52594.42495494274/8.0), - REAL_CONST(52614.617660100812/8.0), - REAL_CONST(52634.812302859558/8.0), - REAL_CONST(52655.008882847229/8.0), - REAL_CONST(52675.20739969227/8.0), - REAL_CONST(52695.407853023295/8.0), - REAL_CONST(52715.610242469098/8.0), - REAL_CONST(52735.814567658657/8.0), - REAL_CONST(52756.02082822111/8.0), - REAL_CONST(52776.229023785803/8.0), - REAL_CONST(52796.439153982225/8.0), - REAL_CONST(52816.651218440056/8.0), - REAL_CONST(52836.865216789171/8.0), - REAL_CONST(52857.081148659599/8.0), - REAL_CONST(52877.29901368155/8.0), - REAL_CONST(52897.518811485425/8.0), - REAL_CONST(52917.740541701773/8.0), - REAL_CONST(52937.964203961354/8.0), - REAL_CONST(52958.18979789508/8.0), - REAL_CONST(52978.417323134046/8.0), - REAL_CONST(52998.646779309529/8.0), - REAL_CONST(53018.878166052978/8.0), - REAL_CONST(53039.111482996006/8.0), - REAL_CONST(53059.346729770419/8.0), - REAL_CONST(53079.583906008193/8.0), - REAL_CONST(53099.823011341483/8.0), - REAL_CONST(53120.0640454026/8.0), - REAL_CONST(53140.307007824063/8.0), - REAL_CONST(53160.551898238533/8.0), - REAL_CONST(53180.79871627887/8.0), - REAL_CONST(53201.047461578091/8.0), - REAL_CONST(53221.2981337694/8.0), - REAL_CONST(53241.550732486176/8.0), - REAL_CONST(53261.805257361964/8.0), - REAL_CONST(53282.061708030487/8.0), - REAL_CONST(53302.32008412564/8.0), - REAL_CONST(53322.580385281493/8.0), - REAL_CONST(53342.842611132299/8.0), - REAL_CONST(53363.106761312469/8.0), - REAL_CONST(53383.372835456597/8.0), - REAL_CONST(53403.640833199453/8.0), - REAL_CONST(53423.910754175973/8.0), - REAL_CONST(53444.18259802126/8.0), - REAL_CONST(53464.456364370613/8.0), - REAL_CONST(53484.732052859479/8.0), - REAL_CONST(53505.009663123499/8.0), - REAL_CONST(53525.289194798468/8.0), - REAL_CONST(53545.570647520362/8.0), - REAL_CONST(53565.854020925333/8.0), - REAL_CONST(53586.139314649699/8.0), - REAL_CONST(53606.426528329954/8.0), - REAL_CONST(53626.715661602764/8.0), - REAL_CONST(53647.006714104959/8.0), - REAL_CONST(53667.299685473547/8.0), - REAL_CONST(53687.59457534572/8.0), - REAL_CONST(53707.891383358816/8.0), - REAL_CONST(53728.190109150361/8.0), - REAL_CONST(53748.490752358055/8.0), - REAL_CONST(53768.793312619753/8.0), - REAL_CONST(53789.09778957349/8.0), - REAL_CONST(53809.404182857485/8.0), - REAL_CONST(53829.712492110106/8.0), - REAL_CONST(53850.022716969899/8.0), - REAL_CONST(53870.334857075584/8.0), - REAL_CONST(53890.648912066055/8.0), - REAL_CONST(53910.964881580367/8.0), - REAL_CONST(53931.28276525774/8.0), - REAL_CONST(53951.602562737586/8.0), - REAL_CONST(53971.924273659461/8.0), - REAL_CONST(53992.24789766311/8.0), - REAL_CONST(54012.57343438844/8.0), - REAL_CONST(54032.90088347553/8.0), - REAL_CONST(54053.23024456462/8.0), - REAL_CONST(54073.561517296133/8.0), - REAL_CONST(54093.894701310644/8.0), - REAL_CONST(54114.22979624891/8.0), - REAL_CONST(54134.566801751855/8.0), - REAL_CONST(54154.90571746057/8.0), - REAL_CONST(54175.246543016314/8.0), - REAL_CONST(54195.589278060506/8.0), - REAL_CONST(54215.933922234755/8.0), - REAL_CONST(54236.280475180814/8.0), - REAL_CONST(54256.628936540626/8.0), - REAL_CONST(54276.97930595628/8.0), - REAL_CONST(54297.331583070045/8.0), - REAL_CONST(54317.685767524359/8.0), - REAL_CONST(54338.041858961828/8.0), - REAL_CONST(54358.399857025215/8.0), - REAL_CONST(54378.759761357462/8.0), - REAL_CONST(54399.121571601667/8.0), - REAL_CONST(54419.485287401105/8.0), - REAL_CONST(54439.850908399218/8.0), - REAL_CONST(54460.218434239614/8.0), - REAL_CONST(54480.587864566056/8.0), - REAL_CONST(54500.95919902248/8.0), - REAL_CONST(54521.332437252997/8.0), - REAL_CONST(54541.707578901878/8.0), - REAL_CONST(54562.084623613555/8.0), - REAL_CONST(54582.46357103264/8.0), - REAL_CONST(54602.844420803893/8.0), - REAL_CONST(54623.227172572246/8.0), - REAL_CONST(54643.611825982807/8.0), - REAL_CONST(54663.998380680838/8.0), - REAL_CONST(54684.386836311773/8.0), - REAL_CONST(54704.777192521207/8.0), - REAL_CONST(54725.169448954897/8.0), - REAL_CONST(54745.563605258772/8.0), - REAL_CONST(54765.959661078923/8.0), - REAL_CONST(54786.357616061614/8.0), - REAL_CONST(54806.757469853255/8.0), - REAL_CONST(54827.159222100439/8.0), - REAL_CONST(54847.562872449904/8.0), - REAL_CONST(54867.968420548583/8.0), - REAL_CONST(54888.375866043534/8.0), - REAL_CONST(54908.785208582012/8.0), - REAL_CONST(54929.196447811417/8.0), - REAL_CONST(54949.609583379322/8.0), - REAL_CONST(54970.024614933463/8.0), - REAL_CONST(54990.441542121727/8.0), - REAL_CONST(55010.86036459219/8.0), - REAL_CONST(55031.28108199306/8.0), - REAL_CONST(55051.703693972733/8.0), - REAL_CONST(55072.128200179759/8.0), - REAL_CONST(55092.554600262847/8.0), - REAL_CONST(55112.982893870874/8.0), - REAL_CONST(55133.413080652877/8.0), - REAL_CONST(55153.845160258061/8.0), - REAL_CONST(55174.279132335789/8.0), - REAL_CONST(55194.714996535586/8.0), - REAL_CONST(55215.152752507143/8.0), - REAL_CONST(55235.592399900306/8.0), - REAL_CONST(55256.033938365079/8.0), - REAL_CONST(55276.477367551655/8.0), - REAL_CONST(55296.92268711036/8.0), - REAL_CONST(55317.369896691685/8.0), - REAL_CONST(55337.818995946305/8.0), - REAL_CONST(55358.269984525024/8.0), - REAL_CONST(55378.72286207883/8.0), - REAL_CONST(55399.177628258869/8.0), - REAL_CONST(55419.634282716441/8.0), - REAL_CONST(55440.092825103013/8.0), - REAL_CONST(55460.553255070205/8.0), - REAL_CONST(55481.015572269804/8.0), - REAL_CONST(55501.479776353764/8.0), - REAL_CONST(55521.945866974187/8.0), - REAL_CONST(55542.413843783339/8.0), - REAL_CONST(55562.883706433655/8.0), - REAL_CONST(55583.355454577715/8.0), - REAL_CONST(55603.82908786826/8.0), - REAL_CONST(55624.304605958219/8.0), - REAL_CONST(55644.782008500639/8.0), - REAL_CONST(55665.261295148754/8.0), - REAL_CONST(55685.742465555952/8.0), - REAL_CONST(55706.225519375774/8.0), - REAL_CONST(55726.710456261928/8.0), - REAL_CONST(55747.197275868275/8.0), - REAL_CONST(55767.685977848843/8.0), - REAL_CONST(55788.176561857814/8.0), - REAL_CONST(55808.669027549528/8.0), - REAL_CONST(55829.163374578478/8.0), - REAL_CONST(55849.659602599328/8.0), - REAL_CONST(55870.157711266889/8.0), - REAL_CONST(55890.657700236145/8.0), - REAL_CONST(55911.159569162221/8.0), - REAL_CONST(55931.663317700411/8.0), - REAL_CONST(55952.168945506164/8.0), - REAL_CONST(55972.676452235086/8.0), - REAL_CONST(55993.185837542944/8.0), - REAL_CONST(56013.697101085651/8.0), - REAL_CONST(56034.210242519301/8.0), - REAL_CONST(56054.72526150012/8.0), - REAL_CONST(56075.242157684508/8.0), - REAL_CONST(56095.760930729011/8.0), - REAL_CONST(56116.281580290342/8.0), - REAL_CONST(56136.804106025367/8.0), - REAL_CONST(56157.328507591104/8.0), - REAL_CONST(56177.85478464474/8.0), - REAL_CONST(56198.382936843598/8.0), - REAL_CONST(56218.912963845185/8.0), - REAL_CONST(56239.444865307138/8.0), - REAL_CONST(56259.978640887268/8.0), - REAL_CONST(56280.514290243525/8.0), - REAL_CONST(56301.051813034042/8.0), - REAL_CONST(56321.591208917082/8.0), - REAL_CONST(56342.13247755108/8.0), - REAL_CONST(56362.675618594607/8.0), - REAL_CONST(56383.220631706419/8.0), - REAL_CONST(56403.767516545398/8.0), - REAL_CONST(56424.316272770608/8.0), - REAL_CONST(56444.866900041241/8.0), - REAL_CONST(56465.419398016667/8.0), - REAL_CONST(56485.973766356394/8.0), - REAL_CONST(56506.530004720102/8.0), - REAL_CONST(56527.088112767611/8.0), - REAL_CONST(56547.648090158902/8.0), - REAL_CONST(56568.209936554107/8.0), - REAL_CONST(56588.773651613519/8.0), - REAL_CONST(56609.339234997584/8.0), - REAL_CONST(56629.9066863669/8.0), - REAL_CONST(56650.47600538221/8.0), - REAL_CONST(56671.04719170442/8.0), - REAL_CONST(56691.620244994599/8.0), - REAL_CONST(56712.195164913959/8.0), - REAL_CONST(56732.771951123868/8.0), - REAL_CONST(56753.350603285835/8.0), - REAL_CONST(56773.931121061541/8.0), - REAL_CONST(56794.513504112823/8.0), - REAL_CONST(56815.097752101647/8.0), - REAL_CONST(56835.683864690152/8.0), - REAL_CONST(56856.271841540627/8.0), - REAL_CONST(56876.86168231551/8.0), - REAL_CONST(56897.453386677393/8.0), - REAL_CONST(56918.046954289028/8.0), - REAL_CONST(56938.642384813298/8.0), - REAL_CONST(56959.239677913261/8.0), - REAL_CONST(56979.838833252121/8.0), - REAL_CONST(57000.439850493225/8.0), - REAL_CONST(57021.04272930009/8.0), - REAL_CONST(57041.647469336371/8.0), - REAL_CONST(57062.254070265873/8.0), - REAL_CONST(57082.862531752558/8.0), - REAL_CONST(57103.472853460553/8.0), - REAL_CONST(57124.085035054108/8.0), - REAL_CONST(57144.699076197649/8.0), - REAL_CONST(57165.314976555739/8.0), - REAL_CONST(57185.932735793103/8.0), - REAL_CONST(57206.552353574611/8.0), - REAL_CONST(57227.173829565276/8.0), - REAL_CONST(57247.797163430281/8.0), - REAL_CONST(57268.42235483494/8.0), - REAL_CONST(57289.049403444733/8.0), - REAL_CONST(57309.678308925286/8.0), - REAL_CONST(57330.30907094237/8.0), - REAL_CONST(57350.941689161911/8.0), - REAL_CONST(57371.576163249985/8.0), - REAL_CONST(57392.212492872815/8.0), - REAL_CONST(57412.850677696784/8.0), - REAL_CONST(57433.490717388406/8.0), - REAL_CONST(57454.132611614368/8.0), - REAL_CONST(57474.776360041491/8.0), - REAL_CONST(57495.421962336746/8.0), - REAL_CONST(57516.069418167266/8.0), - REAL_CONST(57536.718727200314/8.0), - REAL_CONST(57557.36988910332/8.0), - REAL_CONST(57578.022903543861/8.0), - REAL_CONST(57598.677770189643/8.0), - REAL_CONST(57619.334488708548/8.0), - REAL_CONST(57639.993058768589/8.0), - REAL_CONST(57660.653480037938/8.0), - REAL_CONST(57681.315752184906/8.0), - REAL_CONST(57701.979874877965/8.0), - REAL_CONST(57722.64584778573/8.0), - REAL_CONST(57743.31367057695/8.0), - REAL_CONST(57763.983342920546/8.0), - REAL_CONST(57784.654864485572/8.0), - REAL_CONST(57805.328234941233/8.0), - REAL_CONST(57826.003453956881/8.0), - REAL_CONST(57846.680521202026/8.0), - REAL_CONST(57867.359436346305/8.0), - REAL_CONST(57888.040199059527/8.0), - REAL_CONST(57908.722809011633/8.0), - REAL_CONST(57929.407265872709/8.0), - REAL_CONST(57950.093569313001/8.0), - REAL_CONST(57970.781719002895/8.0), - REAL_CONST(57991.471714612911/8.0), - REAL_CONST(58012.16355581375/8.0), - REAL_CONST(58032.857242276223/8.0), - REAL_CONST(58053.552773671312/8.0), - REAL_CONST(58074.25014967013/8.0), - REAL_CONST(58094.949369943948/8.0), - REAL_CONST(58115.650434164185/8.0), - REAL_CONST(58136.353342002389/8.0), - REAL_CONST(58157.058093130276/8.0), - REAL_CONST(58177.764687219693/8.0), - REAL_CONST(58198.47312394264/8.0), - REAL_CONST(58219.183402971255/8.0), - REAL_CONST(58239.895523977837/8.0), - REAL_CONST(58260.609486634821/8.0), - REAL_CONST(58281.325290614775/8.0), - REAL_CONST(58302.042935590434/8.0), - REAL_CONST(58322.762421234678/8.0), - REAL_CONST(58343.483747220511/8.0), - REAL_CONST(58364.206913221096/8.0), - REAL_CONST(58384.931918909751/8.0), - REAL_CONST(58405.658763959924/8.0), - REAL_CONST(58426.3874480452/8.0), - REAL_CONST(58447.117970839339/8.0), - REAL_CONST(58467.85033201622/8.0), - REAL_CONST(58488.584531249864/8.0), - REAL_CONST(58509.320568214462/8.0), - REAL_CONST(58530.058442584334/8.0), - REAL_CONST(58550.798154033931/8.0), - REAL_CONST(58571.539702237875/8.0), - REAL_CONST(58592.283086870906/8.0), - REAL_CONST(58613.028307607929/8.0), - REAL_CONST(58633.775364123983/8.0), - REAL_CONST(58654.52425609425/8.0), - REAL_CONST(58675.274983194053/8.0), - REAL_CONST(58696.027545098877/8.0), - REAL_CONST(58716.781941484325/8.0), - REAL_CONST(58737.538172026158/8.0), - REAL_CONST(58758.296236400274/8.0), - REAL_CONST(58779.056134282728/8.0), - REAL_CONST(58799.817865349694/8.0), - REAL_CONST(58820.581429277503/8.0), - REAL_CONST(58841.346825742643/8.0), - REAL_CONST(58862.114054421712/8.0), - REAL_CONST(58882.883114991484/8.0), - REAL_CONST(58903.654007128847/8.0), - REAL_CONST(58924.426730510851/8.0), - REAL_CONST(58945.201284814684/8.0), - REAL_CONST(58965.977669717664/8.0), - REAL_CONST(58986.755884897269/8.0), - REAL_CONST(59007.535930031117/8.0), - REAL_CONST(59028.317804796949/8.0), - REAL_CONST(59049.101508872664/8.0), - REAL_CONST(59069.887041936301/8.0), - REAL_CONST(59090.674403666046/8.0), - REAL_CONST(59111.463593740213/8.0), - REAL_CONST(59132.254611837263/8.0), - REAL_CONST(59153.047457635803/8.0), - REAL_CONST(59173.84213081457/8.0), - REAL_CONST(59194.638631052461/8.0), - REAL_CONST(59215.436958028506/8.0), - REAL_CONST(59236.237111421855/8.0), - REAL_CONST(59257.039090911829/8.0), - REAL_CONST(59277.842896177877/8.0), - REAL_CONST(59298.648526899589/8.0), - REAL_CONST(59319.455982756685/8.0), - REAL_CONST(59340.26526342905/8.0), - REAL_CONST(59361.076368596696/8.0), - REAL_CONST(59381.889297939757/8.0), - REAL_CONST(59402.704051138542/8.0), - REAL_CONST(59423.520627873484/8.0), - REAL_CONST(59444.339027825139/8.0), - REAL_CONST(59465.159250674224/8.0), - REAL_CONST(59485.9812961016/8.0), - REAL_CONST(59506.805163788253/8.0), - REAL_CONST(59527.630853415307/8.0), - REAL_CONST(59548.458364664046/8.0), - REAL_CONST(59569.287697215863/8.0), - REAL_CONST(59590.118850752311/8.0), - REAL_CONST(59610.951824955089/8.0), - REAL_CONST(59631.786619506012/8.0), - REAL_CONST(59652.623234087048/8.0), - REAL_CONST(59673.461668380311/8.0), - REAL_CONST(59694.301922068029/8.0), - REAL_CONST(59715.143994832593/8.0), - REAL_CONST(59735.987886356525/8.0), - REAL_CONST(59756.833596322482/8.0), - REAL_CONST(59777.681124413255/8.0), - REAL_CONST(59798.530470311794/8.0), - REAL_CONST(59819.381633701159/8.0), - REAL_CONST(59840.234614264569/8.0), - REAL_CONST(59861.089411685381/8.0), - REAL_CONST(59881.94602564707/8.0), - REAL_CONST(59902.804455833269/8.0), - REAL_CONST(59923.664701927737/8.0), - REAL_CONST(59944.526763614384/8.0), - REAL_CONST(59965.390640577243/8.0), - REAL_CONST(59986.256332500488/8.0), - REAL_CONST(60007.123839068438/8.0), - REAL_CONST(60027.993159965539/8.0), - REAL_CONST(60048.864294876381/8.0), - REAL_CONST(60069.737243485688/8.0), - REAL_CONST(60090.612005478324/8.0), - REAL_CONST(60111.488580539284/8.0), - REAL_CONST(60132.366968353708/8.0), - REAL_CONST(60153.247168606867/8.0), - REAL_CONST(60174.129180984164/8.0), - REAL_CONST(60195.013005171153/8.0), - REAL_CONST(60215.898640853513/8.0), - REAL_CONST(60236.786087717061/8.0), - REAL_CONST(60257.675345447751/8.0), - REAL_CONST(60278.566413731671/8.0), - REAL_CONST(60299.459292255044/8.0), - REAL_CONST(60320.353980704247/8.0), - REAL_CONST(60341.25047876576/8.0), - REAL_CONST(60362.148786126229/8.0), - REAL_CONST(60383.048902472423/8.0), - REAL_CONST(60403.950827491237/8.0), - REAL_CONST(60424.854560869717/8.0), - REAL_CONST(60445.76010229504/8.0), - REAL_CONST(60466.667451454516/8.0), - REAL_CONST(60487.57660803559/8.0), - REAL_CONST(60508.487571725847/8.0), - REAL_CONST(60529.400342212997/8.0), - REAL_CONST(60550.314919184893/8.0), - REAL_CONST(60571.231302329521/8.0), - REAL_CONST(60592.149491335003/8.0), - REAL_CONST(60613.069485889588/8.0), - REAL_CONST(60633.991285681674/8.0), - REAL_CONST(60654.914890399785/8.0), - REAL_CONST(60675.840299732568/8.0), - REAL_CONST(60696.767513368832/8.0), - REAL_CONST(60717.696530997484/8.0), - REAL_CONST(60738.627352307602/8.0), - REAL_CONST(60759.55997698837/8.0), - REAL_CONST(60780.494404729128/8.0), - REAL_CONST(60801.430635219323/8.0), - REAL_CONST(60822.368668148556/8.0), - REAL_CONST(60843.308503206565/8.0), - REAL_CONST(60864.250140083204/8.0), - REAL_CONST(60885.193578468468/8.0), - REAL_CONST(60906.138818052495/8.0), - REAL_CONST(60927.085858525541/8.0), - REAL_CONST(60948.034699578006/8.0), - REAL_CONST(60968.985340900421/8.0), - REAL_CONST(60989.937782183442/8.0), - REAL_CONST(61010.892023117864/8.0), - REAL_CONST(61031.848063394616/8.0), - REAL_CONST(61052.805902704764/8.0), - REAL_CONST(61073.765540739492/8.0), - REAL_CONST(61094.726977190134/8.0), - REAL_CONST(61115.690211748137/8.0), - REAL_CONST(61136.655244105103/8.0), - REAL_CONST(61157.622073952742/8.0), - REAL_CONST(61178.590700982917/8.0), - REAL_CONST(61199.561124887616/8.0), - REAL_CONST(61220.533345358948/8.0), - REAL_CONST(61241.507362089171/8.0), - REAL_CONST(61262.483174770663/8.0), - REAL_CONST(61283.460783095943/8.0), - REAL_CONST(61304.440186757645/8.0), - REAL_CONST(61325.421385448557/8.0), - REAL_CONST(61346.404378861582/8.0), - REAL_CONST(61367.389166689762/8.0), - REAL_CONST(61388.375748626262/8.0), - REAL_CONST(61409.364124364387/8.0), - REAL_CONST(61430.354293597571/8.0), - REAL_CONST(61451.346256019373/8.0), - REAL_CONST(61472.340011323497/8.0), - REAL_CONST(61493.335559203762/8.0), - REAL_CONST(61514.332899354122/8.0), - REAL_CONST(61535.332031468672/8.0), - REAL_CONST(61556.332955241618/8.0), - REAL_CONST(61577.335670367313/8.0), - REAL_CONST(61598.340176540238/8.0), - REAL_CONST(61619.346473454993/8.0), - REAL_CONST(61640.354560806329/8.0), - REAL_CONST(61661.3644382891/8.0), - REAL_CONST(61682.376105598312/8.0), - REAL_CONST(61703.389562429089/8.0), - REAL_CONST(61724.404808476691/8.0), - REAL_CONST(61745.42184343651/8.0), - REAL_CONST(61766.440667004063/8.0), - REAL_CONST(61787.461278874987/8.0), - REAL_CONST(61808.483678745069/8.0), - REAL_CONST(61829.507866310203/8.0), - REAL_CONST(61850.533841266435/8.0), - REAL_CONST(61871.561603309929/8.0), - REAL_CONST(61892.591152136971/8.0), - REAL_CONST(61913.622487443987/8.0), - REAL_CONST(61934.655608927525/8.0), - REAL_CONST(61955.690516284267/8.0), - REAL_CONST(61976.727209211022/8.0), - REAL_CONST(61997.765687404724/8.0), - REAL_CONST(62018.805950562448/8.0), - REAL_CONST(62039.847998381381/8.0), - REAL_CONST(62060.891830558845/8.0), - REAL_CONST(62081.93744679229/8.0), - REAL_CONST(62102.984846779298/8.0), - REAL_CONST(62124.034030217575/8.0), - REAL_CONST(62145.084996804966/8.0), - REAL_CONST(62166.137746239416/8.0), - REAL_CONST(62187.19227821903/8.0), - REAL_CONST(62208.248592442025/8.0), - REAL_CONST(62229.306688606739/8.0), - REAL_CONST(62250.366566411656/8.0), - REAL_CONST(62271.428225555377/8.0), - REAL_CONST(62292.491665736627/8.0), - REAL_CONST(62313.556886654267/8.0), - REAL_CONST(62334.623888007271/8.0), - REAL_CONST(62355.692669494762/8.0), - REAL_CONST(62376.763230815974/8.0), - REAL_CONST(62397.835571670272/8.0), - REAL_CONST(62418.909691757144/8.0), - REAL_CONST(62439.98559077621/8.0), - REAL_CONST(62461.063268427228/8.0), - REAL_CONST(62482.142724410049/8.0), - REAL_CONST(62503.223958424685/8.0), - REAL_CONST(62524.306970171267/8.0), - REAL_CONST(62545.39175935003/8.0), - REAL_CONST(62566.478325661366/8.0), - REAL_CONST(62587.566668805768/8.0), - REAL_CONST(62608.656788483881/8.0), - REAL_CONST(62629.748684396451/8.0), - REAL_CONST(62650.842356244357/8.0), - REAL_CONST(62671.937803728622/8.0), - REAL_CONST(62693.035026550366/8.0), - REAL_CONST(62714.134024410858/8.0), - REAL_CONST(62735.234797011479/8.0), - REAL_CONST(62756.337344053733/8.0), - REAL_CONST(62777.441665239276/8.0), - REAL_CONST(62798.547760269852/8.0), - REAL_CONST(62819.655628847358/8.0), - REAL_CONST(62840.765270673801/8.0), - REAL_CONST(62861.876685451323/8.0), - REAL_CONST(62882.989872882186/8.0), - REAL_CONST(62904.104832668774/8.0), - REAL_CONST(62925.221564513602/8.0), - REAL_CONST(62946.340068119309/8.0), - REAL_CONST(62967.460343188657/8.0), - REAL_CONST(62988.582389424526/8.0), - REAL_CONST(63009.70620652994/8.0), - REAL_CONST(63030.831794208025/8.0), - REAL_CONST(63051.959152162039/8.0), - REAL_CONST(63073.08828009537/8.0), - REAL_CONST(63094.219177711529/8.0), - REAL_CONST(63115.351844714154/8.0), - REAL_CONST(63136.486280806988/8.0), - REAL_CONST(63157.622485693922/8.0), - REAL_CONST(63178.760459078956/8.0), - REAL_CONST(63199.900200666219/8.0), - REAL_CONST(63221.041710159967/8.0), - REAL_CONST(63242.184987264569/8.0), - REAL_CONST(63263.330031684534/8.0), - REAL_CONST(63284.476843124474/8.0), - REAL_CONST(63305.625421289144/8.0), - REAL_CONST(63326.775765883409/8.0), - REAL_CONST(63347.927876612259/8.0), - REAL_CONST(63369.081753180813/8.0), - REAL_CONST(63390.237395294316/8.0), - REAL_CONST(63411.39480265812/8.0), - REAL_CONST(63432.553974977716/8.0), - REAL_CONST(63453.714911958712/8.0), - REAL_CONST(63474.877613306839/8.0), - REAL_CONST(63496.042078727944/8.0), - REAL_CONST(63517.208307927998/8.0), - REAL_CONST(63538.376300613119/8.0), - REAL_CONST(63559.546056489504/8.0), - REAL_CONST(63580.717575263516/8.0), - REAL_CONST(63601.890856641607/8.0), - REAL_CONST(63623.065900330374/8.0), - REAL_CONST(63644.242706036515/8.0), - REAL_CONST(63665.421273466869/8.0), - REAL_CONST(63686.601602328381/8.0), - REAL_CONST(63707.783692328136/8.0), - REAL_CONST(63728.967543173334/8.0), - REAL_CONST(63750.153154571279/8.0), - REAL_CONST(63771.340526229418/8.0), - REAL_CONST(63792.529657855317/8.0), - REAL_CONST(63813.720549156649/8.0), - REAL_CONST(63834.913199841227/8.0), - REAL_CONST(63856.107609616978/8.0), - REAL_CONST(63877.303778191941/8.0), - REAL_CONST(63898.501705274284/8.0), - REAL_CONST(63919.7013905723/8.0), - REAL_CONST(63940.902833794404/8.0), - REAL_CONST(63962.106034649114/8.0), - REAL_CONST(63983.310992845094/8.0), - REAL_CONST(64004.517708091109/8.0), - REAL_CONST(64025.726180096048/8.0), - REAL_CONST(64046.936408568938/8.0), - REAL_CONST(64068.1483932189/8.0), - REAL_CONST(64089.362133755196/8.0), - REAL_CONST(64110.577629887193/8.0), - REAL_CONST(64131.794881324393/8.0), - REAL_CONST(64153.013887776404/8.0), - REAL_CONST(64174.234648952966/8.0), - REAL_CONST(64195.457164563937/8.0), - REAL_CONST(64216.681434319289/8.0), - REAL_CONST(64237.907457929112/8.0), - REAL_CONST(64259.135235103626/8.0), - REAL_CONST(64280.36476555316/8.0), - REAL_CONST(64301.596048988169/8.0), - REAL_CONST(64322.829085119236/8.0), - REAL_CONST(64344.06387365704/8.0), - REAL_CONST(64365.300414312398/8.0), - REAL_CONST(64386.538706796251/8.0), - REAL_CONST(64407.778750819634/8.0), - REAL_CONST(64429.020546093721/8.0), - REAL_CONST(64450.26409232981/8.0), - REAL_CONST(64471.509389239291/8.0), - REAL_CONST(64492.756436533709/8.0), - REAL_CONST(64514.005233924705/8.0), - REAL_CONST(64535.255781124033/8.0), - REAL_CONST(64556.50807784358/8.0), - REAL_CONST(64577.762123795357/8.0), - REAL_CONST(64599.017918691468/8.0), - REAL_CONST(64620.275462244172/8.0), - REAL_CONST(64641.534754165805/8.0), - REAL_CONST(64662.795794168844/8.0), - REAL_CONST(64684.058581965895/8.0), - REAL_CONST(64705.323117269661/8.0), - REAL_CONST(64726.589399792974/8.0), - REAL_CONST(64747.857429248776/8.0), - REAL_CONST(64769.127205350138/8.0), - REAL_CONST(64790.398727810236/8.0), - REAL_CONST(64811.671996342375/8.0), - REAL_CONST(64832.947010659969/8.0), - REAL_CONST(64854.223770476558/8.0), - REAL_CONST(64875.502275505794/8.0), - REAL_CONST(64896.782525461451/8.0), - REAL_CONST(64918.064520057414/8.0), - REAL_CONST(64939.348259007682/8.0), - REAL_CONST(64960.633742026388/8.0), - REAL_CONST(64981.920968827762/8.0), - REAL_CONST(65003.209939126165/8.0), - REAL_CONST(65024.500652636067/8.0), - REAL_CONST(65045.793109072067/8.0), - REAL_CONST(65067.087308148861/8.0), - REAL_CONST(65088.383249581282/8.0), - REAL_CONST(65109.680933084259/8.0), - REAL_CONST(65130.980358372864/8.0), - REAL_CONST(65152.28152516226/8.0), - REAL_CONST(65173.584433167736/8.0), - REAL_CONST(65194.889082104703/8.0), - REAL_CONST(65216.195471688683/8.0), - REAL_CONST(65237.503601635319/8.0), - REAL_CONST(65258.813471660353/8.0), - REAL_CONST(65280.125081479666/8.0), - REAL_CONST(65301.438430809241/8.0), - REAL_CONST(65322.753519365178/8.0), - REAL_CONST(65344.070346863708/8.0), - REAL_CONST(65365.388913021146/8.0), - REAL_CONST(65386.709217553958/8.0), - REAL_CONST(65408.031260178701/8.0), - REAL_CONST(65429.355040612056/8.0), - REAL_CONST(65450.680558570821/8.0), - REAL_CONST(65472.00781377191/8.0), - REAL_CONST(65493.336805932355/8.0), - REAL_CONST(65514.66753476928/8.0), - REAL_CONST(65535.999999999956/8.0), - REAL_CONST(65557.334201341757/8.0), - REAL_CONST(65578.670138512171/8.0), - REAL_CONST(65600.007811228788/8.0), - REAL_CONST(65621.347219209332/8.0), - REAL_CONST(65642.688362171626/8.0), - REAL_CONST(65664.031239833639/8.0), - REAL_CONST(65685.375851913413/8.0), - REAL_CONST(65706.722198129137/8.0), - REAL_CONST(65728.070278199084/8.0), - REAL_CONST(65749.420091841661/8.0), - REAL_CONST(65770.771638775404/8.0), - REAL_CONST(65792.124918718939/8.0), - REAL_CONST(65813.479931391004/8.0), - REAL_CONST(65834.836676510458/8.0), - REAL_CONST(65856.195153796303/8.0), - REAL_CONST(65877.5553629676/8.0), - REAL_CONST(65898.917303743554/8.0), - REAL_CONST(65920.280975843489/8.0), - REAL_CONST(65941.646378986843/8.0), - REAL_CONST(65963.013512893158/8.0), - REAL_CONST(65984.382377282076/8.0), - REAL_CONST(66005.752971873386/8.0), - REAL_CONST(66027.125296386963/8.0), - REAL_CONST(66048.499350542799/8.0), - REAL_CONST(66069.875134061018/8.0), - REAL_CONST(66091.252646661844/8.0), - REAL_CONST(66112.631888065618/8.0), - REAL_CONST(66134.01285799277/8.0), - REAL_CONST(66155.395556163887/8.0), - REAL_CONST(66176.779982299631/8.0), - REAL_CONST(66198.166136120795/8.0), - REAL_CONST(66219.554017348273/8.0), - REAL_CONST(66240.943625703105/8.0), - REAL_CONST(66262.334960906388/8.0), - REAL_CONST(66283.728022679396/8.0), - REAL_CONST(66305.122810743444/8.0), - REAL_CONST(66326.519324820023/8.0), - REAL_CONST(66347.917564630698/8.0), - REAL_CONST(66369.317529897162/8.0), - REAL_CONST(66390.719220341227/8.0), - REAL_CONST(66412.122635684791/8.0), - REAL_CONST(66433.527775649884/8.0), - REAL_CONST(66454.934639958636/8.0), - REAL_CONST(66476.343228333324/8.0), - REAL_CONST(66497.753540496284/8.0), - REAL_CONST(66519.165576169995/8.0), - REAL_CONST(66540.57933507704/8.0), - REAL_CONST(66561.994816940118/8.0), - REAL_CONST(66583.412021482043/8.0), - REAL_CONST(66604.830948425733/8.0), - REAL_CONST(66626.251597494222/8.0), - REAL_CONST(66647.673968410629/8.0), - REAL_CONST(66669.098060898235/8.0), - REAL_CONST(66690.523874680381/8.0), - REAL_CONST(66711.951409480564/8.0), - REAL_CONST(66733.380665022371/8.0), - REAL_CONST(66754.811641029475/8.0), - REAL_CONST(66776.244337225711/8.0), - REAL_CONST(66797.678753334985/8.0), - REAL_CONST(66819.11488908132/8.0), - REAL_CONST(66840.552744188884/8.0), - REAL_CONST(66861.992318381905/8.0), - REAL_CONST(66883.433611384738/8.0), - REAL_CONST(66904.876622921889/8.0), - REAL_CONST(66926.321352717903/8.0), - REAL_CONST(66947.767800497502/8.0), - REAL_CONST(66969.215965985466/8.0), - REAL_CONST(66990.665848906734/8.0), - REAL_CONST(67012.117448986304/8.0), - REAL_CONST(67033.570765949335/8.0), - REAL_CONST(67055.025799521056/8.0), - REAL_CONST(67076.482549426815/8.0), - REAL_CONST(67097.941015392076/8.0), - REAL_CONST(67119.401197142433/8.0), - REAL_CONST(67140.863094403554/8.0), - REAL_CONST(67162.326706901222/8.0), - REAL_CONST(67183.792034361351/8.0), - REAL_CONST(67205.259076509959/8.0), - REAL_CONST(67226.72783307315/8.0), - REAL_CONST(67248.198303777172/8.0), - REAL_CONST(67269.670488348347/8.0), - REAL_CONST(67291.144386513144/8.0), - REAL_CONST(67312.619997998088/8.0), - REAL_CONST(67334.09732252988/8.0), - REAL_CONST(67355.576359835293/8.0), - REAL_CONST(67377.057109641188/8.0), - REAL_CONST(67398.53957167457/8.0), - REAL_CONST(67420.023745662547/8.0), - REAL_CONST(67441.50963133233/8.0), - REAL_CONST(67462.99722841123/8.0), - REAL_CONST(67484.486536626689/8.0), - REAL_CONST(67505.977555706224/8.0), - REAL_CONST(67527.470285377494/8.0), - REAL_CONST(67548.964725368263/8.0), - REAL_CONST(67570.460875406367/8.0), - REAL_CONST(67591.9587352198/8.0), - REAL_CONST(67613.458304536631/8.0), - REAL_CONST(67634.95958308503/8.0), - REAL_CONST(67656.462570593329/8.0), - REAL_CONST(67677.967266789899/8.0), - REAL_CONST(67699.473671403248/8.0), - REAL_CONST(67720.981784162024/8.0), - REAL_CONST(67742.491604794923/8.0), - REAL_CONST(67764.003133030797/8.0), - REAL_CONST(67785.516368598575/8.0), - REAL_CONST(67807.031311227314/8.0), - REAL_CONST(67828.547960646174/8.0), - REAL_CONST(67850.066316584402/8.0), - REAL_CONST(67871.58637877139/8.0), - REAL_CONST(67893.108146936589/8.0), - REAL_CONST(67914.63162080961/8.0), - REAL_CONST(67936.156800120138/8.0), - REAL_CONST(67957.683684597971/8.0), - REAL_CONST(67979.212273973011/8.0), - REAL_CONST(68000.742567975263/8.0), - REAL_CONST(68022.274566334876/8.0), - REAL_CONST(68043.808268782057/8.0), - REAL_CONST(68065.343675047145/8.0), - REAL_CONST(68086.880784860579/8.0), - REAL_CONST(68108.419597952918/8.0), - REAL_CONST(68129.960114054789/8.0), - REAL_CONST(68151.502332896969/8.0), - REAL_CONST(68173.04625421032/8.0), - REAL_CONST(68194.591877725834/8.0), - REAL_CONST(68216.139203174564/8.0), - REAL_CONST(68237.688230287706/8.0), - REAL_CONST(68259.238958796544/8.0), - REAL_CONST(68280.791388432481/8.0), - REAL_CONST(68302.345518927032/8.0), - REAL_CONST(68323.901350011787/8.0), - REAL_CONST(68345.458881418483/8.0), - REAL_CONST(68367.018112878912/8.0), - REAL_CONST(68388.579044125028/8.0), - REAL_CONST(68410.141674888844/8.0), - REAL_CONST(68431.706004902502/8.0), - REAL_CONST(68453.272033898262/8.0), - REAL_CONST(68474.839761608455/8.0), - REAL_CONST(68496.409187765545/8.0), - REAL_CONST(68517.980312102081/8.0), - REAL_CONST(68539.553134350732/8.0), - REAL_CONST(68561.127654244279/8.0), - REAL_CONST(68582.70387151558/8.0), - REAL_CONST(68604.281785897634/8.0), - REAL_CONST(68625.861397123503/8.0), - REAL_CONST(68647.44270492639/8.0), - REAL_CONST(68669.025709039604/8.0), - REAL_CONST(68690.610409196524/8.0), - REAL_CONST(68712.196805130661/8.0), - REAL_CONST(68733.784896575627/8.0), - REAL_CONST(68755.374683265123/8.0), - REAL_CONST(68776.966164932994/8.0), - REAL_CONST(68798.559341313128/8.0), - REAL_CONST(68820.154212139591/8.0), - REAL_CONST(68841.750777146473/8.0), - REAL_CONST(68863.349036068044/8.0), - REAL_CONST(68884.948988638629/8.0), - REAL_CONST(68906.550634592684/8.0), - REAL_CONST(68928.153973664739/8.0), - REAL_CONST(68949.75900558944/8.0), - REAL_CONST(68971.365730101577/8.0), - REAL_CONST(68992.974146935987/8.0), - REAL_CONST(69014.584255827634/8.0), - REAL_CONST(69036.196056511588/8.0), - REAL_CONST(69057.809548723017/8.0), - REAL_CONST(69079.424732197207/8.0), - REAL_CONST(69101.041606669532/8.0), - REAL_CONST(69122.660171875468/8.0), - REAL_CONST(69144.280427550606/8.0), - REAL_CONST(69165.902373430625/8.0), - REAL_CONST(69187.526009251334/8.0), - REAL_CONST(69209.151334748618/8.0), - REAL_CONST(69230.778349658474/8.0), - REAL_CONST(69252.40705371699/8.0), - REAL_CONST(69274.037446660412/8.0), - REAL_CONST(69295.669528225/8.0), - REAL_CONST(69317.303298147192/8.0), - REAL_CONST(69338.938756163494/8.0), - REAL_CONST(69360.575902010532/8.0), - REAL_CONST(69382.214735425005/8.0), - REAL_CONST(69403.855256143754/8.0), - REAL_CONST(69425.497463903681/8.0), - REAL_CONST(69447.141358441833/8.0), - REAL_CONST(69468.78693949533/8.0), - REAL_CONST(69490.434206801394/8.0), - REAL_CONST(69512.083160097391/8.0), - REAL_CONST(69533.733799120717/8.0), - REAL_CONST(69555.386123608929/8.0), - REAL_CONST(69577.04013329967/8.0), - REAL_CONST(69598.695827930685/8.0), - REAL_CONST(69620.353207239794/8.0), - REAL_CONST(69642.012270964973/8.0), - REAL_CONST(69663.67301884426/8.0), - REAL_CONST(69685.335450615792/8.0), - REAL_CONST(69706.999566017839/8.0), - REAL_CONST(69728.665364788743/8.0), - REAL_CONST(69750.332846666963/8.0), - REAL_CONST(69772.002011391058/8.0), - REAL_CONST(69793.672858699691/8.0), - REAL_CONST(69815.345388331611/8.0), - REAL_CONST(69837.019600025669/8.0), - REAL_CONST(69858.695493520849/8.0), - REAL_CONST(69880.373068556204/8.0), - REAL_CONST(69902.052324870907/8.0), - REAL_CONST(69923.733262204216/8.0), - REAL_CONST(69945.415880295492/8.0), - REAL_CONST(69967.100178884211/8.0), - REAL_CONST(69988.786157709939/8.0), - REAL_CONST(70010.473816512356/8.0), - REAL_CONST(70032.163155031216/8.0), - REAL_CONST(70053.854173006403/8.0), - REAL_CONST(70075.546870177874/8.0), - REAL_CONST(70097.241246285717/8.0), - REAL_CONST(70118.937301070109/8.0), - REAL_CONST(70140.635034271298/8.0), - REAL_CONST(70162.334445629691/8.0), - REAL_CONST(70184.035534885741/8.0), - REAL_CONST(70205.738301780017/8.0), - REAL_CONST(70227.442746053217/8.0), - REAL_CONST(70249.1488674461/8.0), - REAL_CONST(70270.856665699539/8.0), - REAL_CONST(70292.566140554511/8.0), - REAL_CONST(70314.277291752107/8.0), - REAL_CONST(70335.990119033493/8.0), - REAL_CONST(70357.704622139936/8.0), - REAL_CONST(70379.420800812819/8.0), - REAL_CONST(70401.138654793613/8.0), - REAL_CONST(70422.85818382389/8.0), - REAL_CONST(70444.579387645339/8.0), - REAL_CONST(70466.302265999722/8.0), - REAL_CONST(70488.026818628918/8.0), - REAL_CONST(70509.753045274876/8.0), - REAL_CONST(70531.480945679708/8.0), - REAL_CONST(70553.210519585555/8.0), - REAL_CONST(70574.941766734701/8.0), - REAL_CONST(70596.674686869505/8.0), - REAL_CONST(70618.409279732456/8.0), - REAL_CONST(70640.145545066101/8.0), - REAL_CONST(70661.883482613106/8.0), - REAL_CONST(70683.623092116264/8.0), - REAL_CONST(70705.364373318414/8.0), - REAL_CONST(70727.107325962526/8.0), - REAL_CONST(70748.851949791671/8.0), - REAL_CONST(70770.598244549008/8.0), - REAL_CONST(70792.346209977783/8.0), - REAL_CONST(70814.095845821372/8.0), - REAL_CONST(70835.847151823225/8.0), - REAL_CONST(70857.600127726895/8.0), - REAL_CONST(70879.354773276034/8.0), - REAL_CONST(70901.111088214413/8.0), - REAL_CONST(70922.869072285859/8.0), - REAL_CONST(70944.628725234332/8.0), - REAL_CONST(70966.390046803877/8.0), - REAL_CONST(70988.153036738629/8.0), - REAL_CONST(71009.917694782853/8.0), - REAL_CONST(71031.684020680885/8.0), - REAL_CONST(71053.45201417715/8.0), - REAL_CONST(71075.221675016204/8.0), - REAL_CONST(71096.993002942661/8.0), - REAL_CONST(71118.765997701266/8.0), - REAL_CONST(71140.540659036851/8.0), - REAL_CONST(71162.316986694335/8.0), - REAL_CONST(71184.09498041874/8.0), - REAL_CONST(71205.874639955218/8.0), - REAL_CONST(71227.655965048951/8.0), - REAL_CONST(71249.438955445294/8.0), - REAL_CONST(71271.223610889632/8.0), - REAL_CONST(71293.009931127483/8.0), - REAL_CONST(71314.797915904477/8.0), - REAL_CONST(71336.587564966307/8.0), - REAL_CONST(71358.378878058764/8.0), - REAL_CONST(71380.171854927772/8.0), - REAL_CONST(71401.966495319313/8.0), - REAL_CONST(71423.762798979486/8.0), - REAL_CONST(71445.560765654489/8.0), - REAL_CONST(71467.360395090596/8.0), - REAL_CONST(71489.161687034211/8.0), - REAL_CONST(71510.964641231811/8.0), - REAL_CONST(71532.769257429973/8.0), - REAL_CONST(71554.575535375348/8.0), - REAL_CONST(71576.383474814749/8.0), - REAL_CONST(71598.19307549503/8.0), - REAL_CONST(71620.004337163133/8.0), - REAL_CONST(71641.817259566145/8.0), - REAL_CONST(71663.631842451214/8.0), - REAL_CONST(71685.4480855656/8.0), - REAL_CONST(71707.26598865664/8.0), - REAL_CONST(71729.085551471784/8.0), - REAL_CONST(71750.906773758586/8.0), - REAL_CONST(71772.729655264673/8.0), - REAL_CONST(71794.554195737772/8.0), - REAL_CONST(71816.380394925713/8.0), - REAL_CONST(71838.208252576442/8.0), - REAL_CONST(71860.037768437964/8.0), - REAL_CONST(71881.868942258385/8.0), - REAL_CONST(71903.701773785942/8.0), - REAL_CONST(71925.536262768932/8.0), - REAL_CONST(71947.372408955751/8.0), - REAL_CONST(71969.210212094898/8.0), - REAL_CONST(71991.049671934976/8.0), - REAL_CONST(72012.890788224686/8.0), - REAL_CONST(72034.73356071279/8.0), - REAL_CONST(72056.577989148165/8.0), - REAL_CONST(72078.424073279821/8.0), - REAL_CONST(72100.271812856794/8.0), - REAL_CONST(72122.121207628254/8.0), - REAL_CONST(72143.97225734347/8.0), - REAL_CONST(72165.824961751801/8.0), - REAL_CONST(72187.679320602692/8.0), - REAL_CONST(72209.53533364569/8.0), - REAL_CONST(72231.393000630429/8.0), - REAL_CONST(72253.252321306645/8.0), - REAL_CONST(72275.113295424177/8.0), - REAL_CONST(72296.975922732949/8.0), - REAL_CONST(72318.840202982959/8.0), - REAL_CONST(72340.706135924338/8.0), - REAL_CONST(72362.573721307272/8.0), - REAL_CONST(72384.442958882093/8.0), - REAL_CONST(72406.313848399179/8.0), - REAL_CONST(72428.186389609036/8.0), - REAL_CONST(72450.060582262216/8.0), - REAL_CONST(72471.936426109431/8.0), - REAL_CONST(72493.813920901433/8.0), - REAL_CONST(72515.693066389096/8.0), - REAL_CONST(72537.573862323392/8.0), - REAL_CONST(72559.456308455352/8.0), - REAL_CONST(72581.340404536139/8.0), - REAL_CONST(72603.226150316987/8.0), - REAL_CONST(72625.113545549248/8.0), - REAL_CONST(72647.002589984331/8.0), - REAL_CONST(72668.893283373764/8.0), - REAL_CONST(72690.785625469172/8.0), - REAL_CONST(72712.679616022273/8.0), - REAL_CONST(72734.575254784853/8.0), - REAL_CONST(72756.472541508803/8.0), - REAL_CONST(72778.371475946144/8.0), - REAL_CONST(72800.272057848939/8.0), - REAL_CONST(72822.174286969355/8.0), - REAL_CONST(72844.07816305969/8.0), - REAL_CONST(72865.983685872285/8.0), - REAL_CONST(72887.890855159596/8.0), - REAL_CONST(72909.799670674183/8.0), - REAL_CONST(72931.710132168693/8.0), - REAL_CONST(72953.622239395845/8.0), - REAL_CONST(72975.535992108475/8.0), - REAL_CONST(72997.451390059519/8.0), - REAL_CONST(73019.368433001961/8.0), - REAL_CONST(73041.287120688925/8.0), - REAL_CONST(73063.207452873612/8.0), - REAL_CONST(73085.129429309294/8.0), - REAL_CONST(73107.053049749389/8.0), - REAL_CONST(73128.978313947344/8.0), - REAL_CONST(73150.905221656736/8.0), - REAL_CONST(73172.833772631217/8.0), - REAL_CONST(73194.763966624567/8.0), - REAL_CONST(73216.695803390612/8.0), - REAL_CONST(73238.62928268328/8.0), - REAL_CONST(73260.564404256627/8.0), - REAL_CONST(73282.501167864757/8.0), - REAL_CONST(73304.439573261901/8.0), - REAL_CONST(73326.379620202337/8.0), - REAL_CONST(73348.321308440485/8.0), - REAL_CONST(73370.264637730841/8.0), - REAL_CONST(73392.209607827957/8.0), - REAL_CONST(73414.156218486532/8.0), - REAL_CONST(73436.104469461323/8.0), - REAL_CONST(73458.054360507173/8.0), - REAL_CONST(73480.005891379056/8.0), - REAL_CONST(73501.959061831993/8.0), - REAL_CONST(73523.913871621116/8.0), - REAL_CONST(73545.870320501665/8.0), - REAL_CONST(73567.828408228932/8.0), - REAL_CONST(73589.78813455833/8.0), - REAL_CONST(73611.749499245358/8.0), - REAL_CONST(73633.712502045615/8.0), - REAL_CONST(73655.677142714747/8.0), - REAL_CONST(73677.643421008557/8.0), - REAL_CONST(73699.611336682879/8.0), - REAL_CONST(73721.580889493693/8.0), - REAL_CONST(73743.552079197019/8.0), - REAL_CONST(73765.524905548999/8.0), - REAL_CONST(73787.499368305856/8.0), - REAL_CONST(73809.475467223907/8.0), - REAL_CONST(73831.453202059551/8.0), - REAL_CONST(73853.432572569291/8.0), - REAL_CONST(73875.413578509717/8.0), - REAL_CONST(73897.396219637507/8.0), - REAL_CONST(73919.380495709411/8.0), - REAL_CONST(73941.36640648231/8.0), - REAL_CONST(73963.353951713143/8.0), - REAL_CONST(73985.343131158952/8.0), - REAL_CONST(74007.333944576865/8.0), - REAL_CONST(74029.326391724098/8.0), - REAL_CONST(74051.320472357969/8.0), - REAL_CONST(74073.316186235883/8.0), - REAL_CONST(74095.313533115303/8.0), - REAL_CONST(74117.312512753837/8.0), - REAL_CONST(74139.313124909138/8.0), - REAL_CONST(74161.315369338976/8.0), - REAL_CONST(74183.319245801191/8.0), - REAL_CONST(74205.324754053727/8.0), - REAL_CONST(74227.331893854629/8.0), - REAL_CONST(74249.340664961986/8.0), - REAL_CONST(74271.351067134034/8.0), - REAL_CONST(74293.363100129049/8.0), - REAL_CONST(74315.376763705441/8.0), - REAL_CONST(74337.392057621662/8.0), - REAL_CONST(74359.408981636298/8.0), - REAL_CONST(74381.427535508003/8.0), - REAL_CONST(74403.447718995507/8.0), - REAL_CONST(74425.469531857671/8.0), - REAL_CONST(74447.492973853383/8.0), - REAL_CONST(74469.518044741693/8.0), - REAL_CONST(74491.54474428168/8.0), - REAL_CONST(74513.573072232539/8.0), - REAL_CONST(74535.603028353551/8.0), - REAL_CONST(74557.634612404087/8.0), - REAL_CONST(74579.667824143602/8.0), - REAL_CONST(74601.702663331642/8.0), - REAL_CONST(74623.739129727837/8.0), - REAL_CONST(74645.777223091936/8.0), - REAL_CONST(74667.816943183716/8.0), - REAL_CONST(74689.858289763113/8.0), - REAL_CONST(74711.901262590094/8.0), - REAL_CONST(74733.945861424741/8.0), - REAL_CONST(74755.992086027225/8.0), - REAL_CONST(74778.039936157802/8.0), - REAL_CONST(74800.089411576817/8.0), - REAL_CONST(74822.140512044702/8.0), - REAL_CONST(74844.193237321961/8.0), - REAL_CONST(74866.24758716923/8.0), - REAL_CONST(74888.303561347187/8.0), - REAL_CONST(74910.36115961663/8.0), - REAL_CONST(74932.420381738411/8.0), - REAL_CONST(74954.481227473516/8.0), - REAL_CONST(74976.543696582972/8.0), - REAL_CONST(74998.607788827925/8.0), - REAL_CONST(75020.673503969607/8.0), - REAL_CONST(75042.740841769322/8.0), - REAL_CONST(75064.809801988464/8.0), - REAL_CONST(75086.88038438854/8.0), - REAL_CONST(75108.952588731103/8.0), - REAL_CONST(75131.026414777836/8.0), - REAL_CONST(75153.101862290467/8.0), - REAL_CONST(75175.178931030852/8.0), - REAL_CONST(75197.257620760924/8.0), - REAL_CONST(75219.33793124267/8.0), - REAL_CONST(75241.419862238225/8.0), - REAL_CONST(75263.503413509738/8.0), - REAL_CONST(75285.588584819503/8.0), - REAL_CONST(75307.675375929874/8.0), - REAL_CONST(75329.763786603318/8.0), - REAL_CONST(75351.853816602365/8.0), - REAL_CONST(75373.945465689612/8.0), - REAL_CONST(75396.038733627807/8.0), - REAL_CONST(75418.133620179724/8.0), - REAL_CONST(75440.230125108254/8.0), - REAL_CONST(75462.32824817636/8.0), - REAL_CONST(75484.427989147109/8.0), - REAL_CONST(75506.529347783653/8.0), - REAL_CONST(75528.63232384919/8.0), - REAL_CONST(75550.736917107075/8.0), - REAL_CONST(75572.843127320695/8.0), - REAL_CONST(75594.950954253538/8.0), - REAL_CONST(75617.060397669193/8.0), - REAL_CONST(75639.171457331307/8.0), - REAL_CONST(75661.284133003646/8.0), - REAL_CONST(75683.398424450032/8.0), - REAL_CONST(75705.514331434402/8.0), - REAL_CONST(75727.631853720741/8.0), - REAL_CONST(75749.750991073175/8.0), - REAL_CONST(75771.871743255862/8.0), - REAL_CONST(75793.994110033076/8.0), - REAL_CONST(75816.118091169177/8.0), - REAL_CONST(75838.243686428585/8.0), - REAL_CONST(75860.370895575848/8.0), - REAL_CONST(75882.499718375562/8.0), - REAL_CONST(75904.630154592422/8.0), - REAL_CONST(75926.762203991224/8.0), - REAL_CONST(75948.895866336825/8.0), - REAL_CONST(75971.031141394182/8.0), - REAL_CONST(75993.168028928325/8.0), - REAL_CONST(76015.306528704401/8.0), - REAL_CONST(76037.4466404876/8.0), - REAL_CONST(76059.588364043215/8.0), - REAL_CONST(76081.731699136653/8.0), - REAL_CONST(76103.876645533353/8.0), - REAL_CONST(76126.023202998884/8.0), - REAL_CONST(76148.171371298871/8.0), - REAL_CONST(76170.321150199044/8.0), - REAL_CONST(76192.472539465205/8.0), - REAL_CONST(76214.625538863256/8.0), - REAL_CONST(76236.780148159174/8.0), - REAL_CONST(76258.936367119008/8.0), - REAL_CONST(76281.094195508922/8.0), - REAL_CONST(76303.253633095141/8.0), - REAL_CONST(76325.414679643975/8.0), - REAL_CONST(76347.577334921851/8.0), - REAL_CONST(76369.741598695226/8.0), - REAL_CONST(76391.907470730686/8.0), - REAL_CONST(76414.074950794879/8.0), - REAL_CONST(76436.244038654564/8.0), - REAL_CONST(76458.414734076548/8.0), - REAL_CONST(76480.587036827754/8.0), - REAL_CONST(76502.760946675175/8.0), - REAL_CONST(76524.936463385893/8.0), - REAL_CONST(76547.11358672705/8.0), - REAL_CONST(76569.292316465915/8.0), - REAL_CONST(76591.472652369819/8.0), - REAL_CONST(76613.654594206164/8.0), - REAL_CONST(76635.838141742468/8.0), - REAL_CONST(76658.023294746308/8.0), - REAL_CONST(76680.210052985349/8.0), - REAL_CONST(76702.398416227341/8.0), - REAL_CONST(76724.588384240138/8.0), - REAL_CONST(76746.779956791637/8.0), - REAL_CONST(76768.973133649866/8.0), - REAL_CONST(76791.167914582897/8.0), - REAL_CONST(76813.364299358902/8.0), - REAL_CONST(76835.562287746157/8.0), - REAL_CONST(76857.761879512967/8.0), - REAL_CONST(76879.963074427797/8.0), - REAL_CONST(76902.165872259109/8.0), - REAL_CONST(76924.37027277553/8.0), - REAL_CONST(76946.576275745727/8.0), - REAL_CONST(76968.783880938441/8.0), - REAL_CONST(76990.993088122515/8.0), - REAL_CONST(77013.203897066895/8.0), - REAL_CONST(77035.416307540567/8.0), - REAL_CONST(77057.630319312622/8.0), - REAL_CONST(77079.845932152239/8.0), - REAL_CONST(77102.063145828695/8.0), - REAL_CONST(77124.281960111301/8.0), - REAL_CONST(77146.50237476948/8.0), - REAL_CONST(77168.724389572759/8.0), - REAL_CONST(77190.948004290723/8.0), - REAL_CONST(77213.173218693031/8.0), - REAL_CONST(77235.400032549442/8.0), - REAL_CONST(77257.628445629802/8.0), - REAL_CONST(77279.858457704031/8.0), - REAL_CONST(77302.090068542122/8.0), - REAL_CONST(77324.323277914169/8.0), - REAL_CONST(77346.558085590339/8.0), - REAL_CONST(77368.794491340886/8.0), - REAL_CONST(77391.032494936138/8.0), - REAL_CONST(77413.272096146524/8.0), - REAL_CONST(77435.51329474253/8.0), - REAL_CONST(77457.756090494731/8.0), - REAL_CONST(77480.000483173804/8.0), - REAL_CONST(77502.246472550498/8.0), - REAL_CONST(77524.494058395634/8.0), - REAL_CONST(77546.743240480107/8.0), - REAL_CONST(77568.994018574944/8.0), - REAL_CONST(77591.246392451198/8.0), - REAL_CONST(77613.500361880026/8.0), - REAL_CONST(77635.755926632657/8.0), - REAL_CONST(77658.013086480438/8.0), - REAL_CONST(77680.271841194757/8.0), - REAL_CONST(77702.532190547092/8.0), - REAL_CONST(77724.794134309021/8.0), - REAL_CONST(77747.057672252195/8.0), - REAL_CONST(77769.322804148323/8.0), - REAL_CONST(77791.589529769248/8.0), - REAL_CONST(77813.857848886837/8.0), - REAL_CONST(77836.127761273063/8.0), - REAL_CONST(77858.399266699998/8.0), - REAL_CONST(77880.67236493979/8.0), - REAL_CONST(77902.947055764627/8.0), - REAL_CONST(77925.223338946831/8.0), - REAL_CONST(77947.50121425878/8.0), - REAL_CONST(77969.780681472927/8.0), - REAL_CONST(77992.061740361838/8.0), - REAL_CONST(78014.344390698127/8.0), - REAL_CONST(78036.628632254491/8.0), - REAL_CONST(78058.914464803747/8.0), - REAL_CONST(78081.201888118725/8.0), - REAL_CONST(78103.490901972415/8.0), - REAL_CONST(78125.781506137821/8.0), - REAL_CONST(78148.073700388064/8.0), - REAL_CONST(78170.367484496339/8.0), - REAL_CONST(78192.662858235926/8.0), - REAL_CONST(78214.959821380166/8.0), - REAL_CONST(78237.258373702498/8.0), - REAL_CONST(78259.558514976452/8.0), - REAL_CONST(78281.860244975614/8.0), - REAL_CONST(78304.163563473659/8.0), - REAL_CONST(78326.468470244363/8.0), - REAL_CONST(78348.77496506153/8.0), - REAL_CONST(78371.083047699125/8.0), - REAL_CONST(78393.392717931114/8.0), - REAL_CONST(78415.703975531578/8.0), - REAL_CONST(78438.016820274701/8.0), - REAL_CONST(78460.331251934695/8.0), - REAL_CONST(78482.647270285903/8.0), - REAL_CONST(78504.964875102727/8.0), - REAL_CONST(78527.284066159627/8.0), - REAL_CONST(78549.604843231195/8.0), - REAL_CONST(78571.927206092048/8.0), - REAL_CONST(78594.251154516911/8.0), - REAL_CONST(78616.576688280606/8.0), - REAL_CONST(78638.903807157985/8.0), - REAL_CONST(78661.232510924034/8.0), - REAL_CONST(78683.562799353778/8.0), - REAL_CONST(78705.894672222363/8.0), - REAL_CONST(78728.228129304945/8.0), - REAL_CONST(78750.563170376859/8.0), - REAL_CONST(78772.899795213423/8.0), - REAL_CONST(78795.238003590101/8.0), - REAL_CONST(78817.577795282399/8.0), - REAL_CONST(78839.919170065928/8.0), - REAL_CONST(78862.262127716356/8.0), - REAL_CONST(78884.606668009452/8.0), - REAL_CONST(78906.952790721043/8.0), - REAL_CONST(78929.300495627045/8.0), - REAL_CONST(78951.64978250346/8.0), - REAL_CONST(78974.000651126378/8.0), - REAL_CONST(78996.353101271932/8.0), - REAL_CONST(79018.707132716358/8.0), - REAL_CONST(79041.062745235977/8.0), - REAL_CONST(79063.41993860717/8.0), - REAL_CONST(79085.778712606436/8.0), - REAL_CONST(79108.139067010285/8.0), - REAL_CONST(79130.501001595389/8.0), - REAL_CONST(79152.864516138419/8.0), - REAL_CONST(79175.22961041618/8.0), - REAL_CONST(79197.596284205531/8.0), - REAL_CONST(79219.96453728342/8.0), - REAL_CONST(79242.33436942687/8.0), - REAL_CONST(79264.705780412987/8.0), - REAL_CONST(79287.078770018954/8.0), - REAL_CONST(79309.453338022009/8.0), - REAL_CONST(79331.829484199508/8.0), - REAL_CONST(79354.207208328866/8.0), - REAL_CONST(79376.586510187582/8.0), - REAL_CONST(79398.967389553218/8.0), - REAL_CONST(79421.349846203433/8.0), - REAL_CONST(79443.733879915948/8.0), - REAL_CONST(79466.119490468584/8.0), - REAL_CONST(79488.50667763922/8.0), - REAL_CONST(79510.895441205823/8.0), - REAL_CONST(79533.285780946433/8.0), - REAL_CONST(79555.677696639163/8.0), - REAL_CONST(79578.071188062226/8.0), - REAL_CONST(79600.466254993895/8.0), - REAL_CONST(79622.862897212515/8.0), - REAL_CONST(79645.261114496549/8.0), - REAL_CONST(79667.660906624471/8.0), - REAL_CONST(79690.062273374875/8.0), - REAL_CONST(79712.465214526455/8.0), - REAL_CONST(79734.869729857935/8.0), - REAL_CONST(79757.275819148126/8.0), - REAL_CONST(79779.683482175955/8.0), - REAL_CONST(79802.092718720378/8.0), - REAL_CONST(79824.503528560454/8.0), - REAL_CONST(79846.915911475327/8.0), - REAL_CONST(79869.329867244203/8.0), - REAL_CONST(79891.745395646343/8.0), - REAL_CONST(79914.162496461155/8.0), - REAL_CONST(79936.581169468045/8.0), - REAL_CONST(79959.001414446553/8.0), - REAL_CONST(79981.423231176261/8.0), - REAL_CONST(80003.846619436852/8.0), - REAL_CONST(80026.271579008084/8.0), - REAL_CONST(80048.698109669771/8.0), - REAL_CONST(80071.12621120183/8.0), - REAL_CONST(80093.555883384237/8.0), - REAL_CONST(80115.987125997053/8.0), - REAL_CONST(80138.419938820414/8.0), - REAL_CONST(80160.854321634528/8.0), - REAL_CONST(80183.290274219689/8.0), - REAL_CONST(80205.727796356281/8.0), - REAL_CONST(80228.166887824715/8.0), - REAL_CONST(80250.607548405547/8.0), - REAL_CONST(80273.049777879336/8.0), - REAL_CONST(80295.493576026798/8.0), - REAL_CONST(80317.938942628651/8.0), - REAL_CONST(80340.385877465727/8.0), - REAL_CONST(80362.834380318949/8.0), - REAL_CONST(80385.28445096928/8.0), - REAL_CONST(80407.736089197788/8.0), - REAL_CONST(80430.189294785596/8.0), - REAL_CONST(80452.644067513917/8.0), - REAL_CONST(80475.100407164035/8.0), - REAL_CONST(80497.558313517322/8.0), - REAL_CONST(80520.017786355209/8.0), - REAL_CONST(80542.478825459213/8.0), - REAL_CONST(80564.941430610925/8.0), - REAL_CONST(80587.405601592007/8.0), - REAL_CONST(80609.871338184195/8.0), - REAL_CONST(80632.338640169342/8.0), - REAL_CONST(80654.8075073293/8.0), - REAL_CONST(80677.277939446067/8.0), - REAL_CONST(80699.749936301683/8.0), - REAL_CONST(80722.223497678278/8.0), - REAL_CONST(80744.698623358039/8.0), - REAL_CONST(80767.17531312324/8.0), - REAL_CONST(80789.653566756242/8.0), - REAL_CONST(80812.133384039465/8.0), - REAL_CONST(80834.614764755403/8.0), - REAL_CONST(80857.097708686648/8.0), - REAL_CONST(80879.582215615854/8.0), - REAL_CONST(80902.068285325731/8.0), - REAL_CONST(80924.555917599093/8.0), - REAL_CONST(80947.045112218824/8.0), - REAL_CONST(80969.535868967869/8.0), - REAL_CONST(80992.028187629272/8.0), - REAL_CONST(81014.522067986123/8.0), - REAL_CONST(81037.017509821613/8.0), - REAL_CONST(81059.514512919006/8.0), - REAL_CONST(81082.013077061609/8.0), - REAL_CONST(81104.513202032831/8.0), - REAL_CONST(81127.014887616184/8.0), - REAL_CONST(81149.518133595193/8.0), - REAL_CONST(81172.022939753486/8.0), - REAL_CONST(81194.529305874807/8.0), - REAL_CONST(81217.037231742899/8.0), - REAL_CONST(81239.546717141639/8.0), - REAL_CONST(81262.057761854958/8.0), - REAL_CONST(81284.570365666848/8.0), - REAL_CONST(81307.084528361403/8.0), - REAL_CONST(81329.600249722775/8.0), - REAL_CONST(81352.117529535186/8.0), - REAL_CONST(81374.636367582949/8.0), - REAL_CONST(81397.156763650448/8.0), - REAL_CONST(81419.678717522125/8.0), - REAL_CONST(81442.202228982511/8.0), - REAL_CONST(81464.727297816222/8.0), - REAL_CONST(81487.253923807933/8.0), - REAL_CONST(81509.782106742379/8.0), - REAL_CONST(81532.311846404409/8.0), - REAL_CONST(81554.843142578902/8.0), - REAL_CONST(81577.375995050839/8.0), - REAL_CONST(81599.910403605274/8.0), - REAL_CONST(81622.446368027333/8.0), - REAL_CONST(81644.983888102215/8.0), - REAL_CONST(81667.522963615178/8.0), - REAL_CONST(81690.063594351581/8.0), - REAL_CONST(81712.605780096841/8.0), - REAL_CONST(81735.149520636449/8.0), - REAL_CONST(81757.694815755967/8.0), - REAL_CONST(81780.241665241047/8.0), - REAL_CONST(81802.79006887741/8.0), - REAL_CONST(81825.340026450824/8.0), - REAL_CONST(81847.891537747171/8.0), - REAL_CONST(81870.444602552379/8.0), - REAL_CONST(81892.999220652477/8.0), - REAL_CONST(81915.555391833506/8.0), - REAL_CONST(81938.113115881672/8.0), - REAL_CONST(81960.672392583176/8.0), - REAL_CONST(81983.233221724338/8.0), - REAL_CONST(82005.795603091537/8.0), - REAL_CONST(82028.359536471224/8.0), - REAL_CONST(82050.925021649906/8.0), - REAL_CONST(82073.492058414209/8.0), - REAL_CONST(82096.060646550788/8.0), - REAL_CONST(82118.630785846399/8.0), - REAL_CONST(82141.202476087841/8.0), - REAL_CONST(82163.775717062032/8.0), - REAL_CONST(82186.35050855593/8.0), - REAL_CONST(82208.926850356569/8.0), - REAL_CONST(82231.504742251054/8.0), - REAL_CONST(82254.084184026578/8.0), - REAL_CONST(82276.665175470393/8.0), - REAL_CONST(82299.24771636985/8.0), - REAL_CONST(82321.831806512317/8.0), - REAL_CONST(82344.417445685307/8.0), - REAL_CONST(82367.004633676348/8.0), - REAL_CONST(82389.593370273054/8.0), - REAL_CONST(82412.183655263143/8.0), - REAL_CONST(82434.775488434374/8.0), - REAL_CONST(82457.368869574595/8.0), - REAL_CONST(82479.963798471697/8.0), - REAL_CONST(82502.560274913689/8.0), - REAL_CONST(82525.158298688606/8.0), - REAL_CONST(82547.757869584602/8.0), - REAL_CONST(82570.35898738986/8.0), - REAL_CONST(82592.961651892678/8.0), - REAL_CONST(82615.565862881398/8.0), - REAL_CONST(82638.171620144421/8.0), - REAL_CONST(82660.778923470265/8.0), - REAL_CONST(82683.387772647475/8.0), - REAL_CONST(82705.998167464713/8.0), - REAL_CONST(82728.610107710658/8.0), - REAL_CONST(82751.223593174116/8.0), - REAL_CONST(82773.83862364394/8.0), - REAL_CONST(82796.45519890904/8.0), - REAL_CONST(82819.073318758441/8.0), - REAL_CONST(82841.692982981185/8.0), - REAL_CONST(82864.314191366429/8.0), - REAL_CONST(82886.936943703375/8.0), - REAL_CONST(82909.561239781324/8.0), - REAL_CONST(82932.187079389638/8.0), - REAL_CONST(82954.814462317736/8.0), - REAL_CONST(82977.443388355125/8.0), - REAL_CONST(83000.073857291369/8.0), - REAL_CONST(83022.70586891612/8.0), - REAL_CONST(83045.339423019104/8.0), - REAL_CONST(83067.974519390089/8.0), - REAL_CONST(83090.611157818959/8.0), - REAL_CONST(83113.249338095629/8.0), - REAL_CONST(83135.8890600101/8.0), - REAL_CONST(83158.530323352461/8.0), - REAL_CONST(83181.173127912858/8.0), - REAL_CONST(83203.817473481497/8.0), - REAL_CONST(83226.463359848669/8.0), - REAL_CONST(83249.11078680474/8.0), - REAL_CONST(83271.759754140134/8.0), - REAL_CONST(83294.410261645375/8.0), - REAL_CONST(83317.062309111003/8.0), - REAL_CONST(83339.715896327703/8.0), - REAL_CONST(83362.371023086147/8.0), - REAL_CONST(83385.027689177165/8.0), - REAL_CONST(83407.685894391587/8.0), - REAL_CONST(83430.345638520361/8.0), - REAL_CONST(83453.006921354478/8.0), - REAL_CONST(83475.669742685001/8.0), - REAL_CONST(83498.334102303095/8.0), - REAL_CONST(83520.999999999942/8.0), - REAL_CONST(83543.667435566866/8.0), - REAL_CONST(83566.336408795192/8.0), - REAL_CONST(83589.006919476349/8.0), - REAL_CONST(83611.678967401851/8.0), - REAL_CONST(83634.352552363242/8.0), - REAL_CONST(83657.027674152167/8.0), - REAL_CONST(83679.704332560359/8.0), - REAL_CONST(83702.382527379552/8.0), - REAL_CONST(83725.062258401638/8.0), - REAL_CONST(83747.743525418511/8.0), - REAL_CONST(83770.42632822218/8.0), - REAL_CONST(83793.110666604684/8.0), - REAL_CONST(83815.796540358162/8.0), - REAL_CONST(83838.483949274829/8.0), - REAL_CONST(83861.172893146941/8.0), - REAL_CONST(83883.863371766842/8.0), - REAL_CONST(83906.555384926964/8.0), - REAL_CONST(83929.248932419752/8.0), - REAL_CONST(83951.944014037799/8.0), - REAL_CONST(83974.640629573696/8.0), - REAL_CONST(83997.338778820151/8.0), - REAL_CONST(84020.038461569929/8.0), - REAL_CONST(84042.739677615857/8.0), - REAL_CONST(84065.442426750829/8.0), - REAL_CONST(84088.146708767847/8.0), - REAL_CONST(84110.852523459922/8.0), - REAL_CONST(84133.559870620171/8.0), - REAL_CONST(84156.268750041796/8.0), - REAL_CONST(84178.979161518029/8.0), - REAL_CONST(84201.691104842204/8.0), - REAL_CONST(84224.404579807713/8.0), - REAL_CONST(84247.119586208006/8.0), - REAL_CONST(84269.83612383662/8.0), - REAL_CONST(84292.55419248715/8.0), - REAL_CONST(84315.273791953281/8.0), - REAL_CONST(84337.994922028738/8.0), - REAL_CONST(84360.717582507335/8.0), - REAL_CONST(84383.441773182945/8.0), - REAL_CONST(84406.167493849513/8.0), - REAL_CONST(84428.894744301069/8.0), - REAL_CONST(84451.623524331691/8.0), - REAL_CONST(84474.353833735542/8.0), - REAL_CONST(84497.085672306828/8.0), - REAL_CONST(84519.819039839858/8.0), - REAL_CONST(84542.553936128999/8.0), - REAL_CONST(84565.290360968676/8.0), - REAL_CONST(84588.028314153402/8.0), - REAL_CONST(84610.767795477717/8.0), - REAL_CONST(84633.508804736295/8.0), - REAL_CONST(84656.251341723822/8.0), - REAL_CONST(84678.995406235073/8.0), - REAL_CONST(84701.740998064924/8.0), - REAL_CONST(84724.488117008252/8.0), - REAL_CONST(84747.236762860062/8.0), - REAL_CONST(84769.986935415407/8.0), - REAL_CONST(84792.73863446941/8.0), - REAL_CONST(84815.491859817252/8.0), - REAL_CONST(84838.246611254188/8.0), - REAL_CONST(84861.002888575575/8.0), - REAL_CONST(84883.760691576768/8.0), - REAL_CONST(84906.520020053256/8.0), - REAL_CONST(84929.28087380057/8.0), - REAL_CONST(84952.043252614312/8.0), - REAL_CONST(84974.807156290146/8.0), - REAL_CONST(84997.572584623806/8.0), - REAL_CONST(85020.339537411113/8.0), - REAL_CONST(85043.108014447949/8.0), - REAL_CONST(85065.878015530237/8.0), - REAL_CONST(85088.649540453989/8.0), - REAL_CONST(85111.422589015303/8.0), - REAL_CONST(85134.197161010321/8.0), - REAL_CONST(85156.973256235244/8.0), - REAL_CONST(85179.750874486374/8.0), - REAL_CONST(85202.530015560071/8.0), - REAL_CONST(85225.310679252725/8.0), - REAL_CONST(85248.092865360857/8.0), - REAL_CONST(85270.876573681016/8.0), - REAL_CONST(85293.661804009811/8.0), - REAL_CONST(85316.448556143951/8.0), - REAL_CONST(85339.236829880188/8.0), - REAL_CONST(85362.026625015351/8.0), - REAL_CONST(85384.817941346351/8.0), - REAL_CONST(85407.610778670132/8.0), - REAL_CONST(85430.405136783724/8.0), - REAL_CONST(85453.201015484257/8.0), - REAL_CONST(85475.998414568865/8.0), - REAL_CONST(85498.797333834795/8.0), - REAL_CONST(85521.597773079353/8.0), - REAL_CONST(85544.399732099904/8.0), - REAL_CONST(85567.203210693886/8.0), - REAL_CONST(85590.008208658808/8.0), - REAL_CONST(85612.814725792239/8.0), - REAL_CONST(85635.62276189182/8.0), - REAL_CONST(85658.432316755265/8.0), - REAL_CONST(85681.243390180331/8.0), - REAL_CONST(85704.055981964877/8.0), - REAL_CONST(85726.870091906807/8.0), - REAL_CONST(85749.685719804082/8.0), - REAL_CONST(85772.502865454764/8.0), - REAL_CONST(85795.321528656961/8.0), - REAL_CONST(85818.141709208852/8.0), - REAL_CONST(85840.963406908675/8.0), - REAL_CONST(85863.78662155474/8.0), - REAL_CONST(85886.611352945445/8.0), - REAL_CONST(85909.437600879217/8.0), - REAL_CONST(85932.26536515457/8.0), - REAL_CONST(85955.094645570091/8.0), - REAL_CONST(85977.92544192441/8.0), - REAL_CONST(86000.757754016275/8.0), - REAL_CONST(86023.591581644432/8.0), - REAL_CONST(86046.426924607746/8.0), - REAL_CONST(86069.263782705122/8.0), - REAL_CONST(86092.102155735556/8.0), - REAL_CONST(86114.942043498071/8.0), - REAL_CONST(86137.783445791807/8.0), - REAL_CONST(86160.626362415918/8.0), - REAL_CONST(86183.470793169676/8.0), - REAL_CONST(86206.316737852379/8.0), - REAL_CONST(86229.164196263402/8.0), - REAL_CONST(86252.013168202204/8.0), - REAL_CONST(86274.863653468303/8.0), - REAL_CONST(86297.715651861261/8.0), - REAL_CONST(86320.569163180728/8.0), - REAL_CONST(86343.424187226425/8.0), - REAL_CONST(86366.280723798132/8.0), - REAL_CONST(86389.138772695675/8.0), - REAL_CONST(86411.998333718977/8.0), - REAL_CONST(86434.859406668009/8.0), - REAL_CONST(86457.721991342827/8.0), - REAL_CONST(86480.586087543532/8.0), - REAL_CONST(86503.451695070296/8.0), - REAL_CONST(86526.318813723352/8.0), - REAL_CONST(86549.187443303032/8.0), - REAL_CONST(86572.057583609683/8.0), - REAL_CONST(86594.929234443756/8.0), - REAL_CONST(86617.802395605773/8.0), - REAL_CONST(86640.677066896271/8.0), - REAL_CONST(86663.553248115903/8.0), - REAL_CONST(86686.43093906538/8.0), - REAL_CONST(86709.310139545443/8.0), - REAL_CONST(86732.190849356964/8.0), - REAL_CONST(86755.073068300815/8.0), - REAL_CONST(86777.956796177954/8.0), - REAL_CONST(86800.842032789442/8.0), - REAL_CONST(86823.728777936354/8.0), - REAL_CONST(86846.617031419853/8.0), - REAL_CONST(86869.506793041175/8.0), - REAL_CONST(86892.398062601613/8.0), - REAL_CONST(86915.290839902518/8.0), - REAL_CONST(86938.185124745316/8.0), - REAL_CONST(86961.080916931489/8.0), - REAL_CONST(86983.978216262592/8.0), - REAL_CONST(87006.87702254027/8.0), - REAL_CONST(87029.777335566177/8.0), - REAL_CONST(87052.67915514209/8.0), - REAL_CONST(87075.582481069796/8.0), - REAL_CONST(87098.487313151185/8.0), - REAL_CONST(87121.39365118822/8.0), - REAL_CONST(87144.301494982894/8.0), - REAL_CONST(87167.210844337285/8.0), - REAL_CONST(87190.121699053532/8.0), - REAL_CONST(87213.034058933845/8.0), - REAL_CONST(87235.947923780506/8.0), - REAL_CONST(87258.863293395829/8.0), - REAL_CONST(87281.780167582241/8.0), - REAL_CONST(87304.698546142172/8.0), - REAL_CONST(87327.618428878181/8.0), - REAL_CONST(87350.539815592856/8.0), - REAL_CONST(87373.462706088845/8.0), - REAL_CONST(87396.387100168897/8.0), - REAL_CONST(87419.312997635774/8.0), - REAL_CONST(87442.240398292357/8.0), - REAL_CONST(87465.16930194154/8.0), - REAL_CONST(87488.099708386319/8.0), - REAL_CONST(87511.031617429733/8.0), - REAL_CONST(87533.965028874911/8.0), - REAL_CONST(87556.899942525008/8.0), - REAL_CONST(87579.836358183282/8.0), - REAL_CONST(87602.774275653021/8.0), - REAL_CONST(87625.713694737613/8.0), - REAL_CONST(87648.654615240492/8.0), - REAL_CONST(87671.597036965148/8.0), - REAL_CONST(87694.540959715145/8.0), - REAL_CONST(87717.486383294105/8.0), - REAL_CONST(87740.433307505737/8.0), - REAL_CONST(87763.381732153779/8.0), - REAL_CONST(87786.331657042057/8.0), - REAL_CONST(87809.283081974456/8.0), - REAL_CONST(87832.236006754916/8.0), - REAL_CONST(87855.190431187453/8.0), - REAL_CONST(87878.146355076155/8.0), - REAL_CONST(87901.103778225151/8.0), - REAL_CONST(87924.062700438633/8.0), - REAL_CONST(87947.023121520891/8.0), - REAL_CONST(87969.985041276246/8.0), - REAL_CONST(87992.948459509105/8.0), - REAL_CONST(88015.913376023906/8.0), - REAL_CONST(88038.879790625171/8.0), - REAL_CONST(88061.847703117513/8.0), - REAL_CONST(88084.817113305573/8.0), - REAL_CONST(88107.788020994049/8.0), - REAL_CONST(88130.760425987726/8.0), - REAL_CONST(88153.734328091465/8.0), - REAL_CONST(88176.709727110137/8.0), - REAL_CONST(88199.686622848749/8.0), - REAL_CONST(88222.665015112303/8.0), - REAL_CONST(88245.644903705906/8.0), - REAL_CONST(88268.626288434709/8.0), - REAL_CONST(88291.609169103947/8.0), - REAL_CONST(88314.593545518903/8.0), - REAL_CONST(88337.579417484914/8.0), - REAL_CONST(88360.566784807408/8.0), - REAL_CONST(88383.555647291854/8.0), - REAL_CONST(88406.546004743795/8.0), - REAL_CONST(88429.537856968818/8.0), - REAL_CONST(88452.531203772611/8.0), - REAL_CONST(88475.52604496089/8.0), - REAL_CONST(88498.522380339447/8.0), - REAL_CONST(88521.52020971413/8.0), - REAL_CONST(88544.519532890874/8.0), - REAL_CONST(88567.520349675644/8.0), - REAL_CONST(88590.522659874507/8.0), - REAL_CONST(88613.526463293543/8.0), - REAL_CONST(88636.531759738922/8.0), - REAL_CONST(88659.538549016899/8.0), - REAL_CONST(88682.546830933745/8.0), - REAL_CONST(88705.556605295846/8.0), - REAL_CONST(88728.567871909589/8.0), - REAL_CONST(88751.580630581491/8.0), - REAL_CONST(88774.594881118086/8.0), - REAL_CONST(88797.610623325963/8.0), - REAL_CONST(88820.62785701183/8.0), - REAL_CONST(88843.646581982393/8.0), - REAL_CONST(88866.666798044462/8.0), - REAL_CONST(88889.688505004888/8.0), - REAL_CONST(88912.711702670611/8.0), - REAL_CONST(88935.7363908486/8.0), - REAL_CONST(88958.762569345898/8.0), - REAL_CONST(88981.790237969632/8.0), - REAL_CONST(89004.81939652696/8.0), - REAL_CONST(89027.850044825114/8.0), - REAL_CONST(89050.882182671412/8.0), - REAL_CONST(89073.9158098732/8.0), - REAL_CONST(89096.950926237885/8.0), - REAL_CONST(89119.987531572973/8.0), - REAL_CONST(89143.025625686001/8.0), - REAL_CONST(89166.065208384563/8.0), - REAL_CONST(89189.106279476357/8.0), - REAL_CONST(89212.148838769106/8.0), - REAL_CONST(89235.192886070581/8.0), - REAL_CONST(89258.238421188667/8.0), - REAL_CONST(89281.285443931265/8.0), - REAL_CONST(89304.333954106376/8.0), - REAL_CONST(89327.383951522017/8.0), - REAL_CONST(89350.435435986306/8.0), - REAL_CONST(89373.488407307406/8.0), - REAL_CONST(89396.542865293537/8.0), - REAL_CONST(89419.598809753006/8.0), - REAL_CONST(89442.656240494165/8.0), - REAL_CONST(89465.715157325409/8.0), - REAL_CONST(89488.775560055219/8.0), - REAL_CONST(89511.837448492137/8.0), - REAL_CONST(89534.900822444746/8.0), - REAL_CONST(89557.965681721733/8.0), - REAL_CONST(89581.032026131812/8.0), - REAL_CONST(89604.099855483742/8.0), - REAL_CONST(89627.169169586399/8.0), - REAL_CONST(89650.239968248672/8.0), - REAL_CONST(89673.312251279538/8.0), - REAL_CONST(89696.386018488018/8.0), - REAL_CONST(89719.461269683205/8.0), - REAL_CONST(89742.53800467425/8.0), - REAL_CONST(89765.616223270365/8.0), - REAL_CONST(89788.69592528083/8.0), - REAL_CONST(89811.777110514988/8.0), - REAL_CONST(89834.859778782207/8.0), - REAL_CONST(89857.943929891975/8.0), - REAL_CONST(89881.029563653807/8.0), - REAL_CONST(89904.116679877261/8.0), - REAL_CONST(89927.205278372014/8.0), - REAL_CONST(89950.29535894774/8.0), - REAL_CONST(89973.386921414218/8.0), - REAL_CONST(89996.479965581268/8.0), - REAL_CONST(90019.574491258769/8.0), - REAL_CONST(90042.670498256688/8.0), - REAL_CONST(90065.767986385021/8.0), - REAL_CONST(90088.866955453836/8.0), - REAL_CONST(90111.967405273259/8.0), - REAL_CONST(90135.069335653476/8.0), - REAL_CONST(90158.172746404758/8.0), - REAL_CONST(90181.277637337407/8.0), - REAL_CONST(90204.384008261797/8.0), - REAL_CONST(90227.49185898836/8.0), - REAL_CONST(90250.601189327586/8.0), - REAL_CONST(90273.711999090039/8.0), - REAL_CONST(90296.824288086325/8.0), - REAL_CONST(90319.938056127125/8.0), - REAL_CONST(90343.053303023189/8.0), - REAL_CONST(90366.170028585286/8.0), - REAL_CONST(90389.288232624298/8.0), - REAL_CONST(90412.407914951138/8.0), - REAL_CONST(90435.529075376777/8.0), - REAL_CONST(90458.651713712257/8.0), - REAL_CONST(90481.775829768681/8.0), - REAL_CONST(90504.901423357209/8.0), - REAL_CONST(90528.028494289058/8.0), - REAL_CONST(90551.157042375504/8.0), - REAL_CONST(90574.287067427911/8.0), - REAL_CONST(90597.418569257643/8.0), - REAL_CONST(90620.551547676194/8.0), - REAL_CONST(90643.686002495073/8.0), - REAL_CONST(90666.821933525847/8.0), - REAL_CONST(90689.959340580186/8.0), - REAL_CONST(90713.098223469773/8.0), - REAL_CONST(90736.238582006365/8.0), - REAL_CONST(90759.380416001804/8.0), - REAL_CONST(90782.523725267951/8.0), - REAL_CONST(90805.668509616764/8.0), - REAL_CONST(90828.814768860233/8.0), - REAL_CONST(90851.962502810435/8.0), - REAL_CONST(90875.11171127946/8.0), - REAL_CONST(90898.262394079517/8.0), - REAL_CONST(90921.414551022855/8.0), - REAL_CONST(90944.568181921743/8.0), - REAL_CONST(90967.72328658856/8.0), - REAL_CONST(90990.879864835719/8.0), - REAL_CONST(91014.037916475718/8.0), - REAL_CONST(91037.19744132107/8.0), - REAL_CONST(91060.358439184391/8.0), - REAL_CONST(91083.520909878338/8.0), - REAL_CONST(91106.684853215629/8.0), - REAL_CONST(91129.850269009039/8.0), - REAL_CONST(91153.017157071401/8.0), - REAL_CONST(91176.185517215621/8.0), - REAL_CONST(91199.355349254649/8.0), - REAL_CONST(91222.526653001492/8.0), - REAL_CONST(91245.699428269247/8.0), - REAL_CONST(91268.873674871036/8.0), - REAL_CONST(91292.049392620058/8.0), - REAL_CONST(91315.226581329553/8.0), - REAL_CONST(91338.405240812834/8.0), - REAL_CONST(91361.585370883287/8.0), - REAL_CONST(91384.766971354344/8.0), - REAL_CONST(91407.950042039476/8.0), - REAL_CONST(91431.134582752245/8.0), - REAL_CONST(91454.320593306256/8.0), - REAL_CONST(91477.508073515171/8.0), - REAL_CONST(91500.697023192712/8.0), - REAL_CONST(91523.887442152685/8.0), - REAL_CONST(91547.07933020893/8.0), - REAL_CONST(91570.272687175326/8.0), - REAL_CONST(91593.467512865856/8.0), - REAL_CONST(91616.663807094534/8.0), - REAL_CONST(91639.861569675442/8.0), - REAL_CONST(91663.060800422725/8.0), - REAL_CONST(91686.261499150554/8.0), - REAL_CONST(91709.463665673218/8.0), - REAL_CONST(91732.66729980502/8.0), - REAL_CONST(91755.872401360321/8.0), - REAL_CONST(91779.078970153569/8.0), - REAL_CONST(91802.287005999257/8.0), - REAL_CONST(91825.49650871192/8.0), - REAL_CONST(91848.707478106167/8.0), - REAL_CONST(91871.91991399668/8.0), - REAL_CONST(91895.133816198169/8.0), - REAL_CONST(91918.349184525418/8.0), - REAL_CONST(91941.566018793281/8.0), - REAL_CONST(91964.784318816659/8.0), - REAL_CONST(91988.004084410495/8.0), - REAL_CONST(92011.22531538982/8.0), - REAL_CONST(92034.448011569708/8.0), - REAL_CONST(92057.672172765277/8.0), - REAL_CONST(92080.897798791746/8.0), - REAL_CONST(92104.124889464365/8.0), - REAL_CONST(92127.353444598411/8.0), - REAL_CONST(92150.58346400928/8.0), - REAL_CONST(92173.814947512379/8.0), - REAL_CONST(92197.04789492322/8.0), - REAL_CONST(92220.282306057314/8.0), - REAL_CONST(92243.518180730272/8.0), - REAL_CONST(92266.755518757753/8.0), - REAL_CONST(92289.994319955469/8.0), - REAL_CONST(92313.234584139194/8.0), - REAL_CONST(92336.476311124774/8.0), - REAL_CONST(92359.719500728082/8.0), - REAL_CONST(92382.964152765067/8.0), - REAL_CONST(92406.210267051734/8.0), - REAL_CONST(92429.457843404161/8.0), - REAL_CONST(92452.706881638471/8.0), - REAL_CONST(92475.957381570814/8.0), - REAL_CONST(92499.209343017443/8.0), - REAL_CONST(92522.462765794655/8.0), - REAL_CONST(92545.717649718805/8.0), - REAL_CONST(92568.973994606305/8.0), - REAL_CONST(92592.231800273614/8.0), - REAL_CONST(92615.491066537259/8.0), - REAL_CONST(92638.751793213814/8.0), - REAL_CONST(92662.01398011994/8.0), - REAL_CONST(92685.277627072326/8.0), - REAL_CONST(92708.54273388772/8.0), - REAL_CONST(92731.809300382942/8.0), - REAL_CONST(92755.077326374871/8.0), - REAL_CONST(92778.346811680414/8.0), - REAL_CONST(92801.617756116568/8.0), - REAL_CONST(92824.890159500384/8.0), - REAL_CONST(92848.164021648947/8.0), - REAL_CONST(92871.439342379424/8.0), - REAL_CONST(92894.716121509016/8.0), - REAL_CONST(92917.994358855023/8.0), - REAL_CONST(92941.274054234746/8.0), - REAL_CONST(92964.555207465572/8.0), - REAL_CONST(92987.837818364962/8.0), - REAL_CONST(93011.121886750407/8.0), - REAL_CONST(93034.407412439468/8.0), - REAL_CONST(93057.694395249753/8.0), - REAL_CONST(93080.982834998955/8.0), - REAL_CONST(93104.272731504767/8.0), - REAL_CONST(93127.564084584999/8.0), - REAL_CONST(93150.856894057491/8.0), - REAL_CONST(93174.15115974014/8.0), - REAL_CONST(93197.446881450916/8.0), - REAL_CONST(93220.744059007804/8.0), - REAL_CONST(93244.04269222889/8.0), - REAL_CONST(93267.342780932304/8.0), - REAL_CONST(93290.644324936235/8.0), - REAL_CONST(93313.947324058914/8.0), - REAL_CONST(93337.251778118633/8.0), - REAL_CONST(93360.557686933767/8.0), - REAL_CONST(93383.865050322696/8.0), - REAL_CONST(93407.173868103928/8.0), - REAL_CONST(93430.484140095941/8.0), - REAL_CONST(93453.795866117362/8.0), - REAL_CONST(93477.109045986799/8.0), - REAL_CONST(93500.423679522952/8.0), - REAL_CONST(93523.739766544561/8.0), - REAL_CONST(93547.057306870454/8.0), - REAL_CONST(93570.376300319491/8.0), - REAL_CONST(93593.696746710571/8.0), - REAL_CONST(93617.018645862699/8.0), - REAL_CONST(93640.341997594893/8.0), - REAL_CONST(93663.666801726242/8.0), - REAL_CONST(93686.993058075881/8.0), - REAL_CONST(93710.320766463032/8.0), - REAL_CONST(93733.64992670693/8.0), - REAL_CONST(93756.980538626914/8.0), - REAL_CONST(93780.312602042337/8.0), - REAL_CONST(93803.646116772637/8.0), - REAL_CONST(93826.981082637285/8.0), - REAL_CONST(93850.317499455836/8.0), - REAL_CONST(93873.655367047861/8.0), - REAL_CONST(93896.994685233032/8.0), - REAL_CONST(93920.335453831038/8.0), - REAL_CONST(93943.677672661666/8.0), - REAL_CONST(93967.021341544707/8.0), - REAL_CONST(93990.366460300051/8.0), - REAL_CONST(94013.713028747632/8.0), - REAL_CONST(94037.061046707429/8.0), - REAL_CONST(94060.410513999494/8.0), - REAL_CONST(94083.761430443905/8.0), - REAL_CONST(94107.113795860845/8.0), - REAL_CONST(94130.467610070496/8.0), - REAL_CONST(94153.822872893157/8.0), - REAL_CONST(94177.179584149111/8.0), - REAL_CONST(94200.537743658759/8.0), - REAL_CONST(94223.897351242529/8.0), - REAL_CONST(94247.25840672091/8.0), - REAL_CONST(94270.620909914433/8.0), - REAL_CONST(94293.98486064373/8.0), - REAL_CONST(94317.350258729421/8.0), - REAL_CONST(94340.71710399224/8.0), - REAL_CONST(94364.085396252936/8.0), - REAL_CONST(94387.455135332348/8.0), - REAL_CONST(94410.82632105134/8.0), - REAL_CONST(94434.198953230851/8.0), - REAL_CONST(94457.573031691878/8.0), - REAL_CONST(94480.948556255447/8.0), - REAL_CONST(94504.325526742658/8.0), - REAL_CONST(94527.70394297468/8.0), - REAL_CONST(94551.083804772716/8.0), - REAL_CONST(94574.465111958023/8.0), - REAL_CONST(94597.847864351934/8.0), - REAL_CONST(94621.232061775823/8.0), - REAL_CONST(94644.617704051096/8.0), - REAL_CONST(94668.004790999272/8.0), - REAL_CONST(94691.393322441872/8.0), - REAL_CONST(94714.783298200506/8.0), - REAL_CONST(94738.174718096794/8.0), - REAL_CONST(94761.567581952477/8.0), - REAL_CONST(94784.961889589307/8.0), - REAL_CONST(94808.357640829097/8.0), - REAL_CONST(94831.754835493703/8.0), - REAL_CONST(94855.153473405066/8.0), - REAL_CONST(94878.553554385173/8.0), - REAL_CONST(94901.955078256055/8.0), - REAL_CONST(94925.358044839784/8.0), - REAL_CONST(94948.762453958523/8.0), - REAL_CONST(94972.168305434476/8.0), - REAL_CONST(94995.575599089891/8.0), - REAL_CONST(95018.984334747074/8.0), - REAL_CONST(95042.394512228391/8.0), - REAL_CONST(95065.806131356265/8.0), - REAL_CONST(95089.219191953176/8.0), - REAL_CONST(95112.633693841635/8.0), - REAL_CONST(95136.04963684424/8.0), - REAL_CONST(95159.467020783617/8.0), - REAL_CONST(95182.885845482466/8.0), - REAL_CONST(95206.306110763529/8.0), - REAL_CONST(95229.727816449609/8.0), - REAL_CONST(95253.150962363579/8.0), - REAL_CONST(95276.575548328314/8.0), - REAL_CONST(95300.001574166803/8.0), - REAL_CONST(95323.429039702052/8.0), - REAL_CONST(95346.857944757154/8.0), - REAL_CONST(95370.288289155214/8.0), - REAL_CONST(95393.720072719429/8.0), - REAL_CONST(95417.153295273019/8.0), - REAL_CONST(95440.587956639298/8.0), - REAL_CONST(95464.024056641589/8.0), - REAL_CONST(95487.461595103305/8.0), - REAL_CONST(95510.900571847902/8.0), - REAL_CONST(95534.340986698866/8.0), - REAL_CONST(95557.782839479783/8.0), - REAL_CONST(95581.226130014256/8.0), - REAL_CONST(95604.670858125959/8.0), - REAL_CONST(95628.117023638595/8.0), - REAL_CONST(95651.564626375985/8.0), - REAL_CONST(95675.013666161918/8.0), - REAL_CONST(95698.464142820303/8.0), - REAL_CONST(95721.916056175076/8.0), - REAL_CONST(95745.369406050231/8.0), - REAL_CONST(95768.824192269807/8.0), - REAL_CONST(95792.280414657915/8.0), - REAL_CONST(95815.738073038709/8.0), - REAL_CONST(95839.197167236387/8.0), - REAL_CONST(95862.657697075221/8.0), - REAL_CONST(95886.11966237954/8.0), - REAL_CONST(95909.583062973688/8.0), - REAL_CONST(95933.047898682111/8.0), - REAL_CONST(95956.514169329268/8.0), - REAL_CONST(95979.981874739708/8.0), - REAL_CONST(96003.451014738006/8.0), - REAL_CONST(96026.921589148798/8.0), - REAL_CONST(96050.393597796792/8.0), - REAL_CONST(96073.867040506724/8.0), - REAL_CONST(96097.341917103375/8.0), - REAL_CONST(96120.818227411626/8.0), - REAL_CONST(96144.295971256375/8.0), - REAL_CONST(96167.775148462577/8.0), - REAL_CONST(96191.255758855244/8.0), - REAL_CONST(96214.737802259449/8.0), - REAL_CONST(96238.221278500292/8.0), - REAL_CONST(96261.70618740299/8.0), - REAL_CONST(96285.192528792715/8.0), - REAL_CONST(96308.680302494788/8.0), - REAL_CONST(96332.169508334526/8.0), - REAL_CONST(96355.660146137321/8.0), - REAL_CONST(96379.152215728609/8.0), - REAL_CONST(96402.645716933868/8.0), - REAL_CONST(96426.14064957868/8.0), - REAL_CONST(96449.637013488609/8.0), - REAL_CONST(96473.134808489311/8.0), - REAL_CONST(96496.63403440651/8.0), - REAL_CONST(96520.134691065963/8.0), - REAL_CONST(96543.636778293469/8.0), - REAL_CONST(96567.140295914898/8.0), - REAL_CONST(96590.645243756153/8.0), - REAL_CONST(96614.151621643221/8.0), - REAL_CONST(96637.659429402134/8.0), - REAL_CONST(96661.168666858954/8.0), - REAL_CONST(96684.679333839798/8.0), - REAL_CONST(96708.191430170875/8.0), - REAL_CONST(96731.70495567839/8.0), - REAL_CONST(96755.219910188665/8.0), - REAL_CONST(96778.736293528011/8.0), - REAL_CONST(96802.254105522836/8.0), - REAL_CONST(96825.77334599958/8.0), - REAL_CONST(96849.29401478474/8.0), - REAL_CONST(96872.816111704873/8.0), - REAL_CONST(96896.339636586577/8.0), - REAL_CONST(96919.864589256511/8.0), - REAL_CONST(96943.390969541389/8.0), - REAL_CONST(96966.918777267958/8.0), - REAL_CONST(96990.448012263048/8.0), - REAL_CONST(97013.978674353522/8.0), - REAL_CONST(97037.510763366285/8.0), - REAL_CONST(97061.044279128328/8.0), - REAL_CONST(97084.579221466673/8.0), - REAL_CONST(97108.115590208385/8.0), - REAL_CONST(97131.653385180587/8.0), - REAL_CONST(97155.19260621049/8.0), - REAL_CONST(97178.733253125291/8.0), - REAL_CONST(97202.2753257523/8.0), - REAL_CONST(97225.81882391886/8.0), - REAL_CONST(97249.363747452342/8.0), - REAL_CONST(97272.910096180189/8.0), - REAL_CONST(97296.457869929916/8.0), - REAL_CONST(97320.007068529041/8.0), - REAL_CONST(97343.557691805196/8.0), - REAL_CONST(97367.109739586012/8.0), - REAL_CONST(97390.663211699197/8.0), - REAL_CONST(97414.218107972498/8.0), - REAL_CONST(97437.774428233737/8.0), - REAL_CONST(97461.332172310766/8.0), - REAL_CONST(97484.891340031507/8.0), - REAL_CONST(97508.451931223899/8.0), - REAL_CONST(97532.013945715982/8.0), - REAL_CONST(97555.577383335811/8.0), - REAL_CONST(97579.142243911512/8.0), - REAL_CONST(97602.708527271257/8.0), - REAL_CONST(97626.276233243261/8.0), - REAL_CONST(97649.845361655811/8.0), - REAL_CONST(97673.415912337223/8.0), - REAL_CONST(97696.987885115886/8.0), - REAL_CONST(97720.561279820206/8.0), - REAL_CONST(97744.1360962787/8.0), - REAL_CONST(97767.712334319876/8.0), - REAL_CONST(97791.289993772341/8.0), - REAL_CONST(97814.869074464703/8.0), - REAL_CONST(97838.449576225685/8.0), - REAL_CONST(97862.031498883996/8.0), - REAL_CONST(97885.614842268449/8.0), - REAL_CONST(97909.199606207883/8.0), - REAL_CONST(97932.785790531183/8.0), - REAL_CONST(97956.37339506732/8.0), - REAL_CONST(97979.962419645264/8.0), - REAL_CONST(98003.552864094076/8.0), - REAL_CONST(98027.144728242856/8.0), - REAL_CONST(98050.738011920766/8.0), - REAL_CONST(98074.332714956996/8.0), - REAL_CONST(98097.928837180807/8.0), - REAL_CONST(98121.526378421506/8.0), - REAL_CONST(98145.125338508456/8.0), - REAL_CONST(98168.725717271067/8.0), - REAL_CONST(98192.327514538789/8.0), - REAL_CONST(98215.930730141132/8.0), - REAL_CONST(98239.535363907664/8.0), - REAL_CONST(98263.141415668011/8.0), - REAL_CONST(98286.748885251814/8.0), - REAL_CONST(98310.357772488816/8.0), - REAL_CONST(98333.968077208759/8.0), - REAL_CONST(98357.579799241488/8.0), - REAL_CONST(98381.192938416847/8.0), - REAL_CONST(98404.807494564782/8.0), - REAL_CONST(98428.42346751524/8.0), - REAL_CONST(98452.040857098269/8.0), - REAL_CONST(98475.659663143917/8.0), - REAL_CONST(98499.27988548232/8.0), - REAL_CONST(98522.901523943656/8.0), - REAL_CONST(98546.524578358163/8.0), - REAL_CONST(98570.149048556093/8.0), - REAL_CONST(98593.774934367786/8.0), - REAL_CONST(98617.402235623624/8.0), - REAL_CONST(98641.030952154048/8.0), - REAL_CONST(98664.661083789513/8.0), - REAL_CONST(98688.292630360564/8.0), - REAL_CONST(98711.925591697771/8.0), - REAL_CONST(98735.559967631794/8.0), - REAL_CONST(98759.195757993293/8.0), - REAL_CONST(98782.832962613014/8.0), - REAL_CONST(98806.471581321734/8.0), - REAL_CONST(98830.111613950285/8.0), - REAL_CONST(98853.753060329575/8.0), - REAL_CONST(98877.39592029051/8.0), - REAL_CONST(98901.040193664099/8.0), - REAL_CONST(98924.68588028138/8.0), - REAL_CONST(98948.33297997342/8.0), - REAL_CONST(98971.981492571387/8.0), - REAL_CONST(98995.63141790645/8.0), - REAL_CONST(99019.282755809851/8.0), - REAL_CONST(99042.935506112874/8.0), - REAL_CONST(99066.589668646877/8.0), - REAL_CONST(99090.245243243233/8.0), - REAL_CONST(99113.902229733401/8.0), - REAL_CONST(99137.560627948857/8.0), - REAL_CONST(99161.220437721131/8.0), - REAL_CONST(99184.881658881859/8.0), - REAL_CONST(99208.544291262631/8.0), - REAL_CONST(99232.208334695169/8.0), - REAL_CONST(99255.87378901121/8.0), - REAL_CONST(99279.540654042547/8.0), - REAL_CONST(99303.208929621018/8.0), - REAL_CONST(99326.878615578535/8.0), - REAL_CONST(99350.549711746993/8.0), - REAL_CONST(99374.222217958435/8.0), - REAL_CONST(99397.896134044888/8.0), - REAL_CONST(99421.571459838422/8.0), - REAL_CONST(99445.248195171211/8.0), - REAL_CONST(99468.926339875441/8.0), - REAL_CONST(99492.605893783344/8.0), - REAL_CONST(99516.286856727209/8.0), - REAL_CONST(99539.969228539398/8.0), - REAL_CONST(99563.653009052287/8.0), - REAL_CONST(99587.338198098325/8.0), - REAL_CONST(99611.024795510006/8.0), - REAL_CONST(99634.712801119866/8.0), - REAL_CONST(99658.402214760499/8.0), - REAL_CONST(99682.093036264545/8.0), - REAL_CONST(99705.785265464699/8.0), - REAL_CONST(99729.478902193689/8.0), - REAL_CONST(99753.173946284325/8.0), - REAL_CONST(99776.870397569437/8.0), - REAL_CONST(99800.56825588191/8.0), - REAL_CONST(99824.267521054688/8.0), - REAL_CONST(99847.968192920773/8.0), - REAL_CONST(99871.670271313182/8.0), - REAL_CONST(99895.373756065004/8.0), - REAL_CONST(99919.078647009388/8.0), - REAL_CONST(99942.78494397951/8.0), - REAL_CONST(99966.492646808634/8.0), - REAL_CONST(99990.20175533001/8.0), - REAL_CONST(100013.91226937699/8.0), - REAL_CONST(100037.62418878295/8.0), - REAL_CONST(100061.33751338134/8.0), - REAL_CONST(100085.05224300563/8.0), - REAL_CONST(100108.76837748935/8.0), - REAL_CONST(100132.4859166661/8.0), - REAL_CONST(100156.2048603695/8.0), - REAL_CONST(100179.92520843323/8.0), - REAL_CONST(100203.64696069101/8.0), - REAL_CONST(100227.37011697664/8.0), - REAL_CONST(100251.09467712394/8.0), - REAL_CONST(100274.82064096678/8.0), - REAL_CONST(100298.54800833909/8.0), - REAL_CONST(100322.27677907483/8.0), - REAL_CONST(100346.00695300807/8.0), - REAL_CONST(100369.73852997283/8.0), - REAL_CONST(100393.47150980328/8.0), - REAL_CONST(100417.20589233354/8.0), - REAL_CONST(100440.94167739789/8.0), - REAL_CONST(100464.67886483055/8.0), - REAL_CONST(100488.41745446586/8.0), - REAL_CONST(100512.1574461382/8.0), - REAL_CONST(100535.89883968196/8.0), - REAL_CONST(100559.64163493161/8.0), - REAL_CONST(100583.38583172169/8.0), - REAL_CONST(100607.13142988674/8.0), - REAL_CONST(100630.87842926137/8.0), - REAL_CONST(100654.62682968024/8.0), - REAL_CONST(100678.37663097809/8.0), - REAL_CONST(100702.12783298964/8.0), - REAL_CONST(100725.88043554971/8.0), - REAL_CONST(100749.63443849317/8.0), - REAL_CONST(100773.38984165489/8.0), - REAL_CONST(100797.14664486986/8.0), - REAL_CONST(100820.90484797307/8.0), - REAL_CONST(100844.66445079957/8.0), - REAL_CONST(100868.42545318443/8.0), - REAL_CONST(100892.18785496285/8.0), - REAL_CONST(100915.95165596998/8.0), - REAL_CONST(100939.71685604109/8.0), - REAL_CONST(100963.48345501146/8.0), - REAL_CONST(100987.25145271645/8.0), - REAL_CONST(101011.02084899142/8.0), - REAL_CONST(101034.79164367182/8.0), - REAL_CONST(101058.56383659317/8.0), - REAL_CONST(101082.33742759094/8.0), - REAL_CONST(101106.11241650078/8.0), - REAL_CONST(101129.88880315828/8.0), - REAL_CONST(101153.66658739912/8.0), - REAL_CONST(101177.44576905905/8.0), - REAL_CONST(101201.22634797383/8.0), - REAL_CONST(101225.00832397929/8.0), - REAL_CONST(101248.7916969113/8.0), - REAL_CONST(101272.57646660579/8.0), - REAL_CONST(101296.36263289873/8.0), - REAL_CONST(101320.15019562612/8.0), - REAL_CONST(101343.93915462404/8.0), - REAL_CONST(101367.7295097286/8.0), - REAL_CONST(101391.52126077596/8.0), - REAL_CONST(101415.31440760233/8.0), - REAL_CONST(101439.10895004397/8.0), - REAL_CONST(101462.9048879372/8.0), - REAL_CONST(101486.70222111834/8.0), - REAL_CONST(101510.50094942382/8.0), - REAL_CONST(101534.30107269008/8.0), - REAL_CONST(101558.10259075361/8.0), - REAL_CONST(101581.90550345098/8.0), - REAL_CONST(101605.70981061876/8.0), - REAL_CONST(101629.5155120936/8.0), - REAL_CONST(101653.32260771218/8.0), - REAL_CONST(101677.13109731126/8.0), - REAL_CONST(101700.9409807276/8.0), - REAL_CONST(101724.75225779804/8.0), - REAL_CONST(101748.56492835947/8.0), - REAL_CONST(101772.37899224881/8.0), - REAL_CONST(101796.19444930303/8.0), - REAL_CONST(101820.01129935916/8.0), - REAL_CONST(101843.82954225427/8.0), - REAL_CONST(101867.64917782549/8.0), - REAL_CONST(101891.47020590997/8.0), - REAL_CONST(101915.29262634492/8.0), - REAL_CONST(101939.11643896763/8.0), - REAL_CONST(101962.94164361537/8.0), - REAL_CONST(101986.76824012553/8.0), - REAL_CONST(102010.59622833549/8.0), - REAL_CONST(102034.42560808272/8.0), - REAL_CONST(102058.25637920471/8.0), - REAL_CONST(102082.08854153901/8.0), - REAL_CONST(102105.9220949232/8.0), - REAL_CONST(102129.75703919494/8.0), - REAL_CONST(102153.59337419191/8.0), - REAL_CONST(102177.43109975185/8.0), - REAL_CONST(102201.27021571253/8.0), - REAL_CONST(102225.1107219118/8.0), - REAL_CONST(102248.95261818753/8.0), - REAL_CONST(102272.79590437764/8.0), - REAL_CONST(102296.64058032009/8.0), - REAL_CONST(102320.48664585294/8.0), - REAL_CONST(102344.33410081422/8.0), - REAL_CONST(102368.18294504205/8.0), - REAL_CONST(102392.03317837461/8.0), - REAL_CONST(102415.88480065008/8.0), - REAL_CONST(102439.73781170673/8.0), - REAL_CONST(102463.59221138287/8.0), - REAL_CONST(102487.44799951684/8.0), - REAL_CONST(102511.30517594704/8.0), - REAL_CONST(102535.1637405119/8.0), - REAL_CONST(102559.02369304992/8.0), - REAL_CONST(102582.88503339965/8.0), - REAL_CONST(102606.74776139967/8.0), - REAL_CONST(102630.61187688859/8.0), - REAL_CONST(102654.4773797051/8.0), - REAL_CONST(102678.34426968795/8.0), - REAL_CONST(102702.21254667587/8.0), - REAL_CONST(102726.08221050771/8.0), - REAL_CONST(102749.95326102231/8.0), - REAL_CONST(102773.8256980586/8.0), - REAL_CONST(102797.69952145554/8.0), - REAL_CONST(102821.57473105213/8.0), - REAL_CONST(102845.45132668741/8.0), - REAL_CONST(102869.32930820051/8.0), - REAL_CONST(102893.20867543056/8.0), - REAL_CONST(102917.08942821674/8.0), - REAL_CONST(102940.97156639832/8.0), - REAL_CONST(102964.85508981455/8.0), - REAL_CONST(102988.73999830478/8.0), - REAL_CONST(103012.6262917084/8.0), - REAL_CONST(103036.51396986481/8.0), - REAL_CONST(103060.40303261351/8.0), - REAL_CONST(103084.293479794/8.0), - REAL_CONST(103108.18531124585/8.0), - REAL_CONST(103132.07852680866/8.0), - REAL_CONST(103155.97312632212/8.0), - REAL_CONST(103179.8691096259/8.0), - REAL_CONST(103203.76647655977/8.0), - REAL_CONST(103227.66522696352/8.0), - REAL_CONST(103251.56536067701/8.0), - REAL_CONST(103275.46687754011/8.0), - REAL_CONST(103299.36977739276/8.0), - REAL_CONST(103323.27406007495/8.0), - REAL_CONST(103347.1797254267/8.0), - REAL_CONST(103371.0867732881/8.0), - REAL_CONST(103394.99520349925/8.0), - REAL_CONST(103418.90501590034/8.0), - REAL_CONST(103442.81621033157/8.0), - REAL_CONST(103466.72878663319/8.0), - REAL_CONST(103490.64274464553/8.0), - REAL_CONST(103514.55808420894/8.0), - REAL_CONST(103538.4748051638/8.0), - REAL_CONST(103562.39290735057/8.0), - REAL_CONST(103586.31239060973/8.0), - REAL_CONST(103610.23325478184/8.0), - REAL_CONST(103634.15549970744/8.0), - REAL_CONST(103658.07912522719/8.0), - REAL_CONST(103682.00413118176/8.0), - REAL_CONST(103705.93051741188/8.0), - REAL_CONST(103729.85828375829/8.0), - REAL_CONST(103753.78743006183/8.0), - REAL_CONST(103777.71795616332/8.0), - REAL_CONST(103801.64986190372/8.0), - REAL_CONST(103825.58314712394/8.0), - REAL_CONST(103849.51781166498/8.0), - REAL_CONST(103873.4538553679/8.0), - REAL_CONST(103897.39127807376/8.0), - REAL_CONST(103921.33007962372/8.0), - REAL_CONST(103945.27025985894/8.0), - REAL_CONST(103969.21181862066/8.0), - REAL_CONST(103993.15475575015/8.0), - REAL_CONST(104017.0990710887/8.0), - REAL_CONST(104041.0447644777/8.0), - REAL_CONST(104064.99183575854/8.0), - REAL_CONST(104088.94028477269/8.0), - REAL_CONST(104112.89011136163/8.0), - REAL_CONST(104136.84131536692/8.0), - REAL_CONST(104160.79389663014/8.0), - REAL_CONST(104184.74785499295/8.0), - REAL_CONST(104208.70319029699/8.0), - REAL_CONST(104232.65990238401/8.0), - REAL_CONST(104256.61799109577/8.0), - REAL_CONST(104280.57745627411/8.0), - REAL_CONST(104304.53829776087/8.0), - REAL_CONST(104328.50051539797/8.0), - REAL_CONST(104352.46410902737/8.0), - REAL_CONST(104376.42907849104/8.0), - REAL_CONST(104400.39542363105/8.0), - REAL_CONST(104424.36314428948/8.0), - REAL_CONST(104448.33224030846/8.0), - REAL_CONST(104472.3027115302/8.0), - REAL_CONST(104496.27455779689/8.0), - REAL_CONST(104520.24777895081/8.0), - REAL_CONST(104544.22237483428/8.0), - REAL_CONST(104568.19834528965/8.0), - REAL_CONST(104592.17569015936/8.0), - REAL_CONST(104616.15440928582/8.0), - REAL_CONST(104640.13450251156/8.0), - REAL_CONST(104664.1159696791/8.0), - REAL_CONST(104688.09881063103/8.0), - REAL_CONST(104712.08302520998/8.0), - REAL_CONST(104736.06861325864/8.0), - REAL_CONST(104760.05557461972/8.0), - REAL_CONST(104784.043909136/8.0), - REAL_CONST(104808.03361665027/8.0), - REAL_CONST(104832.0246970054/8.0), - REAL_CONST(104856.01715004431/8.0), - REAL_CONST(104880.01097560991/8.0), - REAL_CONST(104904.00617354522/8.0), - REAL_CONST(104928.00274369326/8.0), - REAL_CONST(104952.00068589712/8.0), - REAL_CONST(104975.99999999993/8.0), - REAL_CONST(105000.00068584486/8.0), - REAL_CONST(105024.00274327511/8.0), - REAL_CONST(105048.00617213396/8.0), - REAL_CONST(105072.0109722647/8.0), - REAL_CONST(105096.0171435107/8.0), - REAL_CONST(105120.02468571534/8.0), - REAL_CONST(105144.03359872208/8.0), - REAL_CONST(105168.04388237436/8.0), - REAL_CONST(105192.05553651576/8.0), - REAL_CONST(105216.06856098982/8.0), - REAL_CONST(105240.08295564017/8.0), - REAL_CONST(105264.09872031047/8.0), - REAL_CONST(105288.11585484444/8.0), - REAL_CONST(105312.13435908582/8.0), - REAL_CONST(105336.1542328784/8.0), - REAL_CONST(105360.17547606604/8.0), - REAL_CONST(105384.19808849262/8.0), - REAL_CONST(105408.22207000206/8.0), - REAL_CONST(105432.24742043833/8.0), - REAL_CONST(105456.27413964548/8.0), - REAL_CONST(105480.30222746753/8.0), - REAL_CONST(105504.33168374863/8.0), - REAL_CONST(105528.36250833291/8.0), - REAL_CONST(105552.39470106458/8.0), - REAL_CONST(105576.42826178786/8.0), - REAL_CONST(105600.46319034706/8.0), - REAL_CONST(105624.49948658649/8.0), - REAL_CONST(105648.53715035053/8.0), - REAL_CONST(105672.5761814836/8.0), - REAL_CONST(105696.61657983017/8.0), - REAL_CONST(105720.65834523473/8.0), - REAL_CONST(105744.70147754184/8.0), - REAL_CONST(105768.7459765961/8.0), - REAL_CONST(105792.79184224214/8.0), - REAL_CONST(105816.83907432464/8.0), - REAL_CONST(105840.88767268835/8.0), - REAL_CONST(105864.93763717801/8.0), - REAL_CONST(105888.98896763846/8.0), - REAL_CONST(105913.04166391456/8.0), - REAL_CONST(105937.09572585119/8.0), - REAL_CONST(105961.15115329332/8.0), - REAL_CONST(105985.20794608595/8.0), - REAL_CONST(106009.26610407409/8.0), - REAL_CONST(106033.32562710284/8.0), - REAL_CONST(106057.38651501729/8.0), - REAL_CONST(106081.44876766266/8.0), - REAL_CONST(106105.51238488412/8.0), - REAL_CONST(106129.57736652695/8.0), - REAL_CONST(106153.64371243643/8.0), - REAL_CONST(106177.71142245791/8.0), - REAL_CONST(106201.78049643678/8.0), - REAL_CONST(106225.85093421848/8.0), - REAL_CONST(106249.92273564848/8.0), - REAL_CONST(106273.99590057228/8.0), - REAL_CONST(106298.07042883546/8.0), - REAL_CONST(106322.14632028362/8.0), - REAL_CONST(106346.22357476239/8.0), - REAL_CONST(106370.30219211751/8.0), - REAL_CONST(106394.38217219469/8.0), - REAL_CONST(106418.46351483969/8.0), - REAL_CONST(106442.54621989837/8.0), - REAL_CONST(106466.63028721658/8.0), - REAL_CONST(106490.71571664025/8.0), - REAL_CONST(106514.80250801529/8.0), - REAL_CONST(106538.89066118775/8.0), - REAL_CONST(106562.98017600364/8.0), - REAL_CONST(106587.07105230905/8.0), - REAL_CONST(106611.16328995011/8.0), - REAL_CONST(106635.25688877302/8.0), - REAL_CONST(106659.35184862395/8.0), - REAL_CONST(106683.44816934918/8.0), - REAL_CONST(106707.54585079502/8.0), - REAL_CONST(106731.64489280782/8.0), - REAL_CONST(106755.74529523395/8.0), - REAL_CONST(106779.84705791986/8.0), - REAL_CONST(106803.95018071201/8.0), - REAL_CONST(106828.05466345693/8.0), - REAL_CONST(106852.16050600118/8.0), - REAL_CONST(106876.26770819137/8.0), - REAL_CONST(106900.37626987413/8.0), - REAL_CONST(106924.48619089619/8.0), - REAL_CONST(106948.59747110425/8.0), - REAL_CONST(106972.71011034511/8.0), - REAL_CONST(106996.82410846559/8.0), - REAL_CONST(107020.93946531253/8.0), - REAL_CONST(107045.05618073288/8.0), - REAL_CONST(107069.17425457356/8.0), - REAL_CONST(107093.29368668159/8.0), - REAL_CONST(107117.41447690397/8.0), - REAL_CONST(107141.53662508781/8.0), - REAL_CONST(107165.66013108024/8.0), - REAL_CONST(107189.7849947284/8.0), - REAL_CONST(107213.91121587952/8.0), - REAL_CONST(107238.03879438085/8.0), - REAL_CONST(107262.16773007967/8.0), - REAL_CONST(107286.29802282334/8.0), - REAL_CONST(107310.42967245923/8.0), - REAL_CONST(107334.56267883476/8.0), - REAL_CONST(107358.69704179741/8.0), - REAL_CONST(107382.83276119467/8.0), - REAL_CONST(107406.96983687414/8.0), - REAL_CONST(107431.10826868335/8.0), - REAL_CONST(107455.24805646999/8.0), - REAL_CONST(107479.38920008171/8.0), - REAL_CONST(107503.53169936626/8.0), - REAL_CONST(107527.67555417139/8.0), - REAL_CONST(107551.82076434491/8.0), - REAL_CONST(107575.96732973469/8.0), - REAL_CONST(107600.11525018861/8.0), - REAL_CONST(107624.26452555459/8.0), - REAL_CONST(107648.41515568066/8.0), - REAL_CONST(107672.56714041479/8.0), - REAL_CONST(107696.72047960508/8.0), - REAL_CONST(107720.87517309963/8.0), - REAL_CONST(107745.03122074658/8.0), - REAL_CONST(107769.18862239413/8.0), - REAL_CONST(107793.34737789053/8.0), - REAL_CONST(107817.50748708403/8.0), - REAL_CONST(107841.66894982298/8.0), - REAL_CONST(107865.83176595572/8.0), - REAL_CONST(107889.99593533068/8.0), - REAL_CONST(107914.16145779629/8.0), - REAL_CONST(107938.32833320105/8.0), - REAL_CONST(107962.49656139348/8.0), - REAL_CONST(107986.66614222217/8.0), - REAL_CONST(108010.83707553572/8.0), - REAL_CONST(108035.00936118282/8.0), - REAL_CONST(108059.18299901215/8.0), - REAL_CONST(108083.35798887245/8.0), - REAL_CONST(108107.53433061253/8.0), - REAL_CONST(108131.71202408121/8.0), - REAL_CONST(108155.89106912735/8.0), - REAL_CONST(108180.07146559987/8.0), - REAL_CONST(108204.25321334775/8.0), - REAL_CONST(108228.43631221994/8.0), - REAL_CONST(108252.62076206553/8.0), - REAL_CONST(108276.80656273357/8.0), - REAL_CONST(108300.99371407321/8.0), - REAL_CONST(108325.18221593359/8.0), - REAL_CONST(108349.37206816394/8.0), - REAL_CONST(108373.56327061349/8.0), - REAL_CONST(108397.75582313156/8.0), - REAL_CONST(108421.94972556747/8.0), - REAL_CONST(108446.1449777706/8.0), - REAL_CONST(108470.34157959036/8.0), - REAL_CONST(108494.53953087622/8.0), - REAL_CONST(108518.73883147769/8.0), - REAL_CONST(108542.93948124432/8.0), - REAL_CONST(108567.14148002568/8.0), - REAL_CONST(108591.34482767139/8.0), - REAL_CONST(108615.54952403114/8.0), - REAL_CONST(108639.75556895464/8.0), - REAL_CONST(108663.96296229165/8.0), - REAL_CONST(108688.17170389196/8.0), - REAL_CONST(108712.38179360541/8.0), - REAL_CONST(108736.59323128188/8.0), - REAL_CONST(108760.80601677128/8.0), - REAL_CONST(108785.02014992358/8.0), - REAL_CONST(108809.23563058881/8.0), - REAL_CONST(108833.45245861699/8.0), - REAL_CONST(108857.67063385822/8.0), - REAL_CONST(108881.89015616261/8.0), - REAL_CONST(108906.11102538036/8.0), - REAL_CONST(108930.33324136167/8.0), - REAL_CONST(108954.55680395682/8.0), - REAL_CONST(108978.78171301607/8.0), - REAL_CONST(109003.00796838976/8.0), - REAL_CONST(109027.23556992831/8.0), - REAL_CONST(109051.46451748211/8.0), - REAL_CONST(109075.69481090162/8.0), - REAL_CONST(109099.92645003737/8.0), - REAL_CONST(109124.15943473989/8.0), - REAL_CONST(109148.39376485976/8.0), - REAL_CONST(109172.62944024763/8.0), - REAL_CONST(109196.86646075416/8.0), - REAL_CONST(109221.10482623006/8.0), - REAL_CONST(109245.34453652608/8.0), - REAL_CONST(109269.58559149304/8.0), - REAL_CONST(109293.82799098175/8.0), - REAL_CONST(109318.07173484311/8.0), - REAL_CONST(109342.31682292801/8.0), - REAL_CONST(109366.56325508743/8.0), - REAL_CONST(109390.81103117237/8.0), - REAL_CONST(109415.06015103387/8.0), - REAL_CONST(109439.31061452301/8.0), - REAL_CONST(109463.56242149093/8.0), - REAL_CONST(109487.8155717888/8.0), - REAL_CONST(109512.07006526781/8.0), - REAL_CONST(109536.3259017792/8.0), - REAL_CONST(109560.58308117429/8.0), - REAL_CONST(109584.8416033044/8.0), - REAL_CONST(109609.1014680209/8.0), - REAL_CONST(109633.36267517522/8.0), - REAL_CONST(109657.62522461878/8.0), - REAL_CONST(109681.88911620311/8.0), - REAL_CONST(109706.15434977971/8.0), - REAL_CONST(109730.4209252002/8.0), - REAL_CONST(109754.68884231619/8.0), - REAL_CONST(109778.95810097932/8.0), - REAL_CONST(109803.22870104131/8.0), - REAL_CONST(109827.50064235389/8.0), - REAL_CONST(109851.77392476884/8.0), - REAL_CONST(109876.04854813802/8.0), - REAL_CONST(109900.32451231324/8.0), - REAL_CONST(109924.60181714644/8.0), - REAL_CONST(109948.88046248957/8.0), - REAL_CONST(109973.1604481946/8.0), - REAL_CONST(109997.44177411357/8.0), - REAL_CONST(110021.72444009855/8.0), - REAL_CONST(110046.00844600165/8.0), - REAL_CONST(110070.29379167501/8.0), - REAL_CONST(110094.58047697082/8.0), - REAL_CONST(110118.86850174134/8.0), - REAL_CONST(110143.15786583882/8.0), - REAL_CONST(110167.44856911557/8.0), - REAL_CONST(110191.74061142397/8.0), - REAL_CONST(110216.03399261639/8.0), - REAL_CONST(110240.32871254528/8.0), - REAL_CONST(110264.62477106311/8.0), - REAL_CONST(110288.9221680224/8.0), - REAL_CONST(110313.22090327571/8.0), - REAL_CONST(110337.52097667565/8.0), - REAL_CONST(110361.82238807483/8.0), - REAL_CONST(110386.12513732594/8.0), - REAL_CONST(110410.42922428172/8.0), - REAL_CONST(110434.73464879491/8.0), - REAL_CONST(110459.04141071832/8.0), - REAL_CONST(110483.34950990479/8.0), - REAL_CONST(110507.6589462072/8.0), - REAL_CONST(110531.96971947847/8.0), - REAL_CONST(110556.28182957157/8.0), - REAL_CONST(110580.5952763395/8.0), - REAL_CONST(110604.91005963532/8.0), - REAL_CONST(110629.22617931209/8.0), - REAL_CONST(110653.54363522294/8.0), - REAL_CONST(110677.86242722106/8.0), - REAL_CONST(110702.18255515963/8.0), - REAL_CONST(110726.50401889188/8.0), - REAL_CONST(110750.82681827113/8.0), - REAL_CONST(110775.1509531507/8.0), - REAL_CONST(110799.47642338395/8.0), - REAL_CONST(110823.80322882428/8.0), - REAL_CONST(110848.13136932514/8.0), - REAL_CONST(110872.46084474004/8.0), - REAL_CONST(110896.79165492248/8.0), - REAL_CONST(110921.12379972603/8.0), - REAL_CONST(110945.4572790043/8.0), - REAL_CONST(110969.79209261097/8.0), - REAL_CONST(110994.12824039967/8.0), - REAL_CONST(111018.46572222417/8.0), - REAL_CONST(111042.80453793822/8.0), - REAL_CONST(111067.14468739564/8.0), - REAL_CONST(111091.48617045028/8.0), - REAL_CONST(111115.82898695602/8.0), - REAL_CONST(111140.1731367668/8.0), - REAL_CONST(111164.51861973655/8.0), - REAL_CONST(111188.86543571933/8.0), - REAL_CONST(111213.21358456917/8.0), - REAL_CONST(111237.56306614014/8.0), - REAL_CONST(111261.91388028639/8.0), - REAL_CONST(111286.26602686207/8.0), - REAL_CONST(111310.61950572141/8.0), - REAL_CONST(111334.97431671864/8.0), - REAL_CONST(111359.33045970804/8.0), - REAL_CONST(111383.68793454397/8.0), - REAL_CONST(111408.04674108078/8.0), - REAL_CONST(111432.40687917286/8.0), - REAL_CONST(111456.76834867468/8.0), - REAL_CONST(111481.13114944073/8.0), - REAL_CONST(111505.49528132551/8.0), - REAL_CONST(111529.86074418361/8.0), - REAL_CONST(111554.22753786964/8.0), - REAL_CONST(111578.59566223821/8.0), - REAL_CONST(111602.96511714405/8.0), - REAL_CONST(111627.33590244185/8.0), - REAL_CONST(111651.7080179864/8.0), - REAL_CONST(111676.08146363248/8.0), - REAL_CONST(111700.45623923496/8.0), - REAL_CONST(111724.8323446487/8.0), - REAL_CONST(111749.20977972864/8.0), - REAL_CONST(111773.58854432974/8.0), - REAL_CONST(111797.96863830699/8.0), - REAL_CONST(111822.35006151545/8.0), - REAL_CONST(111846.73281381019/8.0), - REAL_CONST(111871.11689504632/8.0), - REAL_CONST(111895.50230507903/8.0), - REAL_CONST(111919.8890437635/8.0), - REAL_CONST(111944.27711095495/8.0), - REAL_CONST(111968.6665065087/8.0), - REAL_CONST(111993.05723028004/8.0), - REAL_CONST(112017.44928212435/8.0), - REAL_CONST(112041.842661897/8.0), - REAL_CONST(112066.23736945343/8.0), - REAL_CONST(112090.63340464912/8.0), - REAL_CONST(112115.03076733962/8.0), - REAL_CONST(112139.42945738042/8.0), - REAL_CONST(112163.82947462716/8.0), - REAL_CONST(112188.23081893545/8.0), - REAL_CONST(112212.63349016097/8.0), - REAL_CONST(112237.03748815943/8.0), - REAL_CONST(112261.44281278658/8.0), - REAL_CONST(112285.84946389822/8.0), - REAL_CONST(112310.25744135017/8.0), - REAL_CONST(112334.66674499828/8.0), - REAL_CONST(112359.07737469849/8.0), - REAL_CONST(112383.48933030672/8.0), - REAL_CONST(112407.90261167898/8.0), - REAL_CONST(112432.31721867126/8.0), - REAL_CONST(112456.73315113965/8.0), - REAL_CONST(112481.15040894024/8.0), - REAL_CONST(112505.56899192919/8.0), - REAL_CONST(112529.98889996267/8.0), - REAL_CONST(112554.41013289688/8.0), - REAL_CONST(112578.8326905881/8.0), - REAL_CONST(112603.25657289263/8.0), - REAL_CONST(112627.68177966679/8.0), - REAL_CONST(112652.10831076698/8.0), - REAL_CONST(112676.53616604958/8.0), - REAL_CONST(112700.96534537108/8.0), - REAL_CONST(112725.39584858794/8.0), - REAL_CONST(112749.82767555672/8.0), - REAL_CONST(112774.26082613398/8.0), - REAL_CONST(112798.6953001763/8.0), - REAL_CONST(112823.13109754038/8.0), - REAL_CONST(112847.56821808286/8.0), - REAL_CONST(112872.00666166049/8.0), - REAL_CONST(112896.44642813003/8.0), - REAL_CONST(112920.88751734827/8.0), - REAL_CONST(112945.32992917208/8.0), - REAL_CONST(112969.77366345831/8.0), - REAL_CONST(112994.21872006389/8.0), - REAL_CONST(113018.66509884578/8.0), - REAL_CONST(113043.11279966099/8.0), - REAL_CONST(113067.56182236652/8.0), - REAL_CONST(113092.01216681948/8.0), - REAL_CONST(113116.46383287695/8.0), - REAL_CONST(113140.9168203961/8.0), - REAL_CONST(113165.37112923413/8.0), - REAL_CONST(113189.82675924824/8.0), - REAL_CONST(113214.28371029573/8.0), - REAL_CONST(113238.74198223387/8.0), - REAL_CONST(113263.20157492002/8.0), - REAL_CONST(113287.66248821157/8.0), - REAL_CONST(113312.12472196593/8.0), - REAL_CONST(113336.58827604055/8.0), - REAL_CONST(113361.05315029295/8.0), - REAL_CONST(113385.51934458067/8.0), - REAL_CONST(113409.98685876124/8.0), - REAL_CONST(113434.45569269233/8.0), - REAL_CONST(113458.92584623155/8.0), - REAL_CONST(113483.39731923661/8.0), - REAL_CONST(113507.87011156522/8.0), - REAL_CONST(113532.34422307517/8.0), - REAL_CONST(113556.81965362425/8.0), - REAL_CONST(113581.2964030703/8.0), - REAL_CONST(113605.77447127122/8.0), - REAL_CONST(113630.25385808491/8.0), - REAL_CONST(113654.73456336933/8.0), - REAL_CONST(113679.2165869825/8.0), - REAL_CONST(113703.69992878241/8.0), - REAL_CONST(113728.18458862718/8.0), - REAL_CONST(113752.67056637487/8.0), - REAL_CONST(113777.15786188368/8.0), - REAL_CONST(113801.64647501177/8.0), - REAL_CONST(113826.13640561736/8.0), - REAL_CONST(113850.62765355874/8.0), - REAL_CONST(113875.12021869418/8.0), - REAL_CONST(113899.61410088204/8.0), - REAL_CONST(113924.1092999807/8.0), - REAL_CONST(113948.60581584855/8.0), - REAL_CONST(113973.10364834407/8.0), - REAL_CONST(113997.60279732574/8.0), - REAL_CONST(114022.1032626521/8.0), - REAL_CONST(114046.60504418171/8.0), - REAL_CONST(114071.10814177318/8.0), - REAL_CONST(114095.61255528514/8.0), - REAL_CONST(114120.11828457628/8.0), - REAL_CONST(114144.62532950533/8.0), - REAL_CONST(114169.13368993104/8.0), - REAL_CONST(114193.6433657122/8.0), - REAL_CONST(114218.15435670764/8.0), - REAL_CONST(114242.66666277625/8.0), - REAL_CONST(114267.18028377694/8.0), - REAL_CONST(114291.69521956862/8.0), - REAL_CONST(114316.21147001031/8.0), - REAL_CONST(114340.72903496103/8.0), - REAL_CONST(114365.24791427983/8.0), - REAL_CONST(114389.7681078258/8.0), - REAL_CONST(114414.2896154581/8.0), - REAL_CONST(114438.81243703589/8.0), - REAL_CONST(114463.33657241837/8.0), - REAL_CONST(114487.8620214648/8.0), - REAL_CONST(114512.38878403447/8.0), - REAL_CONST(114536.91685998671/8.0), - REAL_CONST(114561.44624918087/8.0), - REAL_CONST(114585.97695147636/8.0), - REAL_CONST(114610.5089667326/8.0), - REAL_CONST(114635.04229480909/8.0), - REAL_CONST(114659.57693556532/8.0), - REAL_CONST(114684.11288886084/8.0), - REAL_CONST(114708.65015455526/8.0), - REAL_CONST(114733.18873250818/8.0), - REAL_CONST(114757.72862257928/8.0), - REAL_CONST(114782.26982462825/8.0), - REAL_CONST(114806.81233851484/8.0), - REAL_CONST(114831.35616409882/8.0), - REAL_CONST(114855.90130123998/8.0), - REAL_CONST(114880.44774979822/8.0), - REAL_CONST(114904.99550963337/8.0), - REAL_CONST(114929.5445806054/8.0), - REAL_CONST(114954.09496257425/8.0), - REAL_CONST(114978.64665539992/8.0), - REAL_CONST(115003.19965894247/8.0), - REAL_CONST(115027.75397306195/8.0), - REAL_CONST(115052.30959761847/8.0), - REAL_CONST(115076.86653247218/8.0), - REAL_CONST(115101.42477748329/8.0), - REAL_CONST(115125.984332512/8.0), - REAL_CONST(115150.54519741859/8.0), - REAL_CONST(115175.10737206334/8.0), - REAL_CONST(115199.67085630659/8.0), - REAL_CONST(115224.23565000873/8.0), - REAL_CONST(115248.80175303014/8.0), - REAL_CONST(115273.3691652313/8.0), - REAL_CONST(115297.93788647266/8.0), - REAL_CONST(115322.50791661476/8.0), - REAL_CONST(115347.07925551817/8.0), - REAL_CONST(115371.65190304347/8.0), - REAL_CONST(115396.22585905129/8.0), - REAL_CONST(115420.80112340231/8.0), - REAL_CONST(115445.37769595724/8.0), - REAL_CONST(115469.95557657682/8.0), - REAL_CONST(115494.53476512182/8.0), - REAL_CONST(115519.11526145306/8.0), - REAL_CONST(115543.69706543141/8.0), - REAL_CONST(115568.28017691776/8.0), - REAL_CONST(115592.86459577303/8.0), - REAL_CONST(115617.4503218582/8.0), - REAL_CONST(115642.03735503425/8.0), - REAL_CONST(115666.62569516223/8.0), - REAL_CONST(115691.21534210323/8.0), - REAL_CONST(115715.80629571836/8.0), - REAL_CONST(115740.39855586876/8.0), - REAL_CONST(115764.99212241563/8.0), - REAL_CONST(115789.58699522018/8.0), - REAL_CONST(115814.18317414368/8.0), - REAL_CONST(115838.78065904744/8.0), - REAL_CONST(115863.37944979276/8.0), - REAL_CONST(115887.97954624105/8.0), - REAL_CONST(115912.5809482537/8.0), - REAL_CONST(115937.18365569216/8.0), - REAL_CONST(115961.78766841792/8.0), - REAL_CONST(115986.39298629249/8.0), - REAL_CONST(116010.99960917742/8.0), - REAL_CONST(116035.60753693432/8.0), - REAL_CONST(116060.21676942479/8.0), - REAL_CONST(116084.82730651053/8.0), - REAL_CONST(116109.43914805322/8.0), - REAL_CONST(116134.0522939146/8.0), - REAL_CONST(116158.66674395646/8.0), - REAL_CONST(116183.2824980406/8.0), - REAL_CONST(116207.89955602887/8.0), - REAL_CONST(116232.51791778316/8.0), - REAL_CONST(116257.13758316539/8.0), - REAL_CONST(116281.75855203751/8.0), - REAL_CONST(116306.38082426153/8.0), - REAL_CONST(116331.00439969949/8.0), - REAL_CONST(116355.62927821343/8.0), - REAL_CONST(116380.25545966547/8.0), - REAL_CONST(116404.88294391775/8.0), - REAL_CONST(116429.51173083246/8.0), - REAL_CONST(116454.14182027178/8.0), - REAL_CONST(116478.77321209799/8.0), - REAL_CONST(116503.40590617337/8.0), - REAL_CONST(116528.03990236025/8.0), - REAL_CONST(116552.67520052097/8.0), - REAL_CONST(116577.31180051794/8.0), - REAL_CONST(116601.94970221359/8.0), - REAL_CONST(116626.5889054704/8.0), - REAL_CONST(116651.22941015086/8.0), - REAL_CONST(116675.87121611751/8.0), - REAL_CONST(116700.51432323294/8.0), - REAL_CONST(116725.15873135976/8.0), - REAL_CONST(116749.8044403606/8.0), - REAL_CONST(116774.45145009817/8.0), - REAL_CONST(116799.0997604352/8.0), - REAL_CONST(116823.74937123443/8.0), - REAL_CONST(116848.40028235866/8.0), - REAL_CONST(116873.05249367072/8.0), - REAL_CONST(116897.70600503348/8.0), - REAL_CONST(116922.36081630984/8.0), - REAL_CONST(116947.01692736275/8.0), - REAL_CONST(116971.67433805518/8.0), - REAL_CONST(116996.33304825013/8.0), - REAL_CONST(117020.99305781067/8.0), - REAL_CONST(117045.65436659988/8.0), - REAL_CONST(117070.31697448085/8.0), - REAL_CONST(117094.98088131678/8.0), - REAL_CONST(117119.64608697082/8.0), - REAL_CONST(117144.31259130624/8.0), - REAL_CONST(117168.98039418629/8.0), - REAL_CONST(117193.64949547425/8.0), - REAL_CONST(117218.31989503348/8.0), - REAL_CONST(117242.99159272734/8.0), - REAL_CONST(117267.66458841923/8.0), - REAL_CONST(117292.33888197262/8.0), - REAL_CONST(117317.01447325097/8.0), - REAL_CONST(117341.6913621178/8.0), - REAL_CONST(117366.36954843666/8.0), - REAL_CONST(117391.04903207115/8.0), - REAL_CONST(117415.72981288488/8.0), - REAL_CONST(117440.41189074152/8.0), - REAL_CONST(117465.09526550474/8.0), - REAL_CONST(117489.77993703831/8.0), - REAL_CONST(117514.46590520597/8.0), - REAL_CONST(117539.15316987153/8.0), - REAL_CONST(117563.84173089883/8.0), - REAL_CONST(117588.53158815173/8.0), - REAL_CONST(117613.22274149416/8.0), - REAL_CONST(117637.91519079007/8.0), - REAL_CONST(117662.60893590341/8.0), - REAL_CONST(117687.30397669821/8.0), - REAL_CONST(117712.00031303853/8.0), - REAL_CONST(117736.69794478847/8.0), - REAL_CONST(117761.39687181212/8.0), - REAL_CONST(117786.09709397367/8.0), - REAL_CONST(117810.7986111373/8.0), - REAL_CONST(117835.50142316725/8.0), - REAL_CONST(117860.20552992777/8.0), - REAL_CONST(117884.91093128319/8.0), - REAL_CONST(117909.6176270978/8.0), - REAL_CONST(117934.32561723603/8.0), - REAL_CONST(117959.03490156225/8.0), - REAL_CONST(117983.74547994092/8.0), - REAL_CONST(118008.45735223651/8.0), - REAL_CONST(118033.17051831353/8.0), - REAL_CONST(118057.88497803656/8.0), - REAL_CONST(118082.60073127014/8.0), - REAL_CONST(118107.31777787894/8.0), - REAL_CONST(118132.03611772758/8.0), - REAL_CONST(118156.75575068076/8.0), - REAL_CONST(118181.47667660323/8.0), - REAL_CONST(118206.19889535972/8.0), - REAL_CONST(118230.92240681504/8.0), - REAL_CONST(118255.64721083404/8.0), - REAL_CONST(118280.37330728157/8.0), - REAL_CONST(118305.10069602253/8.0), - REAL_CONST(118329.82937692189/8.0), - REAL_CONST(118354.55934984458/8.0), - REAL_CONST(118379.29061465565/8.0), - REAL_CONST(118404.02317122012/8.0), - REAL_CONST(118428.75701940308/8.0), - REAL_CONST(118453.49215906965/8.0), - REAL_CONST(118478.22859008498/8.0), - REAL_CONST(118502.96631231424/8.0), - REAL_CONST(118527.70532562268/8.0), - REAL_CONST(118552.44562987552/8.0), - REAL_CONST(118577.18722493808/8.0), - REAL_CONST(118601.93011067568/8.0), - REAL_CONST(118626.67428695368/8.0), - REAL_CONST(118651.41975363747/8.0), - REAL_CONST(118676.16651059251/8.0), - REAL_CONST(118700.91455768423/8.0), - REAL_CONST(118725.66389477813/8.0), - REAL_CONST(118750.41452173979/8.0), - REAL_CONST(118775.16643843475/8.0), - REAL_CONST(118799.91964472862/8.0), - REAL_CONST(118824.67414048707/8.0), - REAL_CONST(118849.42992557574/8.0), - REAL_CONST(118874.18699986035/8.0), - REAL_CONST(118898.94536320666/8.0), - REAL_CONST(118923.70501548045/8.0), - REAL_CONST(118948.46595654752/8.0), - REAL_CONST(118973.22818627374/8.0), - REAL_CONST(118997.99170452499/8.0), - REAL_CONST(119022.7565111672/8.0), - REAL_CONST(119047.52260606633/8.0), - REAL_CONST(119072.28998908834/8.0), - REAL_CONST(119097.0586600993/8.0), - REAL_CONST(119121.82861896523/8.0), - REAL_CONST(119146.59986555226/8.0), - REAL_CONST(119171.3723997265/8.0), - REAL_CONST(119196.14622135412/8.0), - REAL_CONST(119220.92133030134/8.0), - REAL_CONST(119245.69772643436/8.0), - REAL_CONST(119270.47540961947/8.0), - REAL_CONST(119295.25437972297/8.0), - REAL_CONST(119320.03463661121/8.0), - REAL_CONST(119344.81618015055/8.0), - REAL_CONST(119369.5990102074/8.0), - REAL_CONST(119394.38312664822/8.0), - REAL_CONST(119419.16852933947/8.0), - REAL_CONST(119443.95521814766/8.0), - REAL_CONST(119468.74319293935/8.0), - REAL_CONST(119493.53245358112/8.0), - REAL_CONST(119518.32299993958/8.0), - REAL_CONST(119543.11483188139/8.0), - REAL_CONST(119567.90794927324/8.0), - REAL_CONST(119592.70235198183/8.0), - REAL_CONST(119617.49803987393/8.0), - REAL_CONST(119642.29501281632/8.0), - REAL_CONST(119667.09327067583/8.0), - REAL_CONST(119691.89281331931/8.0), - REAL_CONST(119716.69364061367/8.0), - REAL_CONST(119741.49575242582/8.0), - REAL_CONST(119766.29914862274/8.0), - REAL_CONST(119791.10382907141/8.0), - REAL_CONST(119815.90979363887/8.0), - REAL_CONST(119840.71704219218/8.0), - REAL_CONST(119865.52557459843/8.0), - REAL_CONST(119890.33539072477/8.0), - REAL_CONST(119915.14649043836/8.0), - REAL_CONST(119939.95887360642/8.0), - REAL_CONST(119964.77254009615/8.0), - REAL_CONST(119989.58748977486/8.0), - REAL_CONST(120014.40372250983/8.0), - REAL_CONST(120039.22123816841/8.0), - REAL_CONST(120064.04003661797/8.0), - REAL_CONST(120088.86011772591/8.0), - REAL_CONST(120113.6814813597/8.0), - REAL_CONST(120138.5041273868/8.0), - REAL_CONST(120163.3280556747/8.0), - REAL_CONST(120188.15326609099/8.0), - REAL_CONST(120212.97975850321/8.0), - REAL_CONST(120237.807532779/8.0), - REAL_CONST(120262.63658878599/8.0), - REAL_CONST(120287.46692639188/8.0), - REAL_CONST(120312.29854546436/8.0), - REAL_CONST(120337.13144587121/8.0), - REAL_CONST(120361.9656274802/8.0), - REAL_CONST(120386.80109015915/8.0), - REAL_CONST(120411.63783377589/8.0), - REAL_CONST(120436.47585819835/8.0), - REAL_CONST(120461.31516329442/8.0), - REAL_CONST(120486.15574893207/8.0), - REAL_CONST(120510.99761497928/8.0), - REAL_CONST(120535.84076130406/8.0), - REAL_CONST(120560.68518777451/8.0), - REAL_CONST(120585.53089425867/8.0), - REAL_CONST(120610.3778806247/8.0), - REAL_CONST(120635.22614674074/8.0), - REAL_CONST(120660.07569247499/8.0), - REAL_CONST(120684.92651769568/8.0), - REAL_CONST(120709.77862227106/8.0), - REAL_CONST(120734.63200606944/8.0), - REAL_CONST(120759.48666895913/8.0), - REAL_CONST(120784.3426108085/8.0), - REAL_CONST(120809.19983148595/8.0), - REAL_CONST(120834.05833085992/8.0), - REAL_CONST(120858.91810879884/8.0), - REAL_CONST(120883.77916517125/8.0), - REAL_CONST(120908.64149984565/8.0), - REAL_CONST(120933.5051126906/8.0), - REAL_CONST(120958.37000357473/8.0), - REAL_CONST(120983.23617236665/8.0), - REAL_CONST(121008.10361893504/8.0), - REAL_CONST(121032.97234314861/8.0), - REAL_CONST(121057.84234487606/8.0), - REAL_CONST(121082.71362398617/8.0), - REAL_CONST(121107.58618034775/8.0), - REAL_CONST(121132.46001382964/8.0), - REAL_CONST(121157.33512430069/8.0), - REAL_CONST(121182.21151162982/8.0), - REAL_CONST(121207.08917568595/8.0), - REAL_CONST(121231.96811633807/8.0), - REAL_CONST(121256.84833345517/8.0), - REAL_CONST(121281.72982690629/8.0), - REAL_CONST(121306.61259656049/8.0), - REAL_CONST(121331.49664228689/8.0), - REAL_CONST(121356.38196395461/8.0), - REAL_CONST(121381.26856143285/8.0), - REAL_CONST(121406.15643459078/8.0), - REAL_CONST(121431.04558329767/8.0), - REAL_CONST(121455.93600742276/8.0), - REAL_CONST(121480.82770683538/8.0), - REAL_CONST(121505.72068140487/8.0), - REAL_CONST(121530.61493100057/8.0), - REAL_CONST(121555.51045549192/8.0), - REAL_CONST(121580.40725474835/8.0), - REAL_CONST(121605.30532863933/8.0), - REAL_CONST(121630.20467703436/8.0), - REAL_CONST(121655.10529980299/8.0), - REAL_CONST(121680.00719681478/8.0), - REAL_CONST(121704.91036793934/8.0), - REAL_CONST(121729.81481304632/8.0), - REAL_CONST(121754.72053200539/8.0), - REAL_CONST(121779.62752468624/8.0), - REAL_CONST(121804.53579095862/8.0), - REAL_CONST(121829.44533069231/8.0), - REAL_CONST(121854.3561437571/8.0), - REAL_CONST(121879.26823002285/8.0), - REAL_CONST(121904.1815893594/8.0), - REAL_CONST(121929.09622163669/8.0), - REAL_CONST(121954.01212672464/8.0), - REAL_CONST(121978.92930449323/8.0), - REAL_CONST(122003.84775481246/8.0), - REAL_CONST(122028.76747755238/8.0), - REAL_CONST(122053.68847258303/8.0), - REAL_CONST(122078.61073977455/8.0), - REAL_CONST(122103.53427899707/8.0), - REAL_CONST(122128.45909012076/8.0), - REAL_CONST(122153.38517301581/8.0), - REAL_CONST(122178.31252755247/8.0), - REAL_CONST(122203.24115360099/8.0), - REAL_CONST(122228.17105103172/8.0), - REAL_CONST(122253.10221971494/8.0), - REAL_CONST(122278.03465952107/8.0), - REAL_CONST(122302.96837032049/8.0), - REAL_CONST(122327.90335198362/8.0), - REAL_CONST(122352.83960438096/8.0), - REAL_CONST(122377.777127383/8.0), - REAL_CONST(122402.71592086025/8.0), - REAL_CONST(122427.65598468333/8.0), - REAL_CONST(122452.59731872278/8.0), - REAL_CONST(122477.53992284928/8.0), - REAL_CONST(122502.48379693348/8.0), - REAL_CONST(122527.42894084606/8.0), - REAL_CONST(122552.37535445779/8.0), - REAL_CONST(122577.32303763942/8.0), - REAL_CONST(122602.27199026172/8.0), - REAL_CONST(122627.22221219557/8.0), - REAL_CONST(122652.17370331181/8.0), - REAL_CONST(122677.12646348133/8.0), - REAL_CONST(122702.08049257506/8.0), - REAL_CONST(122727.03579046397/8.0), - REAL_CONST(122751.99235701906/8.0), - REAL_CONST(122776.95019211136/8.0), - REAL_CONST(122801.9092956119/8.0), - REAL_CONST(122826.8696673918/8.0), - REAL_CONST(122851.83130732219/8.0), - REAL_CONST(122876.79421527422/8.0), - REAL_CONST(122901.75839111909/8.0), - REAL_CONST(122926.72383472799/8.0), - REAL_CONST(122951.69054597223/8.0), - REAL_CONST(122976.65852472307/8.0), - REAL_CONST(123001.62777085182/8.0), - REAL_CONST(123026.59828422987/8.0), - REAL_CONST(123051.57006472857/8.0), - REAL_CONST(123076.54311221937/8.0), - REAL_CONST(123101.5174265737/8.0), - REAL_CONST(123126.49300766307/8.0), - REAL_CONST(123151.46985535898/8.0), - REAL_CONST(123176.44796953299/8.0), - REAL_CONST(123201.42735005668/8.0), - REAL_CONST(123226.40799680166/8.0), - REAL_CONST(123251.38990963959/8.0), - REAL_CONST(123276.37308844214/8.0), - REAL_CONST(123301.35753308103/8.0), - REAL_CONST(123326.343243428/8.0), - REAL_CONST(123351.33021935483/8.0), - REAL_CONST(123376.31846073334/8.0), - REAL_CONST(123401.30796743535/8.0), - REAL_CONST(123426.29873933276/8.0), - REAL_CONST(123451.29077629748/8.0), - REAL_CONST(123476.28407820144/8.0), - REAL_CONST(123501.2786449166/8.0), - REAL_CONST(123526.27447631498/8.0), - REAL_CONST(123551.27157226863/8.0), - REAL_CONST(123576.26993264959/8.0), - REAL_CONST(123601.26955732999/8.0), - REAL_CONST(123626.27044618195/8.0), - REAL_CONST(123651.27259907764/8.0), - REAL_CONST(123676.27601588926/8.0), - REAL_CONST(123701.28069648903/8.0), - REAL_CONST(123726.28664074924/8.0), - REAL_CONST(123751.29384854218/8.0), - REAL_CONST(123776.30231974016/8.0), - REAL_CONST(123801.31205421555/8.0), - REAL_CONST(123826.32305184075/8.0), - REAL_CONST(123851.33531248817/8.0), - REAL_CONST(123876.34883603029/8.0), - REAL_CONST(123901.36362233957/8.0), - REAL_CONST(123926.37967128855/8.0), - REAL_CONST(123951.39698274979/8.0), - REAL_CONST(123976.41555659588/8.0), - REAL_CONST(124001.43539269941/8.0), - REAL_CONST(124026.45649093305/8.0), - REAL_CONST(124051.47885116948/8.0), - REAL_CONST(124076.50247328142/8.0), - REAL_CONST(124101.5273571416/8.0), - REAL_CONST(124126.55350262282/8.0), - REAL_CONST(124151.58090959788/8.0), - REAL_CONST(124176.60957793961/8.0), - REAL_CONST(124201.63950752091/8.0), - REAL_CONST(124226.67069821467/8.0), - REAL_CONST(124251.70314989384/8.0), - REAL_CONST(124276.73686243138/8.0), - REAL_CONST(124301.7718357003/8.0), - REAL_CONST(124326.80806957364/8.0), - REAL_CONST(124351.84556392446/8.0), - REAL_CONST(124376.88431862585/8.0), - REAL_CONST(124401.92433355095/8.0), - REAL_CONST(124426.96560857294/8.0), - REAL_CONST(124452.00814356498/8.0), - REAL_CONST(124477.05193840031/8.0), - REAL_CONST(124502.0969929522/8.0), - REAL_CONST(124527.14330709392/8.0), - REAL_CONST(124552.19088069882/8.0), - REAL_CONST(124577.23971364023/8.0), - REAL_CONST(124602.28980579154/8.0), - REAL_CONST(124627.34115702618/8.0), - REAL_CONST(124652.3937672176/8.0), - REAL_CONST(124677.44763623926/8.0), - REAL_CONST(124702.50276396469/8.0), - REAL_CONST(124727.55915026742/8.0), - REAL_CONST(124752.61679502104/8.0), - REAL_CONST(124777.67569809916/8.0), - REAL_CONST(124802.73585937542/8.0), - REAL_CONST(124827.79727872348/8.0), - REAL_CONST(124852.85995601704/8.0), - REAL_CONST(124877.92389112986/8.0), - REAL_CONST(124902.98908393568/8.0), - REAL_CONST(124928.05553430831/8.0), - REAL_CONST(124953.1232421216/8.0), - REAL_CONST(124978.19220724938/8.0), - REAL_CONST(125003.26242956554/8.0), - REAL_CONST(125028.33390894404/8.0), - REAL_CONST(125053.40664525882/8.0), - REAL_CONST(125078.48063838384/8.0), - REAL_CONST(125103.55588819318/8.0), - REAL_CONST(125128.63239456083/8.0), - REAL_CONST(125153.71015736091/8.0), - REAL_CONST(125178.78917646752/8.0), - REAL_CONST(125203.86945175481/8.0), - REAL_CONST(125228.95098309696/8.0), - REAL_CONST(125254.03377036817/8.0), - REAL_CONST(125279.1178134427/8.0), - REAL_CONST(125304.20311219479/8.0), - REAL_CONST(125329.28966649878/8.0), - REAL_CONST(125354.37747622898/8.0), - REAL_CONST(125379.46654125977/8.0), - REAL_CONST(125404.55686146552/8.0), - REAL_CONST(125429.6484367207/8.0), - REAL_CONST(125454.74126689974/8.0), - REAL_CONST(125479.83535187715/8.0), - REAL_CONST(125504.93069152744/8.0), - REAL_CONST(125530.02728572517/8.0), - REAL_CONST(125555.12513434493/8.0), - REAL_CONST(125580.22423726133/8.0), - REAL_CONST(125605.32459434902/8.0), - REAL_CONST(125630.4262054827/8.0), - REAL_CONST(125655.52907053704/8.0), - REAL_CONST(125680.63318938682/8.0), - REAL_CONST(125705.73856190679/8.0), - REAL_CONST(125730.84518797178/8.0), - REAL_CONST(125755.9530674566/8.0), - REAL_CONST(125781.06220023613/8.0), - REAL_CONST(125806.17258618528/8.0), - REAL_CONST(125831.28422517896/8.0), - REAL_CONST(125856.39711709213/8.0), - REAL_CONST(125881.51126179981/8.0), - REAL_CONST(125906.62665917698/8.0), - REAL_CONST(125931.74330909875/8.0), - REAL_CONST(125956.86121144016/8.0), - REAL_CONST(125981.98036607634/8.0), - REAL_CONST(126007.10077288245/8.0), - REAL_CONST(126032.22243173365/8.0), - REAL_CONST(126057.34534250517/8.0), - REAL_CONST(126082.46950507225/8.0), - REAL_CONST(126107.59491931014/8.0), - REAL_CONST(126132.72158509417/8.0), - REAL_CONST(126157.84950229966/8.0), - REAL_CONST(126182.97867080198/8.0), - REAL_CONST(126208.10909047653/8.0), - REAL_CONST(126233.24076119871/8.0), - REAL_CONST(126258.37368284403/8.0), - REAL_CONST(126283.50785528794/8.0), - REAL_CONST(126308.64327840599/8.0), - REAL_CONST(126333.77995207369/8.0), - REAL_CONST(126358.91787616667/8.0), - REAL_CONST(126384.0570505605/8.0), - REAL_CONST(126409.19747513086/8.0), - REAL_CONST(126434.3391497534/8.0), - REAL_CONST(126459.48207430386/8.0), - REAL_CONST(126484.62624865794/8.0), - REAL_CONST(126509.77167269142/8.0), - REAL_CONST(126534.9183462801/8.0), - REAL_CONST(126560.06626929982/8.0), - REAL_CONST(126585.21544162642/8.0), - REAL_CONST(126610.36586313581/8.0), - REAL_CONST(126635.51753370393/8.0), - REAL_CONST(126660.67045320668/8.0), - REAL_CONST(126685.82462152008/8.0), - REAL_CONST(126710.98003852014/8.0), - REAL_CONST(126736.13670408291/8.0), - REAL_CONST(126761.29461808444/8.0), - REAL_CONST(126786.45378040087/8.0), - REAL_CONST(126811.61419090834/8.0), - REAL_CONST(126836.77584948298/8.0), - REAL_CONST(126861.93875600102/8.0), - REAL_CONST(126887.10291033868/8.0), - REAL_CONST(126912.26831237224/8.0), - REAL_CONST(126937.43496197795/8.0), - REAL_CONST(126962.60285903217/8.0), - REAL_CONST(126987.77200341123/8.0), - REAL_CONST(127012.94239499152/8.0), - REAL_CONST(127038.11403364947/8.0), - REAL_CONST(127063.2869192615/8.0), - REAL_CONST(127088.46105170409/8.0), - REAL_CONST(127113.63643085376/8.0), - REAL_CONST(127138.81305658702/8.0), - REAL_CONST(127163.99092878048/8.0), - REAL_CONST(127189.17004731069/8.0), - REAL_CONST(127214.35041205429/8.0), - REAL_CONST(127239.53202288797/8.0), - REAL_CONST(127264.71487968838/8.0), - REAL_CONST(127289.89898233226/8.0), - REAL_CONST(127315.08433069635/8.0), - REAL_CONST(127340.27092465744/8.0), - REAL_CONST(127365.45876409234/8.0), - REAL_CONST(127390.64784887788/8.0), - REAL_CONST(127415.83817889093/8.0), - REAL_CONST(127441.02975400841/8.0), - REAL_CONST(127466.22257410725/8.0), - REAL_CONST(127491.41663906439/8.0), - REAL_CONST(127516.61194875685/8.0), - REAL_CONST(127541.80850306165/8.0), - REAL_CONST(127567.00630185583/8.0), - REAL_CONST(127592.20534501647/8.0), - REAL_CONST(127617.4056324207/8.0), - REAL_CONST(127642.60716394568/8.0), - REAL_CONST(127667.80993946856/8.0), - REAL_CONST(127693.01395886653/8.0), - REAL_CONST(127718.21922201688/8.0), - REAL_CONST(127743.42572879682/8.0), - REAL_CONST(127768.63347908368/8.0), - REAL_CONST(127793.84247275478/8.0), - REAL_CONST(127819.05270968749/8.0), - REAL_CONST(127844.26418975917/8.0), - REAL_CONST(127869.47691284724/8.0), - REAL_CONST(127894.69087882918/8.0), - REAL_CONST(127919.90608758242/8.0), - REAL_CONST(127945.12253898452/8.0), - REAL_CONST(127970.34023291297/8.0), - REAL_CONST(127995.55916924537/8.0), - REAL_CONST(128020.77934785932/8.0), - REAL_CONST(128046.00076863244/8.0), - REAL_CONST(128071.22343144237/8.0), - REAL_CONST(128096.44733616684/8.0), - REAL_CONST(128121.67248268353/8.0), - REAL_CONST(128146.89887087021/8.0), - REAL_CONST(128172.12650060465/8.0), - REAL_CONST(128197.35537176467/8.0), - REAL_CONST(128222.5854842281/8.0), - REAL_CONST(128247.81683787282/8.0), - REAL_CONST(128273.04943257671/8.0), - REAL_CONST(128298.28326821771/8.0), - REAL_CONST(128323.51834467379/8.0), - REAL_CONST(128348.75466182294/8.0), - REAL_CONST(128373.99221954317/8.0), - REAL_CONST(128399.23101771252/8.0), - REAL_CONST(128424.47105620909/8.0), - REAL_CONST(128449.71233491098/8.0), - REAL_CONST(128474.95485369631/8.0), - REAL_CONST(128500.19861244329/8.0), - REAL_CONST(128525.44361103009/8.0), - REAL_CONST(128550.68984933494/8.0), - REAL_CONST(128575.93732723613/8.0), - REAL_CONST(128601.18604461191/8.0), - REAL_CONST(128626.43600134061/8.0), - REAL_CONST(128651.68719730059/8.0), - REAL_CONST(128676.93963237021/8.0), - REAL_CONST(128702.1933064279/8.0), - REAL_CONST(128727.44821935208/8.0), - REAL_CONST(128752.70437102125/8.0), - REAL_CONST(128777.96176131385/8.0), - REAL_CONST(128803.22039010846/8.0), - REAL_CONST(128828.48025728362/8.0), - REAL_CONST(128853.74136271792/8.0), - REAL_CONST(128879.00370628996/8.0), - REAL_CONST(128904.26728787841/8.0), - REAL_CONST(128929.53210736193/8.0), - REAL_CONST(128954.79816461923/8.0), - REAL_CONST(128980.06545952905/8.0), - REAL_CONST(129005.33399197015/8.0), - REAL_CONST(129030.60376182134/8.0), - REAL_CONST(129055.87476896142/8.0), - REAL_CONST(129081.14701326926/8.0), - REAL_CONST(129106.42049462376/8.0), - REAL_CONST(129131.6952129038/8.0), - REAL_CONST(129156.97116798835/8.0), - REAL_CONST(129182.24835975636/8.0), - REAL_CONST(129207.52678808685/8.0), - REAL_CONST(129232.80645285884/8.0), - REAL_CONST(129258.08735395141/8.0), - REAL_CONST(129283.36949124365/8.0), - REAL_CONST(129308.65286461466/8.0), - REAL_CONST(129333.9374739436/8.0), - REAL_CONST(129359.22331910966/8.0), - REAL_CONST(129384.51039999202/8.0), - REAL_CONST(129409.79871646997/8.0), - REAL_CONST(129435.08826842274/8.0), - REAL_CONST(129460.37905572963/8.0), - REAL_CONST(129485.67107826998/8.0), - REAL_CONST(129510.96433592314/8.0), - REAL_CONST(129536.25882856851/8.0), - REAL_CONST(129561.55455608548/8.0), - REAL_CONST(129586.85151835352/8.0), - REAL_CONST(129612.14971525209/8.0), - REAL_CONST(129637.4491466607/8.0), - REAL_CONST(129662.74981245887/8.0), - REAL_CONST(129688.0517125262/8.0), - REAL_CONST(129713.35484674224/8.0), - REAL_CONST(129738.65921498663/8.0), - REAL_CONST(129763.96481713903/8.0), - REAL_CONST(129789.27165307909/8.0), - REAL_CONST(129814.57972268655/8.0), - REAL_CONST(129839.88902584116/8.0), - REAL_CONST(129865.19956242264/8.0), - REAL_CONST(129890.51133231082/8.0), - REAL_CONST(129915.82433538554/8.0), - REAL_CONST(129941.13857152662/8.0), - REAL_CONST(129966.45404061397/8.0), - REAL_CONST(129991.7707425275/8.0), - REAL_CONST(130017.08867714716/8.0), - REAL_CONST(130042.4078443529/8.0), - REAL_CONST(130067.72824402474/8.0), - REAL_CONST(130093.04987604271/8.0), - REAL_CONST(130118.37274028687/8.0), - REAL_CONST(130143.69683663732/8.0), - REAL_CONST(130169.02216497416/8.0), - REAL_CONST(130194.34872517755/8.0), - REAL_CONST(130219.67651712766/8.0), - REAL_CONST(130245.0055407047/8.0), - REAL_CONST(130270.33579578891/8.0), - REAL_CONST(130295.66728226055/8.0), - REAL_CONST(130320.99999999991/8.0), - REAL_CONST(130346.33394888733/8.0), - REAL_CONST(130371.66912880314/8.0), - REAL_CONST(130397.00553962773/8.0), - REAL_CONST(130422.34318124152/8.0), - REAL_CONST(130447.68205352494/8.0), - REAL_CONST(130473.02215635845/8.0), - REAL_CONST(130498.36348962256/8.0), - REAL_CONST(130523.70605319779/8.0), - REAL_CONST(130549.0498469647/8.0), - REAL_CONST(130574.39487080388/8.0), - REAL_CONST(130599.74112459592/8.0), - REAL_CONST(130625.08860822149/8.0), - REAL_CONST(130650.43732156123/8.0), - REAL_CONST(130675.78726449587/8.0), - REAL_CONST(130701.13843690613/8.0), - REAL_CONST(130726.49083867275/8.0), - REAL_CONST(130751.84446967654/8.0), - REAL_CONST(130777.19932979831/8.0), - REAL_CONST(130802.5554189189/8.0), - REAL_CONST(130827.91273691918/8.0), - REAL_CONST(130853.27128368006/8.0), - REAL_CONST(130878.63105908247/8.0), - REAL_CONST(130903.99206300738/8.0), - REAL_CONST(130929.35429533575/8.0), - REAL_CONST(130954.71775594862/8.0), - REAL_CONST(130980.08244472703/8.0), - REAL_CONST(131005.44836155206/8.0), - REAL_CONST(131030.81550630482/8.0), - REAL_CONST(131056.18387886642/8.0), - REAL_CONST(131081.55347911804/8.0), - REAL_CONST(131106.92430694087/8.0), - REAL_CONST(131132.29636221612/8.0), - REAL_CONST(131157.66964482504/8.0), - REAL_CONST(131183.0441546489/8.0), - REAL_CONST(131208.41989156904/8.0), - REAL_CONST(131233.79685546676/8.0), - REAL_CONST(131259.17504622342/8.0), - REAL_CONST(131284.55446372041/8.0), - REAL_CONST(131309.93510783918/8.0), - REAL_CONST(131335.31697846117/8.0), - REAL_CONST(131360.70007546784/8.0), - REAL_CONST(131386.0843987407/8.0), - REAL_CONST(131411.46994816128/8.0), - REAL_CONST(131436.85672361116/8.0), - REAL_CONST(131462.24472497194/8.0), - REAL_CONST(131487.63395212521/8.0), - REAL_CONST(131513.02440495262/8.0), - REAL_CONST(131538.41608333588/8.0), - REAL_CONST(131563.80898715663/8.0), - REAL_CONST(131589.2031162967/8.0), - REAL_CONST(131614.59847063778/8.0), - REAL_CONST(131639.9950500617/8.0), - REAL_CONST(131665.39285445024/8.0), - REAL_CONST(131690.79188368531/8.0), - REAL_CONST(131716.19213764873/8.0), - REAL_CONST(131741.59361622241/8.0), - REAL_CONST(131766.99631928833/8.0), - REAL_CONST(131792.40024672839/8.0), - REAL_CONST(131817.80539842462/8.0), - REAL_CONST(131843.21177425905/8.0), - REAL_CONST(131868.61937411371/8.0), - REAL_CONST(131894.02819787065/8.0), - REAL_CONST(131919.43824541202/8.0), - REAL_CONST(131944.84951661993/8.0), - REAL_CONST(131970.26201137656/8.0), - REAL_CONST(131995.67572956407/8.0), - REAL_CONST(132021.09067106468/8.0), - REAL_CONST(132046.50683576067/8.0), - REAL_CONST(132071.9242235343/8.0), - REAL_CONST(132097.34283426782/8.0), - REAL_CONST(132122.76266784366/8.0), - REAL_CONST(132148.1837241441/8.0), - REAL_CONST(132173.60600305157/8.0), - REAL_CONST(132199.02950444847/8.0), - REAL_CONST(132224.45422821722/8.0), - REAL_CONST(132249.88017424036/8.0), - REAL_CONST(132275.30734240031/8.0), - REAL_CONST(132300.73573257966/8.0), - REAL_CONST(132326.16534466096/8.0), - REAL_CONST(132351.59617852676/8.0), - REAL_CONST(132377.02823405969/8.0), - REAL_CONST(132402.46151114244/8.0), - REAL_CONST(132427.89600965759/8.0), - REAL_CONST(132453.33172948789/8.0), - REAL_CONST(132478.76867051609/8.0), - REAL_CONST(132504.20683262491/8.0), - REAL_CONST(132529.64621569714/8.0), - REAL_CONST(132555.08681961559/8.0), - REAL_CONST(132580.5286442631/8.0), - REAL_CONST(132605.97168952253/8.0), - REAL_CONST(132631.41595527678/8.0), - REAL_CONST(132656.86144140881/8.0), - REAL_CONST(132682.30814780149/8.0), - REAL_CONST(132707.75607433787/8.0), - REAL_CONST(132733.20522090094/8.0), - REAL_CONST(132758.65558737374/8.0), - REAL_CONST(132784.10717363929/8.0), - REAL_CONST(132809.55997958075/8.0), - REAL_CONST(132835.01400508118/8.0), - REAL_CONST(132860.46925002377/8.0), - REAL_CONST(132885.92571429166/8.0), - REAL_CONST(132911.38339776811/8.0), - REAL_CONST(132936.84230033628/8.0), - REAL_CONST(132962.30242187946/8.0), - REAL_CONST(132987.76376228096/8.0), - REAL_CONST(133013.22632142407/8.0), - REAL_CONST(133038.69009919214/8.0), - REAL_CONST(133064.15509546854/8.0), - REAL_CONST(133089.62131013666/8.0), - REAL_CONST(133115.08874307995/8.0), - REAL_CONST(133140.55739418184/8.0), - REAL_CONST(133166.02726332581/8.0), - REAL_CONST(133191.49835039541/8.0), - REAL_CONST(133216.97065527414/8.0), - REAL_CONST(133242.44417784561/8.0), - REAL_CONST(133267.91891799335/8.0), - REAL_CONST(133293.39487560102/8.0), - REAL_CONST(133318.87205055228/8.0), - REAL_CONST(133344.35044273079/8.0), - REAL_CONST(133369.83005202023/8.0), - REAL_CONST(133395.31087830439/8.0), - REAL_CONST(133420.79292146701/8.0), - REAL_CONST(133446.27618139185/8.0), - REAL_CONST(133471.76065796276/8.0), - REAL_CONST(133497.24635106357/8.0), - REAL_CONST(133522.73326057816/8.0), - REAL_CONST(133548.22138639039/8.0), - REAL_CONST(133573.71072838426/8.0), - REAL_CONST(133599.20128644365/8.0), - REAL_CONST(133624.69306045261/8.0), - REAL_CONST(133650.1860502951/8.0), - REAL_CONST(133675.68025585517/8.0), - REAL_CONST(133701.1756770169/8.0), - REAL_CONST(133726.67231366437/8.0), - REAL_CONST(133752.17016568172/8.0), - REAL_CONST(133777.66923295305/8.0), - REAL_CONST(133803.16951536259/8.0), - REAL_CONST(133828.67101279454/8.0), - REAL_CONST(133854.17372513309/8.0), - REAL_CONST(133879.67765226253/8.0), - REAL_CONST(133905.18279406714/8.0), - REAL_CONST(133930.68915043125/8.0), - REAL_CONST(133956.19672123916/8.0), - REAL_CONST(133981.70550637526/8.0), - REAL_CONST(134007.21550572399/8.0), - REAL_CONST(134032.7267191697/8.0), - REAL_CONST(134058.23914659687/8.0), - REAL_CONST(134083.75278789/8.0), - REAL_CONST(134109.26764293358/8.0), - REAL_CONST(134134.78371161217/8.0), - REAL_CONST(134160.30099381026/8.0), - REAL_CONST(134185.8194894125/8.0), - REAL_CONST(134211.33919830353/8.0), - REAL_CONST(134236.8601203679/8.0), - REAL_CONST(134262.38225549037/8.0), - REAL_CONST(134287.90560355558/8.0), - REAL_CONST(134313.43016444831/8.0), - REAL_CONST(134338.95593805326/8.0), - REAL_CONST(134364.48292425525/8.0), - REAL_CONST(134390.01112293909/8.0), - REAL_CONST(134415.54053398955/8.0), - REAL_CONST(134441.07115729159/8.0), - REAL_CONST(134466.60299273001/8.0), - REAL_CONST(134492.1360401898/8.0), - REAL_CONST(134517.67029955584/8.0), - REAL_CONST(134543.20577071316/8.0), - REAL_CONST(134568.74245354676/8.0), - REAL_CONST(134594.28034794159/8.0), - REAL_CONST(134619.81945378278/8.0), - REAL_CONST(134645.35977095537/8.0), - REAL_CONST(134670.90129934452/8.0), - REAL_CONST(134696.4440388353/8.0), - REAL_CONST(134721.98798931291/8.0), - REAL_CONST(134747.53315066252/8.0), - REAL_CONST(134773.07952276937/8.0), - REAL_CONST(134798.62710551871/8.0), - REAL_CONST(134824.17589879577/8.0), - REAL_CONST(134849.72590248589/8.0), - REAL_CONST(134875.27711647438/8.0), - REAL_CONST(134900.82954064661/8.0), - REAL_CONST(134926.38317488792/8.0), - REAL_CONST(134951.93801908373/8.0), - REAL_CONST(134977.49407311951/8.0), - REAL_CONST(135003.05133688069/8.0), - REAL_CONST(135028.60981025276/8.0), - REAL_CONST(135054.16949312127/8.0), - REAL_CONST(135079.73038537172/8.0), - REAL_CONST(135105.29248688967/8.0), - REAL_CONST(135130.85579756077/8.0), - REAL_CONST(135156.42031727062/8.0), - REAL_CONST(135181.98604590484/8.0), - REAL_CONST(135207.55298334916/8.0), - REAL_CONST(135233.12112948924/8.0), - REAL_CONST(135258.69048421088/8.0), - REAL_CONST(135284.26104739975/8.0), - REAL_CONST(135309.83281894168/8.0), - REAL_CONST(135335.4057987225/8.0), - REAL_CONST(135360.97998662802/8.0), - REAL_CONST(135386.55538254412/8.0), - REAL_CONST(135412.13198635669/8.0), - REAL_CONST(135437.70979795168/8.0), - REAL_CONST(135463.28881721498/8.0), - REAL_CONST(135488.86904403262/8.0), - REAL_CONST(135514.45047829056/8.0), - REAL_CONST(135540.03311987486/8.0), - REAL_CONST(135565.61696867159/8.0), - REAL_CONST(135591.20202456677/8.0), - REAL_CONST(135616.78828744654/8.0), - REAL_CONST(135642.37575719706/8.0), - REAL_CONST(135667.96443370447/8.0), - REAL_CONST(135693.55431685498/8.0), - REAL_CONST(135719.14540653475/8.0), - REAL_CONST(135744.73770263011/8.0), - REAL_CONST(135770.33120502727/8.0), - REAL_CONST(135795.92591361253/8.0), - REAL_CONST(135821.52182827223/8.0), - REAL_CONST(135847.11894889272/8.0), - REAL_CONST(135872.7172753604/8.0), - REAL_CONST(135898.31680756161/8.0), - REAL_CONST(135923.91754538284/8.0), - REAL_CONST(135949.51948871053/8.0), - REAL_CONST(135975.12263743114/8.0), - REAL_CONST(136000.72699143123/8.0), - REAL_CONST(136026.33255059729/8.0), - REAL_CONST(136051.93931481591/8.0), - REAL_CONST(136077.54728397369/8.0), - REAL_CONST(136103.15645795723/8.0), - REAL_CONST(136128.76683665317/8.0), - REAL_CONST(136154.37841994822/8.0), - REAL_CONST(136179.99120772901/8.0), - REAL_CONST(136205.60519988232/8.0), - REAL_CONST(136231.2203962949/8.0), - REAL_CONST(136256.83679685349/8.0), - REAL_CONST(136282.45440144493/8.0), - REAL_CONST(136308.07320995603/8.0), - REAL_CONST(136333.69322227367/8.0), - REAL_CONST(136359.31443828469/8.0), - REAL_CONST(136384.93685787608/8.0), - REAL_CONST(136410.56048093468/8.0), - REAL_CONST(136436.18530734754/8.0), - REAL_CONST(136461.81133700156/8.0), - REAL_CONST(136487.43856978384/8.0), - REAL_CONST(136513.06700558143/8.0), - REAL_CONST(136538.6966442813/8.0), - REAL_CONST(136564.32748577066/8.0), - REAL_CONST(136589.95952993655/8.0), - REAL_CONST(136615.59277666616/8.0), - REAL_CONST(136641.22722584667/8.0), - REAL_CONST(136666.86287736523/8.0), - REAL_CONST(136692.49973110916/8.0), - REAL_CONST(136718.13778696564/8.0), - REAL_CONST(136743.77704482197/8.0), - REAL_CONST(136769.41750456547/8.0), - REAL_CONST(136795.05916608346/8.0), - REAL_CONST(136820.70202926331/8.0), - REAL_CONST(136846.34609399244/8.0), - REAL_CONST(136871.99136015819/8.0), - REAL_CONST(136897.63782764805/8.0), - REAL_CONST(136923.28549634948/8.0), - REAL_CONST(136948.93436614997/8.0), - REAL_CONST(136974.58443693706/8.0), - REAL_CONST(137000.23570859825/8.0), - REAL_CONST(137025.88818102115/8.0), - REAL_CONST(137051.54185409332/8.0), - REAL_CONST(137077.19672770242/8.0), - REAL_CONST(137102.85280173609/8.0), - REAL_CONST(137128.51007608202/8.0), - REAL_CONST(137154.16855062786/8.0), - REAL_CONST(137179.82822526142/8.0), - REAL_CONST(137205.48909987041/8.0), - REAL_CONST(137231.15117434258/8.0), - REAL_CONST(137256.8144485658/8.0), - REAL_CONST(137282.47892242789/8.0), - REAL_CONST(137308.14459581667/8.0), - REAL_CONST(137333.81146862009/8.0), - REAL_CONST(137359.47954072602/8.0), - REAL_CONST(137385.14881202241/8.0), - REAL_CONST(137410.81928239719/8.0), - REAL_CONST(137436.49095173844/8.0), - REAL_CONST(137462.16381993407/8.0), - REAL_CONST(137487.83788687221/8.0), - REAL_CONST(137513.51315244089/8.0), - REAL_CONST(137539.18961652822/8.0), - REAL_CONST(137564.86727902229/8.0), - REAL_CONST(137590.54613981131/8.0), - REAL_CONST(137616.22619878338/8.0), - REAL_CONST(137641.90745582676/8.0), - REAL_CONST(137667.58991082967/8.0), - REAL_CONST(137693.27356368033/8.0), - REAL_CONST(137718.95841426702/8.0), - REAL_CONST(137744.64446247809/8.0), - REAL_CONST(137770.33170820182/8.0), - REAL_CONST(137796.02015132661/8.0), - REAL_CONST(137821.70979174081/8.0), - REAL_CONST(137847.40062933284/8.0), - REAL_CONST(137873.09266399115/8.0), - REAL_CONST(137898.78589560417/8.0), - REAL_CONST(137924.48032406042/8.0), - REAL_CONST(137950.17594924837/8.0), - REAL_CONST(137975.8727710566/8.0), - REAL_CONST(138001.57078937365/8.0), - REAL_CONST(138027.27000408815/8.0), - REAL_CONST(138052.97041508864/8.0), - REAL_CONST(138078.67202226384/8.0), - REAL_CONST(138104.3748255024/8.0), - REAL_CONST(138130.07882469296/8.0), - REAL_CONST(138155.78401972432/8.0), - REAL_CONST(138181.49041048516/8.0), - REAL_CONST(138207.1979968643/8.0), - REAL_CONST(138232.9067787505/8.0), - REAL_CONST(138258.61675603263/8.0), - REAL_CONST(138284.32792859949/8.0), - REAL_CONST(138310.04029633995/8.0), - REAL_CONST(138335.75385914298/8.0), - REAL_CONST(138361.46861689744/8.0), - REAL_CONST(138387.18456949232/8.0), - REAL_CONST(138412.90171681659/8.0), - REAL_CONST(138438.62005875923/8.0), - REAL_CONST(138464.33959520931/8.0), - REAL_CONST(138490.06032605586/8.0), - REAL_CONST(138515.78225118798/8.0), - REAL_CONST(138541.50537049473/8.0), - REAL_CONST(138567.2296838653/8.0), - REAL_CONST(138592.95519118884/8.0), - REAL_CONST(138618.68189235451/8.0), - REAL_CONST(138644.40978725153/8.0), - REAL_CONST(138670.13887576913/8.0), - REAL_CONST(138695.86915779658/8.0), - REAL_CONST(138721.60063322316/8.0), - REAL_CONST(138747.33330193823/8.0), - REAL_CONST(138773.06716383106/8.0), - REAL_CONST(138798.80221879104/8.0), - REAL_CONST(138824.53846670757/8.0), - REAL_CONST(138850.27590747006/8.0), - REAL_CONST(138876.01454096794/8.0), - REAL_CONST(138901.7543670907/8.0), - REAL_CONST(138927.49538572782/8.0), - REAL_CONST(138953.2375967688/8.0), - REAL_CONST(138978.9810001032/8.0), - REAL_CONST(139004.72559562061/8.0), - REAL_CONST(139030.47138321059/8.0), - REAL_CONST(139056.2183627628/8.0), - REAL_CONST(139081.96653416683/8.0), - REAL_CONST(139107.71589731239/8.0), - REAL_CONST(139133.46645208917/8.0), - REAL_CONST(139159.21819838689/8.0), - REAL_CONST(139184.97113609532/8.0), - REAL_CONST(139210.72526510421/8.0), - REAL_CONST(139236.48058530336/8.0), - REAL_CONST(139262.23709658257/8.0), - REAL_CONST(139287.99479883176/8.0), - REAL_CONST(139313.75369194071/8.0), - REAL_CONST(139339.51377579942/8.0), - REAL_CONST(139365.27505029776/8.0), - REAL_CONST(139391.03751532568/8.0), - REAL_CONST(139416.80117077316/8.0), - REAL_CONST(139442.56601653024/8.0), - REAL_CONST(139468.33205248689/8.0), - REAL_CONST(139494.09927853322/8.0), - REAL_CONST(139519.86769455927/8.0), - REAL_CONST(139545.63730045516/8.0), - REAL_CONST(139571.408096111/8.0), - REAL_CONST(139597.18008141697/8.0), - REAL_CONST(139622.95325626322/8.0), - REAL_CONST(139648.72762054001/8.0), - REAL_CONST(139674.5031741375/8.0), - REAL_CONST(139700.27991694602/8.0), - REAL_CONST(139726.05784885579/8.0), - REAL_CONST(139751.83696975713/8.0), - REAL_CONST(139777.61727954043/8.0), - REAL_CONST(139803.39877809596/8.0), - REAL_CONST(139829.18146531415/8.0), - REAL_CONST(139854.96534108539/8.0), - REAL_CONST(139880.75040530015/8.0), - REAL_CONST(139906.53665784886/8.0), - REAL_CONST(139932.32409862199/8.0), - REAL_CONST(139958.11272751007/8.0), - REAL_CONST(139983.90254440365/8.0), - REAL_CONST(140009.69354919327/8.0), - REAL_CONST(140035.48574176949/8.0), - REAL_CONST(140061.27912202294/8.0), - REAL_CONST(140087.07368984428/8.0), - REAL_CONST(140112.86944512415/8.0), - REAL_CONST(140138.66638775321/8.0), - REAL_CONST(140164.4645176222/8.0), - REAL_CONST(140190.26383462184/8.0), - REAL_CONST(140216.06433864293/8.0), - REAL_CONST(140241.86602957622/8.0), - REAL_CONST(140267.66890731253/8.0), - REAL_CONST(140293.47297174268/8.0), - REAL_CONST(140319.27822275754/8.0), - REAL_CONST(140345.08466024802/8.0), - REAL_CONST(140370.89228410498/8.0), - REAL_CONST(140396.70109421943/8.0), - REAL_CONST(140422.51109048226/8.0), - REAL_CONST(140448.32227278448/8.0), - REAL_CONST(140474.13464101712/8.0), - REAL_CONST(140499.94819507122/8.0), - REAL_CONST(140525.76293483781/8.0), - REAL_CONST(140551.57886020801/8.0), - REAL_CONST(140577.3959710729/8.0), - REAL_CONST(140603.21426732364/8.0), - REAL_CONST(140629.03374885136/8.0), - REAL_CONST(140654.85441554731/8.0), - REAL_CONST(140680.67626730262/8.0), - REAL_CONST(140706.49930400858/8.0), - REAL_CONST(140732.32352555645/8.0), - REAL_CONST(140758.1489318375/8.0), - REAL_CONST(140783.97552274304/8.0), - REAL_CONST(140809.80329816442/8.0), - REAL_CONST(140835.63225799298/8.0), - REAL_CONST(140861.46240212015/8.0), - REAL_CONST(140887.29373043729/8.0), - REAL_CONST(140913.12624283586/8.0), - REAL_CONST(140938.95993920733/8.0), - REAL_CONST(140964.79481944317/8.0), - REAL_CONST(140990.63088343487/8.0), - REAL_CONST(141016.46813107401/8.0), - REAL_CONST(141042.30656225214/8.0), - REAL_CONST(141068.14617686081/8.0), - REAL_CONST(141093.98697479168/8.0), - REAL_CONST(141119.82895593636/8.0), - REAL_CONST(141145.6721201865/8.0), - REAL_CONST(141171.51646743377/8.0), - REAL_CONST(141197.36199756994/8.0), - REAL_CONST(141223.20871048668/8.0), - REAL_CONST(141249.05660607578/8.0), - REAL_CONST(141274.90568422904/8.0), - REAL_CONST(141300.75594483822/8.0), - REAL_CONST(141326.6073877952/8.0), - REAL_CONST(141352.4600129918/8.0), - REAL_CONST(141378.31382031992/8.0), - REAL_CONST(141404.16880967148/8.0), - REAL_CONST(141430.02498093838/8.0), - REAL_CONST(141455.8823340126/8.0), - REAL_CONST(141481.74086878612/8.0), - REAL_CONST(141507.60058515094/8.0), - REAL_CONST(141533.46148299909/8.0), - REAL_CONST(141559.32356222265/8.0), - REAL_CONST(141585.18682271364/8.0), - REAL_CONST(141611.05126436421/8.0), - REAL_CONST(141636.9168870665/8.0), - REAL_CONST(141662.78369071262/8.0), - REAL_CONST(141688.65167519479/8.0), - REAL_CONST(141714.5208404052/8.0), - REAL_CONST(141740.39118623605/8.0), - REAL_CONST(141766.26271257963/8.0), - REAL_CONST(141792.1354193282/8.0), - REAL_CONST(141818.00930637406/8.0), - REAL_CONST(141843.88437360956/8.0), - REAL_CONST(141869.760620927/8.0), - REAL_CONST(141895.6380482188/8.0), - REAL_CONST(141921.51665537735/8.0), - REAL_CONST(141947.39644229505/8.0), - REAL_CONST(141973.27740886438/8.0), - REAL_CONST(141999.15955497778/8.0), - REAL_CONST(142025.04288052776/8.0), - REAL_CONST(142050.92738540689/8.0), - REAL_CONST(142076.81306950765/8.0), - REAL_CONST(142102.69993272264/8.0), - REAL_CONST(142128.58797494444/8.0), - REAL_CONST(142154.47719606571/8.0), - REAL_CONST(142180.36759597904/8.0), - REAL_CONST(142206.25917457714/8.0), - REAL_CONST(142232.15193175265/8.0), - REAL_CONST(142258.04586739838/8.0), - REAL_CONST(142283.94098140698/8.0), - REAL_CONST(142309.83727367126/8.0), - REAL_CONST(142335.73474408401/8.0), - REAL_CONST(142361.63339253806/8.0), - REAL_CONST(142387.5332189262/8.0), - REAL_CONST(142413.43422314132/8.0), - REAL_CONST(142439.33640507635/8.0), - REAL_CONST(142465.23976462413/8.0), - REAL_CONST(142491.14430167765/8.0), - REAL_CONST(142517.05001612983/8.0), - REAL_CONST(142542.95690787368/8.0), - REAL_CONST(142568.86497680223/8.0), - REAL_CONST(142594.77422280848/8.0), - REAL_CONST(142620.68464578551/8.0), - REAL_CONST(142646.5962456264/8.0), - REAL_CONST(142672.50902222423/8.0), - REAL_CONST(142698.42297547215/8.0), - REAL_CONST(142724.33810526333/8.0), - REAL_CONST(142750.25441149093/8.0), - REAL_CONST(142776.17189404817/8.0), - REAL_CONST(142802.09055282827/8.0), - REAL_CONST(142828.01038772447/8.0), - REAL_CONST(142853.93139863008/8.0), - REAL_CONST(142879.85358543837/8.0), - REAL_CONST(142905.77694804268/8.0), - REAL_CONST(142931.70148633636/8.0), - REAL_CONST(142957.62720021277/8.0), - REAL_CONST(142983.55408956532/8.0), - REAL_CONST(143009.48215428743/8.0), - REAL_CONST(143035.41139427255/8.0), - REAL_CONST(143061.34180941415/8.0), - REAL_CONST(143087.27339960571/8.0), - REAL_CONST(143113.20616474075/8.0), - REAL_CONST(143139.14010471283/8.0), - REAL_CONST(143165.07521941551/8.0), - REAL_CONST(143191.01150874238/8.0), - REAL_CONST(143216.94897258704/8.0), - REAL_CONST(143242.88761084314/8.0), - REAL_CONST(143268.82742340435/8.0), - REAL_CONST(143294.76841016437/8.0), - REAL_CONST(143320.71057101688/8.0), - REAL_CONST(143346.65390585564/8.0), - REAL_CONST(143372.59841457437/8.0), - REAL_CONST(143398.54409706692/8.0), - REAL_CONST(143424.49095322701/8.0), - REAL_CONST(143450.43898294857/8.0), - REAL_CONST(143476.38818612538/8.0), - REAL_CONST(143502.33856265133/8.0), - REAL_CONST(143528.29011242036/8.0), - REAL_CONST(143554.24283532638/8.0), - REAL_CONST(143580.19673126334/8.0), - REAL_CONST(143606.1518001252/8.0), - REAL_CONST(143632.10804180597/8.0), - REAL_CONST(143658.06545619969/8.0), - REAL_CONST(143684.02404320039/8.0), - REAL_CONST(143709.98380270213/8.0), - REAL_CONST(143735.944734599/8.0), - REAL_CONST(143761.90683878519/8.0), - REAL_CONST(143787.87011515474/8.0), - REAL_CONST(143813.83456360188/8.0), - REAL_CONST(143839.8001840208/8.0), - REAL_CONST(143865.76697630569/8.0), - REAL_CONST(143891.73494035081/8.0), - REAL_CONST(143917.7040760504/8.0), - REAL_CONST(143943.67438329876/8.0), - REAL_CONST(143969.6458619902/8.0), - REAL_CONST(143995.61851201905/8.0), - REAL_CONST(144021.59233327967/8.0), - REAL_CONST(144047.56732566646/8.0), - REAL_CONST(144073.54348907378/8.0), - REAL_CONST(144099.52082339607/8.0), - REAL_CONST(144125.49932852783/8.0), - REAL_CONST(144151.4790043635/8.0), - REAL_CONST(144177.45985079758/8.0), - REAL_CONST(144203.44186772458/8.0), - REAL_CONST(144229.42505503909/8.0), - REAL_CONST(144255.40941263564/8.0), - REAL_CONST(144281.39494040885/8.0), - REAL_CONST(144307.38163825331/8.0), - REAL_CONST(144333.36950606373/8.0), - REAL_CONST(144359.35854373468/8.0), - REAL_CONST(144385.34875116093/8.0), - REAL_CONST(144411.34012823718/8.0), - REAL_CONST(144437.33267485813/8.0), - REAL_CONST(144463.32639091855/8.0), - REAL_CONST(144489.32127631325/8.0), - REAL_CONST(144515.31733093705/8.0), - REAL_CONST(144541.31455468474/8.0), - REAL_CONST(144567.3129474512/8.0), - REAL_CONST(144593.3125091313/8.0), - REAL_CONST(144619.31323961995/8.0), - REAL_CONST(144645.31513881206/8.0), - REAL_CONST(144671.31820660262/8.0), - REAL_CONST(144697.32244288657/8.0), - REAL_CONST(144723.32784755889/8.0), - REAL_CONST(144749.33442051467/8.0), - REAL_CONST(144775.34216164888/8.0), - REAL_CONST(144801.35107085665/8.0), - REAL_CONST(144827.36114803303/8.0), - REAL_CONST(144853.37239307314/8.0), - REAL_CONST(144879.38480587213/8.0), - REAL_CONST(144905.39838632516/8.0), - REAL_CONST(144931.41313432742/8.0), - REAL_CONST(144957.4290497741/8.0), - REAL_CONST(144983.44613256046/8.0), - REAL_CONST(145009.46438258173/8.0), - REAL_CONST(145035.48379973322/8.0), - REAL_CONST(145061.50438391021/8.0), - REAL_CONST(145087.52613500805/8.0), - REAL_CONST(145113.54905292206/8.0), - REAL_CONST(145139.57313754765/8.0), - REAL_CONST(145165.59838878017/8.0), - REAL_CONST(145191.62480651509/8.0), - REAL_CONST(145217.65239064783/8.0), - REAL_CONST(145243.68114107384/8.0), - REAL_CONST(145269.71105768863/8.0), - REAL_CONST(145295.74214038774/8.0), - REAL_CONST(145321.77438906668/8.0), - REAL_CONST(145347.80780362099/8.0), - REAL_CONST(145373.84238394629/8.0), - REAL_CONST(145399.87812993818/8.0), - REAL_CONST(145425.91504149229/8.0), - REAL_CONST(145451.95311850426/8.0), - REAL_CONST(145477.9923608698/8.0), - REAL_CONST(145504.03276848458/8.0), - REAL_CONST(145530.07434124436/8.0), - REAL_CONST(145556.11707904484/8.0), - REAL_CONST(145582.16098178181/8.0), - REAL_CONST(145608.20604935108/8.0), - REAL_CONST(145634.25228164849/8.0), - REAL_CONST(145660.29967856981/8.0), - REAL_CONST(145686.34824001096/8.0), - REAL_CONST(145712.39796586783/8.0), - REAL_CONST(145738.4488560363/8.0), - REAL_CONST(145764.50091041232/8.0), - REAL_CONST(145790.55412889185/8.0), - REAL_CONST(145816.60851137087/8.0), - REAL_CONST(145842.66405774537/8.0), - REAL_CONST(145868.72076791141/8.0), - REAL_CONST(145894.77864176501/8.0), - REAL_CONST(145920.83767920226/8.0), - REAL_CONST(145946.89788011924/8.0), - REAL_CONST(145972.95924441208/8.0), - REAL_CONST(145999.02177197693/8.0), - REAL_CONST(146025.08546270995/8.0), - REAL_CONST(146051.15031650732/8.0), - REAL_CONST(146077.21633326527/8.0), - REAL_CONST(146103.28351288004/8.0), - REAL_CONST(146129.35185524789/8.0), - REAL_CONST(146155.42136026506/8.0), - REAL_CONST(146181.49202782792/8.0), - REAL_CONST(146207.56385783272/8.0), - REAL_CONST(146233.63685017588/8.0), - REAL_CONST(146259.71100475377/8.0), - REAL_CONST(146285.78632146274/8.0), - REAL_CONST(146311.86280019928/8.0), - REAL_CONST(146337.94044085976/8.0), - REAL_CONST(146364.01924334071/8.0), - REAL_CONST(146390.09920753856/8.0), - REAL_CONST(146416.18033334985/8.0), - REAL_CONST(146442.26262067116/8.0), - REAL_CONST(146468.34606939898/8.0), - REAL_CONST(146494.43067942993/8.0), - REAL_CONST(146520.51645066062/8.0), - REAL_CONST(146546.60338298764/8.0), - REAL_CONST(146572.69147630769/8.0), - REAL_CONST(146598.78073051744/8.0), - REAL_CONST(146624.87114551352/8.0), - REAL_CONST(146650.96272119274/8.0), - REAL_CONST(146677.05545745179/8.0), - REAL_CONST(146703.14935418745/8.0), - REAL_CONST(146729.2444112965/8.0), - REAL_CONST(146755.34062867577/8.0), - REAL_CONST(146781.43800622207/8.0), - REAL_CONST(146807.53654383228/8.0), - REAL_CONST(146833.63624140329/8.0), - REAL_CONST(146859.73709883197/8.0), - REAL_CONST(146885.83911601527/8.0), - REAL_CONST(146911.94229285014/8.0), - REAL_CONST(146938.04662923355/8.0), - REAL_CONST(146964.15212506248/8.0), - REAL_CONST(146990.25878023397/8.0), - REAL_CONST(147016.36659464505/8.0), - REAL_CONST(147042.47556819281/8.0), - REAL_CONST(147068.58570077427/8.0), - REAL_CONST(147094.6969922866/8.0), - REAL_CONST(147120.80944262692/8.0), - REAL_CONST(147146.92305169237/8.0), - REAL_CONST(147173.03781938017/8.0), - REAL_CONST(147199.15374558745/8.0), - REAL_CONST(147225.27083021149/8.0), - REAL_CONST(147251.38907314953/8.0), - REAL_CONST(147277.50847429881/8.0), - REAL_CONST(147303.62903355664/8.0), - REAL_CONST(147329.75075082036/8.0), - REAL_CONST(147355.87362598727/8.0), - REAL_CONST(147381.99765895473/8.0), - REAL_CONST(147408.12284962015/8.0), - REAL_CONST(147434.24919788091/8.0), - REAL_CONST(147460.37670363448/8.0), - REAL_CONST(147486.50536677826/8.0), - REAL_CONST(147512.63518720976/8.0), - REAL_CONST(147538.76616482646/8.0), - REAL_CONST(147564.89829952587/8.0), - REAL_CONST(147591.03159120557/8.0), - REAL_CONST(147617.16603976308/8.0), - REAL_CONST(147643.30164509601/8.0), - REAL_CONST(147669.43840710199/8.0), - REAL_CONST(147695.57632567859/8.0), - REAL_CONST(147721.71540072354/8.0), - REAL_CONST(147747.85563213445/8.0), - REAL_CONST(147773.99701980909/8.0), - REAL_CONST(147800.13956364512/8.0), - REAL_CONST(147826.28326354033/8.0), - REAL_CONST(147852.42811939248/8.0), - REAL_CONST(147878.57413109933/8.0), - REAL_CONST(147904.72129855872/8.0), - REAL_CONST(147930.86962166851/8.0), - REAL_CONST(147957.01910032652/8.0), - REAL_CONST(147983.16973443062/8.0), - REAL_CONST(148009.32152387875/8.0), - REAL_CONST(148035.47446856883/8.0), - REAL_CONST(148061.62856839882/8.0), - REAL_CONST(148087.78382326665/8.0), - REAL_CONST(148113.94023307035/8.0), - REAL_CONST(148140.09779770792/8.0), - REAL_CONST(148166.25651707739/8.0), - REAL_CONST(148192.41639107687/8.0), - REAL_CONST(148218.57741960438/8.0), - REAL_CONST(148244.73960255808/8.0), - REAL_CONST(148270.90293983606/8.0), - REAL_CONST(148297.0674313365/8.0), - REAL_CONST(148323.23307695755/8.0), - REAL_CONST(148349.39987659742/8.0), - REAL_CONST(148375.56783015432/8.0), - REAL_CONST(148401.73693752653/8.0), - REAL_CONST(148427.90719861226/8.0), - REAL_CONST(148454.07861330983/8.0), - REAL_CONST(148480.25118151752/8.0), - REAL_CONST(148506.42490313368/8.0), - REAL_CONST(148532.59977805667/8.0), - REAL_CONST(148558.77580618486/8.0), - REAL_CONST(148584.95298741665/8.0), - REAL_CONST(148611.13132165043/8.0), - REAL_CONST(148637.31080878471/8.0), - REAL_CONST(148663.49144871789/8.0), - REAL_CONST(148689.6732413485/8.0), - REAL_CONST(148715.85618657502/8.0), - REAL_CONST(148742.040284296/8.0), - REAL_CONST(148768.22553440998/8.0), - REAL_CONST(148794.41193681557/8.0), - REAL_CONST(148820.59949141133/8.0), - REAL_CONST(148846.78819809589/8.0), - REAL_CONST(148872.97805676793/8.0), - REAL_CONST(148899.16906732606/8.0), - REAL_CONST(148925.36122966901/8.0), - REAL_CONST(148951.55454369547/8.0), - REAL_CONST(148977.74900930419/8.0), - REAL_CONST(149003.9446263939/8.0), - REAL_CONST(149030.1413948634/8.0), - REAL_CONST(149056.33931461151/8.0), - REAL_CONST(149082.53838553699/8.0), - REAL_CONST(149108.73860753875/8.0), - REAL_CONST(149134.9399805156/8.0), - REAL_CONST(149161.14250436646/8.0), - REAL_CONST(149187.34617899026/8.0), - REAL_CONST(149213.5510042859/8.0), - REAL_CONST(149239.75698015234/8.0), - REAL_CONST(149265.96410648854/8.0), - REAL_CONST(149292.17238319354/8.0), - REAL_CONST(149318.38181016635/8.0), - REAL_CONST(149344.59238730598/8.0), - REAL_CONST(149370.80411451156/8.0), - REAL_CONST(149397.01699168212/8.0), - REAL_CONST(149423.23101871679/8.0), - REAL_CONST(149449.44619551473/8.0), - REAL_CONST(149475.66252197503/8.0), - REAL_CONST(149501.87999799693/8.0), - REAL_CONST(149528.0986234796/8.0), - REAL_CONST(149554.31839832227/8.0), - REAL_CONST(149580.53932242419/8.0), - REAL_CONST(149606.76139568459/8.0), - REAL_CONST(149632.98461800278/8.0), - REAL_CONST(149659.20898927809/8.0), - REAL_CONST(149685.43450940982/8.0), - REAL_CONST(149711.66117829733/8.0), - REAL_CONST(149737.88899584001/8.0), - REAL_CONST(149764.11796193724/8.0), - REAL_CONST(149790.34807648844/8.0), - REAL_CONST(149816.57933939309/8.0), - REAL_CONST(149842.81175055061/8.0), - REAL_CONST(149869.04530986046/8.0), - REAL_CONST(149895.28001722222/8.0), - REAL_CONST(149921.51587253538/8.0), - REAL_CONST(149947.75287569952/8.0), - REAL_CONST(149973.99102661415/8.0), - REAL_CONST(150000.23032517891/8.0), - REAL_CONST(150026.47077129342/8.0), - REAL_CONST(150052.71236485732/8.0), - REAL_CONST(150078.95510577026/8.0), - REAL_CONST(150105.1989939319/8.0), - REAL_CONST(150131.444029242/8.0), - REAL_CONST(150157.69021160025/8.0), - REAL_CONST(150183.93754090639/8.0), - REAL_CONST(150210.18601706024/8.0), - REAL_CONST(150236.43563996154/8.0), - REAL_CONST(150262.68640951012/8.0), - REAL_CONST(150288.93832560582/8.0), - REAL_CONST(150315.19138814852/8.0), - REAL_CONST(150341.44559703805/8.0), - REAL_CONST(150367.70095217437/8.0), - REAL_CONST(150393.95745345735/8.0), - REAL_CONST(150420.21510078697/8.0), - REAL_CONST(150446.47389406321/8.0), - REAL_CONST(150472.73383318601/8.0), - REAL_CONST(150498.99491805542/8.0), - REAL_CONST(150525.25714857146/8.0), - REAL_CONST(150551.52052463419/8.0), - REAL_CONST(150577.78504614369/8.0), - REAL_CONST(150604.05071300003/8.0), - REAL_CONST(150630.31752510337/8.0), - REAL_CONST(150656.58548235384/8.0), - REAL_CONST(150682.85458465159/8.0), - REAL_CONST(150709.1248318968/8.0), - REAL_CONST(150735.39622398972/8.0), - REAL_CONST(150761.66876083051/8.0), - REAL_CONST(150787.9424423195/8.0), - REAL_CONST(150814.21726835691/8.0), - REAL_CONST(150840.49323884305/8.0), - REAL_CONST(150866.77035367821/8.0), - REAL_CONST(150893.04861276277/8.0), - REAL_CONST(150919.32801599705/8.0), - REAL_CONST(150945.60856328148/8.0), - REAL_CONST(150971.89025451642/8.0), - REAL_CONST(150998.17308960229/8.0), - REAL_CONST(151024.45706843957/8.0), - REAL_CONST(151050.74219092872/8.0), - REAL_CONST(151077.02845697021/8.0), - REAL_CONST(151103.31586646455/8.0), - REAL_CONST(151129.60441931229/8.0), - REAL_CONST(151155.894115414/8.0), - REAL_CONST(151182.1849546702/8.0), - REAL_CONST(151208.47693698155/8.0), - REAL_CONST(151234.77006224863/8.0), - REAL_CONST(151261.06433037209/8.0), - REAL_CONST(151287.35974125259/8.0), - REAL_CONST(151313.65629479082/8.0), - REAL_CONST(151339.95399088747/8.0), - REAL_CONST(151366.25282944329/8.0), - REAL_CONST(151392.55281035902/8.0), - REAL_CONST(151418.85393353543/8.0), - REAL_CONST(151445.1561988733/8.0), - REAL_CONST(151471.45960627345/8.0), - REAL_CONST(151497.76415563675/8.0), - REAL_CONST(151524.06984686397/8.0), - REAL_CONST(151550.37667985607/8.0), - REAL_CONST(151576.68465451393/8.0), - REAL_CONST(151602.99377073845/8.0), - REAL_CONST(151629.30402843058/8.0), - REAL_CONST(151655.61542749128/8.0), - REAL_CONST(151681.92796782157/8.0), - REAL_CONST(151708.24164932242/8.0), - REAL_CONST(151734.55647189484/8.0), - REAL_CONST(151760.87243543993/8.0), - REAL_CONST(151787.18953985872/8.0), - REAL_CONST(151813.50778505235/8.0), - REAL_CONST(151839.82717092187/8.0), - REAL_CONST(151866.14769736846/8.0), - REAL_CONST(151892.46936429327/8.0), - REAL_CONST(151918.79217159748/8.0), - REAL_CONST(151945.11611918229/8.0), - REAL_CONST(151971.44120694889/8.0), - REAL_CONST(151997.76743479856/8.0), - REAL_CONST(152024.09480263255/8.0), - REAL_CONST(152050.42331035214/8.0), - REAL_CONST(152076.75295785864/8.0), - REAL_CONST(152103.08374505339/8.0), - REAL_CONST(152129.41567183775/8.0), - REAL_CONST(152155.74873811303/8.0), - REAL_CONST(152182.08294378067/8.0), - REAL_CONST(152208.41828874208/8.0), - REAL_CONST(152234.75477289871/8.0), - REAL_CONST(152261.09239615197/8.0), - REAL_CONST(152287.43115840337/8.0), - REAL_CONST(152313.77105955439/8.0), - REAL_CONST(152340.11209950657/8.0), - REAL_CONST(152366.45427816146/8.0), - REAL_CONST(152392.79759542056/8.0), - REAL_CONST(152419.14205118554/8.0), - REAL_CONST(152445.48764535793/8.0), - REAL_CONST(152471.8343778394/8.0), - REAL_CONST(152498.18224853161/8.0), - REAL_CONST(152524.53125733617/8.0), - REAL_CONST(152550.88140415482/8.0), - REAL_CONST(152577.23268888926/8.0), - REAL_CONST(152603.58511144121/8.0), - REAL_CONST(152629.93867171241/8.0), - REAL_CONST(152656.29336960468/8.0), - REAL_CONST(152682.64920501978/8.0), - REAL_CONST(152709.00617785956/8.0), - REAL_CONST(152735.36428802583/8.0), - REAL_CONST(152761.72353542043/8.0), - REAL_CONST(152788.08391994529/8.0), - REAL_CONST(152814.44544150229/8.0), - REAL_CONST(152840.80809999333/8.0), - REAL_CONST(152867.17189532038/8.0), - REAL_CONST(152893.53682738543/8.0), - REAL_CONST(152919.90289609041/8.0), - REAL_CONST(152946.27010133737/8.0), - REAL_CONST(152972.63844302832/8.0), - REAL_CONST(152999.00792106529/8.0), - REAL_CONST(153025.37853535041/8.0), - REAL_CONST(153051.7502857857/8.0), - REAL_CONST(153078.12317227334/8.0), - REAL_CONST(153104.4971947154/8.0), - REAL_CONST(153130.8723530141/8.0), - REAL_CONST(153157.24864707157/8.0), - REAL_CONST(153183.62607679001/8.0), - REAL_CONST(153210.00464207167/8.0), - REAL_CONST(153236.38434281875/8.0), - REAL_CONST(153262.76517893354/8.0), - REAL_CONST(153289.14715031831/8.0), - REAL_CONST(153315.53025687535/8.0), - REAL_CONST(153341.91449850702/8.0), - REAL_CONST(153368.2998751156/8.0), - REAL_CONST(153394.68638660354/8.0), - REAL_CONST(153421.07403287315/8.0), - REAL_CONST(153447.46281382689/8.0), - REAL_CONST(153473.85272936718/8.0), - REAL_CONST(153500.24377939643/8.0), - REAL_CONST(153526.63596381716/8.0), - REAL_CONST(153553.02928253182/8.0), - REAL_CONST(153579.42373544298/8.0), - REAL_CONST(153605.81932245308/8.0), - REAL_CONST(153632.21604346478/8.0), - REAL_CONST(153658.61389838057/8.0), - REAL_CONST(153685.0128871031/8.0), - REAL_CONST(153711.41300953497/8.0), - REAL_CONST(153737.81426557881/8.0), - REAL_CONST(153764.21665513728/8.0), - REAL_CONST(153790.62017811305/8.0), - REAL_CONST(153817.02483440886/8.0), - REAL_CONST(153843.43062392739/8.0), - REAL_CONST(153869.83754657139/8.0), - REAL_CONST(153896.24560224367/8.0), - REAL_CONST(153922.65479084692/8.0), - REAL_CONST(153949.06511228404/8.0), - REAL_CONST(153975.4765664578/8.0), - REAL_CONST(154001.88915327107/8.0), - REAL_CONST(154028.30287262669/8.0), - REAL_CONST(154054.71772442761/8.0), - REAL_CONST(154081.13370857667/8.0), - REAL_CONST(154107.55082497682/8.0), - REAL_CONST(154133.96907353101/8.0), - REAL_CONST(154160.38845414223/8.0), - REAL_CONST(154186.80896671346/8.0), - REAL_CONST(154213.23061114774/8.0), - REAL_CONST(154239.65338734805/8.0), - REAL_CONST(154266.07729521746/8.0), - REAL_CONST(154292.50233465908/8.0), - REAL_CONST(154318.92850557598/8.0), - REAL_CONST(154345.35580787127/8.0), - REAL_CONST(154371.7842414481/8.0), - REAL_CONST(154398.21380620965/8.0), - REAL_CONST(154424.64450205903/8.0), - REAL_CONST(154451.07632889951/8.0), - REAL_CONST(154477.50928663427/8.0), - REAL_CONST(154503.94337516659/8.0), - REAL_CONST(154530.37859439969/8.0), - REAL_CONST(154556.81494423689/8.0), - REAL_CONST(154583.25242458144/8.0), - REAL_CONST(154609.69103533673/8.0), - REAL_CONST(154636.13077640603/8.0), - REAL_CONST(154662.57164769279/8.0), - REAL_CONST(154689.01364910032/8.0), - REAL_CONST(154715.45678053208/8.0), - REAL_CONST(154741.90104189145/8.0), - REAL_CONST(154768.34643308193/8.0), - REAL_CONST(154794.79295400696/8.0), - REAL_CONST(154821.24060457002/8.0), - REAL_CONST(154847.68938467462/8.0), - REAL_CONST(154874.13929422433/8.0), - REAL_CONST(154900.59033312264/8.0), - REAL_CONST(154927.04250127316/8.0), - REAL_CONST(154953.49579857948/8.0), - REAL_CONST(154979.95022494521/8.0), - REAL_CONST(155006.40578027396/8.0), - REAL_CONST(155032.86246446942/8.0), - REAL_CONST(155059.32027743524/8.0), - REAL_CONST(155085.77921907514/8.0), - REAL_CONST(155112.2392892928/8.0), - REAL_CONST(155138.70048799197/8.0), - REAL_CONST(155165.16281507642/8.0), - REAL_CONST(155191.62627044989/8.0), - REAL_CONST(155218.09085401625/8.0), - REAL_CONST(155244.55656567923/8.0), - REAL_CONST(155271.02340534274/8.0), - REAL_CONST(155297.49137291059/8.0), - REAL_CONST(155323.96046828668/8.0), - REAL_CONST(155350.4306913749/8.0), - REAL_CONST(155376.90204207919/8.0), - REAL_CONST(155403.37452030348/8.0), - REAL_CONST(155429.84812595171/8.0), - REAL_CONST(155456.32285892789/8.0), - REAL_CONST(155482.79871913602/8.0), - REAL_CONST(155509.27570648011/8.0), - REAL_CONST(155535.75382086422/8.0), - REAL_CONST(155562.23306219239/8.0), - REAL_CONST(155588.71343036872/8.0), - REAL_CONST(155615.19492529731/8.0), - REAL_CONST(155641.67754688227/8.0), - REAL_CONST(155668.16129502779/8.0), - REAL_CONST(155694.64616963797/8.0), - REAL_CONST(155721.13217061706/8.0), - REAL_CONST(155747.61929786921/8.0), - REAL_CONST(155774.10755129869/8.0), - REAL_CONST(155800.59693080973/8.0), - REAL_CONST(155827.08743630661/8.0), - REAL_CONST(155853.57906769359/8.0), - REAL_CONST(155880.07182487496/8.0), - REAL_CONST(155906.56570775513/8.0), - REAL_CONST(155933.06071623837/8.0), - REAL_CONST(155959.55685022907/8.0), - REAL_CONST(155986.05410963166/8.0), - REAL_CONST(156012.5524943505/8.0), - REAL_CONST(156039.05200429002/8.0), - REAL_CONST(156065.55263935472/8.0), - REAL_CONST(156092.054399449/8.0), - REAL_CONST(156118.5572844774/8.0), - REAL_CONST(156145.06129434443/8.0), - REAL_CONST(156171.5664289546/8.0), - REAL_CONST(156198.07268821247/8.0), - REAL_CONST(156224.5800720226/8.0), - REAL_CONST(156251.08858028959/8.0), - REAL_CONST(156277.59821291809/8.0), - REAL_CONST(156304.10896981266/8.0), - REAL_CONST(156330.62085087801/8.0), - REAL_CONST(156357.1338560188/8.0), - REAL_CONST(156383.64798513969/8.0), - REAL_CONST(156410.16323814544/8.0), - REAL_CONST(156436.67961494075/8.0), - REAL_CONST(156463.1971154304/8.0), - REAL_CONST(156489.71573951913/8.0), - REAL_CONST(156516.23548711176/8.0), - REAL_CONST(156542.75635811311/8.0), - REAL_CONST(156569.27835242799/8.0), - REAL_CONST(156595.80146996127/8.0), - REAL_CONST(156622.32571061782/8.0), - REAL_CONST(156648.85107430254/8.0), - REAL_CONST(156675.37756092031/8.0), - REAL_CONST(156701.90517037612/8.0), - REAL_CONST(156728.43390257491/8.0), - REAL_CONST(156754.96375742162/8.0), - REAL_CONST(156781.49473482129/8.0), - REAL_CONST(156808.02683467892/8.0), - REAL_CONST(156834.5600568995/8.0), - REAL_CONST(156861.09440138817/8.0), - REAL_CONST(156887.62986804993/8.0), - REAL_CONST(156914.16645678994/8.0), - REAL_CONST(156940.70416751326/8.0), - REAL_CONST(156967.24300012505/8.0), - REAL_CONST(156993.78295453047/8.0), - REAL_CONST(157020.32403063469/8.0), - REAL_CONST(157046.8662283429/8.0), - REAL_CONST(157073.40954756032/8.0), - REAL_CONST(157099.9539881922/8.0), - REAL_CONST(157126.49955014378/8.0), - REAL_CONST(157153.04623332032/8.0), - REAL_CONST(157179.59403762716/8.0), - REAL_CONST(157206.14296296958/8.0), - REAL_CONST(157232.69300925292/8.0), - REAL_CONST(157259.24417638258/8.0), - REAL_CONST(157285.79646426387/8.0), - REAL_CONST(157312.34987280221/8.0), - REAL_CONST(157338.90440190304/8.0), - REAL_CONST(157365.46005147175/8.0), - REAL_CONST(157392.01682141385/8.0), - REAL_CONST(157418.57471163478/8.0), - REAL_CONST(157445.13372204005/8.0), - REAL_CONST(157471.69385253513/8.0), - REAL_CONST(157498.25510302564/8.0), - REAL_CONST(157524.81747341706/8.0), - REAL_CONST(157551.38096361503/8.0), - REAL_CONST(157577.9455735251/8.0), - REAL_CONST(157604.51130305286/8.0), - REAL_CONST(157631.07815210402/8.0), - REAL_CONST(157657.64612058419/8.0), - REAL_CONST(157684.21520839902/8.0), - REAL_CONST(157710.78541545427/8.0), - REAL_CONST(157737.35674165559/8.0), - REAL_CONST(157763.92918690876/8.0), - REAL_CONST(157790.50275111952/8.0), - REAL_CONST(157817.07743419363/8.0), - REAL_CONST(157843.65323603692/8.0), - REAL_CONST(157870.23015655516/8.0), - REAL_CONST(157896.80819565422/8.0), - REAL_CONST(157923.3873532399/8.0), - REAL_CONST(157949.96762921812/8.0), - REAL_CONST(157976.54902349479/8.0), - REAL_CONST(158003.13153597576/8.0), - REAL_CONST(158029.71516656701/8.0), - REAL_CONST(158056.29991517449/8.0), - REAL_CONST(158082.88578170416/8.0), - REAL_CONST(158109.47276606198/8.0), - REAL_CONST(158136.06086815402/8.0), - REAL_CONST(158162.65008788629/8.0), - REAL_CONST(158189.24042516484/8.0), - REAL_CONST(158215.83187989573/8.0), - REAL_CONST(158242.42445198505/8.0), - REAL_CONST(158269.01814133892/8.0), - REAL_CONST(158295.61294786347/8.0), - REAL_CONST(158322.20887146486/8.0), - REAL_CONST(158348.80591204923/8.0), - REAL_CONST(158375.4040695228/8.0), - REAL_CONST(158402.00334379176/8.0), - REAL_CONST(158428.60373476235/8.0), - REAL_CONST(158455.2052423408/8.0), - REAL_CONST(158481.80786643337/8.0), - REAL_CONST(158508.41160694641/8.0), - REAL_CONST(158535.01646378616/8.0), - REAL_CONST(158561.62243685898/8.0), - REAL_CONST(158588.2295260712/8.0), - REAL_CONST(158614.8377313292/8.0), - REAL_CONST(158641.44705253936/8.0), - REAL_CONST(158668.05748960807/8.0), - REAL_CONST(158694.66904244179/8.0), - REAL_CONST(158721.28171094693/8.0), - REAL_CONST(158747.89549502998/8.0), - REAL_CONST(158774.5103945974/8.0), - REAL_CONST(158801.12640955573/8.0), - REAL_CONST(158827.74353981143/8.0), - REAL_CONST(158854.36178527112/8.0), - REAL_CONST(158880.9811458413/8.0), - REAL_CONST(158907.60162142856/8.0), - REAL_CONST(158934.22321193956/8.0), - REAL_CONST(158960.84591728085/8.0), - REAL_CONST(158987.46973735912/8.0), - REAL_CONST(159014.09467208097/8.0), - REAL_CONST(159040.72072135314/8.0), - REAL_CONST(159067.3478850823/8.0), - REAL_CONST(159093.97616317519/8.0), - REAL_CONST(159120.60555553852/8.0), - REAL_CONST(159147.23606207906/8.0), - REAL_CONST(159173.8676827036/8.0), - REAL_CONST(159200.50041731889/8.0), - REAL_CONST(159227.13426583182/8.0), - REAL_CONST(159253.76922814918/8.0), - REAL_CONST(159280.40530417781/8.0), - REAL_CONST(159307.04249382461/8.0), - REAL_CONST(159333.68079699649/8.0), - REAL_CONST(159360.32021360032/8.0), - REAL_CONST(159386.96074354305/8.0), - REAL_CONST(159413.60238673165/8.0), - REAL_CONST(159440.24514307309/8.0), - REAL_CONST(159466.88901247433/8.0), - REAL_CONST(159493.53399484244/8.0), - REAL_CONST(159520.18009008438/8.0), - REAL_CONST(159546.82729810724/8.0), - REAL_CONST(159573.47561881805/8.0), - REAL_CONST(159600.12505212394/8.0), - REAL_CONST(159626.77559793202/8.0), - REAL_CONST(159653.42725614941/8.0), - REAL_CONST(159680.08002668325/8.0), - REAL_CONST(159706.73390944069/8.0), - REAL_CONST(159733.38890432892/8.0), - REAL_CONST(159760.04501125516/8.0), - REAL_CONST(159786.70223012666/8.0), - REAL_CONST(159813.36056085059/8.0), - REAL_CONST(159840.02000333427/8.0), - REAL_CONST(159866.68055748497/8.0), - REAL_CONST(159893.34222320997/8.0), - REAL_CONST(159920.00500041663/8.0), - REAL_CONST(159946.66888901225/8.0), - REAL_CONST(159973.33388890422/8.0), - REAL_CONST(159999.99999999988/8.0), - REAL_CONST(160026.66722220668/8.0), - REAL_CONST(160053.33555543202/8.0), - REAL_CONST(160080.0049995833/8.0), - REAL_CONST(160106.67555456801/8.0), - REAL_CONST(160133.3472202936/8.0), - REAL_CONST(160160.0199966676/8.0), - REAL_CONST(160186.6938835975/8.0), - REAL_CONST(160213.36888099083/8.0), - REAL_CONST(160240.04498875517/8.0), - REAL_CONST(160266.72220679806/8.0), - REAL_CONST(160293.40053502709/8.0), - REAL_CONST(160320.07997334987/8.0), - REAL_CONST(160346.76052167406/8.0), - REAL_CONST(160373.44217990729/8.0), - REAL_CONST(160400.1249479572/8.0), - REAL_CONST(160426.80882573154/8.0), - REAL_CONST(160453.49381313793/8.0), - REAL_CONST(160480.17991008417/8.0), - REAL_CONST(160506.86711647795/8.0), - REAL_CONST(160533.55543222709/8.0), - REAL_CONST(160560.24485723933/8.0), - REAL_CONST(160586.93539142248/8.0), - REAL_CONST(160613.62703468435/8.0), - REAL_CONST(160640.31978693281/8.0), - REAL_CONST(160667.01364807569/8.0), - REAL_CONST(160693.70861802087/8.0), - REAL_CONST(160720.40469667627/8.0), - REAL_CONST(160747.1018839498/8.0), - REAL_CONST(160773.80017974938/8.0), - REAL_CONST(160800.49958398298/8.0), - REAL_CONST(160827.20009655855/8.0), - REAL_CONST(160853.90171738411/8.0), - REAL_CONST(160880.60444636765/8.0), - REAL_CONST(160907.30828341722/8.0), - REAL_CONST(160934.01322844089/8.0), - REAL_CONST(160960.71928134665/8.0), - REAL_CONST(160987.42644204266/8.0), - REAL_CONST(161014.13471043704/8.0), - REAL_CONST(161040.84408643784/8.0), - REAL_CONST(161067.55456995327/8.0), - REAL_CONST(161094.26616089148/8.0), - REAL_CONST(161120.97885916062/8.0), - REAL_CONST(161147.69266466892/8.0), - REAL_CONST(161174.40757732463/8.0), - REAL_CONST(161201.12359703594/8.0), - REAL_CONST(161227.84072371112/8.0), - REAL_CONST(161254.55895725847/8.0), - REAL_CONST(161281.27829758628/8.0), - REAL_CONST(161307.99874460287/8.0), - REAL_CONST(161334.72029821656/8.0), - REAL_CONST(161361.44295833571/8.0), - REAL_CONST(161388.1667248687/8.0), - REAL_CONST(161414.89159772391/8.0), - REAL_CONST(161441.61757680977/8.0), - REAL_CONST(161468.34466203468/8.0), - REAL_CONST(161495.07285330712/8.0), - REAL_CONST(161521.80215053557/8.0), - REAL_CONST(161548.53255362847/8.0), - REAL_CONST(161575.26406249436/8.0), - REAL_CONST(161601.99667704175/8.0), - REAL_CONST(161628.7303971792/8.0), - REAL_CONST(161655.46522281526/8.0), - REAL_CONST(161682.20115385848/8.0), - REAL_CONST(161708.93819021754/8.0), - REAL_CONST(161735.67633180099/8.0), - REAL_CONST(161762.41557851751/8.0), - REAL_CONST(161789.15593027571/8.0), - REAL_CONST(161815.89738698432/8.0), - REAL_CONST(161842.63994855201/8.0), - REAL_CONST(161869.38361488748/8.0), - REAL_CONST(161896.1283858995/8.0), - REAL_CONST(161922.87426149679/8.0), - REAL_CONST(161949.62124158812/8.0), - REAL_CONST(161976.36932608229/8.0), - REAL_CONST(162003.1185148881/8.0), - REAL_CONST(162029.8688079144/8.0), - REAL_CONST(162056.62020507001/8.0), - REAL_CONST(162083.37270626382/8.0), - REAL_CONST(162110.12631140469/8.0), - REAL_CONST(162136.88102040152/8.0), - REAL_CONST(162163.63683316324/8.0), - REAL_CONST(162190.39374959879/8.0), - REAL_CONST(162217.15176961714/8.0), - REAL_CONST(162243.91089312723/8.0), - REAL_CONST(162270.67112003808/8.0), - REAL_CONST(162297.43245025873/8.0), - REAL_CONST(162324.19488369819/8.0), - REAL_CONST(162350.9584202655/8.0), - REAL_CONST(162377.72305986975/8.0), - REAL_CONST(162404.48880242003/8.0), - REAL_CONST(162431.25564782543/8.0), - REAL_CONST(162458.02359599507/8.0), - REAL_CONST(162484.79264683815/8.0), - REAL_CONST(162511.56280026378/8.0), - REAL_CONST(162538.33405618116/8.0), - REAL_CONST(162565.10641449949/8.0), - REAL_CONST(162591.87987512801/8.0), - REAL_CONST(162618.65443797593/8.0), - REAL_CONST(162645.43010295252/8.0), - REAL_CONST(162672.20686996708/8.0), - REAL_CONST(162698.98473892888/8.0), - REAL_CONST(162725.76370974723/8.0), - REAL_CONST(162752.54378233149/8.0), - REAL_CONST(162779.32495659095/8.0), - REAL_CONST(162806.10723243505/8.0), - REAL_CONST(162832.89060977317/8.0), - REAL_CONST(162859.67508851466/8.0), - REAL_CONST(162886.46066856899/8.0), - REAL_CONST(162913.24734984562/8.0), - REAL_CONST(162940.03513225398/8.0), - REAL_CONST(162966.82401570358/8.0), - REAL_CONST(162993.6140001039/8.0), - REAL_CONST(163020.40508536444/8.0), - REAL_CONST(163047.19727139481/8.0), - REAL_CONST(163073.99055810447/8.0), - REAL_CONST(163100.78494540305/8.0), - REAL_CONST(163127.58043320014/8.0), - REAL_CONST(163154.37702140535/8.0), - REAL_CONST(163181.17470992831/8.0), - REAL_CONST(163207.97349867865/8.0), - REAL_CONST(163234.77338756606/8.0), - REAL_CONST(163261.57437650024/8.0), - REAL_CONST(163288.37646539087/8.0), - REAL_CONST(163315.17965414765/8.0), - REAL_CONST(163341.98394268038/8.0), - REAL_CONST(163368.78933089875/8.0), - REAL_CONST(163395.59581871261/8.0), - REAL_CONST(163422.40340603172/8.0), - REAL_CONST(163449.2120927659/8.0), - REAL_CONST(163476.02187882498/8.0), - REAL_CONST(163502.83276411882/8.0), - REAL_CONST(163529.6447485573/8.0), - REAL_CONST(163556.45783205028/8.0), - REAL_CONST(163583.2720145077/8.0), - REAL_CONST(163610.08729583945/8.0), - REAL_CONST(163636.90367595552/8.0), - REAL_CONST(163663.72115476584/8.0), - REAL_CONST(163690.53973218042/8.0), - REAL_CONST(163717.35940810922/8.0), - REAL_CONST(163744.18018246227/8.0), - REAL_CONST(163771.00205514964/8.0), - REAL_CONST(163797.82502608138/8.0), - REAL_CONST(163824.64909516752/8.0), - REAL_CONST(163851.4742623182/8.0), - REAL_CONST(163878.3005274435/8.0), - REAL_CONST(163905.12789045356/8.0), - REAL_CONST(163931.95635125853/8.0), - REAL_CONST(163958.78590976857/8.0), - REAL_CONST(163985.61656589387/8.0), - REAL_CONST(164012.44831954464/8.0), - REAL_CONST(164039.28117063109/8.0), - REAL_CONST(164066.11511906344/8.0), - REAL_CONST(164092.95016475199/8.0), - REAL_CONST(164119.78630760699/8.0), - REAL_CONST(164146.62354753874/8.0), - REAL_CONST(164173.46188445756/8.0), - REAL_CONST(164200.30131827376/8.0), - REAL_CONST(164227.14184889771/8.0), - REAL_CONST(164253.98347623978/8.0), - REAL_CONST(164280.82620021031/8.0), - REAL_CONST(164307.67002071979/8.0), - REAL_CONST(164334.51493767856/8.0), - REAL_CONST(164361.3609509971/8.0), - REAL_CONST(164388.20806058586/8.0), - REAL_CONST(164415.05626635533/8.0), - REAL_CONST(164441.905568216/8.0), - REAL_CONST(164468.75596607837/8.0), - REAL_CONST(164495.607459853/8.0), - REAL_CONST(164522.4600494504/8.0), - REAL_CONST(164549.31373478117/8.0), - REAL_CONST(164576.16851575591/8.0), - REAL_CONST(164603.02439228518/8.0), - REAL_CONST(164629.88136427966/8.0), - REAL_CONST(164656.73943164994/8.0), - REAL_CONST(164683.59859430668/8.0), - REAL_CONST(164710.45885216061/8.0), - REAL_CONST(164737.32020512238/8.0), - REAL_CONST(164764.1826531027/8.0), - REAL_CONST(164791.04619601235/8.0), - REAL_CONST(164817.91083376206/8.0), - REAL_CONST(164844.77656626256/8.0), - REAL_CONST(164871.64339342469/8.0), - REAL_CONST(164898.51131515924/8.0), - REAL_CONST(164925.38033137703/8.0), - REAL_CONST(164952.25044198887/8.0), - REAL_CONST(164979.1216469057/8.0), - REAL_CONST(165005.9939460383/8.0), - REAL_CONST(165032.86733929763/8.0), - REAL_CONST(165059.7418265946/8.0), - REAL_CONST(165086.61740784015/8.0), - REAL_CONST(165113.4940829452/8.0) -#endif -}; - -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/is.c b/mplayer/libfaad2/is.c deleted file mode 100644 index 58cf88e0..00000000 --- a/mplayer/libfaad2/is.c +++ /dev/null @@ -1,106 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: is.c,v 1.24 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#include "syntax.h" -#include "is.h" - -#ifdef FIXED_POINT -static real_t pow05_table[] = { - COEF_CONST(1.68179283050743), /* 0.5^(-3/4) */ - COEF_CONST(1.41421356237310), /* 0.5^(-2/4) */ - COEF_CONST(1.18920711500272), /* 0.5^(-1/4) */ - COEF_CONST(1.0), /* 0.5^( 0/4) */ - COEF_CONST(0.84089641525371), /* 0.5^(+1/4) */ - COEF_CONST(0.70710678118655), /* 0.5^(+2/4) */ - COEF_CONST(0.59460355750136) /* 0.5^(+3/4) */ -}; -#endif - -void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, - uint16_t frame_len) -{ - uint8_t g, sfb, b; - uint16_t i; -#ifndef FIXED_POINT - real_t scale; -#else - int32_t exp, frac; -#endif - - uint16_t nshort = frame_len/8; - uint8_t group = 0; - - for (g = 0; g < icsr->num_window_groups; g++) - { - /* Do intensity stereo decoding */ - for (b = 0; b < icsr->window_group_length[g]; b++) - { - for (sfb = 0; sfb < icsr->max_sfb; sfb++) - { - if (is_intensity(icsr, g, sfb)) - { -#ifdef MAIN_DEC - /* For scalefactor bands coded in intensity stereo the - corresponding predictors in the right channel are - switched to "off". - */ - ics->pred.prediction_used[sfb] = 0; - icsr->pred.prediction_used[sfb] = 0; -#endif - -#ifndef FIXED_POINT - scale = (real_t)pow(0.5, (0.25*icsr->scale_factors[g][sfb])); -#else - exp = icsr->scale_factors[g][sfb] >> 2; - frac = icsr->scale_factors[g][sfb] & 3; -#endif - - /* Scale from left to right channel, - do not touch left channel */ - for (i = icsr->swb_offset[sfb]; i < icsr->swb_offset[sfb+1]; i++) - { -#ifndef FIXED_POINT - r_spec[(group*nshort)+i] = MUL_R(l_spec[(group*nshort)+i], scale); -#else - if (exp < 0) - r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] << -exp; - else - r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] >> exp; - r_spec[(group*nshort)+i] = MUL_C(r_spec[(group*nshort)+i], pow05_table[frac + 3]); -#endif - if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb)) - r_spec[(group*nshort)+i] = -r_spec[(group*nshort)+i]; - } - } - } - group++; - } - } -} diff --git a/mplayer/libfaad2/is.h b/mplayer/libfaad2/is.h deleted file mode 100644 index 4a0198ef..00000000 --- a/mplayer/libfaad2/is.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: is.h,v 1.16 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __IS_H__ -#define __IS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "syntax.h" - -void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, - uint16_t frame_len); - -static INLINE int8_t is_intensity(ic_stream *ics, uint8_t group, uint8_t sfb) -{ - switch (ics->sfb_cb[group][sfb]) - { - case INTENSITY_HCB: - return 1; - case INTENSITY_HCB2: - return -1; - default: - return 0; - } -} - -static INLINE int8_t invert_intensity(ic_stream *ics, uint8_t group, uint8_t sfb) -{ - if (ics->ms_mask_present == 1) - return (1-2*ics->ms_used[group][sfb]); - return 1; -} - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/kbd_win.h b/mplayer/libfaad2/kbd_win.h deleted file mode 100644 index 8d23c8b6..00000000 --- a/mplayer/libfaad2/kbd_win.h +++ /dev/null @@ -1,2294 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: kbd_win.h,v 1.17 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __KBD_WIN_H__ -#define __KBD_WIN_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _MSC_VER -#pragma warning(disable:4305) -#pragma warning(disable:4244) -#endif - -ALIGN static const real_t kbd_long_1024[] = -{ - FRAC_CONST(0.00029256153896361), - FRAC_CONST(0.00042998567353047), - FRAC_CONST(0.00054674074589540), - FRAC_CONST(0.00065482304299792), - FRAC_CONST(0.00075870195068747), - FRAC_CONST(0.00086059331713336), - FRAC_CONST(0.00096177541439010), - FRAC_CONST(0.0010630609410878), - FRAC_CONST(0.0011650036308132), - FRAC_CONST(0.0012680012194148), - FRAC_CONST(0.0013723517232956), - FRAC_CONST(0.0014782864109136), - FRAC_CONST(0.0015859901976719), - FRAC_CONST(0.0016956148252373), - FRAC_CONST(0.0018072876903517), - FRAC_CONST(0.0019211179405514), - FRAC_CONST(0.0020372007924215), - FRAC_CONST(0.0021556206591754), - FRAC_CONST(0.0022764534599614), - FRAC_CONST(0.0023997683540995), - FRAC_CONST(0.0025256290631156), - FRAC_CONST(0.0026540948920831), - FRAC_CONST(0.0027852215281403), - FRAC_CONST(0.0029190616715331), - FRAC_CONST(0.0030556655443223), - FRAC_CONST(0.0031950812943391), - FRAC_CONST(0.0033373553240392), - FRAC_CONST(0.0034825325586930), - FRAC_CONST(0.0036306566699199), - FRAC_CONST(0.0037817702604646), - FRAC_CONST(0.0039359150179719), - FRAC_CONST(0.0040931318437260), - FRAC_CONST(0.0042534609610026), - FRAC_CONST(0.0044169420066964), - FRAC_CONST(0.0045836141091341), - FRAC_CONST(0.0047535159544086), - FRAC_CONST(0.0049266858431214), - FRAC_CONST(0.0051031617390698), - FRAC_CONST(0.0052829813111335), - FRAC_CONST(0.0054661819693975), - FRAC_CONST(0.0056528008963682), - FRAC_CONST(0.0058428750739943), - FRAC_CONST(0.0060364413070882), - FRAC_CONST(0.0062335362436492), - FRAC_CONST(0.0064341963925079), - FRAC_CONST(0.0066384581386503), - FRAC_CONST(0.0068463577565218), - FRAC_CONST(0.0070579314215715), - FRAC_CONST(0.0072732152202559), - FRAC_CONST(0.0074922451586909), - FRAC_CONST(0.0077150571701162), - FRAC_CONST(0.0079416871213115), - FRAC_CONST(0.0081721708180857), - FRAC_CONST(0.0084065440099458), - FRAC_CONST(0.0086448423940363), - FRAC_CONST(0.0088871016184291), - FRAC_CONST(0.0091333572848345), - FRAC_CONST(0.0093836449507939), - FRAC_CONST(0.0096380001314086), - FRAC_CONST(0.0098964583006517), - FRAC_CONST(0.010159054892306), - FRAC_CONST(0.010425825300561), - FRAC_CONST(0.010696804880310), - FRAC_CONST(0.010972028947167), - FRAC_CONST(0.011251532777236), - FRAC_CONST(0.011535351606646), - FRAC_CONST(0.011823520630897), - FRAC_CONST(0.012116075003993), - FRAC_CONST(0.012413049837429), - FRAC_CONST(0.012714480198999), - FRAC_CONST(0.013020401111478), - FRAC_CONST(0.013330847551161), - FRAC_CONST(0.013645854446288), - FRAC_CONST(0.013965456675352), - FRAC_CONST(0.014289689065314), - FRAC_CONST(0.014618586389712), - FRAC_CONST(0.014952183366697), - FRAC_CONST(0.015290514656976), - FRAC_CONST(0.015633614861688), - FRAC_CONST(0.015981518520214), - FRAC_CONST(0.016334260107915), - FRAC_CONST(0.016691874033817), - FRAC_CONST(0.017054394638241), - FRAC_CONST(0.017421856190380), - FRAC_CONST(0.017794292885832), - FRAC_CONST(0.018171738844085), - FRAC_CONST(0.018554228105962), - FRAC_CONST(0.018941794631032), - FRAC_CONST(0.019334472294980), - FRAC_CONST(0.019732294886947), - FRAC_CONST(0.020135296106839), - FRAC_CONST(0.020543509562604), - FRAC_CONST(0.020956968767488), - FRAC_CONST(0.021375707137257), - FRAC_CONST(0.021799757987407), - FRAC_CONST(0.022229154530343), - FRAC_CONST(0.022663929872540), - FRAC_CONST(0.023104117011689), - FRAC_CONST(0.023549748833816), - FRAC_CONST(0.024000858110398), - FRAC_CONST(0.024457477495451), - FRAC_CONST(0.024919639522613), - FRAC_CONST(0.025387376602207), - FRAC_CONST(0.025860721018295), - FRAC_CONST(0.026339704925726), - FRAC_CONST(0.026824360347160), - FRAC_CONST(0.027314719170100), - FRAC_CONST(0.027810813143900), - FRAC_CONST(0.028312673876775), - FRAC_CONST(0.028820332832801), - FRAC_CONST(0.029333821328905), - FRAC_CONST(0.029853170531859), - FRAC_CONST(0.030378411455255), - FRAC_CONST(0.030909574956490), - FRAC_CONST(0.031446691733739), - FRAC_CONST(0.031989792322926), - FRAC_CONST(0.032538907094693), - FRAC_CONST(0.033094066251369), - FRAC_CONST(0.033655299823935), - FRAC_CONST(0.034222637668991), - FRAC_CONST(0.034796109465717), - FRAC_CONST(0.035375744712844), - FRAC_CONST(0.035961572725616), - FRAC_CONST(0.036553622632758), - FRAC_CONST(0.037151923373446), - FRAC_CONST(0.037756503694277), - FRAC_CONST(0.038367392146243), - FRAC_CONST(0.038984617081711), - FRAC_CONST(0.039608206651398), - FRAC_CONST(0.040238188801359), - FRAC_CONST(0.040874591269976), - FRAC_CONST(0.041517441584950), - FRAC_CONST(0.042166767060301), - FRAC_CONST(0.042822594793376), - FRAC_CONST(0.043484951661852), - FRAC_CONST(0.044153864320760), - FRAC_CONST(0.044829359199509), - FRAC_CONST(0.045511462498913), - FRAC_CONST(0.046200200188234), - FRAC_CONST(0.046895598002228), - FRAC_CONST(0.047597681438201), - FRAC_CONST(0.048306475753074), - FRAC_CONST(0.049022005960455), - FRAC_CONST(0.049744296827725), - FRAC_CONST(0.050473372873129), - FRAC_CONST(0.051209258362879), - FRAC_CONST(0.051951977308273), - FRAC_CONST(0.052701553462813), - FRAC_CONST(0.053458010319350), - FRAC_CONST(0.054221371107223), - FRAC_CONST(0.054991658789428), - FRAC_CONST(0.055768896059787), - FRAC_CONST(0.056553105340134), - FRAC_CONST(0.057344308777513), - FRAC_CONST(0.058142528241393), - FRAC_CONST(0.058947785320893), - FRAC_CONST(0.059760101322019), - FRAC_CONST(0.060579497264926), - FRAC_CONST(0.061405993881180), - FRAC_CONST(0.062239611611049), - FRAC_CONST(0.063080370600799), - FRAC_CONST(0.063928290700012), - FRAC_CONST(0.064783391458919), - FRAC_CONST(0.065645692125747), - FRAC_CONST(0.066515211644086), - FRAC_CONST(0.067391968650269), - FRAC_CONST(0.068275981470777), - FRAC_CONST(0.069167268119652), - FRAC_CONST(0.070065846295935), - FRAC_CONST(0.070971733381121), - FRAC_CONST(0.071884946436630), - FRAC_CONST(0.072805502201299), - FRAC_CONST(0.073733417088896), - FRAC_CONST(0.074668707185649), - FRAC_CONST(0.075611388247794), - FRAC_CONST(0.076561475699152), - FRAC_CONST(0.077518984628715), - FRAC_CONST(0.078483929788261), - FRAC_CONST(0.079456325589986), - FRAC_CONST(0.080436186104162), - FRAC_CONST(0.081423525056808), - FRAC_CONST(0.082418355827392), - FRAC_CONST(0.083420691446553), - FRAC_CONST(0.084430544593841), - FRAC_CONST(0.085447927595483), - FRAC_CONST(0.086472852422178), - FRAC_CONST(0.087505330686900), - FRAC_CONST(0.088545373642744), - FRAC_CONST(0.089592992180780), - FRAC_CONST(0.090648196827937), - FRAC_CONST(0.091710997744919), - FRAC_CONST(0.092781404724131), - FRAC_CONST(0.093859427187640), - FRAC_CONST(0.094945074185163), - FRAC_CONST(0.096038354392069), - FRAC_CONST(0.097139276107423), - FRAC_CONST(0.098247847252041), - FRAC_CONST(0.099364075366580), - FRAC_CONST(0.10048796760965), - FRAC_CONST(0.10161953075597), - FRAC_CONST(0.10275877119451), - FRAC_CONST(0.10390569492671), - FRAC_CONST(0.10506030756469), - FRAC_CONST(0.10622261432949), - FRAC_CONST(0.10739262004941), - FRAC_CONST(0.10857032915821), - FRAC_CONST(0.10975574569357), - FRAC_CONST(0.11094887329534), - FRAC_CONST(0.11214971520402), - FRAC_CONST(0.11335827425914), - FRAC_CONST(0.11457455289772), - FRAC_CONST(0.11579855315274), - FRAC_CONST(0.11703027665170), - FRAC_CONST(0.11826972461510), - FRAC_CONST(0.11951689785504), - FRAC_CONST(0.12077179677383), - FRAC_CONST(0.12203442136263), - FRAC_CONST(0.12330477120008), - FRAC_CONST(0.12458284545102), - FRAC_CONST(0.12586864286523), - FRAC_CONST(0.12716216177615), - FRAC_CONST(0.12846340009971), - FRAC_CONST(0.12977235533312), - FRAC_CONST(0.13108902455375), - FRAC_CONST(0.13241340441801), - FRAC_CONST(0.13374549116025), - FRAC_CONST(0.13508528059173), - FRAC_CONST(0.13643276809961), - FRAC_CONST(0.13778794864595), - FRAC_CONST(0.13915081676677), - FRAC_CONST(0.14052136657114), - FRAC_CONST(0.14189959174027), - FRAC_CONST(0.14328548552671), - FRAC_CONST(0.14467904075349), - FRAC_CONST(0.14608024981336), - FRAC_CONST(0.14748910466804), - FRAC_CONST(0.14890559684750), - FRAC_CONST(0.15032971744929), - FRAC_CONST(0.15176145713790), - FRAC_CONST(0.15320080614414), - FRAC_CONST(0.15464775426459), - FRAC_CONST(0.15610229086100), - FRAC_CONST(0.15756440485987), - FRAC_CONST(0.15903408475193), - FRAC_CONST(0.16051131859170), - FRAC_CONST(0.16199609399712), - FRAC_CONST(0.16348839814917), - FRAC_CONST(0.16498821779156), - FRAC_CONST(0.16649553923042), - FRAC_CONST(0.16801034833404), - FRAC_CONST(0.16953263053270), - FRAC_CONST(0.17106237081842), - FRAC_CONST(0.17259955374484), - FRAC_CONST(0.17414416342714), - FRAC_CONST(0.17569618354193), - FRAC_CONST(0.17725559732720), - FRAC_CONST(0.17882238758238), - FRAC_CONST(0.18039653666830), - FRAC_CONST(0.18197802650733), - FRAC_CONST(0.18356683858343), - FRAC_CONST(0.18516295394233), - FRAC_CONST(0.18676635319174), - FRAC_CONST(0.18837701650148), - FRAC_CONST(0.18999492360384), - FRAC_CONST(0.19162005379380), - FRAC_CONST(0.19325238592940), - FRAC_CONST(0.19489189843209), - FRAC_CONST(0.19653856928714), - FRAC_CONST(0.19819237604409), - FRAC_CONST(0.19985329581721), - FRAC_CONST(0.20152130528605), - FRAC_CONST(0.20319638069594), - FRAC_CONST(0.20487849785865), - FRAC_CONST(0.20656763215298), - FRAC_CONST(0.20826375852540), - FRAC_CONST(0.20996685149083), - FRAC_CONST(0.21167688513330), - FRAC_CONST(0.21339383310678), - FRAC_CONST(0.21511766863598), - FRAC_CONST(0.21684836451719), - FRAC_CONST(0.21858589311922), - FRAC_CONST(0.22033022638425), - FRAC_CONST(0.22208133582887), - FRAC_CONST(0.22383919254503), - FRAC_CONST(0.22560376720111), - FRAC_CONST(0.22737503004300), - FRAC_CONST(0.22915295089517), - FRAC_CONST(0.23093749916189), - FRAC_CONST(0.23272864382838), - FRAC_CONST(0.23452635346201), - FRAC_CONST(0.23633059621364), - FRAC_CONST(0.23814133981883), - FRAC_CONST(0.23995855159925), - FRAC_CONST(0.24178219846403), - FRAC_CONST(0.24361224691114), - FRAC_CONST(0.24544866302890), - FRAC_CONST(0.24729141249740), - FRAC_CONST(0.24914046059007), - FRAC_CONST(0.25099577217522), - FRAC_CONST(0.25285731171763), - FRAC_CONST(0.25472504328019), - FRAC_CONST(0.25659893052556), - FRAC_CONST(0.25847893671788), - FRAC_CONST(0.26036502472451), - FRAC_CONST(0.26225715701781), - FRAC_CONST(0.26415529567692), - FRAC_CONST(0.26605940238966), - FRAC_CONST(0.26796943845439), - FRAC_CONST(0.26988536478190), - FRAC_CONST(0.27180714189742), - FRAC_CONST(0.27373472994256), - FRAC_CONST(0.27566808867736), - FRAC_CONST(0.27760717748238), - FRAC_CONST(0.27955195536071), - FRAC_CONST(0.28150238094021), - FRAC_CONST(0.28345841247557), - FRAC_CONST(0.28542000785059), - FRAC_CONST(0.28738712458038), - FRAC_CONST(0.28935971981364), - FRAC_CONST(0.29133775033492), - FRAC_CONST(0.29332117256704), - FRAC_CONST(0.29530994257338), - FRAC_CONST(0.29730401606034), - FRAC_CONST(0.29930334837974), - FRAC_CONST(0.30130789453132), - FRAC_CONST(0.30331760916521), - FRAC_CONST(0.30533244658452), - FRAC_CONST(0.30735236074785), - FRAC_CONST(0.30937730527195), - FRAC_CONST(0.31140723343430), - FRAC_CONST(0.31344209817583), - FRAC_CONST(0.31548185210356), - FRAC_CONST(0.31752644749341), - FRAC_CONST(0.31957583629288), - FRAC_CONST(0.32162997012390), - FRAC_CONST(0.32368880028565), - FRAC_CONST(0.32575227775738), - FRAC_CONST(0.32782035320134), - FRAC_CONST(0.32989297696566), - FRAC_CONST(0.33197009908736), - FRAC_CONST(0.33405166929523), - FRAC_CONST(0.33613763701295), - FRAC_CONST(0.33822795136203), - FRAC_CONST(0.34032256116495), - FRAC_CONST(0.34242141494820), - FRAC_CONST(0.34452446094547), - FRAC_CONST(0.34663164710072), - FRAC_CONST(0.34874292107143), - FRAC_CONST(0.35085823023181), - FRAC_CONST(0.35297752167598), - FRAC_CONST(0.35510074222129), - FRAC_CONST(0.35722783841160), - FRAC_CONST(0.35935875652060), - FRAC_CONST(0.36149344255514), - FRAC_CONST(0.36363184225864), - FRAC_CONST(0.36577390111444), - FRAC_CONST(0.36791956434930), - FRAC_CONST(0.37006877693676), - FRAC_CONST(0.37222148360070), - FRAC_CONST(0.37437762881878), - FRAC_CONST(0.37653715682603), - FRAC_CONST(0.37870001161834), - FRAC_CONST(0.38086613695607), - FRAC_CONST(0.38303547636766), - FRAC_CONST(0.38520797315322), - FRAC_CONST(0.38738357038821), - FRAC_CONST(0.38956221092708), - FRAC_CONST(0.39174383740701), - FRAC_CONST(0.39392839225157), - FRAC_CONST(0.39611581767449), - FRAC_CONST(0.39830605568342), - FRAC_CONST(0.40049904808370), - FRAC_CONST(0.40269473648218), - FRAC_CONST(0.40489306229101), - FRAC_CONST(0.40709396673153), - FRAC_CONST(0.40929739083810), - FRAC_CONST(0.41150327546197), - FRAC_CONST(0.41371156127524), - FRAC_CONST(0.41592218877472), - FRAC_CONST(0.41813509828594), - FRAC_CONST(0.42035022996702), - FRAC_CONST(0.42256752381274), - FRAC_CONST(0.42478691965848), - FRAC_CONST(0.42700835718423), - FRAC_CONST(0.42923177591866), - FRAC_CONST(0.43145711524314), - FRAC_CONST(0.43368431439580), - FRAC_CONST(0.43591331247564), - FRAC_CONST(0.43814404844658), - FRAC_CONST(0.44037646114161), - FRAC_CONST(0.44261048926688), - FRAC_CONST(0.44484607140589), - FRAC_CONST(0.44708314602359), - FRAC_CONST(0.44932165147057), - FRAC_CONST(0.45156152598727), - FRAC_CONST(0.45380270770813), - FRAC_CONST(0.45604513466581), - FRAC_CONST(0.45828874479543), - FRAC_CONST(0.46053347593880), - FRAC_CONST(0.46277926584861), - FRAC_CONST(0.46502605219277), - FRAC_CONST(0.46727377255861), - FRAC_CONST(0.46952236445718), - FRAC_CONST(0.47177176532752), - FRAC_CONST(0.47402191254100), - FRAC_CONST(0.47627274340557), - FRAC_CONST(0.47852419517009), - FRAC_CONST(0.48077620502869), - FRAC_CONST(0.48302871012505), - FRAC_CONST(0.48528164755674), - FRAC_CONST(0.48753495437962), - FRAC_CONST(0.48978856761212), - FRAC_CONST(0.49204242423966), - FRAC_CONST(0.49429646121898), - FRAC_CONST(0.49655061548250), - FRAC_CONST(0.49880482394273), - FRAC_CONST(0.50105902349665), - FRAC_CONST(0.50331315103004), - FRAC_CONST(0.50556714342194), - FRAC_CONST(0.50782093754901), - FRAC_CONST(0.51007447028990), - FRAC_CONST(0.51232767852971), - FRAC_CONST(0.51458049916433), - FRAC_CONST(0.51683286910489), - FRAC_CONST(0.51908472528213), - FRAC_CONST(0.52133600465083), - FRAC_CONST(0.52358664419420), - FRAC_CONST(0.52583658092832), - FRAC_CONST(0.52808575190648), - FRAC_CONST(0.53033409422367), - FRAC_CONST(0.53258154502092), - FRAC_CONST(0.53482804148974), - FRAC_CONST(0.53707352087652), - FRAC_CONST(0.53931792048690), - FRAC_CONST(0.54156117769021), - FRAC_CONST(0.54380322992385), - FRAC_CONST(0.54604401469766), - FRAC_CONST(0.54828346959835), - FRAC_CONST(0.55052153229384), - FRAC_CONST(0.55275814053768), - FRAC_CONST(0.55499323217338), - FRAC_CONST(0.55722674513883), - FRAC_CONST(0.55945861747062), - FRAC_CONST(0.56168878730842), - FRAC_CONST(0.56391719289930), - FRAC_CONST(0.56614377260214), - FRAC_CONST(0.56836846489188), - FRAC_CONST(0.57059120836390), - FRAC_CONST(0.57281194173835), - FRAC_CONST(0.57503060386439), - FRAC_CONST(0.57724713372458), - FRAC_CONST(0.57946147043912), - FRAC_CONST(0.58167355327012), - FRAC_CONST(0.58388332162591), - FRAC_CONST(0.58609071506528), - FRAC_CONST(0.58829567330173), - FRAC_CONST(0.59049813620770), - FRAC_CONST(0.59269804381879), - FRAC_CONST(0.59489533633802), - FRAC_CONST(0.59708995413996), - FRAC_CONST(0.59928183777495), - FRAC_CONST(0.60147092797329), - FRAC_CONST(0.60365716564937), - FRAC_CONST(0.60584049190582), - FRAC_CONST(0.60802084803764), - FRAC_CONST(0.61019817553632), - FRAC_CONST(0.61237241609393), - FRAC_CONST(0.61454351160718), - FRAC_CONST(0.61671140418155), - FRAC_CONST(0.61887603613527), - FRAC_CONST(0.62103735000336), - FRAC_CONST(0.62319528854167), - FRAC_CONST(0.62534979473088), - FRAC_CONST(0.62750081178042), - FRAC_CONST(0.62964828313250), - FRAC_CONST(0.63179215246597), - FRAC_CONST(0.63393236370030), - FRAC_CONST(0.63606886099946), - FRAC_CONST(0.63820158877577), - FRAC_CONST(0.64033049169379), - FRAC_CONST(0.64245551467413), - FRAC_CONST(0.64457660289729), - FRAC_CONST(0.64669370180740), - FRAC_CONST(0.64880675711607), - FRAC_CONST(0.65091571480603), - FRAC_CONST(0.65302052113494), - FRAC_CONST(0.65512112263906), - FRAC_CONST(0.65721746613689), - FRAC_CONST(0.65930949873289), - FRAC_CONST(0.66139716782102), - FRAC_CONST(0.66348042108842), - FRAC_CONST(0.66555920651892), - FRAC_CONST(0.66763347239664), - FRAC_CONST(0.66970316730947), - FRAC_CONST(0.67176824015260), - FRAC_CONST(0.67382864013196), - FRAC_CONST(0.67588431676768), - FRAC_CONST(0.67793521989751), - FRAC_CONST(0.67998129968017), - FRAC_CONST(0.68202250659876), - FRAC_CONST(0.68405879146403), - FRAC_CONST(0.68609010541774), - FRAC_CONST(0.68811639993588), - FRAC_CONST(0.69013762683195), - FRAC_CONST(0.69215373826012), - FRAC_CONST(0.69416468671849), - FRAC_CONST(0.69617042505214), - FRAC_CONST(0.69817090645634), - FRAC_CONST(0.70016608447958), - FRAC_CONST(0.70215591302664), - FRAC_CONST(0.70414034636163), - FRAC_CONST(0.70611933911096), - FRAC_CONST(0.70809284626630), - FRAC_CONST(0.71006082318751), - FRAC_CONST(0.71202322560554), - FRAC_CONST(0.71398000962530), - FRAC_CONST(0.71593113172842), - FRAC_CONST(0.71787654877613), - FRAC_CONST(0.71981621801195), - FRAC_CONST(0.72175009706445), - FRAC_CONST(0.72367814394990), - FRAC_CONST(0.72560031707496), - FRAC_CONST(0.72751657523927), - FRAC_CONST(0.72942687763803), - FRAC_CONST(0.73133118386457), - FRAC_CONST(0.73322945391280), - FRAC_CONST(0.73512164817975), - FRAC_CONST(0.73700772746796), - FRAC_CONST(0.73888765298787), - FRAC_CONST(0.74076138636020), - FRAC_CONST(0.74262888961827), - FRAC_CONST(0.74449012521027), - FRAC_CONST(0.74634505600152), - FRAC_CONST(0.74819364527663), - FRAC_CONST(0.75003585674175), - FRAC_CONST(0.75187165452661), - FRAC_CONST(0.75370100318668), - FRAC_CONST(0.75552386770515), - FRAC_CONST(0.75734021349500), - FRAC_CONST(0.75915000640095), - FRAC_CONST(0.76095321270137), - FRAC_CONST(0.76274979911019), - FRAC_CONST(0.76453973277875), - FRAC_CONST(0.76632298129757), - FRAC_CONST(0.76809951269819), - FRAC_CONST(0.76986929545481), - FRAC_CONST(0.77163229848604), - FRAC_CONST(0.77338849115651), - FRAC_CONST(0.77513784327849), - FRAC_CONST(0.77688032511340), - FRAC_CONST(0.77861590737340), - FRAC_CONST(0.78034456122283), - FRAC_CONST(0.78206625827961), - FRAC_CONST(0.78378097061667), - FRAC_CONST(0.78548867076330), - FRAC_CONST(0.78718933170643), - FRAC_CONST(0.78888292689189), - FRAC_CONST(0.79056943022564), - FRAC_CONST(0.79224881607494), - FRAC_CONST(0.79392105926949), - FRAC_CONST(0.79558613510249), - FRAC_CONST(0.79724401933170), - FRAC_CONST(0.79889468818046), - FRAC_CONST(0.80053811833858), - FRAC_CONST(0.80217428696334), - FRAC_CONST(0.80380317168028), - FRAC_CONST(0.80542475058405), - FRAC_CONST(0.80703900223920), - FRAC_CONST(0.80864590568089), - FRAC_CONST(0.81024544041560), - FRAC_CONST(0.81183758642175), - FRAC_CONST(0.81342232415032), - FRAC_CONST(0.81499963452540), - FRAC_CONST(0.81656949894467), - FRAC_CONST(0.81813189927991), - FRAC_CONST(0.81968681787738), - FRAC_CONST(0.82123423755821), - FRAC_CONST(0.82277414161874), - FRAC_CONST(0.82430651383076), - FRAC_CONST(0.82583133844180), - FRAC_CONST(0.82734860017528), - FRAC_CONST(0.82885828423070), - FRAC_CONST(0.83036037628369), - FRAC_CONST(0.83185486248609), - FRAC_CONST(0.83334172946597), - FRAC_CONST(0.83482096432759), - FRAC_CONST(0.83629255465130), - FRAC_CONST(0.83775648849344), - FRAC_CONST(0.83921275438615), - FRAC_CONST(0.84066134133716), - FRAC_CONST(0.84210223882952), - FRAC_CONST(0.84353543682130), - FRAC_CONST(0.84496092574524), - FRAC_CONST(0.84637869650833), - FRAC_CONST(0.84778874049138), - FRAC_CONST(0.84919104954855), - FRAC_CONST(0.85058561600677), - FRAC_CONST(0.85197243266520), - FRAC_CONST(0.85335149279457), - FRAC_CONST(0.85472279013653), - FRAC_CONST(0.85608631890295), - FRAC_CONST(0.85744207377513), - FRAC_CONST(0.85879004990298), - FRAC_CONST(0.86013024290422), - FRAC_CONST(0.86146264886346), - FRAC_CONST(0.86278726433124), - FRAC_CONST(0.86410408632306), - FRAC_CONST(0.86541311231838), - FRAC_CONST(0.86671434025950), - FRAC_CONST(0.86800776855046), - FRAC_CONST(0.86929339605590), - FRAC_CONST(0.87057122209981), - FRAC_CONST(0.87184124646433), - FRAC_CONST(0.87310346938840), - FRAC_CONST(0.87435789156650), - FRAC_CONST(0.87560451414719), - FRAC_CONST(0.87684333873173), - FRAC_CONST(0.87807436737261), - FRAC_CONST(0.87929760257204), - FRAC_CONST(0.88051304728038), - FRAC_CONST(0.88172070489456), - FRAC_CONST(0.88292057925645), - FRAC_CONST(0.88411267465117), - FRAC_CONST(0.88529699580537), - FRAC_CONST(0.88647354788545), - FRAC_CONST(0.88764233649580), - FRAC_CONST(0.88880336767692), - FRAC_CONST(0.88995664790351), - FRAC_CONST(0.89110218408260), - FRAC_CONST(0.89223998355154), - FRAC_CONST(0.89337005407600), - FRAC_CONST(0.89449240384793), - FRAC_CONST(0.89560704148345), - FRAC_CONST(0.89671397602074), - FRAC_CONST(0.89781321691786), - FRAC_CONST(0.89890477405053), - FRAC_CONST(0.89998865770993), - FRAC_CONST(0.90106487860034), - FRAC_CONST(0.90213344783689), - FRAC_CONST(0.90319437694315), - FRAC_CONST(0.90424767784873), - FRAC_CONST(0.90529336288690), - FRAC_CONST(0.90633144479201), - FRAC_CONST(0.90736193669708), - FRAC_CONST(0.90838485213119), - FRAC_CONST(0.90940020501694), - FRAC_CONST(0.91040800966776), - FRAC_CONST(0.91140828078533), - FRAC_CONST(0.91240103345685), - FRAC_CONST(0.91338628315231), - FRAC_CONST(0.91436404572173), - FRAC_CONST(0.91533433739238), - FRAC_CONST(0.91629717476594), - FRAC_CONST(0.91725257481564), - FRAC_CONST(0.91820055488334), - FRAC_CONST(0.91914113267664), - FRAC_CONST(0.92007432626589), - FRAC_CONST(0.92100015408120), - FRAC_CONST(0.92191863490944), - FRAC_CONST(0.92282978789113), - FRAC_CONST(0.92373363251740), - FRAC_CONST(0.92463018862687), - FRAC_CONST(0.92551947640245), - FRAC_CONST(0.92640151636824), - FRAC_CONST(0.92727632938624), - FRAC_CONST(0.92814393665320), - FRAC_CONST(0.92900435969727), - FRAC_CONST(0.92985762037477), - FRAC_CONST(0.93070374086684), - FRAC_CONST(0.93154274367610), - FRAC_CONST(0.93237465162328), - FRAC_CONST(0.93319948784382), - FRAC_CONST(0.93401727578443), - FRAC_CONST(0.93482803919967), - FRAC_CONST(0.93563180214841), - FRAC_CONST(0.93642858899043), - FRAC_CONST(0.93721842438279), - FRAC_CONST(0.93800133327637), - FRAC_CONST(0.93877734091223), - FRAC_CONST(0.93954647281807), - FRAC_CONST(0.94030875480458), - FRAC_CONST(0.94106421296182), - FRAC_CONST(0.94181287365556), - FRAC_CONST(0.94255476352362), - FRAC_CONST(0.94328990947213), - FRAC_CONST(0.94401833867184), - FRAC_CONST(0.94474007855439), - FRAC_CONST(0.94545515680855), - FRAC_CONST(0.94616360137644), - FRAC_CONST(0.94686544044975), - FRAC_CONST(0.94756070246592), - FRAC_CONST(0.94824941610434), - FRAC_CONST(0.94893161028248), - FRAC_CONST(0.94960731415209), - FRAC_CONST(0.95027655709525), - FRAC_CONST(0.95093936872056), - FRAC_CONST(0.95159577885924), - FRAC_CONST(0.95224581756115), - FRAC_CONST(0.95288951509097), - FRAC_CONST(0.95352690192417), - FRAC_CONST(0.95415800874314), - FRAC_CONST(0.95478286643320), - FRAC_CONST(0.95540150607863), - FRAC_CONST(0.95601395895871), - FRAC_CONST(0.95662025654373), - FRAC_CONST(0.95722043049100), - FRAC_CONST(0.95781451264084), - FRAC_CONST(0.95840253501260), - FRAC_CONST(0.95898452980058), - FRAC_CONST(0.95956052937008), - FRAC_CONST(0.96013056625336), - FRAC_CONST(0.96069467314557), - FRAC_CONST(0.96125288290073), - FRAC_CONST(0.96180522852773), - FRAC_CONST(0.96235174318622), - FRAC_CONST(0.96289246018262), - FRAC_CONST(0.96342741296604), - FRAC_CONST(0.96395663512424), - FRAC_CONST(0.96448016037959), - FRAC_CONST(0.96499802258499), - FRAC_CONST(0.96551025571985), - FRAC_CONST(0.96601689388602), - FRAC_CONST(0.96651797130376), - FRAC_CONST(0.96701352230768), - FRAC_CONST(0.96750358134269), - FRAC_CONST(0.96798818295998), - FRAC_CONST(0.96846736181297), - FRAC_CONST(0.96894115265327), - FRAC_CONST(0.96940959032667), - FRAC_CONST(0.96987270976912), - FRAC_CONST(0.97033054600270), - FRAC_CONST(0.97078313413161), - FRAC_CONST(0.97123050933818), - FRAC_CONST(0.97167270687887), - FRAC_CONST(0.97210976208030), - FRAC_CONST(0.97254171033525), - FRAC_CONST(0.97296858709871), - FRAC_CONST(0.97339042788392), - FRAC_CONST(0.97380726825843), - FRAC_CONST(0.97421914384017), - FRAC_CONST(0.97462609029350), - FRAC_CONST(0.97502814332534), - FRAC_CONST(0.97542533868127), - FRAC_CONST(0.97581771214160), - FRAC_CONST(0.97620529951759), - FRAC_CONST(0.97658813664749), - FRAC_CONST(0.97696625939282), - FRAC_CONST(0.97733970363445), - FRAC_CONST(0.97770850526884), - FRAC_CONST(0.97807270020427), - FRAC_CONST(0.97843232435704), - FRAC_CONST(0.97878741364771), - FRAC_CONST(0.97913800399743), - FRAC_CONST(0.97948413132414), - FRAC_CONST(0.97982583153895), - FRAC_CONST(0.98016314054243), - FRAC_CONST(0.98049609422096), - FRAC_CONST(0.98082472844313), - FRAC_CONST(0.98114907905608), - FRAC_CONST(0.98146918188197), - FRAC_CONST(0.98178507271438), - FRAC_CONST(0.98209678731477), - FRAC_CONST(0.98240436140902), - FRAC_CONST(0.98270783068385), - FRAC_CONST(0.98300723078342), - FRAC_CONST(0.98330259730589), - FRAC_CONST(0.98359396579995), - FRAC_CONST(0.98388137176152), - FRAC_CONST(0.98416485063031), - FRAC_CONST(0.98444443778651), - FRAC_CONST(0.98472016854752), - FRAC_CONST(0.98499207816463), - FRAC_CONST(0.98526020181980), - FRAC_CONST(0.98552457462240), - FRAC_CONST(0.98578523160609), - FRAC_CONST(0.98604220772560), - FRAC_CONST(0.98629553785362), - FRAC_CONST(0.98654525677772), - FRAC_CONST(0.98679139919726), - FRAC_CONST(0.98703399972035), - FRAC_CONST(0.98727309286089), - FRAC_CONST(0.98750871303556), - FRAC_CONST(0.98774089456089), - FRAC_CONST(0.98796967165036), - FRAC_CONST(0.98819507841154), - FRAC_CONST(0.98841714884323), - FRAC_CONST(0.98863591683269), - FRAC_CONST(0.98885141615285), - FRAC_CONST(0.98906368045957), - FRAC_CONST(0.98927274328896), - FRAC_CONST(0.98947863805473), - FRAC_CONST(0.98968139804554), - FRAC_CONST(0.98988105642241), - FRAC_CONST(0.99007764621618), - FRAC_CONST(0.99027120032501), - FRAC_CONST(0.99046175151186), - FRAC_CONST(0.99064933240208), - FRAC_CONST(0.99083397548099), - FRAC_CONST(0.99101571309153), - FRAC_CONST(0.99119457743191), - FRAC_CONST(0.99137060055337), - FRAC_CONST(0.99154381435784), - FRAC_CONST(0.99171425059582), - FRAC_CONST(0.99188194086414), - FRAC_CONST(0.99204691660388), - FRAC_CONST(0.99220920909823), - FRAC_CONST(0.99236884947045), - FRAC_CONST(0.99252586868186), - FRAC_CONST(0.99268029752989), - FRAC_CONST(0.99283216664606), - FRAC_CONST(0.99298150649419), - FRAC_CONST(0.99312834736847), - FRAC_CONST(0.99327271939167), - FRAC_CONST(0.99341465251338), - FRAC_CONST(0.99355417650825), - FRAC_CONST(0.99369132097430), - FRAC_CONST(0.99382611533130), - FRAC_CONST(0.99395858881910), - FRAC_CONST(0.99408877049612), - FRAC_CONST(0.99421668923778), - FRAC_CONST(0.99434237373503), - FRAC_CONST(0.99446585249289), - FRAC_CONST(0.99458715382906), - FRAC_CONST(0.99470630587254), - FRAC_CONST(0.99482333656229), - FRAC_CONST(0.99493827364600), - FRAC_CONST(0.99505114467878), - FRAC_CONST(0.99516197702200), - FRAC_CONST(0.99527079784214), - FRAC_CONST(0.99537763410962), - FRAC_CONST(0.99548251259777), - FRAC_CONST(0.99558545988178), - FRAC_CONST(0.99568650233767), - FRAC_CONST(0.99578566614138), - FRAC_CONST(0.99588297726783), - FRAC_CONST(0.99597846149005), - FRAC_CONST(0.99607214437834), - FRAC_CONST(0.99616405129947), - FRAC_CONST(0.99625420741595), - FRAC_CONST(0.99634263768527), - FRAC_CONST(0.99642936685928), - FRAC_CONST(0.99651441948352), - FRAC_CONST(0.99659781989663), - FRAC_CONST(0.99667959222978), - FRAC_CONST(0.99675976040620), - FRAC_CONST(0.99683834814063), - FRAC_CONST(0.99691537893895), - FRAC_CONST(0.99699087609774), - FRAC_CONST(0.99706486270391), - FRAC_CONST(0.99713736163442), - FRAC_CONST(0.99720839555593), - FRAC_CONST(0.99727798692461), - FRAC_CONST(0.99734615798589), - FRAC_CONST(0.99741293077431), - FRAC_CONST(0.99747832711337), - FRAC_CONST(0.99754236861541), - FRAC_CONST(0.99760507668158), - FRAC_CONST(0.99766647250181), - FRAC_CONST(0.99772657705478), - FRAC_CONST(0.99778541110799), - FRAC_CONST(0.99784299521785), - FRAC_CONST(0.99789934972976), - FRAC_CONST(0.99795449477828), - FRAC_CONST(0.99800845028730), - FRAC_CONST(0.99806123597027), - FRAC_CONST(0.99811287133042), - FRAC_CONST(0.99816337566108), - FRAC_CONST(0.99821276804596), - FRAC_CONST(0.99826106735952), - FRAC_CONST(0.99830829226732), - FRAC_CONST(0.99835446122649), - FRAC_CONST(0.99839959248609), - FRAC_CONST(0.99844370408765), - FRAC_CONST(0.99848681386566), - FRAC_CONST(0.99852893944805), - FRAC_CONST(0.99857009825685), - FRAC_CONST(0.99861030750869), - FRAC_CONST(0.99864958421549), - FRAC_CONST(0.99868794518504), - FRAC_CONST(0.99872540702178), - FRAC_CONST(0.99876198612738), - FRAC_CONST(0.99879769870160), - FRAC_CONST(0.99883256074295), - FRAC_CONST(0.99886658804953), - FRAC_CONST(0.99889979621983), - FRAC_CONST(0.99893220065356), - FRAC_CONST(0.99896381655254), - FRAC_CONST(0.99899465892154), - FRAC_CONST(0.99902474256924), - FRAC_CONST(0.99905408210916), - FRAC_CONST(0.99908269196056), - FRAC_CONST(0.99911058634952), - FRAC_CONST(0.99913777930986), - FRAC_CONST(0.99916428468421), - FRAC_CONST(0.99919011612505), - FRAC_CONST(0.99921528709576), - FRAC_CONST(0.99923981087174), - FRAC_CONST(0.99926370054150), - FRAC_CONST(0.99928696900779), - FRAC_CONST(0.99930962898876), - FRAC_CONST(0.99933169301910), - FRAC_CONST(0.99935317345126), - FRAC_CONST(0.99937408245662), - FRAC_CONST(0.99939443202674), - FRAC_CONST(0.99941423397457), - FRAC_CONST(0.99943349993572), - FRAC_CONST(0.99945224136972), - FRAC_CONST(0.99947046956130), - FRAC_CONST(0.99948819562171), - FRAC_CONST(0.99950543049000), - FRAC_CONST(0.99952218493439), - FRAC_CONST(0.99953846955355), - FRAC_CONST(0.99955429477803), - FRAC_CONST(0.99956967087154), - FRAC_CONST(0.99958460793242), - FRAC_CONST(0.99959911589494), - FRAC_CONST(0.99961320453077), - FRAC_CONST(0.99962688345035), - FRAC_CONST(0.99964016210433), - FRAC_CONST(0.99965304978499), - FRAC_CONST(0.99966555562769), - FRAC_CONST(0.99967768861231), - FRAC_CONST(0.99968945756473), - FRAC_CONST(0.99970087115825), - FRAC_CONST(0.99971193791510), - FRAC_CONST(0.99972266620792), - FRAC_CONST(0.99973306426121), - FRAC_CONST(0.99974314015288), - FRAC_CONST(0.99975290181568), - FRAC_CONST(0.99976235703876), - FRAC_CONST(0.99977151346914), - FRAC_CONST(0.99978037861326), - FRAC_CONST(0.99978895983845), - FRAC_CONST(0.99979726437448), - FRAC_CONST(0.99980529931507), - FRAC_CONST(0.99981307161943), - FRAC_CONST(0.99982058811377), - FRAC_CONST(0.99982785549283), - FRAC_CONST(0.99983488032144), - FRAC_CONST(0.99984166903600), - FRAC_CONST(0.99984822794606), - FRAC_CONST(0.99985456323584), - FRAC_CONST(0.99986068096572), - FRAC_CONST(0.99986658707386), - FRAC_CONST(0.99987228737764), - FRAC_CONST(0.99987778757524), - FRAC_CONST(0.99988309324717), - FRAC_CONST(0.99988820985777), - FRAC_CONST(0.99989314275675), - FRAC_CONST(0.99989789718072), - FRAC_CONST(0.99990247825468), - FRAC_CONST(0.99990689099357), - FRAC_CONST(0.99991114030376), - FRAC_CONST(0.99991523098456), - FRAC_CONST(0.99991916772971), - FRAC_CONST(0.99992295512891), - FRAC_CONST(0.99992659766930), - FRAC_CONST(0.99993009973692), - FRAC_CONST(0.99993346561824), - FRAC_CONST(0.99993669950161), - FRAC_CONST(0.99993980547870), - FRAC_CONST(0.99994278754604), - FRAC_CONST(0.99994564960642), - FRAC_CONST(0.99994839547033), - FRAC_CONST(0.99995102885747), - FRAC_CONST(0.99995355339809), - FRAC_CONST(0.99995597263451), - FRAC_CONST(0.99995829002249), - FRAC_CONST(0.99996050893264), - FRAC_CONST(0.99996263265183), - FRAC_CONST(0.99996466438460), - FRAC_CONST(0.99996660725452), - FRAC_CONST(0.99996846430558), - FRAC_CONST(0.99997023850356), - FRAC_CONST(0.99997193273736), - FRAC_CONST(0.99997354982037), - FRAC_CONST(0.99997509249183), - FRAC_CONST(0.99997656341810), - FRAC_CONST(0.99997796519400), - FRAC_CONST(0.99997930034415), - FRAC_CONST(0.99998057132421), - FRAC_CONST(0.99998178052220), - FRAC_CONST(0.99998293025975), - FRAC_CONST(0.99998402279338), - FRAC_CONST(0.99998506031574), - FRAC_CONST(0.99998604495686), - FRAC_CONST(0.99998697878536), - FRAC_CONST(0.99998786380966), - FRAC_CONST(0.99998870197921), - FRAC_CONST(0.99998949518567), - FRAC_CONST(0.99999024526408), - FRAC_CONST(0.99999095399401), - FRAC_CONST(0.99999162310077), - FRAC_CONST(0.99999225425649), - FRAC_CONST(0.99999284908128), - FRAC_CONST(0.99999340914435), - FRAC_CONST(0.99999393596510), - FRAC_CONST(0.99999443101421), - FRAC_CONST(0.99999489571473), - FRAC_CONST(0.99999533144314), - FRAC_CONST(0.99999573953040), - FRAC_CONST(0.99999612126300), - FRAC_CONST(0.99999647788395), - FRAC_CONST(0.99999681059383), - FRAC_CONST(0.99999712055178), - FRAC_CONST(0.99999740887647), - FRAC_CONST(0.99999767664709), - FRAC_CONST(0.99999792490431), - FRAC_CONST(0.99999815465123), - FRAC_CONST(0.99999836685427), - FRAC_CONST(0.99999856244415), - FRAC_CONST(0.99999874231676), - FRAC_CONST(0.99999890733405), - FRAC_CONST(0.99999905832493), - FRAC_CONST(0.99999919608613), - FRAC_CONST(0.99999932138304), - FRAC_CONST(0.99999943495056), - FRAC_CONST(0.99999953749392), - FRAC_CONST(0.99999962968950), - FRAC_CONST(0.99999971218563), - FRAC_CONST(0.99999978560337), - FRAC_CONST(0.99999985053727), - FRAC_CONST(0.99999990755616), - FRAC_CONST(0.99999995720387) -}; - -#ifdef ALLOW_SMALL_FRAMELENGTH -ALIGN static const real_t kbd_long_960[] = { - FRAC_CONST(0.0003021562530949), - FRAC_CONST(0.0004452267024786), - FRAC_CONST(0.0005674947527496), - FRAC_CONST(0.0006812465553466), - FRAC_CONST(0.0007910496776387), - FRAC_CONST(0.0008991655033895), - FRAC_CONST(0.0010068978259384), - FRAC_CONST(0.0011150758515751), - FRAC_CONST(0.0012242653193642), - FRAC_CONST(0.0013348735658205), - FRAC_CONST(0.0014472068670273), - FRAC_CONST(0.0015615039850448), - FRAC_CONST(0.0016779568885263), - FRAC_CONST(0.0017967241232412), - FRAC_CONST(0.0019179397560955), - FRAC_CONST(0.0020417195415393), - FRAC_CONST(0.0021681652836642), - FRAC_CONST(0.0022973679910599), - FRAC_CONST(0.0024294102029937), - FRAC_CONST(0.0025643677339078), - FRAC_CONST(0.0027023110014772), - FRAC_CONST(0.0028433060512612), - FRAC_CONST(0.0029874153568025), - FRAC_CONST(0.0031346984511728), - FRAC_CONST(0.0032852124303662), - FRAC_CONST(0.0034390123581190), - FRAC_CONST(0.0035961515940931), - FRAC_CONST(0.0037566820618961), - FRAC_CONST(0.0039206544694386), - FRAC_CONST(0.0040881184912194), - FRAC_CONST(0.0042591229199617), - FRAC_CONST(0.0044337157933972), - FRAC_CONST(0.0046119445007641), - FRAC_CONST(0.0047938558726415), - FRAC_CONST(0.0049794962570131), - FRAC_CONST(0.0051689115838900), - FRAC_CONST(0.0053621474203763), - FRAC_CONST(0.0055592490177131), - FRAC_CONST(0.0057602613515573), - FRAC_CONST(0.0059652291565289), - FRAC_CONST(0.0061741969558843), - FRAC_CONST(0.0063872090870253), - FRAC_CONST(0.0066043097234387), - FRAC_CONST(0.0068255428935640), - FRAC_CONST(0.0070509524970088), - FRAC_CONST(0.0072805823184660), - FRAC_CONST(0.0075144760396340), - FRAC_CONST(0.0077526772493942), - FRAC_CONST(0.0079952294524673), - FRAC_CONST(0.0082421760767325), - FRAC_CONST(0.0084935604793733), - FRAC_CONST(0.0087494259519870), - FRAC_CONST(0.0090098157247792), - FRAC_CONST(0.0092747729699467), - FRAC_CONST(0.0095443408043399), - FRAC_CONST(0.0098185622914832), - FRAC_CONST(0.0100974804430226), - FRAC_CONST(0.0103811382196612), - FRAC_CONST(0.0106695785316351), - FRAC_CONST(0.0109628442387771), - FRAC_CONST(0.0112609781502091), - FRAC_CONST(0.0115640230236993), - FRAC_CONST(0.0118720215647169), - FRAC_CONST(0.0121850164252137), - FRAC_CONST(0.0125030502021561), - FRAC_CONST(0.0128261654358321), - FRAC_CONST(0.0131544046079532), - FRAC_CONST(0.0134878101395681), - FRAC_CONST(0.0138264243888068), - FRAC_CONST(0.0141702896484671), - FRAC_CONST(0.0145194481434592), - FRAC_CONST(0.0148739420281182), - FRAC_CONST(0.0152338133833959), - FRAC_CONST(0.0155991042139432), - FRAC_CONST(0.0159698564450882), - FRAC_CONST(0.0163461119197227), - FRAC_CONST(0.0167279123950996), - FRAC_CONST(0.0171152995395520), - FRAC_CONST(0.0175083149291368), - FRAC_CONST(0.0179070000442104), - FRAC_CONST(0.0183113962659409), - FRAC_CONST(0.0187215448727609), - FRAC_CONST(0.0191374870367659), - FRAC_CONST(0.0195592638200623), - FRAC_CONST(0.0199869161710679), - FRAC_CONST(0.0204204849207691), - FRAC_CONST(0.0208600107789370), - FRAC_CONST(0.0213055343303066), - FRAC_CONST(0.0217570960307201), - FRAC_CONST(0.0222147362032386), - FRAC_CONST(0.0226784950342228), - FRAC_CONST(0.0231484125693867), - FRAC_CONST(0.0236245287098244), - FRAC_CONST(0.0241068832080138), - FRAC_CONST(0.0245955156637973), - FRAC_CONST(0.0250904655203431), - FRAC_CONST(0.0255917720600868), - FRAC_CONST(0.0260994744006559), - FRAC_CONST(0.0266136114907790), - FRAC_CONST(0.0271342221061795), - FRAC_CONST(0.0276613448454576), - FRAC_CONST(0.0281950181259587), - FRAC_CONST(0.0287352801796329), - FRAC_CONST(0.0292821690488833), - FRAC_CONST(0.0298357225824074), - FRAC_CONST(0.0303959784310299), - FRAC_CONST(0.0309629740435296), - FRAC_CONST(0.0315367466624615), - FRAC_CONST(0.0321173333199732), - FRAC_CONST(0.0327047708336193), - FRAC_CONST(0.0332990958021720), - FRAC_CONST(0.0339003446014307), - FRAC_CONST(0.0345085533800302), - FRAC_CONST(0.0351237580552491), - FRAC_CONST(0.0357459943088193), - FRAC_CONST(0.0363752975827358), - FRAC_CONST(0.0370117030750704), - FRAC_CONST(0.0376552457357870), - FRAC_CONST(0.0383059602625614), - FRAC_CONST(0.0389638810966056), - FRAC_CONST(0.0396290424184964), - FRAC_CONST(0.0403014781440112), - FRAC_CONST(0.0409812219199691), - FRAC_CONST(0.0416683071200799), - FRAC_CONST(0.0423627668408009), - FRAC_CONST(0.0430646338972016), - FRAC_CONST(0.0437739408188385), - FRAC_CONST(0.0444907198456388), - FRAC_CONST(0.0452150029237951), - FRAC_CONST(0.0459468217016708), - FRAC_CONST(0.0466862075257170), - FRAC_CONST(0.0474331914364021), - FRAC_CONST(0.0481878041641539), - FRAC_CONST(0.0489500761253148), - FRAC_CONST(0.0497200374181119), - FRAC_CONST(0.0504977178186404), - FRAC_CONST(0.0512831467768636), - FRAC_CONST(0.0520763534126273), - FRAC_CONST(0.0528773665116913), - FRAC_CONST(0.0536862145217772), - FRAC_CONST(0.0545029255486345), - FRAC_CONST(0.0553275273521232), - FRAC_CONST(0.0561600473423164), - FRAC_CONST(0.0570005125756209), - FRAC_CONST(0.0578489497509179), - FRAC_CONST(0.0587053852057233), - FRAC_CONST(0.0595698449123695), - FRAC_CONST(0.0604423544742077), - FRAC_CONST(0.0613229391218317), - FRAC_CONST(0.0622116237093247), - FRAC_CONST(0.0631084327105284), - FRAC_CONST(0.0640133902153352), - FRAC_CONST(0.0649265199260043), - FRAC_CONST(0.0658478451535027), - FRAC_CONST(0.0667773888138695), - FRAC_CONST(0.0677151734246072), - FRAC_CONST(0.0686612211010977), - FRAC_CONST(0.0696155535530446), - FRAC_CONST(0.0705781920809429), - FRAC_CONST(0.0715491575725758), - FRAC_CONST(0.0725284704995383), - FRAC_CONST(0.0735161509137906), - FRAC_CONST(0.0745122184442388), - FRAC_CONST(0.0755166922933461), - FRAC_CONST(0.0765295912337720), - FRAC_CONST(0.0775509336050437), - FRAC_CONST(0.0785807373102561), - FRAC_CONST(0.0796190198128044), - FRAC_CONST(0.0806657981331473), - FRAC_CONST(0.0817210888456026), - FRAC_CONST(0.0827849080751753), - FRAC_CONST(0.0838572714944183), - FRAC_CONST(0.0849381943203265), - FRAC_CONST(0.0860276913112652), - FRAC_CONST(0.0871257767639319), - FRAC_CONST(0.0882324645103534), - FRAC_CONST(0.0893477679149177), - FRAC_CONST(0.0904716998714418), - FRAC_CONST(0.0916042728002747), - FRAC_CONST(0.0927454986454381), - FRAC_CONST(0.0938953888718020), - FRAC_CONST(0.0950539544622996), - FRAC_CONST(0.0962212059151784), - FRAC_CONST(0.0973971532412897), - FRAC_CONST(0.0985818059614169), - FRAC_CONST(0.0997751731036425), - FRAC_CONST(0.1009772632007537), - FRAC_CONST(0.1021880842876888), - FRAC_CONST(0.1034076438990227), - FRAC_CONST(0.1046359490664932), - FRAC_CONST(0.1058730063165681), - FRAC_CONST(0.1071188216680533), - FRAC_CONST(0.1083734006297428), - FRAC_CONST(0.1096367481981100), - FRAC_CONST(0.1109088688550422), - FRAC_CONST(0.1121897665656167), - FRAC_CONST(0.1134794447759207), - FRAC_CONST(0.1147779064109143), - FRAC_CONST(0.1160851538723372), - FRAC_CONST(0.1174011890366591), - FRAC_CONST(0.1187260132530751), - FRAC_CONST(0.1200596273415457), - FRAC_CONST(0.1214020315908810), - FRAC_CONST(0.1227532257568719), - FRAC_CONST(0.1241132090604651), - FRAC_CONST(0.1254819801859856), - FRAC_CONST(0.1268595372794049), - FRAC_CONST(0.1282458779466558), - FRAC_CONST(0.1296409992519942), - FRAC_CONST(0.1310448977164081), - FRAC_CONST(0.1324575693160745), - FRAC_CONST(0.1338790094808633), - FRAC_CONST(0.1353092130928902), - FRAC_CONST(0.1367481744851168), - FRAC_CONST(0.1381958874400010), - FRAC_CONST(0.1396523451881945), - FRAC_CONST(0.1411175404072910), - FRAC_CONST(0.1425914652206223), - FRAC_CONST(0.1440741111961058), - FRAC_CONST(0.1455654693451402), - FRAC_CONST(0.1470655301215526), - FRAC_CONST(0.1485742834205956), - FRAC_CONST(0.1500917185779945), - FRAC_CONST(0.1516178243690463), - FRAC_CONST(0.1531525890077689), - FRAC_CONST(0.1546960001461024), - FRAC_CONST(0.1562480448731608), - FRAC_CONST(0.1578087097145364), - FRAC_CONST(0.1593779806316558), - FRAC_CONST(0.1609558430211876), - FRAC_CONST(0.1625422817145027), - FRAC_CONST(0.1641372809771871), - FRAC_CONST(0.1657408245086070), - FRAC_CONST(0.1673528954415270), - FRAC_CONST(0.1689734763417811), - FRAC_CONST(0.1706025492079969), - FRAC_CONST(0.1722400954713725), - FRAC_CONST(0.1738860959955082), - FRAC_CONST(0.1755405310762898), - FRAC_CONST(0.1772033804418275), - FRAC_CONST(0.1788746232524467), - FRAC_CONST(0.1805542381007349), - FRAC_CONST(0.1822422030116404), - FRAC_CONST(0.1839384954426268), - FRAC_CONST(0.1856430922838810), - FRAC_CONST(0.1873559698585756), - FRAC_CONST(0.1890771039231862), - FRAC_CONST(0.1908064696678625), - FRAC_CONST(0.1925440417168546), - FRAC_CONST(0.1942897941289937), - FRAC_CONST(0.1960437003982277), - FRAC_CONST(0.1978057334542116), - FRAC_CONST(0.1995758656629525), - FRAC_CONST(0.2013540688275098), - FRAC_CONST(0.2031403141887507), - FRAC_CONST(0.2049345724261595), - FRAC_CONST(0.2067368136587033), - FRAC_CONST(0.2085470074457521), - FRAC_CONST(0.2103651227880538), - FRAC_CONST(0.2121911281287646), - FRAC_CONST(0.2140249913545346), - FRAC_CONST(0.2158666797966480), - FRAC_CONST(0.2177161602322188), - FRAC_CONST(0.2195733988854414), - FRAC_CONST(0.2214383614288963), - FRAC_CONST(0.2233110129849106), - FRAC_CONST(0.2251913181269740), - FRAC_CONST(0.2270792408812093), - FRAC_CONST(0.2289747447278976), - FRAC_CONST(0.2308777926030592), - FRAC_CONST(0.2327883469000885), - FRAC_CONST(0.2347063694714437), - FRAC_CONST(0.2366318216303919), - FRAC_CONST(0.2385646641528076), - FRAC_CONST(0.2405048572790267), - FRAC_CONST(0.2424523607157545), - FRAC_CONST(0.2444071336380283), - FRAC_CONST(0.2463691346912334), - FRAC_CONST(0.2483383219931741), - FRAC_CONST(0.2503146531361985), - FRAC_CONST(0.2522980851893767), - FRAC_CONST(0.2542885747007335), - FRAC_CONST(0.2562860776995335), - FRAC_CONST(0.2582905496986215), - FRAC_CONST(0.2603019456968142), - FRAC_CONST(0.2623202201813464), - FRAC_CONST(0.2643453271303700), - FRAC_CONST(0.2663772200155053), - FRAC_CONST(0.2684158518044454), - FRAC_CONST(0.2704611749636135), - FRAC_CONST(0.2725131414608710), - FRAC_CONST(0.2745717027682799), - FRAC_CONST(0.2766368098649151), - FRAC_CONST(0.2787084132397296), - FRAC_CONST(0.2807864628944707), - FRAC_CONST(0.2828709083466482), - FRAC_CONST(0.2849616986325523), - FRAC_CONST(0.2870587823103237), - FRAC_CONST(0.2891621074630737), - FRAC_CONST(0.2912716217020546), - FRAC_CONST(0.2933872721698803), - FRAC_CONST(0.2955090055437973), - FRAC_CONST(0.2976367680390041), - FRAC_CONST(0.2997705054120213), - FRAC_CONST(0.3019101629641097), - FRAC_CONST(0.3040556855447379), - FRAC_CONST(0.3062070175550981), - FRAC_CONST(0.3083641029516701), - FRAC_CONST(0.3105268852498334), - FRAC_CONST(0.3126953075275265), - FRAC_CONST(0.3148693124289546), - FRAC_CONST(0.3170488421683428), - FRAC_CONST(0.3192338385337370), - FRAC_CONST(0.3214242428908514), - FRAC_CONST(0.3236199961869606), - FRAC_CONST(0.3258210389548392), - FRAC_CONST(0.3280273113167459), - FRAC_CONST(0.3302387529884521), - FRAC_CONST(0.3324553032833160), - FRAC_CONST(0.3346769011164010), - FRAC_CONST(0.3369034850086373), - FRAC_CONST(0.3391349930910280), - FRAC_CONST(0.3413713631088974), - FRAC_CONST(0.3436125324261830), - FRAC_CONST(0.3458584380297697), - FRAC_CONST(0.3481090165338656), - FRAC_CONST(0.3503642041844199), - FRAC_CONST(0.3526239368635820), - FRAC_CONST(0.3548881500942010), - FRAC_CONST(0.3571567790443668), - FRAC_CONST(0.3594297585319891), - FRAC_CONST(0.3617070230294185), - FRAC_CONST(0.3639885066681048), - FRAC_CONST(0.3662741432432950), - FRAC_CONST(0.3685638662187693), - FRAC_CONST(0.3708576087316147), - FRAC_CONST(0.3731553035970366), - FRAC_CONST(0.3754568833132069), - FRAC_CONST(0.3777622800661488), - FRAC_CONST(0.3800714257346570), - FRAC_CONST(0.3823842518952546), - FRAC_CONST(0.3847006898271841), - FRAC_CONST(0.3870206705174334), - FRAC_CONST(0.3893441246657958), - FRAC_CONST(0.3916709826899639), - FRAC_CONST(0.3940011747306560), - FRAC_CONST(0.3963346306567764), - FRAC_CONST(0.3986712800706062), - FRAC_CONST(0.4010110523130271), - FRAC_CONST(0.4033538764687756), - FRAC_CONST(0.4056996813717284), - FRAC_CONST(0.4080483956102172), - FRAC_CONST(0.4103999475323736), - FRAC_CONST(0.4127542652515031), - FRAC_CONST(0.4151112766514873), - FRAC_CONST(0.4174709093922143), - FRAC_CONST(0.4198330909150365), - FRAC_CONST(0.4221977484482556), - FRAC_CONST(0.4245648090126334), - FRAC_CONST(0.4269341994269293), - FRAC_CONST(0.4293058463134616), - FRAC_CONST(0.4316796761036958), - FRAC_CONST(0.4340556150438547), - FRAC_CONST(0.4364335892005536), - FRAC_CONST(0.4388135244664580), - FRAC_CONST(0.4411953465659639), - FRAC_CONST(0.4435789810609000), - FRAC_CONST(0.4459643533562509), - FRAC_CONST(0.4483513887059016), - FRAC_CONST(0.4507400122184019), - FRAC_CONST(0.4531301488627497), - FRAC_CONST(0.4555217234741947), - FRAC_CONST(0.4579146607600593), - FRAC_CONST(0.4603088853055777), - FRAC_CONST(0.4627043215797521), - FRAC_CONST(0.4651008939412254), - FRAC_CONST(0.4674985266441709), - FRAC_CONST(0.4698971438441951), - FRAC_CONST(0.4722966696042580), - FRAC_CONST(0.4746970279006055), - FRAC_CONST(0.4770981426287164), - FRAC_CONST(0.4794999376092619), - FRAC_CONST(0.4819023365940778), - FRAC_CONST(0.4843052632721476), - FRAC_CONST(0.4867086412755978), - FRAC_CONST(0.4891123941857028), - FRAC_CONST(0.4915164455388997), - FRAC_CONST(0.4939207188328126), - FRAC_CONST(0.4963251375322855), - FRAC_CONST(0.4987296250754225), - FRAC_CONST(0.5011341048796359), - FRAC_CONST(0.5035385003477012), - FRAC_CONST(0.5059427348738168), - FRAC_CONST(0.5083467318496706), - FRAC_CONST(0.5107504146705106), - FRAC_CONST(0.5131537067412193), - FRAC_CONST(0.5155565314823923), - FRAC_CONST(0.5179588123364193), - FRAC_CONST(0.5203604727735667), - FRAC_CONST(0.5227614362980630), - FRAC_CONST(0.5251616264541841), - FRAC_CONST(0.5275609668323384), - FRAC_CONST(0.5299593810751532), - FRAC_CONST(0.5323567928835578), - FRAC_CONST(0.5347531260228663), - FRAC_CONST(0.5371483043288580), - FRAC_CONST(0.5395422517138538), - FRAC_CONST(0.5419348921727899), - FRAC_CONST(0.5443261497892862), - FRAC_CONST(0.5467159487417104), - FRAC_CONST(0.5491042133092364), - FRAC_CONST(0.5514908678778958), - FRAC_CONST(0.5538758369466227), - FRAC_CONST(0.5562590451332913), - FRAC_CONST(0.5586404171807443), - FRAC_CONST(0.5610198779628133), - FRAC_CONST(0.5633973524903286), - FRAC_CONST(0.5657727659171199), - FRAC_CONST(0.5681460435460047), - FRAC_CONST(0.5705171108347663), - FRAC_CONST(0.5728858934021188), - FRAC_CONST(0.5752523170336598), - FRAC_CONST(0.5776163076878088), - FRAC_CONST(0.5799777915017323), - FRAC_CONST(0.5823366947972535), - FRAC_CONST(0.5846929440867458), - FRAC_CONST(0.5870464660790119), - FRAC_CONST(0.5893971876851449), - FRAC_CONST(0.5917450360243719), - FRAC_CONST(0.5940899384298793), - FRAC_CONST(0.5964318224546208), - FRAC_CONST(0.5987706158771039), - FRAC_CONST(0.6011062467071583), - FRAC_CONST(0.6034386431916822), - FRAC_CONST(0.6057677338203681), - FRAC_CONST(0.6080934473314057), - FRAC_CONST(0.6104157127171639), - FRAC_CONST(0.6127344592298474), - FRAC_CONST(0.6150496163871310), - FRAC_CONST(0.6173611139777690), - FRAC_CONST(0.6196688820671789), - FRAC_CONST(0.6219728510029997), - FRAC_CONST(0.6242729514206247), - FRAC_CONST(0.6265691142487051), - FRAC_CONST(0.6288612707146283), - FRAC_CONST(0.6311493523499663), - FRAC_CONST(0.6334332909958958), - FRAC_CONST(0.6357130188085891), - FRAC_CONST(0.6379884682645743), - FRAC_CONST(0.6402595721660647), - FRAC_CONST(0.6425262636462578), - FRAC_CONST(0.6447884761746012), - FRAC_CONST(0.6470461435620266), - FRAC_CONST(0.6492991999661505), - FRAC_CONST(0.6515475798964411), - FRAC_CONST(0.6537912182193508), - FRAC_CONST(0.6560300501634142), - FRAC_CONST(0.6582640113243098), - FRAC_CONST(0.6604930376698862), - FRAC_CONST(0.6627170655451516), - FRAC_CONST(0.6649360316772256), - FRAC_CONST(0.6671498731802533), - FRAC_CONST(0.6693585275602818), - FRAC_CONST(0.6715619327200959), - FRAC_CONST(0.6737600269640164), - FRAC_CONST(0.6759527490026566), - FRAC_CONST(0.6781400379576392), - FRAC_CONST(0.6803218333662715), - FRAC_CONST(0.6824980751861787), - FRAC_CONST(0.6846687037998949), - FRAC_CONST(0.6868336600194123), - FRAC_CONST(0.6889928850906855), - FRAC_CONST(0.6911463206980928), - FRAC_CONST(0.6932939089688525), - FRAC_CONST(0.6954355924773949), - FRAC_CONST(0.6975713142496884), - FRAC_CONST(0.6997010177675195), - FRAC_CONST(0.7018246469727265), - FRAC_CONST(0.7039421462713862), - FRAC_CONST(0.7060534605379528), - FRAC_CONST(0.7081585351193496), - FRAC_CONST(0.7102573158390105), - FRAC_CONST(0.7123497490008750), - FRAC_CONST(0.7144357813933307), - FRAC_CONST(0.7165153602931092), - FRAC_CONST(0.7185884334691287), - FRAC_CONST(0.7206549491862871), - FRAC_CONST(0.7227148562092042), - FRAC_CONST(0.7247681038059106), - FRAC_CONST(0.7268146417514855), - FRAC_CONST(0.7288544203316418), - FRAC_CONST(0.7308873903462577), - FRAC_CONST(0.7329135031128549), - FRAC_CONST(0.7349327104700221), - FRAC_CONST(0.7369449647807855), - FRAC_CONST(0.7389502189359237), - FRAC_CONST(0.7409484263572271), - FRAC_CONST(0.7429395410007016), - FRAC_CONST(0.7449235173597176), - FRAC_CONST(0.7469003104681008), - FRAC_CONST(0.7488698759031670), - FRAC_CONST(0.7508321697887005), - FRAC_CONST(0.7527871487978728), - FRAC_CONST(0.7547347701561059), - FRAC_CONST(0.7566749916438754), - FRAC_CONST(0.7586077715994560), - FRAC_CONST(0.7605330689216074), - FRAC_CONST(0.7624508430722016), - FRAC_CONST(0.7643610540787891), - FRAC_CONST(0.7662636625371070), - FRAC_CONST(0.7681586296135255), - FRAC_CONST(0.7700459170474343), - FRAC_CONST(0.7719254871535672), - FRAC_CONST(0.7737973028242671), - FRAC_CONST(0.7756613275316875), - FRAC_CONST(0.7775175253299340), - FRAC_CONST(0.7793658608571425), - FRAC_CONST(0.7812062993374951), - FRAC_CONST(0.7830388065831744), - FRAC_CONST(0.7848633489962533), - FRAC_CONST(0.7866798935705233), - FRAC_CONST(0.7884884078932579), - FRAC_CONST(0.7902888601469138), - FRAC_CONST(0.7920812191107668), - FRAC_CONST(0.7938654541624850), - FRAC_CONST(0.7956415352796368), - FRAC_CONST(0.7974094330411343), - FRAC_CONST(0.7991691186286133), - FRAC_CONST(0.8009205638277465), - FRAC_CONST(0.8026637410294932), - FRAC_CONST(0.8043986232312831), - FRAC_CONST(0.8061251840381346), - FRAC_CONST(0.8078433976637077), - FRAC_CONST(0.8095532389312917), - FRAC_CONST(0.8112546832747255), - FRAC_CONST(0.8129477067392539), - FRAC_CONST(0.8146322859823164), - FRAC_CONST(0.8163083982742698), - FRAC_CONST(0.8179760214990457), - FRAC_CONST(0.8196351341547393), - FRAC_CONST(0.8212857153541345), - FRAC_CONST(0.8229277448251595), - FRAC_CONST(0.8245612029112778), - FRAC_CONST(0.8261860705718113), - FRAC_CONST(0.8278023293821971), - FRAC_CONST(0.8294099615341773), - FRAC_CONST(0.8310089498359212), - FRAC_CONST(0.8325992777120815), - FRAC_CONST(0.8341809292037831), - FRAC_CONST(0.8357538889685445), - FRAC_CONST(0.8373181422801330), - FRAC_CONST(0.8388736750283521), - FRAC_CONST(0.8404204737187619), - FRAC_CONST(0.8419585254723335), - FRAC_CONST(0.8434878180250348), - FRAC_CONST(0.8450083397273509), - FRAC_CONST(0.8465200795437368), - FRAC_CONST(0.8480230270520029), - FRAC_CONST(0.8495171724426350), - FRAC_CONST(0.8510025065180464), - FRAC_CONST(0.8524790206917633), - FRAC_CONST(0.8539467069875448), - FRAC_CONST(0.8554055580384357), - FRAC_CONST(0.8568555670857525), - FRAC_CONST(0.8582967279780043), - FRAC_CONST(0.8597290351697464), - FRAC_CONST(0.8611524837203691), - FRAC_CONST(0.8625670692928198), - FRAC_CONST(0.8639727881522599), - FRAC_CONST(0.8653696371646555), - FRAC_CONST(0.8667576137953045), - FRAC_CONST(0.8681367161072958), - FRAC_CONST(0.8695069427599065), - FRAC_CONST(0.8708682930069319), - FRAC_CONST(0.8722207666949527), - FRAC_CONST(0.8735643642615368), - FRAC_CONST(0.8748990867333771), - FRAC_CONST(0.8762249357243662), - FRAC_CONST(0.8775419134336067), - FRAC_CONST(0.8788500226433579), - FRAC_CONST(0.8801492667169208), - FRAC_CONST(0.8814396495964587), - FRAC_CONST(0.8827211758007560), - FRAC_CONST(0.8839938504229149), - FRAC_CONST(0.8852576791279895), - FRAC_CONST(0.8865126681505587), - FRAC_CONST(0.8877588242922386), - FRAC_CONST(0.8889961549191320), - FRAC_CONST(0.8902246679592184), - FRAC_CONST(0.8914443718996848), - FRAC_CONST(0.8926552757841945), - FRAC_CONST(0.8938573892100969), - FRAC_CONST(0.8950507223255798), - FRAC_CONST(0.8962352858267605), - FRAC_CONST(0.8974110909547198), - FRAC_CONST(0.8985781494924783), - FRAC_CONST(0.8997364737619142), - FRAC_CONST(0.9008860766206249), - FRAC_CONST(0.9020269714587307), - FRAC_CONST(0.9031591721956235), - FRAC_CONST(0.9042826932766591), - FRAC_CONST(0.9053975496697941), - FRAC_CONST(0.9065037568621681), - FRAC_CONST(0.9076013308566311), - FRAC_CONST(0.9086902881682180), - FRAC_CONST(0.9097706458205682), - FRAC_CONST(0.9108424213422940), - FRAC_CONST(0.9119056327632955), - FRAC_CONST(0.9129602986110235), - FRAC_CONST(0.9140064379066919), - FRAC_CONST(0.9150440701614393), - FRAC_CONST(0.9160732153724396), - FRAC_CONST(0.9170938940189634), - FRAC_CONST(0.9181061270583908), - FRAC_CONST(0.9191099359221748), - FRAC_CONST(0.9201053425117579), - FRAC_CONST(0.9210923691944400), - FRAC_CONST(0.9220710387992010), - FRAC_CONST(0.9230413746124764), - FRAC_CONST(0.9240034003738882), - FRAC_CONST(0.9249571402719298), - FRAC_CONST(0.9259026189396085), - FRAC_CONST(0.9268398614500427), - FRAC_CONST(0.9277688933120170), - FRAC_CONST(0.9286897404654957), - FRAC_CONST(0.9296024292770939), - FRAC_CONST(0.9305069865355076), - FRAC_CONST(0.9314034394469048), - FRAC_CONST(0.9322918156302762), - FRAC_CONST(0.9331721431127471), - FRAC_CONST(0.9340444503248519), - FRAC_CONST(0.9349087660957711), - FRAC_CONST(0.9357651196485313), - FRAC_CONST(0.9366135405951697), - FRAC_CONST(0.9374540589318637), - FRAC_CONST(0.9382867050340261), - FRAC_CONST(0.9391115096513655), - FRAC_CONST(0.9399285039029165), - FRAC_CONST(0.9407377192720349), - FRAC_CONST(0.9415391876013639), - FRAC_CONST(0.9423329410877687), - FRAC_CONST(0.9431190122772415), - FRAC_CONST(0.9438974340597782), - FRAC_CONST(0.9446682396642262), - FRAC_CONST(0.9454314626531054), - FRAC_CONST(0.9461871369174033), - FRAC_CONST(0.9469352966713429), - FRAC_CONST(0.9476759764471278), - FRAC_CONST(0.9484092110896616), - FRAC_CONST(0.9491350357512457), - FRAC_CONST(0.9498534858862532), - FRAC_CONST(0.9505645972457831), - FRAC_CONST(0.9512684058722927), - FRAC_CONST(0.9519649480942105), - FRAC_CONST(0.9526542605205314), - FRAC_CONST(0.9533363800353921), - FRAC_CONST(0.9540113437926313), - FRAC_CONST(0.9546791892103320), - FRAC_CONST(0.9553399539653500), - FRAC_CONST(0.9559936759878265), - FRAC_CONST(0.9566403934556893), - FRAC_CONST(0.9572801447891388), - FRAC_CONST(0.9579129686451244), - FRAC_CONST(0.9585389039118085), - FRAC_CONST(0.9591579897030224), - FRAC_CONST(0.9597702653527108), - FRAC_CONST(0.9603757704093711), - FRAC_CONST(0.9609745446304828), - FRAC_CONST(0.9615666279769324), - FRAC_CONST(0.9621520606074324), - FRAC_CONST(0.9627308828729358), - FRAC_CONST(0.9633031353110477), - FRAC_CONST(0.9638688586404335), - FRAC_CONST(0.9644280937552258), - FRAC_CONST(0.9649808817194311), - FRAC_CONST(0.9655272637613366), - FRAC_CONST(0.9660672812679171), - FRAC_CONST(0.9666009757792454), - FRAC_CONST(0.9671283889829055), - FRAC_CONST(0.9676495627084089), - FRAC_CONST(0.9681645389216160), - FRAC_CONST(0.9686733597191652), - FRAC_CONST(0.9691760673229058), - FRAC_CONST(0.9696727040743406), - FRAC_CONST(0.9701633124290767), - FRAC_CONST(0.9706479349512860), - FRAC_CONST(0.9711266143081750), - FRAC_CONST(0.9715993932644684), - FRAC_CONST(0.9720663146769026), - FRAC_CONST(0.9725274214887337), - FRAC_CONST(0.9729827567242596), - FRAC_CONST(0.9734323634833574), - FRAC_CONST(0.9738762849360358), - FRAC_CONST(0.9743145643170059), - FRAC_CONST(0.9747472449202687), - FRAC_CONST(0.9751743700937215), - FRAC_CONST(0.9755959832337850), - FRAC_CONST(0.9760121277800496), - FRAC_CONST(0.9764228472099433), - FRAC_CONST(0.9768281850334235), - FRAC_CONST(0.9772281847876897), - FRAC_CONST(0.9776228900319223), - FRAC_CONST(0.9780123443420448), - FRAC_CONST(0.9783965913055132), - FRAC_CONST(0.9787756745161313), - FRAC_CONST(0.9791496375688939), - FRAC_CONST(0.9795185240548578), - FRAC_CONST(0.9798823775560431), - FRAC_CONST(0.9802412416403639), - FRAC_CONST(0.9805951598565897), - FRAC_CONST(0.9809441757293399), - FRAC_CONST(0.9812883327541090), - FRAC_CONST(0.9816276743923267), - FRAC_CONST(0.9819622440664515), - FRAC_CONST(0.9822920851550995), - FRAC_CONST(0.9826172409882086), - FRAC_CONST(0.9829377548422400), - FRAC_CONST(0.9832536699354163), - FRAC_CONST(0.9835650294229984), - FRAC_CONST(0.9838718763926001), - FRAC_CONST(0.9841742538595437), - FRAC_CONST(0.9844722047622547), - FRAC_CONST(0.9847657719576983), - FRAC_CONST(0.9850549982168574), - FRAC_CONST(0.9853399262202529), - FRAC_CONST(0.9856205985535073), - FRAC_CONST(0.9858970577029519), - FRAC_CONST(0.9861693460512790), - FRAC_CONST(0.9864375058732389), - FRAC_CONST(0.9867015793313820), - FRAC_CONST(0.9869616084718489), - FRAC_CONST(0.9872176352202061), - FRAC_CONST(0.9874697013773301), - FRAC_CONST(0.9877178486153397), - FRAC_CONST(0.9879621184735767), - FRAC_CONST(0.9882025523546365), - FRAC_CONST(0.9884391915204485), - FRAC_CONST(0.9886720770884069), - FRAC_CONST(0.9889012500275530), - FRAC_CONST(0.9891267511548089), - FRAC_CONST(0.9893486211312621), - FRAC_CONST(0.9895669004585049), - FRAC_CONST(0.9897816294750255), - FRAC_CONST(0.9899928483526520), - FRAC_CONST(0.9902005970930525), - FRAC_CONST(0.9904049155242876), - FRAC_CONST(0.9906058432974180), - FRAC_CONST(0.9908034198831690), - FRAC_CONST(0.9909976845686489), - FRAC_CONST(0.9911886764541239), - FRAC_CONST(0.9913764344498495), - FRAC_CONST(0.9915609972729590), - FRAC_CONST(0.9917424034444086), - FRAC_CONST(0.9919206912859797), - FRAC_CONST(0.9920958989173397), - FRAC_CONST(0.9922680642531603), - FRAC_CONST(0.9924372250002933), - FRAC_CONST(0.9926034186550070), - FRAC_CONST(0.9927666825002789), - FRAC_CONST(0.9929270536031491), - FRAC_CONST(0.9930845688121325), - FRAC_CONST(0.9932392647546895), - FRAC_CONST(0.9933911778347579), - FRAC_CONST(0.9935403442303433), - FRAC_CONST(0.9936867998911693), - FRAC_CONST(0.9938305805363887), - FRAC_CONST(0.9939717216523539), - FRAC_CONST(0.9941102584904481), - FRAC_CONST(0.9942462260649764), - FRAC_CONST(0.9943796591511174), - FRAC_CONST(0.9945105922829353), - FRAC_CONST(0.9946390597514524), - FRAC_CONST(0.9947650956027824), - FRAC_CONST(0.9948887336363228), - FRAC_CONST(0.9950100074030103), - FRAC_CONST(0.9951289502036336), - FRAC_CONST(0.9952455950872091), - FRAC_CONST(0.9953599748494155), - FRAC_CONST(0.9954721220310890), - FRAC_CONST(0.9955820689167787), - FRAC_CONST(0.9956898475333619), - FRAC_CONST(0.9957954896487196), - FRAC_CONST(0.9958990267704713), - FRAC_CONST(0.9960004901447701), - FRAC_CONST(0.9960999107551559), - FRAC_CONST(0.9961973193214694), - FRAC_CONST(0.9962927462988245), - FRAC_CONST(0.9963862218766388), - FRAC_CONST(0.9964777759777242), - FRAC_CONST(0.9965674382574342), - FRAC_CONST(0.9966552381028704), - FRAC_CONST(0.9967412046321465), - FRAC_CONST(0.9968253666937095), - FRAC_CONST(0.9969077528657186), - FRAC_CONST(0.9969883914554805), - FRAC_CONST(0.9970673104989413), - FRAC_CONST(0.9971445377602348), - FRAC_CONST(0.9972201007312871), - FRAC_CONST(0.9972940266314749), - FRAC_CONST(0.9973663424073412), - FRAC_CONST(0.9974370747323638), - FRAC_CONST(0.9975062500067785), - FRAC_CONST(0.9975738943574574), - FRAC_CONST(0.9976400336378379), - FRAC_CONST(0.9977046934279079), - FRAC_CONST(0.9977678990342401), - FRAC_CONST(0.9978296754900812), - FRAC_CONST(0.9978900475554902), - FRAC_CONST(0.9979490397175296), - FRAC_CONST(0.9980066761905056), - FRAC_CONST(0.9980629809162593), - FRAC_CONST(0.9981179775645063), - FRAC_CONST(0.9981716895332257), - FRAC_CONST(0.9982241399490979), - FRAC_CONST(0.9982753516679893), - FRAC_CONST(0.9983253472754841), - FRAC_CONST(0.9983741490874634), - FRAC_CONST(0.9984217791507299), - FRAC_CONST(0.9984682592436778), - FRAC_CONST(0.9985136108770075), - FRAC_CONST(0.9985578552944850), - FRAC_CONST(0.9986010134737439), - FRAC_CONST(0.9986431061271304), - FRAC_CONST(0.9986841537025921), - FRAC_CONST(0.9987241763846056), - FRAC_CONST(0.9987631940951476), - FRAC_CONST(0.9988012264947044), - FRAC_CONST(0.9988382929833222), - FRAC_CONST(0.9988744127016956), - FRAC_CONST(0.9989096045322947), - FRAC_CONST(0.9989438871005292), - FRAC_CONST(0.9989772787759494), - FRAC_CONST(0.9990097976734847), - FRAC_CONST(0.9990414616547146), - FRAC_CONST(0.9990722883291779), - FRAC_CONST(0.9991022950557125), - FRAC_CONST(0.9991314989438310), - FRAC_CONST(0.9991599168551279), - FRAC_CONST(0.9991875654047181), - FRAC_CONST(0.9992144609627068), - FRAC_CONST(0.9992406196556911), - FRAC_CONST(0.9992660573682882), - FRAC_CONST(0.9992907897446957), - FRAC_CONST(0.9993148321902777), - FRAC_CONST(0.9993381998731797), - FRAC_CONST(0.9993609077259696), - FRAC_CONST(0.9993829704473038), - FRAC_CONST(0.9994044025036201), - FRAC_CONST(0.9994252181308537), - FRAC_CONST(0.9994454313361775), - FRAC_CONST(0.9994650558997651), - FRAC_CONST(0.9994841053765757), - FRAC_CONST(0.9995025930981609), - FRAC_CONST(0.9995205321744921), - FRAC_CONST(0.9995379354958073), - FRAC_CONST(0.9995548157344778), - FRAC_CONST(0.9995711853468930), - FRAC_CONST(0.9995870565753632), - FRAC_CONST(0.9996024414500382), - FRAC_CONST(0.9996173517908444), - FRAC_CONST(0.9996317992094352), - FRAC_CONST(0.9996457951111574), - FRAC_CONST(0.9996593506970310), - FRAC_CONST(0.9996724769657434), - FRAC_CONST(0.9996851847156547), - FRAC_CONST(0.9996974845468164), - FRAC_CONST(0.9997093868630000), - FRAC_CONST(0.9997209018737374), - FRAC_CONST(0.9997320395963699), - FRAC_CONST(0.9997428098581069), - FRAC_CONST(0.9997532222980933), - FRAC_CONST(0.9997632863694836), - FRAC_CONST(0.9997730113415246), - FRAC_CONST(0.9997824063016426), - FRAC_CONST(0.9997914801575380), - FRAC_CONST(0.9998002416392840), - FRAC_CONST(0.9998086993014300), - FRAC_CONST(0.9998168615251084), - FRAC_CONST(0.9998247365201450), - FRAC_CONST(0.9998323323271717), - FRAC_CONST(0.9998396568197407), - FRAC_CONST(0.9998467177064404), - FRAC_CONST(0.9998535225330116), - FRAC_CONST(0.9998600786844637), - FRAC_CONST(0.9998663933871905), - FRAC_CONST(0.9998724737110845), - FRAC_CONST(0.9998783265716498), - FRAC_CONST(0.9998839587321121), - FRAC_CONST(0.9998893768055266), - FRAC_CONST(0.9998945872568815), - FRAC_CONST(0.9998995964051983), - FRAC_CONST(0.9999044104256269), - FRAC_CONST(0.9999090353515359), - FRAC_CONST(0.9999134770765971), - FRAC_CONST(0.9999177413568642), - FRAC_CONST(0.9999218338128448), - FRAC_CONST(0.9999257599315647), - FRAC_CONST(0.9999295250686255), - FRAC_CONST(0.9999331344502529), - FRAC_CONST(0.9999365931753376), - FRAC_CONST(0.9999399062174669), - FRAC_CONST(0.9999430784269460), - FRAC_CONST(0.9999461145328103), - FRAC_CONST(0.9999490191448277), - FRAC_CONST(0.9999517967554878), - FRAC_CONST(0.9999544517419835), - FRAC_CONST(0.9999569883681778), - FRAC_CONST(0.9999594107865607), - FRAC_CONST(0.9999617230401926), - FRAC_CONST(0.9999639290646355), - FRAC_CONST(0.9999660326898712), - FRAC_CONST(0.9999680376422052), - FRAC_CONST(0.9999699475461585), - FRAC_CONST(0.9999717659263435), - FRAC_CONST(0.9999734962093266), - FRAC_CONST(0.9999751417254756), - FRAC_CONST(0.9999767057107922), - FRAC_CONST(0.9999781913087290), - FRAC_CONST(0.9999796015719915), - FRAC_CONST(0.9999809394643231), - FRAC_CONST(0.9999822078622751), - FRAC_CONST(0.9999834095569596), - FRAC_CONST(0.9999845472557860), - FRAC_CONST(0.9999856235841805), - FRAC_CONST(0.9999866410872889), - FRAC_CONST(0.9999876022316609), - FRAC_CONST(0.9999885094069193), - FRAC_CONST(0.9999893649274085), - FRAC_CONST(0.9999901710338274), - FRAC_CONST(0.9999909298948430), - FRAC_CONST(0.9999916436086862), - FRAC_CONST(0.9999923142047299), - FRAC_CONST(0.9999929436450469), - FRAC_CONST(0.9999935338259505), - FRAC_CONST(0.9999940865795161), - FRAC_CONST(0.9999946036750835), - FRAC_CONST(0.9999950868207405), - FRAC_CONST(0.9999955376647868), - FRAC_CONST(0.9999959577971798), - FRAC_CONST(0.9999963487509599), - FRAC_CONST(0.9999967120036571), - FRAC_CONST(0.9999970489786785), - FRAC_CONST(0.9999973610466748), - FRAC_CONST(0.9999976495268890), - FRAC_CONST(0.9999979156884846), - FRAC_CONST(0.9999981607518545), - FRAC_CONST(0.9999983858899099), - FRAC_CONST(0.9999985922293493), - FRAC_CONST(0.9999987808519092), - FRAC_CONST(0.9999989527955938), - FRAC_CONST(0.9999991090558848), - FRAC_CONST(0.9999992505869332), - FRAC_CONST(0.9999993783027293), - FRAC_CONST(0.9999994930782556), - FRAC_CONST(0.9999995957506171), - FRAC_CONST(0.9999996871201549), - FRAC_CONST(0.9999997679515386), - FRAC_CONST(0.9999998389748399), - FRAC_CONST(0.9999999008865869), - FRAC_CONST(0.9999999543507984) -}; -#endif - -ALIGN static const real_t kbd_short_128[] = -{ - FRAC_CONST(4.3795702929468881e-005), - FRAC_CONST(0.00011867384265436617), - FRAC_CONST(0.0002307165763996192), - FRAC_CONST(0.00038947282760568383), - FRAC_CONST(0.00060581272288302553), - FRAC_CONST(0.00089199695169487453), - FRAC_CONST(0.0012617254423430522), - FRAC_CONST(0.0017301724373162003), - FRAC_CONST(0.0023140071937421476), - FRAC_CONST(0.0030313989666022221), - FRAC_CONST(0.0039020049735530842), - FRAC_CONST(0.0049469401815512024), - FRAC_CONST(0.0061887279335368318), - FRAC_CONST(0.0076512306364647726), - FRAC_CONST(0.0093595599562652423), - FRAC_CONST(0.011339966208377799), - FRAC_CONST(0.013619706891715299), - FRAC_CONST(0.016226894586323766), - FRAC_CONST(0.019190324717288168), - FRAC_CONST(0.022539283975960878), - FRAC_CONST(0.026303340480472455), - FRAC_CONST(0.030512117046644357), - FRAC_CONST(0.03519504922365594), - FRAC_CONST(0.040381130021856941), - FRAC_CONST(0.046098643518702249), - FRAC_CONST(0.052374889768730587), - FRAC_CONST(0.059235903660769147), - FRAC_CONST(0.066706170556282418), - FRAC_CONST(0.074808341703430481), - FRAC_CONST(0.083562952548726227), - FRAC_CONST(0.092988147159339674), - FRAC_CONST(0.1030994120216919), - FRAC_CONST(0.11390932249409955), - FRAC_CONST(0.12542730516149531), - FRAC_CONST(0.13765941926783826), - FRAC_CONST(0.15060816028651081), - FRAC_CONST(0.16427228853114245), - FRAC_CONST(0.17864668550988483), - FRAC_CONST(0.19372224048676889), - FRAC_CONST(0.20948576943658073), - FRAC_CONST(0.22591996826744942), - FRAC_CONST(0.24300340184133981), - FRAC_CONST(0.26071052995068139), - FRAC_CONST(0.27901177101369551), - FRAC_CONST(0.29787360383626599), - FRAC_CONST(0.3172587073594233), - FRAC_CONST(0.33712613787396362), - FRAC_CONST(0.35743154274286698), - FRAC_CONST(0.37812740923363009), - FRAC_CONST(0.39916334663203618), - FRAC_CONST(0.42048639939189658), - FRAC_CONST(0.4420413886774246), - FRAC_CONST(0.4637712792815169), - FRAC_CONST(0.4856175685594023), - FRAC_CONST(0.50752069370766872), - FRAC_CONST(0.52942045344797806), - FRAC_CONST(0.55125643994680196), - FRAC_CONST(0.57296847662071559), - FRAC_CONST(0.59449705734411495), - FRAC_CONST(0.61578378249506627), - FRAC_CONST(0.63677178724712891), - FRAC_CONST(0.65740615754163356), - FRAC_CONST(0.67763432925662526), - FRAC_CONST(0.69740646622548552), - FRAC_CONST(0.71667581294953808), - FRAC_CONST(0.73539901809352737), - FRAC_CONST(0.75353642514900732), - FRAC_CONST(0.77105232699609816), - FRAC_CONST(0.78791518148597028), - FRAC_CONST(0.80409778560147072), - FRAC_CONST(0.81957740622770781), - FRAC_CONST(0.83433586607383625), - FRAC_CONST(0.84835958382689225), - FRAC_CONST(0.86163956818294229), - FRAC_CONST(0.87417136598406997), - FRAC_CONST(0.88595496528524853), - FRAC_CONST(0.89699465477567619), - FRAC_CONST(0.90729884157670959), - FRAC_CONST(0.91687983002436779), - FRAC_CONST(0.92575356460899649), - FRAC_CONST(0.93393934077779084), - FRAC_CONST(0.94145948779657318), - FRAC_CONST(0.94833902830402828), - FRAC_CONST(0.95460531956280026), - FRAC_CONST(0.96028768170574896), - FRAC_CONST(0.96541701848104766), - FRAC_CONST(0.97002543610646474), - FRAC_CONST(0.97414586584250062), - FRAC_CONST(0.97781169577969584), - FRAC_CONST(0.98105641710392333), - FRAC_CONST(0.98391328975491177), - FRAC_CONST(0.98641503193166202), - FRAC_CONST(0.98859353733226141), - FRAC_CONST(0.99047962335771556), - FRAC_CONST(0.9921028127769449), - FRAC_CONST(0.99349115056397752), - FRAC_CONST(0.99467105680259038), - FRAC_CONST(0.9956672157341897), - FRAC_CONST(0.99650250022834352), - FRAC_CONST(0.99719793020823266), - FRAC_CONST(0.99777266288955657), - FRAC_CONST(0.99824401211201486), - FRAC_CONST(0.99862749357391212), - FRAC_CONST(0.99893689243401962), - FRAC_CONST(0.99918434952623147), - FRAC_CONST(0.99938046234161726), - FRAC_CONST(0.99953439696357238), - FRAC_CONST(0.99965400728430465), - FRAC_CONST(0.99974595807027455), - FRAC_CONST(0.99981584876278362), - FRAC_CONST(0.99986833527824281), - FRAC_CONST(0.99990724749057802), - FRAC_CONST(0.99993570051598468), - FRAC_CONST(0.99995619835942084), - FRAC_CONST(0.99997072890647543), - FRAC_CONST(0.9999808496399144), - FRAC_CONST(0.99998776381655818), - FRAC_CONST(0.99999238714961569), - FRAC_CONST(0.99999540529959718), - FRAC_CONST(0.99999732268176988), - FRAC_CONST(0.99999850325054862), - FRAC_CONST(0.99999920402413744), - FRAC_CONST(0.9999996021706401), - FRAC_CONST(0.99999981649545566), - FRAC_CONST(0.99999992415545547), - FRAC_CONST(0.99999997338493041), - FRAC_CONST(0.99999999295825959), - FRAC_CONST(0.99999999904096815) -}; - -#ifdef ALLOW_SMALL_FRAMELENGTH -ALIGN static const real_t kbd_short_120[] = -{ - FRAC_CONST(0.0000452320086910), - FRAC_CONST(0.0001274564692111), - FRAC_CONST(0.0002529398385345), - FRAC_CONST(0.0004335140496648), - FRAC_CONST(0.0006827100966952), - FRAC_CONST(0.0010158708222246), - FRAC_CONST(0.0014502162869659), - FRAC_CONST(0.0020048865156264), - FRAC_CONST(0.0027009618393178), - FRAC_CONST(0.0035614590925043), - FRAC_CONST(0.0046113018122711), - FRAC_CONST(0.0058772627936484), - FRAC_CONST(0.0073878776584103), - FRAC_CONST(0.0091733284512589), - FRAC_CONST(0.0112652966728373), - FRAC_CONST(0.0136967855861945), - FRAC_CONST(0.0165019120857793), - FRAC_CONST(0.0197156688892217), - FRAC_CONST(0.0233736582950619), - FRAC_CONST(0.0275117992367496), - FRAC_CONST(0.0321660098468534), - FRAC_CONST(0.0373718682174417), - FRAC_CONST(0.0431642544948834), - FRAC_CONST(0.0495769778717676), - FRAC_CONST(0.0566423924273392), - FRAC_CONST(0.0643910061132260), - FRAC_CONST(0.0728510874761729), - FRAC_CONST(0.0820482749475221), - FRAC_CONST(0.0920051937045235), - FRAC_CONST(0.1027410852163450), - FRAC_CONST(0.1142714546239370), - FRAC_CONST(0.1266077410648368), - FRAC_CONST(0.1397570159398145), - FRAC_CONST(0.1537217139274270), - FRAC_CONST(0.1684994012857075), - FRAC_CONST(0.1840825856392944), - FRAC_CONST(0.2004585710384133), - FRAC_CONST(0.2176093615976121), - FRAC_CONST(0.2355116164824983), - FRAC_CONST(0.2541366584185075), - FRAC_CONST(0.2734505372545160), - FRAC_CONST(0.2934141494343369), - FRAC_CONST(0.3139834135200387), - FRAC_CONST(0.3351095011824163), - FRAC_CONST(0.3567391223361566), - FRAC_CONST(0.3788148623608774), - FRAC_CONST(0.4012755686250732), - FRAC_CONST(0.4240567828288110), - FRAC_CONST(0.4470912150133537), - FRAC_CONST(0.4703092544619664), - FRAC_CONST(0.4936395121456694), - FRAC_CONST(0.5170093888596962), - FRAC_CONST(0.5403456627591340), - FRAC_CONST(0.5635750896430154), - FRAC_CONST(0.5866250090612892), - FRAC_CONST(0.6094239491338723), - FRAC_CONST(0.6319022228794100), - FRAC_CONST(0.6539925088563087), - FRAC_CONST(0.6756304090216887), - FRAC_CONST(0.6967549769155277), - FRAC_CONST(0.7173092095766250), - FRAC_CONST(0.7372404969921184), - FRAC_CONST(0.7565010233699827), - FRAC_CONST(0.7750481150999984), - FRAC_CONST(0.7928445309277697), - FRAC_CONST(0.8098586906021583), - FRAC_CONST(0.8260648390616000), - FRAC_CONST(0.8414431440907889), - FRAC_CONST(0.8559797262966709), - FRAC_CONST(0.8696666212110165), - FRAC_CONST(0.8825016743142358), - FRAC_CONST(0.8944883707784486), - FRAC_CONST(0.9056356027326216), - FRAC_CONST(0.9159573778427816), - FRAC_CONST(0.9254724739583072), - FRAC_CONST(0.9342040454819434), - FRAC_CONST(0.9421791879559176), - FRAC_CONST(0.9494284680976784), - FRAC_CONST(0.9559854271440150), - FRAC_CONST(0.9618860658493898), - FRAC_CONST(0.9671683198119525), - FRAC_CONST(0.9718715339497299), - FRAC_CONST(0.9760359449042233), - FRAC_CONST(0.9797021798981759), - FRAC_CONST(0.9829107801140203), - FRAC_CONST(0.9857017559923277), - FRAC_CONST(0.9881141809867999), - FRAC_CONST(0.9901858292742826), - FRAC_CONST(0.9919528617340944), - FRAC_CONST(0.9934495632180476), - FRAC_CONST(0.9947081327749199), - FRAC_CONST(0.9957585271195989), - FRAC_CONST(0.9966283562984427), - FRAC_CONST(0.9973428292485683), - FRAC_CONST(0.9979247458259197), - FRAC_CONST(0.9983945309245774), - FRAC_CONST(0.9987703055583410), - FRAC_CONST(0.9990679892449266), - FRAC_CONST(0.9993014277313617), - FRAC_CONST(0.9994825400228521), - FRAC_CONST(0.9996214788122335), - FRAC_CONST(0.9997267987294857), - FRAC_CONST(0.9998056273097539), - FRAC_CONST(0.9998638341781910), - FRAC_CONST(0.9999061946325793), - FRAC_CONST(0.9999365445321382), - FRAC_CONST(0.9999579241373735), - FRAC_CONST(0.9999727092594598), - FRAC_CONST(0.9999827287418790), - FRAC_CONST(0.9999893678912771), - FRAC_CONST(0.9999936579844555), - FRAC_CONST(0.9999963523959187), - FRAC_CONST(0.9999979902130101), - FRAC_CONST(0.9999989484358076), - FRAC_CONST(0.9999994840031031), - FRAC_CONST(0.9999997669534347), - FRAC_CONST(0.9999999060327799), - FRAC_CONST(0.9999999680107184), - FRAC_CONST(0.9999999918774242), - FRAC_CONST(0.9999999989770326) -}; -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/local_changes.diff b/mplayer/libfaad2/local_changes.diff deleted file mode 100644 index 85eb1f3e..00000000 --- a/mplayer/libfaad2/local_changes.diff +++ /dev/null @@ -1,341 +0,0 @@ ---- libfaad2.orig/bits.h 2006-03-16 20:15:04.000000000 +0100 -+++ libfaad2/bits.h 2006-03-16 20:37:21.000000000 +0100 -@@ -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 -@@ -32,8 +37,13 @@ - - #ifdef HAVE_CONFIG_H - # include "../config.h" - #endif -+ -+/* Allow build on Cygwin*/ -+#if defined(__CYGWIN__) -+#define __STRICT_ANSI__ -+#endif - - #define INLINE __inline - #if 0 //defined(_WIN32) && !defined(_WIN32_WCE) - #define ALIGN __declspec(align(16)) -@@ -61,7 +69,7 @@ - /* Use if target platform has address generators with autoincrement */ - //#define PREFER_POINTERS - --#ifdef _WIN32_WCE -+#if defined(_WIN32_WCE) || defined(__arm__) || defined(__avr32__) - #define FIXED_POINT - #endif - -@@ -117,6 +125,9 @@ - # ifdef MAIN_DEC - # undef MAIN_DEC - # endif -+# ifdef SBR_DEC -+# undef SBR_DEC -+# endif - #endif // FIXED_POINT - - #ifdef DRM -@@ -151,6 +162,7 @@ - - #include - -+#if 0 - typedef unsigned __int64 uint64_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int16 uint16_t; -@@ -159,6 +171,10 @@ - typedef __int32 int32_t; - typedef __int16 int16_t; - typedef __int8 int8_t; -+#else -+#include -+#endif -+ - typedef float float32_t; - - -@@ -245,7 +245,7 @@ - - #endif - --#ifdef WORDS_BIGENDIAN -+#if HAVE_BIGENDIAN - #define ARCH_IS_BIG_ENDIAN - #endif - -@@ -317,7 +317,7 @@ - } - return i; - } -- #elif (defined(__i386__) && defined(__GNUC__)) -+ #elif (defined(__i386__) && defined(__GNUC__)) && __STDC_VERSION__ < 199901L - #define HAS_LRINTF - // from http://www.stereopsis.com/FPU.html - static INLINE int lrintf(float f) -@@ -330,6 +346,8 @@ - - #else - -+#include -+ - #ifdef HAVE_LRINTF - # define HAS_LRINTF - # define _ISOC9X_SOURCE 1 -@@ -338,8 +356,6 @@ - # define __USE_ISOC99 1 - #endif - -- #include -- - #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 -@@ -463,9 +462,9 @@ - } - } - --void* output_to_PCM(NeAACDecHandle hDecoder, -- real_t **input, void *sample_buffer, uint8_t channels, -- uint16_t frame_len, uint8_t format) -+static void* output_to_PCM_sux(NeAACDecHandle hDecoder, -+ real_t **input, void *sample_buffer, uint8_t channels, -+ uint16_t frame_len, uint8_t format) - { - uint8_t ch; - uint16_t i; -@@ -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 -@@ -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 -@@ -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 -@@ -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,14 @@ - - /* 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_alloced[hDecoder->fr_ch_ele] == 0 || -+ 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 +995,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 +1008,7 @@ - memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size); - } - #endif -+#endif - - return 0; - } diff --git a/mplayer/libfaad2/lt_predict.c b/mplayer/libfaad2/lt_predict.c deleted file mode 100644 index 425fa32a..00000000 --- a/mplayer/libfaad2/lt_predict.c +++ /dev/null @@ -1,215 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: lt_predict.c,v 1.23 2004/09/04 14:56:28 menno Exp $ -**/ - - -#include "common.h" -#include "structs.h" - -#ifdef LTP_DEC - -#include -#include "syntax.h" -#include "lt_predict.h" -#include "filtbank.h" -#include "tns.h" - - -/* static function declarations */ -static int16_t real_to_int16(real_t sig_in); - - -/* check if the object type is an object type that can have LTP */ -uint8_t is_ltp_ot(uint8_t object_type) -{ -#ifdef LTP_DEC - if ((object_type == LTP) -#ifdef ERROR_RESILIENCE - || (object_type == ER_LTP) -#endif -#ifdef LD_DEC - || (object_type == LD) -#endif -#ifdef SCALABLE_DEC - || (object_type == 6) /* TODO */ -#endif - ) - { - return 1; - } -#endif - - return 0; -} - -ALIGN static const real_t codebook[8] = -{ - REAL_CONST(0.570829), - REAL_CONST(0.696616), - REAL_CONST(0.813004), - REAL_CONST(0.911304), - REAL_CONST(0.984900), - REAL_CONST(1.067894), - REAL_CONST(1.194601), - REAL_CONST(1.369533) -}; - -void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec, - int16_t *lt_pred_stat, fb_info *fb, uint8_t win_shape, - uint8_t win_shape_prev, uint8_t sr_index, - uint8_t object_type, uint16_t frame_len) -{ - uint8_t sfb; - uint16_t bin, i, num_samples; - ALIGN real_t x_est[2048]; - ALIGN real_t X_est[2048]; - - if (ics->window_sequence != EIGHT_SHORT_SEQUENCE) - { - if (ltp->data_present) - { - num_samples = frame_len << 1; - - for(i = 0; i < num_samples; i++) - { - /* The extra lookback M (N/2 for LD, 0 for LTP) is handled - in the buffer updating */ - -#if 0 - x_est[i] = MUL_R_C(lt_pred_stat[num_samples + i - ltp->lag], - codebook[ltp->coef]); -#else - /* lt_pred_stat is a 16 bit int, multiplied with the fixed point real - this gives a real for x_est - */ - x_est[i] = (real_t)lt_pred_stat[num_samples + i - ltp->lag] * codebook[ltp->coef]; -#endif - } - - filter_bank_ltp(fb, ics->window_sequence, win_shape, win_shape_prev, - x_est, X_est, object_type, frame_len); - - tns_encode_frame(ics, &(ics->tns), sr_index, object_type, X_est, - frame_len); - - for (sfb = 0; sfb < ltp->last_band; sfb++) - { - if (ltp->long_used[sfb]) - { - uint16_t low = ics->swb_offset[sfb]; - uint16_t high = ics->swb_offset[sfb+1]; - - for (bin = low; bin < high; bin++) - { - spec[bin] += X_est[bin]; - } - } - } - } - } -} - -#ifdef FIXED_POINT -static INLINE int16_t real_to_int16(real_t sig_in) -{ - if (sig_in >= 0) - { - sig_in += (1 << (REAL_BITS-1)); - if (sig_in >= REAL_CONST(32768)) - return 32767; - } else { - sig_in += -(1 << (REAL_BITS-1)); - if (sig_in <= REAL_CONST(-32768)) - return -32768; - } - - return (sig_in >> REAL_BITS); -} -#else -static INLINE int16_t real_to_int16(real_t sig_in) -{ - if (sig_in >= 0) - { -#ifndef HAS_LRINTF - sig_in += 0.5f; -#endif - if (sig_in >= 32768.0f) - return 32767; - } else { -#ifndef HAS_LRINTF - sig_in += -0.5f; -#endif - if (sig_in <= -32768.0f) - return -32768; - } - - return lrintf(sig_in); -} -#endif - -void lt_update_state(int16_t *lt_pred_stat, real_t *time, real_t *overlap, - uint16_t frame_len, uint8_t object_type) -{ - uint16_t i; - - /* - * The reference point for index i and the content of the buffer - * lt_pred_stat are arranged so that lt_pred_stat(0 ... N/2 - 1) contains the - * last aliased half window from the IMDCT, and lt_pred_stat(N/2 ... N-1) - * is always all zeros. The rest of lt_pred_stat (i<0) contains the previous - * fully reconstructed time domain samples, i.e., output of the decoder. - * - * These values are shifted up by N*2 to avoid (i<0) - * - * For the LD object type an extra 512 samples lookback is accomodated here. - */ -#ifdef LD_DEC - if (object_type == LD) - { - for (i = 0; i < frame_len; i++) - { - lt_pred_stat[i] /* extra 512 */ = lt_pred_stat[i + frame_len]; - lt_pred_stat[frame_len + i] = lt_pred_stat[i + (frame_len * 2)]; - lt_pred_stat[(frame_len * 2) + i] = real_to_int16(time[i]); - lt_pred_stat[(frame_len * 3) + i] = real_to_int16(overlap[i]); - } - } else { -#endif - for (i = 0; i < frame_len; i++) - { - lt_pred_stat[i] = lt_pred_stat[i + frame_len]; - lt_pred_stat[frame_len + i] = real_to_int16(time[i]); - lt_pred_stat[(frame_len * 2) + i] = real_to_int16(overlap[i]); -#if 0 /* set to zero once upon initialisation */ - lt_pred_stat[(frame_len * 3) + i] = 0; -#endif - } -#ifdef LD_DEC - } -#endif -} - -#endif diff --git a/mplayer/libfaad2/lt_predict.h b/mplayer/libfaad2/lt_predict.h deleted file mode 100644 index 0059afee..00000000 --- a/mplayer/libfaad2/lt_predict.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: lt_predict.h,v 1.16 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifdef LTP_DEC - -#ifndef __LT_PREDICT_H__ -#define __LT_PREDICT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "filtbank.h" - -uint8_t is_ltp_ot(uint8_t object_type); - -void lt_prediction(ic_stream *ics, - ltp_info *ltp, - real_t *spec, - int16_t *lt_pred_stat, - fb_info *fb, - uint8_t win_shape, - uint8_t win_shape_prev, - uint8_t sr_index, - uint8_t object_type, - uint16_t frame_len); - -void lt_update_state(int16_t *lt_pred_stat, - real_t *time, - real_t *overlap, - uint16_t frame_len, - uint8_t object_type); - -#ifdef __cplusplus -} -#endif -#endif - -#endif diff --git a/mplayer/libfaad2/mdct.c b/mplayer/libfaad2/mdct.c deleted file mode 100644 index 8179473b..00000000 --- a/mplayer/libfaad2/mdct.c +++ /dev/null @@ -1,298 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: mdct.c,v 1.43 2004/09/04 14:56:28 menno Exp $ -**/ - -/* - * Fast (I)MDCT Implementation using (I)FFT ((Inverse) Fast Fourier Transform) - * and consists of three steps: pre-(I)FFT complex multiplication, complex - * (I)FFT, post-(I)FFT complex multiplication, - * - * As described in: - * P. Duhamel, Y. Mahieux, and J.P. Petit, "A Fast Algorithm for the - * Implementation of Filter Banks Based on 'Time Domain Aliasing - * Cancellation," IEEE Proc. on ICASSP91, 1991, pp. 2209-2212. - * - * - * As of April 6th 2002 completely rewritten. - * This (I)MDCT can now be used for any data size n, where n is divisible by 8. - * - */ - -#include "common.h" -#include "structs.h" - -#include -#ifdef _WIN32_WCE -#define assert(x) -#else -#include -#endif - -#include "cfft.h" -#include "mdct.h" -#include "mdct_tab.h" - - -mdct_info *faad_mdct_init(uint16_t N) -{ - mdct_info *mdct = (mdct_info*)faad_malloc(sizeof(mdct_info)); - - assert(N % 8 == 0); - - mdct->N = N; - - /* NOTE: For "small framelengths" in FIXED_POINT the coefficients need to be - * scaled by sqrt("(nearest power of 2) > N" / N) */ - - /* RE(mdct->sincos[k]) = scale*(real_t)(cos(2.0*M_PI*(k+1./8.) / (real_t)N)); - * IM(mdct->sincos[k]) = scale*(real_t)(sin(2.0*M_PI*(k+1./8.) / (real_t)N)); */ - /* scale is 1 for fixed point, sqrt(N) for floating point */ - switch (N) - { - case 2048: mdct->sincos = (complex_t*)mdct_tab_2048; break; - case 256: mdct->sincos = (complex_t*)mdct_tab_256; break; -#ifdef LD_DEC - case 1024: mdct->sincos = (complex_t*)mdct_tab_1024; break; -#endif -#ifdef ALLOW_SMALL_FRAMELENGTH - case 1920: mdct->sincos = (complex_t*)mdct_tab_1920; break; - case 240: mdct->sincos = (complex_t*)mdct_tab_240; break; -#ifdef LD_DEC - case 960: mdct->sincos = (complex_t*)mdct_tab_960; break; -#endif -#endif -#ifdef SSR_DEC - case 512: mdct->sincos = (complex_t*)mdct_tab_512; break; - case 64: mdct->sincos = (complex_t*)mdct_tab_64; break; -#endif - } - - /* initialise fft */ - mdct->cfft = cffti(N/4); - -#ifdef PROFILE - mdct->cycles = 0; - mdct->fft_cycles = 0; -#endif - - return mdct; -} - -void faad_mdct_end(mdct_info *mdct) -{ - if (mdct != NULL) - { -#ifdef PROFILE - printf("MDCT[%.4d]: %I64d cycles\n", mdct->N, mdct->cycles); - printf("CFFT[%.4d]: %I64d cycles\n", mdct->N/4, mdct->fft_cycles); -#endif - - cfftu(mdct->cfft); - - faad_free(mdct); - } -} - -void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out) -{ - uint16_t k; - - complex_t x; -#ifdef ALLOW_SMALL_FRAMELENGTH -#ifdef FIXED_POINT - real_t scale, b_scale = 0; -#endif -#endif - ALIGN complex_t Z1[512]; - complex_t *sincos = mdct->sincos; - - uint16_t N = mdct->N; - uint16_t N2 = N >> 1; - uint16_t N4 = N >> 2; - uint16_t N8 = N >> 3; - -#ifdef PROFILE - int64_t count1, count2 = faad_get_ts(); -#endif - -#ifdef ALLOW_SMALL_FRAMELENGTH -#ifdef FIXED_POINT - /* detect non-power of 2 */ - if (N & (N-1)) - { - /* adjust scale for non-power of 2 MDCT */ - /* 2048/1920 */ - b_scale = 1; - scale = COEF_CONST(1.0666666666666667); - } -#endif -#endif - - /* pre-IFFT complex multiplication */ - for (k = 0; k < N4; k++) - { - ComplexMult(&IM(Z1[k]), &RE(Z1[k]), - X_in[2*k], X_in[N2 - 1 - 2*k], RE(sincos[k]), IM(sincos[k])); - } - -#ifdef PROFILE - count1 = faad_get_ts(); -#endif - - /* complex IFFT, any non-scaling FFT can be used here */ - cfftb(mdct->cfft, Z1); - -#ifdef PROFILE - count1 = faad_get_ts() - count1; -#endif - - /* post-IFFT complex multiplication */ - for (k = 0; k < N4; k++) - { - RE(x) = RE(Z1[k]); - IM(x) = IM(Z1[k]); - ComplexMult(&IM(Z1[k]), &RE(Z1[k]), - IM(x), RE(x), RE(sincos[k]), IM(sincos[k])); - -#ifdef ALLOW_SMALL_FRAMELENGTH -#ifdef FIXED_POINT - /* non-power of 2 MDCT scaling */ - if (b_scale) - { - RE(Z1[k]) = MUL_C(RE(Z1[k]), scale); - IM(Z1[k]) = MUL_C(IM(Z1[k]), scale); - } -#endif -#endif - } - - /* reordering */ - for (k = 0; k < N8; k+=2) - { - X_out[ 2*k] = IM(Z1[N8 + k]); - X_out[ 2 + 2*k] = IM(Z1[N8 + 1 + k]); - - X_out[ 1 + 2*k] = -RE(Z1[N8 - 1 - k]); - X_out[ 3 + 2*k] = -RE(Z1[N8 - 2 - k]); - - X_out[N4 + 2*k] = RE(Z1[ k]); - X_out[N4 + + 2 + 2*k] = RE(Z1[ 1 + k]); - - X_out[N4 + 1 + 2*k] = -IM(Z1[N4 - 1 - k]); - X_out[N4 + 3 + 2*k] = -IM(Z1[N4 - 2 - k]); - - X_out[N2 + 2*k] = RE(Z1[N8 + k]); - X_out[N2 + + 2 + 2*k] = RE(Z1[N8 + 1 + k]); - - X_out[N2 + 1 + 2*k] = -IM(Z1[N8 - 1 - k]); - X_out[N2 + 3 + 2*k] = -IM(Z1[N8 - 2 - k]); - - X_out[N2 + N4 + 2*k] = -IM(Z1[ k]); - X_out[N2 + N4 + 2 + 2*k] = -IM(Z1[ 1 + k]); - - X_out[N2 + N4 + 1 + 2*k] = RE(Z1[N4 - 1 - k]); - X_out[N2 + N4 + 3 + 2*k] = RE(Z1[N4 - 2 - k]); - } - -#ifdef PROFILE - count2 = faad_get_ts() - count2; - mdct->fft_cycles += count1; - mdct->cycles += (count2 - count1); -#endif -} - -#ifdef LTP_DEC -void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out) -{ - uint16_t k; - - complex_t x; - ALIGN complex_t Z1[512]; - complex_t *sincos = mdct->sincos; - - uint16_t N = mdct->N; - uint16_t N2 = N >> 1; - uint16_t N4 = N >> 2; - uint16_t N8 = N >> 3; - -#ifndef FIXED_POINT - real_t scale = REAL_CONST(N); -#else - real_t scale = REAL_CONST(4.0/N); -#endif - -#ifdef ALLOW_SMALL_FRAMELENGTH -#ifdef FIXED_POINT - /* detect non-power of 2 */ - if (N & (N-1)) - { - /* adjust scale for non-power of 2 MDCT */ - /* *= sqrt(2048/1920) */ - scale = MUL_C(scale, COEF_CONST(1.0327955589886444)); - } -#endif -#endif - - /* pre-FFT complex multiplication */ - for (k = 0; k < N8; k++) - { - uint16_t n = k << 1; - RE(x) = X_in[N - N4 - 1 - n] + X_in[N - N4 + n]; - IM(x) = X_in[ N4 + n] - X_in[ N4 - 1 - n]; - - ComplexMult(&RE(Z1[k]), &IM(Z1[k]), - RE(x), IM(x), RE(sincos[k]), IM(sincos[k])); - - RE(Z1[k]) = MUL_R(RE(Z1[k]), scale); - IM(Z1[k]) = MUL_R(IM(Z1[k]), scale); - - RE(x) = X_in[N2 - 1 - n] - X_in[ n]; - IM(x) = X_in[N2 + n] + X_in[N - 1 - n]; - - ComplexMult(&RE(Z1[k + N8]), &IM(Z1[k + N8]), - RE(x), IM(x), RE(sincos[k + N8]), IM(sincos[k + N8])); - - RE(Z1[k + N8]) = MUL_R(RE(Z1[k + N8]), scale); - IM(Z1[k + N8]) = MUL_R(IM(Z1[k + N8]), scale); - } - - /* complex FFT, any non-scaling FFT can be used here */ - cfftf(mdct->cfft, Z1); - - /* post-FFT complex multiplication */ - for (k = 0; k < N4; k++) - { - uint16_t n = k << 1; - ComplexMult(&RE(x), &IM(x), - RE(Z1[k]), IM(Z1[k]), RE(sincos[k]), IM(sincos[k])); - - X_out[ n] = -RE(x); - X_out[N2 - 1 - n] = IM(x); - X_out[N2 + n] = -IM(x); - X_out[N - 1 - n] = RE(x); - } -} -#endif diff --git a/mplayer/libfaad2/mdct.h b/mplayer/libfaad2/mdct.h deleted file mode 100644 index 20896181..00000000 --- a/mplayer/libfaad2/mdct.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: mdct.h,v 1.26 2004/09/08 09:43:11 gcp Exp $ -**/ - -#ifndef __MDCT_H__ -#define __MDCT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -mdct_info *faad_mdct_init(uint16_t N); -void faad_mdct_end(mdct_info *mdct); -void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out); -void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/mdct_tab.h b/mplayer/libfaad2/mdct_tab.h deleted file mode 100644 index 58c147bc..00000000 --- a/mplayer/libfaad2/mdct_tab.h +++ /dev/null @@ -1,3652 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: mdct_tab.h,v 1.3 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __MDCT_TAB_H__ -#define __MDCT_TAB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef FIXED_POINT - -/* 256 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_2048[] = -{ - { FRAC_CONST(0.999999926465718), FRAC_CONST(0.000383495187571) }, - { FRAC_CONST(0.999994043728986), FRAC_CONST(0.003451449920136) }, - { FRAC_CONST(0.999978748667469), FRAC_CONST(0.006519372166339) }, - { FRAC_CONST(0.999954041425130), FRAC_CONST(0.009587233049729) }, - { FRAC_CONST(0.999919922234523), FRAC_CONST(0.012655003694430) }, - { FRAC_CONST(0.999876391416790), FRAC_CONST(0.015722655225417) }, - { FRAC_CONST(0.999823449381662), FRAC_CONST(0.018790158768785) }, - { FRAC_CONST(0.999761096627447), FRAC_CONST(0.021857485452022) }, - { FRAC_CONST(0.999689333741034), FRAC_CONST(0.024924606404281) }, - { FRAC_CONST(0.999608161397882), FRAC_CONST(0.027991492756653) }, - { FRAC_CONST(0.999517580362017), FRAC_CONST(0.031058115642435) }, - { FRAC_CONST(0.999417591486022), FRAC_CONST(0.034124446197403) }, - { FRAC_CONST(0.999308195711029), FRAC_CONST(0.037190455560088) }, - { FRAC_CONST(0.999189394066715), FRAC_CONST(0.040256114872041) }, - { FRAC_CONST(0.999061187671285), FRAC_CONST(0.043321395278110) }, - { FRAC_CONST(0.998923577731466), FRAC_CONST(0.046386267926707) }, - { FRAC_CONST(0.998776565542496), FRAC_CONST(0.049450703970085) }, - { FRAC_CONST(0.998620152488109), FRAC_CONST(0.052514674564603) }, - { FRAC_CONST(0.998454340040525), FRAC_CONST(0.055578150871005) }, - { FRAC_CONST(0.998279129760433), FRAC_CONST(0.058641104054683) }, - { FRAC_CONST(0.998094523296980), FRAC_CONST(0.061703505285957) }, - { FRAC_CONST(0.997900522387752), FRAC_CONST(0.064765325740340) }, - { FRAC_CONST(0.997697128858759), FRAC_CONST(0.067826536598811) }, - { FRAC_CONST(0.997484344624418), FRAC_CONST(0.070887109048088) }, - { FRAC_CONST(0.997262171687536), FRAC_CONST(0.073947014280897) }, - { FRAC_CONST(0.997030612139289), FRAC_CONST(0.077006223496246) }, - { FRAC_CONST(0.996789668159205), FRAC_CONST(0.080064707899691) }, - { FRAC_CONST(0.996539342015138), FRAC_CONST(0.083122438703613) }, - { FRAC_CONST(0.996279636063255), FRAC_CONST(0.086179387127485) }, - { FRAC_CONST(0.996010552748006), FRAC_CONST(0.089235524398144) }, - { FRAC_CONST(0.995732094602106), FRAC_CONST(0.092290821750062) }, - { FRAC_CONST(0.995444264246510), FRAC_CONST(0.095345250425618) }, - { FRAC_CONST(0.995147064390386), FRAC_CONST(0.098398781675364) }, - { FRAC_CONST(0.994840497831093), FRAC_CONST(0.101451386758302) }, - { FRAC_CONST(0.994524567454152), FRAC_CONST(0.104503036942151) }, - { FRAC_CONST(0.994199276233219), FRAC_CONST(0.107553703503616) }, - { FRAC_CONST(0.993864627230060), FRAC_CONST(0.110603357728662) }, - { FRAC_CONST(0.993520623594518), FRAC_CONST(0.113651970912782) }, - { FRAC_CONST(0.993167268564487), FRAC_CONST(0.116699514361268) }, - { FRAC_CONST(0.992804565465879), FRAC_CONST(0.119745959389480) }, - { FRAC_CONST(0.992432517712594), FRAC_CONST(0.122791277323117) }, - { FRAC_CONST(0.992051128806486), FRAC_CONST(0.125835439498487) }, - { FRAC_CONST(0.991660402337333), FRAC_CONST(0.128878417262777) }, - { FRAC_CONST(0.991260341982802), FRAC_CONST(0.131920181974320) }, - { FRAC_CONST(0.990850951508414), FRAC_CONST(0.134960705002869) }, - { FRAC_CONST(0.990432234767506), FRAC_CONST(0.137999957729863) }, - { FRAC_CONST(0.990004195701201), FRAC_CONST(0.141037911548698) }, - { FRAC_CONST(0.989566838338365), FRAC_CONST(0.144074537864995) }, - { FRAC_CONST(0.989120166795573), FRAC_CONST(0.147109808096872) }, - { FRAC_CONST(0.988664185277066), FRAC_CONST(0.150143693675208) }, - { FRAC_CONST(0.988198898074718), FRAC_CONST(0.153176166043918) }, - { FRAC_CONST(0.987724309567987), FRAC_CONST(0.156207196660216) }, - { FRAC_CONST(0.987240424223882), FRAC_CONST(0.159236756994888) }, - { FRAC_CONST(0.986747246596917), FRAC_CONST(0.162264818532558) }, - { FRAC_CONST(0.986244781329065), FRAC_CONST(0.165291352771958) }, - { FRAC_CONST(0.985733033149723), FRAC_CONST(0.168316331226195) }, - { FRAC_CONST(0.985212006875659), FRAC_CONST(0.171339725423019) }, - { FRAC_CONST(0.984681707410971), FRAC_CONST(0.174361506905094) }, - { FRAC_CONST(0.984142139747039), FRAC_CONST(0.177381647230260) }, - { FRAC_CONST(0.983593308962479), FRAC_CONST(0.180400117971807) }, - { FRAC_CONST(0.983035220223096), FRAC_CONST(0.183416890718739) }, - { FRAC_CONST(0.982467878781833), FRAC_CONST(0.186431937076042) }, - { FRAC_CONST(0.981891289978725), FRAC_CONST(0.189445228664950) }, - { FRAC_CONST(0.981305459240845), FRAC_CONST(0.192456737123217) }, - { FRAC_CONST(0.980710392082254), FRAC_CONST(0.195466434105377) }, - { FRAC_CONST(0.980106094103952), FRAC_CONST(0.198474291283016) }, - { FRAC_CONST(0.979492570993821), FRAC_CONST(0.201480280345038) }, - { FRAC_CONST(0.978869828526574), FRAC_CONST(0.204484372997927) }, - { FRAC_CONST(0.978237872563701), FRAC_CONST(0.207486540966021) }, - { FRAC_CONST(0.977596709053412), FRAC_CONST(0.210486755991770) }, - { FRAC_CONST(0.976946344030582), FRAC_CONST(0.213484989836008) }, - { FRAC_CONST(0.976286783616694), FRAC_CONST(0.216481214278217) }, - { FRAC_CONST(0.975618034019782), FRAC_CONST(0.219475401116790) }, - { FRAC_CONST(0.974940101534372), FRAC_CONST(0.222467522169302) }, - { FRAC_CONST(0.974252992541423), FRAC_CONST(0.225457549272769) }, - { FRAC_CONST(0.973556713508266), FRAC_CONST(0.228445454283916) }, - { FRAC_CONST(0.972851270988544), FRAC_CONST(0.231431209079446) }, - { FRAC_CONST(0.972136671622152), FRAC_CONST(0.234414785556295) }, - { FRAC_CONST(0.971412922135171), FRAC_CONST(0.237396155631907) }, - { FRAC_CONST(0.970680029339806), FRAC_CONST(0.240375291244489) }, - { FRAC_CONST(0.969938000134324), FRAC_CONST(0.243352164353285) }, - { FRAC_CONST(0.969186841502986), FRAC_CONST(0.246326746938829) }, - { FRAC_CONST(0.968426560515983), FRAC_CONST(0.249299011003218) }, - { FRAC_CONST(0.967657164329370), FRAC_CONST(0.252268928570371) }, - { FRAC_CONST(0.966878660184996), FRAC_CONST(0.255236471686292) }, - { FRAC_CONST(0.966091055410439), FRAC_CONST(0.258201612419335) }, - { FRAC_CONST(0.965294357418935), FRAC_CONST(0.261164322860466) }, - { FRAC_CONST(0.964488573709308), FRAC_CONST(0.264124575123528) }, - { FRAC_CONST(0.963673711865903), FRAC_CONST(0.267082341345496) }, - { FRAC_CONST(0.962849779558509), FRAC_CONST(0.270037593686751) }, - { FRAC_CONST(0.962016784542291), FRAC_CONST(0.272990304331330) }, - { FRAC_CONST(0.961174734657714), FRAC_CONST(0.275940445487197) }, - { FRAC_CONST(0.960323637830474), FRAC_CONST(0.278887989386500) }, - { FRAC_CONST(0.959463502071418), FRAC_CONST(0.281832908285833) }, - { FRAC_CONST(0.958594335476470), FRAC_CONST(0.284775174466498) }, - { FRAC_CONST(0.957716146226559), FRAC_CONST(0.287714760234765) }, - { FRAC_CONST(0.956828942587535), FRAC_CONST(0.290651637922133) }, - { FRAC_CONST(0.955932732910098), FRAC_CONST(0.293585779885591) }, - { FRAC_CONST(0.955027525629714), FRAC_CONST(0.296517158507877) }, - { FRAC_CONST(0.954113329266539), FRAC_CONST(0.299445746197740) }, - { FRAC_CONST(0.953190152425337), FRAC_CONST(0.302371515390196) }, - { FRAC_CONST(0.952258003795400), FRAC_CONST(0.305294438546792) }, - { FRAC_CONST(0.951316892150466), FRAC_CONST(0.308214488155861) }, - { FRAC_CONST(0.950366826348636), FRAC_CONST(0.311131636732785) }, - { FRAC_CONST(0.949407815332292), FRAC_CONST(0.314045856820251) }, - { FRAC_CONST(0.948439868128010), FRAC_CONST(0.316957120988508) }, - { FRAC_CONST(0.947462993846478), FRAC_CONST(0.319865401835631) }, - { FRAC_CONST(0.946477201682409), FRAC_CONST(0.322770671987771) }, - { FRAC_CONST(0.945482500914454), FRAC_CONST(0.325672904099420) }, - { FRAC_CONST(0.944478900905116), FRAC_CONST(0.328572070853664) }, - { FRAC_CONST(0.943466411100659), FRAC_CONST(0.331468144962441) }, - { FRAC_CONST(0.942445041031025), FRAC_CONST(0.334361099166799) }, - { FRAC_CONST(0.941414800309736), FRAC_CONST(0.337250906237151) }, - { FRAC_CONST(0.940375698633812), FRAC_CONST(0.340137538973532) }, - { FRAC_CONST(0.939327745783671), FRAC_CONST(0.343020970205856) }, - { FRAC_CONST(0.938270951623047), FRAC_CONST(0.345901172794169) }, - { FRAC_CONST(0.937205326098888), FRAC_CONST(0.348778119628908) }, - { FRAC_CONST(0.936130879241267), FRAC_CONST(0.351651783631155) }, - { FRAC_CONST(0.935047621163287), FRAC_CONST(0.354522137752887) }, - { FRAC_CONST(0.933955562060987), FRAC_CONST(0.357389154977241) }, - { FRAC_CONST(0.932854712213241), FRAC_CONST(0.360252808318757) }, - { FRAC_CONST(0.931745081981669), FRAC_CONST(0.363113070823639) }, - { FRAC_CONST(0.930626681810532), FRAC_CONST(0.365969915570009) }, - { FRAC_CONST(0.929499522226639), FRAC_CONST(0.368823315668154) }, - { FRAC_CONST(0.928363613839244), FRAC_CONST(0.371673244260787) }, - { FRAC_CONST(0.927218967339952), FRAC_CONST(0.374519674523293) }, - { FRAC_CONST(0.926065593502609), FRAC_CONST(0.377362579663988) }, - { FRAC_CONST(0.924903503183211), FRAC_CONST(0.380201932924366) }, - { FRAC_CONST(0.923732707319793), FRAC_CONST(0.383037707579352) }, - { FRAC_CONST(0.922553216932333), FRAC_CONST(0.385869876937555) }, - { FRAC_CONST(0.921365043122642), FRAC_CONST(0.388698414341519) }, - { FRAC_CONST(0.920168197074266), FRAC_CONST(0.391523293167972) }, - { FRAC_CONST(0.918962690052376), FRAC_CONST(0.394344486828080) }, - { FRAC_CONST(0.917748533403661), FRAC_CONST(0.397161968767692) }, - { FRAC_CONST(0.916525738556228), FRAC_CONST(0.399975712467595) }, - { FRAC_CONST(0.915294317019487), FRAC_CONST(0.402785691443764) }, - { FRAC_CONST(0.914054280384047), FRAC_CONST(0.405591879247604) }, - { FRAC_CONST(0.912805640321604), FRAC_CONST(0.408394249466208) }, - { FRAC_CONST(0.911548408584834), FRAC_CONST(0.411192775722600) }, - { FRAC_CONST(0.910282597007282), FRAC_CONST(0.413987431675985) }, - { FRAC_CONST(0.909008217503247), FRAC_CONST(0.416778191021998) }, - { FRAC_CONST(0.907725282067676), FRAC_CONST(0.419565027492947) }, - { FRAC_CONST(0.906433802776045), FRAC_CONST(0.422347914858067) }, - { FRAC_CONST(0.905133791784250), FRAC_CONST(0.425126826923762) }, - { FRAC_CONST(0.903825261328488), FRAC_CONST(0.427901737533854) }, - { FRAC_CONST(0.902508223725146), FRAC_CONST(0.430672620569827) }, - { FRAC_CONST(0.901182691370685), FRAC_CONST(0.433439449951074) }, - { FRAC_CONST(0.899848676741519), FRAC_CONST(0.436202199635144) }, - { FRAC_CONST(0.898506192393902), FRAC_CONST(0.438960843617984) }, - { FRAC_CONST(0.897155250963809), FRAC_CONST(0.441715355934187) }, - { FRAC_CONST(0.895795865166814), FRAC_CONST(0.444465710657234) }, - { FRAC_CONST(0.894428047797974), FRAC_CONST(0.447211881899738) }, - { FRAC_CONST(0.893051811731707), FRAC_CONST(0.449953843813691) }, - { FRAC_CONST(0.891667169921672), FRAC_CONST(0.452691570590701) }, - { FRAC_CONST(0.890274135400645), FRAC_CONST(0.455425036462242) }, - { FRAC_CONST(0.888872721280396), FRAC_CONST(0.458154215699893) }, - { FRAC_CONST(0.887462940751569), FRAC_CONST(0.460879082615579) }, - { FRAC_CONST(0.886044807083556), FRAC_CONST(0.463599611561814) }, - { FRAC_CONST(0.884618333624370), FRAC_CONST(0.466315776931944) }, - { FRAC_CONST(0.883183533800523), FRAC_CONST(0.469027553160387) }, - { FRAC_CONST(0.881740421116898), FRAC_CONST(0.471734914722871) }, - { FRAC_CONST(0.880289009156621), FRAC_CONST(0.474437836136679) }, - { FRAC_CONST(0.878829311580933), FRAC_CONST(0.477136291960885) }, - { FRAC_CONST(0.877361342129065), FRAC_CONST(0.479830256796594) }, - { FRAC_CONST(0.875885114618104), FRAC_CONST(0.482519705287184) }, - { FRAC_CONST(0.874400642942865), FRAC_CONST(0.485204612118542) }, - { FRAC_CONST(0.872907941075761), FRAC_CONST(0.487884952019301) }, - { FRAC_CONST(0.871407023066671), FRAC_CONST(0.490560699761082) }, - { FRAC_CONST(0.869897903042806), FRAC_CONST(0.493231830158728) }, - { FRAC_CONST(0.868380595208580), FRAC_CONST(0.495898318070542) }, - { FRAC_CONST(0.866855113845470), FRAC_CONST(0.498560138398525) }, - { FRAC_CONST(0.865321473311890), FRAC_CONST(0.501217266088610) }, - { FRAC_CONST(0.863779688043047), FRAC_CONST(0.503869676130899) }, - { FRAC_CONST(0.862229772550811), FRAC_CONST(0.506517343559899) }, - { FRAC_CONST(0.860671741423578), FRAC_CONST(0.509160243454755) }, - { FRAC_CONST(0.859105609326130), FRAC_CONST(0.511798350939487) }, - { FRAC_CONST(0.857531390999499), FRAC_CONST(0.514431641183223) }, - { FRAC_CONST(0.855949101260827), FRAC_CONST(0.517060089400432) }, - { FRAC_CONST(0.854358755003227), FRAC_CONST(0.519683670851158) }, - { FRAC_CONST(0.852760367195645), FRAC_CONST(0.522302360841255) }, - { FRAC_CONST(0.851153952882715), FRAC_CONST(0.524916134722613) }, - { FRAC_CONST(0.849539527184621), FRAC_CONST(0.527524967893398) }, - { FRAC_CONST(0.847917105296951), FRAC_CONST(0.530128835798279) }, - { FRAC_CONST(0.846286702490560), FRAC_CONST(0.532727713928659) }, - { FRAC_CONST(0.844648334111418), FRAC_CONST(0.535321577822907) }, - { FRAC_CONST(0.843002015580473), FRAC_CONST(0.537910403066589) }, - { FRAC_CONST(0.841347762393502), FRAC_CONST(0.540494165292695) }, - { FRAC_CONST(0.839685590120966), FRAC_CONST(0.543072840181872) }, - { FRAC_CONST(0.838015514407864), FRAC_CONST(0.545646403462649) }, - { FRAC_CONST(0.836337550973584), FRAC_CONST(0.548214830911668) }, - { FRAC_CONST(0.834651715611756), FRAC_CONST(0.550778098353912) }, - { FRAC_CONST(0.832958024190107), FRAC_CONST(0.553336181662932) }, - { FRAC_CONST(0.831256492650303), FRAC_CONST(0.555889056761074) }, - { FRAC_CONST(0.829547137007809), FRAC_CONST(0.558436699619704) }, - { FRAC_CONST(0.827829973351730), FRAC_CONST(0.560979086259438) }, - { FRAC_CONST(0.826105017844665), FRAC_CONST(0.563516192750365) }, - { FRAC_CONST(0.824372286722551), FRAC_CONST(0.566047995212271) }, - { FRAC_CONST(0.822631796294515), FRAC_CONST(0.568574469814869) }, - { FRAC_CONST(0.820883562942715), FRAC_CONST(0.571095592778017) }, - { FRAC_CONST(0.819127603122188), FRAC_CONST(0.573611340371945) }, - { FRAC_CONST(0.817363933360698), FRAC_CONST(0.576121688917478) }, - { FRAC_CONST(0.815592570258577), FRAC_CONST(0.578626614786261) }, - { FRAC_CONST(0.813813530488567), FRAC_CONST(0.581126094400978) }, - { FRAC_CONST(0.812026830795670), FRAC_CONST(0.583620104235573) }, - { FRAC_CONST(0.810232487996982), FRAC_CONST(0.586108620815476) }, - { FRAC_CONST(0.808430518981543), FRAC_CONST(0.588591620717823) }, - { FRAC_CONST(0.806620940710170), FRAC_CONST(0.591069080571671) }, - { FRAC_CONST(0.804803770215303), FRAC_CONST(0.593540977058226) }, - { FRAC_CONST(0.802979024600843), FRAC_CONST(0.596007286911057) }, - { FRAC_CONST(0.801146721041991), FRAC_CONST(0.598467986916314) }, - { FRAC_CONST(0.799306876785086), FRAC_CONST(0.600923053912954) }, - { FRAC_CONST(0.797459509147442), FRAC_CONST(0.603372464792950) }, - { FRAC_CONST(0.795604635517188), FRAC_CONST(0.605816196501515) }, - { FRAC_CONST(0.793742273353100), FRAC_CONST(0.608254226037314) }, - { FRAC_CONST(0.791872440184440), FRAC_CONST(0.610686530452686) }, - { FRAC_CONST(0.789995153610791), FRAC_CONST(0.613113086853855) }, - { FRAC_CONST(0.788110431301888), FRAC_CONST(0.615533872401147) }, - { FRAC_CONST(0.786218290997456), FRAC_CONST(0.617948864309208) }, - { FRAC_CONST(0.784318750507039), FRAC_CONST(0.620358039847214) }, - { FRAC_CONST(0.782411827709837), FRAC_CONST(0.622761376339086) }, - { FRAC_CONST(0.780497540554532), FRAC_CONST(0.625158851163708) }, - { FRAC_CONST(0.778575907059125), FRAC_CONST(0.627550441755132) }, - { FRAC_CONST(0.776646945310762), FRAC_CONST(0.629936125602796) }, - { FRAC_CONST(0.774710673465566), FRAC_CONST(0.632315880251738) }, - { FRAC_CONST(0.772767109748464), FRAC_CONST(0.634689683302798) }, - { FRAC_CONST(0.770816272453019), FRAC_CONST(0.637057512412839) }, - { FRAC_CONST(0.768858179941253), FRAC_CONST(0.639419345294951) }, - { FRAC_CONST(0.766892850643481), FRAC_CONST(0.641775159718664) }, - { FRAC_CONST(0.764920303058128), FRAC_CONST(0.644124933510155) }, - { FRAC_CONST(0.762940555751566), FRAC_CONST(0.646468644552458) }, - { FRAC_CONST(0.760953627357928), FRAC_CONST(0.648806270785673) }, - { FRAC_CONST(0.758959536578942), FRAC_CONST(0.651137790207170) }, - { FRAC_CONST(0.756958302183750), FRAC_CONST(0.653463180871802) }, - { FRAC_CONST(0.754949943008733), FRAC_CONST(0.655782420892106) }, - { FRAC_CONST(0.752934477957330), FRAC_CONST(0.658095488438511) }, - { FRAC_CONST(0.750911925999868), FRAC_CONST(0.660402361739545) }, - { FRAC_CONST(0.748882306173375), FRAC_CONST(0.662703019082037) }, - { FRAC_CONST(0.746845637581407), FRAC_CONST(0.664997438811325) }, - { FRAC_CONST(0.744801939393863), FRAC_CONST(0.667285599331456) }, - { FRAC_CONST(0.742751230846809), FRAC_CONST(0.669567479105392) }, - { FRAC_CONST(0.740693531242296), FRAC_CONST(0.671843056655212) }, - { FRAC_CONST(0.738628859948175), FRAC_CONST(0.674112310562312) }, - { FRAC_CONST(0.736557236397919), FRAC_CONST(0.676375219467612) }, - { FRAC_CONST(0.734478680090438), FRAC_CONST(0.678631762071749) }, - { FRAC_CONST(0.732393210589896), FRAC_CONST(0.680881917135287) }, - { FRAC_CONST(0.730300847525525), FRAC_CONST(0.683125663478909) }, - { FRAC_CONST(0.728201610591445), FRAC_CONST(0.685362979983619) }, - { FRAC_CONST(0.726095519546471), FRAC_CONST(0.687593845590942) }, - { FRAC_CONST(0.723982594213936), FRAC_CONST(0.689818239303122) }, - { FRAC_CONST(0.721862854481496), FRAC_CONST(0.692036140183319) }, - { FRAC_CONST(0.719736320300951), FRAC_CONST(0.694247527355803) }, - { FRAC_CONST(0.717603011688049), FRAC_CONST(0.696452380006158) }, - { FRAC_CONST(0.715462948722304), FRAC_CONST(0.698650677381469) }, - { FRAC_CONST(0.713316151546803), FRAC_CONST(0.700842398790526) }, - { FRAC_CONST(0.711162640368018), FRAC_CONST(0.703027523604011) }, - { FRAC_CONST(0.709002435455618), FRAC_CONST(0.705206031254698) }, - { FRAC_CONST(0.706835557142274), FRAC_CONST(0.707377901237642) }, - { FRAC_CONST(0.704662025823469), FRAC_CONST(0.709543113110377) }, - { FRAC_CONST(0.702481861957308), FRAC_CONST(0.711701646493103) }, - { FRAC_CONST(0.700295086064324), FRAC_CONST(0.713853481068882) }, - { FRAC_CONST(0.698101718727284), FRAC_CONST(0.715998596583829) }, - { FRAC_CONST(0.695901780590997), FRAC_CONST(0.718136972847297) }, - { FRAC_CONST(0.693695292362118), FRAC_CONST(0.720268589732077) }, - { FRAC_CONST(0.691482274808956), FRAC_CONST(0.722393427174578) }, - { FRAC_CONST(0.689262748761273), FRAC_CONST(0.724511465175020) }, - { FRAC_CONST(0.687036735110096), FRAC_CONST(0.726622683797623) }, - { FRAC_CONST(0.684804254807511), FRAC_CONST(0.728727063170794) }, - { FRAC_CONST(0.682565328866473), FRAC_CONST(0.730824583487312) }, - { FRAC_CONST(0.680319978360607), FRAC_CONST(0.732915225004518) }, - { FRAC_CONST(0.678068224424007), FRAC_CONST(0.734998968044497) }, - { FRAC_CONST(0.675810088251037), FRAC_CONST(0.737075792994266) }, - { FRAC_CONST(0.673545591096136), FRAC_CONST(0.739145680305957) }, - { FRAC_CONST(0.671274754273613), FRAC_CONST(0.741208610497004) }, - { FRAC_CONST(0.668997599157450), FRAC_CONST(0.743264564150321) }, - { FRAC_CONST(0.666714147181098), FRAC_CONST(0.745313521914490) }, - { FRAC_CONST(0.664424419837275), FRAC_CONST(0.747355464503940) }, - { FRAC_CONST(0.662128438677769), FRAC_CONST(0.749390372699130) }, - { FRAC_CONST(0.659826225313227), FRAC_CONST(0.751418227346727) }, - { FRAC_CONST(0.657517801412960), FRAC_CONST(0.753439009359794) }, - { FRAC_CONST(0.655203188704732), FRAC_CONST(0.755452699717958) }, - { FRAC_CONST(0.652882408974559), FRAC_CONST(0.757459279467601) }, - { FRAC_CONST(0.650555484066504), FRAC_CONST(0.759458729722028) }, - { FRAC_CONST(0.648222435882470), FRAC_CONST(0.761451031661654) }, - { FRAC_CONST(0.645883286381996), FRAC_CONST(0.763436166534172) }, - { FRAC_CONST(0.643538057582048), FRAC_CONST(0.765414115654738) }, - { FRAC_CONST(0.641186771556811), FRAC_CONST(0.767384860406142) }, - { FRAC_CONST(0.638829450437486), FRAC_CONST(0.769348382238982) }, - { FRAC_CONST(0.636466116412077), FRAC_CONST(0.771304662671845) }, - { FRAC_CONST(0.634096791725184), FRAC_CONST(0.773253683291473) }, - { FRAC_CONST(0.631721498677792), FRAC_CONST(0.775195425752941) }, - { FRAC_CONST(0.629340259627066), FRAC_CONST(0.777129871779832) }, - { FRAC_CONST(0.626953096986133), FRAC_CONST(0.779057003164401) }, - { FRAC_CONST(0.624560033223877), FRAC_CONST(0.780976801767754) }, - { FRAC_CONST(0.622161090864727), FRAC_CONST(0.782889249520015) }, - { FRAC_CONST(0.619756292488441), FRAC_CONST(0.784794328420499) }, - { FRAC_CONST(0.617345660729897), FRAC_CONST(0.786692020537877) }, - { FRAC_CONST(0.614929218278880), FRAC_CONST(0.788582308010347) }, - { FRAC_CONST(0.612506987879866), FRAC_CONST(0.790465173045805) }, - { FRAC_CONST(0.610078992331810), FRAC_CONST(0.792340597922007) }, - { FRAC_CONST(0.607645254487931), FRAC_CONST(0.794208564986741) }, - { FRAC_CONST(0.605205797255497), FRAC_CONST(0.796069056657988) }, - { FRAC_CONST(0.602760643595607), FRAC_CONST(0.797922055424093) }, - { FRAC_CONST(0.600309816522980), FRAC_CONST(0.799767543843926) }, - { FRAC_CONST(0.597853339105734), FRAC_CONST(0.801605504547046) }, - { FRAC_CONST(0.595391234465169), FRAC_CONST(0.803435920233868) }, - { FRAC_CONST(0.592923525775551), FRAC_CONST(0.805258773675822) }, - { FRAC_CONST(0.590450236263896), FRAC_CONST(0.807074047715518) }, - { FRAC_CONST(0.587971389209745), FRAC_CONST(0.808881725266904) }, - { FRAC_CONST(0.585487007944951), FRAC_CONST(0.810681789315431) }, - { FRAC_CONST(0.582997115853458), FRAC_CONST(0.812474222918210) }, - { FRAC_CONST(0.580501736371077), FRAC_CONST(0.814259009204175) }, - { FRAC_CONST(0.578000892985270), FRAC_CONST(0.816036131374237) }, - { FRAC_CONST(0.575494609234928), FRAC_CONST(0.817805572701444) }, - { FRAC_CONST(0.572982908710149), FRAC_CONST(0.819567316531142) }, - { FRAC_CONST(0.570465815052013), FRAC_CONST(0.821321346281127) }, - { FRAC_CONST(0.567943351952366), FRAC_CONST(0.823067645441802) }, - { FRAC_CONST(0.565415543153590), FRAC_CONST(0.824806197576334) }, - { FRAC_CONST(0.562882412448385), FRAC_CONST(0.826536986320810) }, - { FRAC_CONST(0.560343983679541), FRAC_CONST(0.828259995384386) }, - { FRAC_CONST(0.557800280739717), FRAC_CONST(0.829975208549444) }, - { FRAC_CONST(0.555251327571214), FRAC_CONST(0.831682609671745) }, - { FRAC_CONST(0.552697148165750), FRAC_CONST(0.833382182680580) }, - { FRAC_CONST(0.550137766564234), FRAC_CONST(0.835073911578919) }, - { FRAC_CONST(0.547573206856540), FRAC_CONST(0.836757780443567) }, - { FRAC_CONST(0.545003493181281), FRAC_CONST(0.838433773425308) }, - { FRAC_CONST(0.542428649725581), FRAC_CONST(0.840101874749058) }, - { FRAC_CONST(0.539848700724848), FRAC_CONST(0.841762068714012) }, - { FRAC_CONST(0.537263670462543), FRAC_CONST(0.843414339693793) }, - { FRAC_CONST(0.534673583269956), FRAC_CONST(0.845058672136595) }, - { FRAC_CONST(0.532078463525974), FRAC_CONST(0.846695050565337) }, - { FRAC_CONST(0.529478335656852), FRAC_CONST(0.848323459577802) }, - { FRAC_CONST(0.526873224135985), FRAC_CONST(0.849943883846782) }, - { FRAC_CONST(0.524263153483673), FRAC_CONST(0.851556308120229) }, - { FRAC_CONST(0.521648148266897), FRAC_CONST(0.853160717221390) }, - { FRAC_CONST(0.519028233099081), FRAC_CONST(0.854757096048957) }, - { FRAC_CONST(0.516403432639864), FRAC_CONST(0.856345429577204) }, - { FRAC_CONST(0.513773771594868), FRAC_CONST(0.857925702856130) }, - { FRAC_CONST(0.511139274715464), FRAC_CONST(0.859497901011602) }, - { FRAC_CONST(0.508499966798541), FRAC_CONST(0.861062009245491) }, - { FRAC_CONST(0.505855872686269), FRAC_CONST(0.862618012835817) }, - { FRAC_CONST(0.503207017265869), FRAC_CONST(0.864165897136879) }, - { FRAC_CONST(0.500553425469378), FRAC_CONST(0.865705647579402) }, - { FRAC_CONST(0.497895122273411), FRAC_CONST(0.867237249670668) }, - { FRAC_CONST(0.495232132698931), FRAC_CONST(0.868760688994655) }, - { FRAC_CONST(0.492564481811011), FRAC_CONST(0.870275951212172) }, - { FRAC_CONST(0.489892194718595), FRAC_CONST(0.871783022060993) }, - { FRAC_CONST(0.487215296574269), FRAC_CONST(0.873281887355994) }, - { FRAC_CONST(0.484533812574016), FRAC_CONST(0.874772532989284) }, - { FRAC_CONST(0.481847767956986), FRAC_CONST(0.876254944930338) }, - { FRAC_CONST(0.479157188005253), FRAC_CONST(0.877729109226132) }, - { FRAC_CONST(0.476462098043581), FRAC_CONST(0.879195012001267) }, - { FRAC_CONST(0.473762523439183), FRAC_CONST(0.880652639458111) }, - { FRAC_CONST(0.471058489601483), FRAC_CONST(0.882101977876918) }, - { FRAC_CONST(0.468350021981877), FRAC_CONST(0.883543013615962) }, - { FRAC_CONST(0.465637146073494), FRAC_CONST(0.884975733111667) }, - { FRAC_CONST(0.462919887410955), FRAC_CONST(0.886400122878730) }, - { FRAC_CONST(0.460198271570134), FRAC_CONST(0.887816169510255) }, - { FRAC_CONST(0.457472324167916), FRAC_CONST(0.889223859677868) }, - { FRAC_CONST(0.454742070861955), FRAC_CONST(0.890623180131856) }, - { FRAC_CONST(0.452007537350437), FRAC_CONST(0.892014117701280) }, - { FRAC_CONST(0.449268749371830), FRAC_CONST(0.893396659294108) }, - { FRAC_CONST(0.446525732704651), FRAC_CONST(0.894770791897330) }, - { FRAC_CONST(0.443778513167218), FRAC_CONST(0.896136502577087) }, - { FRAC_CONST(0.441027116617407), FRAC_CONST(0.897493778478790) }, - { FRAC_CONST(0.438271568952410), FRAC_CONST(0.898842606827242) }, - { FRAC_CONST(0.435511896108492), FRAC_CONST(0.900182974926757) }, - { FRAC_CONST(0.432748124060744), FRAC_CONST(0.901514870161279) }, - { FRAC_CONST(0.429980278822841), FRAC_CONST(0.902838279994503) }, - { FRAC_CONST(0.427208386446796), FRAC_CONST(0.904153191969992) }, - { FRAC_CONST(0.424432473022717), FRAC_CONST(0.905459593711293) }, - { FRAC_CONST(0.421652564678558), FRAC_CONST(0.906757472922057) }, - { FRAC_CONST(0.418868687579875), FRAC_CONST(0.908046817386148) }, - { FRAC_CONST(0.416080867929579), FRAC_CONST(0.909327614967767) }, - { FRAC_CONST(0.413289131967691), FRAC_CONST(0.910599853611559) }, - { FRAC_CONST(0.410493505971093), FRAC_CONST(0.911863521342729) }, - { FRAC_CONST(0.407694016253280), FRAC_CONST(0.913118606267154) }, - { FRAC_CONST(0.404890689164118), FRAC_CONST(0.914365096571498) }, - { FRAC_CONST(0.402083551089587), FRAC_CONST(0.915602980523320) }, - { FRAC_CONST(0.399272628451541), FRAC_CONST(0.916832246471184) }, - { FRAC_CONST(0.396457947707454), FRAC_CONST(0.918052882844770) }, - { FRAC_CONST(0.393639535350173), FRAC_CONST(0.919264878154985) }, - { FRAC_CONST(0.390817417907669), FRAC_CONST(0.920468220994067) }, - { FRAC_CONST(0.387991621942785), FRAC_CONST(0.921662900035695) }, - { FRAC_CONST(0.385162174052990), FRAC_CONST(0.922848904035094) }, - { FRAC_CONST(0.382329100870125), FRAC_CONST(0.924026221829144) }, - { FRAC_CONST(0.379492429060153), FRAC_CONST(0.925194842336480) }, - { FRAC_CONST(0.376652185322910), FRAC_CONST(0.926354754557603) }, - { FRAC_CONST(0.373808396391851), FRAC_CONST(0.927505947574975) }, - { FRAC_CONST(0.370961089033802), FRAC_CONST(0.928648410553131) }, - { FRAC_CONST(0.368110290048703), FRAC_CONST(0.929782132738772) }, - { FRAC_CONST(0.365256026269360), FRAC_CONST(0.930907103460875) }, - { FRAC_CONST(0.362398324561191), FRAC_CONST(0.932023312130786) }, - { FRAC_CONST(0.359537211821973), FRAC_CONST(0.933130748242325) }, - { FRAC_CONST(0.356672714981588), FRAC_CONST(0.934229401371881) }, - { FRAC_CONST(0.353804861001772), FRAC_CONST(0.935319261178512) }, - { FRAC_CONST(0.350933676875858), FRAC_CONST(0.936400317404042) }, - { FRAC_CONST(0.348059189628526), FRAC_CONST(0.937472559873159) }, - { FRAC_CONST(0.345181426315543), FRAC_CONST(0.938535978493509) }, - { FRAC_CONST(0.342300414023514), FRAC_CONST(0.939590563255789) }, - { FRAC_CONST(0.339416179869623), FRAC_CONST(0.940636304233848) }, - { FRAC_CONST(0.336528751001382), FRAC_CONST(0.941673191584771) }, - { FRAC_CONST(0.333638154596371), FRAC_CONST(0.942701215548982) }, - { FRAC_CONST(0.330744417861983), FRAC_CONST(0.943720366450326) }, - { FRAC_CONST(0.327847568035171), FRAC_CONST(0.944730634696168) }, - { FRAC_CONST(0.324947632382188), FRAC_CONST(0.945732010777477) }, - { FRAC_CONST(0.322044638198335), FRAC_CONST(0.946724485268921) }, - { FRAC_CONST(0.319138612807696), FRAC_CONST(0.947708048828952) }, - { FRAC_CONST(0.316229583562890), FRAC_CONST(0.948682692199895) }, - { FRAC_CONST(0.313317577844809), FRAC_CONST(0.949648406208035) }, - { FRAC_CONST(0.310402623062359), FRAC_CONST(0.950605181763705) }, - { FRAC_CONST(0.307484746652204), FRAC_CONST(0.951553009861369) }, - { FRAC_CONST(0.304563976078509), FRAC_CONST(0.952491881579706) }, - { FRAC_CONST(0.301640338832679), FRAC_CONST(0.953421788081700) }, - { FRAC_CONST(0.298713862433100), FRAC_CONST(0.954342720614716) }, - { FRAC_CONST(0.295784574424884), FRAC_CONST(0.955254670510587) }, - { FRAC_CONST(0.292852502379605), FRAC_CONST(0.956157629185692) }, - { FRAC_CONST(0.289917673895041), FRAC_CONST(0.957051588141041) }, - { FRAC_CONST(0.286980116594916), FRAC_CONST(0.957936538962351) }, - { FRAC_CONST(0.284039858128637), FRAC_CONST(0.958812473320129) }, - { FRAC_CONST(0.281096926171038), FRAC_CONST(0.959679382969747) }, - { FRAC_CONST(0.278151348422115), FRAC_CONST(0.960537259751520) }, - { FRAC_CONST(0.275203152606767), FRAC_CONST(0.961386095590786) }, - { FRAC_CONST(0.272252366474537), FRAC_CONST(0.962225882497979) }, - { FRAC_CONST(0.269299017799346), FRAC_CONST(0.963056612568704) }, - { FRAC_CONST(0.266343134379238), FRAC_CONST(0.963878277983814) }, - { FRAC_CONST(0.263384744036113), FRAC_CONST(0.964690871009481) }, - { FRAC_CONST(0.260423874615468), FRAC_CONST(0.965494383997270) }, - { FRAC_CONST(0.257460553986133), FRAC_CONST(0.966288809384210) }, - { FRAC_CONST(0.254494810040011), FRAC_CONST(0.967074139692867) }, - { FRAC_CONST(0.251526670691813), FRAC_CONST(0.967850367531414) }, - { FRAC_CONST(0.248556163878797), FRAC_CONST(0.968617485593698) }, - { FRAC_CONST(0.245583317560504), FRAC_CONST(0.969375486659311) }, - { FRAC_CONST(0.242608159718497), FRAC_CONST(0.970124363593660) }, - { FRAC_CONST(0.239630718356094), FRAC_CONST(0.970864109348029) }, - { FRAC_CONST(0.236651021498106), FRAC_CONST(0.971594716959650) }, - { FRAC_CONST(0.233669097190577), FRAC_CONST(0.972316179551765) }, - { FRAC_CONST(0.230684973500512), FRAC_CONST(0.973028490333694) }, - { FRAC_CONST(0.227698678515621), FRAC_CONST(0.973731642600896) }, - { FRAC_CONST(0.224710240344050), FRAC_CONST(0.974425629735035) }, - { FRAC_CONST(0.221719687114115), FRAC_CONST(0.975110445204039) }, - { FRAC_CONST(0.218727046974045), FRAC_CONST(0.975786082562164) }, - { FRAC_CONST(0.215732348091706), FRAC_CONST(0.976452535450054) }, - { FRAC_CONST(0.212735618654346), FRAC_CONST(0.977109797594801) }, - { FRAC_CONST(0.209736886868323), FRAC_CONST(0.977757862810003) }, - { FRAC_CONST(0.206736180958844), FRAC_CONST(0.978396724995823) }, - { FRAC_CONST(0.203733529169694), FRAC_CONST(0.979026378139048) }, - { FRAC_CONST(0.200728959762976), FRAC_CONST(0.979646816313141) }, - { FRAC_CONST(0.197722501018842), FRAC_CONST(0.980258033678304) }, - { FRAC_CONST(0.194714181235226), FRAC_CONST(0.980860024481524) }, - { FRAC_CONST(0.191704028727580), FRAC_CONST(0.981452783056636) }, - { FRAC_CONST(0.188692071828605), FRAC_CONST(0.982036303824369) }, - { FRAC_CONST(0.185678338887988), FRAC_CONST(0.982610581292405) }, - { FRAC_CONST(0.182662858272129), FRAC_CONST(0.983175610055424) }, - { FRAC_CONST(0.179645658363882), FRAC_CONST(0.983731384795162) }, - { FRAC_CONST(0.176626767562281), FRAC_CONST(0.984277900280454) }, - { FRAC_CONST(0.173606214282275), FRAC_CONST(0.984815151367289) }, - { FRAC_CONST(0.170584026954464), FRAC_CONST(0.985343132998855) }, - { FRAC_CONST(0.167560234024824), FRAC_CONST(0.985861840205587) }, - { FRAC_CONST(0.164534863954446), FRAC_CONST(0.986371268105216) }, - { FRAC_CONST(0.161507945219266), FRAC_CONST(0.986871411902812) }, - { FRAC_CONST(0.158479506309796), FRAC_CONST(0.987362266890832) }, - { FRAC_CONST(0.155449575730856), FRAC_CONST(0.987843828449162) }, - { FRAC_CONST(0.152418182001307), FRAC_CONST(0.988316092045160) }, - { FRAC_CONST(0.149385353653780), FRAC_CONST(0.988779053233702) }, - { FRAC_CONST(0.146351119234411), FRAC_CONST(0.989232707657220) }, - { FRAC_CONST(0.143315507302572), FRAC_CONST(0.989677051045747) }, - { FRAC_CONST(0.140278546430595), FRAC_CONST(0.990112079216954) }, - { FRAC_CONST(0.137240265203516), FRAC_CONST(0.990537788076189) }, - { FRAC_CONST(0.134200692218792), FRAC_CONST(0.990954173616519) }, - { FRAC_CONST(0.131159856086043), FRAC_CONST(0.991361231918763) }, - { FRAC_CONST(0.128117785426777), FRAC_CONST(0.991758959151536) }, - { FRAC_CONST(0.125074508874121), FRAC_CONST(0.992147351571276) }, - { FRAC_CONST(0.122030055072553), FRAC_CONST(0.992526405522286) }, - { FRAC_CONST(0.118984452677633), FRAC_CONST(0.992896117436766) }, - { FRAC_CONST(0.115937730355728), FRAC_CONST(0.993256483834846) }, - { FRAC_CONST(0.112889916783750), FRAC_CONST(0.993607501324622) }, - { FRAC_CONST(0.109841040648883), FRAC_CONST(0.993949166602181) }, - { FRAC_CONST(0.106791130648307), FRAC_CONST(0.994281476451642) }, - { FRAC_CONST(0.103740215488939), FRAC_CONST(0.994604427745176) }, - { FRAC_CONST(0.100688323887154), FRAC_CONST(0.994918017443043) }, - { FRAC_CONST(0.097635484568517), FRAC_CONST(0.995222242593618) }, - { FRAC_CONST(0.094581726267515), FRAC_CONST(0.995517100333418) }, - { FRAC_CONST(0.091527077727285), FRAC_CONST(0.995802587887129) }, - { FRAC_CONST(0.088471567699341), FRAC_CONST(0.996078702567634) }, - { FRAC_CONST(0.085415224943307), FRAC_CONST(0.996345441776036) }, - { FRAC_CONST(0.082358078226647), FRAC_CONST(0.996602803001684) }, - { FRAC_CONST(0.079300156324388), FRAC_CONST(0.996850783822197) }, - { FRAC_CONST(0.076241488018856), FRAC_CONST(0.997089381903483) }, - { FRAC_CONST(0.073182102099403), FRAC_CONST(0.997318594999769) }, - { FRAC_CONST(0.070122027362134), FRAC_CONST(0.997538420953611) }, - { FRAC_CONST(0.067061292609637), FRAC_CONST(0.997748857695926) }, - { FRAC_CONST(0.063999926650714), FRAC_CONST(0.997949903246001) }, - { FRAC_CONST(0.060937958300107), FRAC_CONST(0.998141555711521) }, - { FRAC_CONST(0.057875416378229), FRAC_CONST(0.998323813288578) }, - { FRAC_CONST(0.054812329710890), FRAC_CONST(0.998496674261695) }, - { FRAC_CONST(0.051748727129028), FRAC_CONST(0.998660137003838) }, - { FRAC_CONST(0.048684637468439), FRAC_CONST(0.998814199976435) }, - { FRAC_CONST(0.045620089569500), FRAC_CONST(0.998958861729386) }, - { FRAC_CONST(0.042555112276904), FRAC_CONST(0.999094120901079) }, - { FRAC_CONST(0.039489734439384), FRAC_CONST(0.999219976218404) }, - { FRAC_CONST(0.036423984909444), FRAC_CONST(0.999336426496761) }, - { FRAC_CONST(0.033357892543086), FRAC_CONST(0.999443470640078) }, - { FRAC_CONST(0.030291486199539), FRAC_CONST(0.999541107640813) }, - { FRAC_CONST(0.027224794740988), FRAC_CONST(0.999629336579970) }, - { FRAC_CONST(0.024157847032300), FRAC_CONST(0.999708156627105) }, - { FRAC_CONST(0.021090671940755), FRAC_CONST(0.999777567040333) }, - { FRAC_CONST(0.018023298335774), FRAC_CONST(0.999837567166337) }, - { FRAC_CONST(0.014955755088644), FRAC_CONST(0.999888156440373) }, - { FRAC_CONST(0.011888071072252), FRAC_CONST(0.999929334386276) }, - { FRAC_CONST(0.008820275160808), FRAC_CONST(0.999961100616463) }, - { FRAC_CONST(0.005752396229574), FRAC_CONST(0.999983454831938) }, - { FRAC_CONST(0.002684463154596), FRAC_CONST(0.999996396822294) } -}; - -/* 64 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_256[] = -{ - { FRAC_CONST(0.999995293809576), FRAC_CONST(0.003067956762966) }, - { FRAC_CONST(0.999618822495179), FRAC_CONST(0.027608145778966) }, - { FRAC_CONST(0.998640218180265), FRAC_CONST(0.052131704680283) }, - { FRAC_CONST(0.997060070339483), FRAC_CONST(0.076623861392031) }, - { FRAC_CONST(0.994879330794806), FRAC_CONST(0.101069862754828) }, - { FRAC_CONST(0.992099313142192), FRAC_CONST(0.125454983411546) }, - { FRAC_CONST(0.988721691960324), FRAC_CONST(0.149764534677322) }, - { FRAC_CONST(0.984748501801904), FRAC_CONST(0.173983873387464) }, - { FRAC_CONST(0.980182135968117), FRAC_CONST(0.198098410717954) }, - { FRAC_CONST(0.975025345066994), FRAC_CONST(0.222093620973204) }, - { FRAC_CONST(0.969281235356549), FRAC_CONST(0.245955050335795) }, - { FRAC_CONST(0.962953266873684), FRAC_CONST(0.269668325572915) }, - { FRAC_CONST(0.956045251349996), FRAC_CONST(0.293219162694259) }, - { FRAC_CONST(0.948561349915730), FRAC_CONST(0.316593375556166) }, - { FRAC_CONST(0.940506070593268), FRAC_CONST(0.339776884406827) }, - { FRAC_CONST(0.931884265581668), FRAC_CONST(0.362755724367397) }, - { FRAC_CONST(0.922701128333879), FRAC_CONST(0.385516053843919) }, - { FRAC_CONST(0.912962190428398), FRAC_CONST(0.408044162864979) }, - { FRAC_CONST(0.902673318237259), FRAC_CONST(0.430326481340083) }, - { FRAC_CONST(0.891840709392343), FRAC_CONST(0.452349587233771) }, - { FRAC_CONST(0.880470889052161), FRAC_CONST(0.474100214650550) }, - { FRAC_CONST(0.868570705971341), FRAC_CONST(0.495565261825773) }, - { FRAC_CONST(0.856147328375194), FRAC_CONST(0.516731799017650) }, - { FRAC_CONST(0.843208239641845), FRAC_CONST(0.537587076295645) }, - { FRAC_CONST(0.829761233794523), FRAC_CONST(0.558118531220556) }, - { FRAC_CONST(0.815814410806734), FRAC_CONST(0.578313796411656) }, - { FRAC_CONST(0.801376171723140), FRAC_CONST(0.598160706996342) }, - { FRAC_CONST(0.786455213599086), FRAC_CONST(0.617647307937804) }, - { FRAC_CONST(0.771060524261814), FRAC_CONST(0.636761861236284) }, - { FRAC_CONST(0.755201376896537), FRAC_CONST(0.655492852999615) }, - { FRAC_CONST(0.738887324460615), FRAC_CONST(0.673829000378756) }, - { FRAC_CONST(0.722128193929215), FRAC_CONST(0.691759258364158) }, - { FRAC_CONST(0.704934080375905), FRAC_CONST(0.709272826438866) }, - { FRAC_CONST(0.687315340891759), FRAC_CONST(0.726359155084346) }, - { FRAC_CONST(0.669282588346636), FRAC_CONST(0.743007952135122) }, - { FRAC_CONST(0.650846684996381), FRAC_CONST(0.759209188978388) }, - { FRAC_CONST(0.632018735939809), FRAC_CONST(0.774953106594874) }, - { FRAC_CONST(0.612810082429410), FRAC_CONST(0.790230221437310) }, - { FRAC_CONST(0.593232295039800), FRAC_CONST(0.805031331142964) }, - { FRAC_CONST(0.573297166698042), FRAC_CONST(0.819347520076797) }, - { FRAC_CONST(0.553016705580028), FRAC_CONST(0.833170164701913) }, - { FRAC_CONST(0.532403127877198), FRAC_CONST(0.846490938774052) }, - { FRAC_CONST(0.511468850437971), FRAC_CONST(0.859301818357008) }, - { FRAC_CONST(0.490226483288291), FRAC_CONST(0.871595086655951) }, - { FRAC_CONST(0.468688822035828), FRAC_CONST(0.883363338665732) }, - { FRAC_CONST(0.446868840162374), FRAC_CONST(0.894599485631383) }, - { FRAC_CONST(0.424779681209109), FRAC_CONST(0.905296759318119) }, - { FRAC_CONST(0.402434650859419), FRAC_CONST(0.915448716088268) }, - { FRAC_CONST(0.379847208924051), FRAC_CONST(0.925049240782678) }, - { FRAC_CONST(0.357030961233430), FRAC_CONST(0.934092550404259) }, - { FRAC_CONST(0.333999651442009), FRAC_CONST(0.942573197601447) }, - { FRAC_CONST(0.310767152749611), FRAC_CONST(0.950486073949482) }, - { FRAC_CONST(0.287347459544730), FRAC_CONST(0.957826413027533) }, - { FRAC_CONST(0.263754678974832), FRAC_CONST(0.964589793289813) }, - { FRAC_CONST(0.240003022448742), FRAC_CONST(0.970772140728950) }, - { FRAC_CONST(0.216106797076220), FRAC_CONST(0.976369731330021) }, - { FRAC_CONST(0.192080397049892), FRAC_CONST(0.981379193313755) }, - { FRAC_CONST(0.167938294974731), FRAC_CONST(0.985797509167567) }, - { FRAC_CONST(0.143695033150295), FRAC_CONST(0.989622017463201) }, - { FRAC_CONST(0.119365214810991), FRAC_CONST(0.992850414459865) }, - { FRAC_CONST(0.094963495329639), FRAC_CONST(0.995480755491927) }, - { FRAC_CONST(0.070504573389614), FRAC_CONST(0.997511456140303) }, - { FRAC_CONST(0.046003182130915), FRAC_CONST(0.998941293186857) }, - { FRAC_CONST(0.021474080275470), FRAC_CONST(0.999769405351215) } -}; - -#ifdef LD_DEC -/* 256 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_1024[] = -{ - { FRAC_CONST(0.999999705862882), FRAC_CONST(0.000766990318743) }, - { FRAC_CONST(0.999976174986898), FRAC_CONST(0.006902858724730) }, - { FRAC_CONST(0.999914995573113), FRAC_CONST(0.013038467241987) }, - { FRAC_CONST(0.999816169924900), FRAC_CONST(0.019173584868323) }, - { FRAC_CONST(0.999679701762988), FRAC_CONST(0.025307980620025) }, - { FRAC_CONST(0.999505596225325), FRAC_CONST(0.031441423540560) }, - { FRAC_CONST(0.999293859866888), FRAC_CONST(0.037573682709270) }, - { FRAC_CONST(0.999044500659429), FRAC_CONST(0.043704527250063) }, - { FRAC_CONST(0.998757527991183), FRAC_CONST(0.049833726340107) }, - { FRAC_CONST(0.998432952666508), FRAC_CONST(0.055961049218521) }, - { FRAC_CONST(0.998070786905482), FRAC_CONST(0.062086265195060) }, - { FRAC_CONST(0.997671044343441), FRAC_CONST(0.068209143658806) }, - { FRAC_CONST(0.997233740030466), FRAC_CONST(0.074329454086846) }, - { FRAC_CONST(0.996758890430818), FRAC_CONST(0.080446966052950) }, - { FRAC_CONST(0.996246513422316), FRAC_CONST(0.086561449236251) }, - { FRAC_CONST(0.995696628295664), FRAC_CONST(0.092672673429913) }, - { FRAC_CONST(0.995109255753726), FRAC_CONST(0.098780408549800) }, - { FRAC_CONST(0.994484417910748), FRAC_CONST(0.104884424643135) }, - { FRAC_CONST(0.993822138291520), FRAC_CONST(0.110984491897163) }, - { FRAC_CONST(0.993122441830496), FRAC_CONST(0.117080380647801) }, - { FRAC_CONST(0.992385354870852), FRAC_CONST(0.123171861388280) }, - { FRAC_CONST(0.991610905163495), FRAC_CONST(0.129258704777796) }, - { FRAC_CONST(0.990799121866020), FRAC_CONST(0.135340681650134) }, - { FRAC_CONST(0.989950035541609), FRAC_CONST(0.141417563022303) }, - { FRAC_CONST(0.989063678157882), FRAC_CONST(0.147489120103154) }, - { FRAC_CONST(0.988140083085693), FRAC_CONST(0.153555124301993) }, - { FRAC_CONST(0.987179285097874), FRAC_CONST(0.159615347237193) }, - { FRAC_CONST(0.986181320367928), FRAC_CONST(0.165669560744784) }, - { FRAC_CONST(0.985146226468662), FRAC_CONST(0.171717536887050) }, - { FRAC_CONST(0.984074042370776), FRAC_CONST(0.177759047961107) }, - { FRAC_CONST(0.982964808441396), FRAC_CONST(0.183793866507478) }, - { FRAC_CONST(0.981818566442553), FRAC_CONST(0.189821765318656) }, - { FRAC_CONST(0.980635359529608), FRAC_CONST(0.195842517447658) }, - { FRAC_CONST(0.979415232249635), FRAC_CONST(0.201855896216568) }, - { FRAC_CONST(0.978158230539735), FRAC_CONST(0.207861675225075) }, - { FRAC_CONST(0.976864401725313), FRAC_CONST(0.213859628358994) }, - { FRAC_CONST(0.975533794518291), FRAC_CONST(0.219849529798779) }, - { FRAC_CONST(0.974166459015280), FRAC_CONST(0.225831154028026) }, - { FRAC_CONST(0.972762446695689), FRAC_CONST(0.231804275841965) }, - { FRAC_CONST(0.971321810419786), FRAC_CONST(0.237768670355934) }, - { FRAC_CONST(0.969844604426715), FRAC_CONST(0.243724113013852) }, - { FRAC_CONST(0.968330884332445), FRAC_CONST(0.249670379596669) }, - { FRAC_CONST(0.966780707127683), FRAC_CONST(0.255607246230807) }, - { FRAC_CONST(0.965194131175725), FRAC_CONST(0.261534489396596) }, - { FRAC_CONST(0.963571216210257), FRAC_CONST(0.267451885936678) }, - { FRAC_CONST(0.961912023333112), FRAC_CONST(0.273359213064419) }, - { FRAC_CONST(0.960216615011963), FRAC_CONST(0.279256248372291) }, - { FRAC_CONST(0.958485055077976), FRAC_CONST(0.285142769840249) }, - { FRAC_CONST(0.956717408723403), FRAC_CONST(0.291018555844085) }, - { FRAC_CONST(0.954913742499131), FRAC_CONST(0.296883385163778) }, - { FRAC_CONST(0.953074124312172), FRAC_CONST(0.302737036991819) }, - { FRAC_CONST(0.951198623423113), FRAC_CONST(0.308579290941525) }, - { FRAC_CONST(0.949287310443502), FRAC_CONST(0.314409927055337) }, - { FRAC_CONST(0.947340257333192), FRAC_CONST(0.320228725813100) }, - { FRAC_CONST(0.945357537397632), FRAC_CONST(0.326035468140330) }, - { FRAC_CONST(0.943339225285108), FRAC_CONST(0.331829935416461) }, - { FRAC_CONST(0.941285396983929), FRAC_CONST(0.337611909483075) }, - { FRAC_CONST(0.939196129819570), FRAC_CONST(0.343381172652115) }, - { FRAC_CONST(0.937071502451759), FRAC_CONST(0.349137507714085) }, - { FRAC_CONST(0.934911594871516), FRAC_CONST(0.354880697946223) }, - { FRAC_CONST(0.932716488398140), FRAC_CONST(0.360610527120662) }, - { FRAC_CONST(0.930486265676150), FRAC_CONST(0.366326779512574) }, - { FRAC_CONST(0.928221010672169), FRAC_CONST(0.372029239908285) }, - { FRAC_CONST(0.925920808671770), FRAC_CONST(0.377717693613386) }, - { FRAC_CONST(0.923585746276257), FRAC_CONST(0.383391926460809) }, - { FRAC_CONST(0.921215911399409), FRAC_CONST(0.389051724818894) }, - { FRAC_CONST(0.918811393264170), FRAC_CONST(0.394696875599434) }, - { FRAC_CONST(0.916372282399289), FRAC_CONST(0.400327166265690) }, - { FRAC_CONST(0.913898670635912), FRAC_CONST(0.405942384840403) }, - { FRAC_CONST(0.911390651104122), FRAC_CONST(0.411542319913765) }, - { FRAC_CONST(0.908848318229439), FRAC_CONST(0.417126760651388) }, - { FRAC_CONST(0.906271767729258), FRAC_CONST(0.422695496802233) }, - { FRAC_CONST(0.903661096609248), FRAC_CONST(0.428248318706532) }, - { FRAC_CONST(0.901016403159702), FRAC_CONST(0.433785017303679) }, - { FRAC_CONST(0.898337786951834), FRAC_CONST(0.439305384140100) }, - { FRAC_CONST(0.895625348834030), FRAC_CONST(0.444809211377105) }, - { FRAC_CONST(0.892879190928052), FRAC_CONST(0.450296291798709) }, - { FRAC_CONST(0.890099416625192), FRAC_CONST(0.455766418819435) }, - { FRAC_CONST(0.887286130582383), FRAC_CONST(0.461219386492092) }, - { FRAC_CONST(0.884439438718254), FRAC_CONST(0.466654989515531) }, - { FRAC_CONST(0.881559448209144), FRAC_CONST(0.472073023242369) }, - { FRAC_CONST(0.878646267485068), FRAC_CONST(0.477473283686698) }, - { FRAC_CONST(0.875700006225635), FRAC_CONST(0.482855567531766) }, - { FRAC_CONST(0.872720775355914), FRAC_CONST(0.488219672137627) }, - { FRAC_CONST(0.869708687042266), FRAC_CONST(0.493565395548775) }, - { FRAC_CONST(0.866663854688111), FRAC_CONST(0.498892536501745) }, - { FRAC_CONST(0.863586392929668), FRAC_CONST(0.504200894432690) }, - { FRAC_CONST(0.860476417631632), FRAC_CONST(0.509490269484936) }, - { FRAC_CONST(0.857334045882816), FRAC_CONST(0.514760462516501) }, - { FRAC_CONST(0.854159395991739), FRAC_CONST(0.520011275107596) }, - { FRAC_CONST(0.850952587482176), FRAC_CONST(0.525242509568095) }, - { FRAC_CONST(0.847713741088654), FRAC_CONST(0.530453968944976) }, - { FRAC_CONST(0.844442978751911), FRAC_CONST(0.535645457029741) }, - { FRAC_CONST(0.841140423614298), FRAC_CONST(0.540816778365797) }, - { FRAC_CONST(0.837806200015151), FRAC_CONST(0.545967738255818) }, - { FRAC_CONST(0.834440433486103), FRAC_CONST(0.551098142769075) }, - { FRAC_CONST(0.831043250746362), FRAC_CONST(0.556207798748740) }, - { FRAC_CONST(0.827614779697938), FRAC_CONST(0.561296513819151) }, - { FRAC_CONST(0.824155149420829), FRAC_CONST(0.566364096393064) }, - { FRAC_CONST(0.820664490168157), FRAC_CONST(0.571410355678857) }, - { FRAC_CONST(0.817142933361273), FRAC_CONST(0.576435101687722) }, - { FRAC_CONST(0.813590611584799), FRAC_CONST(0.581438145240810) }, - { FRAC_CONST(0.810007658581641), FRAC_CONST(0.586419297976361) }, - { FRAC_CONST(0.806394209247956), FRAC_CONST(0.591378372356788) }, - { FRAC_CONST(0.802750399628069), FRAC_CONST(0.596315181675744) }, - { FRAC_CONST(0.799076366909352), FRAC_CONST(0.601229540065149) }, - { FRAC_CONST(0.795372249417061), FRAC_CONST(0.606121262502186) }, - { FRAC_CONST(0.791638186609126), FRAC_CONST(0.610990164816272) }, - { FRAC_CONST(0.787874319070900), FRAC_CONST(0.615836063695985) }, - { FRAC_CONST(0.784080788509870), FRAC_CONST(0.620658776695972) }, - { FRAC_CONST(0.780257737750317), FRAC_CONST(0.625458122243814) }, - { FRAC_CONST(0.776405310727940), FRAC_CONST(0.630233919646864) }, - { FRAC_CONST(0.772523652484441), FRAC_CONST(0.634985989099049) }, - { FRAC_CONST(0.768612909162058), FRAC_CONST(0.639714151687640) }, - { FRAC_CONST(0.764673227998067), FRAC_CONST(0.644418229399988) }, - { FRAC_CONST(0.760704757319237), FRAC_CONST(0.649098045130226) }, - { FRAC_CONST(0.756707646536246), FRAC_CONST(0.653753422685936) }, - { FRAC_CONST(0.752682046138055), FRAC_CONST(0.658384186794785) }, - { FRAC_CONST(0.748628107686245), FRAC_CONST(0.662990163111121) }, - { FRAC_CONST(0.744545983809307), FRAC_CONST(0.667571178222540) }, - { FRAC_CONST(0.740435828196898), FRAC_CONST(0.672127059656412) }, - { FRAC_CONST(0.736297795594053), FRAC_CONST(0.676657635886375) }, - { FRAC_CONST(0.732132041795361), FRAC_CONST(0.681162736338795) }, - { FRAC_CONST(0.727938723639099), FRAC_CONST(0.685642191399187) }, - { FRAC_CONST(0.723717999001324), FRAC_CONST(0.690095832418600) }, - { FRAC_CONST(0.719470026789933), FRAC_CONST(0.694523491719966) }, - { FRAC_CONST(0.715194966938680), FRAC_CONST(0.698925002604414) }, - { FRAC_CONST(0.710892980401152), FRAC_CONST(0.703300199357549) }, - { FRAC_CONST(0.706564229144710), FRAC_CONST(0.707648917255684) }, - { FRAC_CONST(0.702208876144392), FRAC_CONST(0.711970992572050) }, - { FRAC_CONST(0.697827085376777), FRAC_CONST(0.716266262582953) }, - { FRAC_CONST(0.693419021813812), FRAC_CONST(0.720534565573905) }, - { FRAC_CONST(0.688984851416597), FRAC_CONST(0.724775740845711) }, - { FRAC_CONST(0.684524741129142), FRAC_CONST(0.728989628720519) }, - { FRAC_CONST(0.680038858872079), FRAC_CONST(0.733176070547833) }, - { FRAC_CONST(0.675527373536339), FRAC_CONST(0.737334908710483) }, - { FRAC_CONST(0.670990454976794), FRAC_CONST(0.741465986630563) }, - { FRAC_CONST(0.666428274005865), FRAC_CONST(0.745569148775325) }, - { FRAC_CONST(0.661841002387087), FRAC_CONST(0.749644240663033) }, - { FRAC_CONST(0.657228812828643), FRAC_CONST(0.753691108868781) }, - { FRAC_CONST(0.652591878976863), FRAC_CONST(0.757709601030268) }, - { FRAC_CONST(0.647930375409685), FRAC_CONST(0.761699565853535) }, - { FRAC_CONST(0.643244477630086), FRAC_CONST(0.765660853118662) }, - { FRAC_CONST(0.638534362059467), FRAC_CONST(0.769593313685423) }, - { FRAC_CONST(0.633800206031017), FRAC_CONST(0.773496799498899) }, - { FRAC_CONST(0.629042187783036), FRAC_CONST(0.777371163595056) }, - { FRAC_CONST(0.624260486452221), FRAC_CONST(0.781216260106276) }, - { FRAC_CONST(0.619455282066924), FRAC_CONST(0.785031944266848) }, - { FRAC_CONST(0.614626755540375), FRAC_CONST(0.788818072418420) }, - { FRAC_CONST(0.609775088663868), FRAC_CONST(0.792574502015408) }, - { FRAC_CONST(0.604900464099920), FRAC_CONST(0.796301091630359) }, - { FRAC_CONST(0.600003065375389), FRAC_CONST(0.799997700959282) }, - { FRAC_CONST(0.595083076874570), FRAC_CONST(0.803664190826924) }, - { FRAC_CONST(0.590140683832249), FRAC_CONST(0.807300423192014) }, - { FRAC_CONST(0.585176072326730), FRAC_CONST(0.810906261152460) }, - { FRAC_CONST(0.580189429272832), FRAC_CONST(0.814481568950499) }, - { FRAC_CONST(0.575180942414845), FRAC_CONST(0.818026211977813) }, - { FRAC_CONST(0.570150800319470), FRAC_CONST(0.821540056780598) }, - { FRAC_CONST(0.565099192368714), FRAC_CONST(0.825022971064580) }, - { FRAC_CONST(0.560026308752760), FRAC_CONST(0.828474823700007) }, - { FRAC_CONST(0.554932340462810), FRAC_CONST(0.831895484726578) }, - { FRAC_CONST(0.549817479283891), FRAC_CONST(0.835284825358337) }, - { FRAC_CONST(0.544681917787635), FRAC_CONST(0.838642717988527) }, - { FRAC_CONST(0.539525849325029), FRAC_CONST(0.841969036194388) }, - { FRAC_CONST(0.534349468019138), FRAC_CONST(0.845263654741918) }, - { FRAC_CONST(0.529152968757791), FRAC_CONST(0.848526449590593) }, - { FRAC_CONST(0.523936547186249), FRAC_CONST(0.851757297898029) }, - { FRAC_CONST(0.518700399699835), FRAC_CONST(0.854956078024615) }, - { FRAC_CONST(0.513444723436544), FRAC_CONST(0.858122669538086) }, - { FRAC_CONST(0.508169716269615), FRAC_CONST(0.861256953218062) }, - { FRAC_CONST(0.502875576800087), FRAC_CONST(0.864358811060534) }, - { FRAC_CONST(0.497562504349319), FRAC_CONST(0.867428126282307) }, - { FRAC_CONST(0.492230698951486), FRAC_CONST(0.870464783325398) }, - { FRAC_CONST(0.486880361346047), FRAC_CONST(0.873468667861385) }, - { FRAC_CONST(0.481511692970190), FRAC_CONST(0.876439666795714) }, - { FRAC_CONST(0.476124895951244), FRAC_CONST(0.879377668271953) }, - { FRAC_CONST(0.470720173099072), FRAC_CONST(0.882282561676009) }, - { FRAC_CONST(0.465297727898435), FRAC_CONST(0.885154237640285) }, - { FRAC_CONST(0.459857764501330), FRAC_CONST(0.887992588047806) }, - { FRAC_CONST(0.454400487719304), FRAC_CONST(0.890797506036281) }, - { FRAC_CONST(0.448926103015743), FRAC_CONST(0.893568886002136) }, - { FRAC_CONST(0.443434816498138), FRAC_CONST(0.896306623604480) }, - { FRAC_CONST(0.437926834910323), FRAC_CONST(0.899010615769039) }, - { FRAC_CONST(0.432402365624690), FRAC_CONST(0.901680760692038) }, - { FRAC_CONST(0.426861616634386), FRAC_CONST(0.904316957844028) }, - { FRAC_CONST(0.421304796545480), FRAC_CONST(0.906919107973678) }, - { FRAC_CONST(0.415732114569105), FRAC_CONST(0.909487113111505) }, - { FRAC_CONST(0.410143780513590), FRAC_CONST(0.912020876573568) }, - { FRAC_CONST(0.404540004776553), FRAC_CONST(0.914520302965104) }, - { FRAC_CONST(0.398920998336983), FRAC_CONST(0.916985298184123) }, - { FRAC_CONST(0.393286972747297), FRAC_CONST(0.919415769424947) }, - { FRAC_CONST(0.387638140125373), FRAC_CONST(0.921811625181708) }, - { FRAC_CONST(0.381974713146567), FRAC_CONST(0.924172775251791) }, - { FRAC_CONST(0.376296905035705), FRAC_CONST(0.926499130739231) }, - { FRAC_CONST(0.370604929559052), FRAC_CONST(0.928790604058057) }, - { FRAC_CONST(0.364899001016267), FRAC_CONST(0.931047108935595) }, - { FRAC_CONST(0.359179334232337), FRAC_CONST(0.933268560415712) }, - { FRAC_CONST(0.353446144549481), FRAC_CONST(0.935454874862015) }, - { FRAC_CONST(0.347699647819051), FRAC_CONST(0.937605969961000) }, - { FRAC_CONST(0.341940060393402), FRAC_CONST(0.939721764725153) }, - { FRAC_CONST(0.336167599117745), FRAC_CONST(0.941802179495998) }, - { FRAC_CONST(0.330382481321983), FRAC_CONST(0.943847135947093) }, - { FRAC_CONST(0.324584924812532), FRAC_CONST(0.945856557086984) }, - { FRAC_CONST(0.318775147864118), FRAC_CONST(0.947830367262101) }, - { FRAC_CONST(0.312953369211560), FRAC_CONST(0.949768492159607) }, - { FRAC_CONST(0.307119808041533), FRAC_CONST(0.951670858810194) }, - { FRAC_CONST(0.301274683984318), FRAC_CONST(0.953537395590833) }, - { FRAC_CONST(0.295418217105532), FRAC_CONST(0.955368032227470) }, - { FRAC_CONST(0.289550627897843), FRAC_CONST(0.957162699797670) }, - { FRAC_CONST(0.283672137272669), FRAC_CONST(0.958921330733213) }, - { FRAC_CONST(0.277782966551858), FRAC_CONST(0.960643858822638) }, - { FRAC_CONST(0.271883337459360), FRAC_CONST(0.962330219213737) }, - { FRAC_CONST(0.265973472112876), FRAC_CONST(0.963980348415994) }, - { FRAC_CONST(0.260053593015495), FRAC_CONST(0.965594184302977) }, - { FRAC_CONST(0.254123923047321), FRAC_CONST(0.967171666114677) }, - { FRAC_CONST(0.248184685457075), FRAC_CONST(0.968712734459795) }, - { FRAC_CONST(0.242236103853696), FRAC_CONST(0.970217331317979) }, - { FRAC_CONST(0.236278402197920), FRAC_CONST(0.971685400042009) }, - { FRAC_CONST(0.230311804793846), FRAC_CONST(0.973116885359925) }, - { FRAC_CONST(0.224336536280494), FRAC_CONST(0.974511733377116) }, - { FRAC_CONST(0.218352821623346), FRAC_CONST(0.975869891578341) }, - { FRAC_CONST(0.212360886105879), FRAC_CONST(0.977191308829712) }, - { FRAC_CONST(0.206360955321076), FRAC_CONST(0.978475935380617) }, - { FRAC_CONST(0.200353255162940), FRAC_CONST(0.979723722865591) }, - { FRAC_CONST(0.194338011817989), FRAC_CONST(0.980934624306142) }, - { FRAC_CONST(0.188315451756732), FRAC_CONST(0.982108594112514) }, - { FRAC_CONST(0.182285801725153), FRAC_CONST(0.983245588085407) }, - { FRAC_CONST(0.176249288736168), FRAC_CONST(0.984345563417642) }, - { FRAC_CONST(0.170206140061078), FRAC_CONST(0.985408478695768) }, - { FRAC_CONST(0.164156583221016), FRAC_CONST(0.986434293901627) }, - { FRAC_CONST(0.158100845978377), FRAC_CONST(0.987422970413855) }, - { FRAC_CONST(0.152039156328246), FRAC_CONST(0.988374471009341) }, - { FRAC_CONST(0.145971742489812), FRAC_CONST(0.989288759864625) }, - { FRAC_CONST(0.139898832897777), FRAC_CONST(0.990165802557248) }, - { FRAC_CONST(0.133820656193755), FRAC_CONST(0.991005566067049) }, - { FRAC_CONST(0.127737441217662), FRAC_CONST(0.991808018777406) }, - { FRAC_CONST(0.121649416999106), FRAC_CONST(0.992573130476429) }, - { FRAC_CONST(0.115556812748755), FRAC_CONST(0.993300872358093) }, - { FRAC_CONST(0.109459857849718), FRAC_CONST(0.993991217023329) }, - { FRAC_CONST(0.103358781848900), FRAC_CONST(0.994644138481051) }, - { FRAC_CONST(0.097253814448363), FRAC_CONST(0.995259612149133) }, - { FRAC_CONST(0.091145185496681), FRAC_CONST(0.995837614855342) }, - { FRAC_CONST(0.085033124980280), FRAC_CONST(0.996378124838200) }, - { FRAC_CONST(0.078917863014785), FRAC_CONST(0.996881121747814) }, - { FRAC_CONST(0.072799629836352), FRAC_CONST(0.997346586646633) }, - { FRAC_CONST(0.066678655793002), FRAC_CONST(0.997774502010168) }, - { FRAC_CONST(0.060555171335948), FRAC_CONST(0.998164851727646) }, - { FRAC_CONST(0.054429407010919), FRAC_CONST(0.998517621102622) }, - { FRAC_CONST(0.048301593449480), FRAC_CONST(0.998832796853528) }, - { FRAC_CONST(0.042171961360348), FRAC_CONST(0.999110367114175) }, - { FRAC_CONST(0.036040741520706), FRAC_CONST(0.999350321434199) }, - { FRAC_CONST(0.029908164767517), FRAC_CONST(0.999552650779457) }, - { FRAC_CONST(0.023774461988828), FRAC_CONST(0.999717347532362) }, - { FRAC_CONST(0.017639864115082), FRAC_CONST(0.999844405492175) }, - { FRAC_CONST(0.011504602110423), FRAC_CONST(0.999933819875236) }, - { FRAC_CONST(0.005368906963996), FRAC_CONST(0.999985587315143) } -}; -#endif // LD_DEC - -#ifdef ALLOW_SMALL_FRAMELENGTH -/* 480 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_1920[] = -{ - { FRAC_CONST(0.999999916334328), FRAC_CONST(0.000409061532028) }, - { FRAC_CONST(0.999993223088129), FRAC_CONST(0.003681545574400) }, - { FRAC_CONST(0.999975820717897), FRAC_CONST(0.006953990190376) }, - { FRAC_CONST(0.999947709409999), FRAC_CONST(0.010226360334704) }, - { FRAC_CONST(0.999908889465485), FRAC_CONST(0.013498620962929) }, - { FRAC_CONST(0.999859361300084), FRAC_CONST(0.016770737031768) }, - { FRAC_CONST(0.999799125444203), FRAC_CONST(0.020042673499487) }, - { FRAC_CONST(0.999728182542920), FRAC_CONST(0.023314395326274) }, - { FRAC_CONST(0.999646533355977), FRAC_CONST(0.026585867474619) }, - { FRAC_CONST(0.999554178757770), FRAC_CONST(0.029857054909681) }, - { FRAC_CONST(0.999451119737344), FRAC_CONST(0.033127922599673) }, - { FRAC_CONST(0.999337357398377), FRAC_CONST(0.036398435516228) }, - { FRAC_CONST(0.999212892959173), FRAC_CONST(0.039668558634781) }, - { FRAC_CONST(0.999077727752645), FRAC_CONST(0.042938256934941) }, - { FRAC_CONST(0.998931863226306), FRAC_CONST(0.046207495400865) }, - { FRAC_CONST(0.998775300942246), FRAC_CONST(0.049476239021636) }, - { FRAC_CONST(0.998608042577122), FRAC_CONST(0.052744452791636) }, - { FRAC_CONST(0.998430089922136), FRAC_CONST(0.056012101710921) }, - { FRAC_CONST(0.998241444883019), FRAC_CONST(0.059279150785597) }, - { FRAC_CONST(0.998042109480008), FRAC_CONST(0.062545565028192) }, - { FRAC_CONST(0.997832085847824), FRAC_CONST(0.065811309458034) }, - { FRAC_CONST(0.997611376235651), FRAC_CONST(0.069076349101624) }, - { FRAC_CONST(0.997379983007114), FRAC_CONST(0.072340648993011) }, - { FRAC_CONST(0.997137908640245), FRAC_CONST(0.075604174174166) }, - { FRAC_CONST(0.996885155727469), FRAC_CONST(0.078866889695354) }, - { FRAC_CONST(0.996621726975566), FRAC_CONST(0.082128760615515) }, - { FRAC_CONST(0.996347625205645), FRAC_CONST(0.085389752002632) }, - { FRAC_CONST(0.996062853353117), FRAC_CONST(0.088649828934106) }, - { FRAC_CONST(0.995767414467660), FRAC_CONST(0.091908956497133) }, - { FRAC_CONST(0.995461311713186), FRAC_CONST(0.095167099789075) }, - { FRAC_CONST(0.995144548367810), FRAC_CONST(0.098424223917834) }, - { FRAC_CONST(0.994817127823813), FRAC_CONST(0.101680294002229) }, - { FRAC_CONST(0.994479053587606), FRAC_CONST(0.104935275172364) }, - { FRAC_CONST(0.994130329279692), FRAC_CONST(0.108189132570007) }, - { FRAC_CONST(0.993770958634630), FRAC_CONST(0.111441831348957) }, - { FRAC_CONST(0.993400945500988), FRAC_CONST(0.114693336675426) }, - { FRAC_CONST(0.993020293841312), FRAC_CONST(0.117943613728403) }, - { FRAC_CONST(0.992629007732074), FRAC_CONST(0.121192627700032) }, - { FRAC_CONST(0.992227091363634), FRAC_CONST(0.124440343795983) }, - { FRAC_CONST(0.991814549040194), FRAC_CONST(0.127686727235827) }, - { FRAC_CONST(0.991391385179751), FRAC_CONST(0.130931743253405) }, - { FRAC_CONST(0.990957604314048), FRAC_CONST(0.134175357097202) }, - { FRAC_CONST(0.990513211088533), FRAC_CONST(0.137417534030720) }, - { FRAC_CONST(0.990058210262297), FRAC_CONST(0.140658239332849) }, - { FRAC_CONST(0.989592606708036), FRAC_CONST(0.143897438298239) }, - { FRAC_CONST(0.989116405411988), FRAC_CONST(0.147135096237670) }, - { FRAC_CONST(0.988629611473887), FRAC_CONST(0.150371178478428) }, - { FRAC_CONST(0.988132230106905), FRAC_CONST(0.153605650364672) }, - { FRAC_CONST(0.987624266637598), FRAC_CONST(0.156838477257806) }, - { FRAC_CONST(0.987105726505845), FRAC_CONST(0.160069624536852) }, - { FRAC_CONST(0.986576615264794), FRAC_CONST(0.163299057598817) }, - { FRAC_CONST(0.986036938580803), FRAC_CONST(0.166526741859069) }, - { FRAC_CONST(0.985486702233375), FRAC_CONST(0.169752642751702) }, - { FRAC_CONST(0.984925912115099), FRAC_CONST(0.172976725729910) }, - { FRAC_CONST(0.984354574231587), FRAC_CONST(0.176198956266353) }, - { FRAC_CONST(0.983772694701407), FRAC_CONST(0.179419299853531) }, - { FRAC_CONST(0.983180279756024), FRAC_CONST(0.182637722004152) }, - { FRAC_CONST(0.982577335739725), FRAC_CONST(0.185854188251500) }, - { FRAC_CONST(0.981963869109555), FRAC_CONST(0.189068664149806) }, - { FRAC_CONST(0.981339886435250), FRAC_CONST(0.192281115274616) }, - { FRAC_CONST(0.980705394399163), FRAC_CONST(0.195491507223158) }, - { FRAC_CONST(0.980060399796194), FRAC_CONST(0.198699805614714) }, - { FRAC_CONST(0.979404909533716), FRAC_CONST(0.201905976090986) }, - { FRAC_CONST(0.978738930631504), FRAC_CONST(0.205109984316464) }, - { FRAC_CONST(0.978062470221657), FRAC_CONST(0.208311795978794) }, - { FRAC_CONST(0.977375535548522), FRAC_CONST(0.211511376789145) }, - { FRAC_CONST(0.976678133968618), FRAC_CONST(0.214708692482577) }, - { FRAC_CONST(0.975970272950556), FRAC_CONST(0.217903708818409) }, - { FRAC_CONST(0.975251960074958), FRAC_CONST(0.221096391580581) }, - { FRAC_CONST(0.974523203034377), FRAC_CONST(0.224286706578026) }, - { FRAC_CONST(0.973784009633218), FRAC_CONST(0.227474619645035) }, - { FRAC_CONST(0.973034387787646), FRAC_CONST(0.230660096641619) }, - { FRAC_CONST(0.972274345525510), FRAC_CONST(0.233843103453878) }, - { FRAC_CONST(0.971503890986252), FRAC_CONST(0.237023605994367) }, - { FRAC_CONST(0.970723032420820), FRAC_CONST(0.240201570202459) }, - { FRAC_CONST(0.969931778191584), FRAC_CONST(0.243376962044711) }, - { FRAC_CONST(0.969130136772239), FRAC_CONST(0.246549747515226) }, - { FRAC_CONST(0.968318116747721), FRAC_CONST(0.249719892636022) }, - { FRAC_CONST(0.967495726814114), FRAC_CONST(0.252887363457390) }, - { FRAC_CONST(0.966662975778551), FRAC_CONST(0.256052126058264) }, - { FRAC_CONST(0.965819872559127), FRAC_CONST(0.259214146546579) }, - { FRAC_CONST(0.964966426184802), FRAC_CONST(0.262373391059634) }, - { FRAC_CONST(0.964102645795299), FRAC_CONST(0.265529825764461) }, - { FRAC_CONST(0.963228540641012), FRAC_CONST(0.268683416858178) }, - { FRAC_CONST(0.962344120082907), FRAC_CONST(0.271834130568359) }, - { FRAC_CONST(0.961449393592416), FRAC_CONST(0.274981933153391) }, - { FRAC_CONST(0.960544370751341), FRAC_CONST(0.278126790902837) }, - { FRAC_CONST(0.959629061251750), FRAC_CONST(0.281268670137799) }, - { FRAC_CONST(0.958703474895872), FRAC_CONST(0.284407537211272) }, - { FRAC_CONST(0.957767621595993), FRAC_CONST(0.287543358508512) }, - { FRAC_CONST(0.956821511374351), FRAC_CONST(0.290676100447394) }, - { FRAC_CONST(0.955865154363025), FRAC_CONST(0.293805729478766) }, - { FRAC_CONST(0.954898560803832), FRAC_CONST(0.296932212086818) }, - { FRAC_CONST(0.953921741048211), FRAC_CONST(0.300055514789431) }, - { FRAC_CONST(0.952934705557117), FRAC_CONST(0.303175604138543) }, - { FRAC_CONST(0.951937464900908), FRAC_CONST(0.306292446720504) }, - { FRAC_CONST(0.950930029759229), FRAC_CONST(0.309406009156434) }, - { FRAC_CONST(0.949912410920903), FRAC_CONST(0.312516258102580) }, - { FRAC_CONST(0.948884619283808), FRAC_CONST(0.315623160250676) }, - { FRAC_CONST(0.947846665854767), FRAC_CONST(0.318726682328294) }, - { FRAC_CONST(0.946798561749429), FRAC_CONST(0.321826791099207) }, - { FRAC_CONST(0.945740318192145), FRAC_CONST(0.324923453363742) }, - { FRAC_CONST(0.944671946515855), FRAC_CONST(0.328016635959131) }, - { FRAC_CONST(0.943593458161960), FRAC_CONST(0.331106305759876) }, - { FRAC_CONST(0.942504864680205), FRAC_CONST(0.334192429678095) }, - { FRAC_CONST(0.941406177728551), FRAC_CONST(0.337274974663880) }, - { FRAC_CONST(0.940297409073052), FRAC_CONST(0.340353907705650) }, - { FRAC_CONST(0.939178570587730), FRAC_CONST(0.343429195830507) }, - { FRAC_CONST(0.938049674254446), FRAC_CONST(0.346500806104585) }, - { FRAC_CONST(0.936910732162774), FRAC_CONST(0.349568705633406) }, - { FRAC_CONST(0.935761756509868), FRAC_CONST(0.352632861562230) }, - { FRAC_CONST(0.934602759600334), FRAC_CONST(0.355693241076410) }, - { FRAC_CONST(0.933433753846097), FRAC_CONST(0.358749811401739) }, - { FRAC_CONST(0.932254751766271), FRAC_CONST(0.361802539804806) }, - { FRAC_CONST(0.931065765987021), FRAC_CONST(0.364851393593340) }, - { FRAC_CONST(0.929866809241428), FRAC_CONST(0.367896340116568) }, - { FRAC_CONST(0.928657894369357), FRAC_CONST(0.370937346765559) }, - { FRAC_CONST(0.927439034317314), FRAC_CONST(0.373974380973575) }, - { FRAC_CONST(0.926210242138311), FRAC_CONST(0.377007410216418) }, - { FRAC_CONST(0.924971530991726), FRAC_CONST(0.380036402012783) }, - { FRAC_CONST(0.923722914143160), FRAC_CONST(0.383061323924602) }, - { FRAC_CONST(0.922464404964295), FRAC_CONST(0.386082143557389) }, - { FRAC_CONST(0.921196016932755), FRAC_CONST(0.389098828560595) }, - { FRAC_CONST(0.919917763631956), FRAC_CONST(0.392111346627946) }, - { FRAC_CONST(0.918629658750963), FRAC_CONST(0.395119665497795) }, - { FRAC_CONST(0.917331716084346), FRAC_CONST(0.398123752953462) }, - { FRAC_CONST(0.916023949532027), FRAC_CONST(0.401123576823585) }, - { FRAC_CONST(0.914706373099136), FRAC_CONST(0.404119104982459) }, - { FRAC_CONST(0.913379000895858), FRAC_CONST(0.407110305350386) }, - { FRAC_CONST(0.912041847137282), FRAC_CONST(0.410097145894012) }, - { FRAC_CONST(0.910694926143251), FRAC_CONST(0.413079594626675) }, - { FRAC_CONST(0.909338252338207), FRAC_CONST(0.416057619608744) }, - { FRAC_CONST(0.907971840251037), FRAC_CONST(0.419031188947965) }, - { FRAC_CONST(0.906595704514915), FRAC_CONST(0.422000270799800) }, - { FRAC_CONST(0.905209859867151), FRAC_CONST(0.424964833367766) }, - { FRAC_CONST(0.903814321149027), FRAC_CONST(0.427924844903780) }, - { FRAC_CONST(0.902409103305641), FRAC_CONST(0.430880273708497) }, - { FRAC_CONST(0.900994221385748), FRAC_CONST(0.433831088131649) }, - { FRAC_CONST(0.899569690541596), FRAC_CONST(0.436777256572384) }, - { FRAC_CONST(0.898135526028766), FRAC_CONST(0.439718747479604) }, - { FRAC_CONST(0.896691743206008), FRAC_CONST(0.442655529352306) }, - { FRAC_CONST(0.895238357535076), FRAC_CONST(0.445587570739915) }, - { FRAC_CONST(0.893775384580563), FRAC_CONST(0.448514840242624) }, - { FRAC_CONST(0.892302840009734), FRAC_CONST(0.451437306511726) }, - { FRAC_CONST(0.890820739592359), FRAC_CONST(0.454354938249958) }, - { FRAC_CONST(0.889329099200541), FRAC_CONST(0.457267704211826) }, - { FRAC_CONST(0.887827934808551), FRAC_CONST(0.460175573203949) }, - { FRAC_CONST(0.886317262492655), FRAC_CONST(0.463078514085383) }, - { FRAC_CONST(0.884797098430938), FRAC_CONST(0.465976495767966) }, - { FRAC_CONST(0.883267458903136), FRAC_CONST(0.468869487216642) }, - { FRAC_CONST(0.881728360290461), FRAC_CONST(0.471757457449795) }, - { FRAC_CONST(0.880179819075421), FRAC_CONST(0.474640375539586) }, - { FRAC_CONST(0.878621851841649), FRAC_CONST(0.477518210612278) }, - { FRAC_CONST(0.877054475273722), FRAC_CONST(0.480390931848569) }, - { FRAC_CONST(0.875477706156984), FRAC_CONST(0.483258508483922) }, - { FRAC_CONST(0.873891561377366), FRAC_CONST(0.486120909808896) }, - { FRAC_CONST(0.872296057921204), FRAC_CONST(0.488978105169472) }, - { FRAC_CONST(0.870691212875058), FRAC_CONST(0.491830063967383) }, - { FRAC_CONST(0.869077043425529), FRAC_CONST(0.494676755660442) }, - { FRAC_CONST(0.867453566859076), FRAC_CONST(0.497518149762867) }, - { FRAC_CONST(0.865820800561827), FRAC_CONST(0.500354215845611) }, - { FRAC_CONST(0.864178762019399), FRAC_CONST(0.503184923536685) }, - { FRAC_CONST(0.862527468816704), FRAC_CONST(0.506010242521482) }, - { FRAC_CONST(0.860866938637767), FRAC_CONST(0.508830142543107) }, - { FRAC_CONST(0.859197189265532), FRAC_CONST(0.511644593402696) }, - { FRAC_CONST(0.857518238581672), FRAC_CONST(0.514453564959741) }, - { FRAC_CONST(0.855830104566401), FRAC_CONST(0.517257027132414) }, - { FRAC_CONST(0.854132805298278), FRAC_CONST(0.520054949897887) }, - { FRAC_CONST(0.852426358954015), FRAC_CONST(0.522847303292655) }, - { FRAC_CONST(0.850710783808280), FRAC_CONST(0.525634057412856) }, - { FRAC_CONST(0.848986098233506), FRAC_CONST(0.528415182414593) }, - { FRAC_CONST(0.847252320699689), FRAC_CONST(0.531190648514252) }, - { FRAC_CONST(0.845509469774194), FRAC_CONST(0.533960425988819) }, - { FRAC_CONST(0.843757564121554), FRAC_CONST(0.536724485176205) }, - { FRAC_CONST(0.841996622503271), FRAC_CONST(0.539482796475555) }, - { FRAC_CONST(0.840226663777615), FRAC_CONST(0.542235330347571) }, - { FRAC_CONST(0.838447706899422), FRAC_CONST(0.544982057314827) }, - { FRAC_CONST(0.836659770919891), FRAC_CONST(0.547722947962084) }, - { FRAC_CONST(0.834862874986380), FRAC_CONST(0.550457972936605) }, - { FRAC_CONST(0.833057038342201), FRAC_CONST(0.553187102948470) }, - { FRAC_CONST(0.831242280326413), FRAC_CONST(0.555910308770889) }, - { FRAC_CONST(0.829418620373617), FRAC_CONST(0.558627561240515) }, - { FRAC_CONST(0.827586078013746), FRAC_CONST(0.561338831257758) }, - { FRAC_CONST(0.825744672871856), FRAC_CONST(0.564044089787093) }, - { FRAC_CONST(0.823894424667918), FRAC_CONST(0.566743307857377) }, - { FRAC_CONST(0.822035353216601), FRAC_CONST(0.569436456562150) }, - { FRAC_CONST(0.820167478427070), FRAC_CONST(0.572123507059955) }, - { FRAC_CONST(0.818290820302761), FRAC_CONST(0.574804430574639) }, - { FRAC_CONST(0.816405398941175), FRAC_CONST(0.577479198395666) }, - { FRAC_CONST(0.814511234533661), FRAC_CONST(0.580147781878420) }, - { FRAC_CONST(0.812608347365198), FRAC_CONST(0.582810152444517) }, - { FRAC_CONST(0.810696757814178), FRAC_CONST(0.585466281582107) }, - { FRAC_CONST(0.808776486352191), FRAC_CONST(0.588116140846181) }, - { FRAC_CONST(0.806847553543799), FRAC_CONST(0.590759701858874) }, - { FRAC_CONST(0.804909980046325), FRAC_CONST(0.593396936309773) }, - { FRAC_CONST(0.802963786609623), FRAC_CONST(0.596027815956215) }, - { FRAC_CONST(0.801008994075862), FRAC_CONST(0.598652312623592) }, - { FRAC_CONST(0.799045623379300), FRAC_CONST(0.601270398205654) }, - { FRAC_CONST(0.797073695546059), FRAC_CONST(0.603882044664808) }, - { FRAC_CONST(0.795093231693901), FRAC_CONST(0.606487224032418) }, - { FRAC_CONST(0.793104253032005), FRAC_CONST(0.609085908409106) }, - { FRAC_CONST(0.791106780860733), FRAC_CONST(0.611678069965050) }, - { FRAC_CONST(0.789100836571407), FRAC_CONST(0.614263680940283) }, - { FRAC_CONST(0.787086441646080), FRAC_CONST(0.616842713644988) }, - { FRAC_CONST(0.785063617657302), FRAC_CONST(0.619415140459796) }, - { FRAC_CONST(0.783032386267894), FRAC_CONST(0.621980933836084) }, - { FRAC_CONST(0.780992769230711), FRAC_CONST(0.624540066296266) }, - { FRAC_CONST(0.778944788388414), FRAC_CONST(0.627092510434089) }, - { FRAC_CONST(0.776888465673232), FRAC_CONST(0.629638238914927) }, - { FRAC_CONST(0.774823823106730), FRAC_CONST(0.632177224476073) }, - { FRAC_CONST(0.772750882799570), FRAC_CONST(0.634709439927031) }, - { FRAC_CONST(0.770669666951277), FRAC_CONST(0.637234858149809) }, - { FRAC_CONST(0.768580197850002), FRAC_CONST(0.639753452099206) }, - { FRAC_CONST(0.766482497872280), FRAC_CONST(0.642265194803105) }, - { FRAC_CONST(0.764376589482793), FRAC_CONST(0.644770059362758) }, - { FRAC_CONST(0.762262495234126), FRAC_CONST(0.647268018953079) }, - { FRAC_CONST(0.760140237766532), FRAC_CONST(0.649759046822928) }, - { FRAC_CONST(0.758009839807683), FRAC_CONST(0.652243116295397) }, - { FRAC_CONST(0.755871324172429), FRAC_CONST(0.654720200768098) }, - { FRAC_CONST(0.753724713762555), FRAC_CONST(0.657190273713446) }, - { FRAC_CONST(0.751570031566534), FRAC_CONST(0.659653308678945) }, - { FRAC_CONST(0.749407300659280), FRAC_CONST(0.662109279287469) }, - { FRAC_CONST(0.747236544201905), FRAC_CONST(0.664558159237545) }, - { FRAC_CONST(0.745057785441466), FRAC_CONST(0.666999922303638) }, - { FRAC_CONST(0.742871047710719), FRAC_CONST(0.669434542336425) }, - { FRAC_CONST(0.740676354427868), FRAC_CONST(0.671861993263083) }, - { FRAC_CONST(0.738473729096316), FRAC_CONST(0.674282249087562) }, - { FRAC_CONST(0.736263195304409), FRAC_CONST(0.676695283890867) }, - { FRAC_CONST(0.734044776725190), FRAC_CONST(0.679101071831334) }, - { FRAC_CONST(0.731818497116138), FRAC_CONST(0.681499587144906) }, - { FRAC_CONST(0.729584380318920), FRAC_CONST(0.683890804145412) }, - { FRAC_CONST(0.727342450259131), FRAC_CONST(0.686274697224838) }, - { FRAC_CONST(0.725092730946042), FRAC_CONST(0.688651240853606) }, - { FRAC_CONST(0.722835246472338), FRAC_CONST(0.691020409580841) }, - { FRAC_CONST(0.720570021013866), FRAC_CONST(0.693382178034651) }, - { FRAC_CONST(0.718297078829369), FRAC_CONST(0.695736520922392) }, - { FRAC_CONST(0.716016444260233), FRAC_CONST(0.698083413030944) }, - { FRAC_CONST(0.713728141730222), FRAC_CONST(0.700422829226978) }, - { FRAC_CONST(0.711432195745216), FRAC_CONST(0.702754744457225) }, - { FRAC_CONST(0.709128630892954), FRAC_CONST(0.705079133748748) }, - { FRAC_CONST(0.706817471842764), FRAC_CONST(0.707395972209203) }, - { FRAC_CONST(0.704498743345302), FRAC_CONST(0.709705235027113) }, - { FRAC_CONST(0.702172470232289), FRAC_CONST(0.712006897472128) }, - { FRAC_CONST(0.699838677416240), FRAC_CONST(0.714300934895292) }, - { FRAC_CONST(0.697497389890200), FRAC_CONST(0.716587322729308) }, - { FRAC_CONST(0.695148632727480), FRAC_CONST(0.718866036488799) }, - { FRAC_CONST(0.692792431081381), FRAC_CONST(0.721137051770570) }, - { FRAC_CONST(0.690428810184929), FRAC_CONST(0.723400344253874) }, - { FRAC_CONST(0.688057795350606), FRAC_CONST(0.725655889700665) }, - { FRAC_CONST(0.685679411970075), FRAC_CONST(0.727903663955865) }, - { FRAC_CONST(0.683293685513912), FRAC_CONST(0.730143642947616) }, - { FRAC_CONST(0.680900641531330), FRAC_CONST(0.732375802687543) }, - { FRAC_CONST(0.678500305649909), FRAC_CONST(0.734600119271009) }, - { FRAC_CONST(0.676092703575316), FRAC_CONST(0.736816568877370) }, - { FRAC_CONST(0.673677861091036), FRAC_CONST(0.739025127770231) }, - { FRAC_CONST(0.671255804058092), FRAC_CONST(0.741225772297702) }, - { FRAC_CONST(0.668826558414768), FRAC_CONST(0.743418478892647) }, - { FRAC_CONST(0.666390150176334), FRAC_CONST(0.745603224072940) }, - { FRAC_CONST(0.663946605434765), FRAC_CONST(0.747779984441716) }, - { FRAC_CONST(0.661495950358462), FRAC_CONST(0.749948736687619) }, - { FRAC_CONST(0.659038211191971), FRAC_CONST(0.752109457585056) }, - { FRAC_CONST(0.656573414255705), FRAC_CONST(0.754262123994441) }, - { FRAC_CONST(0.654101585945659), FRAC_CONST(0.756406712862448) }, - { FRAC_CONST(0.651622752733128), FRAC_CONST(0.758543201222251) }, - { FRAC_CONST(0.649136941164425), FRAC_CONST(0.760671566193777) }, - { FRAC_CONST(0.646644177860593), FRAC_CONST(0.762791784983948) }, - { FRAC_CONST(0.644144489517126), FRAC_CONST(0.764903834886923) }, - { FRAC_CONST(0.641637902903677), FRAC_CONST(0.767007693284345) }, - { FRAC_CONST(0.639124444863776), FRAC_CONST(0.769103337645580) }, - { FRAC_CONST(0.636604142314538), FRAC_CONST(0.771190745527961) }, - { FRAC_CONST(0.634077022246379), FRAC_CONST(0.773269894577026) }, - { FRAC_CONST(0.631543111722725), FRAC_CONST(0.775340762526760) }, - { FRAC_CONST(0.629002437879721), FRAC_CONST(0.777403327199831) }, - { FRAC_CONST(0.626455027925944), FRAC_CONST(0.779457566507828) }, - { FRAC_CONST(0.623900909142107), FRAC_CONST(0.781503458451498) }, - { FRAC_CONST(0.621340108880771), FRAC_CONST(0.783540981120982) }, - { FRAC_CONST(0.618772654566049), FRAC_CONST(0.785570112696050) }, - { FRAC_CONST(0.616198573693314), FRAC_CONST(0.787590831446332) }, - { FRAC_CONST(0.613617893828905), FRAC_CONST(0.789603115731555) }, - { FRAC_CONST(0.611030642609828), FRAC_CONST(0.791606944001769) }, - { FRAC_CONST(0.608436847743468), FRAC_CONST(0.793602294797585) }, - { FRAC_CONST(0.605836537007281), FRAC_CONST(0.795589146750397) }, - { FRAC_CONST(0.603229738248508), FRAC_CONST(0.797567478582619) }, - { FRAC_CONST(0.600616479383869), FRAC_CONST(0.799537269107905) }, - { FRAC_CONST(0.597996788399267), FRAC_CONST(0.801498497231381) }, - { FRAC_CONST(0.595370693349487), FRAC_CONST(0.803451141949871) }, - { FRAC_CONST(0.592738222357898), FRAC_CONST(0.805395182352117) }, - { FRAC_CONST(0.590099403616149), FRAC_CONST(0.807330597619008) }, - { FRAC_CONST(0.587454265383869), FRAC_CONST(0.809257367023803) }, - { FRAC_CONST(0.584802835988364), FRAC_CONST(0.811175469932349) }, - { FRAC_CONST(0.582145143824311), FRAC_CONST(0.813084885803304) }, - { FRAC_CONST(0.579481217353460), FRAC_CONST(0.814985594188359) }, - { FRAC_CONST(0.576811085104321), FRAC_CONST(0.816877574732454) }, - { FRAC_CONST(0.574134775671867), FRAC_CONST(0.818760807173997) }, - { FRAC_CONST(0.571452317717222), FRAC_CONST(0.820635271345081) }, - { FRAC_CONST(0.568763739967354), FRAC_CONST(0.822500947171703) }, - { FRAC_CONST(0.566069071214772), FRAC_CONST(0.824357814673971) }, - { FRAC_CONST(0.563368340317214), FRAC_CONST(0.826205853966327) }, - { FRAC_CONST(0.560661576197336), FRAC_CONST(0.828045045257756) }, - { FRAC_CONST(0.557948807842409), FRAC_CONST(0.829875368851995) }, - { FRAC_CONST(0.555230064304002), FRAC_CONST(0.831696805147750) }, - { FRAC_CONST(0.552505374697674), FRAC_CONST(0.833509334638900) }, - { FRAC_CONST(0.549774768202663), FRAC_CONST(0.835312937914713) }, - { FRAC_CONST(0.547038274061568), FRAC_CONST(0.837107595660044) }, - { FRAC_CONST(0.544295921580046), FRAC_CONST(0.838893288655553) }, - { FRAC_CONST(0.541547740126486), FRAC_CONST(0.840669997777901) }, - { FRAC_CONST(0.538793759131706), FRAC_CONST(0.842437703999961) }, - { FRAC_CONST(0.536034008088628), FRAC_CONST(0.844196388391019) }, - { FRAC_CONST(0.533268516551970), FRAC_CONST(0.845946032116980) }, - { FRAC_CONST(0.530497314137923), FRAC_CONST(0.847686616440563) }, - { FRAC_CONST(0.527720430523840), FRAC_CONST(0.849418122721510) }, - { FRAC_CONST(0.524937895447912), FRAC_CONST(0.851140532416778) }, - { FRAC_CONST(0.522149738708856), FRAC_CONST(0.852853827080745) }, - { FRAC_CONST(0.519355990165590), FRAC_CONST(0.854557988365401) }, - { FRAC_CONST(0.516556679736915), FRAC_CONST(0.856252998020546) }, - { FRAC_CONST(0.513751837401199), FRAC_CONST(0.857938837893991) }, - { FRAC_CONST(0.510941493196049), FRAC_CONST(0.859615489931744) }, - { FRAC_CONST(0.508125677217994), FRAC_CONST(0.861282936178208) }, - { FRAC_CONST(0.505304419622159), FRAC_CONST(0.862941158776375) }, - { FRAC_CONST(0.502477750621949), FRAC_CONST(0.864590139968012) }, - { FRAC_CONST(0.499645700488717), FRAC_CONST(0.866229862093855) }, - { FRAC_CONST(0.496808299551444), FRAC_CONST(0.867860307593799) }, - { FRAC_CONST(0.493965578196415), FRAC_CONST(0.869481459007080) }, - { FRAC_CONST(0.491117566866892), FRAC_CONST(0.871093298972471) }, - { FRAC_CONST(0.488264296062789), FRAC_CONST(0.872695810228461) }, - { FRAC_CONST(0.485405796340343), FRAC_CONST(0.874288975613440) }, - { FRAC_CONST(0.482542098311789), FRAC_CONST(0.875872778065888) }, - { FRAC_CONST(0.479673232645033), FRAC_CONST(0.877447200624553) }, - { FRAC_CONST(0.476799230063322), FRAC_CONST(0.879012226428633) }, - { FRAC_CONST(0.473920121344914), FRAC_CONST(0.880567838717962) }, - { FRAC_CONST(0.471035937322751), FRAC_CONST(0.882114020833179) }, - { FRAC_CONST(0.468146708884125), FRAC_CONST(0.883650756215917) }, - { FRAC_CONST(0.465252466970353), FRAC_CONST(0.885178028408975) }, - { FRAC_CONST(0.462353242576441), FRAC_CONST(0.886695821056495) }, - { FRAC_CONST(0.459449066750752), FRAC_CONST(0.888204117904136) }, - { FRAC_CONST(0.456539970594675), FRAC_CONST(0.889702902799251) }, - { FRAC_CONST(0.453625985262295), FRAC_CONST(0.891192159691058) }, - { FRAC_CONST(0.450707141960053), FRAC_CONST(0.892671872630812) }, - { FRAC_CONST(0.447783471946415), FRAC_CONST(0.894142025771977) }, - { FRAC_CONST(0.444855006531538), FRAC_CONST(0.895602603370393) }, - { FRAC_CONST(0.441921777076935), FRAC_CONST(0.897053589784447) }, - { FRAC_CONST(0.438983814995137), FRAC_CONST(0.898494969475242) }, - { FRAC_CONST(0.436041151749356), FRAC_CONST(0.899926727006758) }, - { FRAC_CONST(0.433093818853152), FRAC_CONST(0.901348847046022) }, - { FRAC_CONST(0.430141847870093), FRAC_CONST(0.902761314363272) }, - { FRAC_CONST(0.427185270413416), FRAC_CONST(0.904164113832116) }, - { FRAC_CONST(0.424224118145690), FRAC_CONST(0.905557230429701) }, - { FRAC_CONST(0.421258422778478), FRAC_CONST(0.906940649236866) }, - { FRAC_CONST(0.418288216071994), FRAC_CONST(0.908314355438308) }, - { FRAC_CONST(0.415313529834766), FRAC_CONST(0.909678334322736) }, - { FRAC_CONST(0.412334395923293), FRAC_CONST(0.911032571283032) }, - { FRAC_CONST(0.409350846241706), FRAC_CONST(0.912377051816407) }, - { FRAC_CONST(0.406362912741425), FRAC_CONST(0.913711761524555) }, - { FRAC_CONST(0.403370627420818), FRAC_CONST(0.915036686113806) }, - { FRAC_CONST(0.400374022324857), FRAC_CONST(0.916351811395282) }, - { FRAC_CONST(0.397373129544774), FRAC_CONST(0.917657123285050) }, - { FRAC_CONST(0.394367981217720), FRAC_CONST(0.918952607804266) }, - { FRAC_CONST(0.391358609526420), FRAC_CONST(0.920238251079332) }, - { FRAC_CONST(0.388345046698826), FRAC_CONST(0.921514039342042) }, - { FRAC_CONST(0.385327325007776), FRAC_CONST(0.922779958929729) }, - { FRAC_CONST(0.382305476770645), FRAC_CONST(0.924035996285410) }, - { FRAC_CONST(0.379279534348999), FRAC_CONST(0.925282137957935) }, - { FRAC_CONST(0.376249530148250), FRAC_CONST(0.926518370602127) }, - { FRAC_CONST(0.373215496617310), FRAC_CONST(0.927744680978929) }, - { FRAC_CONST(0.370177466248239), FRAC_CONST(0.928961055955541) }, - { FRAC_CONST(0.367135471575903), FRAC_CONST(0.930167482505564) }, - { FRAC_CONST(0.364089545177621), FRAC_CONST(0.931363947709140) }, - { FRAC_CONST(0.361039719672816), FRAC_CONST(0.932550438753087) }, - { FRAC_CONST(0.357986027722671), FRAC_CONST(0.933726942931039) }, - { FRAC_CONST(0.354928502029772), FRAC_CONST(0.934893447643582) }, - { FRAC_CONST(0.351867175337763), FRAC_CONST(0.936049940398387) }, - { FRAC_CONST(0.348802080430994), FRAC_CONST(0.937196408810347) }, - { FRAC_CONST(0.345733250134169), FRAC_CONST(0.938332840601705) }, - { FRAC_CONST(0.342660717311994), FRAC_CONST(0.939459223602190) }, - { FRAC_CONST(0.339584514868829), FRAC_CONST(0.940575545749145) }, - { FRAC_CONST(0.336504675748328), FRAC_CONST(0.941681795087657) }, - { FRAC_CONST(0.333421232933097), FRAC_CONST(0.942777959770684) }, - { FRAC_CONST(0.330334219444328), FRAC_CONST(0.943864028059183) }, - { FRAC_CONST(0.327243668341457), FRAC_CONST(0.944939988322235) }, - { FRAC_CONST(0.324149612721804), FRAC_CONST(0.946005829037171) }, - { FRAC_CONST(0.321052085720218), FRAC_CONST(0.947061538789691) }, - { FRAC_CONST(0.317951120508725), FRAC_CONST(0.948107106273994) }, - { FRAC_CONST(0.314846750296171), FRAC_CONST(0.949142520292891) }, - { FRAC_CONST(0.311739008327867), FRAC_CONST(0.950167769757930) }, - { FRAC_CONST(0.308627927885232), FRAC_CONST(0.951182843689513) }, - { FRAC_CONST(0.305513542285440), FRAC_CONST(0.952187731217013) }, - { FRAC_CONST(0.302395884881056), FRAC_CONST(0.953182421578893) }, - { FRAC_CONST(0.299274989059689), FRAC_CONST(0.954166904122818) }, - { FRAC_CONST(0.296150888243624), FRAC_CONST(0.955141168305771) }, - { FRAC_CONST(0.293023615889471), FRAC_CONST(0.956105203694164) }, - { FRAC_CONST(0.289893205487806), FRAC_CONST(0.957058999963955) }, - { FRAC_CONST(0.286759690562807), FRAC_CONST(0.958002546900750) }, - { FRAC_CONST(0.283623104671904), FRAC_CONST(0.958935834399920) }, - { FRAC_CONST(0.280483481405410), FRAC_CONST(0.959858852466706) }, - { FRAC_CONST(0.277340854386169), FRAC_CONST(0.960771591216325) }, - { FRAC_CONST(0.274195257269191), FRAC_CONST(0.961674040874080) }, - { FRAC_CONST(0.271046723741295), FRAC_CONST(0.962566191775459) }, - { FRAC_CONST(0.267895287520743), FRAC_CONST(0.963448034366243) }, - { FRAC_CONST(0.264740982356888), FRAC_CONST(0.964319559202607) }, - { FRAC_CONST(0.261583842029803), FRAC_CONST(0.965180756951218) }, - { FRAC_CONST(0.258423900349924), FRAC_CONST(0.966031618389343) }, - { FRAC_CONST(0.255261191157689), FRAC_CONST(0.966872134404937) }, - { FRAC_CONST(0.252095748323171), FRAC_CONST(0.967702295996750) }, - { FRAC_CONST(0.248927605745720), FRAC_CONST(0.968522094274417) }, - { FRAC_CONST(0.245756797353599), FRAC_CONST(0.969331520458559) }, - { FRAC_CONST(0.242583357103617), FRAC_CONST(0.970130565880871) }, - { FRAC_CONST(0.239407318980770), FRAC_CONST(0.970919221984218) }, - { FRAC_CONST(0.236228716997876), FRAC_CONST(0.971697480322728) }, - { FRAC_CONST(0.233047585195206), FRAC_CONST(0.972465332561878) }, - { FRAC_CONST(0.229863957640129), FRAC_CONST(0.973222770478587) }, - { FRAC_CONST(0.226677868426735), FRAC_CONST(0.973969785961306) }, - { FRAC_CONST(0.223489351675482), FRAC_CONST(0.974706371010097) }, - { FRAC_CONST(0.220298441532823), FRAC_CONST(0.975432517736727) }, - { FRAC_CONST(0.217105172170841), FRAC_CONST(0.976148218364747) }, - { FRAC_CONST(0.213909577786886), FRAC_CONST(0.976853465229579) }, - { FRAC_CONST(0.210711692603206), FRAC_CONST(0.977548250778596) }, - { FRAC_CONST(0.207511550866582), FRAC_CONST(0.978232567571202) }, - { FRAC_CONST(0.204309186847962), FRAC_CONST(0.978906408278914) }, - { FRAC_CONST(0.201104634842092), FRAC_CONST(0.979569765685441) }, - { FRAC_CONST(0.197897929167148), FRAC_CONST(0.980222632686756) }, - { FRAC_CONST(0.194689104164373), FRAC_CONST(0.980865002291179) }, - { FRAC_CONST(0.191478194197704), FRAC_CONST(0.981496867619447) }, - { FRAC_CONST(0.188265233653407), FRAC_CONST(0.982118221904791) }, - { FRAC_CONST(0.185050256939710), FRAC_CONST(0.982729058493005) }, - { FRAC_CONST(0.181833298486427), FRAC_CONST(0.983329370842520) }, - { FRAC_CONST(0.178614392744603), FRAC_CONST(0.983919152524473) }, - { FRAC_CONST(0.175393574186129), FRAC_CONST(0.984498397222776) }, - { FRAC_CONST(0.172170877303385), FRAC_CONST(0.985067098734184) }, - { FRAC_CONST(0.168946336608867), FRAC_CONST(0.985625250968360) }, - { FRAC_CONST(0.165719986634814), FRAC_CONST(0.986172847947943) }, - { FRAC_CONST(0.162491861932842), FRAC_CONST(0.986709883808609) }, - { FRAC_CONST(0.159261997073573), FRAC_CONST(0.987236352799134) }, - { FRAC_CONST(0.156030426646266), FRAC_CONST(0.987752249281460) }, - { FRAC_CONST(0.152797185258443), FRAC_CONST(0.988257567730749) }, - { FRAC_CONST(0.149562307535523), FRAC_CONST(0.988752302735447) }, - { FRAC_CONST(0.146325828120446), FRAC_CONST(0.989236448997339) }, - { FRAC_CONST(0.143087781673307), FRAC_CONST(0.989710001331608) }, - { FRAC_CONST(0.139848202870981), FRAC_CONST(0.990172954666889) }, - { FRAC_CONST(0.136607126406757), FRAC_CONST(0.990625304045323) }, - { FRAC_CONST(0.133364586989957), FRAC_CONST(0.991067044622612) }, - { FRAC_CONST(0.130120619345575), FRAC_CONST(0.991498171668069) }, - { FRAC_CONST(0.126875258213898), FRAC_CONST(0.991918680564670) }, - { FRAC_CONST(0.123628538350136), FRAC_CONST(0.992328566809103) }, - { FRAC_CONST(0.120380494524051), FRAC_CONST(0.992727826011815) }, - { FRAC_CONST(0.117131161519582), FRAC_CONST(0.993116453897061) }, - { FRAC_CONST(0.113880574134475), FRAC_CONST(0.993494446302948) }, - { FRAC_CONST(0.110628767179910), FRAC_CONST(0.993861799181482) }, - { FRAC_CONST(0.107375775480128), FRAC_CONST(0.994218508598608) }, - { FRAC_CONST(0.104121633872055), FRAC_CONST(0.994564570734255) }, - { FRAC_CONST(0.100866377204933), FRAC_CONST(0.994899981882376) }, - { FRAC_CONST(0.097610040339947), FRAC_CONST(0.995224738450986) }, - { FRAC_CONST(0.094352658149849), FRAC_CONST(0.995538836962204) }, - { FRAC_CONST(0.091094265518583), FRAC_CONST(0.995842274052287) }, - { FRAC_CONST(0.087834897340919), FRAC_CONST(0.996135046471667) }, - { FRAC_CONST(0.084574588522070), FRAC_CONST(0.996417151084987) }, - { FRAC_CONST(0.081313373977324), FRAC_CONST(0.996688584871134) }, - { FRAC_CONST(0.078051288631670), FRAC_CONST(0.996949344923269) }, - { FRAC_CONST(0.074788367419420), FRAC_CONST(0.997199428448862) }, - { FRAC_CONST(0.071524645283840), FRAC_CONST(0.997438832769720) }, - { FRAC_CONST(0.068260157176771), FRAC_CONST(0.997667555322013) }, - { FRAC_CONST(0.064994938058259), FRAC_CONST(0.997885593656308) }, - { FRAC_CONST(0.061729022896176), FRAC_CONST(0.998092945437590) }, - { FRAC_CONST(0.058462446665851), FRAC_CONST(0.998289608445286) }, - { FRAC_CONST(0.055195244349690), FRAC_CONST(0.998475580573295) }, - { FRAC_CONST(0.051927450936806), FRAC_CONST(0.998650859830004) }, - { FRAC_CONST(0.048659101422640), FRAC_CONST(0.998815444338313) }, - { FRAC_CONST(0.045390230808591), FRAC_CONST(0.998969332335654) }, - { FRAC_CONST(0.042120874101635), FRAC_CONST(0.999112522174011) }, - { FRAC_CONST(0.038851066313958), FRAC_CONST(0.999245012319936) }, - { FRAC_CONST(0.035580842462574), FRAC_CONST(0.999366801354564) }, - { FRAC_CONST(0.032310237568951), FRAC_CONST(0.999477887973635) }, - { FRAC_CONST(0.029039286658643), FRAC_CONST(0.999578270987499) }, - { FRAC_CONST(0.025768024760904), FRAC_CONST(0.999667949321134) }, - { FRAC_CONST(0.022496486908322), FRAC_CONST(0.999746922014158) }, - { FRAC_CONST(0.019224708136438), FRAC_CONST(0.999815188220837) }, - { FRAC_CONST(0.015952723483375), FRAC_CONST(0.999872747210095) }, - { FRAC_CONST(0.012680567989461), FRAC_CONST(0.999919598365521) }, - { FRAC_CONST(0.009408276696850), FRAC_CONST(0.999955741185376) }, - { FRAC_CONST(0.006135884649155), FRAC_CONST(0.999981175282601) }, - { FRAC_CONST(0.002863426891064), FRAC_CONST(0.999995900384816) } -}; - -#ifdef LD_DEC -/* 240 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_960[] = -{ - { FRAC_CONST(0.999999665337326), FRAC_CONST(0.000818122995607) }, - { FRAC_CONST(0.999972892444367), FRAC_CONST(0.007363041249780) }, - { FRAC_CONST(0.999903284040864), FRAC_CONST(0.013907644095771) }, - { FRAC_CONST(0.999790843108610), FRAC_CONST(0.020451651184577) }, - { FRAC_CONST(0.999635574464198), FRAC_CONST(0.026994782192715) }, - { FRAC_CONST(0.999437484758823), FRAC_CONST(0.033536756834230) }, - { FRAC_CONST(0.999196582477986), FRAC_CONST(0.040077294872701) }, - { FRAC_CONST(0.998912877941140), FRAC_CONST(0.046616116133247) }, - { FRAC_CONST(0.998586383301244), FRAC_CONST(0.053152940514528) }, - { FRAC_CONST(0.998217112544241), FRAC_CONST(0.059687488000744) }, - { FRAC_CONST(0.997805081488460), FRAC_CONST(0.066219478673630) }, - { FRAC_CONST(0.997350307783942), FRAC_CONST(0.072748632724445) }, - { FRAC_CONST(0.996852810911678), FRAC_CONST(0.079274670465961) }, - { FRAC_CONST(0.996312612182778), FRAC_CONST(0.085797312344440) }, - { FRAC_CONST(0.995729734737558), FRAC_CONST(0.092316278951614) }, - { FRAC_CONST(0.995104203544548), FRAC_CONST(0.098831291036650) }, - { FRAC_CONST(0.994436045399422), FRAC_CONST(0.105342069518114) }, - { FRAC_CONST(0.993725288923851), FRAC_CONST(0.111848335495926) }, - { FRAC_CONST(0.992971964564277), FRAC_CONST(0.118349810263305) }, - { FRAC_CONST(0.992176104590608), FRAC_CONST(0.124846215318711) }, - { FRAC_CONST(0.991337743094838), FRAC_CONST(0.131337272377774) }, - { FRAC_CONST(0.990456915989581), FRAC_CONST(0.137822703385212) }, - { FRAC_CONST(0.989533661006540), FRAC_CONST(0.144302230526747) }, - { FRAC_CONST(0.988568017694885), FRAC_CONST(0.150775576241001) }, - { FRAC_CONST(0.987560027419562), FRAC_CONST(0.157242463231389) }, - { FRAC_CONST(0.986509733359519), FRAC_CONST(0.163702614477995) }, - { FRAC_CONST(0.985417180505858), FRAC_CONST(0.170155753249442) }, - { FRAC_CONST(0.984282415659907), FRAC_CONST(0.176601603114742) }, - { FRAC_CONST(0.983105487431216), FRAC_CONST(0.183039887955141) }, - { FRAC_CONST(0.981886446235473), FRAC_CONST(0.189470331975943) }, - { FRAC_CONST(0.980625344292344), FRAC_CONST(0.195892659718330) }, - { FRAC_CONST(0.979322235623241), FRAC_CONST(0.202306596071156) }, - { FRAC_CONST(0.977977176049000), FRAC_CONST(0.208711866282735) }, - { FRAC_CONST(0.976590223187499), FRAC_CONST(0.215108195972610) }, - { FRAC_CONST(0.975161436451181), FRAC_CONST(0.221495311143304) }, - { FRAC_CONST(0.973690877044515), FRAC_CONST(0.227872938192063) }, - { FRAC_CONST(0.972178607961371), FRAC_CONST(0.234240803922570) }, - { FRAC_CONST(0.970624693982323), FRAC_CONST(0.240598635556650) }, - { FRAC_CONST(0.969029201671875), FRAC_CONST(0.246946160745958) }, - { FRAC_CONST(0.967392199375607), FRAC_CONST(0.253283107583640) }, - { FRAC_CONST(0.965713757217249), FRAC_CONST(0.259609204615985) }, - { FRAC_CONST(0.963993947095677), FRAC_CONST(0.265924180854051) }, - { FRAC_CONST(0.962232842681832), FRAC_CONST(0.272227765785273) }, - { FRAC_CONST(0.960430519415566), FRAC_CONST(0.278519689385053) }, - { FRAC_CONST(0.958587054502409), FRAC_CONST(0.284799682128326) }, - { FRAC_CONST(0.956702526910263), FRAC_CONST(0.291067475001103) }, - { FRAC_CONST(0.954777017366017), FRAC_CONST(0.297322799511998) }, - { FRAC_CONST(0.952810608352092), FRAC_CONST(0.303565387703730) }, - { FRAC_CONST(0.950803384102905), FRAC_CONST(0.309794972164597) }, - { FRAC_CONST(0.948755430601263), FRAC_CONST(0.316011286039934) }, - { FRAC_CONST(0.946666835574676), FRAC_CONST(0.322214063043544) }, - { FRAC_CONST(0.944537688491606), FRAC_CONST(0.328403037469105) }, - { FRAC_CONST(0.942368080557626), FRAC_CONST(0.334577944201551) }, - { FRAC_CONST(0.940158104711519), FRAC_CONST(0.340738518728429) }, - { FRAC_CONST(0.937907855621296), FRAC_CONST(0.346884497151231) }, - { FRAC_CONST(0.935617429680138), FRAC_CONST(0.353015616196696) }, - { FRAC_CONST(0.933286925002268), FRAC_CONST(0.359131613228090) }, - { FRAC_CONST(0.930916441418752), FRAC_CONST(0.365232226256457) }, - { FRAC_CONST(0.928506080473216), FRAC_CONST(0.371317193951838) }, - { FRAC_CONST(0.926055945417500), FRAC_CONST(0.377386255654469) }, - { FRAC_CONST(0.923566141207236), FRAC_CONST(0.383439151385947) }, - { FRAC_CONST(0.921036774497350), FRAC_CONST(0.389475621860365) }, - { FRAC_CONST(0.918467953637492), FRAC_CONST(0.395495408495417) }, - { FRAC_CONST(0.915859788667400), FRAC_CONST(0.401498253423481) }, - { FRAC_CONST(0.913212391312179), FRAC_CONST(0.407483899502658) }, - { FRAC_CONST(0.910525874977521), FRAC_CONST(0.413452090327791) }, - { FRAC_CONST(0.907800354744844), FRAC_CONST(0.419402570241451) }, - { FRAC_CONST(0.905035947366364), FRAC_CONST(0.425335084344881) }, - { FRAC_CONST(0.902232771260093), FRAC_CONST(0.431249378508924) }, - { FRAC_CONST(0.899390946504764), FRAC_CONST(0.437145199384900) }, - { FRAC_CONST(0.896510594834693), FRAC_CONST(0.443022294415467) }, - { FRAC_CONST(0.893591839634558), FRAC_CONST(0.448880411845433) }, - { FRAC_CONST(0.890634805934118), FRAC_CONST(0.454719300732547) }, - { FRAC_CONST(0.887639620402854), FRAC_CONST(0.460538710958240) }, - { FRAC_CONST(0.884606411344546), FRAC_CONST(0.466338393238348) }, - { FRAC_CONST(0.881535308691775), FRAC_CONST(0.472118099133784) }, - { FRAC_CONST(0.878426444000357), FRAC_CONST(0.477877581061184) }, - { FRAC_CONST(0.875279950443708), FRAC_CONST(0.483616592303511) }, - { FRAC_CONST(0.872095962807140), FRAC_CONST(0.489334887020625) }, - { FRAC_CONST(0.868874617482085), FRAC_CONST(0.495032220259813) }, - { FRAC_CONST(0.865616052460258), FRAC_CONST(0.500708347966279) }, - { FRAC_CONST(0.862320407327736), FRAC_CONST(0.506363026993605) }, - { FRAC_CONST(0.858987823258990), FRAC_CONST(0.511996015114162) }, - { FRAC_CONST(0.855618443010829), FRAC_CONST(0.517607071029487) }, - { FRAC_CONST(0.852212410916289), FRAC_CONST(0.523195954380619) }, - { FRAC_CONST(0.848769872878448), FRAC_CONST(0.528762425758396) }, - { FRAC_CONST(0.845290976364179), FRAC_CONST(0.534306246713712) }, - { FRAC_CONST(0.841775870397828), FRAC_CONST(0.539827179767727) }, - { FRAC_CONST(0.838224705554838), FRAC_CONST(0.545324988422046) }, - { FRAC_CONST(0.834637633955290), FRAC_CONST(0.550799437168844) }, - { FRAC_CONST(0.831014809257393), FRAC_CONST(0.556250291500956) }, - { FRAC_CONST(0.827356386650900), FRAC_CONST(0.561677317921925) }, - { FRAC_CONST(0.823662522850458), FRAC_CONST(0.567080283956001) }, - { FRAC_CONST(0.819933376088899), FRAC_CONST(0.572458958158102) }, - { FRAC_CONST(0.816169106110459), FRAC_CONST(0.577813110123727) }, - { FRAC_CONST(0.812369874163934), FRAC_CONST(0.583142510498826) }, - { FRAC_CONST(0.808535842995778), FRAC_CONST(0.588446930989624) }, - { FRAC_CONST(0.804667176843123), FRAC_CONST(0.593726144372402) }, - { FRAC_CONST(0.800764041426753), FRAC_CONST(0.598979924503229) }, - { FRAC_CONST(0.796826603943998), FRAC_CONST(0.604208046327650) }, - { FRAC_CONST(0.792855033061574), FRAC_CONST(0.609410285890327) }, - { FRAC_CONST(0.788849498908361), FRAC_CONST(0.614586420344631) }, - { FRAC_CONST(0.784810173068109), FRAC_CONST(0.619736227962191) }, - { FRAC_CONST(0.780737228572094), FRAC_CONST(0.624859488142386) }, - { FRAC_CONST(0.776630839891703), FRAC_CONST(0.629955981421804) }, - { FRAC_CONST(0.772491182930959), FRAC_CONST(0.635025489483633) }, - { FRAC_CONST(0.768318435018988), FRAC_CONST(0.640067795167023) }, - { FRAC_CONST(0.764112774902423), FRAC_CONST(0.645082682476378) }, - { FRAC_CONST(0.759874382737746), FRAC_CONST(0.650069936590618) }, - { FRAC_CONST(0.755603440083571), FRAC_CONST(0.655029343872374) }, - { FRAC_CONST(0.751300129892866), FRAC_CONST(0.659960691877147) }, - { FRAC_CONST(0.746964636505118), FRAC_CONST(0.664863769362399) }, - { FRAC_CONST(0.742597145638433), FRAC_CONST(0.669738366296610) }, - { FRAC_CONST(0.738197844381584), FRAC_CONST(0.674584273868271) }, - { FRAC_CONST(0.733766921185995), FRAC_CONST(0.679401284494831) }, - { FRAC_CONST(0.729304565857668), FRAC_CONST(0.684189191831585) }, - { FRAC_CONST(0.724810969549055), FRAC_CONST(0.688947790780520) }, - { FRAC_CONST(0.720286324750863), FRAC_CONST(0.693676877499095) }, - { FRAC_CONST(0.715730825283819), FRAC_CONST(0.698376249408973) }, - { FRAC_CONST(0.711144666290356), FRAC_CONST(0.703045705204703) }, - { FRAC_CONST(0.706528044226263), FRAC_CONST(0.707685044862340) }, - { FRAC_CONST(0.701881156852263), FRAC_CONST(0.712294069648014) }, - { FRAC_CONST(0.697204203225545), FRAC_CONST(0.716872582126442) }, - { FRAC_CONST(0.692497383691237), FRAC_CONST(0.721420386169390) }, - { FRAC_CONST(0.687760899873822), FRAC_CONST(0.725937286964068) }, - { FRAC_CONST(0.682994954668502), FRAC_CONST(0.730423091021479) }, - { FRAC_CONST(0.678199752232508), FRAC_CONST(0.734877606184707) }, - { FRAC_CONST(0.673375497976352), FRAC_CONST(0.739300641637149) }, - { FRAC_CONST(0.668522398555031), FRAC_CONST(0.743692007910687) }, - { FRAC_CONST(0.663640661859171), FRAC_CONST(0.748051516893805) }, - { FRAC_CONST(0.658730497006124), FRAC_CONST(0.752378981839648) }, - { FRAC_CONST(0.653792114331011), FRAC_CONST(0.756674217374021) }, - { FRAC_CONST(0.648825725377709), FRAC_CONST(0.760937039503328) }, - { FRAC_CONST(0.643831542889792), FRAC_CONST(0.765167265622459) }, - { FRAC_CONST(0.638809780801414), FRAC_CONST(0.769364714522605) }, - { FRAC_CONST(0.633760654228152), FRAC_CONST(0.773529206399025) }, - { FRAC_CONST(0.628684379457781), FRAC_CONST(0.777660562858748) }, - { FRAC_CONST(0.623581173941019), FRAC_CONST(0.781758606928213) }, - { FRAC_CONST(0.618451256282204), FRAC_CONST(0.785823163060853) }, - { FRAC_CONST(0.613294846229936), FRAC_CONST(0.789854057144609) }, - { FRAC_CONST(0.608112164667659), FRAC_CONST(0.793851116509396) }, - { FRAC_CONST(0.602903433604202), FRAC_CONST(0.797814169934493) }, - { FRAC_CONST(0.597668876164268), FRAC_CONST(0.801743047655882) }, - { FRAC_CONST(0.592408716578875), FRAC_CONST(0.805637581373517) }, - { FRAC_CONST(0.587123180175754), FRAC_CONST(0.809497604258536) }, - { FRAC_CONST(0.581812493369691), FRAC_CONST(0.813322950960406) }, - { FRAC_CONST(0.576476883652835), FRAC_CONST(0.817113457614006) }, - { FRAC_CONST(0.571116579584947), FRAC_CONST(0.820868961846646) }, - { FRAC_CONST(0.565731810783613), FRAC_CONST(0.824589302785025) }, - { FRAC_CONST(0.560322807914407), FRAC_CONST(0.828274321062119) }, - { FRAC_CONST(0.554889802681009), FRAC_CONST(0.831923858824010) }, - { FRAC_CONST(0.549433027815281), FRAC_CONST(0.835537759736646) }, - { FRAC_CONST(0.543952717067296), FRAC_CONST(0.839115868992540) }, - { FRAC_CONST(0.538449105195327), FRAC_CONST(0.842658033317402) }, - { FRAC_CONST(0.532922427955790), FRAC_CONST(0.846164100976699) }, - { FRAC_CONST(0.527372922093142), FRAC_CONST(0.849633921782164) }, - { FRAC_CONST(0.521800825329746), FRAC_CONST(0.853067347098221) }, - { FRAC_CONST(0.516206376355680), FRAC_CONST(0.856464229848356) }, - { FRAC_CONST(0.510589814818519), FRAC_CONST(0.859824424521420) }, - { FRAC_CONST(0.504951381313066), FRAC_CONST(0.863147787177854) }, - { FRAC_CONST(0.499291317371047), FRAC_CONST(0.866434175455865) }, - { FRAC_CONST(0.493609865450762), FRAC_CONST(0.869683448577516) }, - { FRAC_CONST(0.487907268926702), FRAC_CONST(0.872895467354761) }, - { FRAC_CONST(0.482183772079123), FRAC_CONST(0.876070094195407) }, - { FRAC_CONST(0.476439620083580), FRAC_CONST(0.879207193109004) }, - { FRAC_CONST(0.470675059000427), FRAC_CONST(0.882306629712678) }, - { FRAC_CONST(0.464890335764274), FRAC_CONST(0.885368271236879) }, - { FRAC_CONST(0.459085698173413), FRAC_CONST(0.888391986531075) }, - { FRAC_CONST(0.453261394879198), FRAC_CONST(0.891377646069366) }, - { FRAC_CONST(0.447417675375397), FRAC_CONST(0.894325121956035) }, - { FRAC_CONST(0.441554789987504), FRAC_CONST(0.897234287931024) }, - { FRAC_CONST(0.435672989862017), FRAC_CONST(0.900105019375345) }, - { FRAC_CONST(0.429772526955677), FRAC_CONST(0.902937193316419) }, - { FRAC_CONST(0.423853654024676), FRAC_CONST(0.905730688433339) }, - { FRAC_CONST(0.417916624613831), FRAC_CONST(0.908485385062073) }, - { FRAC_CONST(0.411961693045722), FRAC_CONST(0.911201165200584) }, - { FRAC_CONST(0.405989114409798), FRAC_CONST(0.913877912513892) }, - { FRAC_CONST(0.399999144551449), FRAC_CONST(0.916515512339049) }, - { FRAC_CONST(0.393992040061048), FRAC_CONST(0.919113851690058) }, - { FRAC_CONST(0.387968058262959), FRAC_CONST(0.921672819262709) }, - { FRAC_CONST(0.381927457204511), FRAC_CONST(0.924192305439348) }, - { FRAC_CONST(0.375870495644949), FRAC_CONST(0.926672202293573) }, - { FRAC_CONST(0.369797433044349), FRAC_CONST(0.929112403594856) }, - { FRAC_CONST(0.363708529552499), FRAC_CONST(0.931512804813095) }, - { FRAC_CONST(0.357604045997758), FRAC_CONST(0.933873303123091) }, - { FRAC_CONST(0.351484243875885), FRAC_CONST(0.936193797408954) }, - { FRAC_CONST(0.345349385338836), FRAC_CONST(0.938474188268430) }, - { FRAC_CONST(0.339199733183530), FRAC_CONST(0.940714378017165) }, - { FRAC_CONST(0.333035550840599), FRAC_CONST(0.942914270692887) }, - { FRAC_CONST(0.326857102363098), FRAC_CONST(0.945073772059514) }, - { FRAC_CONST(0.320664652415198), FRAC_CONST(0.947192789611197) }, - { FRAC_CONST(0.314458466260842), FRAC_CONST(0.949271232576274) }, - { FRAC_CONST(0.308238809752391), FRAC_CONST(0.951309011921168) }, - { FRAC_CONST(0.302005949319228), FRAC_CONST(0.953306040354194) }, - { FRAC_CONST(0.295760151956351), FRAC_CONST(0.955262232329299) }, - { FRAC_CONST(0.289501685212929), FRAC_CONST(0.957177504049732) }, - { FRAC_CONST(0.283230817180850), FRAC_CONST(0.959051773471624) }, - { FRAC_CONST(0.276947816483228), FRAC_CONST(0.960884960307514) }, - { FRAC_CONST(0.270652952262902), FRAC_CONST(0.962676986029777) }, - { FRAC_CONST(0.264346494170904), FRAC_CONST(0.964427773873996) }, - { FRAC_CONST(0.258028712354909), FRAC_CONST(0.966137248842248) }, - { FRAC_CONST(0.251699877447663), FRAC_CONST(0.967805337706313) }, - { FRAC_CONST(0.245360260555389), FRAC_CONST(0.969431969010818) }, - { FRAC_CONST(0.239010133246176), FRAC_CONST(0.971017073076290) }, - { FRAC_CONST(0.232649767538342), FRAC_CONST(0.972560582002147) }, - { FRAC_CONST(0.226279435888785), FRAC_CONST(0.974062429669605) }, - { FRAC_CONST(0.219899411181310), FRAC_CONST(0.975522551744506) }, - { FRAC_CONST(0.213509966714943), FRAC_CONST(0.976940885680082) }, - { FRAC_CONST(0.207111376192219), FRAC_CONST(0.978317370719628) }, - { FRAC_CONST(0.200703913707458), FRAC_CONST(0.979651947899104) }, - { FRAC_CONST(0.194287853735029), FRAC_CONST(0.980944560049668) }, - { FRAC_CONST(0.187863471117585), FRAC_CONST(0.982195151800116) }, - { FRAC_CONST(0.181431041054297), FRAC_CONST(0.983403669579260) }, - { FRAC_CONST(0.174990839089060), FRAC_CONST(0.984570061618221) }, - { FRAC_CONST(0.168543141098691), FRAC_CONST(0.985694277952645) }, - { FRAC_CONST(0.162088223281113), FRAC_CONST(0.986776270424848) }, - { FRAC_CONST(0.155626362143520), FRAC_CONST(0.987815992685872) }, - { FRAC_CONST(0.149157834490539), FRAC_CONST(0.988813400197476) }, - { FRAC_CONST(0.142682917412363), FRAC_CONST(0.989768450234042) }, - { FRAC_CONST(0.136201888272891), FRAC_CONST(0.990681101884405) }, - { FRAC_CONST(0.129715024697841), FRAC_CONST(0.991551316053606) }, - { FRAC_CONST(0.123222604562857), FRAC_CONST(0.992379055464567) }, - { FRAC_CONST(0.116724905981611), FRAC_CONST(0.993164284659685) }, - { FRAC_CONST(0.110222207293883), FRAC_CONST(0.993906970002356) }, - { FRAC_CONST(0.103714787053643), FRAC_CONST(0.994607079678411) }, - { FRAC_CONST(0.097202924017115), FRAC_CONST(0.995264583697482) }, - { FRAC_CONST(0.090686897130838), FRAC_CONST(0.995879453894286) }, - { FRAC_CONST(0.084166985519718), FRAC_CONST(0.996451663929828) }, - { FRAC_CONST(0.077643468475068), FRAC_CONST(0.996981189292537) }, - { FRAC_CONST(0.071116625442645), FRAC_CONST(0.997468007299307) }, - { FRAC_CONST(0.064586736010684), FRAC_CONST(0.997912097096476) }, - { FRAC_CONST(0.058054079897912), FRAC_CONST(0.998313439660714) }, - { FRAC_CONST(0.051518936941578), FRAC_CONST(0.998672017799843) }, - { FRAC_CONST(0.044981587085452), FRAC_CONST(0.998987816153567) }, - { FRAC_CONST(0.038442310367847), FRAC_CONST(0.999260821194138) }, - { FRAC_CONST(0.031901386909611), FRAC_CONST(0.999491021226926) }, - { FRAC_CONST(0.025359096902136), FRAC_CONST(0.999678406390929) }, - { FRAC_CONST(0.018815720595351), FRAC_CONST(0.999822968659191) }, - { FRAC_CONST(0.012271538285720), FRAC_CONST(0.999924701839145) }, - { FRAC_CONST(0.005726830304231), FRAC_CONST(0.999983601572879) } -}; -#endif // LD_DEC - -/* 60 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_240[] = -{ - { FRAC_CONST(0.999994645401696), FRAC_CONST(0.003272486506527) }, - { FRAC_CONST(0.999566308502021), FRAC_CONST(0.029448173247963) }, - { FRAC_CONST(0.998452918783950), FRAC_CONST(0.055603677682425) }, - { FRAC_CONST(0.996655239309180), FRAC_CONST(0.081721074133668) }, - { FRAC_CONST(0.994174502117428), FRAC_CONST(0.107782463042759) }, - { FRAC_CONST(0.991012407382049), FRAC_CONST(0.133769983235535) }, - { FRAC_CONST(0.987171122244825), FRAC_CONST(0.159665824163761) }, - { FRAC_CONST(0.982653279330712), FRAC_CONST(0.185452238111591) }, - { FRAC_CONST(0.977461974943572), FRAC_CONST(0.211111552358965) }, - { FRAC_CONST(0.971600766944121), FRAC_CONST(0.236626181293610) }, - { FRAC_CONST(0.965073672311547), FRAC_CONST(0.261978638463337) }, - { FRAC_CONST(0.957885164390477), FRAC_CONST(0.287151548560387) }, - { FRAC_CONST(0.950040169825165), FRAC_CONST(0.312127659329594) }, - { FRAC_CONST(0.941544065183021), FRAC_CONST(0.336889853392220) }, - { FRAC_CONST(0.932402673269775), FRAC_CONST(0.361421159977355) }, - { FRAC_CONST(0.922622259138823), FRAC_CONST(0.385704766552831) }, - { FRAC_CONST(0.912209525797468), FRAC_CONST(0.409724030347695) }, - { FRAC_CONST(0.901171609613013), FRAC_CONST(0.433462489758331) }, - { FRAC_CONST(0.889516075421856), FRAC_CONST(0.456903875630421) }, - { FRAC_CONST(0.877250911344924), FRAC_CONST(0.480032122409011) }, - { FRAC_CONST(0.864384523313017), FRAC_CONST(0.502831379149042) }, - { FRAC_CONST(0.850925729305802), FRAC_CONST(0.525286020378792) }, - { FRAC_CONST(0.836883753308409), FRAC_CONST(0.547380656808797) }, - { FRAC_CONST(0.822268218989775), FRAC_CONST(0.569100145878898) }, - { FRAC_CONST(0.807089143107059), FRAC_CONST(0.590429602136201) }, - { FRAC_CONST(0.791356928640660), FRAC_CONST(0.611354407436816) }, - { FRAC_CONST(0.775082357664531), FRAC_CONST(0.631860220964409) }, - { FRAC_CONST(0.758276583956687), FRAC_CONST(0.651932989058674) }, - { FRAC_CONST(0.740951125354959), FRAC_CONST(0.671558954847018) }, - { FRAC_CONST(0.723117855863248), FRAC_CONST(0.690724667672829) }, - { FRAC_CONST(0.704788997513670), FRAC_CONST(0.709416992313883) }, - { FRAC_CONST(0.685977111990193), FRAC_CONST(0.727623117984575) }, - { FRAC_CONST(0.666695092019479), FRAC_CONST(0.745330567115786) }, - { FRAC_CONST(0.646956152534857), FRAC_CONST(0.762527203906388) }, - { FRAC_CONST(0.626773821619469), FRAC_CONST(0.779201242640517) }, - { FRAC_CONST(0.606161931234795), FRAC_CONST(0.795341255764910) }, - { FRAC_CONST(0.585134607740916), FRAC_CONST(0.810936181720784) }, - { FRAC_CONST(0.563706262215017), FRAC_CONST(0.825975332524873) }, - { FRAC_CONST(0.541891580574752), FRAC_CONST(0.840448401094438) }, - { FRAC_CONST(0.519705513513249), FRAC_CONST(0.854345468311227) }, - { FRAC_CONST(0.497163266252654), FRAC_CONST(0.867657009819544) }, - { FRAC_CONST(0.474280288123229), FRAC_CONST(0.880373902553765) }, - { FRAC_CONST(0.451072261975153), FRAC_CONST(0.892487430990834) }, - { FRAC_CONST(0.427555093430282), FRAC_CONST(0.903989293123443) }, - { FRAC_CONST(0.403744899981227), FRAC_CONST(0.914871606149819) }, - { FRAC_CONST(0.379657999945233), FRAC_CONST(0.925126911876195) }, - { FRAC_CONST(0.355310901280416), FRAC_CONST(0.934748181828292) }, - { FRAC_CONST(0.330720290272038), FRAC_CONST(0.943728822068278) }, - { FRAC_CONST(0.305903020096554), FRAC_CONST(0.952062677713924) }, - { FRAC_CONST(0.280876099271292), FRAC_CONST(0.959744037156857) }, - { FRAC_CONST(0.255656679997665), FRAC_CONST(0.966767635977008) }, - { FRAC_CONST(0.230262046405902), FRAC_CONST(0.973128660550580) }, - { FRAC_CONST(0.204709602709380), FRAC_CONST(0.978822751349072) }, - { FRAC_CONST(0.179016861276633), FRAC_CONST(0.983846005927077) }, - { FRAC_CONST(0.153201430629259), FRAC_CONST(0.988194981596825) }, - { FRAC_CONST(0.127281003373913), FRAC_CONST(0.991866697787626) }, - { FRAC_CONST(0.101273344076683), FRAC_CONST(0.994858638088611) }, - { FRAC_CONST(0.075196277088140), FRAC_CONST(0.997168751973348) }, - { FRAC_CONST(0.049067674327418), FRAC_CONST(0.998795456205172) }, - { FRAC_CONST(0.022905443033697), FRAC_CONST(0.999737635922260) } -}; -#endif // ALLOW_SMALL_FRAMELENGTH - -#ifdef SSR_DEC -/* 128 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_512[] = -{ - { FRAC_CONST(0.999998823451702), FRAC_CONST(0.001533980186285) }, - { FRAC_CONST(0.999904701082853), FRAC_CONST(0.013805388528060) }, - { FRAC_CONST(0.999659996743959), FRAC_CONST(0.026074717829104) }, - { FRAC_CONST(0.999264747286594), FRAC_CONST(0.038340120373553) }, - { FRAC_CONST(0.998719012233873), FRAC_CONST(0.050599749036899) }, - { FRAC_CONST(0.998022873771486), FRAC_CONST(0.062851757564161) }, - { FRAC_CONST(0.997176436735326), FRAC_CONST(0.075094300847921) }, - { FRAC_CONST(0.996179828595697), FRAC_CONST(0.087325535206192) }, - { FRAC_CONST(0.995033199438119), FRAC_CONST(0.099543618660069) }, - { FRAC_CONST(0.993736721940725), FRAC_CONST(0.111746711211127) }, - { FRAC_CONST(0.992290591348257), FRAC_CONST(0.123932975118512) }, - { FRAC_CONST(0.990695025442665), FRAC_CONST(0.136100575175706) }, - { FRAC_CONST(0.988950264510303), FRAC_CONST(0.148247678986896) }, - { FRAC_CONST(0.987056571305751), FRAC_CONST(0.160372457242928) }, - { FRAC_CONST(0.985014231012240), FRAC_CONST(0.172473083996796) }, - { FRAC_CONST(0.982823551198705), FRAC_CONST(0.184547736938620) }, - { FRAC_CONST(0.980484861773469), FRAC_CONST(0.196594597670080) }, - { FRAC_CONST(0.977998514934557), FRAC_CONST(0.208611851978263) }, - { FRAC_CONST(0.975364885116657), FRAC_CONST(0.220597690108874) }, - { FRAC_CONST(0.972584368934732), FRAC_CONST(0.232550307038775) }, - { FRAC_CONST(0.969657385124292), FRAC_CONST(0.244467902747824) }, - { FRAC_CONST(0.966584374478333), FRAC_CONST(0.256348682489943) }, - { FRAC_CONST(0.963365799780954), FRAC_CONST(0.268190857063403) }, - { FRAC_CONST(0.960002145737666), FRAC_CONST(0.279992643080273) }, - { FRAC_CONST(0.956493918902395), FRAC_CONST(0.291752263234989) }, - { FRAC_CONST(0.952841647601199), FRAC_CONST(0.303467946572011) }, - { FRAC_CONST(0.949045881852701), FRAC_CONST(0.315137928752522) }, - { FRAC_CONST(0.945107193285261), FRAC_CONST(0.326760452320132) }, - { FRAC_CONST(0.941026175050889), FRAC_CONST(0.338333766965541) }, - { FRAC_CONST(0.936803441735922), FRAC_CONST(0.349856129790135) }, - { FRAC_CONST(0.932439629268462), FRAC_CONST(0.361325805568454) }, - { FRAC_CONST(0.927935394822618), FRAC_CONST(0.372741067009516) }, - { FRAC_CONST(0.923291416719528), FRAC_CONST(0.384100195016935) }, - { FRAC_CONST(0.918508394325212), FRAC_CONST(0.395401478947816) }, - { FRAC_CONST(0.913587047945251), FRAC_CONST(0.406643216870369) }, - { FRAC_CONST(0.908528118716306), FRAC_CONST(0.417823715820212) }, - { FRAC_CONST(0.903332368494512), FRAC_CONST(0.428941292055329) }, - { FRAC_CONST(0.898000579740740), FRAC_CONST(0.439994271309633) }, - { FRAC_CONST(0.892533555402765), FRAC_CONST(0.450980989045104) }, - { FRAC_CONST(0.886932118794342), FRAC_CONST(0.461899790702463) }, - { FRAC_CONST(0.881197113471222), FRAC_CONST(0.472749031950343) }, - { FRAC_CONST(0.875329403104111), FRAC_CONST(0.483527078932919) }, - { FRAC_CONST(0.869329871348607), FRAC_CONST(0.494232308515960) }, - { FRAC_CONST(0.863199421712124), FRAC_CONST(0.504863108531268) }, - { FRAC_CONST(0.856938977417829), FRAC_CONST(0.515417878019463) }, - { FRAC_CONST(0.850549481265603), FRAC_CONST(0.525895027471085) }, - { FRAC_CONST(0.844031895490066), FRAC_CONST(0.536292979065963) }, - { FRAC_CONST(0.837387201615662), FRAC_CONST(0.546610166910835) }, - { FRAC_CONST(0.830616400308846), FRAC_CONST(0.556845037275160) }, - { FRAC_CONST(0.823720511227391), FRAC_CONST(0.566996048825109) }, - { FRAC_CONST(0.816700572866828), FRAC_CONST(0.577061672855679) }, - { FRAC_CONST(0.809557642404051), FRAC_CONST(0.587040393520918) }, - { FRAC_CONST(0.802292795538116), FRAC_CONST(0.596930708062197) }, - { FRAC_CONST(0.794907126328237), FRAC_CONST(0.606731127034524) }, - { FRAC_CONST(0.787401747029031), FRAC_CONST(0.616440174530854) }, - { FRAC_CONST(0.779777787923015), FRAC_CONST(0.626056388404344) }, - { FRAC_CONST(0.772036397150385), FRAC_CONST(0.635578320488556) }, - { FRAC_CONST(0.764178740536117), FRAC_CONST(0.645004536815544) }, - { FRAC_CONST(0.756206001414395), FRAC_CONST(0.654333617831800) }, - { FRAC_CONST(0.748119380450404), FRAC_CONST(0.663564158612040) }, - { FRAC_CONST(0.739920095459516), FRAC_CONST(0.672694769070773) }, - { FRAC_CONST(0.731609381223893), FRAC_CONST(0.681724074171650) }, - { FRAC_CONST(0.723188489306527), FRAC_CONST(0.690650714134535) }, - { FRAC_CONST(0.714658687862769), FRAC_CONST(0.699473344640284) }, - { FRAC_CONST(0.706021261449340), FRAC_CONST(0.708190637033195) }, - { FRAC_CONST(0.697277510830887), FRAC_CONST(0.716801278521100) }, - { FRAC_CONST(0.688428752784091), FRAC_CONST(0.725303972373061) }, - { FRAC_CONST(0.679476319899365), FRAC_CONST(0.733697438114660) }, - { FRAC_CONST(0.670421560380173), FRAC_CONST(0.741980411720831) }, - { FRAC_CONST(0.661265837839992), FRAC_CONST(0.750151645806215) }, - { FRAC_CONST(0.652010531096960), FRAC_CONST(0.758209909813015) }, - { FRAC_CONST(0.642657033966227), FRAC_CONST(0.766153990196313) }, - { FRAC_CONST(0.633206755050057), FRAC_CONST(0.773982690606823) }, - { FRAC_CONST(0.623661117525695), FRAC_CONST(0.781694832071059) }, - { FRAC_CONST(0.614021558931038), FRAC_CONST(0.789289253168886) }, - { FRAC_CONST(0.604289530948156), FRAC_CONST(0.796764810208419) }, - { FRAC_CONST(0.594466499184665), FRAC_CONST(0.804120377398266) }, - { FRAC_CONST(0.584553942953015), FRAC_CONST(0.811354847017064) }, - { FRAC_CONST(0.574553355047716), FRAC_CONST(0.818467129580299) }, - { FRAC_CONST(0.564466241520520), FRAC_CONST(0.825456154004377) }, - { FRAC_CONST(0.554294121453620), FRAC_CONST(0.832320867767930) }, - { FRAC_CONST(0.544038526730884), FRAC_CONST(0.839060237070313) }, - { FRAC_CONST(0.533701001807153), FRAC_CONST(0.845673246987299) }, - { FRAC_CONST(0.523283103475656), FRAC_CONST(0.852158901623920) }, - { FRAC_CONST(0.512786400633563), FRAC_CONST(0.858516224264443) }, - { FRAC_CONST(0.502212474045711), FRAC_CONST(0.864744257519462) }, - { FRAC_CONST(0.491562916106550), FRAC_CONST(0.870842063470079) }, - { FRAC_CONST(0.480839330600334), FRAC_CONST(0.876808723809146) }, - { FRAC_CONST(0.470043332459596), FRAC_CONST(0.882643339979563) }, - { FRAC_CONST(0.459176547521944), FRAC_CONST(0.888345033309596) }, - { FRAC_CONST(0.448240612285220), FRAC_CONST(0.893912945145203) }, - { FRAC_CONST(0.437237173661044), FRAC_CONST(0.899346236979341) }, - { FRAC_CONST(0.426167888726800), FRAC_CONST(0.904644090578246) }, - { FRAC_CONST(0.415034424476082), FRAC_CONST(0.909805708104652) }, - { FRAC_CONST(0.403838457567654), FRAC_CONST(0.914830312237946) }, - { FRAC_CONST(0.392581674072952), FRAC_CONST(0.919717146291227) }, - { FRAC_CONST(0.381265769222162), FRAC_CONST(0.924465474325263) }, - { FRAC_CONST(0.369892447148934), FRAC_CONST(0.929074581259316) }, - { FRAC_CONST(0.358463420633737), FRAC_CONST(0.933543772978836) }, - { FRAC_CONST(0.346980410845924), FRAC_CONST(0.937872376439990) }, - { FRAC_CONST(0.335445147084532), FRAC_CONST(0.942059739771017) }, - { FRAC_CONST(0.323859366517853), FRAC_CONST(0.946105232370403) }, - { FRAC_CONST(0.312224813921825), FRAC_CONST(0.950008245001843) }, - { FRAC_CONST(0.300543241417273), FRAC_CONST(0.953768189885990) }, - { FRAC_CONST(0.288816408206049), FRAC_CONST(0.957384500788976) }, - { FRAC_CONST(0.277046080306100), FRAC_CONST(0.960856633107680) }, - { FRAC_CONST(0.265234030285512), FRAC_CONST(0.964184063951746) }, - { FRAC_CONST(0.253382036995570), FRAC_CONST(0.967366292222329) }, - { FRAC_CONST(0.241491885302869), FRAC_CONST(0.970402838687556) }, - { FRAC_CONST(0.229565365820519), FRAC_CONST(0.973293246054698) }, - { FRAC_CONST(0.217604274638484), FRAC_CONST(0.976037079039039) }, - { FRAC_CONST(0.205610413053099), FRAC_CONST(0.978633924429423) }, - { FRAC_CONST(0.193585587295804), FRAC_CONST(0.981083391150487) }, - { FRAC_CONST(0.181531608261125), FRAC_CONST(0.983385110321551) }, - { FRAC_CONST(0.169450291233968), FRAC_CONST(0.985538735312176) }, - { FRAC_CONST(0.157343455616238), FRAC_CONST(0.987543941794359) }, - { FRAC_CONST(0.145212924652848), FRAC_CONST(0.989400427791380) }, - { FRAC_CONST(0.133060525157139), FRAC_CONST(0.991107913723277) }, - { FRAC_CONST(0.120888087235777), FRAC_CONST(0.992666142448948) }, - { FRAC_CONST(0.108697444013139), FRAC_CONST(0.994074879304879) }, - { FRAC_CONST(0.096490431355253), FRAC_CONST(0.995333912140482) }, - { FRAC_CONST(0.084268887593324), FRAC_CONST(0.996443051350043) }, - { FRAC_CONST(0.072034653246889), FRAC_CONST(0.997402129901275) }, - { FRAC_CONST(0.059789570746640), FRAC_CONST(0.998211003360478) }, - { FRAC_CONST(0.047535484156959), FRAC_CONST(0.998869549914284) }, - { FRAC_CONST(0.035274238898214), FRAC_CONST(0.999377670388003) }, - { FRAC_CONST(0.023007681468839), FRAC_CONST(0.999735288260562) }, - { FRAC_CONST(0.010737659167265), FRAC_CONST(0.999942349676024) } -}; - -/* 16 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_64[] = -{ - { FRAC_CONST(0.999924701839145), FRAC_CONST(0.012271538285720) }, - { FRAC_CONST(0.993906970002356), FRAC_CONST(0.110222207293883) }, - { FRAC_CONST(0.978317370719628), FRAC_CONST(0.207111376192219) }, - { FRAC_CONST(0.953306040354194), FRAC_CONST(0.302005949319228) }, - { FRAC_CONST(0.919113851690058), FRAC_CONST(0.393992040061048) }, - { FRAC_CONST(0.876070094195407), FRAC_CONST(0.482183772079123) }, - { FRAC_CONST(0.824589302785025), FRAC_CONST(0.565731810783613) }, - { FRAC_CONST(0.765167265622459), FRAC_CONST(0.643831542889791) }, - { FRAC_CONST(0.698376249408973), FRAC_CONST(0.715730825283819) }, - { FRAC_CONST(0.624859488142386), FRAC_CONST(0.780737228572094) }, - { FRAC_CONST(0.545324988422046), FRAC_CONST(0.838224705554838) }, - { FRAC_CONST(0.460538710958240), FRAC_CONST(0.887639620402854) }, - { FRAC_CONST(0.371317193951838), FRAC_CONST(0.928506080473215) }, - { FRAC_CONST(0.278519689385053), FRAC_CONST(0.960430519415566) }, - { FRAC_CONST(0.183039887955141), FRAC_CONST(0.983105487431216) }, - { FRAC_CONST(0.085797312344440), FRAC_CONST(0.996312612182778) } -}; -#endif // SSR_DEC - -#else // FIXED_POINT - -/* 256 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_2048[] = -{ - { FRAC_CONST(0.031249997702054), FRAC_CONST(0.000011984224612) }, - { FRAC_CONST(0.031249813866531), FRAC_CONST(0.000107857810004) }, - { FRAC_CONST(0.031249335895858), FRAC_CONST(0.000203730380198) }, - { FRAC_CONST(0.031248563794535), FRAC_CONST(0.000299601032804) }, - { FRAC_CONST(0.031247497569829), FRAC_CONST(0.000395468865451) }, - { FRAC_CONST(0.031246137231775), FRAC_CONST(0.000491332975794) }, - { FRAC_CONST(0.031244482793177), FRAC_CONST(0.000587192461525) }, - { FRAC_CONST(0.031242534269608), FRAC_CONST(0.000683046420376) }, - { FRAC_CONST(0.031240291679407), FRAC_CONST(0.000778893950134) }, - { FRAC_CONST(0.031237755043684), FRAC_CONST(0.000874734148645) }, - { FRAC_CONST(0.031234924386313), FRAC_CONST(0.000970566113826) }, - { FRAC_CONST(0.031231799733938), FRAC_CONST(0.001066388943669) }, - { FRAC_CONST(0.031228381115970), FRAC_CONST(0.001162201736253) }, - { FRAC_CONST(0.031224668564585), FRAC_CONST(0.001258003589751) }, - { FRAC_CONST(0.031220662114728), FRAC_CONST(0.001353793602441) }, - { FRAC_CONST(0.031216361804108), FRAC_CONST(0.001449570872710) }, - { FRAC_CONST(0.031211767673203), FRAC_CONST(0.001545334499065) }, - { FRAC_CONST(0.031206879765253), FRAC_CONST(0.001641083580144) }, - { FRAC_CONST(0.031201698126266), FRAC_CONST(0.001736817214719) }, - { FRAC_CONST(0.031196222805014), FRAC_CONST(0.001832534501709) }, - { FRAC_CONST(0.031190453853031), FRAC_CONST(0.001928234540186) }, - { FRAC_CONST(0.031184391324617), FRAC_CONST(0.002023916429386) }, - { FRAC_CONST(0.031178035276836), FRAC_CONST(0.002119579268713) }, - { FRAC_CONST(0.031171385769513), FRAC_CONST(0.002215222157753) }, - { FRAC_CONST(0.031164442865236), FRAC_CONST(0.002310844196278) }, - { FRAC_CONST(0.031157206629353), FRAC_CONST(0.002406444484258) }, - { FRAC_CONST(0.031149677129975), FRAC_CONST(0.002502022121865) }, - { FRAC_CONST(0.031141854437973), FRAC_CONST(0.002597576209488) }, - { FRAC_CONST(0.031133738626977), FRAC_CONST(0.002693105847734) }, - { FRAC_CONST(0.031125329773375), FRAC_CONST(0.002788610137442) }, - { FRAC_CONST(0.031116627956316), FRAC_CONST(0.002884088179689) }, - { FRAC_CONST(0.031107633257703), FRAC_CONST(0.002979539075801) }, - { FRAC_CONST(0.031098345762200), FRAC_CONST(0.003074961927355) }, - { FRAC_CONST(0.031088765557222), FRAC_CONST(0.003170355836197) }, - { FRAC_CONST(0.031078892732942), FRAC_CONST(0.003265719904442) }, - { FRAC_CONST(0.031068727382288), FRAC_CONST(0.003361053234488) }, - { FRAC_CONST(0.031058269600939), FRAC_CONST(0.003456354929021) }, - { FRAC_CONST(0.031047519487329), FRAC_CONST(0.003551624091024) }, - { FRAC_CONST(0.031036477142640), FRAC_CONST(0.003646859823790) }, - { FRAC_CONST(0.031025142670809), FRAC_CONST(0.003742061230921) }, - { FRAC_CONST(0.031013516178519), FRAC_CONST(0.003837227416347) }, - { FRAC_CONST(0.031001597775203), FRAC_CONST(0.003932357484328) }, - { FRAC_CONST(0.030989387573042), FRAC_CONST(0.004027450539462) }, - { FRAC_CONST(0.030976885686963), FRAC_CONST(0.004122505686697) }, - { FRAC_CONST(0.030964092234638), FRAC_CONST(0.004217522031340) }, - { FRAC_CONST(0.030951007336485), FRAC_CONST(0.004312498679058) }, - { FRAC_CONST(0.030937631115663), FRAC_CONST(0.004407434735897) }, - { FRAC_CONST(0.030923963698074), FRAC_CONST(0.004502329308281) }, - { FRAC_CONST(0.030910005212362), FRAC_CONST(0.004597181503027) }, - { FRAC_CONST(0.030895755789908), FRAC_CONST(0.004691990427350) }, - { FRAC_CONST(0.030881215564835), FRAC_CONST(0.004786755188872) }, - { FRAC_CONST(0.030866384674000), FRAC_CONST(0.004881474895632) }, - { FRAC_CONST(0.030851263256996), FRAC_CONST(0.004976148656090) }, - { FRAC_CONST(0.030835851456154), FRAC_CONST(0.005070775579142) }, - { FRAC_CONST(0.030820149416533), FRAC_CONST(0.005165354774124) }, - { FRAC_CONST(0.030804157285929), FRAC_CONST(0.005259885350819) }, - { FRAC_CONST(0.030787875214864), FRAC_CONST(0.005354366419469) }, - { FRAC_CONST(0.030771303356593), FRAC_CONST(0.005448797090784) }, - { FRAC_CONST(0.030754441867095), FRAC_CONST(0.005543176475946) }, - { FRAC_CONST(0.030737290905077), FRAC_CONST(0.005637503686619) }, - { FRAC_CONST(0.030719850631972), FRAC_CONST(0.005731777834961) }, - { FRAC_CONST(0.030702121211932), FRAC_CONST(0.005825998033626) }, - { FRAC_CONST(0.030684102811835), FRAC_CONST(0.005920163395780) }, - { FRAC_CONST(0.030665795601276), FRAC_CONST(0.006014273035101) }, - { FRAC_CONST(0.030647199752570), FRAC_CONST(0.006108326065793) }, - { FRAC_CONST(0.030628315440748), FRAC_CONST(0.006202321602594) }, - { FRAC_CONST(0.030609142843557), FRAC_CONST(0.006296258760782) }, - { FRAC_CONST(0.030589682141455), FRAC_CONST(0.006390136656185) }, - { FRAC_CONST(0.030569933517616), FRAC_CONST(0.006483954405188) }, - { FRAC_CONST(0.030549897157919), FRAC_CONST(0.006577711124743) }, - { FRAC_CONST(0.030529573250956), FRAC_CONST(0.006671405932375) }, - { FRAC_CONST(0.030508961988022), FRAC_CONST(0.006765037946194) }, - { FRAC_CONST(0.030488063563118), FRAC_CONST(0.006858606284900) }, - { FRAC_CONST(0.030466878172949), FRAC_CONST(0.006952110067791) }, - { FRAC_CONST(0.030445406016919), FRAC_CONST(0.007045548414774) }, - { FRAC_CONST(0.030423647297133), FRAC_CONST(0.007138920446372) }, - { FRAC_CONST(0.030401602218392), FRAC_CONST(0.007232225283733) }, - { FRAC_CONST(0.030379270988192), FRAC_CONST(0.007325462048634) }, - { FRAC_CONST(0.030356653816724), FRAC_CONST(0.007418629863497) }, - { FRAC_CONST(0.030333750916869), FRAC_CONST(0.007511727851390) }, - { FRAC_CONST(0.030310562504198), FRAC_CONST(0.007604755136040) }, - { FRAC_CONST(0.030287088796968), FRAC_CONST(0.007697710841838) }, - { FRAC_CONST(0.030263330016124), FRAC_CONST(0.007790594093851) }, - { FRAC_CONST(0.030239286385293), FRAC_CONST(0.007883404017824) }, - { FRAC_CONST(0.030214958130781), FRAC_CONST(0.007976139740197) }, - { FRAC_CONST(0.030190345481576), FRAC_CONST(0.008068800388104) }, - { FRAC_CONST(0.030165448669342), FRAC_CONST(0.008161385089390) }, - { FRAC_CONST(0.030140267928416), FRAC_CONST(0.008253892972610) }, - { FRAC_CONST(0.030114803495809), FRAC_CONST(0.008346323167047) }, - { FRAC_CONST(0.030089055611203), FRAC_CONST(0.008438674802711) }, - { FRAC_CONST(0.030063024516947), FRAC_CONST(0.008530947010354) }, - { FRAC_CONST(0.030036710458054), FRAC_CONST(0.008623138921475) }, - { FRAC_CONST(0.030010113682202), FRAC_CONST(0.008715249668328) }, - { FRAC_CONST(0.029983234439732), FRAC_CONST(0.008807278383932) }, - { FRAC_CONST(0.029956072983640), FRAC_CONST(0.008899224202078) }, - { FRAC_CONST(0.029928629569580), FRAC_CONST(0.008991086257336) }, - { FRAC_CONST(0.029900904455860), FRAC_CONST(0.009082863685067) }, - { FRAC_CONST(0.029872897903441), FRAC_CONST(0.009174555621425) }, - { FRAC_CONST(0.029844610175929), FRAC_CONST(0.009266161203371) }, - { FRAC_CONST(0.029816041539579), FRAC_CONST(0.009357679568679) }, - { FRAC_CONST(0.029787192263292), FRAC_CONST(0.009449109855944) }, - { FRAC_CONST(0.029758062618606), FRAC_CONST(0.009540451204587) }, - { FRAC_CONST(0.029728652879702), FRAC_CONST(0.009631702754871) }, - { FRAC_CONST(0.029698963323395), FRAC_CONST(0.009722863647900) }, - { FRAC_CONST(0.029668994229134), FRAC_CONST(0.009813933025633) }, - { FRAC_CONST(0.029638745879000), FRAC_CONST(0.009904910030891) }, - { FRAC_CONST(0.029608218557702), FRAC_CONST(0.009995793807363) }, - { FRAC_CONST(0.029577412552575), FRAC_CONST(0.010086583499618) }, - { FRAC_CONST(0.029546328153577), FRAC_CONST(0.010177278253107) }, - { FRAC_CONST(0.029514965653285), FRAC_CONST(0.010267877214177) }, - { FRAC_CONST(0.029483325346896), FRAC_CONST(0.010358379530076) }, - { FRAC_CONST(0.029451407532220), FRAC_CONST(0.010448784348962) }, - { FRAC_CONST(0.029419212509679), FRAC_CONST(0.010539090819911) }, - { FRAC_CONST(0.029386740582307), FRAC_CONST(0.010629298092923) }, - { FRAC_CONST(0.029353992055740), FRAC_CONST(0.010719405318933) }, - { FRAC_CONST(0.029320967238220), FRAC_CONST(0.010809411649818) }, - { FRAC_CONST(0.029287666440590), FRAC_CONST(0.010899316238403) }, - { FRAC_CONST(0.029254089976290), FRAC_CONST(0.010989118238474) }, - { FRAC_CONST(0.029220238161353), FRAC_CONST(0.011078816804778) }, - { FRAC_CONST(0.029186111314406), FRAC_CONST(0.011168411093039) }, - { FRAC_CONST(0.029151709756664), FRAC_CONST(0.011257900259961) }, - { FRAC_CONST(0.029117033811927), FRAC_CONST(0.011347283463239) }, - { FRAC_CONST(0.029082083806579), FRAC_CONST(0.011436559861563) }, - { FRAC_CONST(0.029046860069582), FRAC_CONST(0.011525728614630) }, - { FRAC_CONST(0.029011362932476), FRAC_CONST(0.011614788883150) }, - { FRAC_CONST(0.028975592729373), FRAC_CONST(0.011703739828853) }, - { FRAC_CONST(0.028939549796957), FRAC_CONST(0.011792580614500) }, - { FRAC_CONST(0.028903234474475), FRAC_CONST(0.011881310403886) }, - { FRAC_CONST(0.028866647103744), FRAC_CONST(0.011969928361855) }, - { FRAC_CONST(0.028829788029135), FRAC_CONST(0.012058433654299) }, - { FRAC_CONST(0.028792657597583), FRAC_CONST(0.012146825448172) }, - { FRAC_CONST(0.028755256158571), FRAC_CONST(0.012235102911499) }, - { FRAC_CONST(0.028717584064137), FRAC_CONST(0.012323265213377) }, - { FRAC_CONST(0.028679641668864), FRAC_CONST(0.012411311523990) }, - { FRAC_CONST(0.028641429329882), FRAC_CONST(0.012499241014612) }, - { FRAC_CONST(0.028602947406859), FRAC_CONST(0.012587052857618) }, - { FRAC_CONST(0.028564196262001), FRAC_CONST(0.012674746226488) }, - { FRAC_CONST(0.028525176260050), FRAC_CONST(0.012762320295819) }, - { FRAC_CONST(0.028485887768276), FRAC_CONST(0.012849774241331) }, - { FRAC_CONST(0.028446331156478), FRAC_CONST(0.012937107239875) }, - { FRAC_CONST(0.028406506796976), FRAC_CONST(0.013024318469437) }, - { FRAC_CONST(0.028366415064615), FRAC_CONST(0.013111407109155) }, - { FRAC_CONST(0.028326056336751), FRAC_CONST(0.013198372339315) }, - { FRAC_CONST(0.028285430993258), FRAC_CONST(0.013285213341368) }, - { FRAC_CONST(0.028244539416515), FRAC_CONST(0.013371929297933) }, - { FRAC_CONST(0.028203381991411), FRAC_CONST(0.013458519392807) }, - { FRAC_CONST(0.028161959105334), FRAC_CONST(0.013544982810971) }, - { FRAC_CONST(0.028120271148172), FRAC_CONST(0.013631318738598) }, - { FRAC_CONST(0.028078318512309), FRAC_CONST(0.013717526363062) }, - { FRAC_CONST(0.028036101592619), FRAC_CONST(0.013803604872943) }, - { FRAC_CONST(0.027993620786463), FRAC_CONST(0.013889553458039) }, - { FRAC_CONST(0.027950876493687), FRAC_CONST(0.013975371309367) }, - { FRAC_CONST(0.027907869116616), FRAC_CONST(0.014061057619178) }, - { FRAC_CONST(0.027864599060052), FRAC_CONST(0.014146611580959) }, - { FRAC_CONST(0.027821066731270), FRAC_CONST(0.014232032389445) }, - { FRAC_CONST(0.027777272540012), FRAC_CONST(0.014317319240622) }, - { FRAC_CONST(0.027733216898487), FRAC_CONST(0.014402471331737) }, - { FRAC_CONST(0.027688900221361), FRAC_CONST(0.014487487861307) }, - { FRAC_CONST(0.027644322925762), FRAC_CONST(0.014572368029123) }, - { FRAC_CONST(0.027599485431266), FRAC_CONST(0.014657111036262) }, - { FRAC_CONST(0.027554388159903), FRAC_CONST(0.014741716085090) }, - { FRAC_CONST(0.027509031536144), FRAC_CONST(0.014826182379271) }, - { FRAC_CONST(0.027463415986904), FRAC_CONST(0.014910509123778) }, - { FRAC_CONST(0.027417541941533), FRAC_CONST(0.014994695524894) }, - { FRAC_CONST(0.027371409831816), FRAC_CONST(0.015078740790225) }, - { FRAC_CONST(0.027325020091965), FRAC_CONST(0.015162644128704) }, - { FRAC_CONST(0.027278373158618), FRAC_CONST(0.015246404750603) }, - { FRAC_CONST(0.027231469470833), FRAC_CONST(0.015330021867534) }, - { FRAC_CONST(0.027184309470088), FRAC_CONST(0.015413494692460) }, - { FRAC_CONST(0.027136893600268), FRAC_CONST(0.015496822439704) }, - { FRAC_CONST(0.027089222307671), FRAC_CONST(0.015580004324954) }, - { FRAC_CONST(0.027041296040997), FRAC_CONST(0.015663039565269) }, - { FRAC_CONST(0.026993115251345), FRAC_CONST(0.015745927379091) }, - { FRAC_CONST(0.026944680392213), FRAC_CONST(0.015828666986247) }, - { FRAC_CONST(0.026895991919487), FRAC_CONST(0.015911257607961) }, - { FRAC_CONST(0.026847050291442), FRAC_CONST(0.015993698466859) }, - { FRAC_CONST(0.026797855968734), FRAC_CONST(0.016075988786976) }, - { FRAC_CONST(0.026748409414401), FRAC_CONST(0.016158127793763) }, - { FRAC_CONST(0.026698711093851), FRAC_CONST(0.016240114714099) }, - { FRAC_CONST(0.026648761474864), FRAC_CONST(0.016321948776289) }, - { FRAC_CONST(0.026598561027585), FRAC_CONST(0.016403629210082) }, - { FRAC_CONST(0.026548110224519), FRAC_CONST(0.016485155246669) }, - { FRAC_CONST(0.026497409540530), FRAC_CONST(0.016566526118696) }, - { FRAC_CONST(0.026446459452830), FRAC_CONST(0.016647741060271) }, - { FRAC_CONST(0.026395260440982), FRAC_CONST(0.016728799306966) }, - { FRAC_CONST(0.026343812986890), FRAC_CONST(0.016809700095831) }, - { FRAC_CONST(0.026292117574797), FRAC_CONST(0.016890442665397) }, - { FRAC_CONST(0.026240174691280), FRAC_CONST(0.016971026255683) }, - { FRAC_CONST(0.026187984825246), FRAC_CONST(0.017051450108208) }, - { FRAC_CONST(0.026135548467924), FRAC_CONST(0.017131713465990) }, - { FRAC_CONST(0.026082866112867), FRAC_CONST(0.017211815573560) }, - { FRAC_CONST(0.026029938255941), FRAC_CONST(0.017291755676967) }, - { FRAC_CONST(0.025976765395322), FRAC_CONST(0.017371533023784) }, - { FRAC_CONST(0.025923348031494), FRAC_CONST(0.017451146863116) }, - { FRAC_CONST(0.025869686667242), FRAC_CONST(0.017530596445607) }, - { FRAC_CONST(0.025815781807646), FRAC_CONST(0.017609881023449) }, - { FRAC_CONST(0.025761633960080), FRAC_CONST(0.017688999850383) }, - { FRAC_CONST(0.025707243634204), FRAC_CONST(0.017767952181715) }, - { FRAC_CONST(0.025652611341960), FRAC_CONST(0.017846737274313) }, - { FRAC_CONST(0.025597737597568), FRAC_CONST(0.017925354386623) }, - { FRAC_CONST(0.025542622917522), FRAC_CONST(0.018003802778671) }, - { FRAC_CONST(0.025487267820581), FRAC_CONST(0.018082081712071) }, - { FRAC_CONST(0.025431672827768), FRAC_CONST(0.018160190450031) }, - { FRAC_CONST(0.025375838462365), FRAC_CONST(0.018238128257362) }, - { FRAC_CONST(0.025319765249906), FRAC_CONST(0.018315894400484) }, - { FRAC_CONST(0.025263453718173), FRAC_CONST(0.018393488147432) }, - { FRAC_CONST(0.025206904397193), FRAC_CONST(0.018470908767865) }, - { FRAC_CONST(0.025150117819228), FRAC_CONST(0.018548155533070) }, - { FRAC_CONST(0.025093094518776), FRAC_CONST(0.018625227715971) }, - { FRAC_CONST(0.025035835032562), FRAC_CONST(0.018702124591135) }, - { FRAC_CONST(0.024978339899534), FRAC_CONST(0.018778845434780) }, - { FRAC_CONST(0.024920609660858), FRAC_CONST(0.018855389524780) }, - { FRAC_CONST(0.024862644859912), FRAC_CONST(0.018931756140672) }, - { FRAC_CONST(0.024804446042284), FRAC_CONST(0.019007944563666) }, - { FRAC_CONST(0.024746013755764), FRAC_CONST(0.019083954076646) }, - { FRAC_CONST(0.024687348550337), FRAC_CONST(0.019159783964183) }, - { FRAC_CONST(0.024628450978184), FRAC_CONST(0.019235433512536) }, - { FRAC_CONST(0.024569321593670), FRAC_CONST(0.019310902009663) }, - { FRAC_CONST(0.024509960953345), FRAC_CONST(0.019386188745225) }, - { FRAC_CONST(0.024450369615932), FRAC_CONST(0.019461293010596) }, - { FRAC_CONST(0.024390548142329), FRAC_CONST(0.019536214098866) }, - { FRAC_CONST(0.024330497095598), FRAC_CONST(0.019610951304848) }, - { FRAC_CONST(0.024270217040961), FRAC_CONST(0.019685503925087) }, - { FRAC_CONST(0.024209708545799), FRAC_CONST(0.019759871257867) }, - { FRAC_CONST(0.024148972179639), FRAC_CONST(0.019834052603212) }, - { FRAC_CONST(0.024088008514157), FRAC_CONST(0.019908047262901) }, - { FRAC_CONST(0.024026818123164), FRAC_CONST(0.019981854540467) }, - { FRAC_CONST(0.023965401582609), FRAC_CONST(0.020055473741208) }, - { FRAC_CONST(0.023903759470567), FRAC_CONST(0.020128904172192) }, - { FRAC_CONST(0.023841892367236), FRAC_CONST(0.020202145142264) }, - { FRAC_CONST(0.023779800854935), FRAC_CONST(0.020275195962052) }, - { FRAC_CONST(0.023717485518092), FRAC_CONST(0.020348055943974) }, - { FRAC_CONST(0.023654946943242), FRAC_CONST(0.020420724402244) }, - { FRAC_CONST(0.023592185719023), FRAC_CONST(0.020493200652878) }, - { FRAC_CONST(0.023529202436167), FRAC_CONST(0.020565484013703) }, - { FRAC_CONST(0.023465997687496), FRAC_CONST(0.020637573804361) }, - { FRAC_CONST(0.023402572067918), FRAC_CONST(0.020709469346314) }, - { FRAC_CONST(0.023338926174419), FRAC_CONST(0.020781169962854) }, - { FRAC_CONST(0.023275060606058), FRAC_CONST(0.020852674979108) }, - { FRAC_CONST(0.023210975963963), FRAC_CONST(0.020923983722044) }, - { FRAC_CONST(0.023146672851322), FRAC_CONST(0.020995095520475) }, - { FRAC_CONST(0.023082151873380), FRAC_CONST(0.021066009705072) }, - { FRAC_CONST(0.023017413637435), FRAC_CONST(0.021136725608363) }, - { FRAC_CONST(0.022952458752826), FRAC_CONST(0.021207242564742) }, - { FRAC_CONST(0.022887287830934), FRAC_CONST(0.021277559910478) }, - { FRAC_CONST(0.022821901485173), FRAC_CONST(0.021347676983716) }, - { FRAC_CONST(0.022756300330983), FRAC_CONST(0.021417593124488) }, - { FRAC_CONST(0.022690484985827), FRAC_CONST(0.021487307674717) }, - { FRAC_CONST(0.022624456069185), FRAC_CONST(0.021556819978223) }, - { FRAC_CONST(0.022558214202547), FRAC_CONST(0.021626129380729) }, - { FRAC_CONST(0.022491760009405), FRAC_CONST(0.021695235229869) }, - { FRAC_CONST(0.022425094115252), FRAC_CONST(0.021764136875192) }, - { FRAC_CONST(0.022358217147572), FRAC_CONST(0.021832833668171) }, - { FRAC_CONST(0.022291129735838), FRAC_CONST(0.021901324962204) }, - { FRAC_CONST(0.022223832511501), FRAC_CONST(0.021969610112625) }, - { FRAC_CONST(0.022156326107988), FRAC_CONST(0.022037688476709) }, - { FRAC_CONST(0.022088611160696), FRAC_CONST(0.022105559413676) }, - { FRAC_CONST(0.022020688306983), FRAC_CONST(0.022173222284699) }, - { FRAC_CONST(0.021952558186166), FRAC_CONST(0.022240676452909) }, - { FRAC_CONST(0.021884221439510), FRAC_CONST(0.022307921283403) }, - { FRAC_CONST(0.021815678710228), FRAC_CONST(0.022374956143245) }, - { FRAC_CONST(0.021746930643469), FRAC_CONST(0.022441780401478) }, - { FRAC_CONST(0.021677977886316), FRAC_CONST(0.022508393429127) }, - { FRAC_CONST(0.021608821087780), FRAC_CONST(0.022574794599206) }, - { FRAC_CONST(0.021539460898790), FRAC_CONST(0.022640983286719) }, - { FRAC_CONST(0.021469897972190), FRAC_CONST(0.022706958868676) }, - { FRAC_CONST(0.021400132962735), FRAC_CONST(0.022772720724087) }, - { FRAC_CONST(0.021330166527077), FRAC_CONST(0.022838268233979) }, - { FRAC_CONST(0.021259999323769), FRAC_CONST(0.022903600781391) }, - { FRAC_CONST(0.021189632013250), FRAC_CONST(0.022968717751391) }, - { FRAC_CONST(0.021119065257845), FRAC_CONST(0.023033618531071) }, - { FRAC_CONST(0.021048299721754), FRAC_CONST(0.023098302509561) }, - { FRAC_CONST(0.020977336071050), FRAC_CONST(0.023162769078031) }, - { FRAC_CONST(0.020906174973670), FRAC_CONST(0.023227017629698) }, - { FRAC_CONST(0.020834817099409), FRAC_CONST(0.023291047559828) }, - { FRAC_CONST(0.020763263119915), FRAC_CONST(0.023354858265748) }, - { FRAC_CONST(0.020691513708680), FRAC_CONST(0.023418449146848) }, - { FRAC_CONST(0.020619569541038), FRAC_CONST(0.023481819604585) }, - { FRAC_CONST(0.020547431294155), FRAC_CONST(0.023544969042494) }, - { FRAC_CONST(0.020475099647023), FRAC_CONST(0.023607896866186) }, - { FRAC_CONST(0.020402575280455), FRAC_CONST(0.023670602483363) }, - { FRAC_CONST(0.020329858877078), FRAC_CONST(0.023733085303813) }, - { FRAC_CONST(0.020256951121327), FRAC_CONST(0.023795344739427) }, - { FRAC_CONST(0.020183852699437), FRAC_CONST(0.023857380204193) }, - { FRAC_CONST(0.020110564299439), FRAC_CONST(0.023919191114211) }, - { FRAC_CONST(0.020037086611150), FRAC_CONST(0.023980776887692) }, - { FRAC_CONST(0.019963420326171), FRAC_CONST(0.024042136944968) }, - { FRAC_CONST(0.019889566137877), FRAC_CONST(0.024103270708495) }, - { FRAC_CONST(0.019815524741412), FRAC_CONST(0.024164177602859) }, - { FRAC_CONST(0.019741296833681), FRAC_CONST(0.024224857054779) }, - { FRAC_CONST(0.019666883113346), FRAC_CONST(0.024285308493120) }, - { FRAC_CONST(0.019592284280817), FRAC_CONST(0.024345531348888) }, - { FRAC_CONST(0.019517501038246), FRAC_CONST(0.024405525055242) }, - { FRAC_CONST(0.019442534089523), FRAC_CONST(0.024465289047500) }, - { FRAC_CONST(0.019367384140264), FRAC_CONST(0.024524822763141) }, - { FRAC_CONST(0.019292051897809), FRAC_CONST(0.024584125641809) }, - { FRAC_CONST(0.019216538071215), FRAC_CONST(0.024643197125323) }, - { FRAC_CONST(0.019140843371246), FRAC_CONST(0.024702036657681) }, - { FRAC_CONST(0.019064968510369), FRAC_CONST(0.024760643685063) }, - { FRAC_CONST(0.018988914202748), FRAC_CONST(0.024819017655836) }, - { FRAC_CONST(0.018912681164234), FRAC_CONST(0.024877158020562) }, - { FRAC_CONST(0.018836270112363), FRAC_CONST(0.024935064232003) }, - { FRAC_CONST(0.018759681766343), FRAC_CONST(0.024992735745123) }, - { FRAC_CONST(0.018682916847054), FRAC_CONST(0.025050172017095) }, - { FRAC_CONST(0.018605976077037), FRAC_CONST(0.025107372507308) }, - { FRAC_CONST(0.018528860180486), FRAC_CONST(0.025164336677369) }, - { FRAC_CONST(0.018451569883247), FRAC_CONST(0.025221063991110) }, - { FRAC_CONST(0.018374105912805), FRAC_CONST(0.025277553914591) }, - { FRAC_CONST(0.018296468998280), FRAC_CONST(0.025333805916107) }, - { FRAC_CONST(0.018218659870421), FRAC_CONST(0.025389819466194) }, - { FRAC_CONST(0.018140679261596), FRAC_CONST(0.025445594037630) }, - { FRAC_CONST(0.018062527905790), FRAC_CONST(0.025501129105445) }, - { FRAC_CONST(0.017984206538592), FRAC_CONST(0.025556424146920) }, - { FRAC_CONST(0.017905715897192), FRAC_CONST(0.025611478641598) }, - { FRAC_CONST(0.017827056720375), FRAC_CONST(0.025666292071285) }, - { FRAC_CONST(0.017748229748511), FRAC_CONST(0.025720863920056) }, - { FRAC_CONST(0.017669235723550), FRAC_CONST(0.025775193674260) }, - { FRAC_CONST(0.017590075389012), FRAC_CONST(0.025829280822525) }, - { FRAC_CONST(0.017510749489986), FRAC_CONST(0.025883124855762) }, - { FRAC_CONST(0.017431258773116), FRAC_CONST(0.025936725267170) }, - { FRAC_CONST(0.017351603986600), FRAC_CONST(0.025990081552242) }, - { FRAC_CONST(0.017271785880180), FRAC_CONST(0.026043193208768) }, - { FRAC_CONST(0.017191805205132), FRAC_CONST(0.026096059736841) }, - { FRAC_CONST(0.017111662714267), FRAC_CONST(0.026148680638861) }, - { FRAC_CONST(0.017031359161915), FRAC_CONST(0.026201055419541) }, - { FRAC_CONST(0.016950895303924), FRAC_CONST(0.026253183585908) }, - { FRAC_CONST(0.016870271897651), FRAC_CONST(0.026305064647313) }, - { FRAC_CONST(0.016789489701954), FRAC_CONST(0.026356698115431) }, - { FRAC_CONST(0.016708549477186), FRAC_CONST(0.026408083504269) }, - { FRAC_CONST(0.016627451985187), FRAC_CONST(0.026459220330167) }, - { FRAC_CONST(0.016546197989277), FRAC_CONST(0.026510108111806) }, - { FRAC_CONST(0.016464788254250), FRAC_CONST(0.026560746370212) }, - { FRAC_CONST(0.016383223546365), FRAC_CONST(0.026611134628757) }, - { FRAC_CONST(0.016301504633341), FRAC_CONST(0.026661272413168) }, - { FRAC_CONST(0.016219632284346), FRAC_CONST(0.026711159251530) }, - { FRAC_CONST(0.016137607269996), FRAC_CONST(0.026760794674288) }, - { FRAC_CONST(0.016055430362340), FRAC_CONST(0.026810178214254) }, - { FRAC_CONST(0.015973102334858), FRAC_CONST(0.026859309406613) }, - { FRAC_CONST(0.015890623962454), FRAC_CONST(0.026908187788922) }, - { FRAC_CONST(0.015807996021446), FRAC_CONST(0.026956812901119) }, - { FRAC_CONST(0.015725219289558), FRAC_CONST(0.027005184285527) }, - { FRAC_CONST(0.015642294545918), FRAC_CONST(0.027053301486856) }, - { FRAC_CONST(0.015559222571044), FRAC_CONST(0.027101164052208) }, - { FRAC_CONST(0.015476004146842), FRAC_CONST(0.027148771531083) }, - { FRAC_CONST(0.015392640056594), FRAC_CONST(0.027196123475380) }, - { FRAC_CONST(0.015309131084956), FRAC_CONST(0.027243219439406) }, - { FRAC_CONST(0.015225478017946), FRAC_CONST(0.027290058979875) }, - { FRAC_CONST(0.015141681642938), FRAC_CONST(0.027336641655915) }, - { FRAC_CONST(0.015057742748656), FRAC_CONST(0.027382967029073) }, - { FRAC_CONST(0.014973662125164), FRAC_CONST(0.027429034663317) }, - { FRAC_CONST(0.014889440563862), FRAC_CONST(0.027474844125040) }, - { FRAC_CONST(0.014805078857474), FRAC_CONST(0.027520394983066) }, - { FRAC_CONST(0.014720577800046), FRAC_CONST(0.027565686808654) }, - { FRAC_CONST(0.014635938186934), FRAC_CONST(0.027610719175499) }, - { FRAC_CONST(0.014551160814797), FRAC_CONST(0.027655491659740) }, - { FRAC_CONST(0.014466246481592), FRAC_CONST(0.027700003839960) }, - { FRAC_CONST(0.014381195986567), FRAC_CONST(0.027744255297195) }, - { FRAC_CONST(0.014296010130247), FRAC_CONST(0.027788245614933) }, - { FRAC_CONST(0.014210689714436), FRAC_CONST(0.027831974379120) }, - { FRAC_CONST(0.014125235542201), FRAC_CONST(0.027875441178165) }, - { FRAC_CONST(0.014039648417870), FRAC_CONST(0.027918645602941) }, - { FRAC_CONST(0.013953929147020), FRAC_CONST(0.027961587246792) }, - { FRAC_CONST(0.013868078536476), FRAC_CONST(0.028004265705534) }, - { FRAC_CONST(0.013782097394294), FRAC_CONST(0.028046680577462) }, - { FRAC_CONST(0.013695986529763), FRAC_CONST(0.028088831463351) }, - { FRAC_CONST(0.013609746753390), FRAC_CONST(0.028130717966461) }, - { FRAC_CONST(0.013523378876898), FRAC_CONST(0.028172339692540) }, - { FRAC_CONST(0.013436883713214), FRAC_CONST(0.028213696249828) }, - { FRAC_CONST(0.013350262076462), FRAC_CONST(0.028254787249062) }, - { FRAC_CONST(0.013263514781960), FRAC_CONST(0.028295612303478) }, - { FRAC_CONST(0.013176642646205), FRAC_CONST(0.028336171028814) }, - { FRAC_CONST(0.013089646486871), FRAC_CONST(0.028376463043317) }, - { FRAC_CONST(0.013002527122799), FRAC_CONST(0.028416487967743) }, - { FRAC_CONST(0.012915285373990), FRAC_CONST(0.028456245425361) }, - { FRAC_CONST(0.012827922061597), FRAC_CONST(0.028495735041960) }, - { FRAC_CONST(0.012740438007915), FRAC_CONST(0.028534956445849) }, - { FRAC_CONST(0.012652834036379), FRAC_CONST(0.028573909267859) }, - { FRAC_CONST(0.012565110971550), FRAC_CONST(0.028612593141354) }, - { FRAC_CONST(0.012477269639111), FRAC_CONST(0.028651007702224) }, - { FRAC_CONST(0.012389310865858), FRAC_CONST(0.028689152588899) }, - { FRAC_CONST(0.012301235479693), FRAC_CONST(0.028727027442343) }, - { FRAC_CONST(0.012213044309615), FRAC_CONST(0.028764631906065) }, - { FRAC_CONST(0.012124738185712), FRAC_CONST(0.028801965626115) }, - { FRAC_CONST(0.012036317939156), FRAC_CONST(0.028839028251097) }, - { FRAC_CONST(0.011947784402191), FRAC_CONST(0.028875819432161) }, - { FRAC_CONST(0.011859138408130), FRAC_CONST(0.028912338823015) }, - { FRAC_CONST(0.011770380791341), FRAC_CONST(0.028948586079925) }, - { FRAC_CONST(0.011681512387245), FRAC_CONST(0.028984560861718) }, - { FRAC_CONST(0.011592534032306), FRAC_CONST(0.029020262829785) }, - { FRAC_CONST(0.011503446564022), FRAC_CONST(0.029055691648087) }, - { FRAC_CONST(0.011414250820918), FRAC_CONST(0.029090846983152) }, - { FRAC_CONST(0.011324947642537), FRAC_CONST(0.029125728504087) }, - { FRAC_CONST(0.011235537869437), FRAC_CONST(0.029160335882573) }, - { FRAC_CONST(0.011146022343175), FRAC_CONST(0.029194668792871) }, - { FRAC_CONST(0.011056401906305), FRAC_CONST(0.029228726911828) }, - { FRAC_CONST(0.010966677402371), FRAC_CONST(0.029262509918876) }, - { FRAC_CONST(0.010876849675891), FRAC_CONST(0.029296017496036) }, - { FRAC_CONST(0.010786919572361), FRAC_CONST(0.029329249327922) }, - { FRAC_CONST(0.010696887938235), FRAC_CONST(0.029362205101743) }, - { FRAC_CONST(0.010606755620926), FRAC_CONST(0.029394884507308) }, - { FRAC_CONST(0.010516523468793), FRAC_CONST(0.029427287237024) }, - { FRAC_CONST(0.010426192331137), FRAC_CONST(0.029459412985906) }, - { FRAC_CONST(0.010335763058187), FRAC_CONST(0.029491261451573) }, - { FRAC_CONST(0.010245236501099), FRAC_CONST(0.029522832334255) }, - { FRAC_CONST(0.010154613511943), FRAC_CONST(0.029554125336796) }, - { FRAC_CONST(0.010063894943698), FRAC_CONST(0.029585140164654) }, - { FRAC_CONST(0.009973081650240), FRAC_CONST(0.029615876525905) }, - { FRAC_CONST(0.009882174486340), FRAC_CONST(0.029646334131247) }, - { FRAC_CONST(0.009791174307650), FRAC_CONST(0.029676512694001) }, - { FRAC_CONST(0.009700081970699), FRAC_CONST(0.029706411930116) }, - { FRAC_CONST(0.009608898332881), FRAC_CONST(0.029736031558168) }, - { FRAC_CONST(0.009517624252453), FRAC_CONST(0.029765371299366) }, - { FRAC_CONST(0.009426260588521), FRAC_CONST(0.029794430877553) }, - { FRAC_CONST(0.009334808201034), FRAC_CONST(0.029823210019210) }, - { FRAC_CONST(0.009243267950778), FRAC_CONST(0.029851708453456) }, - { FRAC_CONST(0.009151640699363), FRAC_CONST(0.029879925912053) }, - { FRAC_CONST(0.009059927309220), FRAC_CONST(0.029907862129408) }, - { FRAC_CONST(0.008968128643591), FRAC_CONST(0.029935516842573) }, - { FRAC_CONST(0.008876245566520), FRAC_CONST(0.029962889791254) }, - { FRAC_CONST(0.008784278942845), FRAC_CONST(0.029989980717805) }, - { FRAC_CONST(0.008692229638191), FRAC_CONST(0.030016789367235) }, - { FRAC_CONST(0.008600098518961), FRAC_CONST(0.030043315487212) }, - { FRAC_CONST(0.008507886452329), FRAC_CONST(0.030069558828062) }, - { FRAC_CONST(0.008415594306230), FRAC_CONST(0.030095519142772) }, - { FRAC_CONST(0.008323222949351), FRAC_CONST(0.030121196186994) }, - { FRAC_CONST(0.008230773251129), FRAC_CONST(0.030146589719046) }, - { FRAC_CONST(0.008138246081733), FRAC_CONST(0.030171699499915) }, - { FRAC_CONST(0.008045642312067), FRAC_CONST(0.030196525293257) }, - { FRAC_CONST(0.007952962813750), FRAC_CONST(0.030221066865402) }, - { FRAC_CONST(0.007860208459119), FRAC_CONST(0.030245323985357) }, - { FRAC_CONST(0.007767380121212), FRAC_CONST(0.030269296424803) }, - { FRAC_CONST(0.007674478673766), FRAC_CONST(0.030292983958103) }, - { FRAC_CONST(0.007581504991203), FRAC_CONST(0.030316386362302) }, - { FRAC_CONST(0.007488459948628), FRAC_CONST(0.030339503417126) }, - { FRAC_CONST(0.007395344421816), FRAC_CONST(0.030362334904989) }, - { FRAC_CONST(0.007302159287206), FRAC_CONST(0.030384880610993) }, - { FRAC_CONST(0.007208905421891), FRAC_CONST(0.030407140322928) }, - { FRAC_CONST(0.007115583703613), FRAC_CONST(0.030429113831278) }, - { FRAC_CONST(0.007022195010752), FRAC_CONST(0.030450800929220) }, - { FRAC_CONST(0.006928740222316), FRAC_CONST(0.030472201412626) }, - { FRAC_CONST(0.006835220217939), FRAC_CONST(0.030493315080068) }, - { FRAC_CONST(0.006741635877866), FRAC_CONST(0.030514141732814) }, - { FRAC_CONST(0.006647988082948), FRAC_CONST(0.030534681174838) }, - { FRAC_CONST(0.006554277714635), FRAC_CONST(0.030554933212813) }, - { FRAC_CONST(0.006460505654964), FRAC_CONST(0.030574897656119) }, - { FRAC_CONST(0.006366672786553), FRAC_CONST(0.030594574316845) }, - { FRAC_CONST(0.006272779992593), FRAC_CONST(0.030613963009786) }, - { FRAC_CONST(0.006178828156839), FRAC_CONST(0.030633063552447) }, - { FRAC_CONST(0.006084818163601), FRAC_CONST(0.030651875765048) }, - { FRAC_CONST(0.005990750897737), FRAC_CONST(0.030670399470520) }, - { FRAC_CONST(0.005896627244644), FRAC_CONST(0.030688634494512) }, - { FRAC_CONST(0.005802448090250), FRAC_CONST(0.030706580665388) }, - { FRAC_CONST(0.005708214321004), FRAC_CONST(0.030724237814232) }, - { FRAC_CONST(0.005613926823871), FRAC_CONST(0.030741605774849) }, - { FRAC_CONST(0.005519586486321), FRAC_CONST(0.030758684383764) }, - { FRAC_CONST(0.005425194196321), FRAC_CONST(0.030775473480228) }, - { FRAC_CONST(0.005330750842327), FRAC_CONST(0.030791972906214) }, - { FRAC_CONST(0.005236257313276), FRAC_CONST(0.030808182506425) }, - { FRAC_CONST(0.005141714498576), FRAC_CONST(0.030824102128288) }, - { FRAC_CONST(0.005047123288102), FRAC_CONST(0.030839731621963) }, - { FRAC_CONST(0.004952484572181), FRAC_CONST(0.030855070840339) }, - { FRAC_CONST(0.004857799241589), FRAC_CONST(0.030870119639036) }, - { FRAC_CONST(0.004763068187541), FRAC_CONST(0.030884877876411) }, - { FRAC_CONST(0.004668292301681), FRAC_CONST(0.030899345413553) }, - { FRAC_CONST(0.004573472476075), FRAC_CONST(0.030913522114288) }, - { FRAC_CONST(0.004478609603205), FRAC_CONST(0.030927407845180) }, - { FRAC_CONST(0.004383704575956), FRAC_CONST(0.030941002475530) }, - { FRAC_CONST(0.004288758287610), FRAC_CONST(0.030954305877381) }, - { FRAC_CONST(0.004193771631837), FRAC_CONST(0.030967317925516) }, - { FRAC_CONST(0.004098745502689), FRAC_CONST(0.030980038497461) }, - { FRAC_CONST(0.004003680794587), FRAC_CONST(0.030992467473486) }, - { FRAC_CONST(0.003908578402316), FRAC_CONST(0.031004604736602) }, - { FRAC_CONST(0.003813439221017), FRAC_CONST(0.031016450172571) }, - { FRAC_CONST(0.003718264146176), FRAC_CONST(0.031028003669899) }, - { FRAC_CONST(0.003623054073616), FRAC_CONST(0.031039265119839) }, - { FRAC_CONST(0.003527809899492), FRAC_CONST(0.031050234416394) }, - { FRAC_CONST(0.003432532520278), FRAC_CONST(0.031060911456318) }, - { FRAC_CONST(0.003337222832760), FRAC_CONST(0.031071296139114) }, - { FRAC_CONST(0.003241881734029), FRAC_CONST(0.031081388367037) }, - { FRAC_CONST(0.003146510121474), FRAC_CONST(0.031091188045095) }, - { FRAC_CONST(0.003051108892766), FRAC_CONST(0.031100695081051) }, - { FRAC_CONST(0.002955678945860), FRAC_CONST(0.031109909385419) }, - { FRAC_CONST(0.002860221178978), FRAC_CONST(0.031118830871473) }, - { FRAC_CONST(0.002764736490604), FRAC_CONST(0.031127459455239) }, - { FRAC_CONST(0.002669225779478), FRAC_CONST(0.031135795055501) }, - { FRAC_CONST(0.002573689944583), FRAC_CONST(0.031143837593803) }, - { FRAC_CONST(0.002478129885137), FRAC_CONST(0.031151586994444) }, - { FRAC_CONST(0.002382546500589), FRAC_CONST(0.031159043184484) }, - { FRAC_CONST(0.002286940690606), FRAC_CONST(0.031166206093743) }, - { FRAC_CONST(0.002191313355067), FRAC_CONST(0.031173075654800) }, - { FRAC_CONST(0.002095665394051), FRAC_CONST(0.031179651802998) }, - { FRAC_CONST(0.001999997707835), FRAC_CONST(0.031185934476438) }, - { FRAC_CONST(0.001904311196878), FRAC_CONST(0.031191923615985) }, - { FRAC_CONST(0.001808606761820), FRAC_CONST(0.031197619165268) }, - { FRAC_CONST(0.001712885303465), FRAC_CONST(0.031203021070678) }, - { FRAC_CONST(0.001617147722782), FRAC_CONST(0.031208129281370) }, - { FRAC_CONST(0.001521394920889), FRAC_CONST(0.031212943749264) }, - { FRAC_CONST(0.001425627799047), FRAC_CONST(0.031217464429043) }, - { FRAC_CONST(0.001329847258653), FRAC_CONST(0.031221691278159) }, - { FRAC_CONST(0.001234054201231), FRAC_CONST(0.031225624256825) }, - { FRAC_CONST(0.001138249528420), FRAC_CONST(0.031229263328024) }, - { FRAC_CONST(0.001042434141971), FRAC_CONST(0.031232608457502) }, - { FRAC_CONST(0.000946608943736), FRAC_CONST(0.031235659613775) }, - { FRAC_CONST(0.000850774835656), FRAC_CONST(0.031238416768124) }, - { FRAC_CONST(0.000754932719759), FRAC_CONST(0.031240879894597) }, - { FRAC_CONST(0.000659083498149), FRAC_CONST(0.031243048970010) }, - { FRAC_CONST(0.000563228072993), FRAC_CONST(0.031244923973948) }, - { FRAC_CONST(0.000467367346520), FRAC_CONST(0.031246504888762) }, - { FRAC_CONST(0.000371502221008), FRAC_CONST(0.031247791699571) }, - { FRAC_CONST(0.000275633598775), FRAC_CONST(0.031248784394264) }, - { FRAC_CONST(0.000179762382174), FRAC_CONST(0.031249482963498) }, - { FRAC_CONST(0.000083889473581), FRAC_CONST(0.031249887400697) } -}; - -/* 64 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_256[] = -{ - { FRAC_CONST(0.088387931675923), FRAC_CONST(0.000271171628935) }, - { FRAC_CONST(0.088354655998507), FRAC_CONST(0.002440238387037) }, - { FRAC_CONST(0.088268158780110), FRAC_CONST(0.004607835236780) }, - { FRAC_CONST(0.088128492123423), FRAC_CONST(0.006772656498875) }, - { FRAC_CONST(0.087935740158418), FRAC_CONST(0.008933398165942) }, - { FRAC_CONST(0.087690018991670), FRAC_CONST(0.011088758687994) }, - { FRAC_CONST(0.087391476636423), FRAC_CONST(0.013237439756448) }, - { FRAC_CONST(0.087040292923427), FRAC_CONST(0.015378147086172) }, - { FRAC_CONST(0.086636679392621), FRAC_CONST(0.017509591195118) }, - { FRAC_CONST(0.086180879165703), FRAC_CONST(0.019630488181053) }, - { FRAC_CONST(0.085673166799686), FRAC_CONST(0.021739560494940) }, - { FRAC_CONST(0.085113848121515), FRAC_CONST(0.023835537710479) }, - { FRAC_CONST(0.084503260043847), FRAC_CONST(0.025917157289369) }, - { FRAC_CONST(0.083841770362110), FRAC_CONST(0.027983165341813) }, - { FRAC_CONST(0.083129777532952), FRAC_CONST(0.030032317381813) }, - { FRAC_CONST(0.082367710434230), FRAC_CONST(0.032063379076803) }, - { FRAC_CONST(0.081556028106671), FRAC_CONST(0.034075126991164) }, - { FRAC_CONST(0.080695219477356), FRAC_CONST(0.036066349323177) }, - { FRAC_CONST(0.079785803065216), FRAC_CONST(0.038035846634965) }, - { FRAC_CONST(0.078828326668693), FRAC_CONST(0.039982432574992) }, - { FRAC_CONST(0.077823367035766), FRAC_CONST(0.041904934592675) }, - { FRAC_CONST(0.076771529516540), FRAC_CONST(0.043802194644686) }, - { FRAC_CONST(0.075673447698606), FRAC_CONST(0.045673069892513) }, - { FRAC_CONST(0.074529783025390), FRAC_CONST(0.047516433390863) }, - { FRAC_CONST(0.073341224397728), FRAC_CONST(0.049331174766491) }, - { FRAC_CONST(0.072108487758894), FRAC_CONST(0.051116200887052) }, - { FRAC_CONST(0.070832315663343), FRAC_CONST(0.052870436519557) }, - { FRAC_CONST(0.069513476829429), FRAC_CONST(0.054592824978055) }, - { FRAC_CONST(0.068152765676348), FRAC_CONST(0.056282328760143) }, - { FRAC_CONST(0.066751001845620), FRAC_CONST(0.057937930171918) }, - { FRAC_CONST(0.065309029707361), FRAC_CONST(0.059558631940996) }, - { FRAC_CONST(0.063827717851668), FRAC_CONST(0.061143457817234) }, - { FRAC_CONST(0.062307958565413), FRAC_CONST(0.062691453160784) }, - { FRAC_CONST(0.060750667294763), FRAC_CONST(0.064201685517134) }, - { FRAC_CONST(0.059156782093749), FRAC_CONST(0.065673245178784) }, - { FRAC_CONST(0.057527263059216), FRAC_CONST(0.067105245733220) }, - { FRAC_CONST(0.055863091752499), FRAC_CONST(0.068496824596852) }, - { FRAC_CONST(0.054165270608165), FRAC_CONST(0.069847143534609) }, - { FRAC_CONST(0.052434822330188), FRAC_CONST(0.071155389164853) }, - { FRAC_CONST(0.050672789275903), FRAC_CONST(0.072420773449336) }, - { FRAC_CONST(0.048880232828135), FRAC_CONST(0.073642534167879) }, - { FRAC_CONST(0.047058232755862), FRAC_CONST(0.074819935377512) }, - { FRAC_CONST(0.045207886563797), FRAC_CONST(0.075952267855771) }, - { FRAC_CONST(0.043330308831298), FRAC_CONST(0.077038849527912) }, - { FRAC_CONST(0.041426630540984), FRAC_CONST(0.078079025877766) }, - { FRAC_CONST(0.039497998397473), FRAC_CONST(0.079072170341994) }, - { FRAC_CONST(0.037545574136653), FRAC_CONST(0.080017684687506) }, - { FRAC_CONST(0.035570533825892), FRAC_CONST(0.080914999371817) }, - { FRAC_CONST(0.033574067155622), FRAC_CONST(0.081763573886112) }, - { FRAC_CONST(0.031557376722714), FRAC_CONST(0.082562897080836) }, - { FRAC_CONST(0.029521677306074), FRAC_CONST(0.083312487473584) }, - { FRAC_CONST(0.027468195134911), FRAC_CONST(0.084011893539132) }, - { FRAC_CONST(0.025398167150101), FRAC_CONST(0.084660693981419) }, - { FRAC_CONST(0.023312840259098), FRAC_CONST(0.085258497987320) }, - { FRAC_CONST(0.021213470584847), FRAC_CONST(0.085804945462053) }, - { FRAC_CONST(0.019101322709138), FRAC_CONST(0.086299707246093) }, - { FRAC_CONST(0.016977668910873), FRAC_CONST(0.086742485313442) }, - { FRAC_CONST(0.014843788399692), FRAC_CONST(0.087133012951149) }, - { FRAC_CONST(0.012700966545425), FRAC_CONST(0.087471054919968) }, - { FRAC_CONST(0.010550494103830), FRAC_CONST(0.087756407596056) }, - { FRAC_CONST(0.008393666439096), FRAC_CONST(0.087988899093631) }, - { FRAC_CONST(0.006231782743558), FRAC_CONST(0.088168389368510) }, - { FRAC_CONST(0.004066145255116), FRAC_CONST(0.088294770302461) }, - { FRAC_CONST(0.001898058472816), FRAC_CONST(0.088367965768336) } -}; - -#ifdef LD_DEC -/* 128 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_1024[] = -{ - { FRAC_CONST(0.044194160825012), FRAC_CONST(0.000033896503468) }, - { FRAC_CONST(0.044193120897389), FRAC_CONST(0.000305066138364) }, - { FRAC_CONST(0.044190417123742), FRAC_CONST(0.000576224287693) }, - { FRAC_CONST(0.044186049605866), FRAC_CONST(0.000847360742503) }, - { FRAC_CONST(0.044180018508197), FRAC_CONST(0.001118465294660) }, - { FRAC_CONST(0.044172324057802), FRAC_CONST(0.001389527737231) }, - { FRAC_CONST(0.044162966544372), FRAC_CONST(0.001660537864867) }, - { FRAC_CONST(0.044151946320213), FRAC_CONST(0.001931485474192) }, - { FRAC_CONST(0.044139263800230), FRAC_CONST(0.002202360364180) }, - { FRAC_CONST(0.044124919461912), FRAC_CONST(0.002473152336546) }, - { FRAC_CONST(0.044108913845316), FRAC_CONST(0.002743851196123) }, - { FRAC_CONST(0.044091247553044), FRAC_CONST(0.003014446751254) }, - { FRAC_CONST(0.044071921250223), FRAC_CONST(0.003284928814169) }, - { FRAC_CONST(0.044050935664476), FRAC_CONST(0.003555287201370) }, - { FRAC_CONST(0.044028291585898), FRAC_CONST(0.003825511734018) }, - { FRAC_CONST(0.044003989867028), FRAC_CONST(0.004095592238311) }, - { FRAC_CONST(0.043978031422810), FRAC_CONST(0.004365518545871) }, - { FRAC_CONST(0.043950417230565), FRAC_CONST(0.004635280494126) }, - { FRAC_CONST(0.043921148329953), FRAC_CONST(0.004904867926689) }, - { FRAC_CONST(0.043890225822930), FRAC_CONST(0.005174270693748) }, - { FRAC_CONST(0.043857650873712), FRAC_CONST(0.005443478652439) }, - { FRAC_CONST(0.043823424708727), FRAC_CONST(0.005712481667236) }, - { FRAC_CONST(0.043787548616571), FRAC_CONST(0.005981269610326) }, - { FRAC_CONST(0.043750023947958), FRAC_CONST(0.006249832361997) }, - { FRAC_CONST(0.043710852115672), FRAC_CONST(0.006518159811011) }, - { FRAC_CONST(0.043670034594508), FRAC_CONST(0.006786241854993) }, - { FRAC_CONST(0.043627572921225), FRAC_CONST(0.007054068400804) }, - { FRAC_CONST(0.043583468694479), FRAC_CONST(0.007321629364927) }, - { FRAC_CONST(0.043537723574771), FRAC_CONST(0.007588914673843) }, - { FRAC_CONST(0.043490339284377), FRAC_CONST(0.007855914264410) }, - { FRAC_CONST(0.043441317607290), FRAC_CONST(0.008122618084246) }, - { FRAC_CONST(0.043390660389149), FRAC_CONST(0.008389016092101) }, - { FRAC_CONST(0.043338369537168), FRAC_CONST(0.008655098258243) }, - { FRAC_CONST(0.043284447020070), FRAC_CONST(0.008920854564826) }, - { FRAC_CONST(0.043228894868005), FRAC_CONST(0.009186275006278) }, - { FRAC_CONST(0.043171715172482), FRAC_CONST(0.009451349589667) }, - { FRAC_CONST(0.043112910086283), FRAC_CONST(0.009716068335087) }, - { FRAC_CONST(0.043052481823387), FRAC_CONST(0.009980421276025) }, - { FRAC_CONST(0.042990432658884), FRAC_CONST(0.010244398459743) }, - { FRAC_CONST(0.042926764928889), FRAC_CONST(0.010507989947649) }, - { FRAC_CONST(0.042861481030457), FRAC_CONST(0.010771185815673) }, - { FRAC_CONST(0.042794583421490), FRAC_CONST(0.011033976154639) }, - { FRAC_CONST(0.042726074620644), FRAC_CONST(0.011296351070639) }, - { FRAC_CONST(0.042655957207238), FRAC_CONST(0.011558300685406) }, - { FRAC_CONST(0.042584233821153), FRAC_CONST(0.011819815136685) }, - { FRAC_CONST(0.042510907162732), FRAC_CONST(0.012080884578604) }, - { FRAC_CONST(0.042435979992684), FRAC_CONST(0.012341499182048) }, - { FRAC_CONST(0.042359455131975), FRAC_CONST(0.012601649135022) }, - { FRAC_CONST(0.042281335461721), FRAC_CONST(0.012861324643029) }, - { FRAC_CONST(0.042201623923085), FRAC_CONST(0.013120515929433) }, - { FRAC_CONST(0.042120323517160), FRAC_CONST(0.013379213235827) }, - { FRAC_CONST(0.042037437304862), FRAC_CONST(0.013637406822406) }, - { FRAC_CONST(0.041952968406809), FRAC_CONST(0.013895086968325) }, - { FRAC_CONST(0.041866920003207), FRAC_CONST(0.014152243972073) }, - { FRAC_CONST(0.041779295333730), FRAC_CONST(0.014408868151835) }, - { FRAC_CONST(0.041690097697398), FRAC_CONST(0.014664949845855) }, - { FRAC_CONST(0.041599330452450), FRAC_CONST(0.014920479412801) }, - { FRAC_CONST(0.041506997016224), FRAC_CONST(0.015175447232131) }, - { FRAC_CONST(0.041413100865019), FRAC_CONST(0.015429843704450) }, - { FRAC_CONST(0.041317645533974), FRAC_CONST(0.015683659251874) }, - { FRAC_CONST(0.041220634616927), FRAC_CONST(0.015936884318392) }, - { FRAC_CONST(0.041122071766285), FRAC_CONST(0.016189509370223) }, - { FRAC_CONST(0.041021960692883), FRAC_CONST(0.016441524896177) }, - { FRAC_CONST(0.040920305165846), FRAC_CONST(0.016692921408010) }, - { FRAC_CONST(0.040817109012449), FRAC_CONST(0.016943689440788) }, - { FRAC_CONST(0.040712376117967), FRAC_CONST(0.017193819553235) }, - { FRAC_CONST(0.040606110425535), FRAC_CONST(0.017443302328094) }, - { FRAC_CONST(0.040498315935996), FRAC_CONST(0.017692128372479) }, - { FRAC_CONST(0.040388996707752), FRAC_CONST(0.017940288318230) }, - { FRAC_CONST(0.040278156856609), FRAC_CONST(0.018187772822267) }, - { FRAC_CONST(0.040165800555627), FRAC_CONST(0.018434572566936) }, - { FRAC_CONST(0.040051932034955), FRAC_CONST(0.018680678260367) }, - { FRAC_CONST(0.039936555581679), FRAC_CONST(0.018926080636820) }, - { FRAC_CONST(0.039819675539659), FRAC_CONST(0.019170770457035) }, - { FRAC_CONST(0.039701296309360), FRAC_CONST(0.019414738508577) }, - { FRAC_CONST(0.039581422347694), FRAC_CONST(0.019657975606187) }, - { FRAC_CONST(0.039460058167849), FRAC_CONST(0.019900472592126) }, - { FRAC_CONST(0.039337208339116), FRAC_CONST(0.020142220336521) }, - { FRAC_CONST(0.039212877486723), FRAC_CONST(0.020383209737704) }, - { FRAC_CONST(0.039087070291656), FRAC_CONST(0.020623431722561) }, - { FRAC_CONST(0.038959791490485), FRAC_CONST(0.020862877246870) }, - { FRAC_CONST(0.038831045875184), FRAC_CONST(0.021101537295642) }, - { FRAC_CONST(0.038700838292953), FRAC_CONST(0.021339402883462) }, - { FRAC_CONST(0.038569173646034), FRAC_CONST(0.021576465054824) }, - { FRAC_CONST(0.038436056891527), FRAC_CONST(0.021812714884472) }, - { FRAC_CONST(0.038301493041202), FRAC_CONST(0.022048143477734) }, - { FRAC_CONST(0.038165487161312), FRAC_CONST(0.022282741970855) }, - { FRAC_CONST(0.038028044372402), FRAC_CONST(0.022516501531335) }, - { FRAC_CONST(0.037889169849115), FRAC_CONST(0.022749413358259) }, - { FRAC_CONST(0.037748868819998), FRAC_CONST(0.022981468682628) }, - { FRAC_CONST(0.037607146567305), FRAC_CONST(0.023212658767690) }, - { FRAC_CONST(0.037464008426800), FRAC_CONST(0.023442974909269) }, - { FRAC_CONST(0.037319459787553), FRAC_CONST(0.023672408436094) }, - { FRAC_CONST(0.037173506091737), FRAC_CONST(0.023900950710120) }, - { FRAC_CONST(0.037026152834428), FRAC_CONST(0.024128593126861) }, - { FRAC_CONST(0.036877405563392), FRAC_CONST(0.024355327115708) }, - { FRAC_CONST(0.036727269878879), FRAC_CONST(0.024581144140255) }, - { FRAC_CONST(0.036575751433414), FRAC_CONST(0.024806035698618) }, - { FRAC_CONST(0.036422855931580), FRAC_CONST(0.025029993323758) }, - { FRAC_CONST(0.036268589129807), FRAC_CONST(0.025253008583796) }, - { FRAC_CONST(0.036112956836151), FRAC_CONST(0.025475073082334) }, - { FRAC_CONST(0.035955964910083), FRAC_CONST(0.025696178458769) }, - { FRAC_CONST(0.035797619262257), FRAC_CONST(0.025916316388609) }, - { FRAC_CONST(0.035637925854300), FRAC_CONST(0.026135478583784) }, - { FRAC_CONST(0.035476890698576), FRAC_CONST(0.026353656792963) }, - { FRAC_CONST(0.035314519857970), FRAC_CONST(0.026570842801858) }, - { FRAC_CONST(0.035150819445650), FRAC_CONST(0.026787028433540) }, - { FRAC_CONST(0.034985795624846), FRAC_CONST(0.027002205548742) }, - { FRAC_CONST(0.034819454608610), FRAC_CONST(0.027216366046166) }, - { FRAC_CONST(0.034651802659589), FRAC_CONST(0.027429501862792) }, - { FRAC_CONST(0.034482846089783), FRAC_CONST(0.027641604974175) }, - { FRAC_CONST(0.034312591260311), FRAC_CONST(0.027852667394755) }, - { FRAC_CONST(0.034141044581172), FRAC_CONST(0.028062681178149) }, - { FRAC_CONST(0.033968212511001), FRAC_CONST(0.028271638417458) }, - { FRAC_CONST(0.033794101556828), FRAC_CONST(0.028479531245560) }, - { FRAC_CONST(0.033618718273831), FRAC_CONST(0.028686351835407) }, - { FRAC_CONST(0.033442069265093), FRAC_CONST(0.028892092400321) }, - { FRAC_CONST(0.033264161181349), FRAC_CONST(0.029096745194286) }, - { FRAC_CONST(0.033085000720737), FRAC_CONST(0.029300302512241) }, - { FRAC_CONST(0.032904594628548), FRAC_CONST(0.029502756690366) }, - { FRAC_CONST(0.032722949696969), FRAC_CONST(0.029704100106376) }, - { FRAC_CONST(0.032540072764829), FRAC_CONST(0.029904325179807) }, - { FRAC_CONST(0.032355970717341), FRAC_CONST(0.030103424372297) }, - { FRAC_CONST(0.032170650485843), FRAC_CONST(0.030301390187873) }, - { FRAC_CONST(0.031984119047537), FRAC_CONST(0.030498215173235) }, - { FRAC_CONST(0.031796383425227), FRAC_CONST(0.030693891918034) }, - { FRAC_CONST(0.031607450687052), FRAC_CONST(0.030888413055150) }, - { FRAC_CONST(0.031417327946223), FRAC_CONST(0.031081771260973) }, - { FRAC_CONST(0.031226022360754), FRAC_CONST(0.031273959255676) }, - { FRAC_CONST(0.031033541133193), FRAC_CONST(0.031464969803488) }, - { FRAC_CONST(0.030839891510348), FRAC_CONST(0.031654795712972) }, - { FRAC_CONST(0.030645080783018), FRAC_CONST(0.031843429837288) }, - { FRAC_CONST(0.030449116285718), FRAC_CONST(0.032030865074469) }, - { FRAC_CONST(0.030252005396399), FRAC_CONST(0.032217094367684) }, - { FRAC_CONST(0.030053755536176), FRAC_CONST(0.032402110705505) }, - { FRAC_CONST(0.029854374169043), FRAC_CONST(0.032585907122172) }, - { FRAC_CONST(0.029653868801596), FRAC_CONST(0.032768476697853) }, - { FRAC_CONST(0.029452246982750), FRAC_CONST(0.032949812558907) }, - { FRAC_CONST(0.029249516303451), FRAC_CONST(0.033129907878142) }, - { FRAC_CONST(0.029045684396395), FRAC_CONST(0.033308755875070) }, - { FRAC_CONST(0.028840758935738), FRAC_CONST(0.033486349816166) }, - { FRAC_CONST(0.028634747636808), FRAC_CONST(0.033662683015118) }, - { FRAC_CONST(0.028427658255815), FRAC_CONST(0.033837748833080) }, - { FRAC_CONST(0.028219498589555), FRAC_CONST(0.034011540678924) }, - { FRAC_CONST(0.028010276475123), FRAC_CONST(0.034184052009485) }, - { FRAC_CONST(0.027799999789613), FRAC_CONST(0.034355276329809) }, - { FRAC_CONST(0.027588676449824), FRAC_CONST(0.034525207193396) }, - { FRAC_CONST(0.027376314411959), FRAC_CONST(0.034693838202447) }, - { FRAC_CONST(0.027162921671330), FRAC_CONST(0.034861163008098) }, - { FRAC_CONST(0.026948506262053), FRAC_CONST(0.035027175310665) }, - { FRAC_CONST(0.026733076256746), FRAC_CONST(0.035191868859880) }, - { FRAC_CONST(0.026516639766228), FRAC_CONST(0.035355237455122) }, - { FRAC_CONST(0.026299204939210), FRAC_CONST(0.035517274945657) }, - { FRAC_CONST(0.026080779961991), FRAC_CONST(0.035677975230865) }, - { FRAC_CONST(0.025861373058146), FRAC_CONST(0.035837332260471) }, - { FRAC_CONST(0.025640992488223), FRAC_CONST(0.035995340034772) }, - { FRAC_CONST(0.025419646549425), FRAC_CONST(0.036151992604866) }, - { FRAC_CONST(0.025197343575302), FRAC_CONST(0.036307284072871) }, - { FRAC_CONST(0.024974091935435), FRAC_CONST(0.036461208592152) }, - { FRAC_CONST(0.024749900035122), FRAC_CONST(0.036613760367538) }, - { FRAC_CONST(0.024524776315061), FRAC_CONST(0.036764933655540) }, - { FRAC_CONST(0.024298729251033), FRAC_CONST(0.036914722764569) }, - { FRAC_CONST(0.024071767353583), FRAC_CONST(0.037063122055150) }, - { FRAC_CONST(0.023843899167697), FRAC_CONST(0.037210125940135) }, - { FRAC_CONST(0.023615133272485), FRAC_CONST(0.037355728884908) }, - { FRAC_CONST(0.023385478280852), FRAC_CONST(0.037499925407603) }, - { FRAC_CONST(0.023154942839179), FRAC_CONST(0.037642710079302) }, - { FRAC_CONST(0.022923535626995), FRAC_CONST(0.037784077524241) }, - { FRAC_CONST(0.022691265356652), FRAC_CONST(0.037924022420018) }, - { FRAC_CONST(0.022458140772993), FRAC_CONST(0.038062539497785) }, - { FRAC_CONST(0.022224170653027), FRAC_CONST(0.038199623542453) }, - { FRAC_CONST(0.021989363805598), FRAC_CONST(0.038335269392885) }, - { FRAC_CONST(0.021753729071049), FRAC_CONST(0.038469471942092) }, - { FRAC_CONST(0.021517275320897), FRAC_CONST(0.038602226137423) }, - { FRAC_CONST(0.021280011457490), FRAC_CONST(0.038733526980758) }, - { FRAC_CONST(0.021041946413679), FRAC_CONST(0.038863369528695) }, - { FRAC_CONST(0.020803089152479), FRAC_CONST(0.038991748892734) }, - { FRAC_CONST(0.020563448666730), FRAC_CONST(0.039118660239466) }, - { FRAC_CONST(0.020323033978761), FRAC_CONST(0.039244098790750) }, - { FRAC_CONST(0.020081854140050), FRAC_CONST(0.039368059823895) }, - { FRAC_CONST(0.019839918230880), FRAC_CONST(0.039490538671839) }, - { FRAC_CONST(0.019597235360003), FRAC_CONST(0.039611530723322) }, - { FRAC_CONST(0.019353814664291), FRAC_CONST(0.039731031423061) }, - { FRAC_CONST(0.019109665308395), FRAC_CONST(0.039849036271924) }, - { FRAC_CONST(0.018864796484402), FRAC_CONST(0.039965540827094) }, - { FRAC_CONST(0.018619217411483), FRAC_CONST(0.040080540702240) }, - { FRAC_CONST(0.018372937335552), FRAC_CONST(0.040194031567683) }, - { FRAC_CONST(0.018125965528915), FRAC_CONST(0.040306009150554) }, - { FRAC_CONST(0.017878311289921), FRAC_CONST(0.040416469234963) }, - { FRAC_CONST(0.017629983942612), FRAC_CONST(0.040525407662148) }, - { FRAC_CONST(0.017380992836371), FRAC_CONST(0.040632820330639) }, - { FRAC_CONST(0.017131347345575), FRAC_CONST(0.040738703196411) }, - { FRAC_CONST(0.016881056869233), FRAC_CONST(0.040843052273033) }, - { FRAC_CONST(0.016630130830641), FRAC_CONST(0.040945863631822) }, - { FRAC_CONST(0.016378578677023), FRAC_CONST(0.041047133401988) }, - { FRAC_CONST(0.016126409879175), FRAC_CONST(0.041146857770781) }, - { FRAC_CONST(0.015873633931110), FRAC_CONST(0.041245032983635) }, - { FRAC_CONST(0.015620260349699), FRAC_CONST(0.041341655344309) }, - { FRAC_CONST(0.015366298674314), FRAC_CONST(0.041436721215026) }, - { FRAC_CONST(0.015111758466470), FRAC_CONST(0.041530227016609) }, - { FRAC_CONST(0.014856649309460), FRAC_CONST(0.041622169228618) }, - { FRAC_CONST(0.014600980808001), FRAC_CONST(0.041712544389481) }, - { FRAC_CONST(0.014344762587867), FRAC_CONST(0.041801349096623) }, - { FRAC_CONST(0.014088004295529), FRAC_CONST(0.041888580006598) }, - { FRAC_CONST(0.013830715597792), FRAC_CONST(0.041974233835211) }, - { FRAC_CONST(0.013572906181430), FRAC_CONST(0.042058307357645) }, - { FRAC_CONST(0.013314585752822), FRAC_CONST(0.042140797408577) }, - { FRAC_CONST(0.013055764037585), FRAC_CONST(0.042221700882306) }, - { FRAC_CONST(0.012796450780212), FRAC_CONST(0.042301014732860) }, - { FRAC_CONST(0.012536655743699), FRAC_CONST(0.042378735974118) }, - { FRAC_CONST(0.012276388709183), FRAC_CONST(0.042454861679919) }, - { FRAC_CONST(0.012015659475571), FRAC_CONST(0.042529388984173) }, - { FRAC_CONST(0.011754477859172), FRAC_CONST(0.042602315080970) }, - { FRAC_CONST(0.011492853693324), FRAC_CONST(0.042673637224683) }, - { FRAC_CONST(0.011230796828031), FRAC_CONST(0.042743352730074) }, - { FRAC_CONST(0.010968317129584), FRAC_CONST(0.042811458972393) }, - { FRAC_CONST(0.010705424480197), FRAC_CONST(0.042877953387479) }, - { FRAC_CONST(0.010442128777629), FRAC_CONST(0.042942833471854) }, - { FRAC_CONST(0.010178439934815), FRAC_CONST(0.043006096782821) }, - { FRAC_CONST(0.009914367879490), FRAC_CONST(0.043067740938551) }, - { FRAC_CONST(0.009649922553818), FRAC_CONST(0.043127763618177) }, - { FRAC_CONST(0.009385113914016), FRAC_CONST(0.043186162561878) }, - { FRAC_CONST(0.009119951929979), FRAC_CONST(0.043242935570968) }, - { FRAC_CONST(0.008854446584907), FRAC_CONST(0.043298080507974) }, - { FRAC_CONST(0.008588607874926), FRAC_CONST(0.043351595296722) }, - { FRAC_CONST(0.008322445808712), FRAC_CONST(0.043403477922409) }, - { FRAC_CONST(0.008055970407118), FRAC_CONST(0.043453726431684) }, - { FRAC_CONST(0.007789191702791), FRAC_CONST(0.043502338932719) }, - { FRAC_CONST(0.007522119739798), FRAC_CONST(0.043549313595281) }, - { FRAC_CONST(0.007254764573250), FRAC_CONST(0.043594648650800) }, - { FRAC_CONST(0.006987136268915), FRAC_CONST(0.043638342392438) }, - { FRAC_CONST(0.006719244902849), FRAC_CONST(0.043680393175148) }, - { FRAC_CONST(0.006451100561010), FRAC_CONST(0.043720799415744) }, - { FRAC_CONST(0.006182713338881), FRAC_CONST(0.043759559592953) }, - { FRAC_CONST(0.005914093341090), FRAC_CONST(0.043796672247476) }, - { FRAC_CONST(0.005645250681027), FRAC_CONST(0.043832135982044) }, - { FRAC_CONST(0.005376195480466), FRAC_CONST(0.043865949461465) }, - { FRAC_CONST(0.005106937869184), FRAC_CONST(0.043898111412683) }, - { FRAC_CONST(0.004837487984578), FRAC_CONST(0.043928620624817) }, - { FRAC_CONST(0.004567855971284), FRAC_CONST(0.043957475949213) }, - { FRAC_CONST(0.004298051980793), FRAC_CONST(0.043984676299484) }, - { FRAC_CONST(0.004028086171076), FRAC_CONST(0.044010220651553) }, - { FRAC_CONST(0.003757968706190), FRAC_CONST(0.044034108043689) }, - { FRAC_CONST(0.003487709755907), FRAC_CONST(0.044056337576546) }, - { FRAC_CONST(0.003217319495322), FRAC_CONST(0.044076908413193) }, - { FRAC_CONST(0.002946808104477), FRAC_CONST(0.044095819779151) }, - { FRAC_CONST(0.002676185767973), FRAC_CONST(0.044113070962418) }, - { FRAC_CONST(0.002405462674586), FRAC_CONST(0.044128661313495) }, - { FRAC_CONST(0.002134649016890), FRAC_CONST(0.044142590245416) }, - { FRAC_CONST(0.001863754990865), FRAC_CONST(0.044154857233763) }, - { FRAC_CONST(0.001592790795518), FRAC_CONST(0.044165461816692) }, - { FRAC_CONST(0.001321766632497), FRAC_CONST(0.044174403594946) }, - { FRAC_CONST(0.001050692705710), FRAC_CONST(0.044181682231873) }, - { FRAC_CONST(0.000779579220936), FRAC_CONST(0.044187297453434) }, - { FRAC_CONST(0.000508436385446), FRAC_CONST(0.044191249048222) }, - { FRAC_CONST(0.000237274407613), FRAC_CONST(0.044193536867459) } -}; -#endif // LD_DEC - -#ifdef ALLOW_SMALL_FRAMELENGTH -/* 480 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_1920[] = -{ - { FRAC_CONST(0.032274858518097), FRAC_CONST(0.000013202404176) }, - { FRAC_CONST(0.032274642494505), FRAC_CONST(0.000118821372483) }, - { FRAC_CONST(0.032274080835421), FRAC_CONST(0.000224439068308) }, - { FRAC_CONST(0.032273173546860), FRAC_CONST(0.000330054360572) }, - { FRAC_CONST(0.032271920638538), FRAC_CONST(0.000435666118218) }, - { FRAC_CONST(0.032270322123873), FRAC_CONST(0.000541273210231) }, - { FRAC_CONST(0.032268378019984), FRAC_CONST(0.000646874505642) }, - { FRAC_CONST(0.032266088347691), FRAC_CONST(0.000752468873546) }, - { FRAC_CONST(0.032263453131514), FRAC_CONST(0.000858055183114) }, - { FRAC_CONST(0.032260472399674), FRAC_CONST(0.000963632303600) }, - { FRAC_CONST(0.032257146184092), FRAC_CONST(0.001069199104358) }, - { FRAC_CONST(0.032253474520390), FRAC_CONST(0.001174754454853) }, - { FRAC_CONST(0.032249457447888), FRAC_CONST(0.001280297224671) }, - { FRAC_CONST(0.032245095009606), FRAC_CONST(0.001385826283535) }, - { FRAC_CONST(0.032240387252262), FRAC_CONST(0.001491340501313) }, - { FRAC_CONST(0.032235334226272), FRAC_CONST(0.001596838748031) }, - { FRAC_CONST(0.032229935985750), FRAC_CONST(0.001702319893890) }, - { FRAC_CONST(0.032224192588507), FRAC_CONST(0.001807782809271) }, - { FRAC_CONST(0.032218104096050), FRAC_CONST(0.001913226364749) }, - { FRAC_CONST(0.032211670573582), FRAC_CONST(0.002018649431111) }, - { FRAC_CONST(0.032204892090000), FRAC_CONST(0.002124050879359) }, - { FRAC_CONST(0.032197768717898), FRAC_CONST(0.002229429580728) }, - { FRAC_CONST(0.032190300533560), FRAC_CONST(0.002334784406698) }, - { FRAC_CONST(0.032182487616965), FRAC_CONST(0.002440114229003) }, - { FRAC_CONST(0.032174330051782), FRAC_CONST(0.002545417919644) }, - { FRAC_CONST(0.032165827925374), FRAC_CONST(0.002650694350905) }, - { FRAC_CONST(0.032156981328790), FRAC_CONST(0.002755942395358) }, - { FRAC_CONST(0.032147790356771), FRAC_CONST(0.002861160925883) }, - { FRAC_CONST(0.032138255107744), FRAC_CONST(0.002966348815672) }, - { FRAC_CONST(0.032128375683825), FRAC_CONST(0.003071504938250) }, - { FRAC_CONST(0.032118152190814), FRAC_CONST(0.003176628167476) }, - { FRAC_CONST(0.032107584738196), FRAC_CONST(0.003281717377568) }, - { FRAC_CONST(0.032096673439141), FRAC_CONST(0.003386771443102) }, - { FRAC_CONST(0.032085418410500), FRAC_CONST(0.003491789239036) }, - { FRAC_CONST(0.032073819772804), FRAC_CONST(0.003596769640711) }, - { FRAC_CONST(0.032061877650267), FRAC_CONST(0.003701711523874) }, - { FRAC_CONST(0.032049592170778), FRAC_CONST(0.003806613764680) }, - { FRAC_CONST(0.032036963465906), FRAC_CONST(0.003911475239711) }, - { FRAC_CONST(0.032023991670893), FRAC_CONST(0.004016294825985) }, - { FRAC_CONST(0.032010676924657), FRAC_CONST(0.004121071400967) }, - { FRAC_CONST(0.031997019369789), FRAC_CONST(0.004225803842586) }, - { FRAC_CONST(0.031983019152549), FRAC_CONST(0.004330491029241) }, - { FRAC_CONST(0.031968676422869), FRAC_CONST(0.004435131839816) }, - { FRAC_CONST(0.031953991334348), FRAC_CONST(0.004539725153692) }, - { FRAC_CONST(0.031938964044252), FRAC_CONST(0.004644269850758) }, - { FRAC_CONST(0.031923594713510), FRAC_CONST(0.004748764811426) }, - { FRAC_CONST(0.031907883506716), FRAC_CONST(0.004853208916638) }, - { FRAC_CONST(0.031891830592124), FRAC_CONST(0.004957601047881) }, - { FRAC_CONST(0.031875436141648), FRAC_CONST(0.005061940087200) }, - { FRAC_CONST(0.031858700330859), FRAC_CONST(0.005166224917208) }, - { FRAC_CONST(0.031841623338985), FRAC_CONST(0.005270454421097) }, - { FRAC_CONST(0.031824205348907), FRAC_CONST(0.005374627482653) }, - { FRAC_CONST(0.031806446547156), FRAC_CONST(0.005478742986267) }, - { FRAC_CONST(0.031788347123916), FRAC_CONST(0.005582799816945) }, - { FRAC_CONST(0.031769907273017), FRAC_CONST(0.005686796860323) }, - { FRAC_CONST(0.031751127191935), FRAC_CONST(0.005790733002674) }, - { FRAC_CONST(0.031732007081789), FRAC_CONST(0.005894607130928) }, - { FRAC_CONST(0.031712547147340), FRAC_CONST(0.005998418132675) }, - { FRAC_CONST(0.031692747596989), FRAC_CONST(0.006102164896182) }, - { FRAC_CONST(0.031672608642773), FRAC_CONST(0.006205846310406) }, - { FRAC_CONST(0.031652130500364), FRAC_CONST(0.006309461265002) }, - { FRAC_CONST(0.031631313389067), FRAC_CONST(0.006413008650337) }, - { FRAC_CONST(0.031610157531816), FRAC_CONST(0.006516487357501) }, - { FRAC_CONST(0.031588663155172), FRAC_CONST(0.006619896278321) }, - { FRAC_CONST(0.031566830489325), FRAC_CONST(0.006723234305370) }, - { FRAC_CONST(0.031544659768083), FRAC_CONST(0.006826500331981) }, - { FRAC_CONST(0.031522151228878), FRAC_CONST(0.006929693252258) }, - { FRAC_CONST(0.031499305112758), FRAC_CONST(0.007032811961088) }, - { FRAC_CONST(0.031476121664387), FRAC_CONST(0.007135855354151) }, - { FRAC_CONST(0.031452601132040), FRAC_CONST(0.007238822327937) }, - { FRAC_CONST(0.031428743767604), FRAC_CONST(0.007341711779751) }, - { FRAC_CONST(0.031404549826572), FRAC_CONST(0.007444522607730) }, - { FRAC_CONST(0.031380019568042), FRAC_CONST(0.007547253710853) }, - { FRAC_CONST(0.031355153254712), FRAC_CONST(0.007649903988952) }, - { FRAC_CONST(0.031329951152882), FRAC_CONST(0.007752472342725) }, - { FRAC_CONST(0.031304413532445), FRAC_CONST(0.007854957673748) }, - { FRAC_CONST(0.031278540666888), FRAC_CONST(0.007957358884484) }, - { FRAC_CONST(0.031252332833290), FRAC_CONST(0.008059674878300) }, - { FRAC_CONST(0.031225790312316), FRAC_CONST(0.008161904559473) }, - { FRAC_CONST(0.031198913388214), FRAC_CONST(0.008264046833205) }, - { FRAC_CONST(0.031171702348814), FRAC_CONST(0.008366100605636) }, - { FRAC_CONST(0.031144157485525), FRAC_CONST(0.008468064783849) }, - { FRAC_CONST(0.031116279093331), FRAC_CONST(0.008569938275893) }, - { FRAC_CONST(0.031088067470786), FRAC_CONST(0.008671719990782) }, - { FRAC_CONST(0.031059522920014), FRAC_CONST(0.008773408838517) }, - { FRAC_CONST(0.031030645746705), FRAC_CONST(0.008875003730092) }, - { FRAC_CONST(0.031001436260110), FRAC_CONST(0.008976503577507) }, - { FRAC_CONST(0.030971894773039), FRAC_CONST(0.009077907293780) }, - { FRAC_CONST(0.030942021601857), FRAC_CONST(0.009179213792959) }, - { FRAC_CONST(0.030911817066483), FRAC_CONST(0.009280421990133) }, - { FRAC_CONST(0.030881281490382), FRAC_CONST(0.009381530801444) }, - { FRAC_CONST(0.030850415200566), FRAC_CONST(0.009482539144097) }, - { FRAC_CONST(0.030819218527589), FRAC_CONST(0.009583445936373) }, - { FRAC_CONST(0.030787691805541), FRAC_CONST(0.009684250097643) }, - { FRAC_CONST(0.030755835372048), FRAC_CONST(0.009784950548375) }, - { FRAC_CONST(0.030723649568268), FRAC_CONST(0.009885546210147) }, - { FRAC_CONST(0.030691134738883), FRAC_CONST(0.009986036005661) }, - { FRAC_CONST(0.030658291232103), FRAC_CONST(0.010086418858753) }, - { FRAC_CONST(0.030625119399655), FRAC_CONST(0.010186693694402) }, - { FRAC_CONST(0.030591619596781), FRAC_CONST(0.010286859438745) }, - { FRAC_CONST(0.030557792182239), FRAC_CONST(0.010386915019088) }, - { FRAC_CONST(0.030523637518292), FRAC_CONST(0.010486859363916) }, - { FRAC_CONST(0.030489155970710), FRAC_CONST(0.010586691402906) }, - { FRAC_CONST(0.030454347908763), FRAC_CONST(0.010686410066936) }, - { FRAC_CONST(0.030419213705216), FRAC_CONST(0.010786014288099) }, - { FRAC_CONST(0.030383753736329), FRAC_CONST(0.010885502999714) }, - { FRAC_CONST(0.030347968381849), FRAC_CONST(0.010984875136338) }, - { FRAC_CONST(0.030311858025010), FRAC_CONST(0.011084129633775) }, - { FRAC_CONST(0.030275423052523), FRAC_CONST(0.011183265429088) }, - { FRAC_CONST(0.030238663854579), FRAC_CONST(0.011282281460612) }, - { FRAC_CONST(0.030201580824838), FRAC_CONST(0.011381176667967) }, - { FRAC_CONST(0.030164174360430), FRAC_CONST(0.011479949992062) }, - { FRAC_CONST(0.030126444861948), FRAC_CONST(0.011578600375117) }, - { FRAC_CONST(0.030088392733446), FRAC_CONST(0.011677126760663) }, - { FRAC_CONST(0.030050018382430), FRAC_CONST(0.011775528093563) }, - { FRAC_CONST(0.030011322219859), FRAC_CONST(0.011873803320018) }, - { FRAC_CONST(0.029972304660138), FRAC_CONST(0.011971951387578) }, - { FRAC_CONST(0.029932966121114), FRAC_CONST(0.012069971245157) }, - { FRAC_CONST(0.029893307024070), FRAC_CONST(0.012167861843041) }, - { FRAC_CONST(0.029853327793724), FRAC_CONST(0.012265622132901) }, - { FRAC_CONST(0.029813028858222), FRAC_CONST(0.012363251067801) }, - { FRAC_CONST(0.029772410649132), FRAC_CONST(0.012460747602215) }, - { FRAC_CONST(0.029731473601443), FRAC_CONST(0.012558110692033) }, - { FRAC_CONST(0.029690218153558), FRAC_CONST(0.012655339294575) }, - { FRAC_CONST(0.029648644747289), FRAC_CONST(0.012752432368600) }, - { FRAC_CONST(0.029606753827855), FRAC_CONST(0.012849388874320) }, - { FRAC_CONST(0.029564545843872), FRAC_CONST(0.012946207773407) }, - { FRAC_CONST(0.029522021247356), FRAC_CONST(0.013042888029011) }, - { FRAC_CONST(0.029479180493710), FRAC_CONST(0.013139428605762) }, - { FRAC_CONST(0.029436024041725), FRAC_CONST(0.013235828469789) }, - { FRAC_CONST(0.029392552353570), FRAC_CONST(0.013332086588727) }, - { FRAC_CONST(0.029348765894794), FRAC_CONST(0.013428201931728) }, - { FRAC_CONST(0.029304665134313), FRAC_CONST(0.013524173469475) }, - { FRAC_CONST(0.029260250544412), FRAC_CONST(0.013620000174189) }, - { FRAC_CONST(0.029215522600735), FRAC_CONST(0.013715681019643) }, - { FRAC_CONST(0.029170481782283), FRAC_CONST(0.013811214981173) }, - { FRAC_CONST(0.029125128571406), FRAC_CONST(0.013906601035686) }, - { FRAC_CONST(0.029079463453801), FRAC_CONST(0.014001838161674) }, - { FRAC_CONST(0.029033486918505), FRAC_CONST(0.014096925339225) }, - { FRAC_CONST(0.028987199457889), FRAC_CONST(0.014191861550031) }, - { FRAC_CONST(0.028940601567655), FRAC_CONST(0.014286645777401) }, - { FRAC_CONST(0.028893693746829), FRAC_CONST(0.014381277006273) }, - { FRAC_CONST(0.028846476497755), FRAC_CONST(0.014475754223221) }, - { FRAC_CONST(0.028798950326094), FRAC_CONST(0.014570076416472) }, - { FRAC_CONST(0.028751115740811), FRAC_CONST(0.014664242575910) }, - { FRAC_CONST(0.028702973254178), FRAC_CONST(0.014758251693091) }, - { FRAC_CONST(0.028654523381760), FRAC_CONST(0.014852102761253) }, - { FRAC_CONST(0.028605766642418), FRAC_CONST(0.014945794775326) }, - { FRAC_CONST(0.028556703558297), FRAC_CONST(0.015039326731945) }, - { FRAC_CONST(0.028507334654823), FRAC_CONST(0.015132697629457) }, - { FRAC_CONST(0.028457660460698), FRAC_CONST(0.015225906467935) }, - { FRAC_CONST(0.028407681507891), FRAC_CONST(0.015318952249187) }, - { FRAC_CONST(0.028357398331639), FRAC_CONST(0.015411833976768) }, - { FRAC_CONST(0.028306811470432), FRAC_CONST(0.015504550655988) }, - { FRAC_CONST(0.028255921466016), FRAC_CONST(0.015597101293927) }, - { FRAC_CONST(0.028204728863381), FRAC_CONST(0.015689484899442) }, - { FRAC_CONST(0.028153234210760), FRAC_CONST(0.015781700483179) }, - { FRAC_CONST(0.028101438059619), FRAC_CONST(0.015873747057582) }, - { FRAC_CONST(0.028049340964652), FRAC_CONST(0.015965623636907) }, - { FRAC_CONST(0.027996943483779), FRAC_CONST(0.016057329237229) }, - { FRAC_CONST(0.027944246178133), FRAC_CONST(0.016148862876456) }, - { FRAC_CONST(0.027891249612061), FRAC_CONST(0.016240223574335) }, - { FRAC_CONST(0.027837954353113), FRAC_CONST(0.016331410352467) }, - { FRAC_CONST(0.027784360972039), FRAC_CONST(0.016422422234315) }, - { FRAC_CONST(0.027730470042780), FRAC_CONST(0.016513258245214) }, - { FRAC_CONST(0.027676282142466), FRAC_CONST(0.016603917412384) }, - { FRAC_CONST(0.027621797851405), FRAC_CONST(0.016694398764938) }, - { FRAC_CONST(0.027567017753080), FRAC_CONST(0.016784701333894) }, - { FRAC_CONST(0.027511942434143), FRAC_CONST(0.016874824152183) }, - { FRAC_CONST(0.027456572484404), FRAC_CONST(0.016964766254662) }, - { FRAC_CONST(0.027400908496833), FRAC_CONST(0.017054526678124) }, - { FRAC_CONST(0.027344951067546), FRAC_CONST(0.017144104461307) }, - { FRAC_CONST(0.027288700795801), FRAC_CONST(0.017233498644904) }, - { FRAC_CONST(0.027232158283994), FRAC_CONST(0.017322708271577) }, - { FRAC_CONST(0.027175324137651), FRAC_CONST(0.017411732385960) }, - { FRAC_CONST(0.027118198965418), FRAC_CONST(0.017500570034678) }, - { FRAC_CONST(0.027060783379060), FRAC_CONST(0.017589220266351) }, - { FRAC_CONST(0.027003077993454), FRAC_CONST(0.017677682131607) }, - { FRAC_CONST(0.026945083426576), FRAC_CONST(0.017765954683088) }, - { FRAC_CONST(0.026886800299502), FRAC_CONST(0.017854036975468) }, - { FRAC_CONST(0.026828229236397), FRAC_CONST(0.017941928065456) }, - { FRAC_CONST(0.026769370864511), FRAC_CONST(0.018029627011808) }, - { FRAC_CONST(0.026710225814170), FRAC_CONST(0.018117132875340) }, - { FRAC_CONST(0.026650794718768), FRAC_CONST(0.018204444718934) }, - { FRAC_CONST(0.026591078214767), FRAC_CONST(0.018291561607551) }, - { FRAC_CONST(0.026531076941680), FRAC_CONST(0.018378482608238) }, - { FRAC_CONST(0.026470791542075), FRAC_CONST(0.018465206790142) }, - { FRAC_CONST(0.026410222661558), FRAC_CONST(0.018551733224515) }, - { FRAC_CONST(0.026349370948775), FRAC_CONST(0.018638060984730) }, - { FRAC_CONST(0.026288237055398), FRAC_CONST(0.018724189146286) }, - { FRAC_CONST(0.026226821636121), FRAC_CONST(0.018810116786819) }, - { FRAC_CONST(0.026165125348656), FRAC_CONST(0.018895842986112) }, - { FRAC_CONST(0.026103148853718), FRAC_CONST(0.018981366826109) }, - { FRAC_CONST(0.026040892815028), FRAC_CONST(0.019066687390916) }, - { FRAC_CONST(0.025978357899296), FRAC_CONST(0.019151803766819) }, - { FRAC_CONST(0.025915544776223), FRAC_CONST(0.019236715042290) }, - { FRAC_CONST(0.025852454118485), FRAC_CONST(0.019321420307998) }, - { FRAC_CONST(0.025789086601733), FRAC_CONST(0.019405918656817) }, - { FRAC_CONST(0.025725442904582), FRAC_CONST(0.019490209183837) }, - { FRAC_CONST(0.025661523708606), FRAC_CONST(0.019574290986376) }, - { FRAC_CONST(0.025597329698327), FRAC_CONST(0.019658163163984) }, - { FRAC_CONST(0.025532861561211), FRAC_CONST(0.019741824818458) }, - { FRAC_CONST(0.025468119987662), FRAC_CONST(0.019825275053848) }, - { FRAC_CONST(0.025403105671008), FRAC_CONST(0.019908512976470) }, - { FRAC_CONST(0.025337819307501), FRAC_CONST(0.019991537694913) }, - { FRAC_CONST(0.025272261596305), FRAC_CONST(0.020074348320047) }, - { FRAC_CONST(0.025206433239491), FRAC_CONST(0.020156943965039) }, - { FRAC_CONST(0.025140334942028), FRAC_CONST(0.020239323745355) }, - { FRAC_CONST(0.025073967411776), FRAC_CONST(0.020321486778774) }, - { FRAC_CONST(0.025007331359476), FRAC_CONST(0.020403432185395) }, - { FRAC_CONST(0.024940427498748), FRAC_CONST(0.020485159087650) }, - { FRAC_CONST(0.024873256546079), FRAC_CONST(0.020566666610309) }, - { FRAC_CONST(0.024805819220816), FRAC_CONST(0.020647953880491) }, - { FRAC_CONST(0.024738116245157), FRAC_CONST(0.020729020027676) }, - { FRAC_CONST(0.024670148344147), FRAC_CONST(0.020809864183709) }, - { FRAC_CONST(0.024601916245669), FRAC_CONST(0.020890485482816) }, - { FRAC_CONST(0.024533420680433), FRAC_CONST(0.020970883061607) }, - { FRAC_CONST(0.024464662381971), FRAC_CONST(0.021051056059087) }, - { FRAC_CONST(0.024395642086630), FRAC_CONST(0.021131003616670) }, - { FRAC_CONST(0.024326360533561), FRAC_CONST(0.021210724878181) }, - { FRAC_CONST(0.024256818464715), FRAC_CONST(0.021290218989868) }, - { FRAC_CONST(0.024187016624830), FRAC_CONST(0.021369485100415) }, - { FRAC_CONST(0.024116955761430), FRAC_CONST(0.021448522360944) }, - { FRAC_CONST(0.024046636624808), FRAC_CONST(0.021527329925030) }, - { FRAC_CONST(0.023976059968027), FRAC_CONST(0.021605906948708) }, - { FRAC_CONST(0.023905226546906), FRAC_CONST(0.021684252590480) }, - { FRAC_CONST(0.023834137120014), FRAC_CONST(0.021762366011328) }, - { FRAC_CONST(0.023762792448662), FRAC_CONST(0.021840246374720) }, - { FRAC_CONST(0.023691193296893), FRAC_CONST(0.021917892846620) }, - { FRAC_CONST(0.023619340431478), FRAC_CONST(0.021995304595495) }, - { FRAC_CONST(0.023547234621902), FRAC_CONST(0.022072480792330) }, - { FRAC_CONST(0.023474876640361), FRAC_CONST(0.022149420610628) }, - { FRAC_CONST(0.023402267261751), FRAC_CONST(0.022226123226426) }, - { FRAC_CONST(0.023329407263659), FRAC_CONST(0.022302587818300) }, - { FRAC_CONST(0.023256297426359), FRAC_CONST(0.022378813567377) }, - { FRAC_CONST(0.023182938532797), FRAC_CONST(0.022454799657339) }, - { FRAC_CONST(0.023109331368588), FRAC_CONST(0.022530545274437) }, - { FRAC_CONST(0.023035476722006), FRAC_CONST(0.022606049607496) }, - { FRAC_CONST(0.022961375383975), FRAC_CONST(0.022681311847926) }, - { FRAC_CONST(0.022887028148061), FRAC_CONST(0.022756331189727) }, - { FRAC_CONST(0.022812435810462), FRAC_CONST(0.022831106829504) }, - { FRAC_CONST(0.022737599170003), FRAC_CONST(0.022905637966469) }, - { FRAC_CONST(0.022662519028125), FRAC_CONST(0.022979923802453) }, - { FRAC_CONST(0.022587196188874), FRAC_CONST(0.023053963541915) }, - { FRAC_CONST(0.022511631458899), FRAC_CONST(0.023127756391950) }, - { FRAC_CONST(0.022435825647437), FRAC_CONST(0.023201301562294) }, - { FRAC_CONST(0.022359779566306), FRAC_CONST(0.023274598265338) }, - { FRAC_CONST(0.022283494029900), FRAC_CONST(0.023347645716133) }, - { FRAC_CONST(0.022206969855176), FRAC_CONST(0.023420443132400) }, - { FRAC_CONST(0.022130207861645), FRAC_CONST(0.023492989734537) }, - { FRAC_CONST(0.022053208871367), FRAC_CONST(0.023565284745628) }, - { FRAC_CONST(0.021975973708940), FRAC_CONST(0.023637327391451) }, - { FRAC_CONST(0.021898503201489), FRAC_CONST(0.023709116900488) }, - { FRAC_CONST(0.021820798178663), FRAC_CONST(0.023780652503931) }, - { FRAC_CONST(0.021742859472618), FRAC_CONST(0.023851933435691) }, - { FRAC_CONST(0.021664687918017), FRAC_CONST(0.023922958932406) }, - { FRAC_CONST(0.021586284352013), FRAC_CONST(0.023993728233451) }, - { FRAC_CONST(0.021507649614247), FRAC_CONST(0.024064240580942) }, - { FRAC_CONST(0.021428784546832), FRAC_CONST(0.024134495219750) }, - { FRAC_CONST(0.021349689994350), FRAC_CONST(0.024204491397504) }, - { FRAC_CONST(0.021270366803840), FRAC_CONST(0.024274228364600) }, - { FRAC_CONST(0.021190815824791), FRAC_CONST(0.024343705374213) }, - { FRAC_CONST(0.021111037909128), FRAC_CONST(0.024412921682298) }, - { FRAC_CONST(0.021031033911210), FRAC_CONST(0.024481876547605) }, - { FRAC_CONST(0.020950804687815), FRAC_CONST(0.024550569231683) }, - { FRAC_CONST(0.020870351098134), FRAC_CONST(0.024618998998889) }, - { FRAC_CONST(0.020789674003759), FRAC_CONST(0.024687165116394) }, - { FRAC_CONST(0.020708774268678), FRAC_CONST(0.024755066854194) }, - { FRAC_CONST(0.020627652759262), FRAC_CONST(0.024822703485116) }, - { FRAC_CONST(0.020546310344257), FRAC_CONST(0.024890074284826) }, - { FRAC_CONST(0.020464747894775), FRAC_CONST(0.024957178531837) }, - { FRAC_CONST(0.020382966284284), FRAC_CONST(0.025024015507516) }, - { FRAC_CONST(0.020300966388600), FRAC_CONST(0.025090584496093) }, - { FRAC_CONST(0.020218749085876), FRAC_CONST(0.025156884784668) }, - { FRAC_CONST(0.020136315256592), FRAC_CONST(0.025222915663218) }, - { FRAC_CONST(0.020053665783549), FRAC_CONST(0.025288676424605) }, - { FRAC_CONST(0.019970801551857), FRAC_CONST(0.025354166364584) }, - { FRAC_CONST(0.019887723448925), FRAC_CONST(0.025419384781811) }, - { FRAC_CONST(0.019804432364452), FRAC_CONST(0.025484330977848) }, - { FRAC_CONST(0.019720929190419), FRAC_CONST(0.025549004257175) }, - { FRAC_CONST(0.019637214821078), FRAC_CONST(0.025613403927192) }, - { FRAC_CONST(0.019553290152943), FRAC_CONST(0.025677529298230) }, - { FRAC_CONST(0.019469156084779), FRAC_CONST(0.025741379683559) }, - { FRAC_CONST(0.019384813517595), FRAC_CONST(0.025804954399392) }, - { FRAC_CONST(0.019300263354632), FRAC_CONST(0.025868252764895) }, - { FRAC_CONST(0.019215506501354), FRAC_CONST(0.025931274102193) }, - { FRAC_CONST(0.019130543865439), FRAC_CONST(0.025994017736379) }, - { FRAC_CONST(0.019045376356769), FRAC_CONST(0.026056482995518) }, - { FRAC_CONST(0.018960004887419), FRAC_CONST(0.026118669210657) }, - { FRAC_CONST(0.018874430371648), FRAC_CONST(0.026180575715833) }, - { FRAC_CONST(0.018788653725892), FRAC_CONST(0.026242201848076) }, - { FRAC_CONST(0.018702675868750), FRAC_CONST(0.026303546947421) }, - { FRAC_CONST(0.018616497720974), FRAC_CONST(0.026364610356909) }, - { FRAC_CONST(0.018530120205464), FRAC_CONST(0.026425391422602) }, - { FRAC_CONST(0.018443544247254), FRAC_CONST(0.026485889493583) }, - { FRAC_CONST(0.018356770773502), FRAC_CONST(0.026546103921965) }, - { FRAC_CONST(0.018269800713483), FRAC_CONST(0.026606034062902) }, - { FRAC_CONST(0.018182634998576), FRAC_CONST(0.026665679274589) }, - { FRAC_CONST(0.018095274562256), FRAC_CONST(0.026725038918274) }, - { FRAC_CONST(0.018007720340083), FRAC_CONST(0.026784112358263) }, - { FRAC_CONST(0.017919973269692), FRAC_CONST(0.026842898961926) }, - { FRAC_CONST(0.017832034290785), FRAC_CONST(0.026901398099707) }, - { FRAC_CONST(0.017743904345116), FRAC_CONST(0.026959609145127) }, - { FRAC_CONST(0.017655584376488), FRAC_CONST(0.027017531474792) }, - { FRAC_CONST(0.017567075330734), FRAC_CONST(0.027075164468401) }, - { FRAC_CONST(0.017478378155718), FRAC_CONST(0.027132507508750) }, - { FRAC_CONST(0.017389493801313), FRAC_CONST(0.027189559981742) }, - { FRAC_CONST(0.017300423219401), FRAC_CONST(0.027246321276391) }, - { FRAC_CONST(0.017211167363854), FRAC_CONST(0.027302790784828) }, - { FRAC_CONST(0.017121727190533), FRAC_CONST(0.027358967902310) }, - { FRAC_CONST(0.017032103657269), FRAC_CONST(0.027414852027226) }, - { FRAC_CONST(0.016942297723858), FRAC_CONST(0.027470442561102) }, - { FRAC_CONST(0.016852310352050), FRAC_CONST(0.027525738908608) }, - { FRAC_CONST(0.016762142505537), FRAC_CONST(0.027580740477564) }, - { FRAC_CONST(0.016671795149944), FRAC_CONST(0.027635446678948) }, - { FRAC_CONST(0.016581269252819), FRAC_CONST(0.027689856926900) }, - { FRAC_CONST(0.016490565783622), FRAC_CONST(0.027743970638730) }, - { FRAC_CONST(0.016399685713714), FRAC_CONST(0.027797787234924) }, - { FRAC_CONST(0.016308630016347), FRAC_CONST(0.027851306139149) }, - { FRAC_CONST(0.016217399666655), FRAC_CONST(0.027904526778260) }, - { FRAC_CONST(0.016125995641641), FRAC_CONST(0.027957448582309) }, - { FRAC_CONST(0.016034418920170), FRAC_CONST(0.028010070984544) }, - { FRAC_CONST(0.015942670482954), FRAC_CONST(0.028062393421421) }, - { FRAC_CONST(0.015850751312545), FRAC_CONST(0.028114415332610) }, - { FRAC_CONST(0.015758662393324), FRAC_CONST(0.028166136160998) }, - { FRAC_CONST(0.015666404711489), FRAC_CONST(0.028217555352697) }, - { FRAC_CONST(0.015573979255046), FRAC_CONST(0.028268672357047) }, - { FRAC_CONST(0.015481387013797), FRAC_CONST(0.028319486626627) }, - { FRAC_CONST(0.015388628979331), FRAC_CONST(0.028369997617257) }, - { FRAC_CONST(0.015295706145012), FRAC_CONST(0.028420204788004) }, - { FRAC_CONST(0.015202619505968), FRAC_CONST(0.028470107601191) }, - { FRAC_CONST(0.015109370059084), FRAC_CONST(0.028519705522399) }, - { FRAC_CONST(0.015015958802984), FRAC_CONST(0.028568998020472) }, - { FRAC_CONST(0.014922386738030), FRAC_CONST(0.028617984567529) }, - { FRAC_CONST(0.014828654866302), FRAC_CONST(0.028666664638963) }, - { FRAC_CONST(0.014734764191593), FRAC_CONST(0.028715037713449) }, - { FRAC_CONST(0.014640715719398), FRAC_CONST(0.028763103272951) }, - { FRAC_CONST(0.014546510456900), FRAC_CONST(0.028810860802724) }, - { FRAC_CONST(0.014452149412962), FRAC_CONST(0.028858309791325) }, - { FRAC_CONST(0.014357633598114), FRAC_CONST(0.028905449730613) }, - { FRAC_CONST(0.014262964024545), FRAC_CONST(0.028952280115756) }, - { FRAC_CONST(0.014168141706090), FRAC_CONST(0.028998800445240) }, - { FRAC_CONST(0.014073167658220), FRAC_CONST(0.029045010220868) }, - { FRAC_CONST(0.013978042898030), FRAC_CONST(0.029090908947771) }, - { FRAC_CONST(0.013882768444231), FRAC_CONST(0.029136496134411) }, - { FRAC_CONST(0.013787345317136), FRAC_CONST(0.029181771292585) }, - { FRAC_CONST(0.013691774538648), FRAC_CONST(0.029226733937433) }, - { FRAC_CONST(0.013596057132255), FRAC_CONST(0.029271383587441) }, - { FRAC_CONST(0.013500194123014), FRAC_CONST(0.029315719764447) }, - { FRAC_CONST(0.013404186537539), FRAC_CONST(0.029359741993647) }, - { FRAC_CONST(0.013308035403995), FRAC_CONST(0.029403449803598) }, - { FRAC_CONST(0.013211741752084), FRAC_CONST(0.029446842726223) }, - { FRAC_CONST(0.013115306613032), FRAC_CONST(0.029489920296820) }, - { FRAC_CONST(0.013018731019584), FRAC_CONST(0.029532682054063) }, - { FRAC_CONST(0.012922016005985), FRAC_CONST(0.029575127540008) }, - { FRAC_CONST(0.012825162607977), FRAC_CONST(0.029617256300097) }, - { FRAC_CONST(0.012728171862781), FRAC_CONST(0.029659067883165) }, - { FRAC_CONST(0.012631044809089), FRAC_CONST(0.029700561841444) }, - { FRAC_CONST(0.012533782487056), FRAC_CONST(0.029741737730567) }, - { FRAC_CONST(0.012436385938281), FRAC_CONST(0.029782595109573) }, - { FRAC_CONST(0.012338856205805), FRAC_CONST(0.029823133540913) }, - { FRAC_CONST(0.012241194334091), FRAC_CONST(0.029863352590452) }, - { FRAC_CONST(0.012143401369021), FRAC_CONST(0.029903251827477) }, - { FRAC_CONST(0.012045478357878), FRAC_CONST(0.029942830824699) }, - { FRAC_CONST(0.011947426349339), FRAC_CONST(0.029982089158259) }, - { FRAC_CONST(0.011849246393462), FRAC_CONST(0.030021026407731) }, - { FRAC_CONST(0.011750939541676), FRAC_CONST(0.030059642156129) }, - { FRAC_CONST(0.011652506846768), FRAC_CONST(0.030097935989909) }, - { FRAC_CONST(0.011553949362874), FRAC_CONST(0.030135907498976) }, - { FRAC_CONST(0.011455268145464), FRAC_CONST(0.030173556276684) }, - { FRAC_CONST(0.011356464251335), FRAC_CONST(0.030210881919845) }, - { FRAC_CONST(0.011257538738598), FRAC_CONST(0.030247884028732) }, - { FRAC_CONST(0.011158492666665), FRAC_CONST(0.030284562207083) }, - { FRAC_CONST(0.011059327096240), FRAC_CONST(0.030320916062102) }, - { FRAC_CONST(0.010960043089307), FRAC_CONST(0.030356945204470) }, - { FRAC_CONST(0.010860641709118), FRAC_CONST(0.030392649248343) }, - { FRAC_CONST(0.010761124020182), FRAC_CONST(0.030428027811361) }, - { FRAC_CONST(0.010661491088253), FRAC_CONST(0.030463080514646) }, - { FRAC_CONST(0.010561743980319), FRAC_CONST(0.030497806982812) }, - { FRAC_CONST(0.010461883764593), FRAC_CONST(0.030532206843968) }, - { FRAC_CONST(0.010361911510496), FRAC_CONST(0.030566279729717) }, - { FRAC_CONST(0.010261828288652), FRAC_CONST(0.030600025275167) }, - { FRAC_CONST(0.010161635170872), FRAC_CONST(0.030633443118931) }, - { FRAC_CONST(0.010061333230142), FRAC_CONST(0.030666532903129) }, - { FRAC_CONST(0.009960923540617), FRAC_CONST(0.030699294273397) }, - { FRAC_CONST(0.009860407177603), FRAC_CONST(0.030731726878888) }, - { FRAC_CONST(0.009759785217550), FRAC_CONST(0.030763830372273) }, - { FRAC_CONST(0.009659058738038), FRAC_CONST(0.030795604409750) }, - { FRAC_CONST(0.009558228817767), FRAC_CONST(0.030827048651045) }, - { FRAC_CONST(0.009457296536545), FRAC_CONST(0.030858162759415) }, - { FRAC_CONST(0.009356262975275), FRAC_CONST(0.030888946401653) }, - { FRAC_CONST(0.009255129215945), FRAC_CONST(0.030919399248091) }, - { FRAC_CONST(0.009153896341616), FRAC_CONST(0.030949520972603) }, - { FRAC_CONST(0.009052565436412), FRAC_CONST(0.030979311252611) }, - { FRAC_CONST(0.008951137585505), FRAC_CONST(0.031008769769084) }, - { FRAC_CONST(0.008849613875105), FRAC_CONST(0.031037896206544) }, - { FRAC_CONST(0.008747995392451), FRAC_CONST(0.031066690253072) }, - { FRAC_CONST(0.008646283225794), FRAC_CONST(0.031095151600306) }, - { FRAC_CONST(0.008544478464390), FRAC_CONST(0.031123279943448) }, - { FRAC_CONST(0.008442582198486), FRAC_CONST(0.031151074981266) }, - { FRAC_CONST(0.008340595519310), FRAC_CONST(0.031178536416098) }, - { FRAC_CONST(0.008238519519057), FRAC_CONST(0.031205663953853) }, - { FRAC_CONST(0.008136355290878), FRAC_CONST(0.031232457304017) }, - { FRAC_CONST(0.008034103928871), FRAC_CONST(0.031258916179656) }, - { FRAC_CONST(0.007931766528065), FRAC_CONST(0.031285040297416) }, - { FRAC_CONST(0.007829344184412), FRAC_CONST(0.031310829377528) }, - { FRAC_CONST(0.007726837994772), FRAC_CONST(0.031336283143813) }, - { FRAC_CONST(0.007624249056906), FRAC_CONST(0.031361401323680) }, - { FRAC_CONST(0.007521578469457), FRAC_CONST(0.031386183648135) }, - { FRAC_CONST(0.007418827331946), FRAC_CONST(0.031410629851778) }, - { FRAC_CONST(0.007315996744755), FRAC_CONST(0.031434739672811) }, - { FRAC_CONST(0.007213087809115), FRAC_CONST(0.031458512853036) }, - { FRAC_CONST(0.007110101627101), FRAC_CONST(0.031481949137863) }, - { FRAC_CONST(0.007007039301610), FRAC_CONST(0.031505048276306) }, - { FRAC_CONST(0.006903901936357), FRAC_CONST(0.031527810020993) }, - { FRAC_CONST(0.006800690635862), FRAC_CONST(0.031550234128164) }, - { FRAC_CONST(0.006697406505433), FRAC_CONST(0.031572320357675) }, - { FRAC_CONST(0.006594050651161), FRAC_CONST(0.031594068473000) }, - { FRAC_CONST(0.006490624179905), FRAC_CONST(0.031615478241233) }, - { FRAC_CONST(0.006387128199278), FRAC_CONST(0.031636549433095) }, - { FRAC_CONST(0.006283563817639), FRAC_CONST(0.031657281822929) }, - { FRAC_CONST(0.006179932144080), FRAC_CONST(0.031677675188707) }, - { FRAC_CONST(0.006076234288412), FRAC_CONST(0.031697729312034) }, - { FRAC_CONST(0.005972471361157), FRAC_CONST(0.031717443978146) }, - { FRAC_CONST(0.005868644473532), FRAC_CONST(0.031736818975914) }, - { FRAC_CONST(0.005764754737440), FRAC_CONST(0.031755854097848) }, - { FRAC_CONST(0.005660803265456), FRAC_CONST(0.031774549140098) }, - { FRAC_CONST(0.005556791170816), FRAC_CONST(0.031792903902453) }, - { FRAC_CONST(0.005452719567407), FRAC_CONST(0.031810918188350) }, - { FRAC_CONST(0.005348589569753), FRAC_CONST(0.031828591804869) }, - { FRAC_CONST(0.005244402293001), FRAC_CONST(0.031845924562742) }, - { FRAC_CONST(0.005140158852914), FRAC_CONST(0.031862916276347) }, - { FRAC_CONST(0.005035860365855), FRAC_CONST(0.031879566763717) }, - { FRAC_CONST(0.004931507948778), FRAC_CONST(0.031895875846539) }, - { FRAC_CONST(0.004827102719212), FRAC_CONST(0.031911843350155) }, - { FRAC_CONST(0.004722645795254), FRAC_CONST(0.031927469103567) }, - { FRAC_CONST(0.004618138295554), FRAC_CONST(0.031942752939435) }, - { FRAC_CONST(0.004513581339303), FRAC_CONST(0.031957694694082) }, - { FRAC_CONST(0.004408976046222), FRAC_CONST(0.031972294207493) }, - { FRAC_CONST(0.004304323536549), FRAC_CONST(0.031986551323320) }, - { FRAC_CONST(0.004199624931030), FRAC_CONST(0.032000465888879) }, - { FRAC_CONST(0.004094881350902), FRAC_CONST(0.032014037755158) }, - { FRAC_CONST(0.003990093917884), FRAC_CONST(0.032027266776813) }, - { FRAC_CONST(0.003885263754166), FRAC_CONST(0.032040152812170) }, - { FRAC_CONST(0.003780391982394), FRAC_CONST(0.032052695723232) }, - { FRAC_CONST(0.003675479725661), FRAC_CONST(0.032064895375674) }, - { FRAC_CONST(0.003570528107494), FRAC_CONST(0.032076751638847) }, - { FRAC_CONST(0.003465538251839), FRAC_CONST(0.032088264385780) }, - { FRAC_CONST(0.003360511283053), FRAC_CONST(0.032099433493181) }, - { FRAC_CONST(0.003255448325892), FRAC_CONST(0.032110258841438) }, - { FRAC_CONST(0.003150350505494), FRAC_CONST(0.032120740314619) }, - { FRAC_CONST(0.003045218947373), FRAC_CONST(0.032130877800478) }, - { FRAC_CONST(0.002940054777404), FRAC_CONST(0.032140671190449) }, - { FRAC_CONST(0.002834859121810), FRAC_CONST(0.032150120379653) }, - { FRAC_CONST(0.002729633107153), FRAC_CONST(0.032159225266897) }, - { FRAC_CONST(0.002624377860318), FRAC_CONST(0.032167985754674) }, - { FRAC_CONST(0.002519094508504), FRAC_CONST(0.032176401749168) }, - { FRAC_CONST(0.002413784179212), FRAC_CONST(0.032184473160250) }, - { FRAC_CONST(0.002308448000231), FRAC_CONST(0.032192199901481) }, - { FRAC_CONST(0.002203087099626), FRAC_CONST(0.032199581890114) }, - { FRAC_CONST(0.002097702605728), FRAC_CONST(0.032206619047093) }, - { FRAC_CONST(0.001992295647121), FRAC_CONST(0.032213311297057) }, - { FRAC_CONST(0.001886867352628), FRAC_CONST(0.032219658568338) }, - { FRAC_CONST(0.001781418851302), FRAC_CONST(0.032225660792960) }, - { FRAC_CONST(0.001675951272410), FRAC_CONST(0.032231317906644) }, - { FRAC_CONST(0.001570465745428), FRAC_CONST(0.032236629848809) }, - { FRAC_CONST(0.001464963400018), FRAC_CONST(0.032241596562566) }, - { FRAC_CONST(0.001359445366028), FRAC_CONST(0.032246217994727) }, - { FRAC_CONST(0.001253912773470), FRAC_CONST(0.032250494095799) }, - { FRAC_CONST(0.001148366752513), FRAC_CONST(0.032254424819990) }, - { FRAC_CONST(0.001042808433471), FRAC_CONST(0.032258010125204) }, - { FRAC_CONST(0.000937238946789), FRAC_CONST(0.032261249973045) }, - { FRAC_CONST(0.000831659423030), FRAC_CONST(0.032264144328817) }, - { FRAC_CONST(0.000726070992868), FRAC_CONST(0.032266693161525) }, - { FRAC_CONST(0.000620474787068), FRAC_CONST(0.032268896443871) }, - { FRAC_CONST(0.000514871936481), FRAC_CONST(0.032270754152261) }, - { FRAC_CONST(0.000409263572030), FRAC_CONST(0.032272266266801) }, - { FRAC_CONST(0.000303650824695), FRAC_CONST(0.032273432771295) }, - { FRAC_CONST(0.000198034825504), FRAC_CONST(0.032274253653254) }, - { FRAC_CONST(0.000092416705518), FRAC_CONST(0.032274728903884) } -}; - -#ifdef LD_DEC -/* 240 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_960[] = -{ - { FRAC_CONST(0.045643531183573), FRAC_CONST(0.000037342034959) }, - { FRAC_CONST(0.045642309173789), FRAC_CONST(0.000336075315362) }, - { FRAC_CONST(0.045639131999390), FRAC_CONST(0.000634794199417) }, - { FRAC_CONST(0.045633999796474), FRAC_CONST(0.000933485891002) }, - { FRAC_CONST(0.045626912784890), FRAC_CONST(0.001232137595157) }, - { FRAC_CONST(0.045617871268219), FRAC_CONST(0.001530736518639) }, - { FRAC_CONST(0.045606875633772), FRAC_CONST(0.001829269870464) }, - { FRAC_CONST(0.045593926352564), FRAC_CONST(0.002127724862455) }, - { FRAC_CONST(0.045579023979299), FRAC_CONST(0.002426088709795) }, - { FRAC_CONST(0.045562169152346), FRAC_CONST(0.002724348631569) }, - { FRAC_CONST(0.045543362593709), FRAC_CONST(0.003022491851315) }, - { FRAC_CONST(0.045522605108999), FRAC_CONST(0.003320505597570) }, - { FRAC_CONST(0.045499897587396), FRAC_CONST(0.003618377104416) }, - { FRAC_CONST(0.045475241001617), FRAC_CONST(0.003916093612031) }, - { FRAC_CONST(0.045448636407866), FRAC_CONST(0.004213642367228) }, - { FRAC_CONST(0.045420084945797), FRAC_CONST(0.004511010624011) }, - { FRAC_CONST(0.045389587838458), FRAC_CONST(0.004808185644112) }, - { FRAC_CONST(0.045357146392244), FRAC_CONST(0.005105154697544) }, - { FRAC_CONST(0.045322761996840), FRAC_CONST(0.005401905063139) }, - { FRAC_CONST(0.045286436125157), FRAC_CONST(0.005698424029100) }, - { FRAC_CONST(0.045248170333275), FRAC_CONST(0.005994698893542) }, - { FRAC_CONST(0.045207966260374), FRAC_CONST(0.006290716965035) }, - { FRAC_CONST(0.045165825628663), FRAC_CONST(0.006586465563151) }, - { FRAC_CONST(0.045121750243305), FRAC_CONST(0.006881932019003) }, - { FRAC_CONST(0.045075741992343), FRAC_CONST(0.007177103675792) }, - { FRAC_CONST(0.045027802846618), FRAC_CONST(0.007471967889347) }, - { FRAC_CONST(0.044977934859683), FRAC_CONST(0.007766512028667) }, - { FRAC_CONST(0.044926140167717), FRAC_CONST(0.008060723476460) }, - { FRAC_CONST(0.044872420989432), FRAC_CONST(0.008354589629687) }, - { FRAC_CONST(0.044816779625979), FRAC_CONST(0.008648097900101) }, - { FRAC_CONST(0.044759218460849), FRAC_CONST(0.008941235714784) }, - { FRAC_CONST(0.044699739959770), FRAC_CONST(0.009233990516688) }, - { FRAC_CONST(0.044638346670603), FRAC_CONST(0.009526349765171) }, - { FRAC_CONST(0.044575041223233), FRAC_CONST(0.009818300936537) }, - { FRAC_CONST(0.044509826329454), FRAC_CONST(0.010109831524568) }, - { FRAC_CONST(0.044442704782856), FRAC_CONST(0.010400929041064) }, - { FRAC_CONST(0.044373679458701), FRAC_CONST(0.010691581016378) }, - { FRAC_CONST(0.044302753313806), FRAC_CONST(0.010981774999945) }, - { FRAC_CONST(0.044229929386409), FRAC_CONST(0.011271498560822) }, - { FRAC_CONST(0.044155210796046), FRAC_CONST(0.011560739288214) }, - { FRAC_CONST(0.044078600743413), FRAC_CONST(0.011849484792012) }, - { FRAC_CONST(0.044000102510229), FRAC_CONST(0.012137722703321) }, - { FRAC_CONST(0.043919719459097), FRAC_CONST(0.012425440674986) }, - { FRAC_CONST(0.043837455033359), FRAC_CONST(0.012712626382127) }, - { FRAC_CONST(0.043753312756950), FRAC_CONST(0.012999267522665) }, - { FRAC_CONST(0.043667296234245), FRAC_CONST(0.013285351817848) }, - { FRAC_CONST(0.043579409149906), FRAC_CONST(0.013570867012776) }, - { FRAC_CONST(0.043489655268722), FRAC_CONST(0.013855800876928) }, - { FRAC_CONST(0.043398038435451), FRAC_CONST(0.014140141204686) }, - { FRAC_CONST(0.043304562574653), FRAC_CONST(0.014423875815857) }, - { FRAC_CONST(0.043209231690524), FRAC_CONST(0.014706992556195) }, - { FRAC_CONST(0.043112049866720), FRAC_CONST(0.014989479297920) }, - { FRAC_CONST(0.043013021266188), FRAC_CONST(0.015271323940241) }, - { FRAC_CONST(0.042912150130984), FRAC_CONST(0.015552514409871) }, - { FRAC_CONST(0.042809440782090), FRAC_CONST(0.015833038661547) }, - { FRAC_CONST(0.042704897619235), FRAC_CONST(0.016112884678543) }, - { FRAC_CONST(0.042598525120698), FRAC_CONST(0.016392040473187) }, - { FRAC_CONST(0.042490327843124), FRAC_CONST(0.016670494087374) }, - { FRAC_CONST(0.042380310421324), FRAC_CONST(0.016948233593079) }, - { FRAC_CONST(0.042268477568078), FRAC_CONST(0.017225247092864) }, - { FRAC_CONST(0.042154834073934), FRAC_CONST(0.017501522720393) }, - { FRAC_CONST(0.042039384807000), FRAC_CONST(0.017777048640940) }, - { FRAC_CONST(0.041922134712739), FRAC_CONST(0.018051813051888) }, - { FRAC_CONST(0.041803088813754), FRAC_CONST(0.018325804183247) }, - { FRAC_CONST(0.041682252209576), FRAC_CONST(0.018599010298148) }, - { FRAC_CONST(0.041559630076443), FRAC_CONST(0.018871419693350) }, - { FRAC_CONST(0.041435227667079), FRAC_CONST(0.019143020699741) }, - { FRAC_CONST(0.041309050310468), FRAC_CONST(0.019413801682838) }, - { FRAC_CONST(0.041181103411629), FRAC_CONST(0.019683751043285) }, - { FRAC_CONST(0.041051392451382), FRAC_CONST(0.019952857217350) }, - { FRAC_CONST(0.040919922986111), FRAC_CONST(0.020221108677421) }, - { FRAC_CONST(0.040786700647532), FRAC_CONST(0.020488493932496) }, - { FRAC_CONST(0.040651731142446), FRAC_CONST(0.020755001528683) }, - { FRAC_CONST(0.040515020252497), FRAC_CONST(0.021020620049682) }, - { FRAC_CONST(0.040376573833925), FRAC_CONST(0.021285338117280) }, - { FRAC_CONST(0.040236397817314), FRAC_CONST(0.021549144391836) }, - { FRAC_CONST(0.040094498207337), FRAC_CONST(0.021812027572768) }, - { FRAC_CONST(0.039950881082502), FRAC_CONST(0.022073976399034) }, - { FRAC_CONST(0.039805552594888), FRAC_CONST(0.022334979649620) }, - { FRAC_CONST(0.039658518969884), FRAC_CONST(0.022595026144014) }, - { FRAC_CONST(0.039509786505922), FRAC_CONST(0.022854104742690) }, - { FRAC_CONST(0.039359361574204), FRAC_CONST(0.023112204347583) }, - { FRAC_CONST(0.039207250618434), FRAC_CONST(0.023369313902565) }, - { FRAC_CONST(0.039053460154540), FRAC_CONST(0.023625422393919) }, - { FRAC_CONST(0.038897996770393), FRAC_CONST(0.023880518850809) }, - { FRAC_CONST(0.038740867125527), FRAC_CONST(0.024134592345752) }, - { FRAC_CONST(0.038582077950852), FRAC_CONST(0.024387631995085) }, - { FRAC_CONST(0.038421636048370), FRAC_CONST(0.024639626959432) }, - { FRAC_CONST(0.038259548290876), FRAC_CONST(0.024890566444167) }, - { FRAC_CONST(0.038095821621671), FRAC_CONST(0.025140439699877) }, - { FRAC_CONST(0.037930463054261), FRAC_CONST(0.025389236022825) }, - { FRAC_CONST(0.037763479672055), FRAC_CONST(0.025636944755403) }, - { FRAC_CONST(0.037594878628068), FRAC_CONST(0.025883555286595) }, - { FRAC_CONST(0.037424667144605), FRAC_CONST(0.026129057052425) }, - { FRAC_CONST(0.037252852512960), FRAC_CONST(0.026373439536415) }, - { FRAC_CONST(0.037079442093102), FRAC_CONST(0.026616692270033) }, - { FRAC_CONST(0.036904443313354), FRAC_CONST(0.026858804833142) }, - { FRAC_CONST(0.036727863670081), FRAC_CONST(0.027099766854444) }, - { FRAC_CONST(0.036549710727369), FRAC_CONST(0.027339568011930) }, - { FRAC_CONST(0.036369992116697), FRAC_CONST(0.027578198033315) }, - { FRAC_CONST(0.036188715536611), FRAC_CONST(0.027815646696484) }, - { FRAC_CONST(0.036005888752396), FRAC_CONST(0.028051903829926) }, - { FRAC_CONST(0.035821519595745), FRAC_CONST(0.028286959313171) }, - { FRAC_CONST(0.035635615964417), FRAC_CONST(0.028520803077226) }, - { FRAC_CONST(0.035448185821906), FRAC_CONST(0.028753425105002) }, - { FRAC_CONST(0.035259237197095), FRAC_CONST(0.028984815431745) }, - { FRAC_CONST(0.035068778183914), FRAC_CONST(0.029214964145465) }, - { FRAC_CONST(0.034876816940994), FRAC_CONST(0.029443861387355) }, - { FRAC_CONST(0.034683361691315), FRAC_CONST(0.029671497352220) }, - { FRAC_CONST(0.034488420721856), FRAC_CONST(0.029897862288892) }, - { FRAC_CONST(0.034292002383240), FRAC_CONST(0.030122946500652) }, - { FRAC_CONST(0.034094115089375), FRAC_CONST(0.030346740345641) }, - { FRAC_CONST(0.033894767317093), FRAC_CONST(0.030569234237276) }, - { FRAC_CONST(0.033693967605790), FRAC_CONST(0.030790418644658) }, - { FRAC_CONST(0.033491724557057), FRAC_CONST(0.031010284092984) }, - { FRAC_CONST(0.033288046834313), FRAC_CONST(0.031228821163949) }, - { FRAC_CONST(0.033082943162434), FRAC_CONST(0.031446020496153) }, - { FRAC_CONST(0.032876422327378), FRAC_CONST(0.031661872785500) }, - { FRAC_CONST(0.032668493175811), FRAC_CONST(0.031876368785596) }, - { FRAC_CONST(0.032459164614726), FRAC_CONST(0.032089499308145) }, - { FRAC_CONST(0.032248445611061), FRAC_CONST(0.032301255223347) }, - { FRAC_CONST(0.032036345191317), FRAC_CONST(0.032511627460281) }, - { FRAC_CONST(0.031822872441171), FRAC_CONST(0.032720607007302) }, - { FRAC_CONST(0.031608036505083), FRAC_CONST(0.032928184912422) }, - { FRAC_CONST(0.031391846585912), FRAC_CONST(0.033134352283693) }, - { FRAC_CONST(0.031174311944513), FRAC_CONST(0.033339100289593) }, - { FRAC_CONST(0.030955441899347), FRAC_CONST(0.033542420159397) }, - { FRAC_CONST(0.030735245826077), FRAC_CONST(0.033744303183559) }, - { FRAC_CONST(0.030513733157171), FRAC_CONST(0.033944740714083) }, - { FRAC_CONST(0.030290913381494), FRAC_CONST(0.034143724164891) }, - { FRAC_CONST(0.030066796043904), FRAC_CONST(0.034341245012195) }, - { FRAC_CONST(0.029841390744841), FRAC_CONST(0.034537294794860) }, - { FRAC_CONST(0.029614707139919), FRAC_CONST(0.034731865114764) }, - { FRAC_CONST(0.029386754939508), FRAC_CONST(0.034924947637164) }, - { FRAC_CONST(0.029157543908322), FRAC_CONST(0.035116534091046) }, - { FRAC_CONST(0.028927083864999), FRAC_CONST(0.035306616269485) }, - { FRAC_CONST(0.028695384681680), FRAC_CONST(0.035495186029992) }, - { FRAC_CONST(0.028462456283587), FRAC_CONST(0.035682235294866) }, - { FRAC_CONST(0.028228308648598), FRAC_CONST(0.035867756051541) }, - { FRAC_CONST(0.027992951806817), FRAC_CONST(0.036051740352923) }, - { FRAC_CONST(0.027756395840148), FRAC_CONST(0.036234180317738) }, - { FRAC_CONST(0.027518650881862), FRAC_CONST(0.036415068130865) }, - { FRAC_CONST(0.027279727116161), FRAC_CONST(0.036594396043672) }, - { FRAC_CONST(0.027039634777745), FRAC_CONST(0.036772156374348) }, - { FRAC_CONST(0.026798384151369), FRAC_CONST(0.036948341508233) }, - { FRAC_CONST(0.026555985571409), FRAC_CONST(0.037122943898140) }, - { FRAC_CONST(0.026312449421412), FRAC_CONST(0.037295956064686) }, - { FRAC_CONST(0.026067786133656), FRAC_CONST(0.037467370596605) }, - { FRAC_CONST(0.025822006188702), FRAC_CONST(0.037637180151068) }, - { FRAC_CONST(0.025575120114946), FRAC_CONST(0.037805377454000) }, - { FRAC_CONST(0.025327138488165), FRAC_CONST(0.037971955300388) }, - { FRAC_CONST(0.025078071931066), FRAC_CONST(0.038136906554591) }, - { FRAC_CONST(0.024827931112832), FRAC_CONST(0.038300224150647) }, - { FRAC_CONST(0.024576726748663), FRAC_CONST(0.038461901092573) }, - { FRAC_CONST(0.024324469599317), FRAC_CONST(0.038621930454668) }, - { FRAC_CONST(0.024071170470652), FRAC_CONST(0.038780305381806) }, - { FRAC_CONST(0.023816840213160), FRAC_CONST(0.038937019089732) }, - { FRAC_CONST(0.023561489721501), FRAC_CONST(0.039092064865353) }, - { FRAC_CONST(0.023305129934041), FRAC_CONST(0.039245436067023) }, - { FRAC_CONST(0.023047771832380), FRAC_CONST(0.039397126124832) }, - { FRAC_CONST(0.022789426440883), FRAC_CONST(0.039547128540881) }, - { FRAC_CONST(0.022530104826206), FRAC_CONST(0.039695436889566) }, - { FRAC_CONST(0.022269818096825), FRAC_CONST(0.039842044817851) }, - { FRAC_CONST(0.022008577402555), FRAC_CONST(0.039986946045542) }, - { FRAC_CONST(0.021746393934081), FRAC_CONST(0.040130134365550) }, - { FRAC_CONST(0.021483278922467), FRAC_CONST(0.040271603644166) }, - { FRAC_CONST(0.021219243638687), FRAC_CONST(0.040411347821316) }, - { FRAC_CONST(0.020954299393132), FRAC_CONST(0.040549360910825) }, - { FRAC_CONST(0.020688457535133), FRAC_CONST(0.040685637000671) }, - { FRAC_CONST(0.020421729452469), FRAC_CONST(0.040820170253240) }, - { FRAC_CONST(0.020154126570884), FRAC_CONST(0.040952954905576) }, - { FRAC_CONST(0.019885660353596), FRAC_CONST(0.041083985269625) }, - { FRAC_CONST(0.019616342300802), FRAC_CONST(0.041213255732484) }, - { FRAC_CONST(0.019346183949192), FRAC_CONST(0.041340760756635) }, - { FRAC_CONST(0.019075196871451), FRAC_CONST(0.041466494880189) }, - { FRAC_CONST(0.018803392675763), FRAC_CONST(0.041590452717113) }, - { FRAC_CONST(0.018530783005316), FRAC_CONST(0.041712628957466) }, - { FRAC_CONST(0.018257379537800), FRAC_CONST(0.041833018367625) }, - { FRAC_CONST(0.017983193984910), FRAC_CONST(0.041951615790509) }, - { FRAC_CONST(0.017708238091842), FRAC_CONST(0.042068416145797) }, - { FRAC_CONST(0.017432523636792), FRAC_CONST(0.042183414430153) }, - { FRAC_CONST(0.017156062430449), FRAC_CONST(0.042296605717432) }, - { FRAC_CONST(0.016878866315491), FRAC_CONST(0.042407985158896) }, - { FRAC_CONST(0.016600947166078), FRAC_CONST(0.042517547983420) }, - { FRAC_CONST(0.016322316887341), FRAC_CONST(0.042625289497698) }, - { FRAC_CONST(0.016042987414872), FRAC_CONST(0.042731205086442) }, - { FRAC_CONST(0.015762970714219), FRAC_CONST(0.042835290212581) }, - { FRAC_CONST(0.015482278780363), FRAC_CONST(0.042937540417454) }, - { FRAC_CONST(0.015200923637213), FRAC_CONST(0.043037951321002) }, - { FRAC_CONST(0.014918917337087), FRAC_CONST(0.043136518621958) }, - { FRAC_CONST(0.014636271960196), FRAC_CONST(0.043233238098025) }, - { FRAC_CONST(0.014352999614128), FRAC_CONST(0.043328105606063) }, - { FRAC_CONST(0.014069112433327), FRAC_CONST(0.043421117082265) }, - { FRAC_CONST(0.013784622578575), FRAC_CONST(0.043512268542327) }, - { FRAC_CONST(0.013499542236471), FRAC_CONST(0.043601556081625) }, - { FRAC_CONST(0.013213883618907), FRAC_CONST(0.043688975875378) }, - { FRAC_CONST(0.012927658962548), FRAC_CONST(0.043774524178812) }, - { FRAC_CONST(0.012640880528305), FRAC_CONST(0.043858197327323) }, - { FRAC_CONST(0.012353560600813), FRAC_CONST(0.043939991736633) }, - { FRAC_CONST(0.012065711487901), FRAC_CONST(0.044019903902940) }, - { FRAC_CONST(0.011777345520066), FRAC_CONST(0.044097930403073) }, - { FRAC_CONST(0.011488475049948), FRAC_CONST(0.044174067894638) }, - { FRAC_CONST(0.011199112451794), FRAC_CONST(0.044248313116156) }, - { FRAC_CONST(0.010909270120937), FRAC_CONST(0.044320662887211) }, - { FRAC_CONST(0.010618960473257), FRAC_CONST(0.044391114108577) }, - { FRAC_CONST(0.010328195944653), FRAC_CONST(0.044459663762361) }, - { FRAC_CONST(0.010036988990509), FRAC_CONST(0.044526308912122) }, - { FRAC_CONST(0.009745352085163), FRAC_CONST(0.044591046703005) }, - { FRAC_CONST(0.009453297721368), FRAC_CONST(0.044653874361857) }, - { FRAC_CONST(0.009160838409762), FRAC_CONST(0.044714789197351) }, - { FRAC_CONST(0.008867986678328), FRAC_CONST(0.044773788600099) }, - { FRAC_CONST(0.008574755071860), FRAC_CONST(0.044830870042761) }, - { FRAC_CONST(0.008281156151424), FRAC_CONST(0.044886031080160) }, - { FRAC_CONST(0.007987202493820), FRAC_CONST(0.044939269349379) }, - { FRAC_CONST(0.007692906691044), FRAC_CONST(0.044990582569869) }, - { FRAC_CONST(0.007398281349750), FRAC_CONST(0.045039968543542) }, - { FRAC_CONST(0.007103339090706), FRAC_CONST(0.045087425154868) }, - { FRAC_CONST(0.006808092548258), FRAC_CONST(0.045132950370962) }, - { FRAC_CONST(0.006512554369783), FRAC_CONST(0.045176542241676) }, - { FRAC_CONST(0.006216737215155), FRAC_CONST(0.045218198899680) }, - { FRAC_CONST(0.005920653756196), FRAC_CONST(0.045257918560541) }, - { FRAC_CONST(0.005624316676135), FRAC_CONST(0.045295699522801) }, - { FRAC_CONST(0.005327738669067), FRAC_CONST(0.045331540168049) }, - { FRAC_CONST(0.005030932439406), FRAC_CONST(0.045365438960992) }, - { FRAC_CONST(0.004733910701344), FRAC_CONST(0.045397394449517) }, - { FRAC_CONST(0.004436686178303), FRAC_CONST(0.045427405264758) }, - { FRAC_CONST(0.004139271602393), FRAC_CONST(0.045455470121152) }, - { FRAC_CONST(0.003841679713863), FRAC_CONST(0.045481587816494) }, - { FRAC_CONST(0.003543923260561), FRAC_CONST(0.045505757231988) }, - { FRAC_CONST(0.003246014997382), FRAC_CONST(0.045527977332297) }, - { FRAC_CONST(0.002947967685724), FRAC_CONST(0.045548247165585) }, - { FRAC_CONST(0.002649794092941), FRAC_CONST(0.045566565863562) }, - { FRAC_CONST(0.002351506991799), FRAC_CONST(0.045582932641515) }, - { FRAC_CONST(0.002053119159924), FRAC_CONST(0.045597346798344) }, - { FRAC_CONST(0.001754643379257), FRAC_CONST(0.045609807716597) }, - { FRAC_CONST(0.001456092435508), FRAC_CONST(0.045620314862489) }, - { FRAC_CONST(0.001157479117605), FRAC_CONST(0.045628867785927) }, - { FRAC_CONST(0.000858816217149), FRAC_CONST(0.045635466120535) }, - { FRAC_CONST(0.000560116527865), FRAC_CONST(0.045640109583661) }, - { FRAC_CONST(0.000261392845053), FRAC_CONST(0.045642797976394) } -}; -#endif // LD_DEC - -/* 60 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_240[] = -{ - { FRAC_CONST(0.091286604111815), FRAC_CONST(0.000298735779793) }, - { FRAC_CONST(0.091247502481454), FRAC_CONST(0.002688238127538) }, - { FRAC_CONST(0.091145864370807), FRAC_CONST(0.005075898091152) }, - { FRAC_CONST(0.090981759437558), FRAC_CONST(0.007460079287760) }, - { FRAC_CONST(0.090755300151030), FRAC_CONST(0.009839147718664) }, - { FRAC_CONST(0.090466641715108), FRAC_CONST(0.012211472889198) }, - { FRAC_CONST(0.090115981961863), FRAC_CONST(0.014575428926191) }, - { FRAC_CONST(0.089703561215976), FRAC_CONST(0.016929395692256) }, - { FRAC_CONST(0.089229662130024), FRAC_CONST(0.019271759896156) }, - { FRAC_CONST(0.088694609490769), FRAC_CONST(0.021600916198470) }, - { FRAC_CONST(0.088098769996564), FRAC_CONST(0.023915268311810) }, - { FRAC_CONST(0.087442552006035), FRAC_CONST(0.026213230094844) }, - { FRAC_CONST(0.086726405258214), FRAC_CONST(0.028493226639351) }, - { FRAC_CONST(0.085950820564309), FRAC_CONST(0.030753695349588) }, - { FRAC_CONST(0.085116329471329), FRAC_CONST(0.032993087013213) }, - { FRAC_CONST(0.084223503897785), FRAC_CONST(0.035209866863042) }, - { FRAC_CONST(0.083272955741727), FRAC_CONST(0.037402515628894) }, - { FRAC_CONST(0.082265336461381), FRAC_CONST(0.039569530578832) }, - { FRAC_CONST(0.081201336628670), FRAC_CONST(0.041709426549053) }, - { FRAC_CONST(0.080081685455930), FRAC_CONST(0.043820736961749) }, - { FRAC_CONST(0.078907150296148), FRAC_CONST(0.045902014830227) }, - { FRAC_CONST(0.077678536117054), FRAC_CONST(0.047951833750597) }, - { FRAC_CONST(0.076396684949434), FRAC_CONST(0.049968788879362) }, - { FRAC_CONST(0.075062475310050), FRAC_CONST(0.051951497896226) }, - { FRAC_CONST(0.073676821599542), FRAC_CONST(0.053898601951466) }, - { FRAC_CONST(0.072240673475749), FRAC_CONST(0.055808766597225) }, - { FRAC_CONST(0.070755015202858), FRAC_CONST(0.057680682702068) }, - { FRAC_CONST(0.069220864976840), FRAC_CONST(0.059513067348201) }, - { FRAC_CONST(0.067639274227625), FRAC_CONST(0.061304664710718) }, - { FRAC_CONST(0.066011326898512), FRAC_CONST(0.063054246918278) }, - { FRAC_CONST(0.064338138703282), FRAC_CONST(0.064760614894630) }, - { FRAC_CONST(0.062620856361546), FRAC_CONST(0.066422599180399) }, - { FRAC_CONST(0.060860656812842), FRAC_CONST(0.068039060734572) }, - { FRAC_CONST(0.059058746410016), FRAC_CONST(0.069608891715145) }, - { FRAC_CONST(0.057216360092450), FRAC_CONST(0.071131016238378) }, - { FRAC_CONST(0.055334760539699), FRAC_CONST(0.072604391116154) }, - { FRAC_CONST(0.053415237306106), FRAC_CONST(0.074028006570930) }, - { FRAC_CONST(0.051459105937014), FRAC_CONST(0.075400886927784) }, - { FRAC_CONST(0.049467707067153), FRAC_CONST(0.076722091283096) }, - { FRAC_CONST(0.047442405501835), FRAC_CONST(0.077990714149396) }, - { FRAC_CONST(0.045384589281588), FRAC_CONST(0.079205886075941) }, - { FRAC_CONST(0.043295668730857), FRAC_CONST(0.080366774244592) }, - { FRAC_CONST(0.041177075491445), FRAC_CONST(0.081472583040586) }, - { FRAC_CONST(0.039030261541332), FRAC_CONST(0.082522554597810) }, - { FRAC_CONST(0.036856698199564), FRAC_CONST(0.083515969318206) }, - { FRAC_CONST(0.034657875117883), FRAC_CONST(0.084452146364948) }, - { FRAC_CONST(0.032435299259796), FRAC_CONST(0.085330444129049) }, - { FRAC_CONST(0.030190493867775), FRAC_CONST(0.086150260669096) }, - { FRAC_CONST(0.027924997419306), FRAC_CONST(0.086911034123781) }, - { FRAC_CONST(0.025640362572491), FRAC_CONST(0.087612243096981) }, - { FRAC_CONST(0.023338155101933), FRAC_CONST(0.088253407015092) }, - { FRAC_CONST(0.021019952825636), FRAC_CONST(0.088834086456390) }, - { FRAC_CONST(0.018687344523641), FRAC_CONST(0.089353883452193) }, - { FRAC_CONST(0.016341928849164), FRAC_CONST(0.089812441759604) }, - { FRAC_CONST(0.013985313232951), FRAC_CONST(0.090209447105664) }, - { FRAC_CONST(0.011619112781631), FRAC_CONST(0.090544627402740) }, - { FRAC_CONST(0.009244949170797), FRAC_CONST(0.090817752935000) }, - { FRAC_CONST(0.006864449533597), FRAC_CONST(0.091028636515846) }, - { FRAC_CONST(0.004479245345574), FRAC_CONST(0.091177133616206) }, - { FRAC_CONST(0.002090971306534), FRAC_CONST(0.091263142463585) } -}; -#endif // ALLOW_SMALL_FRAMELENGTH - -#ifdef SSR_DEC -/* 128 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_512[] = -{ - { FRAC_CONST(0.062499926465731), FRAC_CONST(0.000095873761643) }, - { FRAC_CONST(0.062494043817678), FRAC_CONST(0.000862836783004) }, - { FRAC_CONST(0.062478749796497), FRAC_CONST(0.001629669864319) }, - { FRAC_CONST(0.062454046705412), FRAC_CONST(0.002396257523347) }, - { FRAC_CONST(0.062419938264617), FRAC_CONST(0.003162484314806) }, - { FRAC_CONST(0.062376429610718), FRAC_CONST(0.003928234847760) }, - { FRAC_CONST(0.062323527295958), FRAC_CONST(0.004693393802995) }, - { FRAC_CONST(0.062261239287231), FRAC_CONST(0.005457845950387) }, - { FRAC_CONST(0.062189574964882), FRAC_CONST(0.006221476166254) }, - { FRAC_CONST(0.062108545121295), FRAC_CONST(0.006984169450695) }, - { FRAC_CONST(0.062018161959266), FRAC_CONST(0.007745810944907) }, - { FRAC_CONST(0.061918439090167), FRAC_CONST(0.008506285948482) }, - { FRAC_CONST(0.061809391531894), FRAC_CONST(0.009265479936681) }, - { FRAC_CONST(0.061691035706609), FRAC_CONST(0.010023278577683) }, - { FRAC_CONST(0.061563389438265), FRAC_CONST(0.010779567749800) }, - { FRAC_CONST(0.061426471949919), FRAC_CONST(0.011534233558664) }, - { FRAC_CONST(0.061280303860842), FRAC_CONST(0.012287162354380) }, - { FRAC_CONST(0.061124907183410), FRAC_CONST(0.013038240748641) }, - { FRAC_CONST(0.060960305319791), FRAC_CONST(0.013787355631805) }, - { FRAC_CONST(0.060786523058421), FRAC_CONST(0.014534394189923) }, - { FRAC_CONST(0.060603586570268), FRAC_CONST(0.015279243921739) }, - { FRAC_CONST(0.060411523404896), FRAC_CONST(0.016021792655621) }, - { FRAC_CONST(0.060210362486310), FRAC_CONST(0.016761928566463) }, - { FRAC_CONST(0.060000134108604), FRAC_CONST(0.017499540192517) }, - { FRAC_CONST(0.059780869931400), FRAC_CONST(0.018234516452187) }, - { FRAC_CONST(0.059552602975075), FRAC_CONST(0.018966746660751) }, - { FRAC_CONST(0.059315367615794), FRAC_CONST(0.019696120547033) }, - { FRAC_CONST(0.059069199580329), FRAC_CONST(0.020422528270008) }, - { FRAC_CONST(0.058814135940681), FRAC_CONST(0.021145860435346) }, - { FRAC_CONST(0.058550215108495), FRAC_CONST(0.021866008111883) }, - { FRAC_CONST(0.058277476829279), FRAC_CONST(0.022582862848028) }, - { FRAC_CONST(0.057995962176414), FRAC_CONST(0.023296316688095) }, - { FRAC_CONST(0.057705713544970), FRAC_CONST(0.024006262188558) }, - { FRAC_CONST(0.057406774645326), FRAC_CONST(0.024712592434239) }, - { FRAC_CONST(0.057099190496578), FRAC_CONST(0.025415201054398) }, - { FRAC_CONST(0.056783007419769), FRAC_CONST(0.026113982238763) }, - { FRAC_CONST(0.056458273030907), FRAC_CONST(0.026808830753458) }, - { FRAC_CONST(0.056125036233796), FRAC_CONST(0.027499641956852) }, - { FRAC_CONST(0.055783347212673), FRAC_CONST(0.028186311815319) }, - { FRAC_CONST(0.055433257424646), FRAC_CONST(0.028868736918904) }, - { FRAC_CONST(0.055074819591951), FRAC_CONST(0.029546814496896) }, - { FRAC_CONST(0.054708087694007), FRAC_CONST(0.030220442433307) }, - { FRAC_CONST(0.054333116959288), FRAC_CONST(0.030889519282247) }, - { FRAC_CONST(0.053949963857008), FRAC_CONST(0.031553944283204) }, - { FRAC_CONST(0.053558686088614), FRAC_CONST(0.032213617376216) }, - { FRAC_CONST(0.053159342579100), FRAC_CONST(0.032868439216943) }, - { FRAC_CONST(0.052751993468129), FRAC_CONST(0.033518311191623) }, - { FRAC_CONST(0.052336700100979), FRAC_CONST(0.034163135431927) }, - { FRAC_CONST(0.051913525019303), FRAC_CONST(0.034802814829698) }, - { FRAC_CONST(0.051482531951712), FRAC_CONST(0.035437253051569) }, - { FRAC_CONST(0.051043785804177), FRAC_CONST(0.036066354553480) }, - { FRAC_CONST(0.050597352650253), FRAC_CONST(0.036690024595057) }, - { FRAC_CONST(0.050143299721132), FRAC_CONST(0.037308169253887) }, - { FRAC_CONST(0.049681695395515), FRAC_CONST(0.037920695439658) }, - { FRAC_CONST(0.049212609189314), FRAC_CONST(0.038527510908178) }, - { FRAC_CONST(0.048736111745188), FRAC_CONST(0.039128524275271) }, - { FRAC_CONST(0.048252274821899), FRAC_CONST(0.039723645030535) }, - { FRAC_CONST(0.047761171283507), FRAC_CONST(0.040312783550971) }, - { FRAC_CONST(0.047262875088400), FRAC_CONST(0.040895851114488) }, - { FRAC_CONST(0.046757461278150), FRAC_CONST(0.041472759913252) }, - { FRAC_CONST(0.046245005966220), FRAC_CONST(0.042043423066923) }, - { FRAC_CONST(0.045725586326493), FRAC_CONST(0.042607754635728) }, - { FRAC_CONST(0.045199280581658), FRAC_CONST(0.043165669633408) }, - { FRAC_CONST(0.044666167991423), FRAC_CONST(0.043717084040018) }, - { FRAC_CONST(0.044126328840584), FRAC_CONST(0.044261914814575) }, - { FRAC_CONST(0.043579844426930), FRAC_CONST(0.044800079907569) }, - { FRAC_CONST(0.043026797049006), FRAC_CONST(0.045331498273316) }, - { FRAC_CONST(0.042467269993710), FRAC_CONST(0.045856089882166) }, - { FRAC_CONST(0.041901347523761), FRAC_CONST(0.046373775732552) }, - { FRAC_CONST(0.041329114865000), FRAC_CONST(0.046884477862888) }, - { FRAC_CONST(0.040750658193560), FRAC_CONST(0.047388119363313) }, - { FRAC_CONST(0.040166064622889), FRAC_CONST(0.047884624387270) }, - { FRAC_CONST(0.039575422190629), FRAC_CONST(0.048373918162926) }, - { FRAC_CONST(0.038978819845356), FRAC_CONST(0.048855927004441) }, - { FRAC_CONST(0.038376347433190), FRAC_CONST(0.049330578323055) }, - { FRAC_CONST(0.037768095684260), FRAC_CONST(0.049797800638026) }, - { FRAC_CONST(0.037154156199042), FRAC_CONST(0.050257523587392) }, - { FRAC_CONST(0.036534621434563), FRAC_CONST(0.050709677938566) }, - { FRAC_CONST(0.035909584690482), FRAC_CONST(0.051154195598769) }, - { FRAC_CONST(0.035279140095032), FRAC_CONST(0.051591009625274) }, - { FRAC_CONST(0.034643382590851), FRAC_CONST(0.052020054235496) }, - { FRAC_CONST(0.034002407920680), FRAC_CONST(0.052441264816895) }, - { FRAC_CONST(0.033356312612947), FRAC_CONST(0.052854577936706) }, - { FRAC_CONST(0.032705193967229), FRAC_CONST(0.053259931351495) }, - { FRAC_CONST(0.032049150039598), FRAC_CONST(0.053657264016528) }, - { FRAC_CONST(0.031388279627857), FRAC_CONST(0.054046516094966) }, - { FRAC_CONST(0.030722682256659), FRAC_CONST(0.054427628966880) }, - { FRAC_CONST(0.030052458162521), FRAC_CONST(0.054800545238072) }, - { FRAC_CONST(0.029377708278725), FRAC_CONST(0.055165208748723) }, - { FRAC_CONST(0.028698534220122), FRAC_CONST(0.055521564581850) }, - { FRAC_CONST(0.028015038267826), FRAC_CONST(0.055869559071575) }, - { FRAC_CONST(0.027327323353815), FRAC_CONST(0.056209139811209) }, - { FRAC_CONST(0.026635493045425), FRAC_CONST(0.056540255661140) }, - { FRAC_CONST(0.025939651529755), FRAC_CONST(0.056862856756541) }, - { FRAC_CONST(0.025239903597978), FRAC_CONST(0.057176894514872) }, - { FRAC_CONST(0.024536354629559), FRAC_CONST(0.057482321643202) }, - { FRAC_CONST(0.023829110576385), FRAC_CONST(0.057779092145329) }, - { FRAC_CONST(0.023118277946808), FRAC_CONST(0.058067161328707) }, - { FRAC_CONST(0.022403963789609), FRAC_CONST(0.058346485811177) }, - { FRAC_CONST(0.021686275677870), FRAC_CONST(0.058617023527499) }, - { FRAC_CONST(0.020965321692783), FRAC_CONST(0.058878733735689) }, - { FRAC_CONST(0.020241210407366), FRAC_CONST(0.059131577023150) }, - { FRAC_CONST(0.019514050870114), FRAC_CONST(0.059375515312615) }, - { FRAC_CONST(0.018783952588580), FRAC_CONST(0.059610511867874) }, - { FRAC_CONST(0.018051025512878), FRAC_CONST(0.059836531299311) }, - { FRAC_CONST(0.017315380019131), FRAC_CONST(0.060053539569230) }, - { FRAC_CONST(0.016577126892844), FRAC_CONST(0.060261503996984) }, - { FRAC_CONST(0.015836377312223), FRAC_CONST(0.060460393263896) }, - { FRAC_CONST(0.015093242831429), FRAC_CONST(0.060650177417972) }, - { FRAC_CONST(0.014347835363782), FRAC_CONST(0.060830827878419) }, - { FRAC_CONST(0.013600267164905), FRAC_CONST(0.061002317439940) }, - { FRAC_CONST(0.012850650815819), FRAC_CONST(0.061164620276839) }, - { FRAC_CONST(0.012099099205988), FRAC_CONST(0.061317711946905) }, - { FRAC_CONST(0.011345725516320), FRAC_CONST(0.061461569395097) }, - { FRAC_CONST(0.010590643202123), FRAC_CONST(0.061596170957011) }, - { FRAC_CONST(0.009833965976015), FRAC_CONST(0.061721496362147) }, - { FRAC_CONST(0.009075807790803), FRAC_CONST(0.061837526736961) }, - { FRAC_CONST(0.008316282822321), FRAC_CONST(0.061944244607705) }, - { FRAC_CONST(0.007555505452236), FRAC_CONST(0.062041633903059) }, - { FRAC_CONST(0.006793590250821), FRAC_CONST(0.062129679956555) }, - { FRAC_CONST(0.006030651959703), FRAC_CONST(0.062208369508780) }, - { FRAC_CONST(0.005266805474583), FRAC_CONST(0.062277690709378) }, - { FRAC_CONST(0.004502165827931), FRAC_CONST(0.062337633118830) }, - { FRAC_CONST(0.003736848171665), FRAC_CONST(0.062388187710030) }, - { FRAC_CONST(0.002970967759810), FRAC_CONST(0.062429346869643) }, - { FRAC_CONST(0.002204639931138), FRAC_CONST(0.062461104399250) }, - { FRAC_CONST(0.001437980091802), FRAC_CONST(0.062483455516285) }, - { FRAC_CONST(0.000671103697954), FRAC_CONST(0.062496396854751) } -}; - -/* 16 (N/4) complex twiddle factors */ -ALIGN static const complex_t mdct_tab_64[] = -{ - { FRAC_CONST(0.176763384336599), FRAC_CONST(0.002169321984356) }, - { FRAC_CONST(0.175699589589310), FRAC_CONST(0.019484717553714) }, - { FRAC_CONST(0.172943711747111), FRAC_CONST(0.036612464641599) }, - { FRAC_CONST(0.168522291420137), FRAC_CONST(0.053387613680577) }, - { FRAC_CONST(0.162477909303132), FRAC_CONST(0.069648610815172) }, - { FRAC_CONST(0.154868776100077), FRAC_CONST(0.085238853753814) }, - { FRAC_CONST(0.145768171923295), FRAC_CONST(0.100008199934509) }, - { FRAC_CONST(0.135263740565902), FRAC_CONST(0.113814412479792) }, - { FRAC_CONST(0.123456645444178), FRAC_CONST(0.126524530015608) }, - { FRAC_CONST(0.110460595338559), FRAC_CONST(0.138016147162030) }, - { FRAC_CONST(0.096400749315926), FRAC_CONST(0.148178593363981) }, - { FRAC_CONST(0.081412511379371), FRAC_CONST(0.156913998709178) }, - { FRAC_CONST(0.065640226453626), FRAC_CONST(0.164138236468888) }, - { FRAC_CONST(0.049235790264535), FRAC_CONST(0.169781733284316) }, - { FRAC_CONST(0.032357186500177), FRAC_CONST(0.173790139196080) }, - { FRAC_CONST(0.015166965341583), FRAC_CONST(0.176124851064031) } -}; -#endif // SSR_DEC - -#endif // FIXED_POINT - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/mp4.c b/mplayer/libfaad2/mp4.c deleted file mode 100644 index c25468e4..00000000 --- a/mplayer/libfaad2/mp4.c +++ /dev/null @@ -1,308 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: mp4.c,v 1.32 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#include - -#include "bits.h" -#include "mp4.h" -#include "syntax.h" - -/* defines if an object type can be decoded by this library or not */ -static uint8_t ObjectTypesTable[32] = { - 0, /* 0 NULL */ -#ifdef MAIN_DEC - 1, /* 1 AAC Main */ -#else - 0, /* 1 AAC Main */ -#endif - 1, /* 2 AAC LC */ -#ifdef SSR_DEC - 1, /* 3 AAC SSR */ -#else - 0, /* 3 AAC SSR */ -#endif -#ifdef LTP_DEC - 1, /* 4 AAC LTP */ -#else - 0, /* 4 AAC LTP */ -#endif -#ifdef SBR_DEC - 1, /* 5 SBR */ -#else - 0, /* 5 SBR */ -#endif -#ifdef SCALABLE_DEC - 1, /* 6 AAC Scalable */ -#else - 0, /* 6 AAC Scalable */ -#endif - 0, /* 7 TwinVQ */ - 0, /* 8 CELP */ - 0, /* 9 HVXC */ - 0, /* 10 Reserved */ - 0, /* 11 Reserved */ - 0, /* 12 TTSI */ - 0, /* 13 Main synthetic */ - 0, /* 14 Wavetable synthesis */ - 0, /* 15 General MIDI */ - 0, /* 16 Algorithmic Synthesis and Audio FX */ - - /* MPEG-4 Version 2 */ -#ifdef ERROR_RESILIENCE - 1, /* 17 ER AAC LC */ - 0, /* 18 (Reserved) */ -#ifdef LTP_DEC - 1, /* 19 ER AAC LTP */ -#else - 0, /* 19 ER AAC LTP */ -#endif -#ifdef SCALABLE_DEC - 1, /* 20 ER AAC scalable */ -#else - 0, /* 20 ER AAC scalable */ -#endif - 0, /* 21 ER TwinVQ */ - 0, /* 22 ER BSAC */ -#ifdef LD_DEC - 1, /* 23 ER AAC LD */ -#else - 0, /* 23 ER AAC LD */ -#endif - 0, /* 24 ER CELP */ - 0, /* 25 ER HVXC */ - 0, /* 26 ER HILN */ - 0, /* 27 ER Parametric */ -#else /* No ER defined */ - 0, /* 17 ER AAC LC */ - 0, /* 18 (Reserved) */ - 0, /* 19 ER AAC LTP */ - 0, /* 20 ER AAC scalable */ - 0, /* 21 ER TwinVQ */ - 0, /* 22 ER BSAC */ - 0, /* 23 ER AAC LD */ - 0, /* 24 ER CELP */ - 0, /* 25 ER HVXC */ - 0, /* 26 ER HILN */ - 0, /* 27 ER Parametric */ -#endif - 0, /* 28 (Reserved) */ - 0, /* 29 (Reserved) */ - 0, /* 30 (Reserved) */ - 0 /* 31 (Reserved) */ -}; - -/* Table 1.6.1 */ -int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer, - uint32_t buffer_size, - mp4AudioSpecificConfig *mp4ASC) -{ - return AudioSpecificConfig2(pBuffer, buffer_size, mp4ASC, NULL, 0); -} - -int8_t AudioSpecificConfigFromBitfile(bitfile *ld, - mp4AudioSpecificConfig *mp4ASC, - program_config *pce, uint32_t buffer_size, uint8_t short_form) -{ - int8_t result = 0; - uint32_t startpos = faad_get_processed_bits(ld); -#ifdef SBR_DEC - int8_t bits_to_decode = 0; -#endif - - if (mp4ASC == NULL) - return -8; - - memset(mp4ASC, 0, sizeof(mp4AudioSpecificConfig)); - - mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(ld, 5 - DEBUGVAR(1,1,"parse_audio_decoder_specific_info(): ObjectTypeIndex")); - - mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,2,"parse_audio_decoder_specific_info(): SamplingFrequencyIndex")); - if(mp4ASC->samplingFrequencyIndex==0x0f) - faad_getbits(ld, 24); - - mp4ASC->channelsConfiguration = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,3,"parse_audio_decoder_specific_info(): ChannelsConfiguration")); - - mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex); - - if (ObjectTypesTable[mp4ASC->objectTypeIndex] != 1) - { - return -1; - } - - if (mp4ASC->samplingFrequency == 0) - { - return -2; - } - - if (mp4ASC->channelsConfiguration > 7) - { - return -3; - } - -#if (defined(PS_DEC) || defined(DRM_PS)) - /* check if we have a mono file */ - if (mp4ASC->channelsConfiguration == 1) - { - /* upMatrix to 2 channels for implicit signalling of PS */ - mp4ASC->channelsConfiguration = 2; - } -#endif - -#ifdef SBR_DEC - mp4ASC->sbr_present_flag = -1; - if (mp4ASC->objectTypeIndex == 5) - { - uint8_t tmp; - - mp4ASC->sbr_present_flag = 1; - tmp = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,5,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex")); - /* check for downsampled SBR */ - if (tmp == mp4ASC->samplingFrequencyIndex) - mp4ASC->downSampledSBR = 1; - mp4ASC->samplingFrequencyIndex = tmp; - if (mp4ASC->samplingFrequencyIndex == 15) - { - mp4ASC->samplingFrequency = (uint32_t)faad_getbits(ld, 24 - DEBUGVAR(1,6,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex")); - } else { - mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex); - } - mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(ld, 5 - DEBUGVAR(1,7,"parse_audio_decoder_specific_info(): ObjectTypeIndex")); - } -#endif - - /* get GASpecificConfig */ - if (mp4ASC->objectTypeIndex == 1 || mp4ASC->objectTypeIndex == 2 || - mp4ASC->objectTypeIndex == 3 || mp4ASC->objectTypeIndex == 4 || - mp4ASC->objectTypeIndex == 6 || mp4ASC->objectTypeIndex == 7) - { - result = GASpecificConfig(ld, mp4ASC, pce); - -#ifdef ERROR_RESILIENCE - } else if (mp4ASC->objectTypeIndex >= ER_OBJECT_START) { /* ER */ - result = GASpecificConfig(ld, mp4ASC, pce); - mp4ASC->epConfig = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,143,"parse_audio_decoder_specific_info(): epConfig")); - - if (mp4ASC->epConfig != 0) - result = -5; -#endif - - } else { - result = -4; - } - -#ifdef SSR_DEC - /* shorter frames not allowed for SSR */ - if ((mp4ASC->objectTypeIndex == 4) && mp4ASC->frameLengthFlag) - return -6; -#endif - - -#ifdef SBR_DEC - if(short_form) - bits_to_decode = 0; - else - bits_to_decode = (int8_t)(buffer_size*8 - (startpos-faad_get_processed_bits(ld))); - if ((mp4ASC->objectTypeIndex != 5) && (bits_to_decode >= 16)) - { - int16_t syncExtensionType = (int16_t)faad_getbits(ld, 11 - DEBUGVAR(1,9,"parse_audio_decoder_specific_info(): syncExtensionType")); - - if (syncExtensionType == 0x2b7) - { - mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(ld, 5 - DEBUGVAR(1,10,"parse_audio_decoder_specific_info(): extensionAudioObjectType")); - - if (mp4ASC->objectTypeIndex == 5) - { - mp4ASC->sbr_present_flag = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,11,"parse_audio_decoder_specific_info(): sbr_present_flag")); - - if (mp4ASC->sbr_present_flag) - { - uint8_t tmp; - tmp = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,12,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex")); - - /* check for downsampled SBR */ - if (tmp == mp4ASC->samplingFrequencyIndex) - mp4ASC->downSampledSBR = 1; - mp4ASC->samplingFrequencyIndex = tmp; - - if (mp4ASC->samplingFrequencyIndex == 15) - { - mp4ASC->samplingFrequency = (uint32_t)faad_getbits(ld, 24 - DEBUGVAR(1,13,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex")); - } else { - mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex); - } - } - } - } - } - - /* no SBR signalled, this could mean either implicit signalling or no SBR in this file */ - /* MPEG specification states: assume SBR on files with samplerate <= 24000 Hz */ - if (mp4ASC->sbr_present_flag == -1) - { - if (mp4ASC->samplingFrequency <= 24000) - { - mp4ASC->samplingFrequency *= 2; - mp4ASC->forceUpSampling = 1; - } else /* > 24000*/ { - mp4ASC->downSampledSBR = 1; - } - } -#endif - - return result; -} - -int8_t AudioSpecificConfig2(uint8_t *pBuffer, - uint32_t buffer_size, - mp4AudioSpecificConfig *mp4ASC, - program_config *pce, - uint8_t short_form) -{ - uint8_t ret = 0; - bitfile ld; - faad_initbits(&ld, pBuffer, buffer_size); - faad_byte_align(&ld); - ret = AudioSpecificConfigFromBitfile(&ld, mp4ASC, pce, buffer_size, short_form); - faad_endbits(&ld); - return ret; -} - diff --git a/mplayer/libfaad2/mp4.h b/mplayer/libfaad2/mp4.h deleted file mode 100644 index 9c224aa8..00000000 --- a/mplayer/libfaad2/mp4.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: mp4.h,v 1.21 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __MP4_H__ -#define __MP4_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "bits.h" -#include "decoder.h" - -int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer, - uint32_t buffer_size, - mp4AudioSpecificConfig *mp4ASC); - -int8_t AudioSpecificConfig2(uint8_t *pBuffer, - uint32_t buffer_size, - mp4AudioSpecificConfig *mp4ASC, - program_config *pce, uint8_t short_form); - -int8_t AudioSpecificConfigFromBitfile(bitfile *ld, - mp4AudioSpecificConfig *mp4ASC, - program_config *pce, uint32_t bsize, uint8_t short_form); -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/ms.c b/mplayer/libfaad2/ms.c deleted file mode 100644 index 0f671d5e..00000000 --- a/mplayer/libfaad2/ms.c +++ /dev/null @@ -1,74 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: ms.c,v 1.17 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#include "syntax.h" -#include "ms.h" -#include "is.h" -#include "pns.h" - -void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, - uint16_t frame_len) -{ - uint8_t g, b, sfb; - uint8_t group = 0; - uint16_t nshort = frame_len/8; - - uint16_t i, k; - real_t tmp; - - if (ics->ms_mask_present >= 1) - { - for (g = 0; g < ics->num_window_groups; g++) - { - for (b = 0; b < ics->window_group_length[g]; b++) - { - for (sfb = 0; sfb < ics->max_sfb; sfb++) - { - /* If intensity stereo coding or noise substitution is on - for a particular scalefactor band, no M/S stereo decoding - is carried out. - */ - if ((ics->ms_used[g][sfb] || ics->ms_mask_present == 2) && - !is_intensity(icsr, g, sfb) && !is_noise(ics, g, sfb)) - { - for (i = ics->swb_offset[sfb]; i < ics->swb_offset[sfb+1]; i++) - { - k = (group*nshort) + i; - tmp = l_spec[k] - r_spec[k]; - l_spec[k] = l_spec[k] + r_spec[k]; - r_spec[k] = tmp; - } - } - } - group++; - } - } - } -} diff --git a/mplayer/libfaad2/ms.h b/mplayer/libfaad2/ms.h deleted file mode 100644 index 29915c4d..00000000 --- a/mplayer/libfaad2/ms.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: ms.h,v 1.15 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __MS_H__ -#define __MS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, - uint16_t frame_len); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/neaacdec.h b/mplayer/libfaad2/neaacdec.h deleted file mode 100644 index 9dc74c6b..00000000 --- a/mplayer/libfaad2/neaacdec.h +++ /dev/null @@ -1,254 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: neaacdec.h,v 1.5 2004/09/04 14:56:27 menno Exp $ -**/ - -#ifndef __NEAACDEC_H__ -#define __NEAACDEC_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#if 1 -/* MACROS FOR BACKWARDS COMPATIBILITY */ -/* structs */ -#define faacDecHandle NeAACDecHandle -#define faacDecConfiguration NeAACDecConfiguration -#define faacDecConfigurationPtr NeAACDecConfigurationPtr -#define faacDecFrameInfo NeAACDecFrameInfo -/* functions */ -#define faacDecGetErrorMessage NeAACDecGetErrorMessage -#define faacDecSetConfiguration NeAACDecSetConfiguration -#define faacDecGetCurrentConfiguration NeAACDecGetCurrentConfiguration -#define faacDecInit NeAACDecInit -#define faacDecInit2 NeAACDecInit2 -#define faacDecInitDRM NeAACDecInitDRM -#define faacDecPostSeekReset NeAACDecPostSeekReset -#define faacDecOpen NeAACDecOpen -#define faacDecClose NeAACDecClose -#define faacDecDecode NeAACDecDecode -#define AudioSpecificConfig NeAACDecAudioSpecificConfig -#endif - - -#ifdef _WIN32 - #pragma pack(push, 8) - #ifndef NEAACDECAPI - #define NEAACDECAPI __cdecl - #endif -#else - #ifndef NEAACDECAPI - #define NEAACDECAPI - #endif -#endif - -#define FAAD2_VERSION "2.1 beta" - -/* object types for AAC */ -#define MAIN 1 -#define LC 2 -#define SSR 3 -#define LTP 4 -#define HE_AAC 5 -#define ER_LC 17 -#define ER_LTP 19 -#define LD 23 -#define DRM_ER_LC 27 /* special object type for DRM */ - -/* header types */ -#define RAW 0 -#define ADIF 1 -#define ADTS 2 -#define LATM 3 - -/* SBR signalling */ -#define NO_SBR 0 -#define SBR_UPSAMPLED 1 -#define SBR_DOWNSAMPLED 2 -#define NO_SBR_UPSAMPLED 3 - -/* library output formats */ -#define FAAD_FMT_16BIT 1 -#define FAAD_FMT_24BIT 2 -#define FAAD_FMT_32BIT 3 -#define FAAD_FMT_FLOAT 4 -#define FAAD_FMT_FIXED FAAD_FMT_FLOAT -#define FAAD_FMT_DOUBLE 5 - -/* Capabilities */ -#define LC_DEC_CAP (1<<0) /* Can decode LC */ -#define MAIN_DEC_CAP (1<<1) /* Can decode MAIN */ -#define LTP_DEC_CAP (1<<2) /* Can decode LTP */ -#define LD_DEC_CAP (1<<3) /* Can decode LD */ -#define ERROR_RESILIENCE_CAP (1<<4) /* Can decode ER */ -#define FIXED_POINT_CAP (1<<5) /* Fixed point */ - -/* Channel definitions */ -#define FRONT_CHANNEL_CENTER (1) -#define FRONT_CHANNEL_LEFT (2) -#define FRONT_CHANNEL_RIGHT (3) -#define SIDE_CHANNEL_LEFT (4) -#define SIDE_CHANNEL_RIGHT (5) -#define BACK_CHANNEL_LEFT (6) -#define BACK_CHANNEL_RIGHT (7) -#define BACK_CHANNEL_CENTER (8) -#define LFE_CHANNEL (9) -#define UNKNOWN_CHANNEL (0) - -/* DRM channel definitions */ -#define DRMCH_MONO 1 -#define DRMCH_STEREO 2 -#define DRMCH_SBR_MONO 3 -#define DRMCH_SBR_STEREO 4 -#define DRMCH_SBR_PS_STEREO 5 - - -/* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel, - so at least so much bytes per channel should be available in this stream */ -#define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */ - - -typedef void *NeAACDecHandle; - -typedef struct mp4AudioSpecificConfig -{ - /* Audio Specific Info */ - unsigned char objectTypeIndex; - unsigned char samplingFrequencyIndex; - unsigned long samplingFrequency; - unsigned char channelsConfiguration; - - /* GA Specific Info */ - unsigned char frameLengthFlag; - unsigned char dependsOnCoreCoder; - unsigned short coreCoderDelay; - unsigned char extensionFlag; - unsigned char aacSectionDataResilienceFlag; - unsigned char aacScalefactorDataResilienceFlag; - unsigned char aacSpectralDataResilienceFlag; - unsigned char epConfig; - - char sbr_present_flag; - char forceUpSampling; - char downSampledSBR; -} mp4AudioSpecificConfig; - -typedef struct NeAACDecConfiguration -{ - unsigned char defObjectType; - unsigned long defSampleRate; - unsigned char outputFormat; - unsigned char downMatrix; - unsigned char useOldADTSFormat; - unsigned char dontUpSampleImplicitSBR; -} NeAACDecConfiguration, *NeAACDecConfigurationPtr; - -typedef struct NeAACDecFrameInfo -{ - unsigned long bytesconsumed; - unsigned long samples; - unsigned char channels; - unsigned char error; - unsigned long samplerate; - - /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */ - unsigned char sbr; - - /* MPEG-4 ObjectType */ - unsigned char object_type; - - /* AAC header type; MP4 will be signalled as RAW also */ - unsigned char header_type; - - /* multichannel configuration */ - unsigned char num_front_channels; - unsigned char num_side_channels; - unsigned char num_back_channels; - unsigned char num_lfe_channels; - unsigned char channel_position[64]; - - /* PS: 0: off, 1: on */ - unsigned char ps; -} NeAACDecFrameInfo; - -char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode); - -unsigned long NEAACDECAPI NeAACDecGetCapabilities(void); - -NeAACDecHandle NEAACDECAPI NeAACDecOpen(void); - -NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder); - -unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder, - NeAACDecConfigurationPtr config); - -/* Init the library based on info from the AAC file (ADTS/ADIF) */ -long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, - unsigned char *buffer, - unsigned long buffer_size, - unsigned long *samplerate, - unsigned char *channels, - int latm_stream); - -/* Init the library using a DecoderSpecificInfo */ -char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, unsigned char *pBuffer, - unsigned long SizeOfDecoderSpecificInfo, - unsigned long *samplerate, unsigned char *channels); - -/* Init the library for DRM */ -char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate, - unsigned char channels); - -void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame); - -void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder); - -void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder, - NeAACDecFrameInfo *hInfo, - unsigned char *buffer, - unsigned long buffer_size); - -void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder, - NeAACDecFrameInfo *hInfo, - unsigned char *buffer, - unsigned long buffer_size, - void **sample_buffer, - unsigned long sample_buffer_size); - -char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer, - unsigned long buffer_size, - mp4AudioSpecificConfig *mp4ASC); - -#ifdef _WIN32 - #pragma pack(pop) -#endif - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/mplayer/libfaad2/output.c b/mplayer/libfaad2/output.c deleted file mode 100644 index eea402d7..00000000 --- a/mplayer/libfaad2/output.c +++ /dev/null @@ -1,603 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** Any non-GPL usage of this software or parts of this software is strictly -** forbidden. -** -** Initially modified for use with MPlayer by Rich Felker on 2005/03/29 -** $Id: output.c 32343 2010-09-22 21:08:59Z diego $ -** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ -**/ - -#include "common.h" -#include "structs.h" - -#include "output.h" -#include "decoder.h" - -#ifndef FIXED_POINT - - -#define FLOAT_SCALE (1.0f/(1<<15)) - -#define DM_MUL REAL_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2)) -#define RSQRT2 REAL_CONST(0.7071067811865475244) // 1/sqrt(2) - - -static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample, - uint8_t down_matrix, uint8_t *internal_channel) -{ - if (!down_matrix) - return input[internal_channel[channel]][sample]; - - if (channel == 0) - { - return DM_MUL * (input[internal_channel[1]][sample] + - input[internal_channel[0]][sample] * RSQRT2 + - input[internal_channel[3]][sample] * RSQRT2); - } else { - return DM_MUL * (input[internal_channel[2]][sample] + - input[internal_channel[0]][sample] * RSQRT2 + - input[internal_channel[4]][sample] * RSQRT2); - } -} - -#ifndef HAS_LRINTF -#define CLIP(sample, max, min) \ -if (sample >= 0.0f) \ -{ \ - sample += 0.5f; \ - if (sample >= max) \ - sample = max; \ -} else { \ - sample += -0.5f; \ - if (sample <= min) \ - sample = min; \ -} -#else -#define CLIP(sample, max, min) \ -if (sample >= 0.0f) \ -{ \ - if (sample >= max) \ - sample = max; \ -} else { \ - if (sample <= min) \ - sample = min; \ -} -#endif - -#define CONV(a,b) ((a<<1)|(b&0x1)) - -static void to_PCM_16bit(NeAACDecHandle hDecoder, real_t **input, - uint8_t channels, uint16_t frame_len, - int16_t **sample_buffer) -{ - uint8_t ch, ch1; - uint16_t i; - - switch (CONV(channels,hDecoder->downMatrix)) - { - case CONV(1,0): - case CONV(1,1): - for(i = 0; i < frame_len; i++) - { - real_t inp = input[hDecoder->internal_channel[0]][i]; - - CLIP(inp, 32767.0f, -32768.0f); - - (*sample_buffer)[i] = (int16_t)lrintf(inp); - } - break; - case CONV(2,0): - if (hDecoder->upMatrix) - { - ch = hDecoder->internal_channel[0]; - for(i = 0; i < frame_len; i++) - { - real_t inp0 = input[ch][i]; - - CLIP(inp0, 32767.0f, -32768.0f); - - (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0); - (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp0); - } - } else { - ch = hDecoder->internal_channel[0]; - ch1 = hDecoder->internal_channel[1]; - for(i = 0; i < frame_len; i++) - { - real_t inp0 = input[ch ][i]; - real_t inp1 = input[ch1][i]; - - CLIP(inp0, 32767.0f, -32768.0f); - CLIP(inp1, 32767.0f, -32768.0f); - - (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0); - (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp1); - } - } - break; - default: - for (ch = 0; ch < channels; ch++) - { - for(i = 0; i < frame_len; i++) - { - real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); - - CLIP(inp, 32767.0f, -32768.0f); - - (*sample_buffer)[(i*channels)+ch] = (int16_t)lrintf(inp); - } - } - break; - } -} - -static void to_PCM_24bit(NeAACDecHandle hDecoder, real_t **input, - uint8_t channels, uint16_t frame_len, - int32_t **sample_buffer) -{ - uint8_t ch, ch1; - uint16_t i; - - switch (CONV(channels,hDecoder->downMatrix)) - { - case CONV(1,0): - case CONV(1,1): - for(i = 0; i < frame_len; i++) - { - real_t inp = input[hDecoder->internal_channel[0]][i]; - - inp *= 256.0f; - CLIP(inp, 8388607.0f, -8388608.0f); - - (*sample_buffer)[i] = (int32_t)lrintf(inp); - } - break; - case CONV(2,0): - if (hDecoder->upMatrix) - { - ch = hDecoder->internal_channel[0]; - for(i = 0; i < frame_len; i++) - { - real_t inp0 = input[ch][i]; - - inp0 *= 256.0f; - CLIP(inp0, 8388607.0f, -8388608.0f); - - (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0); - (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0); - } - } else { - ch = hDecoder->internal_channel[0]; - ch1 = hDecoder->internal_channel[1]; - for(i = 0; i < frame_len; i++) - { - real_t inp0 = input[ch ][i]; - real_t inp1 = input[ch1][i]; - - inp0 *= 256.0f; - inp1 *= 256.0f; - CLIP(inp0, 8388607.0f, -8388608.0f); - CLIP(inp1, 8388607.0f, -8388608.0f); - - (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0); - (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1); - } - } - break; - default: - for (ch = 0; ch < channels; ch++) - { - for(i = 0; i < frame_len; i++) - { - real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); - - inp *= 256.0f; - CLIP(inp, 8388607.0f, -8388608.0f); - - (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp); - } - } - break; - } -} - -static void to_PCM_32bit(NeAACDecHandle hDecoder, real_t **input, - uint8_t channels, uint16_t frame_len, - int32_t **sample_buffer) -{ - uint8_t ch, ch1; - uint16_t i; - - switch (CONV(channels,hDecoder->downMatrix)) - { - case CONV(1,0): - case CONV(1,1): - for(i = 0; i < frame_len; i++) - { - real_t inp = input[hDecoder->internal_channel[0]][i]; - - inp *= 65536.0f; - CLIP(inp, 2147483647.0f, -2147483648.0f); - - (*sample_buffer)[i] = (int32_t)lrintf(inp); - } - break; - case CONV(2,0): - if (hDecoder->upMatrix) - { - ch = hDecoder->internal_channel[0]; - for(i = 0; i < frame_len; i++) - { - real_t inp0 = input[ch][i]; - - inp0 *= 65536.0f; - CLIP(inp0, 2147483647.0f, -2147483648.0f); - - (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0); - (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0); - } - } else { - ch = hDecoder->internal_channel[0]; - ch1 = hDecoder->internal_channel[1]; - for(i = 0; i < frame_len; i++) - { - real_t inp0 = input[ch ][i]; - real_t inp1 = input[ch1][i]; - - inp0 *= 65536.0f; - inp1 *= 65536.0f; - CLIP(inp0, 2147483647.0f, -2147483648.0f); - CLIP(inp1, 2147483647.0f, -2147483648.0f); - - (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0); - (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1); - } - } - break; - default: - for (ch = 0; ch < channels; ch++) - { - for(i = 0; i < frame_len; i++) - { - real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); - - inp *= 65536.0f; - CLIP(inp, 2147483647.0f, -2147483648.0f); - - (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp); - } - } - break; - } -} - -static void to_PCM_float(NeAACDecHandle hDecoder, real_t **input, - uint8_t channels, uint16_t frame_len, - float32_t **sample_buffer) -{ - uint8_t ch, ch1; - uint16_t i; - - switch (CONV(channels,hDecoder->downMatrix)) - { - case CONV(1,0): - case CONV(1,1): - for(i = 0; i < frame_len; i++) - { - real_t inp = input[hDecoder->internal_channel[0]][i]; - (*sample_buffer)[i] = inp*FLOAT_SCALE; - } - break; - case CONV(2,0): - if (hDecoder->upMatrix) - { - ch = hDecoder->internal_channel[0]; - for(i = 0; i < frame_len; i++) - { - real_t inp0 = input[ch][i]; - (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE; - (*sample_buffer)[(i*2)+1] = inp0*FLOAT_SCALE; - } - } else { - ch = hDecoder->internal_channel[0]; - ch1 = hDecoder->internal_channel[1]; - for(i = 0; i < frame_len; i++) - { - real_t inp0 = input[ch ][i]; - real_t inp1 = input[ch1][i]; - (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE; - (*sample_buffer)[(i*2)+1] = inp1*FLOAT_SCALE; - } - } - break; - default: - for (ch = 0; ch < channels; ch++) - { - for(i = 0; i < frame_len; i++) - { - real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); - (*sample_buffer)[(i*channels)+ch] = inp*FLOAT_SCALE; - } - } - break; - } -} - -static void to_PCM_double(NeAACDecHandle hDecoder, real_t **input, - uint8_t channels, uint16_t frame_len, - double **sample_buffer) -{ - uint8_t ch, ch1; - uint16_t i; - - switch (CONV(channels,hDecoder->downMatrix)) - { - case CONV(1,0): - case CONV(1,1): - for(i = 0; i < frame_len; i++) - { - real_t inp = input[hDecoder->internal_channel[0]][i]; - (*sample_buffer)[i] = (double)inp*FLOAT_SCALE; - } - break; - case CONV(2,0): - if (hDecoder->upMatrix) - { - ch = hDecoder->internal_channel[0]; - for(i = 0; i < frame_len; i++) - { - real_t inp0 = input[ch][i]; - (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE; - (*sample_buffer)[(i*2)+1] = (double)inp0*FLOAT_SCALE; - } - } else { - ch = hDecoder->internal_channel[0]; - ch1 = hDecoder->internal_channel[1]; - for(i = 0; i < frame_len; i++) - { - real_t inp0 = input[ch ][i]; - real_t inp1 = input[ch1][i]; - (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE; - (*sample_buffer)[(i*2)+1] = (double)inp1*FLOAT_SCALE; - } - } - break; - default: - for (ch = 0; ch < channels; ch++) - { - for(i = 0; i < frame_len; i++) - { - real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); - (*sample_buffer)[(i*channels)+ch] = (double)inp*FLOAT_SCALE; - } - } - break; - } -} - -void *output_to_PCM(NeAACDecHandle hDecoder, - real_t **input, void *sample_buffer, uint8_t channels, - uint16_t frame_len, uint8_t format) -{ - int16_t *short_sample_buffer = (int16_t*)sample_buffer; - int32_t *int_sample_buffer = (int32_t*)sample_buffer; - float32_t *float_sample_buffer = (float32_t*)sample_buffer; - double *double_sample_buffer = (double*)sample_buffer; - -#ifdef PROFILE - int64_t count = faad_get_ts(); -#endif - - /* Copy output to a standard PCM buffer */ - switch (format) - { - case FAAD_FMT_16BIT: - to_PCM_16bit(hDecoder, input, channels, frame_len, &short_sample_buffer); - break; - case FAAD_FMT_24BIT: - to_PCM_24bit(hDecoder, input, channels, frame_len, &int_sample_buffer); - break; - case FAAD_FMT_32BIT: - to_PCM_32bit(hDecoder, input, channels, frame_len, &int_sample_buffer); - break; - case FAAD_FMT_FLOAT: - to_PCM_float(hDecoder, input, channels, frame_len, &float_sample_buffer); - break; - case FAAD_FMT_DOUBLE: - to_PCM_double(hDecoder, input, channels, frame_len, &double_sample_buffer); - break; - } - -#ifdef PROFILE - count = faad_get_ts() - count; - hDecoder->output_cycles += count; -#endif - - return sample_buffer; -} - -#else - -#define DM_MUL FRAC_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2)) -#define RSQRT2 FRAC_CONST(0.7071067811865475244) // 1/sqrt(2) - -static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample, - uint8_t down_matrix, uint8_t up_matrix, - uint8_t *internal_channel) -{ - if (up_matrix == 1) - return input[internal_channel[0]][sample]; - - if (!down_matrix) - return input[internal_channel[channel]][sample]; - - if (channel == 0) - { - real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2); - real_t L_S = MUL_F(input[internal_channel[3]][sample], RSQRT2); - real_t cum = input[internal_channel[1]][sample] + C + L_S; - return MUL_F(cum, DM_MUL); - } else { - real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2); - real_t R_S = MUL_F(input[internal_channel[4]][sample], RSQRT2); - real_t cum = input[internal_channel[2]][sample] + C + R_S; - return MUL_F(cum, DM_MUL); - } -} - -static void* output_to_PCM_sux(NeAACDecHandle hDecoder, - real_t **input, void *sample_buffer, uint8_t channels, - uint16_t frame_len, uint8_t format) -{ - uint8_t ch; - uint16_t i; - int16_t *short_sample_buffer = (int16_t*)sample_buffer; - int32_t *int_sample_buffer = (int32_t*)sample_buffer; - - /* Copy output to a standard PCM buffer */ - for (ch = 0; ch < channels; ch++) - { - switch (format) - { - case FAAD_FMT_16BIT: - for(i = 0; i < frame_len; i++) - { - int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix, - hDecoder->internal_channel); - if (tmp >= 0) - { - tmp += (1 << (REAL_BITS-1)); - if (tmp >= REAL_CONST(32767)) - { - tmp = REAL_CONST(32767); - } - } else { - tmp += -(1 << (REAL_BITS-1)); - if (tmp <= REAL_CONST(-32768)) - { - tmp = REAL_CONST(-32768); - } - } - tmp >>= REAL_BITS; - short_sample_buffer[(i*channels)+ch] = (int16_t)tmp; - } - break; - case FAAD_FMT_24BIT: - for(i = 0; i < frame_len; i++) - { - int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix, - hDecoder->internal_channel); - if (tmp >= 0) - { - tmp += (1 << (REAL_BITS-9)); - tmp >>= (REAL_BITS-8); - if (tmp >= 8388607) - { - tmp = 8388607; - } - } else { - tmp += -(1 << (REAL_BITS-9)); - tmp >>= (REAL_BITS-8); - if (tmp <= -8388608) - { - tmp = -8388608; - } - } - int_sample_buffer[(i*channels)+ch] = (int32_t)tmp; - } - break; - case FAAD_FMT_32BIT: - for(i = 0; i < frame_len; i++) - { - int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix, - hDecoder->internal_channel); - if (tmp >= 0) - { - tmp += (1 << (16-REAL_BITS-1)); - tmp <<= (16-REAL_BITS); - } else { - tmp += -(1 << (16-REAL_BITS-1)); - tmp <<= (16-REAL_BITS); - } - int_sample_buffer[(i*channels)+ch] = (int32_t)tmp; - } - break; - case FAAD_FMT_FIXED: - for(i = 0; i < frame_len; i++) - { - real_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix, - hDecoder->internal_channel); - int_sample_buffer[(i*channels)+ch] = (int32_t)tmp; - } - break; - } - } - - 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 diff --git a/mplayer/libfaad2/output.h b/mplayer/libfaad2/output.h deleted file mode 100644 index 5f0ee26e..00000000 --- a/mplayer/libfaad2/output.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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.h,v 1.21 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __OUTPUT_H__ -#define __OUTPUT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -void* output_to_PCM(NeAACDecHandle hDecoder, - real_t **input, - void *samplebuffer, - uint8_t channels, - uint16_t frame_len, - uint8_t format); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/pns.c b/mplayer/libfaad2/pns.c deleted file mode 100644 index 8d76fd65..00000000 --- a/mplayer/libfaad2/pns.c +++ /dev/null @@ -1,265 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: pns.c,v 1.34 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#include "pns.h" - - -/* static function declarations */ -static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size, - uint8_t sub); - - -#ifdef FIXED_POINT - -#define DIV(A, B) (((int64_t)A << REAL_BITS)/B) - -#define step(shift) \ - if ((0x40000000l >> shift) + root <= value) \ - { \ - value -= (0x40000000l >> shift) + root; \ - root = (root >> 1) | (0x40000000l >> shift); \ - } else { \ - root = root >> 1; \ - } - -/* fixed point square root approximation */ -/* !!!! ONLY WORKS FOR EVEN %REAL_BITS% !!!! */ -real_t fp_sqrt(real_t value) -{ - real_t root = 0; - - step( 0); step( 2); step( 4); step( 6); - step( 8); step(10); step(12); step(14); - step(16); step(18); step(20); step(22); - step(24); step(26); step(28); step(30); - - if (root < value) - ++root; - - root <<= (REAL_BITS/2); - - return root; -} - -static real_t pow2_table[] = -{ - COEF_CONST(1.0), - COEF_CONST(1.18920711500272), - COEF_CONST(1.41421356237310), - COEF_CONST(1.68179283050743) -}; -#endif - -/* The function gen_rand_vector(addr, size) generates a vector of length - with signed random values of average energy MEAN_NRG per random - value. A suitable random number generator can be realized using one - multiplication/accumulation per random value. -*/ -static INLINE void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size, - uint8_t sub) -{ -#ifndef FIXED_POINT - uint16_t i; - real_t energy = 0.0; - - real_t scale = (real_t)1.0/(real_t)size; - - for (i = 0; i < size; i++) - { - real_t tmp = scale*(real_t)(int32_t)random_int(); - spec[i] = tmp; - energy += tmp*tmp; - } - - scale = (real_t)1.0/(real_t)sqrt(energy); - scale *= (real_t)pow(2.0, 0.25 * scale_factor); - for (i = 0; i < size; i++) - { - spec[i] *= scale; - } -#else - uint16_t i; - real_t energy = 0, scale; - int32_t exp, frac; - - for (i = 0; i < size; i++) - { - /* this can be replaced by a 16 bit random generator!!!! */ - real_t tmp = (int32_t)random_int(); - if (tmp < 0) - tmp = -(tmp & ((1<<(REAL_BITS-1))-1)); - else - tmp = (tmp & ((1<<(REAL_BITS-1))-1)); - - energy += MUL_R(tmp,tmp); - - spec[i] = tmp; - } - - energy = fp_sqrt(energy); - if (energy > 0) - { - scale = DIV(REAL_CONST(1),energy); - - exp = scale_factor >> 2; - frac = scale_factor & 3; - - /* IMDCT pre-scaling */ - exp -= sub; - - if (exp < 0) - scale >>= -exp; - else - scale <<= exp; - - if (frac) - scale = MUL_C(scale, pow2_table[frac]); - - for (i = 0; i < size; i++) - { - spec[i] = MUL_R(spec[i], scale); - } - } -#endif -} - -void pns_decode(ic_stream *ics_left, ic_stream *ics_right, - real_t *spec_left, real_t *spec_right, uint16_t frame_len, - uint8_t channel_pair, uint8_t object_type) -{ - uint8_t g, sfb, b; - uint16_t size, offs; - - uint8_t group = 0; - uint16_t nshort = frame_len >> 3; - - uint8_t sub = 0; - -#ifdef FIXED_POINT - /* IMDCT scaling */ - if (object_type == LD) - { - sub = 9 /*9*/; - } else { - if (ics_left->window_sequence == EIGHT_SHORT_SEQUENCE) - sub = 7 /*7*/; - else - sub = 10 /*10*/; - } -#endif - - for (g = 0; g < ics_left->num_window_groups; g++) - { - /* Do perceptual noise substitution decoding */ - for (b = 0; b < ics_left->window_group_length[g]; b++) - { - for (sfb = 0; sfb < ics_left->max_sfb; sfb++) - { - if (is_noise(ics_left, g, sfb)) - { -#ifdef LTP_DEC - /* Simultaneous use of LTP and PNS is not prevented in the - syntax. If both LTP, and PNS are enabled on the same - scalefactor band, PNS takes precedence, and no prediction - is applied to this band. - */ - ics_left->ltp.long_used[sfb] = 0; - ics_left->ltp2.long_used[sfb] = 0; -#endif - -#ifdef MAIN_DEC - /* For scalefactor bands coded using PNS the corresponding - predictors are switched to "off". - */ - ics_left->pred.prediction_used[sfb] = 0; -#endif - - offs = ics_left->swb_offset[sfb]; - size = ics_left->swb_offset[sfb+1] - offs; - - /* Generate random vector */ - gen_rand_vector(&spec_left[(group*nshort)+offs], - ics_left->scale_factors[g][sfb], size, sub); - } - -/* From the spec: - If the same scalefactor band and group is coded by perceptual noise - substitution in both channels of a channel pair, the correlation of - the noise signal can be controlled by means of the ms_used field: While - the default noise generation process works independently for each channel - (separate generation of random vectors), the same random vector is used - for both channels if ms_used[] is set for a particular scalefactor band - and group. In this case, no M/S stereo coding is carried out (because M/S - stereo coding and noise substitution coding are mutually exclusive). - If the same scalefactor band and group is coded by perceptual noise - substitution in only one channel of a channel pair the setting of ms_used[] - is not evaluated. -*/ - if (channel_pair) - { - if (is_noise(ics_right, g, sfb)) - { - if (((ics_left->ms_mask_present == 1) && - (ics_left->ms_used[g][sfb])) || - (ics_left->ms_mask_present == 2)) - { - uint16_t c; - - offs = ics_right->swb_offset[sfb]; - size = ics_right->swb_offset[sfb+1] - offs; - - for (c = 0; c < size; c++) - { - spec_right[(group*nshort) + offs + c] = - spec_left[(group*nshort) + offs + c]; - } - } else /*if (ics_left->ms_mask_present == 0)*/ { -#ifdef LTP_DEC - ics_right->ltp.long_used[sfb] = 0; - ics_right->ltp2.long_used[sfb] = 0; -#endif -#ifdef MAIN_DEC - ics_right->pred.prediction_used[sfb] = 0; -#endif - - offs = ics_right->swb_offset[sfb]; - size = ics_right->swb_offset[sfb+1] - offs; - - /* Generate random vector */ - gen_rand_vector(&spec_right[(group*nshort)+offs], - ics_right->scale_factors[g][sfb], size, sub); - } - } - } - } /* sfb */ - group++; - } /* b */ - } /* g */ -} diff --git a/mplayer/libfaad2/pns.h b/mplayer/libfaad2/pns.h deleted file mode 100644 index a0f204d3..00000000 --- a/mplayer/libfaad2/pns.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: pns.h,v 1.23 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __PNS_H__ -#define __PNS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "syntax.h" - -#define NOISE_OFFSET 90 - -void pns_decode(ic_stream *ics_left, ic_stream *ics_right, - real_t *spec_left, real_t *spec_right, uint16_t frame_len, - uint8_t channel_pair, uint8_t object_type); - -static INLINE uint8_t is_noise(ic_stream *ics, uint8_t group, uint8_t sfb) -{ - if (ics->sfb_cb[group][sfb] == NOISE_HCB) - return 1; - return 0; -} - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/ps_dec.c b/mplayer/libfaad2/ps_dec.c deleted file mode 100644 index 555734e5..00000000 --- a/mplayer/libfaad2/ps_dec.c +++ /dev/null @@ -1,1988 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR and PS decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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 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" - -#ifdef PS_DEC - -#include -#include "ps_dec.h" -#include "ps_tables.h" - -/* constants */ -#define NEGATE_IPD_MASK (0x1000) -#define DECAY_SLOPE FRAC_CONST(0.05) -#define COEF_SQRT2 COEF_CONST(1.4142135623731) - -/* tables */ -/* filters are mirrored in coef 6, second half left out */ -static const real_t p8_13_20[7] = -{ - FRAC_CONST(0.00746082949812), - FRAC_CONST(0.02270420949825), - FRAC_CONST(0.04546865930473), - FRAC_CONST(0.07266113929591), - FRAC_CONST(0.09885108575264), - FRAC_CONST(0.11793710567217), - FRAC_CONST(0.125) -}; - -static const real_t p2_13_20[7] = -{ - FRAC_CONST(0.0), - FRAC_CONST(0.01899487526049), - FRAC_CONST(0.0), - FRAC_CONST(-0.07293139167538), - FRAC_CONST(0.0), - FRAC_CONST(0.30596630545168), - FRAC_CONST(0.5) -}; - -static const real_t p12_13_34[7] = -{ - FRAC_CONST(0.04081179924692), - FRAC_CONST(0.03812810994926), - FRAC_CONST(0.05144908135699), - FRAC_CONST(0.06399831151592), - FRAC_CONST(0.07428313801106), - FRAC_CONST(0.08100347892914), - FRAC_CONST(0.08333333333333) -}; - -static const real_t p8_13_34[7] = -{ - FRAC_CONST(0.01565675600122), - FRAC_CONST(0.03752716391991), - FRAC_CONST(0.05417891378782), - FRAC_CONST(0.08417044116767), - FRAC_CONST(0.10307344158036), - FRAC_CONST(0.12222452249753), - FRAC_CONST(0.125) -}; - -static const real_t p4_13_34[7] = -{ - FRAC_CONST(-0.05908211155639), - FRAC_CONST(-0.04871498374946), - FRAC_CONST(0.0), - FRAC_CONST(0.07778723915851), - FRAC_CONST(0.16486303567403), - FRAC_CONST(0.23279856662996), - FRAC_CONST(0.25) -}; - -#ifdef PARAM_32KHZ -static const uint8_t delay_length_d[2][NO_ALLPASS_LINKS] = { - { 1, 2, 3 } /* d_24kHz */, - { 3, 4, 5 } /* d_48kHz */ -}; -#else -static const uint8_t delay_length_d[NO_ALLPASS_LINKS] = { - 3, 4, 5 /* d_48kHz */ -}; -#endif -static const real_t filter_a[NO_ALLPASS_LINKS] = { /* a(m) = exp(-d_48kHz(m)/7) */ - FRAC_CONST(0.65143905753106), - FRAC_CONST(0.56471812200776), - FRAC_CONST(0.48954165955695) -}; - -static const uint8_t group_border20[10+12 + 1] = -{ - 6, 7, 0, 1, 2, 3, /* 6 subqmf subbands */ - 9, 8, /* 2 subqmf subbands */ - 10, 11, /* 2 subqmf subbands */ - 3, 4, 5, 6, 7, 8, 9, 11, 14, 18, 23, 35, 64 -}; - -static const uint8_t group_border34[32+18 + 1] = -{ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, /* 12 subqmf subbands */ - 12, 13, 14, 15, 16, 17, 18, 19, /* 8 subqmf subbands */ - 20, 21, 22, 23, /* 4 subqmf subbands */ - 24, 25, 26, 27, /* 4 subqmf subbands */ - 28, 29, 30, 31, /* 4 subqmf subbands */ - 32-27, 33-27, 34-27, 35-27, 36-27, 37-27, 38-27, 40-27, 42-27, 44-27, 46-27, 48-27, 51-27, 54-27, 57-27, 60-27, 64-27, 68-27, 91-27 -}; - -static const uint16_t map_group2bk20[10+12] = -{ - (NEGATE_IPD_MASK | 1), (NEGATE_IPD_MASK | 0), - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 -}; - -static const uint16_t map_group2bk34[32+18] = -{ - 0, 1, 2, 3, 4, 5, 6, 6, 7, (NEGATE_IPD_MASK | 2), (NEGATE_IPD_MASK | 1), (NEGATE_IPD_MASK | 0), - 10, 10, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 9, - 14, 11, 12, 13, - 14, 15, 16, 13, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 -}; - -/* type definitions */ -typedef struct -{ - uint8_t frame_len; - uint8_t resolution20[3]; - uint8_t resolution34[5]; - - qmf_t *work; - qmf_t **buffer; - qmf_t **temp; -} hyb_info; - -/* static function declarations */ -static void ps_data_decode(ps_info *ps); -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); -static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filter, - qmf_t *buffer, qmf_t **X_hybrid); -static void hybrid_analysis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32], - uint8_t use34); -static void hybrid_synthesis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32], - uint8_t use34); -static int8_t delta_clip(int8_t i, int8_t min, int8_t max); -static void delta_decode(uint8_t enable, int8_t *index, int8_t *index_prev, - uint8_t dt_flag, uint8_t nr_par, uint8_t stride, - int8_t min_index, int8_t max_index); -static void delta_modulo_decode(uint8_t enable, int8_t *index, int8_t *index_prev, - uint8_t dt_flag, uint8_t nr_par, uint8_t stride, - int8_t log2modulo); -static void map20indexto34(int8_t *index, uint8_t bins); -#ifdef PS_LOW_POWER -static void map34indexto20(int8_t *index, uint8_t bins); -#endif -static void ps_data_decode(ps_info *ps); -static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64], - qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]); -static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64], - qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]); - -/* */ - - -static hyb_info *hybrid_init(void) -{ - uint8_t i; - - hyb_info *hyb = (hyb_info*)faad_malloc(sizeof(hyb_info)); - - hyb->resolution34[0] = 12; - hyb->resolution34[1] = 8; - hyb->resolution34[2] = 4; - hyb->resolution34[3] = 4; - hyb->resolution34[4] = 4; - - hyb->resolution20[0] = 8; - hyb->resolution20[1] = 2; - hyb->resolution20[2] = 2; - - hyb->frame_len = 32; - - hyb->work = (qmf_t*)faad_malloc((hyb->frame_len+12) * sizeof(qmf_t)); - memset(hyb->work, 0, (hyb->frame_len+12) * sizeof(qmf_t)); - - hyb->buffer = (qmf_t**)faad_malloc(5 * sizeof(qmf_t*)); - for (i = 0; i < 5; i++) - { - hyb->buffer[i] = (qmf_t*)faad_malloc(hyb->frame_len * sizeof(qmf_t)); - memset(hyb->buffer[i], 0, hyb->frame_len * sizeof(qmf_t)); - } - - hyb->temp = (qmf_t**)faad_malloc(hyb->frame_len * sizeof(qmf_t*)); - for (i = 0; i < hyb->frame_len; i++) - { - hyb->temp[i] = (qmf_t*)faad_malloc(12 /*max*/ * sizeof(qmf_t)); - } - - return hyb; -} - -static void hybrid_free(hyb_info *hyb) -{ - uint8_t i; - - if (hyb->work) - faad_free(hyb->work); - - for (i = 0; i < 5; i++) - { - if (hyb->buffer[i]) - faad_free(hyb->buffer[i]); - } - if (hyb->buffer) - faad_free(hyb->buffer); - - for (i = 0; i < hyb->frame_len; i++) - { - if (hyb->temp[i]) - faad_free(hyb->temp[i]); - } - if (hyb->temp) - faad_free(hyb->temp); -} - -/* real filter, size 2 */ -static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter, - qmf_t *buffer, qmf_t **X_hybrid) -{ - uint8_t i; - - for (i = 0; i < frame_len; i++) - { - real_t r0 = MUL_F(filter[0],(QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+i]))); - real_t r1 = MUL_F(filter[1],(QMF_RE(buffer[1+i]) + QMF_RE(buffer[11+i]))); - real_t r2 = MUL_F(filter[2],(QMF_RE(buffer[2+i]) + QMF_RE(buffer[10+i]))); - real_t r3 = MUL_F(filter[3],(QMF_RE(buffer[3+i]) + QMF_RE(buffer[9+i]))); - real_t r4 = MUL_F(filter[4],(QMF_RE(buffer[4+i]) + QMF_RE(buffer[8+i]))); - real_t r5 = MUL_F(filter[5],(QMF_RE(buffer[5+i]) + QMF_RE(buffer[7+i]))); - real_t r6 = MUL_F(filter[6],QMF_RE(buffer[6+i])); - real_t i0 = MUL_F(filter[0],(QMF_IM(buffer[0+i]) + QMF_IM(buffer[12+i]))); - real_t i1 = MUL_F(filter[1],(QMF_IM(buffer[1+i]) + QMF_IM(buffer[11+i]))); - real_t i2 = MUL_F(filter[2],(QMF_IM(buffer[2+i]) + QMF_IM(buffer[10+i]))); - real_t i3 = MUL_F(filter[3],(QMF_IM(buffer[3+i]) + QMF_IM(buffer[9+i]))); - real_t i4 = MUL_F(filter[4],(QMF_IM(buffer[4+i]) + QMF_IM(buffer[8+i]))); - real_t i5 = MUL_F(filter[5],(QMF_IM(buffer[5+i]) + QMF_IM(buffer[7+i]))); - real_t i6 = MUL_F(filter[6],QMF_IM(buffer[6+i])); - - /* q = 0 */ - QMF_RE(X_hybrid[i][0]) = r0 + r1 + r2 + r3 + r4 + r5 + r6; - QMF_IM(X_hybrid[i][0]) = i0 + i1 + i2 + i3 + i4 + i5 + i6; - - /* q = 1 */ - QMF_RE(X_hybrid[i][1]) = r0 - r1 + r2 - r3 + r4 - r5 + r6; - QMF_IM(X_hybrid[i][1]) = i0 - i1 + i2 - i3 + i4 - i5 + i6; - } -} - -/* complex filter, size 4 */ -static void channel_filter4(hyb_info *hyb, uint8_t frame_len, const real_t *filter, - qmf_t *buffer, qmf_t **X_hybrid) -{ - uint8_t i; - real_t input_re1[2], input_re2[2], input_im1[2], input_im2[2]; - - for (i = 0; i < frame_len; i++) - { - input_re1[0] = -MUL_F(filter[2], (QMF_RE(buffer[i+2]) + QMF_RE(buffer[i+10]))) + - MUL_F(filter[6], QMF_RE(buffer[i+6])); - input_re1[1] = MUL_F(FRAC_CONST(-0.70710678118655), - (MUL_F(filter[1], (QMF_RE(buffer[i+1]) + QMF_RE(buffer[i+11]))) + - MUL_F(filter[3], (QMF_RE(buffer[i+3]) + QMF_RE(buffer[i+9]))) - - MUL_F(filter[5], (QMF_RE(buffer[i+5]) + QMF_RE(buffer[i+7]))))); - - input_im1[0] = MUL_F(filter[0], (QMF_IM(buffer[i+0]) - QMF_IM(buffer[i+12]))) - - MUL_F(filter[4], (QMF_IM(buffer[i+4]) - QMF_IM(buffer[i+8]))); - input_im1[1] = MUL_F(FRAC_CONST(0.70710678118655), - (MUL_F(filter[1], (QMF_IM(buffer[i+1]) - QMF_IM(buffer[i+11]))) - - MUL_F(filter[3], (QMF_IM(buffer[i+3]) - QMF_IM(buffer[i+9]))) - - MUL_F(filter[5], (QMF_IM(buffer[i+5]) - QMF_IM(buffer[i+7]))))); - - input_re2[0] = MUL_F(filter[0], (QMF_RE(buffer[i+0]) - QMF_RE(buffer[i+12]))) - - MUL_F(filter[4], (QMF_RE(buffer[i+4]) - QMF_RE(buffer[i+8]))); - input_re2[1] = MUL_F(FRAC_CONST(0.70710678118655), - (MUL_F(filter[1], (QMF_RE(buffer[i+1]) - QMF_RE(buffer[i+11]))) - - MUL_F(filter[3], (QMF_RE(buffer[i+3]) - QMF_RE(buffer[i+9]))) - - MUL_F(filter[5], (QMF_RE(buffer[i+5]) - QMF_RE(buffer[i+7]))))); - - input_im2[0] = -MUL_F(filter[2], (QMF_IM(buffer[i+2]) + QMF_IM(buffer[i+10]))) + - MUL_F(filter[6], QMF_IM(buffer[i+6])); - input_im2[1] = MUL_F(FRAC_CONST(-0.70710678118655), - (MUL_F(filter[1], (QMF_IM(buffer[i+1]) + QMF_IM(buffer[i+11]))) + - MUL_F(filter[3], (QMF_IM(buffer[i+3]) + QMF_IM(buffer[i+9]))) - - MUL_F(filter[5], (QMF_IM(buffer[i+5]) + QMF_IM(buffer[i+7]))))); - - /* q == 0 */ - QMF_RE(X_hybrid[i][0]) = input_re1[0] + input_re1[1] + input_im1[0] + input_im1[1]; - QMF_IM(X_hybrid[i][0]) = -input_re2[0] - input_re2[1] + input_im2[0] + input_im2[1]; - - /* q == 1 */ - QMF_RE(X_hybrid[i][1]) = input_re1[0] - input_re1[1] - input_im1[0] + input_im1[1]; - QMF_IM(X_hybrid[i][1]) = input_re2[0] - input_re2[1] + input_im2[0] - input_im2[1]; - - /* q == 2 */ - QMF_RE(X_hybrid[i][2]) = input_re1[0] - input_re1[1] + input_im1[0] - input_im1[1]; - QMF_IM(X_hybrid[i][2]) = -input_re2[0] + input_re2[1] + input_im2[0] - input_im2[1]; - - /* q == 3 */ - QMF_RE(X_hybrid[i][3]) = input_re1[0] + input_re1[1] - input_im1[0] - input_im1[1]; - QMF_IM(X_hybrid[i][3]) = input_re2[0] + input_re2[1] + input_im2[0] + input_im2[1]; - } -} - -static void INLINE DCT3_4_unscaled(real_t *y, real_t *x) -{ - real_t f0, f1, f2, f3, f4, f5, f6, f7, f8; - - f0 = MUL_F(x[2], FRAC_CONST(0.7071067811865476)); - f1 = x[0] - f0; - f2 = x[0] + f0; - f3 = x[1] + x[3]; - f4 = MUL_C(x[1], COEF_CONST(1.3065629648763766)); - f5 = MUL_F(f3, FRAC_CONST(-0.9238795325112866)); - f6 = MUL_F(x[3], FRAC_CONST(-0.5411961001461967)); - f7 = f4 + f5; - f8 = f6 - f5; - y[3] = f2 - f8; - y[0] = f2 + f8; - y[2] = f1 - f7; - y[1] = f1 + f7; -} - -/* complex filter, size 8 */ -static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filter, - qmf_t *buffer, qmf_t **X_hybrid) -{ - uint8_t i, n; - real_t input_re1[4], input_re2[4], input_im1[4], input_im2[4]; - real_t x[4]; - - for (i = 0; i < frame_len; i++) - { - input_re1[0] = MUL_F(filter[6],QMF_RE(buffer[6+i])); - input_re1[1] = MUL_F(filter[5],(QMF_RE(buffer[5+i]) + QMF_RE(buffer[7+i]))); - input_re1[2] = -MUL_F(filter[0],(QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+i]))) + MUL_F(filter[4],(QMF_RE(buffer[4+i]) + QMF_RE(buffer[8+i]))); - input_re1[3] = -MUL_F(filter[1],(QMF_RE(buffer[1+i]) + QMF_RE(buffer[11+i]))) + MUL_F(filter[3],(QMF_RE(buffer[3+i]) + QMF_RE(buffer[9+i]))); - - input_im1[0] = MUL_F(filter[5],(QMF_IM(buffer[7+i]) - QMF_IM(buffer[5+i]))); - input_im1[1] = MUL_F(filter[0],(QMF_IM(buffer[12+i]) - QMF_IM(buffer[0+i]))) + MUL_F(filter[4],(QMF_IM(buffer[8+i]) - QMF_IM(buffer[4+i]))); - input_im1[2] = MUL_F(filter[1],(QMF_IM(buffer[11+i]) - QMF_IM(buffer[1+i]))) + MUL_F(filter[3],(QMF_IM(buffer[9+i]) - QMF_IM(buffer[3+i]))); - input_im1[3] = MUL_F(filter[2],(QMF_IM(buffer[10+i]) - QMF_IM(buffer[2+i]))); - - for (n = 0; n < 4; n++) - { - x[n] = input_re1[n] - input_im1[3-n]; - } - DCT3_4_unscaled(x, x); - QMF_RE(X_hybrid[i][7]) = x[0]; - QMF_RE(X_hybrid[i][5]) = x[2]; - QMF_RE(X_hybrid[i][3]) = x[3]; - QMF_RE(X_hybrid[i][1]) = x[1]; - - for (n = 0; n < 4; n++) - { - x[n] = input_re1[n] + input_im1[3-n]; - } - DCT3_4_unscaled(x, x); - QMF_RE(X_hybrid[i][6]) = x[1]; - QMF_RE(X_hybrid[i][4]) = x[3]; - QMF_RE(X_hybrid[i][2]) = x[2]; - QMF_RE(X_hybrid[i][0]) = x[0]; - - input_im2[0] = MUL_F(filter[6],QMF_IM(buffer[6+i])); - input_im2[1] = MUL_F(filter[5],(QMF_IM(buffer[5+i]) + QMF_IM(buffer[7+i]))); - input_im2[2] = -MUL_F(filter[0],(QMF_IM(buffer[0+i]) + QMF_IM(buffer[12+i]))) + MUL_F(filter[4],(QMF_IM(buffer[4+i]) + QMF_IM(buffer[8+i]))); - input_im2[3] = -MUL_F(filter[1],(QMF_IM(buffer[1+i]) + QMF_IM(buffer[11+i]))) + MUL_F(filter[3],(QMF_IM(buffer[3+i]) + QMF_IM(buffer[9+i]))); - - input_re2[0] = MUL_F(filter[5],(QMF_RE(buffer[7+i]) - QMF_RE(buffer[5+i]))); - input_re2[1] = MUL_F(filter[0],(QMF_RE(buffer[12+i]) - QMF_RE(buffer[0+i]))) + MUL_F(filter[4],(QMF_RE(buffer[8+i]) - QMF_RE(buffer[4+i]))); - input_re2[2] = MUL_F(filter[1],(QMF_RE(buffer[11+i]) - QMF_RE(buffer[1+i]))) + MUL_F(filter[3],(QMF_RE(buffer[9+i]) - QMF_RE(buffer[3+i]))); - input_re2[3] = MUL_F(filter[2],(QMF_RE(buffer[10+i]) - QMF_RE(buffer[2+i]))); - - for (n = 0; n < 4; n++) - { - x[n] = input_im2[n] + input_re2[3-n]; - } - DCT3_4_unscaled(x, x); - QMF_IM(X_hybrid[i][7]) = x[0]; - QMF_IM(X_hybrid[i][5]) = x[2]; - QMF_IM(X_hybrid[i][3]) = x[3]; - QMF_IM(X_hybrid[i][1]) = x[1]; - - for (n = 0; n < 4; n++) - { - x[n] = input_im2[n] - input_re2[3-n]; - } - DCT3_4_unscaled(x, x); - QMF_IM(X_hybrid[i][6]) = x[1]; - QMF_IM(X_hybrid[i][4]) = x[3]; - QMF_IM(X_hybrid[i][2]) = x[2]; - QMF_IM(X_hybrid[i][0]) = x[0]; - } -} - -static void INLINE DCT3_6_unscaled(real_t *y, real_t *x) -{ - real_t f0, f1, f2, f3, f4, f5, f6, f7; - - f0 = MUL_F(x[3], FRAC_CONST(0.70710678118655)); - f1 = x[0] + f0; - f2 = x[0] - f0; - f3 = MUL_F((x[1] - x[5]), FRAC_CONST(0.70710678118655)); - f4 = MUL_F(x[2], FRAC_CONST(0.86602540378444)) + MUL_F(x[4], FRAC_CONST(0.5)); - f5 = f4 - x[4]; - f6 = MUL_F(x[1], FRAC_CONST(0.96592582628907)) + MUL_F(x[5], FRAC_CONST(0.25881904510252)); - f7 = f6 - f3; - y[0] = f1 + f6 + f4; - y[1] = f2 + f3 - x[4]; - y[2] = f7 + f2 - f5; - y[3] = f1 - f7 - f5; - y[4] = f1 - f3 - x[4]; - y[5] = f2 - f6 + f4; -} - -/* complex filter, size 12 */ -static void channel_filter12(hyb_info *hyb, uint8_t frame_len, const real_t *filter, - qmf_t *buffer, qmf_t **X_hybrid) -{ - uint8_t i, n; - real_t input_re1[6], input_re2[6], input_im1[6], input_im2[6]; - real_t out_re1[6], out_re2[6], out_im1[6], out_im2[6]; - - for (i = 0; i < frame_len; i++) - { - for (n = 0; n < 6; n++) - { - if (n == 0) - { - input_re1[0] = MUL_F(QMF_RE(buffer[6+i]), filter[6]); - input_re2[0] = MUL_F(QMF_IM(buffer[6+i]), filter[6]); - } else { - input_re1[6-n] = MUL_F((QMF_RE(buffer[n+i]) + QMF_RE(buffer[12-n+i])), filter[n]); - input_re2[6-n] = MUL_F((QMF_IM(buffer[n+i]) + QMF_IM(buffer[12-n+i])), filter[n]); - } - input_im2[n] = MUL_F((QMF_RE(buffer[n+i]) - QMF_RE(buffer[12-n+i])), filter[n]); - input_im1[n] = MUL_F((QMF_IM(buffer[n+i]) - QMF_IM(buffer[12-n+i])), filter[n]); - } - - DCT3_6_unscaled(out_re1, input_re1); - DCT3_6_unscaled(out_re2, input_re2); - - DCT3_6_unscaled(out_im1, input_im1); - DCT3_6_unscaled(out_im2, input_im2); - - for (n = 0; n < 6; n += 2) - { - QMF_RE(X_hybrid[i][n]) = out_re1[n] - out_im1[n]; - QMF_IM(X_hybrid[i][n]) = out_re2[n] + out_im2[n]; - QMF_RE(X_hybrid[i][n+1]) = out_re1[n+1] + out_im1[n+1]; - QMF_IM(X_hybrid[i][n+1]) = out_re2[n+1] - out_im2[n+1]; - - QMF_RE(X_hybrid[i][10-n]) = out_re1[n+1] - out_im1[n+1]; - QMF_IM(X_hybrid[i][10-n]) = out_re2[n+1] + out_im2[n+1]; - QMF_RE(X_hybrid[i][11-n]) = out_re1[n] + out_im1[n]; - QMF_IM(X_hybrid[i][11-n]) = out_re2[n] - out_im2[n]; - } - } -} - -/* Hybrid analysis: further split up QMF subbands - * to improve frequency resolution - */ -static void hybrid_analysis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32], - uint8_t use34) -{ - uint8_t k, n, band; - uint8_t offset = 0; - uint8_t qmf_bands = (use34) ? 5 : 3; - uint8_t *resolution = (use34) ? hyb->resolution34 : hyb->resolution20; - - for (band = 0; band < qmf_bands; band++) - { - /* build working buffer */ - memcpy(hyb->work, hyb->buffer[band], 12 * sizeof(qmf_t)); - - /* add new samples */ - for (n = 0; n < hyb->frame_len; n++) - { - QMF_RE(hyb->work[12 + n]) = QMF_RE(X[n + 6 /*delay*/][band]); - QMF_IM(hyb->work[12 + n]) = QMF_IM(X[n + 6 /*delay*/][band]); - } - - /* store samples */ - memcpy(hyb->buffer[band], hyb->work + hyb->frame_len, 12 * sizeof(qmf_t)); - - - switch(resolution[band]) - { - case 2: - /* Type B real filter, Q[p] = 2 */ - channel_filter2(hyb, hyb->frame_len, p2_13_20, hyb->work, hyb->temp); - break; - case 4: - /* Type A complex filter, Q[p] = 4 */ - channel_filter4(hyb, hyb->frame_len, p4_13_34, hyb->work, hyb->temp); - break; - case 8: - /* Type A complex filter, Q[p] = 8 */ - channel_filter8(hyb, hyb->frame_len, (use34) ? p8_13_34 : p8_13_20, - hyb->work, hyb->temp); - break; - case 12: - /* Type A complex filter, Q[p] = 12 */ - channel_filter12(hyb, hyb->frame_len, p12_13_34, hyb->work, hyb->temp); - break; - } - - for (n = 0; n < hyb->frame_len; n++) - { - for (k = 0; k < resolution[band]; k++) - { - QMF_RE(X_hybrid[n][offset + k]) = QMF_RE(hyb->temp[n][k]); - QMF_IM(X_hybrid[n][offset + k]) = QMF_IM(hyb->temp[n][k]); - } - } - offset += resolution[band]; - } - - /* group hybrid channels */ - if (!use34) - { - for (n = 0; n < 32 /*30?*/; n++) - { - QMF_RE(X_hybrid[n][3]) += QMF_RE(X_hybrid[n][4]); - QMF_IM(X_hybrid[n][3]) += QMF_IM(X_hybrid[n][4]); - QMF_RE(X_hybrid[n][4]) = 0; - QMF_IM(X_hybrid[n][4]) = 0; - - QMF_RE(X_hybrid[n][2]) += QMF_RE(X_hybrid[n][5]); - QMF_IM(X_hybrid[n][2]) += QMF_IM(X_hybrid[n][5]); - QMF_RE(X_hybrid[n][5]) = 0; - QMF_IM(X_hybrid[n][5]) = 0; - } - } -} - -static void hybrid_synthesis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32], - uint8_t use34) -{ - uint8_t k, n, band; - uint8_t offset = 0; - uint8_t qmf_bands = (use34) ? 5 : 3; - uint8_t *resolution = (use34) ? hyb->resolution34 : hyb->resolution20; - - for(band = 0; band < qmf_bands; band++) - { - for (n = 0; n < hyb->frame_len; n++) - { - QMF_RE(X[n][band]) = 0; - QMF_IM(X[n][band]) = 0; - - for (k = 0; k < resolution[band]; k++) - { - QMF_RE(X[n][band]) += QMF_RE(X_hybrid[n][offset + k]); - QMF_IM(X[n][band]) += QMF_IM(X_hybrid[n][offset + k]); - } - } - offset += resolution[band]; - } -} - -/* limits the value i to the range [min,max] */ -static int8_t delta_clip(int8_t i, int8_t min, int8_t max) -{ - if (i < min) - return min; - else if (i > max) - return max; - else - return i; -} - -//int iid = 0; - -/* delta decode array */ -static void delta_decode(uint8_t enable, int8_t *index, int8_t *index_prev, - uint8_t dt_flag, uint8_t nr_par, uint8_t stride, - int8_t min_index, int8_t max_index) -{ - int8_t i; - - if (enable == 1) - { - if (dt_flag == 0) - { - /* delta coded in frequency direction */ - index[0] = 0 + index[0]; - index[0] = delta_clip(index[0], min_index, max_index); - - for (i = 1; i < nr_par; i++) - { - index[i] = index[i-1] + index[i]; - index[i] = delta_clip(index[i], min_index, max_index); - } - } else { - /* delta coded in time direction */ - for (i = 0; i < nr_par; i++) - { - //int8_t tmp2; - //int8_t tmp = index[i]; - - //printf("%d %d\n", index_prev[i*stride], index[i]); - //printf("%d\n", index[i]); - - index[i] = index_prev[i*stride] + index[i]; - //tmp2 = index[i]; - index[i] = delta_clip(index[i], min_index, max_index); - - //if (iid) - //{ - // if (index[i] == 7) - // { - // printf("%d %d %d\n", index_prev[i*stride], tmp, tmp2); - // } - //} - } - } - } else { - /* set indices to zero */ - for (i = 0; i < nr_par; i++) - { - index[i] = 0; - } - } - - /* coarse */ - if (stride == 2) - { - for (i = (nr_par<<1)-1; i > 0; i--) - { - index[i] = index[i>>1]; - } - } -} - -/* delta modulo decode array */ -/* in: log2 value of the modulo value to allow using AND instead of MOD */ -static void delta_modulo_decode(uint8_t enable, int8_t *index, int8_t *index_prev, - uint8_t dt_flag, uint8_t nr_par, uint8_t stride, - int8_t log2modulo) -{ - int8_t i; - - if (enable == 1) - { - if (dt_flag == 0) - { - /* delta coded in frequency direction */ - index[0] = 0 + index[0]; - index[0] &= log2modulo; - - for (i = 1; i < nr_par; i++) - { - index[i] = index[i-1] + index[i]; - index[i] &= log2modulo; - } - } else { - /* delta coded in time direction */ - for (i = 0; i < nr_par; i++) - { - index[i] = index_prev[i*stride] + index[i]; - index[i] &= log2modulo; - } - } - } else { - /* set indices to zero */ - for (i = 0; i < nr_par; i++) - { - index[i] = 0; - } - } - - /* coarse */ - if (stride == 2) - { - index[0] = 0; - for (i = (nr_par<<1)-1; i > 0; i--) - { - index[i] = index[i>>1]; - } - } -} - -#ifdef PS_LOW_POWER -static void map34indexto20(int8_t *index, uint8_t bins) -{ - index[0] = (2*index[0]+index[1])/3; - index[1] = (index[1]+2*index[2])/3; - index[2] = (2*index[3]+index[4])/3; - index[3] = (index[4]+2*index[5])/3; - index[4] = (index[6]+index[7])/2; - index[5] = (index[8]+index[9])/2; - index[6] = index[10]; - index[7] = index[11]; - index[8] = (index[12]+index[13])/2; - index[9] = (index[14]+index[15])/2; - index[10] = index[16]; - - if (bins == 34) - { - index[11] = index[17]; - index[12] = index[18]; - index[13] = index[19]; - index[14] = (index[20]+index[21])/2; - index[15] = (index[22]+index[23])/2; - index[16] = (index[24]+index[25])/2; - index[17] = (index[26]+index[27])/2; - index[18] = (index[28]+index[29]+index[30]+index[31])/4; - index[19] = (index[32]+index[33])/2; - } -} -#endif - -static void map20indexto34(int8_t *index, uint8_t bins) -{ - index[0] = index[0]; - index[1] = (index[0] + index[1])/2; - index[2] = index[1]; - index[3] = index[2]; - index[4] = (index[2] + index[3])/2; - index[5] = index[3]; - index[6] = index[4]; - index[7] = index[4]; - index[8] = index[5]; - index[9] = index[5]; - index[10] = index[6]; - index[11] = index[7]; - index[12] = index[8]; - index[13] = index[8]; - index[14] = index[9]; - index[15] = index[9]; - index[16] = index[10]; - - if (bins == 34) - { - index[17] = index[11]; - index[18] = index[12]; - index[19] = index[13]; - index[20] = index[14]; - index[21] = index[14]; - index[22] = index[15]; - index[23] = index[15]; - index[24] = index[16]; - index[25] = index[16]; - index[26] = index[17]; - index[27] = index[17]; - index[28] = index[18]; - index[29] = index[18]; - index[30] = index[18]; - index[31] = index[18]; - index[32] = index[19]; - index[33] = index[19]; - } -} - -/* parse the bitstream data decoded in ps_data() */ -static void ps_data_decode(ps_info *ps) -{ - uint8_t env, bin; - - /* ps data not available, use data from previous frame */ - if (ps->ps_data_available == 0) - { - ps->num_env = 0; - } - - for (env = 0; env < ps->num_env; env++) - { - int8_t *iid_index_prev; - int8_t *icc_index_prev; - int8_t *ipd_index_prev; - int8_t *opd_index_prev; - - int8_t num_iid_steps = (ps->iid_mode < 3) ? 7 : 15 /*fine quant*/; - - if (env == 0) - { - /* take last envelope from previous frame */ - iid_index_prev = ps->iid_index_prev; - icc_index_prev = ps->icc_index_prev; - ipd_index_prev = ps->ipd_index_prev; - opd_index_prev = ps->opd_index_prev; - } else { - /* take index values from previous envelope */ - iid_index_prev = ps->iid_index[env - 1]; - icc_index_prev = ps->icc_index[env - 1]; - ipd_index_prev = ps->ipd_index[env - 1]; - opd_index_prev = ps->opd_index[env - 1]; - } - -// iid = 1; - /* delta decode iid parameters */ - delta_decode(ps->enable_iid, ps->iid_index[env], iid_index_prev, - ps->iid_dt[env], ps->nr_iid_par, - (ps->iid_mode == 0 || ps->iid_mode == 3) ? 2 : 1, - -num_iid_steps, num_iid_steps); -// iid = 0; - - /* delta decode icc parameters */ - delta_decode(ps->enable_icc, ps->icc_index[env], icc_index_prev, - ps->icc_dt[env], ps->nr_icc_par, - (ps->icc_mode == 0 || ps->icc_mode == 3) ? 2 : 1, - 0, 7); - - /* delta modulo decode ipd parameters */ - delta_modulo_decode(ps->enable_ipdopd, ps->ipd_index[env], ipd_index_prev, - ps->ipd_dt[env], ps->nr_ipdopd_par, 1, /*log2(8)*/ 3); - - /* delta modulo decode opd parameters */ - delta_modulo_decode(ps->enable_ipdopd, ps->opd_index[env], opd_index_prev, - ps->opd_dt[env], ps->nr_ipdopd_par, 1, /*log2(8)*/ 3); - } - - /* handle error case */ - if (ps->num_env == 0) - { - /* force to 1 */ - ps->num_env = 1; - - if (ps->enable_iid) - { - for (bin = 0; bin < 34; bin++) - ps->iid_index[0][bin] = ps->iid_index_prev[bin]; - } else { - for (bin = 0; bin < 34; bin++) - ps->iid_index[0][bin] = 0; - } - - if (ps->enable_icc) - { - for (bin = 0; bin < 34; bin++) - ps->icc_index[0][bin] = ps->icc_index_prev[bin]; - } else { - for (bin = 0; bin < 34; bin++) - ps->icc_index[0][bin] = 0; - } - - if (ps->enable_ipdopd) - { - for (bin = 0; bin < 17; bin++) - { - ps->ipd_index[0][bin] = ps->ipd_index_prev[bin]; - ps->opd_index[0][bin] = ps->opd_index_prev[bin]; - } - } else { - for (bin = 0; bin < 17; bin++) - { - ps->ipd_index[0][bin] = 0; - ps->opd_index[0][bin] = 0; - } - } - } - - /* update previous indices */ - for (bin = 0; bin < 34; bin++) - ps->iid_index_prev[bin] = ps->iid_index[ps->num_env-1][bin]; - for (bin = 0; bin < 34; bin++) - ps->icc_index_prev[bin] = ps->icc_index[ps->num_env-1][bin]; - for (bin = 0; bin < 17; bin++) - { - ps->ipd_index_prev[bin] = ps->ipd_index[ps->num_env-1][bin]; - ps->opd_index_prev[bin] = ps->opd_index[ps->num_env-1][bin]; - } - - ps->ps_data_available = 0; - - if (ps->frame_class == 0) - { - ps->border_position[0] = 0; - for (env = 1; env < ps->num_env; env++) - { - ps->border_position[env] = (env * 32 /* 30 for 960? */) / ps->num_env; - } - ps->border_position[ps->num_env] = 32 /* 30 for 960? */; - } else { - ps->border_position[0] = 0; - - if (ps->border_position[ps->num_env] < 32 /* 30 for 960? */) - { - ps->num_env++; - ps->border_position[ps->num_env] = 32 /* 30 for 960? */; - for (bin = 0; bin < 34; bin++) - { - ps->iid_index[ps->num_env][bin] = ps->iid_index[ps->num_env-1][bin]; - ps->icc_index[ps->num_env][bin] = ps->icc_index[ps->num_env-1][bin]; - } - for (bin = 0; bin < 17; bin++) - { - ps->ipd_index[ps->num_env][bin] = ps->ipd_index[ps->num_env-1][bin]; - ps->opd_index[ps->num_env][bin] = ps->opd_index[ps->num_env-1][bin]; - } - } - - for (env = 1; env < ps->num_env; env++) - { - int8_t thr = 32 /* 30 for 960? */ - (ps->num_env - env); - - if (ps->border_position[env] > thr) - { - ps->border_position[env] = thr; - } else { - thr = ps->border_position[env-1]+1; - if (ps->border_position[env] < thr) - { - ps->border_position[env] = thr; - } - } - } - } - - /* make sure that the indices of all parameters can be mapped - * to the same hybrid synthesis filterbank - */ -#ifdef PS_LOW_POWER - for (env = 0; env < ps->num_env; env++) - { - if (ps->iid_mode == 2 || ps->iid_mode == 5) - map34indexto20(ps->iid_index[env], 34); - if (ps->icc_mode == 2 || ps->icc_mode == 5) - map34indexto20(ps->icc_index[env], 34); - - /* disable ipd/opd */ - for (bin = 0; bin < 17; bin++) - { - ps->aaIpdIndex[env][bin] = 0; - ps->aaOpdIndex[env][bin] = 0; - } - } -#else - if (ps->use34hybrid_bands) - { - for (env = 0; env < ps->num_env; env++) - { - if (ps->iid_mode != 2 && ps->iid_mode != 5) - map20indexto34(ps->iid_index[env], 34); - if (ps->icc_mode != 2 && ps->icc_mode != 5) - map20indexto34(ps->icc_index[env], 34); - if (ps->ipd_mode != 2 && ps->ipd_mode != 5) - { - map20indexto34(ps->ipd_index[env], 17); - map20indexto34(ps->opd_index[env], 17); - } - } - } -#endif - -#if 0 - for (env = 0; env < ps->num_env; env++) - { - printf("iid[env:%d]:", env); - for (bin = 0; bin < 34; bin++) - { - printf(" %d", ps->iid_index[env][bin]); - } - printf("\n"); - } - for (env = 0; env < ps->num_env; env++) - { - printf("icc[env:%d]:", env); - for (bin = 0; bin < 34; bin++) - { - printf(" %d", ps->icc_index[env][bin]); - } - printf("\n"); - } - for (env = 0; env < ps->num_env; env++) - { - printf("ipd[env:%d]:", env); - for (bin = 0; bin < 17; bin++) - { - printf(" %d", ps->ipd_index[env][bin]); - } - printf("\n"); - } - for (env = 0; env < ps->num_env; env++) - { - printf("opd[env:%d]:", env); - for (bin = 0; bin < 17; bin++) - { - printf(" %d", ps->opd_index[env][bin]); - } - printf("\n"); - } - printf("\n"); -#endif -} - -/* decorrelate the mono signal using an allpass filter */ -static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64], - qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]) -{ - uint8_t gr, n, m, bk; - uint8_t temp_delay; - uint8_t sb, maxsb; - const complex_t *Phi_Fract_SubQmf; - uint8_t temp_delay_ser[NO_ALLPASS_LINKS]; - real_t P_SmoothPeakDecayDiffNrg, nrg; - real_t P[32][34]; - real_t G_TransientRatio[32][34] = {{0}}; - complex_t inputLeft; - - - /* chose hybrid filterbank: 20 or 34 band case */ - if (ps->use34hybrid_bands) - { - Phi_Fract_SubQmf = Phi_Fract_SubQmf34; - } else{ - Phi_Fract_SubQmf = Phi_Fract_SubQmf20; - } - - /* clear the energy values */ - for (n = 0; n < 32; n++) - { - for (bk = 0; bk < 34; bk++) - { - P[n][bk] = 0; - } - } - - /* calculate the energy in each parameter band b(k) */ - for (gr = 0; gr < ps->num_groups; gr++) - { - /* select the parameter index b(k) to which this group belongs */ - bk = (~NEGATE_IPD_MASK) & ps->map_group2bk[gr]; - - /* select the upper subband border for this group */ - maxsb = (gr < ps->num_hybrid_groups) ? ps->group_border[gr]+1 : ps->group_border[gr+1]; - - for (sb = ps->group_border[gr]; sb < maxsb; sb++) - { - for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++) - { -#ifdef FIXED_POINT - uint32_t in_re, in_im; -#endif - - /* input from hybrid subbands or QMF subbands */ - if (gr < ps->num_hybrid_groups) - { - RE(inputLeft) = QMF_RE(X_hybrid_left[n][sb]); - IM(inputLeft) = QMF_IM(X_hybrid_left[n][sb]); - } else { - RE(inputLeft) = QMF_RE(X_left[n][sb]); - IM(inputLeft) = QMF_IM(X_left[n][sb]); - } - - /* accumulate energy */ -#ifdef FIXED_POINT - /* NOTE: all input is scaled by 2^(-5) because of fixed point QMF - * meaning that P will be scaled by 2^(-10) compared to floating point version - */ - in_re = ((abs(RE(inputLeft))+(1<<(REAL_BITS-1)))>>REAL_BITS); - in_im = ((abs(IM(inputLeft))+(1<<(REAL_BITS-1)))>>REAL_BITS); - P[n][bk] += in_re*in_re + in_im*in_im; -#else - P[n][bk] += MUL_R(RE(inputLeft),RE(inputLeft)) + MUL_R(IM(inputLeft),IM(inputLeft)); -#endif - } - } - } - -#if 0 - for (n = 0; n < 32; n++) - { - for (bk = 0; bk < 34; bk++) - { -#ifdef FIXED_POINT - printf("%d %d: %d\n", n, bk, P[n][bk] /*/(float)REAL_PRECISION*/); -#else - printf("%d %d: %f\n", n, bk, P[n][bk]/1024.0); -#endif - } - } -#endif - - /* calculate transient reduction ratio for each parameter band b(k) */ - for (bk = 0; bk < ps->nr_par_bands; bk++) - { - for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++) - { - const real_t gamma = COEF_CONST(1.5); - - ps->P_PeakDecayNrg[bk] = MUL_F(ps->P_PeakDecayNrg[bk], ps->alpha_decay); - if (ps->P_PeakDecayNrg[bk] < P[n][bk]) - ps->P_PeakDecayNrg[bk] = P[n][bk]; - - /* apply smoothing filter to peak decay energy */ - P_SmoothPeakDecayDiffNrg = ps->P_SmoothPeakDecayDiffNrg_prev[bk]; - P_SmoothPeakDecayDiffNrg += MUL_F((ps->P_PeakDecayNrg[bk] - P[n][bk] - ps->P_SmoothPeakDecayDiffNrg_prev[bk]), ps->alpha_smooth); - ps->P_SmoothPeakDecayDiffNrg_prev[bk] = P_SmoothPeakDecayDiffNrg; - - /* apply smoothing filter to energy */ - nrg = ps->P_prev[bk]; - nrg += MUL_F((P[n][bk] - ps->P_prev[bk]), ps->alpha_smooth); - ps->P_prev[bk] = nrg; - - /* calculate transient ratio */ - if (MUL_C(P_SmoothPeakDecayDiffNrg, gamma) <= nrg) - { - G_TransientRatio[n][bk] = REAL_CONST(1.0); - } else { - G_TransientRatio[n][bk] = DIV_R(nrg, (MUL_C(P_SmoothPeakDecayDiffNrg, gamma))); - } - } - } - -#if 0 - for (n = 0; n < 32; n++) - { - for (bk = 0; bk < 34; bk++) - { -#ifdef FIXED_POINT - printf("%d %d: %f\n", n, bk, G_TransientRatio[n][bk]/(float)REAL_PRECISION); -#else - printf("%d %d: %f\n", n, bk, G_TransientRatio[n][bk]); -#endif - } - } -#endif - - /* apply stereo decorrelation filter to the signal */ - for (gr = 0; gr < ps->num_groups; gr++) - { - if (gr < ps->num_hybrid_groups) - maxsb = ps->group_border[gr] + 1; - else - maxsb = ps->group_border[gr + 1]; - - /* QMF channel */ - for (sb = ps->group_border[gr]; sb < maxsb; sb++) - { - real_t g_DecaySlope; - real_t g_DecaySlope_filt[NO_ALLPASS_LINKS]; - - /* g_DecaySlope: [0..1] */ - if (gr < ps->num_hybrid_groups || sb <= ps->decay_cutoff) - { - g_DecaySlope = FRAC_CONST(1.0); - } else { - int8_t decay = ps->decay_cutoff - sb; - if (decay <= -20 /* -1/DECAY_SLOPE */) - { - g_DecaySlope = 0; - } else { - /* decay(int)*decay_slope(frac) = g_DecaySlope(frac) */ - g_DecaySlope = FRAC_CONST(1.0) + DECAY_SLOPE * decay; - } - } - - /* calculate g_DecaySlope_filt for every m multiplied by filter_a[m] */ - for (m = 0; m < NO_ALLPASS_LINKS; m++) - { - g_DecaySlope_filt[m] = MUL_F(g_DecaySlope, filter_a[m]); - } - - - /* set delay indices */ - temp_delay = ps->saved_delay; - for (n = 0; n < NO_ALLPASS_LINKS; n++) - temp_delay_ser[n] = ps->delay_buf_index_ser[n]; - - for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++) - { - complex_t tmp, tmp0, R0; - - if (gr < ps->num_hybrid_groups) - { - /* hybrid filterbank input */ - RE(inputLeft) = QMF_RE(X_hybrid_left[n][sb]); - IM(inputLeft) = QMF_IM(X_hybrid_left[n][sb]); - } else { - /* QMF filterbank input */ - RE(inputLeft) = QMF_RE(X_left[n][sb]); - IM(inputLeft) = QMF_IM(X_left[n][sb]); - } - - if (sb > ps->nr_allpass_bands && gr >= ps->num_hybrid_groups) - { - /* delay */ - - /* never hybrid subbands here, always QMF subbands */ - RE(tmp) = RE(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]); - IM(tmp) = IM(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]); - RE(R0) = RE(tmp); - IM(R0) = IM(tmp); - RE(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]) = RE(inputLeft); - IM(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]) = IM(inputLeft); - } else { - /* allpass filter */ - uint8_t m; - complex_t Phi_Fract; - - /* fetch parameters */ - if (gr < ps->num_hybrid_groups) - { - /* select data from the hybrid subbands */ - RE(tmp0) = RE(ps->delay_SubQmf[temp_delay][sb]); - IM(tmp0) = IM(ps->delay_SubQmf[temp_delay][sb]); - - RE(ps->delay_SubQmf[temp_delay][sb]) = RE(inputLeft); - IM(ps->delay_SubQmf[temp_delay][sb]) = IM(inputLeft); - - RE(Phi_Fract) = RE(Phi_Fract_SubQmf[sb]); - IM(Phi_Fract) = IM(Phi_Fract_SubQmf[sb]); - } else { - /* select data from the QMF subbands */ - RE(tmp0) = RE(ps->delay_Qmf[temp_delay][sb]); - IM(tmp0) = IM(ps->delay_Qmf[temp_delay][sb]); - - RE(ps->delay_Qmf[temp_delay][sb]) = RE(inputLeft); - IM(ps->delay_Qmf[temp_delay][sb]) = IM(inputLeft); - - RE(Phi_Fract) = RE(Phi_Fract_Qmf[sb]); - IM(Phi_Fract) = IM(Phi_Fract_Qmf[sb]); - } - - /* z^(-2) * Phi_Fract[k] */ - ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Phi_Fract), IM(Phi_Fract)); - - RE(R0) = RE(tmp); - IM(R0) = IM(tmp); - for (m = 0; m < NO_ALLPASS_LINKS; m++) - { - complex_t Q_Fract_allpass, tmp2; - - /* fetch parameters */ - if (gr < ps->num_hybrid_groups) - { - /* select data from the hybrid subbands */ - RE(tmp0) = RE(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]); - IM(tmp0) = IM(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]); - - if (ps->use34hybrid_bands) - { - RE(Q_Fract_allpass) = RE(Q_Fract_allpass_SubQmf34[sb][m]); - IM(Q_Fract_allpass) = IM(Q_Fract_allpass_SubQmf34[sb][m]); - } else { - RE(Q_Fract_allpass) = RE(Q_Fract_allpass_SubQmf20[sb][m]); - IM(Q_Fract_allpass) = IM(Q_Fract_allpass_SubQmf20[sb][m]); - } - } else { - /* select data from the QMF subbands */ - RE(tmp0) = RE(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]); - IM(tmp0) = IM(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]); - - RE(Q_Fract_allpass) = RE(Q_Fract_allpass_Qmf[sb][m]); - IM(Q_Fract_allpass) = IM(Q_Fract_allpass_Qmf[sb][m]); - } - - /* delay by a fraction */ - /* z^(-d(m)) * Q_Fract_allpass[k,m] */ - ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Q_Fract_allpass), IM(Q_Fract_allpass)); - - /* -a(m) * g_DecaySlope[k] */ - RE(tmp) += -MUL_F(g_DecaySlope_filt[m], RE(R0)); - IM(tmp) += -MUL_F(g_DecaySlope_filt[m], IM(R0)); - - /* -a(m) * g_DecaySlope[k] * Q_Fract_allpass[k,m] * z^(-d(m)) */ - RE(tmp2) = RE(R0) + MUL_F(g_DecaySlope_filt[m], RE(tmp)); - IM(tmp2) = IM(R0) + MUL_F(g_DecaySlope_filt[m], IM(tmp)); - - /* store sample */ - if (gr < ps->num_hybrid_groups) - { - RE(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]) = RE(tmp2); - IM(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]) = IM(tmp2); - } else { - RE(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]) = RE(tmp2); - IM(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]) = IM(tmp2); - } - - /* store for next iteration (or as output value if last iteration) */ - RE(R0) = RE(tmp); - IM(R0) = IM(tmp); - } - } - - /* select b(k) for reading the transient ratio */ - bk = (~NEGATE_IPD_MASK) & ps->map_group2bk[gr]; - - /* duck if a past transient is found */ - RE(R0) = MUL_R(G_TransientRatio[n][bk], RE(R0)); - IM(R0) = MUL_R(G_TransientRatio[n][bk], IM(R0)); - - if (gr < ps->num_hybrid_groups) - { - /* hybrid */ - QMF_RE(X_hybrid_right[n][sb]) = RE(R0); - QMF_IM(X_hybrid_right[n][sb]) = IM(R0); - } else { - /* QMF */ - QMF_RE(X_right[n][sb]) = RE(R0); - QMF_IM(X_right[n][sb]) = IM(R0); - } - - /* Update delay buffer index */ - if (++temp_delay >= 2) - { - temp_delay = 0; - } - - /* update delay indices */ - if (sb > ps->nr_allpass_bands && gr >= ps->num_hybrid_groups) - { - /* delay_D depends on the samplerate, it can hold the values 14 and 1 */ - if (++ps->delay_buf_index_delay[sb] >= ps->delay_D[sb]) - { - ps->delay_buf_index_delay[sb] = 0; - } - } - - for (m = 0; m < NO_ALLPASS_LINKS; m++) - { - if (++temp_delay_ser[m] >= ps->num_sample_delay_ser[m]) - { - temp_delay_ser[m] = 0; - } - } - } - } - } - - /* update delay indices */ - ps->saved_delay = temp_delay; - for (m = 0; m < NO_ALLPASS_LINKS; m++) - ps->delay_buf_index_ser[m] = temp_delay_ser[m]; -} - -#ifdef FIXED_POINT -#define step(shift) \ - if ((0x40000000l >> shift) + root <= value) \ - { \ - value -= (0x40000000l >> shift) + root; \ - root = (root >> 1) | (0x40000000l >> shift); \ - } else { \ - root = root >> 1; \ - } - -/* fixed point square root approximation */ -static real_t ps_sqrt(real_t value) -{ - real_t root = 0; - - step( 0); step( 2); step( 4); step( 6); - step( 8); step(10); step(12); step(14); - step(16); step(18); step(20); step(22); - step(24); step(26); step(28); step(30); - - if (root < value) - ++root; - - root <<= (REAL_BITS/2); - - return root; -} -#else -#define ps_sqrt(A) sqrt(A) -#endif - -static const real_t ipdopd_cos_tab[] = { - FRAC_CONST(1.000000000000000), - FRAC_CONST(0.707106781186548), - FRAC_CONST(0.000000000000000), - FRAC_CONST(-0.707106781186547), - FRAC_CONST(-1.000000000000000), - FRAC_CONST(-0.707106781186548), - FRAC_CONST(-0.000000000000000), - FRAC_CONST(0.707106781186547), - FRAC_CONST(1.000000000000000) -}; - -static const real_t ipdopd_sin_tab[] = { - FRAC_CONST(0.000000000000000), - FRAC_CONST(0.707106781186547), - FRAC_CONST(1.000000000000000), - FRAC_CONST(0.707106781186548), - FRAC_CONST(0.000000000000000), - FRAC_CONST(-0.707106781186547), - FRAC_CONST(-1.000000000000000), - FRAC_CONST(-0.707106781186548), - FRAC_CONST(-0.000000000000000) -}; - -static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64], - qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]) -{ - uint8_t n; - uint8_t gr; - uint8_t bk = 0; - uint8_t sb, maxsb; - uint8_t env; - uint8_t nr_ipdopd_par; - complex_t h11, h12, h21, h22; - complex_t H11, H12, H21, H22; - complex_t deltaH11, deltaH12, deltaH21, deltaH22; - complex_t tempLeft; - complex_t tempRight; - complex_t phaseLeft; - complex_t phaseRight; - real_t L; - const real_t *sf_iid; - uint8_t no_iid_steps; - - if (ps->iid_mode >= 3) - { - no_iid_steps = 15; - sf_iid = sf_iid_fine; - } else { - no_iid_steps = 7; - sf_iid = sf_iid_normal; - } - - if (ps->ipd_mode == 0 || ps->ipd_mode == 3) - { - nr_ipdopd_par = 11; /* resolution */ - } else { - nr_ipdopd_par = ps->nr_ipdopd_par; - } - - for (gr = 0; gr < ps->num_groups; gr++) - { - bk = (~NEGATE_IPD_MASK) & ps->map_group2bk[gr]; - - /* use one channel per group in the subqmf domain */ - maxsb = (gr < ps->num_hybrid_groups) ? ps->group_border[gr] + 1 : ps->group_border[gr + 1]; - - for (env = 0; env < ps->num_env; env++) - { - if (ps->icc_mode < 3) - { - /* type 'A' mixing as described in 8.6.4.6.2.1 */ - real_t c_1, c_2; - real_t cosa, sina; - real_t cosb, sinb; - real_t ab1, ab2; - real_t ab3, ab4; - - /* - c_1 = sqrt(2.0 / (1.0 + pow(10.0, quant_iid[no_iid_steps + iid_index] / 10.0))); - c_2 = sqrt(2.0 / (1.0 + pow(10.0, quant_iid[no_iid_steps - iid_index] / 10.0))); - alpha = 0.5 * acos(quant_rho[icc_index]); - beta = alpha * ( c_1 - c_2 ) / sqrt(2.0); - */ - - //printf("%d\n", ps->iid_index[env][bk]); - - /* calculate the scalefactors c_1 and c_2 from the intensity differences */ - c_1 = sf_iid[no_iid_steps + ps->iid_index[env][bk]]; - c_2 = sf_iid[no_iid_steps - ps->iid_index[env][bk]]; - - /* calculate alpha and beta using the ICC parameters */ - cosa = cos_alphas[ps->icc_index[env][bk]]; - sina = sin_alphas[ps->icc_index[env][bk]]; - - if (ps->iid_mode >= 3) - { - if (ps->iid_index[env][bk] < 0) - { - cosb = cos_betas_fine[-ps->iid_index[env][bk]][ps->icc_index[env][bk]]; - sinb = -sin_betas_fine[-ps->iid_index[env][bk]][ps->icc_index[env][bk]]; - } else { - cosb = cos_betas_fine[ps->iid_index[env][bk]][ps->icc_index[env][bk]]; - sinb = sin_betas_fine[ps->iid_index[env][bk]][ps->icc_index[env][bk]]; - } - } else { - if (ps->iid_index[env][bk] < 0) - { - cosb = cos_betas_normal[-ps->iid_index[env][bk]][ps->icc_index[env][bk]]; - sinb = -sin_betas_normal[-ps->iid_index[env][bk]][ps->icc_index[env][bk]]; - } else { - cosb = cos_betas_normal[ps->iid_index[env][bk]][ps->icc_index[env][bk]]; - sinb = sin_betas_normal[ps->iid_index[env][bk]][ps->icc_index[env][bk]]; - } - } - - ab1 = MUL_C(cosb, cosa); - ab2 = MUL_C(sinb, sina); - ab3 = MUL_C(sinb, cosa); - ab4 = MUL_C(cosb, sina); - - /* h_xy: COEF */ - RE(h11) = MUL_C(c_2, (ab1 - ab2)); - RE(h12) = MUL_C(c_1, (ab1 + ab2)); - RE(h21) = MUL_C(c_2, (ab3 + ab4)); - RE(h22) = MUL_C(c_1, (ab3 - ab4)); - } else { - /* type 'B' mixing as described in 8.6.4.6.2.2 */ - real_t sina, cosa; - real_t cosg, sing; - - /* - real_t c, rho, mu, alpha, gamma; - uint8_t i; - - i = ps->iid_index[env][bk]; - c = (real_t)pow(10.0, ((i)?(((i>0)?1:-1)*quant_iid[((i>0)?i:-i)-1]):0.)/20.0); - rho = quant_rho[ps->icc_index[env][bk]]; - - if (rho == 0.0f && c == 1.) - { - alpha = (real_t)M_PI/4.0f; - rho = 0.05f; - } else { - if (rho <= 0.05f) - { - rho = 0.05f; - } - alpha = 0.5f*(real_t)atan( (2.0f*c*rho) / (c*c-1.0f) ); - - if (alpha < 0.) - { - alpha += (real_t)M_PI/2.0f; - } - if (rho < 0.) - { - alpha += (real_t)M_PI; - } - } - mu = c+1.0f/c; - mu = 1+(4.0f*rho*rho-4.0f)/(mu*mu); - gamma = (real_t)atan(sqrt((1.0f-sqrt(mu))/(1.0f+sqrt(mu)))); - */ - - if (ps->iid_mode >= 3) - { - uint8_t abs_iid = abs(ps->iid_index[env][bk]); - - cosa = sincos_alphas_B_fine[no_iid_steps + ps->iid_index[env][bk]][ps->icc_index[env][bk]]; - sina = sincos_alphas_B_fine[30 - (no_iid_steps + ps->iid_index[env][bk])][ps->icc_index[env][bk]]; - cosg = cos_gammas_fine[abs_iid][ps->icc_index[env][bk]]; - sing = sin_gammas_fine[abs_iid][ps->icc_index[env][bk]]; - } else { - uint8_t abs_iid = abs(ps->iid_index[env][bk]); - - cosa = sincos_alphas_B_normal[no_iid_steps + ps->iid_index[env][bk]][ps->icc_index[env][bk]]; - sina = sincos_alphas_B_normal[14 - (no_iid_steps + ps->iid_index[env][bk])][ps->icc_index[env][bk]]; - cosg = cos_gammas_normal[abs_iid][ps->icc_index[env][bk]]; - sing = sin_gammas_normal[abs_iid][ps->icc_index[env][bk]]; - } - - RE(h11) = MUL_C(COEF_SQRT2, MUL_C(cosa, cosg)); - RE(h12) = MUL_C(COEF_SQRT2, MUL_C(sina, cosg)); - RE(h21) = MUL_C(COEF_SQRT2, MUL_C(-cosa, sing)); - RE(h22) = MUL_C(COEF_SQRT2, MUL_C(sina, sing)); - } - - /* calculate phase rotation parameters H_xy */ - /* note that the imaginary part of these parameters are only calculated when - IPD and OPD are enabled - */ - if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par)) - { - int8_t i; - real_t xxyy, ppqq; - real_t yq, xp, xq, py, tmp; - - /* ringbuffer index */ - i = ps->phase_hist; - - /* previous value */ -#ifdef FIXED_POINT - /* divide by 4, shift right 2 bits */ - RE(tempLeft) = RE(ps->ipd_prev[bk][i]) >> 2; - IM(tempLeft) = IM(ps->ipd_prev[bk][i]) >> 2; - RE(tempRight) = RE(ps->opd_prev[bk][i]) >> 2; - IM(tempRight) = IM(ps->opd_prev[bk][i]) >> 2; -#else - RE(tempLeft) = MUL_F(RE(ps->ipd_prev[bk][i]), FRAC_CONST(0.25)); - IM(tempLeft) = MUL_F(IM(ps->ipd_prev[bk][i]), FRAC_CONST(0.25)); - RE(tempRight) = MUL_F(RE(ps->opd_prev[bk][i]), FRAC_CONST(0.25)); - IM(tempRight) = MUL_F(IM(ps->opd_prev[bk][i]), FRAC_CONST(0.25)); -#endif - - /* save current value */ - RE(ps->ipd_prev[bk][i]) = ipdopd_cos_tab[abs(ps->ipd_index[env][bk])]; - IM(ps->ipd_prev[bk][i]) = ipdopd_sin_tab[abs(ps->ipd_index[env][bk])]; - RE(ps->opd_prev[bk][i]) = ipdopd_cos_tab[abs(ps->opd_index[env][bk])]; - IM(ps->opd_prev[bk][i]) = ipdopd_sin_tab[abs(ps->opd_index[env][bk])]; - - /* add current value */ - RE(tempLeft) += RE(ps->ipd_prev[bk][i]); - IM(tempLeft) += IM(ps->ipd_prev[bk][i]); - RE(tempRight) += RE(ps->opd_prev[bk][i]); - IM(tempRight) += IM(ps->opd_prev[bk][i]); - - /* ringbuffer index */ - if (i == 0) - { - i = 2; - } - i--; - - /* get value before previous */ -#ifdef FIXED_POINT - /* dividing by 2, shift right 1 bit */ - RE(tempLeft) += (RE(ps->ipd_prev[bk][i]) >> 1); - IM(tempLeft) += (IM(ps->ipd_prev[bk][i]) >> 1); - RE(tempRight) += (RE(ps->opd_prev[bk][i]) >> 1); - IM(tempRight) += (IM(ps->opd_prev[bk][i]) >> 1); -#else - RE(tempLeft) += MUL_F(RE(ps->ipd_prev[bk][i]), FRAC_CONST(0.5)); - IM(tempLeft) += MUL_F(IM(ps->ipd_prev[bk][i]), FRAC_CONST(0.5)); - RE(tempRight) += MUL_F(RE(ps->opd_prev[bk][i]), FRAC_CONST(0.5)); - IM(tempRight) += MUL_F(IM(ps->opd_prev[bk][i]), FRAC_CONST(0.5)); -#endif - -#if 0 /* original code */ - ipd = (float)atan2(IM(tempLeft), RE(tempLeft)); - opd = (float)atan2(IM(tempRight), RE(tempRight)); - - /* phase rotation */ - RE(phaseLeft) = (float)cos(opd); - IM(phaseLeft) = (float)sin(opd); - opd -= ipd; - RE(phaseRight) = (float)cos(opd); - IM(phaseRight) = (float)sin(opd); -#else - // x = IM(tempLeft) - // y = RE(tempLeft) - // p = IM(tempRight) - // q = RE(tempRight) - // cos(atan2(x,y)) = 1/sqrt(1 + (x*x)/(y*y)) - // sin(atan2(x,y)) = x/(y*sqrt(1 + (x*x)/(y*y))) - // cos(atan2(x,y)-atan2(p,q)) = (y*q+x*p)/(y*q * sqrt(1 + (x*x)/(y*y)) * sqrt(1 + (p*p)/(q*q))); - // sin(atan2(x,y)-atan2(p,q)) = (x*q-p*y)/(y*q * sqrt(1 + (x*x)/(y*y)) * sqrt(1 + (p*p)/(q*q))); - - /* (x*x)/(y*y) (REAL > 0) */ - xxyy = DIV_R(MUL_C(IM(tempLeft),IM(tempLeft)), MUL_C(RE(tempLeft),RE(tempLeft))); - ppqq = DIV_R(MUL_C(IM(tempRight),IM(tempRight)), MUL_C(RE(tempRight),RE(tempRight))); - - /* 1 + (x*x)/(y*y) (REAL > 1) */ - xxyy += REAL_CONST(1); - ppqq += REAL_CONST(1); - - /* 1 / sqrt(1 + (x*x)/(y*y)) (FRAC <= 1) */ - xxyy = DIV_R(FRAC_CONST(1), ps_sqrt(xxyy)); - ppqq = DIV_R(FRAC_CONST(1), ps_sqrt(ppqq)); - - /* COEF */ - yq = MUL_C(RE(tempLeft), RE(tempRight)); - xp = MUL_C(IM(tempLeft), IM(tempRight)); - xq = MUL_C(IM(tempLeft), RE(tempRight)); - py = MUL_C(RE(tempLeft), IM(tempRight)); - - RE(phaseLeft) = xxyy; - IM(phaseLeft) = MUL_R(xxyy, (DIV_R(IM(tempLeft), RE(tempLeft)))); - - tmp = DIV_C(MUL_F(xxyy, ppqq), yq); - - /* MUL_C(FRAC,COEF) = FRAC */ - RE(phaseRight) = MUL_C(tmp, (yq+xp)); - IM(phaseRight) = MUL_C(tmp, (xq-py)); -#endif - - /* MUL_F(COEF, FRAC) = COEF */ - IM(h11) = MUL_F(RE(h11), IM(phaseLeft)); - IM(h12) = MUL_F(RE(h12), IM(phaseRight)); - IM(h21) = MUL_F(RE(h21), IM(phaseLeft)); - IM(h22) = MUL_F(RE(h22), IM(phaseRight)); - - RE(h11) = MUL_F(RE(h11), RE(phaseLeft)); - RE(h12) = MUL_F(RE(h12), RE(phaseRight)); - RE(h21) = MUL_F(RE(h21), RE(phaseLeft)); - RE(h22) = MUL_F(RE(h22), RE(phaseRight)); - } - - /* length of the envelope n_e+1 - n_e (in time samples) */ - /* 0 < L <= 32: integer */ - L = (real_t)(ps->border_position[env + 1] - ps->border_position[env]); - - /* obtain final H_xy by means of linear interpolation */ - RE(deltaH11) = (RE(h11) - RE(ps->h11_prev[gr])) / L; - RE(deltaH12) = (RE(h12) - RE(ps->h12_prev[gr])) / L; - RE(deltaH21) = (RE(h21) - RE(ps->h21_prev[gr])) / L; - RE(deltaH22) = (RE(h22) - RE(ps->h22_prev[gr])) / L; - - RE(H11) = RE(ps->h11_prev[gr]); - RE(H12) = RE(ps->h12_prev[gr]); - RE(H21) = RE(ps->h21_prev[gr]); - RE(H22) = RE(ps->h22_prev[gr]); - - RE(ps->h11_prev[gr]) = RE(h11); - RE(ps->h12_prev[gr]) = RE(h12); - RE(ps->h21_prev[gr]) = RE(h21); - RE(ps->h22_prev[gr]) = RE(h22); - - /* only calculate imaginary part when needed */ - if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par)) - { - /* obtain final H_xy by means of linear interpolation */ - IM(deltaH11) = (IM(h11) - IM(ps->h11_prev[gr])) / L; - IM(deltaH12) = (IM(h12) - IM(ps->h12_prev[gr])) / L; - IM(deltaH21) = (IM(h21) - IM(ps->h21_prev[gr])) / L; - IM(deltaH22) = (IM(h22) - IM(ps->h22_prev[gr])) / L; - - IM(H11) = IM(ps->h11_prev[gr]); - IM(H12) = IM(ps->h12_prev[gr]); - IM(H21) = IM(ps->h21_prev[gr]); - IM(H22) = IM(ps->h22_prev[gr]); - - if ((NEGATE_IPD_MASK & ps->map_group2bk[gr]) != 0) - { - IM(deltaH11) = -IM(deltaH11); - IM(deltaH12) = -IM(deltaH12); - IM(deltaH21) = -IM(deltaH21); - IM(deltaH22) = -IM(deltaH22); - - IM(H11) = -IM(H11); - IM(H12) = -IM(H12); - IM(H21) = -IM(H21); - IM(H22) = -IM(H22); - } - - IM(ps->h11_prev[gr]) = IM(h11); - IM(ps->h12_prev[gr]) = IM(h12); - IM(ps->h21_prev[gr]) = IM(h21); - IM(ps->h22_prev[gr]) = IM(h22); - } - - /* apply H_xy to the current envelope band of the decorrelated subband */ - for (n = ps->border_position[env]; n < ps->border_position[env + 1]; n++) - { - /* addition finalises the interpolation over every n */ - RE(H11) += RE(deltaH11); - RE(H12) += RE(deltaH12); - RE(H21) += RE(deltaH21); - RE(H22) += RE(deltaH22); - if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par)) - { - IM(H11) += IM(deltaH11); - IM(H12) += IM(deltaH12); - IM(H21) += IM(deltaH21); - IM(H22) += IM(deltaH22); - } - - /* channel is an alias to the subband */ - for (sb = ps->group_border[gr]; sb < maxsb; sb++) - { - complex_t inLeft, inRight; - - /* load decorrelated samples */ - if (gr < ps->num_hybrid_groups) - { - RE(inLeft) = RE(X_hybrid_left[n][sb]); - IM(inLeft) = IM(X_hybrid_left[n][sb]); - RE(inRight) = RE(X_hybrid_right[n][sb]); - IM(inRight) = IM(X_hybrid_right[n][sb]); - } else { - RE(inLeft) = RE(X_left[n][sb]); - IM(inLeft) = IM(X_left[n][sb]); - RE(inRight) = RE(X_right[n][sb]); - IM(inRight) = IM(X_right[n][sb]); - } - - /* apply mixing */ - RE(tempLeft) = MUL_C(RE(H11), RE(inLeft)) + MUL_C(RE(H21), RE(inRight)); - IM(tempLeft) = MUL_C(RE(H11), IM(inLeft)) + MUL_C(RE(H21), IM(inRight)); - RE(tempRight) = MUL_C(RE(H12), RE(inLeft)) + MUL_C(RE(H22), RE(inRight)); - IM(tempRight) = MUL_C(RE(H12), IM(inLeft)) + MUL_C(RE(H22), IM(inRight)); - - /* only perform imaginary operations when needed */ - if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par)) - { - /* apply rotation */ - RE(tempLeft) -= MUL_C(IM(H11), IM(inLeft)) + MUL_C(IM(H21), IM(inRight)); - IM(tempLeft) += MUL_C(IM(H11), RE(inLeft)) + MUL_C(IM(H21), RE(inRight)); - RE(tempRight) -= MUL_C(IM(H12), IM(inLeft)) + MUL_C(IM(H22), IM(inRight)); - IM(tempRight) += MUL_C(IM(H12), RE(inLeft)) + MUL_C(IM(H22), RE(inRight)); - } - - /* store final samples */ - if (gr < ps->num_hybrid_groups) - { - RE(X_hybrid_left[n][sb]) = RE(tempLeft); - IM(X_hybrid_left[n][sb]) = IM(tempLeft); - RE(X_hybrid_right[n][sb]) = RE(tempRight); - IM(X_hybrid_right[n][sb]) = IM(tempRight); - } else { - RE(X_left[n][sb]) = RE(tempLeft); - IM(X_left[n][sb]) = IM(tempLeft); - RE(X_right[n][sb]) = RE(tempRight); - IM(X_right[n][sb]) = IM(tempRight); - } - } - } - - /* shift phase smoother's circular buffer index */ - ps->phase_hist++; - if (ps->phase_hist == 2) - { - ps->phase_hist = 0; - } - } - } -} - -void ps_free(ps_info *ps) -{ - /* free hybrid filterbank structures */ - hybrid_free(ps->hyb); - - faad_free(ps); -} - -ps_info *ps_init(uint8_t sr_index) -{ - uint8_t i; - uint8_t short_delay_band; - - ps_info *ps = (ps_info*)faad_malloc(sizeof(ps_info)); - memset(ps, 0, sizeof(ps_info)); - - ps->hyb = hybrid_init(); - - ps->ps_data_available = 0; - - /* delay stuff*/ - ps->saved_delay = 0; - - for (i = 0; i < 64; i++) - { - ps->delay_buf_index_delay[i] = 0; - } - - for (i = 0; i < NO_ALLPASS_LINKS; i++) - { - ps->delay_buf_index_ser[i] = 0; -#ifdef PARAM_32KHZ - if (sr_index <= 5) /* >= 32 kHz*/ - { - ps->num_sample_delay_ser[i] = delay_length_d[1][i]; - } else { - ps->num_sample_delay_ser[i] = delay_length_d[0][i]; - } -#else - /* THESE ARE CONSTANTS NOW */ - ps->num_sample_delay_ser[i] = delay_length_d[i]; -#endif - } - -#ifdef PARAM_32KHZ - if (sr_index <= 5) /* >= 32 kHz*/ - { - short_delay_band = 35; - ps->nr_allpass_bands = 22; - ps->alpha_decay = FRAC_CONST(0.76592833836465); - ps->alpha_smooth = FRAC_CONST(0.25); - } else { - short_delay_band = 64; - ps->nr_allpass_bands = 45; - ps->alpha_decay = FRAC_CONST(0.58664621951003); - ps->alpha_smooth = FRAC_CONST(0.6); - } -#else - /* THESE ARE CONSTANTS NOW */ - short_delay_band = 35; - ps->nr_allpass_bands = 22; - ps->alpha_decay = FRAC_CONST(0.76592833836465); - ps->alpha_smooth = FRAC_CONST(0.25); -#endif - - /* THESE ARE CONSTANT NOW IF PS IS INDEPENDANT OF SAMPLERATE */ - for (i = 0; i < short_delay_band; i++) - { - ps->delay_D[i] = 14; - } - for (i = short_delay_band; i < 64; i++) - { - ps->delay_D[i] = 1; - } - - /* mixing and phase */ - for (i = 0; i < 50; i++) - { - RE(ps->h11_prev[i]) = 1; - IM(ps->h12_prev[i]) = 1; - RE(ps->h11_prev[i]) = 1; - IM(ps->h12_prev[i]) = 1; - } - - ps->phase_hist = 0; - - for (i = 0; i < 20; i++) - { - RE(ps->ipd_prev[i][0]) = 0; - IM(ps->ipd_prev[i][0]) = 0; - RE(ps->ipd_prev[i][1]) = 0; - IM(ps->ipd_prev[i][1]) = 0; - RE(ps->opd_prev[i][0]) = 0; - IM(ps->opd_prev[i][0]) = 0; - RE(ps->opd_prev[i][1]) = 0; - IM(ps->opd_prev[i][1]) = 0; - } - - return ps; -} - -/* 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}}}; - - /* delta decoding of the bitstream data */ - ps_data_decode(ps); - - /* set up some parameters depending on filterbank type */ - if (ps->use34hybrid_bands) - { - ps->group_border = (uint8_t*)group_border34; - ps->map_group2bk = (uint16_t*)map_group2bk34; - ps->num_groups = 32+18; - ps->num_hybrid_groups = 32; - ps->nr_par_bands = 34; - ps->decay_cutoff = 5; - } else { - ps->group_border = (uint8_t*)group_border20; - ps->map_group2bk = (uint16_t*)map_group2bk20; - ps->num_groups = 10+12; - ps->num_hybrid_groups = 10; - ps->nr_par_bands = 20; - ps->decay_cutoff = 3; - } - - /* Perform further analysis on the lowest subbands to get a higher - * frequency resolution - */ - hybrid_analysis((hyb_info*)ps->hyb, X_left, X_hybrid_left, - ps->use34hybrid_bands); - - /* decorrelate mono signal */ - ps_decorrelate(ps, X_left, X_right, X_hybrid_left, X_hybrid_right); - - /* apply mixing and phase parameters */ - ps_mix_phase(ps, X_left, X_right, X_hybrid_left, X_hybrid_right); - - /* hybrid synthesis, to rebuild the SBR QMF matrices */ - hybrid_synthesis((hyb_info*)ps->hyb, X_left, X_hybrid_left, - ps->use34hybrid_bands); - - hybrid_synthesis((hyb_info*)ps->hyb, X_right, X_hybrid_right, - ps->use34hybrid_bands); - - return 0; -} - -#endif - diff --git a/mplayer/libfaad2/ps_dec.h b/mplayer/libfaad2/ps_dec.h deleted file mode 100644 index 172ef3ec..00000000 --- a/mplayer/libfaad2/ps_dec.h +++ /dev/null @@ -1,148 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: ps_dec.h,v 1.8 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __PS_DEC_H__ -#define __PS_DEC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "bits.h" - -#define EXTENSION_ID_PS 2 - -#define MAX_PS_ENVELOPES 5 -#define NO_ALLPASS_LINKS 3 - -typedef struct -{ - /* bitstream parameters */ - uint8_t enable_iid; - uint8_t enable_icc; - uint8_t enable_ext; - - uint8_t iid_mode; - uint8_t icc_mode; - uint8_t nr_iid_par; - uint8_t nr_ipdopd_par; - uint8_t nr_icc_par; - - uint8_t frame_class; - uint8_t num_env; - - uint8_t border_position[MAX_PS_ENVELOPES+1]; - - uint8_t iid_dt[MAX_PS_ENVELOPES]; - uint8_t icc_dt[MAX_PS_ENVELOPES]; - - uint8_t enable_ipdopd; - uint8_t ipd_mode; - uint8_t ipd_dt[MAX_PS_ENVELOPES]; - uint8_t opd_dt[MAX_PS_ENVELOPES]; - - /* indices */ - int8_t iid_index_prev[34]; - int8_t icc_index_prev[34]; - int8_t ipd_index_prev[17]; - int8_t opd_index_prev[17]; - int8_t iid_index[MAX_PS_ENVELOPES][34]; - int8_t icc_index[MAX_PS_ENVELOPES][34]; - int8_t ipd_index[MAX_PS_ENVELOPES][17]; - int8_t opd_index[MAX_PS_ENVELOPES][17]; - - int8_t ipd_index_1[17]; - int8_t opd_index_1[17]; - int8_t ipd_index_2[17]; - int8_t opd_index_2[17]; - - /* ps data was correctly read */ - uint8_t ps_data_available; - - /* a header has been read */ - uint8_t header_read; - - /* hybrid filterbank parameters */ - void *hyb; - uint8_t use34hybrid_bands; - - /**/ - uint8_t num_groups; - uint8_t num_hybrid_groups; - uint8_t nr_par_bands; - uint8_t nr_allpass_bands; - uint8_t decay_cutoff; - - uint8_t *group_border; - uint16_t *map_group2bk; - - /* filter delay handling */ - uint8_t saved_delay; - uint8_t delay_buf_index_ser[NO_ALLPASS_LINKS]; - uint8_t num_sample_delay_ser[NO_ALLPASS_LINKS]; - uint8_t delay_D[64]; - uint8_t delay_buf_index_delay[64]; - - complex_t delay_Qmf[14][64]; /* 14 samples delay max, 64 QMF channels */ - complex_t delay_SubQmf[2][32]; /* 2 samples delay max (SubQmf is always allpass filtered) */ - complex_t delay_Qmf_ser[NO_ALLPASS_LINKS][5][64]; /* 5 samples delay max (table 8.34), 64 QMF channels */ - complex_t delay_SubQmf_ser[NO_ALLPASS_LINKS][5][32]; /* 5 samples delay max (table 8.34) */ - - /* transients */ - real_t alpha_decay; - real_t alpha_smooth; - - real_t P_PeakDecayNrg[34]; - real_t P_prev[34]; - real_t P_SmoothPeakDecayDiffNrg_prev[34]; - - /* mixing and phase */ - complex_t h11_prev[50]; - complex_t h12_prev[50]; - complex_t h21_prev[50]; - complex_t h22_prev[50]; - uint8_t phase_hist; - complex_t ipd_prev[20][2]; - complex_t opd_prev[20][2]; - -} ps_info; - -/* ps_syntax.c */ -uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header); - -/* ps_dec.c */ -ps_info *ps_init(uint8_t sr_index); -void ps_free(ps_info *ps); - -uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]); - - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/mplayer/libfaad2/ps_syntax.c b/mplayer/libfaad2/ps_syntax.c deleted file mode 100644 index 4d774e3e..00000000 --- a/mplayer/libfaad2/ps_syntax.c +++ /dev/null @@ -1,545 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR and PS decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: ps_syntax.c,v 1.6 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" - -#ifdef PS_DEC - -#include "bits.h" -#include "ps_dec.h" - -/* type definitaions */ -typedef const int8_t (*ps_huff_tab)[2]; - -/* static data tables */ -static const uint8_t nr_iid_par_tab[] = { - 10, 20, 34, 10, 20, 34, 0, 0 -}; -static const uint8_t nr_ipdopd_par_tab[] = { - 5, 11, 17, 5, 11, 17, 0, 0 -}; -static const uint8_t nr_icc_par_tab[] = { - 10, 20, 34, 10, 20, 34, 0, 0 -}; -static const uint8_t num_env_tab[][4] = { - { 0, 1, 2, 4 }, - { 1, 2, 3, 4 } -}; - -/* binary lookup huffman tables */ -static const int8_t f_huff_iid_def[][2] = { - { /*0*/ -31, 1 }, /* index 0: 1 bits: x */ - { 2, 3 }, /* index 1: 2 bits: 1x */ - { /*1*/ -30, /*-1*/ -32 }, /* index 2: 3 bits: 10x */ - { 4, 5 }, /* index 3: 3 bits: 11x */ - { /*2*/ -29, /*-2*/ -33 }, /* index 4: 4 bits: 110x */ - { 6, 7 }, /* index 5: 4 bits: 111x */ - { /*3*/ -28, /*-3*/ -34 }, /* index 6: 5 bits: 1110x */ - { 8, 9 }, /* index 7: 5 bits: 1111x */ - { /*-4*/ -35, /*4*/ -27 }, /* index 8: 6 bits: 11110x */ - { /*5*/ -26, 10 }, /* index 9: 6 bits: 11111x */ - { /*-5*/ -36, 11 }, /* index 10: 7 bits: 111111x */ - { /*6*/ -25, 12 }, /* index 11: 8 bits: 1111111x */ - { /*-6*/ -37, 13 }, /* index 12: 9 bits: 11111111x */ - { /*-7*/ -38, 14 }, /* index 13: 10 bits: 111111111x */ - { /*7*/ -24, 15 }, /* index 14: 11 bits: 1111111111x */ - { 16, 17 }, /* index 15: 12 bits: 11111111111x */ - { /*8*/ -23, /*-8*/ -39 }, /* index 16: 13 bits: 111111111110x */ - { 18, 19 }, /* index 17: 13 bits: 111111111111x */ - { /*9*/ -22, /*10*/ -21 }, /* index 18: 14 bits: 1111111111110x */ - { 20, 21 }, /* index 19: 14 bits: 1111111111111x */ - { /*-9*/ -40, /*11*/ -20 }, /* index 20: 15 bits: 11111111111110x */ - { 22, 23 }, /* index 21: 15 bits: 11111111111111x */ - { /*-10*/ -41, 24 }, /* index 22: 16 bits: 111111111111110x */ - { 25, 26 }, /* index 23: 16 bits: 111111111111111x */ - { /*-11*/ -42, /*-14*/ -45 }, /* index 24: 17 bits: 1111111111111101x */ - { /*-13*/ -44, /*-12*/ -43 }, /* index 25: 17 bits: 1111111111111110x */ - { /*12*/ -19, 27 }, /* index 26: 17 bits: 1111111111111111x */ - { /*13*/ -18, /*14*/ -17 } /* index 27: 18 bits: 11111111111111111x */ -}; - -static const int8_t t_huff_iid_def[][2] = { - { /*0*/ -31, 1 }, /* index 0: 1 bits: x */ - { /*-1*/ -32, 2 }, /* index 1: 2 bits: 1x */ - { /*1*/ -30, 3 }, /* index 2: 3 bits: 11x */ - { /*-2*/ -33, 4 }, /* index 3: 4 bits: 111x */ - { /*2*/ -29, 5 }, /* index 4: 5 bits: 1111x */ - { /*-3*/ -34, 6 }, /* index 5: 6 bits: 11111x */ - { /*3*/ -28, 7 }, /* index 6: 7 bits: 111111x */ - { /*-4*/ -35, 8 }, /* index 7: 8 bits: 1111111x */ - { /*4*/ -27, 9 }, /* index 8: 9 bits: 11111111x */ - { /*-5*/ -36, 10 }, /* index 9: 10 bits: 111111111x */ - { /*5*/ -26, 11 }, /* index 10: 11 bits: 1111111111x */ - { /*-6*/ -37, 12 }, /* index 11: 12 bits: 11111111111x */ - { /*6*/ -25, 13 }, /* index 12: 13 bits: 111111111111x */ - { /*7*/ -24, 14 }, /* index 13: 14 bits: 1111111111111x */ - { /*-7*/ -38, 15 }, /* index 14: 15 bits: 11111111111111x */ - { 16, 17 }, /* index 15: 16 bits: 111111111111111x */ - { /*8*/ -23, /*-8*/ -39 }, /* index 16: 17 bits: 1111111111111110x */ - { 18, 19 }, /* index 17: 17 bits: 1111111111111111x */ - { 20, 21 }, /* index 18: 18 bits: 11111111111111110x */ - { 22, 23 }, /* index 19: 18 bits: 11111111111111111x */ - { /*9*/ -22, /*-14*/ -45 }, /* index 20: 19 bits: 111111111111111100x */ - { /*-13*/ -44, /*-12*/ -43 }, /* index 21: 19 bits: 111111111111111101x */ - { 24, 25 }, /* index 22: 19 bits: 111111111111111110x */ - { 26, 27 }, /* index 23: 19 bits: 111111111111111111x */ - { /*-11*/ -42, /*-10*/ -41 }, /* index 24: 20 bits: 1111111111111111100x */ - { /*-9*/ -40, /*10*/ -21 }, /* index 25: 20 bits: 1111111111111111101x */ - { /*11*/ -20, /*12*/ -19 }, /* index 26: 20 bits: 1111111111111111110x */ - { /*13*/ -18, /*14*/ -17 } /* index 27: 20 bits: 1111111111111111111x */ -}; - -static const int8_t f_huff_iid_fine[][2] = { - { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ - { 2, 3 }, /* index 1: 2 bits: 0x */ - { 4, /*-1*/ -32 }, /* index 2: 3 bits: 00x */ - { /*1*/ -30, 5 }, /* index 3: 3 bits: 01x */ - { /*-2*/ -33, /*2*/ -29 }, /* index 4: 4 bits: 000x */ - { 6, 7 }, /* index 5: 4 bits: 011x */ - { /*-3*/ -34, /*3*/ -28 }, /* index 6: 5 bits: 0110x */ - { 8, 9 }, /* index 7: 5 bits: 0111x */ - { /*-4*/ -35, /*4*/ -27 }, /* index 8: 6 bits: 01110x */ - { 10, 11 }, /* index 9: 6 bits: 01111x */ - { /*-5*/ -36, /*5*/ -26 }, /* index 10: 7 bits: 011110x */ - { 12, 13 }, /* index 11: 7 bits: 011111x */ - { /*-6*/ -37, /*6*/ -25 }, /* index 12: 8 bits: 0111110x */ - { 14, 15 }, /* index 13: 8 bits: 0111111x */ - { /*7*/ -24, 16 }, /* index 14: 9 bits: 01111110x */ - { 17, 18 }, /* index 15: 9 bits: 01111111x */ - { 19, /*-8*/ -39 }, /* index 16: 10 bits: 011111101x */ - { /*8*/ -23, 20 }, /* index 17: 10 bits: 011111110x */ - { 21, /*-7*/ -38 }, /* index 18: 10 bits: 011111111x */ - { /*10*/ -21, 22 }, /* index 19: 11 bits: 0111111010x */ - { 23, /*-9*/ -40 }, /* index 20: 11 bits: 0111111101x */ - { /*9*/ -22, 24 }, /* index 21: 11 bits: 0111111110x */ - { /*-11*/ -42, /*11*/ -20 }, /* index 22: 12 bits: 01111110101x */ - { 25, 26 }, /* index 23: 12 bits: 01111111010x */ - { 27, /*-10*/ -41 }, /* index 24: 12 bits: 01111111101x */ - { 28, /*-12*/ -43 }, /* index 25: 13 bits: 011111110100x */ - { /*12*/ -19, 29 }, /* index 26: 13 bits: 011111110101x */ - { 30, 31 }, /* index 27: 13 bits: 011111111010x */ - { 32, /*-14*/ -45 }, /* index 28: 14 bits: 0111111101000x */ - { /*14*/ -17, 33 }, /* index 29: 14 bits: 0111111101011x */ - { 34, /*-13*/ -44 }, /* index 30: 14 bits: 0111111110100x */ - { /*13*/ -18, 35 }, /* index 31: 14 bits: 0111111110101x */ - { 36, 37 }, /* index 32: 15 bits: 01111111010000x */ - { 38, /*-15*/ -46 }, /* index 33: 15 bits: 01111111010111x */ - { /*15*/ -16, 39 }, /* index 34: 15 bits: 01111111101000x */ - { 40, 41 }, /* index 35: 15 bits: 01111111101011x */ - { 42, 43 }, /* index 36: 16 bits: 011111110100000x */ - { /*-17*/ -48, /*17*/ -14 }, /* index 37: 16 bits: 011111110100001x */ - { 44, 45 }, /* index 38: 16 bits: 011111110101110x */ - { 46, 47 }, /* index 39: 16 bits: 011111111010001x */ - { 48, 49 }, /* index 40: 16 bits: 011111111010110x */ - { /*-16*/ -47, /*16*/ -15 }, /* index 41: 16 bits: 011111111010111x */ - { /*-21*/ -52, /*21*/ -10 }, /* index 42: 17 bits: 0111111101000000x */ - { /*-19*/ -50, /*19*/ -12 }, /* index 43: 17 bits: 0111111101000001x */ - { /*-18*/ -49, /*18*/ -13 }, /* index 44: 17 bits: 0111111101011100x */ - { 50, 51 }, /* index 45: 17 bits: 0111111101011101x */ - { 52, 53 }, /* index 46: 17 bits: 0111111110100010x */ - { 54, 55 }, /* index 47: 17 bits: 0111111110100011x */ - { 56, 57 }, /* index 48: 17 bits: 0111111110101100x */ - { 58, 59 }, /* index 49: 17 bits: 0111111110101101x */ - { /*-26*/ -57, /*-25*/ -56 }, /* index 50: 18 bits: 01111111010111010x */ - { /*-28*/ -59, /*-27*/ -58 }, /* index 51: 18 bits: 01111111010111011x */ - { /*-22*/ -53, /*22*/ -9 }, /* index 52: 18 bits: 01111111101000100x */ - { /*-24*/ -55, /*-23*/ -54 }, /* index 53: 18 bits: 01111111101000101x */ - { /*25*/ -6, /*26*/ -5 }, /* index 54: 18 bits: 01111111101000110x */ - { /*23*/ -8, /*24*/ -7 }, /* index 55: 18 bits: 01111111101000111x */ - { /*29*/ -2, /*30*/ -1 }, /* index 56: 18 bits: 01111111101011000x */ - { /*27*/ -4, /*28*/ -3 }, /* index 57: 18 bits: 01111111101011001x */ - { /*-30*/ -61, /*-29*/ -60 }, /* index 58: 18 bits: 01111111101011010x */ - { /*-20*/ -51, /*20*/ -11 } /* index 59: 18 bits: 01111111101011011x */ -}; - -static const int8_t t_huff_iid_fine[][2] = { - { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ - { /*1*/ -30, 2 }, /* index 1: 2 bits: 0x */ - { 3, /*-1*/ -32 }, /* index 2: 3 bits: 01x */ - { 4, 5 }, /* index 3: 4 bits: 010x */ - { 6, 7 }, /* index 4: 5 bits: 0100x */ - { /*-2*/ -33, /*2*/ -29 }, /* index 5: 5 bits: 0101x */ - { 8, /*-3*/ -34 }, /* index 6: 6 bits: 01000x */ - { /*3*/ -28, 9 }, /* index 7: 6 bits: 01001x */ - { /*-4*/ -35, /*4*/ -27 }, /* index 8: 7 bits: 010000x */ - { 10, 11 }, /* index 9: 7 bits: 010011x */ - { /*5*/ -26, 12 }, /* index 10: 8 bits: 0100110x */ - { 13, 14 }, /* index 11: 8 bits: 0100111x */ - { /*-6*/ -37, /*6*/ -25 }, /* index 12: 9 bits: 01001101x */ - { 15, 16 }, /* index 13: 9 bits: 01001110x */ - { 17, /*-5*/ -36 }, /* index 14: 9 bits: 01001111x */ - { 18, /*-7*/ -38 }, /* index 15: 10 bits: 010011100x */ - { /*7*/ -24, 19 }, /* index 16: 10 bits: 010011101x */ - { 20, 21 }, /* index 17: 10 bits: 010011110x */ - { /*9*/ -22, 22 }, /* index 18: 11 bits: 0100111000x */ - { 23, 24 }, /* index 19: 11 bits: 0100111011x */ - { /*-8*/ -39, /*8*/ -23 }, /* index 20: 11 bits: 0100111100x */ - { 25, 26 }, /* index 21: 11 bits: 0100111101x */ - { /*11*/ -20, 27 }, /* index 22: 12 bits: 01001110001x */ - { 28, 29 }, /* index 23: 12 bits: 01001110110x */ - { /*-10*/ -41, /*10*/ -21 }, /* index 24: 12 bits: 01001110111x */ - { 30, 31 }, /* index 25: 12 bits: 01001111010x */ - { 32, /*-9*/ -40 }, /* index 26: 12 bits: 01001111011x */ - { 33, /*-13*/ -44 }, /* index 27: 13 bits: 010011100011x */ - { /*13*/ -18, 34 }, /* index 28: 13 bits: 010011101100x */ - { 35, 36 }, /* index 29: 13 bits: 010011101101x */ - { 37, /*-12*/ -43 }, /* index 30: 13 bits: 010011110100x */ - { /*12*/ -19, 38 }, /* index 31: 13 bits: 010011110101x */ - { 39, /*-11*/ -42 }, /* index 32: 13 bits: 010011110110x */ - { 40, 41 }, /* index 33: 14 bits: 0100111000110x */ - { 42, 43 }, /* index 34: 14 bits: 0100111011001x */ - { 44, 45 }, /* index 35: 14 bits: 0100111011010x */ - { 46, /*-15*/ -46 }, /* index 36: 14 bits: 0100111011011x */ - { /*15*/ -16, 47 }, /* index 37: 14 bits: 0100111101000x */ - { /*-14*/ -45, /*14*/ -17 }, /* index 38: 14 bits: 0100111101011x */ - { 48, 49 }, /* index 39: 14 bits: 0100111101100x */ - { /*-21*/ -52, /*-20*/ -51 }, /* index 40: 15 bits: 01001110001100x */ - { /*18*/ -13, /*19*/ -12 }, /* index 41: 15 bits: 01001110001101x */ - { /*-19*/ -50, /*-18*/ -49 }, /* index 42: 15 bits: 01001110110010x */ - { 50, 51 }, /* index 43: 15 bits: 01001110110011x */ - { 52, 53 }, /* index 44: 15 bits: 01001110110100x */ - { 54, 55 }, /* index 45: 15 bits: 01001110110101x */ - { 56, /*-17*/ -48 }, /* index 46: 15 bits: 01001110110110x */ - { /*17*/ -14, 57 }, /* index 47: 15 bits: 01001111010001x */ - { 58, /*-16*/ -47 }, /* index 48: 15 bits: 01001111011000x */ - { /*16*/ -15, 59 }, /* index 49: 15 bits: 01001111011001x */ - { /*-26*/ -57, /*26*/ -5 }, /* index 50: 16 bits: 010011101100110x */ - { /*-28*/ -59, /*-27*/ -58 }, /* index 51: 16 bits: 010011101100111x */ - { /*29*/ -2, /*30*/ -1 }, /* index 52: 16 bits: 010011101101000x */ - { /*27*/ -4, /*28*/ -3 }, /* index 53: 16 bits: 010011101101001x */ - { /*-30*/ -61, /*-29*/ -60 }, /* index 54: 16 bits: 010011101101010x */ - { /*-25*/ -56, /*25*/ -6 }, /* index 55: 16 bits: 010011101101011x */ - { /*-24*/ -55, /*24*/ -7 }, /* index 56: 16 bits: 010011101101100x */ - { /*-23*/ -54, /*23*/ -8 }, /* index 57: 16 bits: 010011110100011x */ - { /*-22*/ -53, /*22*/ -9 }, /* index 58: 16 bits: 010011110110000x */ - { /*20*/ -11, /*21*/ -10 } /* index 59: 16 bits: 010011110110011x */ -}; - -static const int8_t f_huff_icc[][2] = { - { /*0*/ -31, 1 }, /* index 0: 1 bits: x */ - { /*1*/ -30, 2 }, /* index 1: 2 bits: 1x */ - { /*-1*/ -32, 3 }, /* index 2: 3 bits: 11x */ - { /*2*/ -29, 4 }, /* index 3: 4 bits: 111x */ - { /*-2*/ -33, 5 }, /* index 4: 5 bits: 1111x */ - { /*3*/ -28, 6 }, /* index 5: 6 bits: 11111x */ - { /*-3*/ -34, 7 }, /* index 6: 7 bits: 111111x */ - { /*4*/ -27, 8 }, /* index 7: 8 bits: 1111111x */ - { /*5*/ -26, 9 }, /* index 8: 9 bits: 11111111x */ - { /*-4*/ -35, 10 }, /* index 9: 10 bits: 111111111x */ - { /*6*/ -25, 11 }, /* index 10: 11 bits: 1111111111x */ - { /*-5*/ -36, 12 }, /* index 11: 12 bits: 11111111111x */ - { /*7*/ -24, 13 }, /* index 12: 13 bits: 111111111111x */ - { /*-6*/ -37, /*-7*/ -38 } /* index 13: 14 bits: 1111111111111x */ -}; - -static const int8_t t_huff_icc[][2] = { - { /*0*/ -31, 1 }, /* index 0: 1 bits: x */ - { /*1*/ -30, 2 }, /* index 1: 2 bits: 1x */ - { /*-1*/ -32, 3 }, /* index 2: 3 bits: 11x */ - { /*2*/ -29, 4 }, /* index 3: 4 bits: 111x */ - { /*-2*/ -33, 5 }, /* index 4: 5 bits: 1111x */ - { /*3*/ -28, 6 }, /* index 5: 6 bits: 11111x */ - { /*-3*/ -34, 7 }, /* index 6: 7 bits: 111111x */ - { /*4*/ -27, 8 }, /* index 7: 8 bits: 1111111x */ - { /*-4*/ -35, 9 }, /* index 8: 9 bits: 11111111x */ - { /*5*/ -26, 10 }, /* index 9: 10 bits: 111111111x */ - { /*-5*/ -36, 11 }, /* index 10: 11 bits: 1111111111x */ - { /*6*/ -25, 12 }, /* index 11: 12 bits: 11111111111x */ - { /*-6*/ -37, 13 }, /* index 12: 13 bits: 111111111111x */ - { /*-7*/ -38, /*7*/ -24 } /* index 13: 14 bits: 1111111111111x */ -}; - -static const int8_t f_huff_ipd[][2] = { - { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ - { 2, 3 }, /* index 1: 2 bits: 0x */ - { /*1*/ -30, 4 }, /* index 2: 3 bits: 00x */ - { 5, 6 }, /* index 3: 3 bits: 01x */ - { /*4*/ -27, /*5*/ -26 }, /* index 4: 4 bits: 001x */ - { /*3*/ -28, /*6*/ -25 }, /* index 5: 4 bits: 010x */ - { /*2*/ -29, /*7*/ -24 } /* index 6: 4 bits: 011x */ -}; - -static const int8_t t_huff_ipd[][2] = { - { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ - { 2, 3 }, /* index 1: 2 bits: 0x */ - { 4, 5 }, /* index 2: 3 bits: 00x */ - { /*1*/ -30, /*7*/ -24 }, /* index 3: 3 bits: 01x */ - { /*5*/ -26, 6 }, /* index 4: 4 bits: 000x */ - { /*2*/ -29, /*6*/ -25 }, /* index 5: 4 bits: 001x */ - { /*4*/ -27, /*3*/ -28 } /* index 6: 5 bits: 0001x */ -}; - -static const int8_t f_huff_opd[][2] = { - { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ - { 2, 3 }, /* index 1: 2 bits: 0x */ - { /*7*/ -24, /*1*/ -30 }, /* index 2: 3 bits: 00x */ - { 4, 5 }, /* index 3: 3 bits: 01x */ - { /*3*/ -28, /*6*/ -25 }, /* index 4: 4 bits: 010x */ - { /*2*/ -29, 6 }, /* index 5: 4 bits: 011x */ - { /*5*/ -26, /*4*/ -27 } /* index 6: 5 bits: 0111x */ -}; - -static const int8_t t_huff_opd[][2] = { - { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ - { 2, 3 }, /* index 1: 2 bits: 0x */ - { 4, 5 }, /* index 2: 3 bits: 00x */ - { /*1*/ -30, /*7*/ -24 }, /* index 3: 3 bits: 01x */ - { /*5*/ -26, 6 }, /* index 4: 4 bits: 000x */ - { /*2*/ -29, /*6*/ -25 }, /* index 5: 4 bits: 001x */ - { /*4*/ -27, /*3*/ -28 } /* index 6: 5 bits: 0001x */ -}; - -/* static function declarations */ -static uint16_t ps_extension(ps_info *ps, bitfile *ld, - const uint8_t ps_extension_id, - const uint16_t num_bits_left); -static void huff_data(bitfile *ld, const uint8_t dt, const uint8_t nr_par, - ps_huff_tab t_huff, ps_huff_tab f_huff, int8_t *par); -static INLINE int8_t ps_huff_dec(bitfile *ld, ps_huff_tab t_huff); - - -uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header) -{ - uint8_t tmp, n; - uint16_t bits = (uint16_t)faad_get_processed_bits(ld); - - *header = 0; - - /* check for new PS header */ - if (faad_get1bit(ld - DEBUGVAR(1,1000,"ps_data(): enable_ps_header"))) - { - *header = 1; - - ps->header_read = 1; - - ps->use34hybrid_bands = 0; - - /* Inter-channel Intensity Difference (IID) parameters enabled */ - ps->enable_iid = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,1001,"ps_data(): enable_iid")); - - if (ps->enable_iid) - { - ps->iid_mode = (uint8_t)faad_getbits(ld, 3 - DEBUGVAR(1,1002,"ps_data(): iid_mode")); - - ps->nr_iid_par = nr_iid_par_tab[ps->iid_mode]; - ps->nr_ipdopd_par = nr_ipdopd_par_tab[ps->iid_mode]; - - if (ps->iid_mode == 2 || ps->iid_mode == 5) - ps->use34hybrid_bands = 1; - - /* IPD freq res equal to IID freq res */ - ps->ipd_mode = ps->iid_mode; - } - - /* Inter-channel Coherence (ICC) parameters enabled */ - ps->enable_icc = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,1003,"ps_data(): enable_icc")); - - if (ps->enable_icc) - { - ps->icc_mode = (uint8_t)faad_getbits(ld, 3 - DEBUGVAR(1,1004,"ps_data(): icc_mode")); - - ps->nr_icc_par = nr_icc_par_tab[ps->icc_mode]; - - if (ps->icc_mode == 2 || ps->icc_mode == 5) - ps->use34hybrid_bands = 1; - } - - /* PS extension layer enabled */ - ps->enable_ext = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,1005,"ps_data(): enable_ext")); - } - - /* we are here, but no header has been read yet */ - if (ps->header_read == 0) - return 1; - - ps->frame_class = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,1006,"ps_data(): frame_class")); - tmp = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,1007,"ps_data(): num_env_idx")); - - ps->num_env = num_env_tab[ps->frame_class][tmp]; - - if (ps->frame_class) - { - for (n = 1; n < ps->num_env+1; n++) - { - ps->border_position[n] = (uint8_t)faad_getbits(ld, 5 - DEBUGVAR(1,1008,"ps_data(): border_position")); - } - } - - if (ps->enable_iid) - { - for (n = 0; n < ps->num_env; n++) - { - ps->iid_dt[n] = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,1009,"ps_data(): iid_dt")); - - /* iid_data */ - if (ps->iid_mode < 3) - { - huff_data(ld, ps->iid_dt[n], ps->nr_iid_par, t_huff_iid_def, - f_huff_iid_def, ps->iid_index[n]); - } else { - huff_data(ld, ps->iid_dt[n], ps->nr_iid_par, t_huff_iid_fine, - f_huff_iid_fine, ps->iid_index[n]); - } - } - } - - if (ps->enable_icc) - { - for (n = 0; n < ps->num_env; n++) - { - ps->icc_dt[n] = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,1010,"ps_data(): icc_dt")); - - /* icc_data */ - huff_data(ld, ps->icc_dt[n], ps->nr_icc_par, t_huff_icc, - f_huff_icc, ps->icc_index[n]); - } - } - - if (ps->enable_ext) - { - uint16_t num_bits_left; - uint16_t cnt = (uint16_t)faad_getbits(ld, 4 - DEBUGVAR(1,1011,"ps_data(): ps_extension_size")); - if (cnt == 15) - { - cnt += (uint16_t)faad_getbits(ld, 8 - DEBUGVAR(1,1012,"ps_data(): esc_count")); - } - - num_bits_left = 8 * cnt; - while (num_bits_left > 7) - { - uint8_t ps_extension_id = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,1013,"ps_data(): ps_extension_size")); - - num_bits_left -= 2; - num_bits_left -= ps_extension(ps, ld, ps_extension_id, num_bits_left); - } - - faad_getbits(ld, num_bits_left - DEBUGVAR(1,1014,"ps_data(): fill_bits")); - } - - bits = (uint16_t)faad_get_processed_bits(ld) - bits; - - ps->ps_data_available = 1; - - return bits; -} - -static uint16_t ps_extension(ps_info *ps, bitfile *ld, - const uint8_t ps_extension_id, - const uint16_t num_bits_left) -{ - uint8_t n; - uint16_t bits = (uint16_t)faad_get_processed_bits(ld); - - if (ps_extension_id == 0) - { - ps->enable_ipdopd = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,1015,"ps_extension(): enable_ipdopd")); - - if (ps->enable_ipdopd) - { - for (n = 0; n < ps->num_env; n++) - { - ps->ipd_dt[n] = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,1016,"ps_extension(): ipd_dt")); - - /* ipd_data */ - huff_data(ld, ps->ipd_dt[n], ps->nr_ipdopd_par, t_huff_ipd, - f_huff_ipd, ps->ipd_index[n]); - - ps->opd_dt[n] = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,1017,"ps_extension(): opd_dt")); - - /* opd_data */ - huff_data(ld, ps->opd_dt[n], ps->nr_ipdopd_par, t_huff_opd, - f_huff_opd, ps->opd_index[n]); - } - } - faad_get1bit(ld - DEBUGVAR(1,1018,"ps_extension(): reserved_ps")); - } - - /* return number of bits read */ - bits = (uint16_t)faad_get_processed_bits(ld) - bits; - - return bits; -} - -/* read huffman data coded in either the frequency or the time direction */ -static void huff_data(bitfile *ld, const uint8_t dt, const uint8_t nr_par, - ps_huff_tab t_huff, ps_huff_tab f_huff, int8_t *par) -{ - uint8_t n; - - if (dt) - { - /* coded in time direction */ - for (n = 0; n < nr_par; n++) - { - par[n] = ps_huff_dec(ld, t_huff); - } - } else { - /* coded in frequency direction */ - par[0] = ps_huff_dec(ld, f_huff); - - for (n = 1; n < nr_par; n++) - { - par[n] = ps_huff_dec(ld, f_huff); - } - } -} - -/* binary search huffman decoding */ -static INLINE int8_t ps_huff_dec(bitfile *ld, ps_huff_tab t_huff) -{ - uint8_t bit; - int16_t index = 0; - - while (index >= 0) - { - bit = (uint8_t)faad_get1bit(ld); - index = t_huff[index][bit]; - } - - return index + 31; -} - -#endif diff --git a/mplayer/libfaad2/ps_tables.h b/mplayer/libfaad2/ps_tables.h deleted file mode 100644 index f61eef0b..00000000 --- a/mplayer/libfaad2/ps_tables.h +++ /dev/null @@ -1,547 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: ps_tables.h,v 1.3 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __PS_TABLES_H__ -#define __PS_TABLES_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _MSC_VER -#pragma warning(disable:4305) -#pragma warning(disable:4244) -#endif - -#if 0 -#if 0 -float f_center_20[12] = { - 0.5/4, 1.5/4, 2.5/4, 3.5/4, - 4.5/4*0, 5.5/4*0, -1.5/4, -0.5/4, - 3.5/2, 2.5/2, 4.5/2, 5.5/2 -}; -#else -float f_center_20[12] = { - 0.5/8, 1.5/8, 2.5/8, 3.5/8, - 4.5/8*0, 5.5/8*0, -1.5/8, -0.5/8, - 3.5/4, 2.5/4, 4.5/4, 5.5/4 -}; -#endif - -float f_center_34[32] = { - 1/12, 3/12, 5/12, 7/12, - 9/12, 11/12, 13/12, 15/12, - 17/12, -5/12, -3/12, -1/12, - 17/8, 19/8, 5/8, 7/8, - 9/8, 11/8, 13/8, 15/8, - 9/4, 11/4, 13/4, 7/4, - 17/4, 11/4, 13/4, 15/4, - 17/4, 19/4, 21/4, 15/4 -}; - -static const real_t frac_delay_q[] = { - FRAC_CONST(0.43), - FRAC_CONST(0.75), - FRAC_CONST(0.347) -}; -#endif - -/* RE(ps->Phi_Fract_Qmf[j]) = (float)cos(M_PI*(j+0.5)*(0.39)); */ -/* IM(ps->Phi_Fract_Qmf[j]) = (float)sin(M_PI*(j+0.5)*(0.39)); */ -static const complex_t Phi_Fract_Qmf[] = { - { FRAC_CONST(0.8181497455), FRAC_CONST(0.5750052333) }, - { FRAC_CONST(-0.2638730407), FRAC_CONST(0.9645574093) }, - { FRAC_CONST(-0.9969173074), FRAC_CONST(0.0784590989) }, - { FRAC_CONST(-0.4115143716), FRAC_CONST(-0.9114032984) }, - { FRAC_CONST(0.7181262970), FRAC_CONST(-0.6959127784) }, - { FRAC_CONST(0.8980275989), FRAC_CONST(0.4399391711) }, - { FRAC_CONST(-0.1097343117), FRAC_CONST(0.9939609766) }, - { FRAC_CONST(-0.9723699093), FRAC_CONST(0.2334453613) }, - { FRAC_CONST(-0.5490227938), FRAC_CONST(-0.8358073831) }, - { FRAC_CONST(0.6004202366), FRAC_CONST(-0.7996846437) }, - { FRAC_CONST(0.9557930231), FRAC_CONST(0.2940403223) }, - { FRAC_CONST(0.0471064523), FRAC_CONST(0.9988898635) }, - { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, - { FRAC_CONST(-0.6730124950), FRAC_CONST(-0.7396311164) }, - { FRAC_CONST(0.4679298103), FRAC_CONST(-0.8837656379) }, - { FRAC_CONST(0.9900236726), FRAC_CONST(0.1409012377) }, - { FRAC_CONST(0.2027872950), FRAC_CONST(0.9792228341) }, - { FRAC_CONST(-0.8526401520), FRAC_CONST(0.5224985480) }, - { FRAC_CONST(-0.7804304361), FRAC_CONST(-0.6252426505) }, - { FRAC_CONST(0.3239174187), FRAC_CONST(-0.9460853338) }, - { FRAC_CONST(0.9998766184), FRAC_CONST(-0.0157073177) }, - { FRAC_CONST(0.3534748554), FRAC_CONST(0.9354440570) }, - { FRAC_CONST(-0.7604059577), FRAC_CONST(0.6494480371) }, - { FRAC_CONST(-0.8686315417), FRAC_CONST(-0.4954586625) }, - { FRAC_CONST(0.1719291061), FRAC_CONST(-0.9851093292) }, - { FRAC_CONST(0.9851093292), FRAC_CONST(-0.1719291061) }, - { FRAC_CONST(0.4954586625), FRAC_CONST(0.8686315417) }, - { FRAC_CONST(-0.6494480371), FRAC_CONST(0.7604059577) }, - { FRAC_CONST(-0.9354440570), FRAC_CONST(-0.3534748554) }, - { FRAC_CONST(0.0157073177), FRAC_CONST(-0.9998766184) }, - { FRAC_CONST(0.9460853338), FRAC_CONST(-0.3239174187) }, - { FRAC_CONST(0.6252426505), FRAC_CONST(0.7804304361) }, - { FRAC_CONST(-0.5224985480), FRAC_CONST(0.8526401520) }, - { FRAC_CONST(-0.9792228341), FRAC_CONST(-0.2027872950) }, - { FRAC_CONST(-0.1409012377), FRAC_CONST(-0.9900236726) }, - { FRAC_CONST(0.8837656379), FRAC_CONST(-0.4679298103) }, - { FRAC_CONST(0.7396311164), FRAC_CONST(0.6730124950) }, - { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, - { FRAC_CONST(-0.9988898635), FRAC_CONST(-0.0471064523) }, - { FRAC_CONST(-0.2940403223), FRAC_CONST(-0.9557930231) }, - { FRAC_CONST(0.7996846437), FRAC_CONST(-0.6004202366) }, - { FRAC_CONST(0.8358073831), FRAC_CONST(0.5490227938) }, - { FRAC_CONST(-0.2334453613), FRAC_CONST(0.9723699093) }, - { FRAC_CONST(-0.9939609766), FRAC_CONST(0.1097343117) }, - { FRAC_CONST(-0.4399391711), FRAC_CONST(-0.8980275989) }, - { FRAC_CONST(0.6959127784), FRAC_CONST(-0.7181262970) }, - { FRAC_CONST(0.9114032984), FRAC_CONST(0.4115143716) }, - { FRAC_CONST(-0.0784590989), FRAC_CONST(0.9969173074) }, - { FRAC_CONST(-0.9645574093), FRAC_CONST(0.2638730407) }, - { FRAC_CONST(-0.5750052333), FRAC_CONST(-0.8181497455) }, - { FRAC_CONST(0.5750052333), FRAC_CONST(-0.8181497455) }, - { FRAC_CONST(0.9645574093), FRAC_CONST(0.2638730407) }, - { FRAC_CONST(0.0784590989), FRAC_CONST(0.9969173074) }, - { FRAC_CONST(-0.9114032984), FRAC_CONST(0.4115143716) }, - { FRAC_CONST(-0.6959127784), FRAC_CONST(-0.7181262970) }, - { FRAC_CONST(0.4399391711), FRAC_CONST(-0.8980275989) }, - { FRAC_CONST(0.9939609766), FRAC_CONST(0.1097343117) }, - { FRAC_CONST(0.2334453613), FRAC_CONST(0.9723699093) }, - { FRAC_CONST(-0.8358073831), FRAC_CONST(0.5490227938) }, - { FRAC_CONST(-0.7996846437), FRAC_CONST(-0.6004202366) }, - { FRAC_CONST(0.2940403223), FRAC_CONST(-0.9557930231) }, - { FRAC_CONST(0.9988898635), FRAC_CONST(-0.0471064523) }, - { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, - { FRAC_CONST(-0.7396311164), FRAC_CONST(0.6730124950) } -}; - -/* RE(Phi_Fract_SubQmf20[j]) = (float)cos(M_PI*f_center_20[j]*0.39); */ -/* IM(Phi_Fract_SubQmf20[j]) = (float)sin(M_PI*f_center_20[j]*0.39); */ -static const complex_t Phi_Fract_SubQmf20[] = { - { FRAC_CONST(0.9882950187), FRAC_CONST(0.1525546312) }, - { FRAC_CONST(0.8962930441), FRAC_CONST(0.4434623122) }, - { FRAC_CONST(0.7208535671), FRAC_CONST(0.6930873394) }, - { FRAC_CONST(0.4783087075), FRAC_CONST(0.8781917691) }, - { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, - { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, - { FRAC_CONST(0.8962930441), FRAC_CONST(-0.4434623122) }, - { FRAC_CONST(0.9882950187), FRAC_CONST(-0.1525546312) }, - { FRAC_CONST(-0.5424415469), FRAC_CONST(0.8400935531) }, - { FRAC_CONST(0.0392598175), FRAC_CONST(0.9992290139) }, - { FRAC_CONST(-0.9268565774), FRAC_CONST(0.3754155636) }, - { FRAC_CONST(-0.9741733670), FRAC_CONST(-0.2258012742) } -}; - -/* RE(Phi_Fract_SubQmf34[j]) = (float)cos(M_PI*f_center_34[j]*0.39); */ -/* IM(Phi_Fract_SubQmf34[j]) = (float)sin(M_PI*f_center_34[j]*0.39); */ -static const complex_t Phi_Fract_SubQmf34[] = { - { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, - { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, - { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, - { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, - { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, - { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, - { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, - { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, - { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, - { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, - { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, - { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, - { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, - { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, - { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, - { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, - { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, - { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, - { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, - { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, - { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, - { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, - { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) }, - { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, - { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) }, - { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, - { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) }, - { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) }, - { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) }, - { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) }, - { FRAC_CONST(0.9876883626), FRAC_CONST(-0.1564344615) }, - { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) } -}; - -/* RE(Q_Fract_allpass_Qmf[j][i]) = (float)cos(M_PI*(j+0.5)*(frac_delay_q[i])); */ -/* IM(Q_Fract_allpass_Qmf[j][i]) = (float)sin(M_PI*(j+0.5)*(frac_delay_q[i])); */ -static const complex_t Q_Fract_allpass_Qmf[][3] = { - { { FRAC_CONST(0.7804303765), FRAC_CONST(0.6252426505) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.8550928831), FRAC_CONST(0.5184748173) } }, - { { FRAC_CONST(-0.4399392009), FRAC_CONST(0.8980275393) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.0643581524), FRAC_CONST(0.9979268909) } }, - { { FRAC_CONST(-0.9723699093), FRAC_CONST(-0.2334454209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.9146071672), FRAC_CONST(0.4043435752) } }, - { { FRAC_CONST(0.0157073960), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7814115286), FRAC_CONST(-0.6240159869) } }, - { { FRAC_CONST(0.9792228341), FRAC_CONST(-0.2027871907) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.1920081824), FRAC_CONST(-0.9813933372) } }, - { { FRAC_CONST(0.4115142524), FRAC_CONST(0.9114032984) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9589683414), FRAC_CONST(-0.2835132182) } }, - { { FRAC_CONST(-0.7996847630), FRAC_CONST(0.6004201174) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.6947838664), FRAC_CONST(0.7192186117) } }, - { { FRAC_CONST(-0.7604058385), FRAC_CONST(-0.6494481564) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3164770305), FRAC_CONST(0.9486001730) } }, - { { FRAC_CONST(0.4679299891), FRAC_CONST(-0.8837655187) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9874414206), FRAC_CONST(0.1579856575) } }, - { { FRAC_CONST(0.9645573497), FRAC_CONST(0.2638732493) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.5966450572), FRAC_CONST(-0.8025052547) } }, - { { FRAC_CONST(-0.0471066870), FRAC_CONST(0.9988898635) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.4357025325), FRAC_CONST(-0.9000906944) } }, - { { FRAC_CONST(-0.9851093888), FRAC_CONST(0.1719288528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9995546937), FRAC_CONST(-0.0298405960) } }, - { { FRAC_CONST(-0.3826831877), FRAC_CONST(-0.9238796234) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.4886211455), FRAC_CONST(0.8724960685) } }, - { { FRAC_CONST(0.8181498647), FRAC_CONST(-0.5750049949) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.5477093458), FRAC_CONST(0.8366686702) } }, - { { FRAC_CONST(0.7396308780), FRAC_CONST(0.6730127335) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9951074123), FRAC_CONST(-0.0987988561) } }, - { { FRAC_CONST(-0.4954589605), FRAC_CONST(0.8686313629) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3725017905), FRAC_CONST(-0.9280315042) } }, - { { FRAC_CONST(-0.9557929039), FRAC_CONST(-0.2940406799) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.6506417990), FRAC_CONST(-0.7593847513) } }, - { { FRAC_CONST(0.0784594864), FRAC_CONST(-0.9969173074) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9741733670), FRAC_CONST(0.2258014232) } }, - { { FRAC_CONST(0.9900237322), FRAC_CONST(-0.1409008205) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.2502108514), FRAC_CONST(0.9681913853) } }, - { { FRAC_CONST(0.3534744382), FRAC_CONST(0.9354441762) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7427945137), FRAC_CONST(0.6695194840) } }, - { { FRAC_CONST(-0.8358076215), FRAC_CONST(0.5490224361) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9370992780), FRAC_CONST(-0.3490629196) } }, - { { FRAC_CONST(-0.7181259394), FRAC_CONST(-0.6959131360) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.1237744763), FRAC_CONST(-0.9923103452) } }, - { { FRAC_CONST(0.5224990249), FRAC_CONST(-0.8526399136) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.8226406574), FRAC_CONST(-0.5685616732) } }, - { { FRAC_CONST(0.9460852146), FRAC_CONST(0.3239179254) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.8844994903), FRAC_CONST(0.4665412009) } }, - { { FRAC_CONST(-0.1097348556), FRAC_CONST(0.9939609170) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.0047125919), FRAC_CONST(0.9999889135) } }, - { { FRAC_CONST(-0.9939610362), FRAC_CONST(0.1097337380) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8888573647), FRAC_CONST(0.4581840038) } }, - { { FRAC_CONST(-0.3239168525), FRAC_CONST(-0.9460855722) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8172453642), FRAC_CONST(-0.5762898922) } }, - { { FRAC_CONST(0.8526405096), FRAC_CONST(-0.5224980116) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.1331215799), FRAC_CONST(-0.9910997152) } }, - { { FRAC_CONST(0.6959123611), FRAC_CONST(0.7181267142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9403476119), FRAC_CONST(-0.3402152061) } }, - { { FRAC_CONST(-0.5490233898), FRAC_CONST(0.8358070254) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7364512086), FRAC_CONST(0.6764906645) } }, - { { FRAC_CONST(-0.9354437590), FRAC_CONST(-0.3534754813) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2593250275), FRAC_CONST(0.9657900929) } }, - { { FRAC_CONST(0.1409019381), FRAC_CONST(-0.9900235534) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9762582779), FRAC_CONST(0.2166097313) } }, - { { FRAC_CONST(0.9969173670), FRAC_CONST(-0.0784583688) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.6434556246), FRAC_CONST(-0.7654833794) } }, - { { FRAC_CONST(0.2940396070), FRAC_CONST(0.9557932615) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3812320232), FRAC_CONST(-0.9244794250) } }, - { { FRAC_CONST(-0.8686318994), FRAC_CONST(0.4954580069) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9959943891), FRAC_CONST(-0.0894154981) } }, - { { FRAC_CONST(-0.6730118990), FRAC_CONST(-0.7396316528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.5397993922), FRAC_CONST(0.8417937160) } }, - { { FRAC_CONST(0.5750059485), FRAC_CONST(-0.8181492686) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.4968227744), FRAC_CONST(0.8678520322) } }, - { { FRAC_CONST(0.9238792062), FRAC_CONST(0.3826842010) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9992290139), FRAC_CONST(-0.0392601527) } }, - { { FRAC_CONST(-0.1719299555), FRAC_CONST(0.9851091504) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4271997511), FRAC_CONST(-0.9041572809) } }, - { { FRAC_CONST(-0.9988899231), FRAC_CONST(0.0471055657) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.6041822433), FRAC_CONST(-0.7968461514) } }, - { { FRAC_CONST(-0.2638721764), FRAC_CONST(-0.9645576477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9859085083), FRAC_CONST(0.1672853529) } }, - { { FRAC_CONST(0.8837660551), FRAC_CONST(-0.4679289758) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3075223565), FRAC_CONST(0.9515408874) } }, - { { FRAC_CONST(0.6494473219), FRAC_CONST(0.7604066133) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.7015317082), FRAC_CONST(0.7126382589) } }, - { { FRAC_CONST(-0.6004210114), FRAC_CONST(0.7996840477) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9562535882), FRAC_CONST(-0.2925389707) } }, - { { FRAC_CONST(-0.9114028811), FRAC_CONST(-0.4115152657) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.1827499419), FRAC_CONST(-0.9831594229) } }, - { { FRAC_CONST(0.2027882934), FRAC_CONST(-0.9792225957) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7872582674), FRAC_CONST(-0.6166234016) } }, - { { FRAC_CONST(0.9998766780), FRAC_CONST(-0.0157062728) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9107555747), FRAC_CONST(0.4129458666) } }, - { { FRAC_CONST(0.2334443331), FRAC_CONST(0.9723701477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.0549497530), FRAC_CONST(0.9984891415) } }, - { { FRAC_CONST(-0.8980280757), FRAC_CONST(0.4399381876) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.8599416018), FRAC_CONST(0.5103924870) } }, - { { FRAC_CONST(-0.6252418160), FRAC_CONST(-0.7804310918) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8501682281), FRAC_CONST(-0.5265110731) } }, - { { FRAC_CONST(0.6252435446), FRAC_CONST(-0.7804297209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.0737608299), FRAC_CONST(-0.9972759485) } }, - { { FRAC_CONST(0.8980270624), FRAC_CONST(0.4399402142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9183775187), FRAC_CONST(-0.3957053721) } }, - { { FRAC_CONST(-0.2334465086), FRAC_CONST(0.9723696709) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.7754954696), FRAC_CONST(0.6313531399) } }, - { { FRAC_CONST(-0.9998766184), FRAC_CONST(-0.0157085191) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2012493610), FRAC_CONST(0.9795400500) } }, - { { FRAC_CONST(-0.2027861029), FRAC_CONST(-0.9792230725) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9615978599), FRAC_CONST(0.2744622827) } }, - { { FRAC_CONST(0.9114037752), FRAC_CONST(-0.4115132093) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.6879743338), FRAC_CONST(-0.7257350087) } }, - { { FRAC_CONST(0.6004192233), FRAC_CONST(0.7996854186) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.3254036009), FRAC_CONST(-0.9455752373) } }, - { { FRAC_CONST(-0.6494490504), FRAC_CONST(0.7604051232) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9888865948), FRAC_CONST(-0.1486719251) } }, - { { FRAC_CONST(-0.8837650418), FRAC_CONST(-0.4679309726) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.5890548825), FRAC_CONST(0.8080930114) } }, - { { FRAC_CONST(0.2638743520), FRAC_CONST(-0.9645570517) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.4441666007), FRAC_CONST(0.8959442377) } }, - { { FRAC_CONST(0.9988898039), FRAC_CONST(0.0471078083) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9997915030), FRAC_CONST(0.0204183888) } }, - { { FRAC_CONST(0.1719277352), FRAC_CONST(0.9851095676) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4803760946), FRAC_CONST(-0.8770626187) } }, - { { FRAC_CONST(-0.9238800406), FRAC_CONST(0.3826821446) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.5555707216), FRAC_CONST(-0.8314692974) } }, - { { FRAC_CONST(-0.5750041008), FRAC_CONST(-0.8181505203) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9941320419), FRAC_CONST(0.1081734300) } } -}; - -/* RE(Q_Fract_allpass_SubQmf20[j][i]) = (float)cos(M_PI*f_center_20[j]*frac_delay_q[i]); */ -/* IM(Q_Fract_allpass_SubQmf20[j][i]) = (float)sin(M_PI*f_center_20[j]*frac_delay_q[i]); */ -static const complex_t Q_Fract_allpass_SubQmf20[][3] = { - { { FRAC_CONST(0.9857769012), FRAC_CONST(0.1680592746) }, { FRAC_CONST(0.9569403529), FRAC_CONST(0.2902846634) }, { FRAC_CONST(0.9907300472), FRAC_CONST(0.1358452588) } }, - { { FRAC_CONST(0.8744080663), FRAC_CONST(0.4851911962) }, { FRAC_CONST(0.6343932748), FRAC_CONST(0.7730104327) }, { FRAC_CONST(0.9175986052), FRAC_CONST(0.3975082636) } }, - { { FRAC_CONST(0.6642524004), FRAC_CONST(0.7475083470) }, { FRAC_CONST(0.0980171412), FRAC_CONST(0.9951847196) }, { FRAC_CONST(0.7767338753), FRAC_CONST(0.6298289299) } }, - { { FRAC_CONST(0.3790524006), FRAC_CONST(0.9253752232) }, { FRAC_CONST(-0.4713967443), FRAC_CONST(0.8819212914) }, { FRAC_CONST(0.5785340071), FRAC_CONST(0.8156582713) } }, - { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, - { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, - { { FRAC_CONST(0.8744080663), FRAC_CONST(-0.4851911962) }, { FRAC_CONST(0.6343932748), FRAC_CONST(-0.7730104327) }, { FRAC_CONST(0.9175986052), FRAC_CONST(-0.3975082636) } }, - { { FRAC_CONST(0.9857769012), FRAC_CONST(-0.1680592746) }, { FRAC_CONST(0.9569403529), FRAC_CONST(-0.2902846634) }, { FRAC_CONST(0.9907300472), FRAC_CONST(-0.1358452588) } }, - { { FRAC_CONST(-0.7126385570), FRAC_CONST(0.7015314102) }, { FRAC_CONST(-0.5555702448), FRAC_CONST(-0.8314695954) }, { FRAC_CONST(-0.3305967748), FRAC_CONST(0.9437720776) } }, - { { FRAC_CONST(-0.1175374240), FRAC_CONST(0.9930684566) }, { FRAC_CONST(-0.9807852507), FRAC_CONST(0.1950903237) }, { FRAC_CONST(0.2066311091), FRAC_CONST(0.9784189463) } }, - { { FRAC_CONST(-0.9947921634), FRAC_CONST(0.1019244045) }, { FRAC_CONST(0.5555702448), FRAC_CONST(-0.8314695954) }, { FRAC_CONST(-0.7720130086), FRAC_CONST(0.6356067061) } }, - { { FRAC_CONST(-0.8400934935), FRAC_CONST(-0.5424416065) }, { FRAC_CONST(0.9807852507), FRAC_CONST(0.1950903237) }, { FRAC_CONST(-0.9896889329), FRAC_CONST(0.1432335079) } } -}; - -/* RE(Q_Fract_allpass_SubQmf34[j][i]) = (float)cos(M_PI*f_center_34[j]*frac_delay_q[i]); */ -/* IM(Q_Fract_allpass_SubQmf34[j][i]) = (float)sin(M_PI*f_center_34[j]*frac_delay_q[i]); */ -static const complex_t Q_Fract_allpass_SubQmf34[][3] = { - { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, - { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, - { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, - { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, - { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, - { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, - { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, - { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, - { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, - { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, - { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, - { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, - { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, - { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, - { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, - { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, - { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, - { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, - { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, - { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, - { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, - { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, - { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } }, - { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, - { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } }, - { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, - { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } }, - { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } }, - { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } }, - { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } }, - { { FRAC_CONST(0.8910064697), FRAC_CONST(0.4539906085) }, { FRAC_CONST(0.7071067691), FRAC_CONST(-0.7071067691) }, { FRAC_CONST(0.6730125546), FRAC_CONST(-0.7396310568) } }, - { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } } -}; - -#if 0 -static float quant_rho[8] = -{ - FRAC_CONST(1.0), FRAC_CONST(0.937), FRAC_CONST(0.84118), FRAC_CONST(0.60092), - FRAC_CONST(0.36764), FRAC_CONST(0.0), FRAC_CONST(-0.589), FRAC_CONST(-1.0) -}; - -static const uint8_t quant_iid_normal[7] = -{ - 2, 4, 7, 10, 14, 18, 25 -}; - -static const uint8_t quant_iid_fine[15] = -{ - 2, 4, 6, 8, 10, 13, 16, 19, 22, 25, 30, 35, 40, 45, 50 -}; -#endif - -static const real_t cos_alphas[] = { - COEF_CONST(1.0000000000), COEF_CONST(0.9841239700), COEF_CONST(0.9594738210), - COEF_CONST(0.8946843079), COEF_CONST(0.8269340931), COEF_CONST(0.7071067812), - COEF_CONST(0.4533210856), COEF_CONST(0.0000000000) -}; - -static const real_t sin_alphas[] = { - COEF_CONST(0.0000000000), COEF_CONST(0.1774824264), COEF_CONST(0.2817977763), - COEF_CONST(0.4466989918), COEF_CONST(0.5622988580), COEF_CONST(0.7071067812), - COEF_CONST(0.8913472911), COEF_CONST(1.0000000000) -}; - -static const real_t cos_betas_normal[][8] = { - { COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9995871699), COEF_CONST(0.9989419133), COEF_CONST(0.9972204583), COEF_CONST(0.9953790839), COEF_CONST(0.9920112747), COEF_CONST(0.9843408180), COEF_CONST(0.9681727381) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9984497744), COEF_CONST(0.9960279377), COEF_CONST(0.9895738413), COEF_CONST(0.9826814632), COEF_CONST(0.9701058164), COEF_CONST(0.9416098832), COEF_CONST(0.8822105900) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9959398908), COEF_CONST(0.9896038018), COEF_CONST(0.9727589768), COEF_CONST(0.9548355329), COEF_CONST(0.9223070404), COEF_CONST(0.8494349490), COEF_CONST(0.7013005535) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9932417400), COEF_CONST(0.9827071856), COEF_CONST(0.9547730996), COEF_CONST(0.9251668930), COEF_CONST(0.8717461589), COEF_CONST(0.7535520592), COEF_CONST(0.5198827312) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9902068095), COEF_CONST(0.9749613872), COEF_CONST(0.9346538534), COEF_CONST(0.8921231300), COEF_CONST(0.8158851259), COEF_CONST(0.6495964302), COEF_CONST(0.3313370772) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9880510933), COEF_CONST(0.9694670261), COEF_CONST(0.9204347876), COEF_CONST(0.8688622825), COEF_CONST(0.7768516704), COEF_CONST(0.5782161800), COEF_CONST(0.2069970356) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9858996945), COEF_CONST(0.9639898866), COEF_CONST(0.9063034786), COEF_CONST(0.8458214608), COEF_CONST(0.7384262300), COEF_CONST(0.5089811277), COEF_CONST(0.0905465944) } -}; - -static const real_t sin_betas_normal[][8] = { - { COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.0287313368), COEF_CONST(-0.0459897147), COEF_CONST(-0.0745074328), COEF_CONST(-0.0960233266), COEF_CONST(-0.1261492408), COEF_CONST(-0.1762757894), COEF_CONST(-0.2502829383) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.0556601118), COEF_CONST(-0.0890412670), COEF_CONST(-0.1440264301), COEF_CONST(-0.1853028382), COEF_CONST(-0.2426823129), COEF_CONST(-0.3367058477), COEF_CONST(-0.4708550466) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.0900207420), COEF_CONST(-0.1438204281), COEF_CONST(-0.2318188366), COEF_CONST(-0.2971348264), COEF_CONST(-0.3864579191), COEF_CONST(-0.5276933461), COEF_CONST(-0.7128657193) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1160639735), COEF_CONST(-0.1851663774), COEF_CONST(-0.2973353800), COEF_CONST(-0.3795605619), COEF_CONST(-0.4899577884), COEF_CONST(-0.6573882369), COEF_CONST(-0.8542376401) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1396082894), COEF_CONST(-0.2223742196), COEF_CONST(-0.3555589603), COEF_CONST(-0.4517923427), COEF_CONST(-0.5782140273), COEF_CONST(-0.7602792104), COEF_CONST(-0.9435124489) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1541266914), COEF_CONST(-0.2452217065), COEF_CONST(-0.3908961522), COEF_CONST(-0.4950538699), COEF_CONST(-0.6296836366), COEF_CONST(-0.8158836002), COEF_CONST(-0.9783415698) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1673373610), COEF_CONST(-0.2659389001), COEF_CONST(-0.4226275012), COEF_CONST(-0.5334660781), COEF_CONST(-0.6743342664), COEF_CONST(-0.8607776784), COEF_CONST(-0.9958922202) } -}; - -static const real_t cos_betas_fine[][8] = { - { COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9995871699), COEF_CONST(0.9989419133), COEF_CONST(0.9972204583), COEF_CONST(0.9953790839), COEF_CONST(0.9920112747), COEF_CONST(0.9843408180), COEF_CONST(0.9681727381) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9984497744), COEF_CONST(0.9960279377), COEF_CONST(0.9895738413), COEF_CONST(0.9826814632), COEF_CONST(0.9701058164), COEF_CONST(0.9416098832), COEF_CONST(0.8822105900) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9968361371), COEF_CONST(0.9918968104), COEF_CONST(0.9787540479), COEF_CONST(0.9647515190), COEF_CONST(0.9392903010), COEF_CONST(0.8820167114), COEF_CONST(0.7645325390) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9950262915), COEF_CONST(0.9872675041), COEF_CONST(0.9666584578), COEF_CONST(0.9447588606), COEF_CONST(0.9050918405), COEF_CONST(0.8165997379), COEF_CONST(0.6383824796) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9932417400), COEF_CONST(0.9827071856), COEF_CONST(0.9547730996), COEF_CONST(0.9251668930), COEF_CONST(0.8717461589), COEF_CONST(0.7535520592), COEF_CONST(0.5198827312) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9908827998), COEF_CONST(0.9766855904), COEF_CONST(0.9391249214), COEF_CONST(0.8994531782), COEF_CONST(0.8282352693), COEF_CONST(0.6723983174), COEF_CONST(0.3719473225) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9890240165), COEF_CONST(0.9719459866), COEF_CONST(0.9268448110), COEF_CONST(0.8793388536), COEF_CONST(0.7944023271), COEF_CONST(0.6101812098), COEF_CONST(0.2621501145) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9876350461), COEF_CONST(0.9684073447), COEF_CONST(0.9176973944), COEF_CONST(0.8643930070), COEF_CONST(0.7693796058), COEF_CONST(0.5646720713), COEF_CONST(0.1838899556) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9866247085), COEF_CONST(0.9658349704), COEF_CONST(0.9110590761), COEF_CONST(0.8535668048), COEF_CONST(0.7513165426), COEF_CONST(0.5320914819), COEF_CONST(0.1289530943) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9858996945), COEF_CONST(0.9639898866), COEF_CONST(0.9063034786), COEF_CONST(0.8458214608), COEF_CONST(0.7384262300), COEF_CONST(0.5089811277), COEF_CONST(0.0905465944) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9851245614), COEF_CONST(0.9620180268), COEF_CONST(0.9012265590), COEF_CONST(0.8375623272), COEF_CONST(0.7247108045), COEF_CONST(0.4845204297), COEF_CONST(0.0504115003) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9846869856), COEF_CONST(0.9609052357), COEF_CONST(0.8983639533), COEF_CONST(0.8329098386), COEF_CONST(0.7169983441), COEF_CONST(0.4708245354), COEF_CONST(0.0281732509) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9844406325), COEF_CONST(0.9602788522), COEF_CONST(0.8967533934), COEF_CONST(0.8302936455), COEF_CONST(0.7126658102), COEF_CONST(0.4631492839), COEF_CONST(0.0157851140) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9843020502), COEF_CONST(0.9599265269), COEF_CONST(0.8958477331), COEF_CONST(0.8288229094), COEF_CONST(0.7102315840), COEF_CONST(0.4588429315), COEF_CONST(0.0088578059) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9842241136), COEF_CONST(0.9597283916), COEF_CONST(0.8953385094), COEF_CONST(0.8279961409), COEF_CONST(0.7088635748), COEF_CONST(0.4564246834), COEF_CONST(0.0049751355) } -}; - -static const real_t sin_betas_fine[][8] = { - { COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.0287313368), COEF_CONST(-0.0459897147), COEF_CONST(-0.0745074328), COEF_CONST(-0.0960233266), COEF_CONST(-0.1261492408), COEF_CONST(-0.1762757894), COEF_CONST(-0.2502829383) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.0556601118), COEF_CONST(-0.0890412670), COEF_CONST(-0.1440264301), COEF_CONST(-0.1853028382), COEF_CONST(-0.2426823129), COEF_CONST(-0.3367058477), COEF_CONST(-0.4708550466) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.0794840594), COEF_CONST(-0.1270461238), COEF_CONST(-0.2050378347), COEF_CONST(-0.2631625097), COEF_CONST(-0.3431234916), COEF_CONST(-0.4712181245), COEF_CONST(-0.6445851354) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.0996126459), COEF_CONST(-0.1590687758), COEF_CONST(-0.2560691819), COEF_CONST(-0.3277662204), COEF_CONST(-0.4252161335), COEF_CONST(-0.5772043556), COEF_CONST(-0.7697193058) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1160639735), COEF_CONST(-0.1851663774), COEF_CONST(-0.2973353800), COEF_CONST(-0.3795605619), COEF_CONST(-0.4899577884), COEF_CONST(-0.6573882369), COEF_CONST(-0.8542376401) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1347266752), COEF_CONST(-0.2146747714), COEF_CONST(-0.3435758752), COEF_CONST(-0.4370171396), COEF_CONST(-0.5603805303), COEF_CONST(-0.7401895046), COEF_CONST(-0.9282538388) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1477548470), COEF_CONST(-0.2352041647), COEF_CONST(-0.3754446647), COEF_CONST(-0.4761965776), COEF_CONST(-0.6073919186), COEF_CONST(-0.7922618830), COEF_CONST(-0.9650271071) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1567705832), COEF_CONST(-0.2493736450), COEF_CONST(-0.3972801182), COEF_CONST(-0.5028167951), COEF_CONST(-0.6387918458), COEF_CONST(-0.8253153651), COEF_CONST(-0.9829468369) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1630082348), COEF_CONST(-0.2591578860), COEF_CONST(-0.4122758299), COEF_CONST(-0.5209834064), COEF_CONST(-0.6599420072), COEF_CONST(-0.8466868694), COEF_CONST(-0.9916506943) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1673373610), COEF_CONST(-0.2659389001), COEF_CONST(-0.4226275012), COEF_CONST(-0.5334660781), COEF_CONST(-0.6743342664), COEF_CONST(-0.8607776784), COEF_CONST(-0.9958922202) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1718417832), COEF_CONST(-0.2729859267), COEF_CONST(-0.4333482310), COEF_CONST(-0.5463417868), COEF_CONST(-0.6890531546), COEF_CONST(-0.8747799456), COEF_CONST(-0.9987285320) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1743316967), COEF_CONST(-0.2768774604), COEF_CONST(-0.4392518725), COEF_CONST(-0.5534087104), COEF_CONST(-0.6970748701), COEF_CONST(-0.8822268738), COEF_CONST(-0.9996030552) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1757175038), COEF_CONST(-0.2790421580), COEF_CONST(-0.4425306221), COEF_CONST(-0.5573261722), COEF_CONST(-0.7015037013), COEF_CONST(-0.8862802834), COEF_CONST(-0.9998754073) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1764921355), COEF_CONST(-0.2802517850), COEF_CONST(-0.4443611583), COEF_CONST(-0.5595110229), COEF_CONST(-0.7039681080), COEF_CONST(-0.8885173967), COEF_CONST(-0.9999607689) }, - { COEF_CONST(0.0000000000), COEF_CONST(-0.1769262394), COEF_CONST(-0.2809295540), COEF_CONST(-0.4453862969), COEF_CONST(-0.5607337966), COEF_CONST(-0.7053456119), COEF_CONST(-0.8897620516), COEF_CONST(-0.9999876239) } -}; - -static const real_t sincos_alphas_B_normal[][8] = { - { COEF_CONST(0.0561454100), COEF_CONST(0.0526385859), COEF_CONST(0.0472937334), COEF_CONST(0.0338410641), COEF_CONST(0.0207261065), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635) }, - { COEF_CONST(0.1249065138), COEF_CONST(0.1173697697), COEF_CONST(0.1057888284), COEF_CONST(0.0761985131), COEF_CONST(0.0468732723), COEF_CONST(0.0063956103), COEF_CONST(0.0063956103), COEF_CONST(0.0063956103) }, - { COEF_CONST(0.1956693050), COEF_CONST(0.1846090179), COEF_CONST(0.1673645109), COEF_CONST(0.1220621836), COEF_CONST(0.0757362479), COEF_CONST(0.0103882630), COEF_CONST(0.0103882630), COEF_CONST(0.0103882630) }, - { COEF_CONST(0.3015113269), COEF_CONST(0.2870525790), COEF_CONST(0.2637738799), COEF_CONST(0.1984573949), COEF_CONST(0.1260749909), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126) }, - { COEF_CONST(0.4078449476), COEF_CONST(0.3929852420), COEF_CONST(0.3680589270), COEF_CONST(0.2911029124), COEF_CONST(0.1934512363), COEF_CONST(0.0278686716), COEF_CONST(0.0278686716), COEF_CONST(0.0278686716) }, - { COEF_CONST(0.5336171261), COEF_CONST(0.5226637762), COEF_CONST(0.5033652606), COEF_CONST(0.4349162672), COEF_CONST(0.3224682122), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036) }, - { COEF_CONST(0.6219832023), COEF_CONST(0.6161847276), COEF_CONST(0.6057251063), COEF_CONST(0.5654342668), COEF_CONST(0.4826149915), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758) }, - { COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657) }, - { COEF_CONST(0.7830305572), COEF_CONST(0.7876016373), COEF_CONST(0.7956739618), COEF_CONST(0.8247933372), COEF_CONST(0.8758325942), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542) }, - { COEF_CONST(0.8457261833), COEF_CONST(0.8525388778), COEF_CONST(0.8640737401), COEF_CONST(0.9004708933), COEF_CONST(0.9465802987), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532) }, - { COEF_CONST(0.9130511848), COEF_CONST(0.9195447612), COEF_CONST(0.9298024282), COEF_CONST(0.9566917233), COEF_CONST(0.9811098801), COEF_CONST(0.9996115928), COEF_CONST(0.9996115928), COEF_CONST(0.9996115928) }, - { COEF_CONST(0.9534625907), COEF_CONST(0.9579148236), COEF_CONST(0.9645845234), COEF_CONST(0.9801095128), COEF_CONST(0.9920207064), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099) }, - { COEF_CONST(0.9806699215), COEF_CONST(0.9828120260), COEF_CONST(0.9858950861), COEF_CONST(0.9925224431), COEF_CONST(0.9971278825), COEF_CONST(0.9999460406), COEF_CONST(0.9999460406), COEF_CONST(0.9999460406) }, - { COEF_CONST(0.9921685024), COEF_CONST(0.9930882705), COEF_CONST(0.9943886135), COEF_CONST(0.9970926648), COEF_CONST(0.9989008403), COEF_CONST(0.9999795479), COEF_CONST(0.9999795479), COEF_CONST(0.9999795479) }, - { COEF_CONST(0.9984226014), COEF_CONST(0.9986136287), COEF_CONST(0.9988810254), COEF_CONST(0.9994272242), COEF_CONST(0.9997851906), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221) } -}; - -static const real_t sincos_alphas_B_fine[][8] = { - { COEF_CONST(0.0031622158), COEF_CONST(0.0029630181), COEF_CONST(0.0026599892), COEF_CONST(0.0019002704), COEF_CONST(0.0011626042), COEF_CONST(0.0001580278), COEF_CONST(0.0001580278), COEF_CONST(0.0001580278) }, - { COEF_CONST(0.0056232673), COEF_CONST(0.0052689825), COEF_CONST(0.0047302825), COEF_CONST(0.0033791756), COEF_CONST(0.0020674015), COEF_CONST(0.0002811710), COEF_CONST(0.0002811710), COEF_CONST(0.0002811710) }, - { COEF_CONST(0.0099994225), COEF_CONST(0.0093696693), COEF_CONST(0.0084117414), COEF_CONST(0.0060093796), COEF_CONST(0.0036766009), COEF_CONST(0.0005000392), COEF_CONST(0.0005000392), COEF_CONST(0.0005000392) }, - { COEF_CONST(0.0177799194), COEF_CONST(0.0166607102), COEF_CONST(0.0149581377), COEF_CONST(0.0106875809), COEF_CONST(0.0065392545), COEF_CONST(0.0008893767), COEF_CONST(0.0008893767), COEF_CONST(0.0008893767) }, - { COEF_CONST(0.0316069684), COEF_CONST(0.0296211579), COEF_CONST(0.0265987295), COEF_CONST(0.0190113813), COEF_CONST(0.0116349973), COEF_CONST(0.0015826974), COEF_CONST(0.0015826974), COEF_CONST(0.0015826974) }, - { COEF_CONST(0.0561454100), COEF_CONST(0.0526385859), COEF_CONST(0.0472937334), COEF_CONST(0.0338410641), COEF_CONST(0.0207261065), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635) }, - { COEF_CONST(0.0791834041), COEF_CONST(0.0742798103), COEF_CONST(0.0667907269), COEF_CONST(0.0478705292), COEF_CONST(0.0293500747), COEF_CONST(0.0039966755), COEF_CONST(0.0039966755), COEF_CONST(0.0039966755) }, - { COEF_CONST(0.1115021177), COEF_CONST(0.1047141985), COEF_CONST(0.0943053154), COEF_CONST(0.0678120561), COEF_CONST(0.0416669150), COEF_CONST(0.0056813213), COEF_CONST(0.0056813213), COEF_CONST(0.0056813213) }, - { COEF_CONST(0.1565355066), COEF_CONST(0.1473258371), COEF_CONST(0.1330924027), COEF_CONST(0.0963282233), COEF_CONST(0.0594509113), COEF_CONST(0.0081277946), COEF_CONST(0.0081277946), COEF_CONST(0.0081277946) }, - { COEF_CONST(0.2184643682), COEF_CONST(0.2064579524), COEF_CONST(0.1876265439), COEF_CONST(0.1375744167), COEF_CONST(0.0856896681), COEF_CONST(0.0117817338), COEF_CONST(0.0117817338), COEF_CONST(0.0117817338) }, - { COEF_CONST(0.3015113269), COEF_CONST(0.2870525790), COEF_CONST(0.2637738799), COEF_CONST(0.1984573949), COEF_CONST(0.1260749909), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126) }, - { COEF_CONST(0.3698741335), COEF_CONST(0.3547727297), COEF_CONST(0.3298252076), COEF_CONST(0.2556265829), COEF_CONST(0.1665990017), COEF_CONST(0.0236344541), COEF_CONST(0.0236344541), COEF_CONST(0.0236344541) }, - { COEF_CONST(0.4480623975), COEF_CONST(0.4339410024), COEF_CONST(0.4098613774), COEF_CONST(0.3322709108), COEF_CONST(0.2266784729), COEF_CONST(0.0334094131), COEF_CONST(0.0334094131), COEF_CONST(0.0334094131) }, - { COEF_CONST(0.5336171261), COEF_CONST(0.5226637762), COEF_CONST(0.5033652606), COEF_CONST(0.4349162672), COEF_CONST(0.3224682122), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036) }, - { COEF_CONST(0.6219832023), COEF_CONST(0.6161847276), COEF_CONST(0.6057251063), COEF_CONST(0.5654342668), COEF_CONST(0.4826149915), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758) }, - { COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657) }, - { COEF_CONST(0.7830305572), COEF_CONST(0.7876016373), COEF_CONST(0.7956739618), COEF_CONST(0.8247933372), COEF_CONST(0.8758325942), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542) }, - { COEF_CONST(0.8457261833), COEF_CONST(0.8525388778), COEF_CONST(0.8640737401), COEF_CONST(0.9004708933), COEF_CONST(0.9465802987), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532) }, - { COEF_CONST(0.8940022267), COEF_CONST(0.9009412572), COEF_CONST(0.9121477564), COEF_CONST(0.9431839770), COEF_CONST(0.9739696219), COEF_CONST(0.9994417480), COEF_CONST(0.9994417480), COEF_CONST(0.9994417480) }, - { COEF_CONST(0.9290818561), COEF_CONST(0.9349525662), COEF_CONST(0.9440420138), COEF_CONST(0.9667755833), COEF_CONST(0.9860247275), COEF_CONST(0.9997206664), COEF_CONST(0.9997206664), COEF_CONST(0.9997206664) }, - { COEF_CONST(0.9534625907), COEF_CONST(0.9579148236), COEF_CONST(0.9645845234), COEF_CONST(0.9801095128), COEF_CONST(0.9920207064), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099) }, - { COEF_CONST(0.9758449068), COEF_CONST(0.9784554646), COEF_CONST(0.9822404252), COEF_CONST(0.9904914275), COEF_CONST(0.9963218730), COEF_CONST(0.9999305926), COEF_CONST(0.9999305926), COEF_CONST(0.9999305926) }, - { COEF_CONST(0.9876723320), COEF_CONST(0.9890880155), COEF_CONST(0.9911036356), COEF_CONST(0.9953496173), COEF_CONST(0.9982312259), COEF_CONST(0.9999669685), COEF_CONST(0.9999669685), COEF_CONST(0.9999669685) }, - { COEF_CONST(0.9937641889), COEF_CONST(0.9945023501), COEF_CONST(0.9955433130), COEF_CONST(0.9976981117), COEF_CONST(0.9991315558), COEF_CONST(0.9999838610), COEF_CONST(0.9999838610), COEF_CONST(0.9999838610) }, - { COEF_CONST(0.9968600642), COEF_CONST(0.9972374385), COEF_CONST(0.9977670024), COEF_CONST(0.9988535464), COEF_CONST(0.9995691924), COEF_CONST(0.9999920129), COEF_CONST(0.9999920129), COEF_CONST(0.9999920129) }, - { COEF_CONST(0.9984226014), COEF_CONST(0.9986136287), COEF_CONST(0.9988810254), COEF_CONST(0.9994272242), COEF_CONST(0.9997851906), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221) }, - { COEF_CONST(0.9995003746), COEF_CONST(0.9995611974), COEF_CONST(0.9996461891), COEF_CONST(0.9998192657), COEF_CONST(0.9999323103), COEF_CONST(0.9999987475), COEF_CONST(0.9999987475), COEF_CONST(0.9999987475) }, - { COEF_CONST(0.9998419236), COEF_CONST(0.9998611991), COEF_CONST(0.9998881193), COEF_CONST(0.9999428861), COEF_CONST(0.9999786185), COEF_CONST(0.9999996045), COEF_CONST(0.9999996045), COEF_CONST(0.9999996045) }, - { COEF_CONST(0.9999500038), COEF_CONST(0.9999561034), COEF_CONST(0.9999646206), COEF_CONST(0.9999819429), COEF_CONST(0.9999932409), COEF_CONST(0.9999998750), COEF_CONST(0.9999998750), COEF_CONST(0.9999998750) }, - { COEF_CONST(0.9999841890), COEF_CONST(0.9999861183), COEF_CONST(0.9999888121), COEF_CONST(0.9999942902), COEF_CONST(0.9999978628), COEF_CONST(0.9999999605), COEF_CONST(0.9999999605), COEF_CONST(0.9999999605) }, - { COEF_CONST(0.9999950000), COEF_CONST(0.9999956102), COEF_CONST(0.9999964621), COEF_CONST(0.9999981945), COEF_CONST(0.9999993242), COEF_CONST(0.9999999875), COEF_CONST(0.9999999875), COEF_CONST(0.9999999875) } -}; - -static const real_t cos_gammas_normal[][8] = { - { COEF_CONST(1.0000000000), COEF_CONST(0.9841239707), COEF_CONST(0.9594738226), COEF_CONST(0.8946843024), COEF_CONST(0.8269341029), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9849690570), COEF_CONST(0.9617776789), COEF_CONST(0.9020941550), COEF_CONST(0.8436830391), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9871656089), COEF_CONST(0.9676774734), COEF_CONST(0.9199102884), COEF_CONST(0.8785067015), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9913533967), COEF_CONST(0.9786000177), COEF_CONST(0.9496063381), COEF_CONST(0.9277157252), COEF_CONST(0.9133354077), COEF_CONST(0.9133354077), COEF_CONST(0.9133354077) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9948924435), COEF_CONST(0.9875319180), COEF_CONST(0.9716329849), COEF_CONST(0.9604805241), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9977406278), COEF_CONST(0.9945423840), COEF_CONST(0.9878736667), COEF_CONST(0.9833980494), COEF_CONST(0.9807207440), COEF_CONST(0.9807207440), COEF_CONST(0.9807207440) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9990607067), COEF_CONST(0.9977417734), COEF_CONST(0.9950323970), COEF_CONST(0.9932453273), COEF_CONST(0.9921884740), COEF_CONST(0.9921884740), COEF_CONST(0.9921884740) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9998081748), COEF_CONST(0.9995400312), COEF_CONST(0.9989936459), COEF_CONST(0.9986365356), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591) } -}; - -static const real_t cos_gammas_fine[][8] = { - { COEF_CONST(1.0000000000), COEF_CONST(0.9841239707), COEF_CONST(0.9594738226), COEF_CONST(0.8946843024), COEF_CONST(0.8269341029), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9849690570), COEF_CONST(0.9617776789), COEF_CONST(0.9020941550), COEF_CONST(0.8436830391), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9871656089), COEF_CONST(0.9676774734), COEF_CONST(0.9199102884), COEF_CONST(0.8785067015), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9899597309), COEF_CONST(0.9750098690), COEF_CONST(0.9402333855), COEF_CONST(0.9129698759), COEF_CONST(0.8943765944), COEF_CONST(0.8943765944), COEF_CONST(0.8943765944) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9926607607), COEF_CONST(0.9819295710), COEF_CONST(0.9580160104), COEF_CONST(0.9404993670), COEF_CONST(0.9293004472), COEF_CONST(0.9293004472), COEF_CONST(0.9293004472) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9948924435), COEF_CONST(0.9875319180), COEF_CONST(0.9716329849), COEF_CONST(0.9604805241), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9972074644), COEF_CONST(0.9932414270), COEF_CONST(0.9849197629), COEF_CONST(0.9792926592), COEF_CONST(0.9759092525), COEF_CONST(0.9759092525), COEF_CONST(0.9759092525) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9985361982), COEF_CONST(0.9964742028), COEF_CONST(0.9922136306), COEF_CONST(0.9893845420), COEF_CONST(0.9877041371), COEF_CONST(0.9877041371), COEF_CONST(0.9877041371) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9992494366), COEF_CONST(0.9981967170), COEF_CONST(0.9960386625), COEF_CONST(0.9946185834), COEF_CONST(0.9937800239), COEF_CONST(0.9937800239), COEF_CONST(0.9937800239) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9996194722), COEF_CONST(0.9990869422), COEF_CONST(0.9979996269), COEF_CONST(0.9972873651), COEF_CONST(0.9968679747), COEF_CONST(0.9968679747), COEF_CONST(0.9968679747) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9998081748), COEF_CONST(0.9995400312), COEF_CONST(0.9989936459), COEF_CONST(0.9986365356), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9999390971), COEF_CONST(0.9998540271), COEF_CONST(0.9996809352), COEF_CONST(0.9995679735), COEF_CONST(0.9995016284), COEF_CONST(0.9995016284), COEF_CONST(0.9995016284) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9999807170), COEF_CONST(0.9999537862), COEF_CONST(0.9998990191), COEF_CONST(0.9998632947), COEF_CONST(0.9998423208), COEF_CONST(0.9998423208), COEF_CONST(0.9998423208) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9999938979), COEF_CONST(0.9999853814), COEF_CONST(0.9999680568), COEF_CONST(0.9999567596), COEF_CONST(0.9999501270), COEF_CONST(0.9999501270), COEF_CONST(0.9999501270) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9999980703), COEF_CONST(0.9999953731), COEF_CONST(0.9999898968), COEF_CONST(0.9999863277), COEF_CONST(0.9999842265), COEF_CONST(0.9999842265), COEF_CONST(0.9999842265) }, - { COEF_CONST(1.0000000000), COEF_CONST(0.9999993891), COEF_CONST(0.9999985397), COEF_CONST(0.9999968037), COEF_CONST(0.9999956786), COEF_CONST(0.9999950155), COEF_CONST(0.9999950155), COEF_CONST(0.9999950155) } -}; - -static const real_t sin_gammas_normal[][8] = { - { COEF_CONST(0.0000000000), COEF_CONST(0.1774824223), COEF_CONST(0.2817977711), COEF_CONST(0.4466990028), COEF_CONST(0.5622988435), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.1727308798), COEF_CONST(0.2738315110), COEF_CONST(0.4315392630), COEF_CONST(0.5368416242), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.1596999079), COEF_CONST(0.2521910140), COEF_CONST(0.3921288836), COEF_CONST(0.4777300236), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.1312190642), COEF_CONST(0.2057717310), COEF_CONST(0.3134450552), COEF_CONST(0.3732874674), COEF_CONST(0.4072080955), COEF_CONST(0.4072080955), COEF_CONST(0.4072080955) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.1009407043), COEF_CONST(0.1574189028), COEF_CONST(0.2364938532), COEF_CONST(0.2783471983), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.0671836269), COEF_CONST(0.1043333428), COEF_CONST(0.1552598422), COEF_CONST(0.1814615013), COEF_CONST(0.1954144885), COEF_CONST(0.1954144885), COEF_CONST(0.1954144885) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.0433324862), COEF_CONST(0.0671666110), COEF_CONST(0.0995516398), COEF_CONST(0.1160332699), COEF_CONST(0.1247478739), COEF_CONST(0.1247478739), COEF_CONST(0.1247478739) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.0195860576), COEF_CONST(0.0303269852), COEF_CONST(0.0448519274), COEF_CONST(0.0522022017), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040) } -}; - -static const real_t sin_gammas_fine[][8] = { - { COEF_CONST(0.0000000000), COEF_CONST(0.1774824223), COEF_CONST(0.2817977711), COEF_CONST(0.4466990028), COEF_CONST(0.5622988435), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.1727308798), COEF_CONST(0.2738315110), COEF_CONST(0.4315392630), COEF_CONST(0.5368416242), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.1596999079), COEF_CONST(0.2521910140), COEF_CONST(0.3921288836), COEF_CONST(0.4777300236), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.1413496768), COEF_CONST(0.2221615526), COEF_CONST(0.3405307340), COEF_CONST(0.4080269669), COEF_CONST(0.4473147744), COEF_CONST(0.4473147744), COEF_CONST(0.4473147744) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.1209322714), COEF_CONST(0.1892467110), COEF_CONST(0.2867147079), COEF_CONST(0.3397954394), COEF_CONST(0.3693246252), COEF_CONST(0.3693246252), COEF_CONST(0.3693246252) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.1009407043), COEF_CONST(0.1574189028), COEF_CONST(0.2364938532), COEF_CONST(0.2783471983), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.0746811420), COEF_CONST(0.1160666523), COEF_CONST(0.1730117353), COEF_CONST(0.2024497161), COEF_CONST(0.2181768341), COEF_CONST(0.2181768341), COEF_CONST(0.2181768341) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.0540875291), COEF_CONST(0.0838997203), COEF_CONST(0.1245476266), COEF_CONST(0.1453211203), COEF_CONST(0.1563346972), COEF_CONST(0.1563346972), COEF_CONST(0.1563346972) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.0387371058), COEF_CONST(0.0600276114), COEF_CONST(0.0889212171), COEF_CONST(0.1036044086), COEF_CONST(0.1113609634), COEF_CONST(0.1113609634), COEF_CONST(0.1113609634) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.0275846110), COEF_CONST(0.0427233177), COEF_CONST(0.0632198125), COEF_CONST(0.0736064637), COEF_CONST(0.0790837596), COEF_CONST(0.0790837596), COEF_CONST(0.0790837596) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.0195860576), COEF_CONST(0.0303269852), COEF_CONST(0.0448519274), COEF_CONST(0.0522022017), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.0110363955), COEF_CONST(0.0170857974), COEF_CONST(0.0252592108), COEF_CONST(0.0293916021), COEF_CONST(0.0315673054), COEF_CONST(0.0315673054), COEF_CONST(0.0315673054) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.0062101284), COEF_CONST(0.0096138203), COEF_CONST(0.0142109649), COEF_CONST(0.0165345659), COEF_CONST(0.0177576316), COEF_CONST(0.0177576316), COEF_CONST(0.0177576316) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.0034934509), COEF_CONST(0.0054071189), COEF_CONST(0.0079928316), COEF_CONST(0.0092994041), COEF_CONST(0.0099871631), COEF_CONST(0.0099871631), COEF_CONST(0.0099871631) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.0019645397), COEF_CONST(0.0030419905), COEF_CONST(0.0044951511), COEF_CONST(0.0052291853), COEF_CONST(0.0056166498), COEF_CONST(0.0056166498), COEF_CONST(0.0056166498) }, - { COEF_CONST(0.0000000000), COEF_CONST(0.0011053943), COEF_CONST(0.0017089869), COEF_CONST(0.0025283670), COEF_CONST(0.0029398552), COEF_CONST(0.0031573685), COEF_CONST(0.0031573685), COEF_CONST(0.0031573685) } -}; - -static const real_t sf_iid_normal[] = { - COEF_CONST(1.4119827747), COEF_CONST(1.4031381607), COEF_CONST(1.3868767023), - COEF_CONST(1.3483997583), COEF_CONST(1.2912493944), COEF_CONST(1.1960374117), - COEF_CONST(1.1073724031), COEF_CONST(1.0000000000), COEF_CONST(0.8796171546), - COEF_CONST(0.7546485662), COEF_CONST(0.5767799020), COEF_CONST(0.4264014363), - COEF_CONST(0.2767182887), COEF_CONST(0.1766446233), COEF_CONST(0.0794016272) -}; - -static const real_t sf_iid_fine[] = { - COEF_CONST(1.4142065048), COEF_CONST(1.4141912460), COEF_CONST(1.4141428471), - COEF_CONST(1.4139900208), COEF_CONST(1.4135069847), COEF_CONST(1.4119827747), - COEF_CONST(1.4097729921), COEF_CONST(1.4053947926), COEF_CONST(1.3967796564), - COEF_CONST(1.3800530434), COEF_CONST(1.3483997583), COEF_CONST(1.3139201403), - COEF_CONST(1.2643101215), COEF_CONST(1.1960374117), COEF_CONST(1.1073724031), - COEF_CONST(1.0000000000), COEF_CONST(0.8796171546), COEF_CONST(0.7546485662), - COEF_CONST(0.6336560845), COEF_CONST(0.5230810642), COEF_CONST(0.4264014363), - COEF_CONST(0.3089554012), COEF_CONST(0.2213746458), COEF_CONST(0.1576878875), - COEF_CONST(0.1119822487), COEF_CONST(0.0794016272), COEF_CONST(0.0446990170), - COEF_CONST(0.0251446925), COEF_CONST(0.0141414283), COEF_CONST(0.0079525812), - COEF_CONST(0.0044721137) -}; - -#ifdef __cplusplus - -#endif -#endif - diff --git a/mplayer/libfaad2/pulse.c b/mplayer/libfaad2/pulse.c deleted file mode 100644 index 386386b6..00000000 --- a/mplayer/libfaad2/pulse.c +++ /dev/null @@ -1,56 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: pulse.c,v 1.17 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#include "syntax.h" -#include "pulse.h" - -uint8_t pulse_decode(ic_stream *ics, int16_t *spec_data, uint16_t framelen) -{ - uint8_t i; - uint16_t k; - pulse_info *pul = &(ics->pul); - - k = ics->swb_offset[pul->pulse_start_sfb]; - - for (i = 0; i <= pul->number_pulse; i++) - { - k += pul->pulse_offset[i]; - - if (k >= framelen) - return 15; /* should not be possible */ - - if (spec_data[k] > 0) - spec_data[k] += pul->pulse_amp[i]; - else - spec_data[k] -= pul->pulse_amp[i]; - } - - return 0; -} diff --git a/mplayer/libfaad2/pulse.h b/mplayer/libfaad2/pulse.h deleted file mode 100644 index 9bc97608..00000000 --- a/mplayer/libfaad2/pulse.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: pulse.h,v 1.16 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __PULSE_H__ -#define __PULSE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -uint8_t pulse_decode(ic_stream *ics, int16_t *spec_coef, uint16_t framelen); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/rvlc.c b/mplayer/libfaad2/rvlc.c deleted file mode 100644 index 23d218bc..00000000 --- a/mplayer/libfaad2/rvlc.c +++ /dev/null @@ -1,530 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: rvlc.c,v 1.17 2004/09/04 14:56:28 menno Exp $ -**/ - -/* RVLC scalefactor decoding - * - * RVLC works like this: - * 1. Only symmetric huffman codewords are used - * 2. Total length of the scalefactor data is stored in the bitsream - * 3. Scalefactors are DPCM coded - * 4. Next to the starting value for DPCM the ending value is also stored - * - * With all this it is possible to read the scalefactor data from 2 sides. - * If there is a bit error in the scalefactor data it is possible to start - * decoding from the other end of the data, to find all but 1 scalefactor. - */ - -#include "common.h" -#include "structs.h" - -#include - -#include "syntax.h" -#include "bits.h" -#include "rvlc.h" - - -#ifdef ERROR_RESILIENCE - -//#define PRINT_RVLC - -/* static function declarations */ -static uint8_t rvlc_decode_sf_forward(ic_stream *ics, - bitfile *ld_sf, - bitfile *ld_esc, - uint8_t *is_used); -#if 0 -static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, - bitfile *ld_sf, - bitfile *ld_esc, - uint8_t is_used); -#endif -static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc, - int8_t direction); -static int8_t rvlc_huffman_esc(bitfile *ld_esc, int8_t direction); - - -uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld) -{ - uint8_t bits = 9; - - ics->sf_concealment = faad_get1bit(ld - DEBUGVAR(1,149,"rvlc_scale_factor_data(): sf_concealment")); - ics->rev_global_gain = (uint8_t)faad_getbits(ld, 8 - DEBUGVAR(1,150,"rvlc_scale_factor_data(): rev_global_gain")); - - if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) - bits = 11; - - /* the number of bits used for the huffman codewords */ - ics->length_of_rvlc_sf = (uint16_t)faad_getbits(ld, bits - DEBUGVAR(1,151,"rvlc_scale_factor_data(): length_of_rvlc_sf")); - - if (ics->noise_used) - { - ics->dpcm_noise_nrg = (uint16_t)faad_getbits(ld, 9 - DEBUGVAR(1,152,"rvlc_scale_factor_data(): dpcm_noise_nrg")); - - ics->length_of_rvlc_sf -= 9; - } - - ics->sf_escapes_present = faad_get1bit(ld - DEBUGVAR(1,153,"rvlc_scale_factor_data(): sf_escapes_present")); - - if (ics->sf_escapes_present) - { - ics->length_of_rvlc_escapes = (uint8_t)faad_getbits(ld, 8 - DEBUGVAR(1,154,"rvlc_scale_factor_data(): length_of_rvlc_escapes")); - } - - if (ics->noise_used) - { - ics->dpcm_noise_last_position = (uint16_t)faad_getbits(ld, 9 - DEBUGVAR(1,155,"rvlc_scale_factor_data(): dpcm_noise_last_position")); - } - - return 0; -} - -uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld) -{ - uint8_t result; - uint8_t intensity_used = 0; - uint8_t *rvlc_sf_buffer = NULL; - uint8_t *rvlc_esc_buffer = NULL; - bitfile ld_rvlc_sf, ld_rvlc_esc; -// bitfile ld_rvlc_sf_rev, ld_rvlc_esc_rev; - - if (ics->length_of_rvlc_sf > 0) - { - /* We read length_of_rvlc_sf bits here to put it in a - seperate bitfile. - */ - rvlc_sf_buffer = faad_getbitbuffer(ld, ics->length_of_rvlc_sf - DEBUGVAR(1,156,"rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_sf")); - - faad_initbits(&ld_rvlc_sf, (void*)rvlc_sf_buffer, bit2byte(ics->length_of_rvlc_sf)); -// faad_initbits_rev(&ld_rvlc_sf_rev, (void*)rvlc_sf_buffer, -// ics->length_of_rvlc_sf); - } - - if (ics->sf_escapes_present) - { - /* We read length_of_rvlc_escapes bits here to put it in a - seperate bitfile. - */ - rvlc_esc_buffer = faad_getbitbuffer(ld, ics->length_of_rvlc_escapes - DEBUGVAR(1,157,"rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_escapes")); - - faad_initbits(&ld_rvlc_esc, (void*)rvlc_esc_buffer, bit2byte(ics->length_of_rvlc_escapes)); -// faad_initbits_rev(&ld_rvlc_esc_rev, (void*)rvlc_esc_buffer, -// ics->length_of_rvlc_escapes); - } - - /* decode the rvlc scale factors and escapes */ - result = rvlc_decode_sf_forward(ics, &ld_rvlc_sf, - &ld_rvlc_esc, &intensity_used); -// result = rvlc_decode_sf_reverse(ics, &ld_rvlc_sf_rev, -// &ld_rvlc_esc_rev, intensity_used); - - - if (rvlc_esc_buffer) faad_free(rvlc_esc_buffer); - if (rvlc_sf_buffer) faad_free(rvlc_sf_buffer); - - if (ics->length_of_rvlc_sf > 0) - faad_endbits(&ld_rvlc_sf); - if (ics->sf_escapes_present) - faad_endbits(&ld_rvlc_esc); - - return result; -} - -static uint8_t rvlc_decode_sf_forward(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc, - uint8_t *intensity_used) -{ - int8_t g, sfb; - int8_t t = 0; - int8_t error = 0; - int8_t noise_pcm_flag = 1; - - int16_t scale_factor = ics->global_gain; - int16_t is_position = 0; - int16_t noise_energy = ics->global_gain - 90 - 256; - -#ifdef PRINT_RVLC - printf("\nglobal_gain: %d\n", ics->global_gain); -#endif - - for (g = 0; g < ics->num_window_groups; g++) - { - for (sfb = 0; sfb < ics->max_sfb; sfb++) - { - if (error) - { - ics->scale_factors[g][sfb] = 0; - } else { - switch (ics->sfb_cb[g][sfb]) - { - case ZERO_HCB: /* zero book */ - ics->scale_factors[g][sfb] = 0; - break; - case INTENSITY_HCB: /* intensity books */ - case INTENSITY_HCB2: - - *intensity_used = 1; - - /* decode intensity position */ - t = rvlc_huffman_sf(ld_sf, ld_esc, +1); - - is_position += t; - ics->scale_factors[g][sfb] = is_position; - - break; - case NOISE_HCB: /* noise books */ - - /* decode noise energy */ - if (noise_pcm_flag) - { - int16_t n = ics->dpcm_noise_nrg; - noise_pcm_flag = 0; - noise_energy += n; - } else { - t = rvlc_huffman_sf(ld_sf, ld_esc, +1); - noise_energy += t; - } - - ics->scale_factors[g][sfb] = noise_energy; - - break; - default: /* spectral books */ - - /* decode scale factor */ - t = rvlc_huffman_sf(ld_sf, ld_esc, +1); - - scale_factor += t; - if (scale_factor < 0) - return 4; - - ics->scale_factors[g][sfb] = scale_factor; - - break; - } -#ifdef PRINT_RVLC - printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb], - ics->scale_factors[g][sfb]); -#endif - if (t == 99) - { - error = 1; - } - } - } - } -#ifdef PRINT_RVLC - printf("\n\n"); -#endif - - return 0; -} - -#if 0 // not used right now, doesn't work correctly yet -static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc, - uint8_t intensity_used) -{ - int8_t g, sfb; - int8_t t = 0; - int8_t error = 0; - int8_t noise_pcm_flag = 1, is_pcm_flag = 1, sf_pcm_flag = 1; - - int16_t scale_factor = ics->rev_global_gain; - int16_t is_position = 0; - int16_t noise_energy = ics->rev_global_gain; - -#ifdef PRINT_RVLC - printf("\nrev_global_gain: %d\n", ics->rev_global_gain); -#endif - - if (intensity_used) - { - is_position = rvlc_huffman_sf(ld_sf, ld_esc, -1); -#ifdef PRINT_RVLC - printf("is_position: %d\n", is_position); -#endif - } - - for (g = ics->num_window_groups-1; g >= 0; g--) - { - for (sfb = ics->max_sfb-1; sfb >= 0; sfb--) - { - if (error) - { - ics->scale_factors[g][sfb] = 0; - } else { - switch (ics->sfb_cb[g][sfb]) - { - case ZERO_HCB: /* zero book */ - ics->scale_factors[g][sfb] = 0; - break; - case INTENSITY_HCB: /* intensity books */ - case INTENSITY_HCB2: - - if (is_pcm_flag) - { - is_pcm_flag = 0; - ics->scale_factors[g][sfb] = is_position; - } else { - t = rvlc_huffman_sf(ld_sf, ld_esc, -1); - is_position -= t; - - ics->scale_factors[g][sfb] = (uint8_t)is_position; - } - break; - case NOISE_HCB: /* noise books */ - - /* decode noise energy */ - if (noise_pcm_flag) - { - noise_pcm_flag = 0; - noise_energy = ics->dpcm_noise_last_position; - } else { - t = rvlc_huffman_sf(ld_sf, ld_esc, -1); - noise_energy -= t; - } - - ics->scale_factors[g][sfb] = (uint8_t)noise_energy; - break; - default: /* spectral books */ - - if (sf_pcm_flag || (sfb == 0)) - { - sf_pcm_flag = 0; - if (sfb == 0) - scale_factor = ics->global_gain; - } else { - /* decode scale factor */ - t = rvlc_huffman_sf(ld_sf, ld_esc, -1); - scale_factor -= t; - } - - if (scale_factor < 0) - return 4; - - ics->scale_factors[g][sfb] = (uint8_t)scale_factor; - break; - } -#ifdef PRINT_RVLC - printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb], - ics->scale_factors[g][sfb]); -#endif - if (t == 99) - { - error = 1; - } - } - } - } - -#ifdef PRINT_RVLC - printf("\n\n"); -#endif - - return 0; -} -#endif - -/* index == 99 means not allowed codeword */ -static rvlc_huff_table book_rvlc[] = { - /*index length codeword */ - { 0, 1, 0 }, /* 0 */ - { -1, 3, 5 }, /* 101 */ - { 1, 3, 7 }, /* 111 */ - { -2, 4, 9 }, /* 1001 */ - { -3, 5, 17 }, /* 10001 */ - { 2, 5, 27 }, /* 11011 */ - { -4, 6, 33 }, /* 100001 */ - { 99, 6, 50 }, /* 110010 */ - { 3, 6, 51 }, /* 110011 */ - { 99, 6, 52 }, /* 110100 */ - { -7, 7, 65 }, /* 1000001 */ - { 99, 7, 96 }, /* 1100000 */ - { 99, 7, 98 }, /* 1100010 */ - { 7, 7, 99 }, /* 1100011 */ - { 4, 7, 107 }, /* 1101011 */ - { -5, 8, 129 }, /* 10000001 */ - { 99, 8, 194 }, /* 11000010 */ - { 5, 8, 195 }, /* 11000011 */ - { 99, 8, 212 }, /* 11010100 */ - { 99, 9, 256 }, /* 100000000 */ - { -6, 9, 257 }, /* 100000001 */ - { 99, 9, 426 }, /* 110101010 */ - { 6, 9, 427 }, /* 110101011 */ - { 99, 10, 0 } /* Shouldn't come this far */ -}; - -static rvlc_huff_table book_escape[] = { - /*index length codeword */ - { 1, 2, 0 }, - { 0, 2, 2 }, - { 3, 3, 2 }, - { 2, 3, 6 }, - { 4, 4, 14 }, - { 7, 5, 13 }, - { 6, 5, 15 }, - { 5, 5, 31 }, - { 11, 6, 24 }, - { 10, 6, 25 }, - { 9, 6, 29 }, - { 8, 6, 61 }, - { 13, 7, 56 }, - { 12, 7, 120 }, - { 15, 8, 114 }, - { 14, 8, 242 }, - { 17, 9, 230 }, - { 16, 9, 486 }, - { 19, 10, 463 }, - { 18, 10, 974 }, - { 22, 11, 925 }, - { 20, 11, 1950 }, - { 21, 11, 1951 }, - { 23, 12, 1848 }, - { 25, 13, 3698 }, - { 24, 14, 7399 }, - { 26, 15, 14797 }, - { 49, 19, 236736 }, - { 50, 19, 236737 }, - { 51, 19, 236738 }, - { 52, 19, 236739 }, - { 53, 19, 236740 }, - { 27, 20, 473482 }, - { 28, 20, 473483 }, - { 29, 20, 473484 }, - { 30, 20, 473485 }, - { 31, 20, 473486 }, - { 32, 20, 473487 }, - { 33, 20, 473488 }, - { 34, 20, 473489 }, - { 35, 20, 473490 }, - { 36, 20, 473491 }, - { 37, 20, 473492 }, - { 38, 20, 473493 }, - { 39, 20, 473494 }, - { 40, 20, 473495 }, - { 41, 20, 473496 }, - { 42, 20, 473497 }, - { 43, 20, 473498 }, - { 44, 20, 473499 }, - { 45, 20, 473500 }, - { 46, 20, 473501 }, - { 47, 20, 473502 }, - { 48, 20, 473503 }, - { 99, 21, 0 } /* Shouldn't come this far */ -}; - -static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc, - int8_t direction) -{ - uint8_t i, j; - int8_t index; - uint32_t cw; - rvlc_huff_table *h = book_rvlc; - - i = h->len; - if (direction > 0) - cw = faad_getbits(ld_sf, i DEBUGVAR(1,0,"")); - else - cw = faad_getbits_rev(ld_sf, i DEBUGVAR(1,0,"")); - - while ((cw != h->cw) - && (i < 10)) - { - h++; - j = h->len-i; - i += j; - cw <<= j; - if (direction > 0) - cw |= faad_getbits(ld_sf, j DEBUGVAR(1,0,"")); - else - cw |= faad_getbits_rev(ld_sf, j DEBUGVAR(1,0,"")); - } - - index = h->index; - - if (index == +ESC_VAL) - { - int8_t esc = rvlc_huffman_esc(ld_esc, direction); - if (esc == 99) - return 99; - index += esc; -#ifdef PRINT_RVLC - printf("esc: %d - ", esc); -#endif - } - if (index == -ESC_VAL) - { - int8_t esc = rvlc_huffman_esc(ld_esc, direction); - if (esc == 99) - return 99; - index -= esc; -#ifdef PRINT_RVLC - printf("esc: %d - ", esc); -#endif - } - - return index; -} - -static int8_t rvlc_huffman_esc(bitfile *ld, - int8_t direction) -{ - uint8_t i, j; - uint32_t cw; - rvlc_huff_table *h = book_escape; - - i = h->len; - if (direction > 0) - cw = faad_getbits(ld, i DEBUGVAR(1,0,"")); - else - cw = faad_getbits_rev(ld, i DEBUGVAR(1,0,"")); - - while ((cw != h->cw) - && (i < 21)) - { - h++; - j = h->len-i; - i += j; - cw <<= j; - if (direction > 0) - cw |= faad_getbits(ld, j DEBUGVAR(1,0,"")); - else - cw |= faad_getbits_rev(ld, j DEBUGVAR(1,0,"")); - } - - return h->index; -} - -#endif - diff --git a/mplayer/libfaad2/rvlc.h b/mplayer/libfaad2/rvlc.h deleted file mode 100644 index 6bdc5788..00000000 --- a/mplayer/libfaad2/rvlc.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: rvlc.h,v 1.13 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __RVLC_SCF_H__ -#define __RVLC_SCF_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct -{ - int8_t index; - uint8_t len; - uint32_t cw; -} rvlc_huff_table; - - -#define ESC_VAL 7 - - -uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld); -uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/sbr_dct.c b/mplayer/libfaad2/sbr_dct.c deleted file mode 100644 index 67f0c1c5..00000000 --- a/mplayer/libfaad2/sbr_dct.c +++ /dev/null @@ -1,2271 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_dct.c,v 1.15 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" - -#ifdef SBR_DEC - -#ifdef _MSC_VER -#pragma warning(disable:4305) -#pragma warning(disable:4244) -#endif - - -#include "sbr_dct.h" - -void DCT4_32(real_t *y, real_t *x) -{ - real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; - real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; - real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30; - real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40; - real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50; - real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60; - real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70; - real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80; - real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90; - real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100; - real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110; - real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120; - real_t f121, f122, f123, f124, f125, f126, f127, f128, f129, f130; - real_t f131, f132, f133, f134, f135, f136, f137, f138, f139, f140; - real_t f141, f142, f143, f144, f145, f146, f147, f148, f149, f150; - real_t f151, f152, f153, f154, f155, f156, f157, f158, f159, f160; - real_t f161, f162, f163, f164, f165, f166, f167, f168, f169, f170; - real_t f171, f172, f173, f174, f175, f176, f177, f178, f179, f180; - real_t f181, f182, f183, f184, f185, f186, f187, f188, f189, f190; - real_t f191, f192, f193, f194, f195, f196, f197, f198, f199, f200; - real_t f201, f202, f203, f204, f205, f206, f207, f208, f209, f210; - real_t f211, f212, f213, f214, f215, f216, f217, f218, f219, f220; - real_t f221, f222, f223, f224, f225, f226, f227, f228, f229, f230; - real_t f231, f232, f233, f234, f235, f236, f237, f238, f239, f240; - real_t f241, f242, f243, f244, f245, f246, f247, f248, f249, f250; - real_t f251, f252, f253, f254, f255, f256, f257, f258, f259, f260; - real_t f261, f262, f263, f264, f265, f266, f267, f268, f269, f270; - real_t f271, f272, f273, f274, f275, f276, f277, f278, f279, f280; - real_t f281, f282, f283, f284, f285, f286, f287, f288, f289, f290; - real_t f291, f292, f293, f294, f295, f296, f297, f298, f299, f300; - real_t f301, f302, f303, f304, f305, f306, f307, f310, f311, f312; - real_t f313, f316, f317, f318, f319, f322, f323, f324, f325, f328; - real_t f329, f330, f331, f334, f335, f336, f337, f340, f341, f342; - real_t f343, f346, f347, f348, f349, f352, f353, f354, f355, f358; - real_t f359, f360, f361, f364, f365, f366, f367, f370, f371, f372; - real_t f373, f376, f377, f378, f379, f382, f383, f384, f385, f388; - real_t f389, f390, f391, f394, f395, f396, f397; - - f0 = x[15] - x[16]; - f1 = x[15] + x[16]; - f2 = MUL_F(FRAC_CONST(0.7071067811865476), f1); - f3 = MUL_F(FRAC_CONST(0.7071067811865476), f0); - f4 = x[8] - x[23]; - f5 = x[8] + x[23]; - f6 = MUL_F(FRAC_CONST(0.7071067811865476), f5); - f7 = MUL_F(FRAC_CONST(0.7071067811865476), f4); - f8 = x[12] - x[19]; - f9 = x[12] + x[19]; - f10 = MUL_F(FRAC_CONST(0.7071067811865476), f9); - f11 = MUL_F(FRAC_CONST(0.7071067811865476), f8); - f12 = x[11] - x[20]; - f13 = x[11] + x[20]; - f14 = MUL_F(FRAC_CONST(0.7071067811865476), f13); - f15 = MUL_F(FRAC_CONST(0.7071067811865476), f12); - f16 = x[14] - x[17]; - f17 = x[14] + x[17]; - f18 = MUL_F(FRAC_CONST(0.7071067811865476), f17); - f19 = MUL_F(FRAC_CONST(0.7071067811865476), f16); - f20 = x[9] - x[22]; - f21 = x[9] + x[22]; - f22 = MUL_F(FRAC_CONST(0.7071067811865476), f21); - f23 = MUL_F(FRAC_CONST(0.7071067811865476), f20); - f24 = x[13] - x[18]; - f25 = x[13] + x[18]; - f26 = MUL_F(FRAC_CONST(0.7071067811865476), f25); - f27 = MUL_F(FRAC_CONST(0.7071067811865476), f24); - f28 = x[10] - x[21]; - f29 = x[10] + x[21]; - f30 = MUL_F(FRAC_CONST(0.7071067811865476), f29); - f31 = MUL_F(FRAC_CONST(0.7071067811865476), f28); - f32 = x[0] - f2; - f33 = x[0] + f2; - f34 = x[31] - f3; - f35 = x[31] + f3; - f36 = x[7] - f6; - f37 = x[7] + f6; - f38 = x[24] - f7; - f39 = x[24] + f7; - f40 = x[3] - f10; - f41 = x[3] + f10; - f42 = x[28] - f11; - f43 = x[28] + f11; - f44 = x[4] - f14; - f45 = x[4] + f14; - f46 = x[27] - f15; - f47 = x[27] + f15; - f48 = x[1] - f18; - f49 = x[1] + f18; - f50 = x[30] - f19; - f51 = x[30] + f19; - f52 = x[6] - f22; - f53 = x[6] + f22; - f54 = x[25] - f23; - f55 = x[25] + f23; - f56 = x[2] - f26; - f57 = x[2] + f26; - f58 = x[29] - f27; - f59 = x[29] + f27; - f60 = x[5] - f30; - f61 = x[5] + f30; - f62 = x[26] - f31; - f63 = x[26] + f31; - f64 = f39 + f37; - f65 = MUL_F(FRAC_CONST(-0.5411961001461969), f39); - f66 = MUL_F(FRAC_CONST(0.9238795325112867), f64); - f67 = MUL_C(COEF_CONST(1.3065629648763766), f37); - f68 = f65 + f66; - f69 = f67 - f66; - f70 = f38 + f36; - f71 = MUL_C(COEF_CONST(1.3065629648763770), f38); - f72 = MUL_F(FRAC_CONST(-0.3826834323650904), f70); - f73 = MUL_F(FRAC_CONST(0.5411961001461961), f36); - f74 = f71 + f72; - f75 = f73 - f72; - f76 = f47 + f45; - f77 = MUL_F(FRAC_CONST(-0.5411961001461969), f47); - f78 = MUL_F(FRAC_CONST(0.9238795325112867), f76); - f79 = MUL_C(COEF_CONST(1.3065629648763766), f45); - f80 = f77 + f78; - f81 = f79 - f78; - f82 = f46 + f44; - f83 = MUL_C(COEF_CONST(1.3065629648763770), f46); - f84 = MUL_F(FRAC_CONST(-0.3826834323650904), f82); - f85 = MUL_F(FRAC_CONST(0.5411961001461961), f44); - f86 = f83 + f84; - f87 = f85 - f84; - f88 = f55 + f53; - f89 = MUL_F(FRAC_CONST(-0.5411961001461969), f55); - f90 = MUL_F(FRAC_CONST(0.9238795325112867), f88); - f91 = MUL_C(COEF_CONST(1.3065629648763766), f53); - f92 = f89 + f90; - f93 = f91 - f90; - f94 = f54 + f52; - f95 = MUL_C(COEF_CONST(1.3065629648763770), f54); - f96 = MUL_F(FRAC_CONST(-0.3826834323650904), f94); - f97 = MUL_F(FRAC_CONST(0.5411961001461961), f52); - f98 = f95 + f96; - f99 = f97 - f96; - f100 = f63 + f61; - f101 = MUL_F(FRAC_CONST(-0.5411961001461969), f63); - f102 = MUL_F(FRAC_CONST(0.9238795325112867), f100); - f103 = MUL_C(COEF_CONST(1.3065629648763766), f61); - f104 = f101 + f102; - f105 = f103 - f102; - f106 = f62 + f60; - f107 = MUL_C(COEF_CONST(1.3065629648763770), f62); - f108 = MUL_F(FRAC_CONST(-0.3826834323650904), f106); - f109 = MUL_F(FRAC_CONST(0.5411961001461961), f60); - f110 = f107 + f108; - f111 = f109 - f108; - f112 = f33 - f68; - f113 = f33 + f68; - f114 = f35 - f69; - f115 = f35 + f69; - f116 = f32 - f74; - f117 = f32 + f74; - f118 = f34 - f75; - f119 = f34 + f75; - f120 = f41 - f80; - f121 = f41 + f80; - f122 = f43 - f81; - f123 = f43 + f81; - f124 = f40 - f86; - f125 = f40 + f86; - f126 = f42 - f87; - f127 = f42 + f87; - f128 = f49 - f92; - f129 = f49 + f92; - f130 = f51 - f93; - f131 = f51 + f93; - f132 = f48 - f98; - f133 = f48 + f98; - f134 = f50 - f99; - f135 = f50 + f99; - f136 = f57 - f104; - f137 = f57 + f104; - f138 = f59 - f105; - f139 = f59 + f105; - f140 = f56 - f110; - f141 = f56 + f110; - f142 = f58 - f111; - f143 = f58 + f111; - f144 = f123 + f121; - f145 = MUL_F(FRAC_CONST(-0.7856949583871021), f123); - f146 = MUL_F(FRAC_CONST(0.9807852804032304), f144); - f147 = MUL_C(COEF_CONST(1.1758756024193588), f121); - f148 = f145 + f146; - f149 = f147 - f146; - f150 = f127 + f125; - f151 = MUL_F(FRAC_CONST(0.2758993792829431), f127); - f152 = MUL_F(FRAC_CONST(0.5555702330196022), f150); - f153 = MUL_C(COEF_CONST(1.3870398453221475), f125); - f154 = f151 + f152; - f155 = f153 - f152; - f156 = f122 + f120; - f157 = MUL_C(COEF_CONST(1.1758756024193591), f122); - f158 = MUL_F(FRAC_CONST(-0.1950903220161287), f156); - f159 = MUL_F(FRAC_CONST(0.7856949583871016), f120); - f160 = f157 + f158; - f161 = f159 - f158; - f162 = f126 + f124; - f163 = MUL_C(COEF_CONST(1.3870398453221473), f126); - f164 = MUL_F(FRAC_CONST(-0.8314696123025455), f162); - f165 = MUL_F(FRAC_CONST(-0.2758993792829436), f124); - f166 = f163 + f164; - f167 = f165 - f164; - f168 = f139 + f137; - f169 = MUL_F(FRAC_CONST(-0.7856949583871021), f139); - f170 = MUL_F(FRAC_CONST(0.9807852804032304), f168); - f171 = MUL_C(COEF_CONST(1.1758756024193588), f137); - f172 = f169 + f170; - f173 = f171 - f170; - f174 = f143 + f141; - f175 = MUL_F(FRAC_CONST(0.2758993792829431), f143); - f176 = MUL_F(FRAC_CONST(0.5555702330196022), f174); - f177 = MUL_C(COEF_CONST(1.3870398453221475), f141); - f178 = f175 + f176; - f179 = f177 - f176; - f180 = f138 + f136; - f181 = MUL_C(COEF_CONST(1.1758756024193591), f138); - f182 = MUL_F(FRAC_CONST(-0.1950903220161287), f180); - f183 = MUL_F(FRAC_CONST(0.7856949583871016), f136); - f184 = f181 + f182; - f185 = f183 - f182; - f186 = f142 + f140; - f187 = MUL_C(COEF_CONST(1.3870398453221473), f142); - f188 = MUL_F(FRAC_CONST(-0.8314696123025455), f186); - f189 = MUL_F(FRAC_CONST(-0.2758993792829436), f140); - f190 = f187 + f188; - f191 = f189 - f188; - f192 = f113 - f148; - f193 = f113 + f148; - f194 = f115 - f149; - f195 = f115 + f149; - f196 = f117 - f154; - f197 = f117 + f154; - f198 = f119 - f155; - f199 = f119 + f155; - f200 = f112 - f160; - f201 = f112 + f160; - f202 = f114 - f161; - f203 = f114 + f161; - f204 = f116 - f166; - f205 = f116 + f166; - f206 = f118 - f167; - f207 = f118 + f167; - f208 = f129 - f172; - f209 = f129 + f172; - f210 = f131 - f173; - f211 = f131 + f173; - f212 = f133 - f178; - f213 = f133 + f178; - f214 = f135 - f179; - f215 = f135 + f179; - f216 = f128 - f184; - f217 = f128 + f184; - f218 = f130 - f185; - f219 = f130 + f185; - f220 = f132 - f190; - f221 = f132 + f190; - f222 = f134 - f191; - f223 = f134 + f191; - f224 = f211 + f209; - f225 = MUL_F(FRAC_CONST(-0.8971675863426361), f211); - f226 = MUL_F(FRAC_CONST(0.9951847266721968), f224); - f227 = MUL_C(COEF_CONST(1.0932018670017576), f209); - f228 = f225 + f226; - f229 = f227 - f226; - f230 = f215 + f213; - f231 = MUL_F(FRAC_CONST(-0.4105245275223571), f215); - f232 = MUL_F(FRAC_CONST(0.8819212643483549), f230); - f233 = MUL_C(COEF_CONST(1.3533180011743529), f213); - f234 = f231 + f232; - f235 = f233 - f232; - f236 = f219 + f217; - f237 = MUL_F(FRAC_CONST(0.1386171691990915), f219); - f238 = MUL_F(FRAC_CONST(0.6343932841636455), f236); - f239 = MUL_C(COEF_CONST(1.4074037375263826), f217); - f240 = f237 + f238; - f241 = f239 - f238; - f242 = f223 + f221; - f243 = MUL_F(FRAC_CONST(0.6666556584777466), f223); - f244 = MUL_F(FRAC_CONST(0.2902846772544623), f242); - f245 = MUL_C(COEF_CONST(1.2472250129866711), f221); - f246 = f243 + f244; - f247 = f245 - f244; - f248 = f210 + f208; - f249 = MUL_C(COEF_CONST(1.0932018670017574), f210); - f250 = MUL_F(FRAC_CONST(-0.0980171403295605), f248); - f251 = MUL_F(FRAC_CONST(0.8971675863426364), f208); - f252 = f249 + f250; - f253 = f251 - f250; - f254 = f214 + f212; - f255 = MUL_C(COEF_CONST(1.3533180011743529), f214); - f256 = MUL_F(FRAC_CONST(-0.4713967368259979), f254); - f257 = MUL_F(FRAC_CONST(0.4105245275223569), f212); - f258 = f255 + f256; - f259 = f257 - f256; - f260 = f218 + f216; - f261 = MUL_C(COEF_CONST(1.4074037375263826), f218); - f262 = MUL_F(FRAC_CONST(-0.7730104533627369), f260); - f263 = MUL_F(FRAC_CONST(-0.1386171691990913), f216); - f264 = f261 + f262; - f265 = f263 - f262; - f266 = f222 + f220; - f267 = MUL_C(COEF_CONST(1.2472250129866711), f222); - f268 = MUL_F(FRAC_CONST(-0.9569403357322089), f266); - f269 = MUL_F(FRAC_CONST(-0.6666556584777469), f220); - f270 = f267 + f268; - f271 = f269 - f268; - f272 = f193 - f228; - f273 = f193 + f228; - f274 = f195 - f229; - f275 = f195 + f229; - f276 = f197 - f234; - f277 = f197 + f234; - f278 = f199 - f235; - f279 = f199 + f235; - f280 = f201 - f240; - f281 = f201 + f240; - f282 = f203 - f241; - f283 = f203 + f241; - f284 = f205 - f246; - f285 = f205 + f246; - f286 = f207 - f247; - f287 = f207 + f247; - f288 = f192 - f252; - f289 = f192 + f252; - f290 = f194 - f253; - f291 = f194 + f253; - f292 = f196 - f258; - f293 = f196 + f258; - f294 = f198 - f259; - f295 = f198 + f259; - f296 = f200 - f264; - f297 = f200 + f264; - f298 = f202 - f265; - f299 = f202 + f265; - f300 = f204 - f270; - f301 = f204 + f270; - f302 = f206 - f271; - f303 = f206 + f271; - f304 = f275 + f273; - f305 = MUL_F(FRAC_CONST(-0.9751575901732920), f275); - f306 = MUL_F(FRAC_CONST(0.9996988186962043), f304); - f307 = MUL_C(COEF_CONST(1.0242400472191164), f273); - y[0] = f305 + f306; - y[31] = f307 - f306; - f310 = f279 + f277; - f311 = MUL_F(FRAC_CONST(-0.8700688593994936), f279); - f312 = MUL_F(FRAC_CONST(0.9924795345987100), f310); - f313 = MUL_C(COEF_CONST(1.1148902097979263), f277); - y[2] = f311 + f312; - y[29] = f313 - f312; - f316 = f283 + f281; - f317 = MUL_F(FRAC_CONST(-0.7566008898816587), f283); - f318 = MUL_F(FRAC_CONST(0.9757021300385286), f316); - f319 = MUL_C(COEF_CONST(1.1948033701953984), f281); - y[4] = f317 + f318; - y[27] = f319 - f318; - f322 = f287 + f285; - f323 = MUL_F(FRAC_CONST(-0.6358464401941451), f287); - f324 = MUL_F(FRAC_CONST(0.9495281805930367), f322); - f325 = MUL_C(COEF_CONST(1.2632099209919283), f285); - y[6] = f323 + f324; - y[25] = f325 - f324; - f328 = f291 + f289; - f329 = MUL_F(FRAC_CONST(-0.5089684416985408), f291); - f330 = MUL_F(FRAC_CONST(0.9142097557035307), f328); - f331 = MUL_C(COEF_CONST(1.3194510697085207), f289); - y[8] = f329 + f330; - y[23] = f331 - f330; - f334 = f295 + f293; - f335 = MUL_F(FRAC_CONST(-0.3771887988789273), f295); - f336 = MUL_F(FRAC_CONST(0.8700869911087114), f334); - f337 = MUL_C(COEF_CONST(1.3629851833384954), f293); - y[10] = f335 + f336; - y[21] = f337 - f336; - f340 = f299 + f297; - f341 = MUL_F(FRAC_CONST(-0.2417766217337384), f299); - f342 = MUL_F(FRAC_CONST(0.8175848131515837), f340); - f343 = MUL_C(COEF_CONST(1.3933930045694289), f297); - y[12] = f341 + f342; - y[19] = f343 - f342; - f346 = f303 + f301; - f347 = MUL_F(FRAC_CONST(-0.1040360035527077), f303); - f348 = MUL_F(FRAC_CONST(0.7572088465064845), f346); - f349 = MUL_C(COEF_CONST(1.4103816894602612), f301); - y[14] = f347 + f348; - y[17] = f349 - f348; - f352 = f274 + f272; - f353 = MUL_F(FRAC_CONST(0.0347065382144002), f274); - f354 = MUL_F(FRAC_CONST(0.6895405447370668), f352); - f355 = MUL_C(COEF_CONST(1.4137876276885337), f272); - y[16] = f353 + f354; - y[15] = f355 - f354; - f358 = f278 + f276; - f359 = MUL_F(FRAC_CONST(0.1731148370459795), f278); - f360 = MUL_F(FRAC_CONST(0.6152315905806268), f358); - f361 = MUL_C(COEF_CONST(1.4035780182072330), f276); - y[18] = f359 + f360; - y[13] = f361 - f360; - f364 = f282 + f280; - f365 = MUL_F(FRAC_CONST(0.3098559453626100), f282); - f366 = MUL_F(FRAC_CONST(0.5349976198870972), f364); - f367 = MUL_C(COEF_CONST(1.3798511851368043), f280); - y[20] = f365 + f366; - y[11] = f367 - f366; - f370 = f286 + f284; - f371 = MUL_F(FRAC_CONST(0.4436129715409088), f286); - f372 = MUL_F(FRAC_CONST(0.4496113296546065), f370); - f373 = MUL_C(COEF_CONST(1.3428356308501219), f284); - y[22] = f371 + f372; - y[9] = f373 - f372; - f376 = f290 + f288; - f377 = MUL_F(FRAC_CONST(0.5730977622997509), f290); - f378 = MUL_F(FRAC_CONST(0.3598950365349881), f376); - f379 = MUL_C(COEF_CONST(1.2928878353697271), f288); - y[24] = f377 + f378; - y[7] = f379 - f378; - f382 = f294 + f292; - f383 = MUL_F(FRAC_CONST(0.6970633083205415), f294); - f384 = MUL_F(FRAC_CONST(0.2667127574748984), f382); - f385 = MUL_C(COEF_CONST(1.2304888232703382), f292); - y[26] = f383 + f384; - y[5] = f385 - f384; - f388 = f298 + f296; - f389 = MUL_F(FRAC_CONST(0.8143157536286401), f298); - f390 = MUL_F(FRAC_CONST(0.1709618887603012), f388); - f391 = MUL_C(COEF_CONST(1.1562395311492424), f296); - y[28] = f389 + f390; - y[3] = f391 - f390; - f394 = f302 + f300; - f395 = MUL_F(FRAC_CONST(0.9237258930790228), f302); - f396 = MUL_F(FRAC_CONST(0.0735645635996674), f394); - f397 = MUL_C(COEF_CONST(1.0708550202783576), f300); - y[30] = f395 + f396; - y[1] = f397 - f396; -} - -#ifdef SBR_LOW_POWER - -void DCT2_16_unscaled(real_t *y, real_t *x) -{ - real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; - real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; - real_t f21, f22, f23, f24, f25, f26, f27, f28, f31, f32; - real_t f33, f34, f37, f38, f39, f40, f41, f42, f43, f44; - real_t f45, f46, f47, f48, f49, f51, f53, f54, f57, f58; - real_t f59, f60, f61, f62, f63, f64, f65, f66, f67, f68; - real_t f69, f70, f71, f72, f73, f74, f75, f76, f77, f78; - real_t f79, f80, f81, f82, f83, f84, f85, f86, f87, f88; - real_t f89, f90, f91, f92, f95, f96, f97, f98, f101, f102; - real_t f103, f104, f107, f108, f109, f110; - - f0 = x[0] - x[15]; - f1 = x[0] + x[15]; - f2 = x[1] - x[14]; - f3 = x[1] + x[14]; - f4 = x[2] - x[13]; - f5 = x[2] + x[13]; - f6 = x[3] - x[12]; - f7 = x[3] + x[12]; - f8 = x[4] - x[11]; - f9 = x[4] + x[11]; - f10 = x[5] - x[10]; - f11 = x[5] + x[10]; - f12 = x[6] - x[9]; - f13 = x[6] + x[9]; - f14 = x[7] - x[8]; - f15 = x[7] + x[8]; - f16 = f1 - f15; - f17 = f1 + f15; - f18 = f3 - f13; - f19 = f3 + f13; - f20 = f5 - f11; - f21 = f5 + f11; - f22 = f7 - f9; - f23 = f7 + f9; - f24 = f17 - f23; - f25 = f17 + f23; - f26 = f19 - f21; - f27 = f19 + f21; - f28 = f25 - f27; - y[0] = f25 + f27; - y[8] = MUL_F(f28, FRAC_CONST(0.7071067811865476)); - f31 = f24 + f26; - f32 = MUL_C(f24, COEF_CONST(1.3065629648763766)); - f33 = MUL_F(f31, FRAC_CONST(-0.9238795325112866)); - f34 = MUL_F(f26, FRAC_CONST(-0.5411961001461967)); - y[12] = f32 + f33; - y[4] = f34 - f33; - f37 = f16 + f22; - f38 = MUL_C(f16, COEF_CONST(1.1758756024193588)); - f39 = MUL_F(f37, FRAC_CONST(-0.9807852804032304)); - f40 = MUL_F(f22, FRAC_CONST(-0.7856949583871021)); - f41 = f38 + f39; - f42 = f40 - f39; - f43 = f18 + f20; - f44 = MUL_C(f18, COEF_CONST(1.3870398453221473)); - f45 = MUL_F(f43, FRAC_CONST(-0.8314696123025455)); - f46 = MUL_F(f20, FRAC_CONST(-0.2758993792829436)); - f47 = f44 + f45; - f48 = f46 - f45; - f49 = f42 - f48; - y[2] = f42 + f48; - f51 = MUL_F(f49, FRAC_CONST(0.7071067811865476)); - y[14] = f41 - f47; - f53 = f41 + f47; - f54 = MUL_F(f53, FRAC_CONST(0.7071067811865476)); - y[10] = f51 - f54; - y[6] = f51 + f54; - f57 = f2 - f4; - f58 = f2 + f4; - f59 = f6 - f8; - f60 = f6 + f8; - f61 = f10 - f12; - f62 = f10 + f12; - f63 = MUL_F(f60, FRAC_CONST(0.7071067811865476)); - f64 = f0 - f63; - f65 = f0 + f63; - f66 = f58 + f62; - f67 = MUL_C(f58, COEF_CONST(1.3065629648763766)); - f68 = MUL_F(f66, FRAC_CONST(-0.9238795325112866)); - f69 = MUL_F(f62, FRAC_CONST(-0.5411961001461967)); - f70 = f67 + f68; - f71 = f69 - f68; - f72 = f65 - f71; - f73 = f65 + f71; - f74 = f64 - f70; - f75 = f64 + f70; - f76 = MUL_F(f59, FRAC_CONST(0.7071067811865476)); - f77 = f14 - f76; - f78 = f14 + f76; - f79 = f61 + f57; - f80 = MUL_C(f61, COEF_CONST(1.3065629648763766)); - f81 = MUL_F(f79, FRAC_CONST(-0.9238795325112866)); - f82 = MUL_F(f57, FRAC_CONST(-0.5411961001461967)); - f83 = f80 + f81; - f84 = f82 - f81; - f85 = f78 - f84; - f86 = f78 + f84; - f87 = f77 - f83; - f88 = f77 + f83; - f89 = f86 + f73; - f90 = MUL_F(f86, FRAC_CONST(-0.8971675863426361)); - f91 = MUL_F(f89, FRAC_CONST(0.9951847266721968)); - f92 = MUL_C(f73, COEF_CONST(1.0932018670017576)); - y[1] = f90 + f91; - y[15] = f92 - f91; - f95 = f75 - f88; - f96 = MUL_F(f88, FRAC_CONST(-0.6666556584777466)); - f97 = MUL_F(f95, FRAC_CONST(0.9569403357322089)); - f98 = MUL_C(f75, COEF_CONST(1.2472250129866713)); - y[3] = f97 - f96; - y[13] = f98 - f97; - f101 = f87 + f74; - f102 = MUL_F(f87, FRAC_CONST(-0.4105245275223571)); - f103 = MUL_F(f101, FRAC_CONST(0.8819212643483549)); - f104 = MUL_C(f74, COEF_CONST(1.3533180011743529)); - y[5] = f102 + f103; - y[11] = f104 - f103; - f107 = f72 - f85; - f108 = MUL_F(f85, FRAC_CONST(-0.1386171691990915)); - f109 = MUL_F(f107, FRAC_CONST(0.7730104533627370)); - f110 = MUL_C(f72, COEF_CONST(1.4074037375263826)); - y[7] = f109 - f108; - y[9] = f110 - f109; -} - -void DCT4_16(real_t *y, real_t *x) -{ - real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; - real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; - real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30; - real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40; - real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50; - real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60; - real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70; - real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80; - real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90; - real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100; - real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110; - real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120; - real_t f121, f122, f123, f124, f125, f126, f127, f128, f130, f132; - real_t f134, f136, f138, f140, f142, f144, f145, f148, f149, f152; - real_t f153, f156, f157; - - f0 = x[0] + x[15]; - f1 = MUL_C(COEF_CONST(1.0478631305325901), x[0]); - f2 = MUL_F(FRAC_CONST(-0.9987954562051724), f0); - f3 = MUL_F(FRAC_CONST(-0.9497277818777548), x[15]); - f4 = f1 + f2; - f5 = f3 - f2; - f6 = x[2] + x[13]; - f7 = MUL_C(COEF_CONST(1.2130114330978077), x[2]); - f8 = MUL_F(FRAC_CONST(-0.9700312531945440), f6); - f9 = MUL_F(FRAC_CONST(-0.7270510732912803), x[13]); - f10 = f7 + f8; - f11 = f9 - f8; - f12 = x[4] + x[11]; - f13 = MUL_C(COEF_CONST(1.3315443865537255), x[4]); - f14 = MUL_F(FRAC_CONST(-0.9039892931234433), f12); - f15 = MUL_F(FRAC_CONST(-0.4764341996931612), x[11]); - f16 = f13 + f14; - f17 = f15 - f14; - f18 = x[6] + x[9]; - f19 = MUL_C(COEF_CONST(1.3989068359730781), x[6]); - f20 = MUL_F(FRAC_CONST(-0.8032075314806453), f18); - f21 = MUL_F(FRAC_CONST(-0.2075082269882124), x[9]); - f22 = f19 + f20; - f23 = f21 - f20; - f24 = x[8] + x[7]; - f25 = MUL_C(COEF_CONST(1.4125100802019777), x[8]); - f26 = MUL_F(FRAC_CONST(-0.6715589548470187), f24); - f27 = MUL_F(FRAC_CONST(0.0693921705079402), x[7]); - f28 = f25 + f26; - f29 = f27 - f26; - f30 = x[10] + x[5]; - f31 = MUL_C(COEF_CONST(1.3718313541934939), x[10]); - f32 = MUL_F(FRAC_CONST(-0.5141027441932219), f30); - f33 = MUL_F(FRAC_CONST(0.3436258658070501), x[5]); - f34 = f31 + f32; - f35 = f33 - f32; - f36 = x[12] + x[3]; - f37 = MUL_C(COEF_CONST(1.2784339185752409), x[12]); - f38 = MUL_F(FRAC_CONST(-0.3368898533922200), f36); - f39 = MUL_F(FRAC_CONST(0.6046542117908008), x[3]); - f40 = f37 + f38; - f41 = f39 - f38; - f42 = x[14] + x[1]; - f43 = MUL_C(COEF_CONST(1.1359069844201433), x[14]); - f44 = MUL_F(FRAC_CONST(-0.1467304744553624), f42); - f45 = MUL_F(FRAC_CONST(0.8424460355094185), x[1]); - f46 = f43 + f44; - f47 = f45 - f44; - f48 = f5 - f29; - f49 = f5 + f29; - f50 = f4 - f28; - f51 = f4 + f28; - f52 = f11 - f35; - f53 = f11 + f35; - f54 = f10 - f34; - f55 = f10 + f34; - f56 = f17 - f41; - f57 = f17 + f41; - f58 = f16 - f40; - f59 = f16 + f40; - f60 = f23 - f47; - f61 = f23 + f47; - f62 = f22 - f46; - f63 = f22 + f46; - f64 = f48 + f50; - f65 = MUL_C(COEF_CONST(1.1758756024193588), f48); - f66 = MUL_F(FRAC_CONST(-0.9807852804032304), f64); - f67 = MUL_F(FRAC_CONST(-0.7856949583871021), f50); - f68 = f65 + f66; - f69 = f67 - f66; - f70 = f52 + f54; - f71 = MUL_C(COEF_CONST(1.3870398453221475), f52); - f72 = MUL_F(FRAC_CONST(-0.5555702330196022), f70); - f73 = MUL_F(FRAC_CONST(0.2758993792829431), f54); - f74 = f71 + f72; - f75 = f73 - f72; - f76 = f56 + f58; - f77 = MUL_F(FRAC_CONST(0.7856949583871022), f56); - f78 = MUL_F(FRAC_CONST(0.1950903220161283), f76); - f79 = MUL_C(COEF_CONST(1.1758756024193586), f58); - f80 = f77 + f78; - f81 = f79 - f78; - f82 = f60 + f62; - f83 = MUL_F(FRAC_CONST(-0.2758993792829430), f60); - f84 = MUL_F(FRAC_CONST(0.8314696123025452), f82); - f85 = MUL_C(COEF_CONST(1.3870398453221475), f62); - f86 = f83 + f84; - f87 = f85 - f84; - f88 = f49 - f57; - f89 = f49 + f57; - f90 = f51 - f59; - f91 = f51 + f59; - f92 = f53 - f61; - f93 = f53 + f61; - f94 = f55 - f63; - f95 = f55 + f63; - f96 = f69 - f81; - f97 = f69 + f81; - f98 = f68 - f80; - f99 = f68 + f80; - f100 = f75 - f87; - f101 = f75 + f87; - f102 = f74 - f86; - f103 = f74 + f86; - f104 = f88 + f90; - f105 = MUL_C(COEF_CONST(1.3065629648763766), f88); - f106 = MUL_F(FRAC_CONST(-0.9238795325112866), f104); - f107 = MUL_F(FRAC_CONST(-0.5411961001461967), f90); - f108 = f105 + f106; - f109 = f107 - f106; - f110 = f92 + f94; - f111 = MUL_F(FRAC_CONST(0.5411961001461969), f92); - f112 = MUL_F(FRAC_CONST(0.3826834323650898), f110); - f113 = MUL_C(COEF_CONST(1.3065629648763766), f94); - f114 = f111 + f112; - f115 = f113 - f112; - f116 = f96 + f98; - f117 = MUL_C(COEF_CONST(1.3065629648763766), f96); - f118 = MUL_F(FRAC_CONST(-0.9238795325112866), f116); - f119 = MUL_F(FRAC_CONST(-0.5411961001461967), f98); - f120 = f117 + f118; - f121 = f119 - f118; - f122 = f100 + f102; - f123 = MUL_F(FRAC_CONST(0.5411961001461969), f100); - f124 = MUL_F(FRAC_CONST(0.3826834323650898), f122); - f125 = MUL_C(COEF_CONST(1.3065629648763766), f102); - f126 = f123 + f124; - f127 = f125 - f124; - f128 = f89 - f93; - y[0] = f89 + f93; - f130 = f91 - f95; - y[15] = f91 + f95; - f132 = f109 - f115; - y[3] = f109 + f115; - f134 = f108 - f114; - y[12] = f108 + f114; - f136 = f97 - f101; - y[1] = f97 + f101; - f138 = f99 - f103; - y[14] = f99 + f103; - f140 = f121 - f127; - y[2] = f121 + f127; - f142 = f120 - f126; - y[13] = f120 + f126; - f144 = f128 - f130; - f145 = f128 + f130; - y[8] = MUL_F(FRAC_CONST(0.7071067811865474), f144); - y[7] = MUL_F(FRAC_CONST(0.7071067811865474), f145); - f148 = f132 - f134; - f149 = f132 + f134; - y[11] = MUL_F(FRAC_CONST(0.7071067811865474), f148); - y[4] = MUL_F(FRAC_CONST(0.7071067811865474), f149); - f152 = f136 - f138; - f153 = f136 + f138; - y[9] = MUL_F(FRAC_CONST(0.7071067811865474), f152); - y[6] = MUL_F(FRAC_CONST(0.7071067811865474), f153); - f156 = f140 - f142; - f157 = f140 + f142; - y[10] = MUL_F(FRAC_CONST(0.7071067811865474), f156); - y[5] = MUL_F(FRAC_CONST(0.7071067811865474), f157); -} - -void DCT3_32_unscaled(real_t *y, real_t *x) -{ - real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; - real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; - real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30; - real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40; - real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50; - real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60; - real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70; - real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80; - real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90; - real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100; - real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110; - real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120; - real_t f121, f122, f123, f124, f125, f126, f127, f128, f129, f130; - real_t f131, f132, f133, f134, f135, f136, f137, f138, f139, f140; - real_t f141, f142, f143, f144, f145, f146, f147, f148, f149, f150; - real_t f151, f152, f153, f154, f155, f156, f157, f158, f159, f160; - real_t f161, f162, f163, f164, f165, f166, f167, f168, f169, f170; - real_t f171, f172, f173, f174, f175, f176, f177, f178, f179, f180; - real_t f181, f182, f183, f184, f185, f186, f187, f188, f189, f190; - real_t f191, f192, f193, f194, f195, f196, f197, f198, f199, f200; - real_t f201, f202, f203, f204, f205, f206, f207, f208, f209, f210; - real_t f211, f212, f213, f214, f215, f216, f217, f218, f219, f220; - real_t f221, f222, f223, f224, f225, f226, f227, f228, f229, f230; - real_t f231, f232, f233, f234, f235, f236, f237, f238, f239, f240; - real_t f241, f242, f243, f244, f245, f246, f247, f248, f249, f250; - real_t f251, f252, f253, f254, f255, f256, f257, f258, f259, f260; - real_t f261, f262, f263, f264, f265, f266, f267, f268, f269, f270; - real_t f271, f272; - - f0 = MUL_F(x[16], FRAC_CONST(0.7071067811865476)); - f1 = x[0] - f0; - f2 = x[0] + f0; - f3 = x[8] + x[24]; - f4 = MUL_C(x[8], COEF_CONST(1.3065629648763766)); - f5 = MUL_F(f3, FRAC_CONST((-0.9238795325112866))); - f6 = MUL_F(x[24], FRAC_CONST((-0.5411961001461967))); - f7 = f4 + f5; - f8 = f6 - f5; - f9 = f2 - f8; - f10 = f2 + f8; - f11 = f1 - f7; - f12 = f1 + f7; - f13 = x[4] + x[28]; - f14 = MUL_C(x[4], COEF_CONST(1.1758756024193588)); - f15 = MUL_F(f13, FRAC_CONST((-0.9807852804032304))); - f16 = MUL_F(x[28], FRAC_CONST((-0.7856949583871021))); - f17 = f14 + f15; - f18 = f16 - f15; - f19 = x[12] + x[20]; - f20 = MUL_C(x[12], COEF_CONST(1.3870398453221473)); - f21 = MUL_F(f19, FRAC_CONST((-0.8314696123025455))); - f22 = MUL_F(x[20], FRAC_CONST((-0.2758993792829436))); - f23 = f20 + f21; - f24 = f22 - f21; - f25 = f18 - f24; - f26 = f18 + f24; - f27 = MUL_F(f25, FRAC_CONST(0.7071067811865476)); - f28 = f17 - f23; - f29 = f17 + f23; - f30 = MUL_F(f29, FRAC_CONST(0.7071067811865476)); - f31 = f27 - f30; - f32 = f27 + f30; - f33 = f10 - f26; - f34 = f10 + f26; - f35 = f12 - f32; - f36 = f12 + f32; - f37 = f11 - f31; - f38 = f11 + f31; - f39 = f9 - f28; - f40 = f9 + f28; - f41 = x[2] + x[30]; - f42 = MUL_C(x[2], COEF_CONST(1.0932018670017569)); - f43 = MUL_F(f41, FRAC_CONST((-0.9951847266721969))); - f44 = MUL_F(x[30], FRAC_CONST((-0.8971675863426368))); - f45 = f42 + f43; - f46 = f44 - f43; - f47 = x[6] + x[26]; - f48 = MUL_C(x[6], COEF_CONST(1.2472250129866711)); - f49 = MUL_F(f47, FRAC_CONST((-0.9569403357322089))); - f50 = MUL_F(x[26], FRAC_CONST((-0.6666556584777469))); - f51 = f48 + f49; - f52 = f50 - f49; - f53 = x[10] + x[22]; - f54 = MUL_C(x[10], COEF_CONST(1.3533180011743526)); - f55 = MUL_F(f53, FRAC_CONST((-0.8819212643483551))); - f56 = MUL_F(x[22], FRAC_CONST((-0.4105245275223575))); - f57 = f54 + f55; - f58 = f56 - f55; - f59 = x[14] + x[18]; - f60 = MUL_C(x[14], COEF_CONST(1.4074037375263826)); - f61 = MUL_F(f59, FRAC_CONST((-0.7730104533627369))); - f62 = MUL_F(x[18], FRAC_CONST((-0.1386171691990913))); - f63 = f60 + f61; - f64 = f62 - f61; - f65 = f46 - f64; - f66 = f46 + f64; - f67 = f52 - f58; - f68 = f52 + f58; - f69 = f66 - f68; - f70 = f66 + f68; - f71 = MUL_F(f69, FRAC_CONST(0.7071067811865476)); - f72 = f65 + f67; - f73 = MUL_C(f65, COEF_CONST(1.3065629648763766)); - f74 = MUL_F(f72, FRAC_CONST((-0.9238795325112866))); - f75 = MUL_F(f67, FRAC_CONST((-0.5411961001461967))); - f76 = f73 + f74; - f77 = f75 - f74; - f78 = f45 - f63; - f79 = f45 + f63; - f80 = f51 - f57; - f81 = f51 + f57; - f82 = f79 + f81; - f83 = MUL_C(f79, COEF_CONST(1.3065629648763770)); - f84 = MUL_F(f82, FRAC_CONST((-0.3826834323650904))); - f85 = MUL_F(f81, FRAC_CONST(0.5411961001461961)); - f86 = f83 + f84; - f87 = f85 - f84; - f88 = f78 - f80; - f89 = f78 + f80; - f90 = MUL_F(f89, FRAC_CONST(0.7071067811865476)); - f91 = f77 - f87; - f92 = f77 + f87; - f93 = f71 - f90; - f94 = f71 + f90; - f95 = f76 - f86; - f96 = f76 + f86; - f97 = f34 - f70; - f98 = f34 + f70; - f99 = f36 - f92; - f100 = f36 + f92; - f101 = f38 - f91; - f102 = f38 + f91; - f103 = f40 - f94; - f104 = f40 + f94; - f105 = f39 - f93; - f106 = f39 + f93; - f107 = f37 - f96; - f108 = f37 + f96; - f109 = f35 - f95; - f110 = f35 + f95; - f111 = f33 - f88; - f112 = f33 + f88; - f113 = x[1] + x[31]; - f114 = MUL_C(x[1], COEF_CONST(1.0478631305325901)); - f115 = MUL_F(f113, FRAC_CONST((-0.9987954562051724))); - f116 = MUL_F(x[31], FRAC_CONST((-0.9497277818777548))); - f117 = f114 + f115; - f118 = f116 - f115; - f119 = x[5] + x[27]; - f120 = MUL_C(x[5], COEF_CONST(1.2130114330978077)); - f121 = MUL_F(f119, FRAC_CONST((-0.9700312531945440))); - f122 = MUL_F(x[27], FRAC_CONST((-0.7270510732912803))); - f123 = f120 + f121; - f124 = f122 - f121; - f125 = x[9] + x[23]; - f126 = MUL_C(x[9], COEF_CONST(1.3315443865537255)); - f127 = MUL_F(f125, FRAC_CONST((-0.9039892931234433))); - f128 = MUL_F(x[23], FRAC_CONST((-0.4764341996931612))); - f129 = f126 + f127; - f130 = f128 - f127; - f131 = x[13] + x[19]; - f132 = MUL_C(x[13], COEF_CONST(1.3989068359730781)); - f133 = MUL_F(f131, FRAC_CONST((-0.8032075314806453))); - f134 = MUL_F(x[19], FRAC_CONST((-0.2075082269882124))); - f135 = f132 + f133; - f136 = f134 - f133; - f137 = x[17] + x[15]; - f138 = MUL_C(x[17], COEF_CONST(1.4125100802019777)); - f139 = MUL_F(f137, FRAC_CONST((-0.6715589548470187))); - f140 = MUL_F(x[15], FRAC_CONST(0.0693921705079402)); - f141 = f138 + f139; - f142 = f140 - f139; - f143 = x[21] + x[11]; - f144 = MUL_C(x[21], COEF_CONST(1.3718313541934939)); - f145 = MUL_F(f143, FRAC_CONST((-0.5141027441932219))); - f146 = MUL_F(x[11], FRAC_CONST(0.3436258658070501)); - f147 = f144 + f145; - f148 = f146 - f145; - f149 = x[25] + x[7]; - f150 = MUL_C(x[25], COEF_CONST(1.2784339185752409)); - f151 = MUL_F(f149, FRAC_CONST((-0.3368898533922200))); - f152 = MUL_F(x[7], FRAC_CONST(0.6046542117908008)); - f153 = f150 + f151; - f154 = f152 - f151; - f155 = x[29] + x[3]; - f156 = MUL_C(x[29], COEF_CONST(1.1359069844201433)); - f157 = MUL_F(f155, FRAC_CONST((-0.1467304744553624))); - f158 = MUL_F(x[3], FRAC_CONST(0.8424460355094185)); - f159 = f156 + f157; - f160 = f158 - f157; - f161 = f118 - f142; - f162 = f118 + f142; - f163 = f117 - f141; - f164 = f117 + f141; - f165 = f124 - f148; - f166 = f124 + f148; - f167 = f123 - f147; - f168 = f123 + f147; - f169 = f130 - f154; - f170 = f130 + f154; - f171 = f129 - f153; - f172 = f129 + f153; - f173 = f136 - f160; - f174 = f136 + f160; - f175 = f135 - f159; - f176 = f135 + f159; - f177 = f161 + f163; - f178 = MUL_C(f161, COEF_CONST(1.1758756024193588)); - f179 = MUL_F(f177, FRAC_CONST((-0.9807852804032304))); - f180 = MUL_F(f163, FRAC_CONST((-0.7856949583871021))); - f181 = f178 + f179; - f182 = f180 - f179; - f183 = f165 + f167; - f184 = MUL_C(f165, COEF_CONST(1.3870398453221475)); - f185 = MUL_F(f183, FRAC_CONST((-0.5555702330196022))); - f186 = MUL_F(f167, FRAC_CONST(0.2758993792829431)); - f187 = f184 + f185; - f188 = f186 - f185; - f189 = f169 + f171; - f190 = MUL_F(f169, FRAC_CONST(0.7856949583871022)); - f191 = MUL_F(f189, FRAC_CONST(0.1950903220161283)); - f192 = MUL_C(f171, COEF_CONST(1.1758756024193586)); - f193 = f190 + f191; - f194 = f192 - f191; - f195 = f173 + f175; - f196 = MUL_F(f173, FRAC_CONST((-0.2758993792829430))); - f197 = MUL_F(f195, FRAC_CONST(0.8314696123025452)); - f198 = MUL_C(f175, COEF_CONST(1.3870398453221475)); - f199 = f196 + f197; - f200 = f198 - f197; - f201 = f162 - f170; - f202 = f162 + f170; - f203 = f164 - f172; - f204 = f164 + f172; - f205 = f166 - f174; - f206 = f166 + f174; - f207 = f168 - f176; - f208 = f168 + f176; - f209 = f182 - f194; - f210 = f182 + f194; - f211 = f181 - f193; - f212 = f181 + f193; - f213 = f188 - f200; - f214 = f188 + f200; - f215 = f187 - f199; - f216 = f187 + f199; - f217 = f201 + f203; - f218 = MUL_C(f201, COEF_CONST(1.3065629648763766)); - f219 = MUL_F(f217, FRAC_CONST((-0.9238795325112866))); - f220 = MUL_F(f203, FRAC_CONST((-0.5411961001461967))); - f221 = f218 + f219; - f222 = f220 - f219; - f223 = f205 + f207; - f224 = MUL_F(f205, FRAC_CONST(0.5411961001461969)); - f225 = MUL_F(f223, FRAC_CONST(0.3826834323650898)); - f226 = MUL_C(f207, COEF_CONST(1.3065629648763766)); - f227 = f224 + f225; - f228 = f226 - f225; - f229 = f209 + f211; - f230 = MUL_C(f209, COEF_CONST(1.3065629648763766)); - f231 = MUL_F(f229, FRAC_CONST((-0.9238795325112866))); - f232 = MUL_F(f211, FRAC_CONST((-0.5411961001461967))); - f233 = f230 + f231; - f234 = f232 - f231; - f235 = f213 + f215; - f236 = MUL_F(f213, FRAC_CONST(0.5411961001461969)); - f237 = MUL_F(f235, FRAC_CONST(0.3826834323650898)); - f238 = MUL_C(f215, COEF_CONST(1.3065629648763766)); - f239 = f236 + f237; - f240 = f238 - f237; - f241 = f202 - f206; - f242 = f202 + f206; - f243 = f204 - f208; - f244 = f204 + f208; - f245 = f222 - f228; - f246 = f222 + f228; - f247 = f221 - f227; - f248 = f221 + f227; - f249 = f210 - f214; - f250 = f210 + f214; - f251 = f212 - f216; - f252 = f212 + f216; - f253 = f234 - f240; - f254 = f234 + f240; - f255 = f233 - f239; - f256 = f233 + f239; - f257 = f241 - f243; - f258 = f241 + f243; - f259 = MUL_F(f257, FRAC_CONST(0.7071067811865474)); - f260 = MUL_F(f258, FRAC_CONST(0.7071067811865474)); - f261 = f245 - f247; - f262 = f245 + f247; - f263 = MUL_F(f261, FRAC_CONST(0.7071067811865474)); - f264 = MUL_F(f262, FRAC_CONST(0.7071067811865474)); - f265 = f249 - f251; - f266 = f249 + f251; - f267 = MUL_F(f265, FRAC_CONST(0.7071067811865474)); - f268 = MUL_F(f266, FRAC_CONST(0.7071067811865474)); - f269 = f253 - f255; - f270 = f253 + f255; - f271 = MUL_F(f269, FRAC_CONST(0.7071067811865474)); - f272 = MUL_F(f270, FRAC_CONST(0.7071067811865474)); - y[31] = f98 - f242; - y[0] = f98 + f242; - y[30] = f100 - f250; - y[1] = f100 + f250; - y[29] = f102 - f254; - y[2] = f102 + f254; - y[28] = f104 - f246; - y[3] = f104 + f246; - y[27] = f106 - f264; - y[4] = f106 + f264; - y[26] = f108 - f272; - y[5] = f108 + f272; - y[25] = f110 - f268; - y[6] = f110 + f268; - y[24] = f112 - f260; - y[7] = f112 + f260; - y[23] = f111 - f259; - y[8] = f111 + f259; - y[22] = f109 - f267; - y[9] = f109 + f267; - y[21] = f107 - f271; - y[10] = f107 + f271; - y[20] = f105 - f263; - y[11] = f105 + f263; - y[19] = f103 - f248; - y[12] = f103 + f248; - y[18] = f101 - f256; - y[13] = f101 + f256; - y[17] = f99 - f252; - y[14] = f99 + f252; - y[16] = f97 - f244; - y[15] = f97 + f244; -} - -void DCT2_32_unscaled(real_t *y, real_t *x) -{ - real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; - real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; - real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30; - real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40; - real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50; - real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60; - real_t f63, f64, f65, f66, f69, f70, f71, f72, f73, f74; - real_t f75, f76, f77, f78, f79, f80, f81, f83, f85, f86; - real_t f89, f90, f91, f92, f93, f94, f95, f96, f97, f98; - real_t f99, f100, f101, f102, f103, f104, f105, f106, f107, f108; - real_t f109, f110, f111, f112, f113, f114, f115, f116, f117, f118; - real_t f119, f120, f121, f122, f123, f124, f127, f128, f129, f130; - real_t f133, f134, f135, f136, f139, f140, f141, f142, f145, f146; - real_t f147, f148, f149, f150, f151, f152, f153, f154, f155, f156; - real_t f157, f158, f159, f160, f161, f162, f163, f164, f165, f166; - real_t f167, f168, f169, f170, f171, f172, f173, f174, f175, f176; - real_t f177, f178, f179, f180, f181, f182, f183, f184, f185, f186; - real_t f187, f188, f189, f190, f191, f192, f193, f194, f195, f196; - real_t f197, f198, f199, f200, f201, f202, f203, f204, f205, f206; - real_t f207, f208, f209, f210, f211, f212, f213, f214, f215, f216; - real_t f217, f218, f219, f220, f221, f222, f223, f224, f225, f226; - real_t f227, f228, f229, f230, f231, f232, f233, f234, f235, f236; - real_t f237, f238, f239, f240, f241, f242, f243, f244, f247, f248; - real_t f249, f250, f253, f254, f255, f256, f259, f260, f261, f262; - real_t f265, f266, f267, f268, f271, f272, f273, f274, f277, f278; - real_t f279, f280, f283, f284, f285, f286; - - f0 = x[0] - x[31]; - f1 = x[0] + x[31]; - f2 = x[1] - x[30]; - f3 = x[1] + x[30]; - f4 = x[2] - x[29]; - f5 = x[2] + x[29]; - f6 = x[3] - x[28]; - f7 = x[3] + x[28]; - f8 = x[4] - x[27]; - f9 = x[4] + x[27]; - f10 = x[5] - x[26]; - f11 = x[5] + x[26]; - f12 = x[6] - x[25]; - f13 = x[6] + x[25]; - f14 = x[7] - x[24]; - f15 = x[7] + x[24]; - f16 = x[8] - x[23]; - f17 = x[8] + x[23]; - f18 = x[9] - x[22]; - f19 = x[9] + x[22]; - f20 = x[10] - x[21]; - f21 = x[10] + x[21]; - f22 = x[11] - x[20]; - f23 = x[11] + x[20]; - f24 = x[12] - x[19]; - f25 = x[12] + x[19]; - f26 = x[13] - x[18]; - f27 = x[13] + x[18]; - f28 = x[14] - x[17]; - f29 = x[14] + x[17]; - f30 = x[15] - x[16]; - f31 = x[15] + x[16]; - f32 = f1 - f31; - f33 = f1 + f31; - f34 = f3 - f29; - f35 = f3 + f29; - f36 = f5 - f27; - f37 = f5 + f27; - f38 = f7 - f25; - f39 = f7 + f25; - f40 = f9 - f23; - f41 = f9 + f23; - f42 = f11 - f21; - f43 = f11 + f21; - f44 = f13 - f19; - f45 = f13 + f19; - f46 = f15 - f17; - f47 = f15 + f17; - f48 = f33 - f47; - f49 = f33 + f47; - f50 = f35 - f45; - f51 = f35 + f45; - f52 = f37 - f43; - f53 = f37 + f43; - f54 = f39 - f41; - f55 = f39 + f41; - f56 = f49 - f55; - f57 = f49 + f55; - f58 = f51 - f53; - f59 = f51 + f53; - f60 = f57 - f59; - y[0] = f57 + f59; - y[16] = MUL_F(FRAC_CONST(0.7071067811865476), f60); - f63 = f56 + f58; - f64 = MUL_C(COEF_CONST(1.3065629648763766), f56); - f65 = MUL_F(FRAC_CONST(-0.9238795325112866), f63); - f66 = MUL_F(FRAC_CONST(-0.5411961001461967), f58); - y[24] = f64 + f65; - y[8] = f66 - f65; - f69 = f48 + f54; - f70 = MUL_C(COEF_CONST(1.1758756024193588), f48); - f71 = MUL_F(FRAC_CONST(-0.9807852804032304), f69); - f72 = MUL_F(FRAC_CONST(-0.7856949583871021), f54); - f73 = f70 + f71; - f74 = f72 - f71; - f75 = f50 + f52; - f76 = MUL_C(COEF_CONST(1.3870398453221473), f50); - f77 = MUL_F(FRAC_CONST(-0.8314696123025455), f75); - f78 = MUL_F(FRAC_CONST(-0.2758993792829436), f52); - f79 = f76 + f77; - f80 = f78 - f77; - f81 = f74 - f80; - y[4] = f74 + f80; - f83 = MUL_F(FRAC_CONST(0.7071067811865476), f81); - y[28] = f73 - f79; - f85 = f73 + f79; - f86 = MUL_F(FRAC_CONST(0.7071067811865476), f85); - y[20] = f83 - f86; - y[12] = f83 + f86; - f89 = f34 - f36; - f90 = f34 + f36; - f91 = f38 - f40; - f92 = f38 + f40; - f93 = f42 - f44; - f94 = f42 + f44; - f95 = MUL_F(FRAC_CONST(0.7071067811865476), f92); - f96 = f32 - f95; - f97 = f32 + f95; - f98 = f90 + f94; - f99 = MUL_C(COEF_CONST(1.3065629648763766), f90); - f100 = MUL_F(FRAC_CONST(-0.9238795325112866), f98); - f101 = MUL_F(FRAC_CONST(-0.5411961001461967), f94); - f102 = f99 + f100; - f103 = f101 - f100; - f104 = f97 - f103; - f105 = f97 + f103; - f106 = f96 - f102; - f107 = f96 + f102; - f108 = MUL_F(FRAC_CONST(0.7071067811865476), f91); - f109 = f46 - f108; - f110 = f46 + f108; - f111 = f93 + f89; - f112 = MUL_C(COEF_CONST(1.3065629648763766), f93); - f113 = MUL_F(FRAC_CONST(-0.9238795325112866), f111); - f114 = MUL_F(FRAC_CONST(-0.5411961001461967), f89); - f115 = f112 + f113; - f116 = f114 - f113; - f117 = f110 - f116; - f118 = f110 + f116; - f119 = f109 - f115; - f120 = f109 + f115; - f121 = f118 + f105; - f122 = MUL_F(FRAC_CONST(-0.8971675863426361), f118); - f123 = MUL_F(FRAC_CONST(0.9951847266721968), f121); - f124 = MUL_C(COEF_CONST(1.0932018670017576), f105); - y[2] = f122 + f123; - y[30] = f124 - f123; - f127 = f107 - f120; - f128 = MUL_F(FRAC_CONST(-0.6666556584777466), f120); - f129 = MUL_F(FRAC_CONST(0.9569403357322089), f127); - f130 = MUL_C(COEF_CONST(1.2472250129866713), f107); - y[6] = f129 - f128; - y[26] = f130 - f129; - f133 = f119 + f106; - f134 = MUL_F(FRAC_CONST(-0.4105245275223571), f119); - f135 = MUL_F(FRAC_CONST(0.8819212643483549), f133); - f136 = MUL_C(COEF_CONST(1.3533180011743529), f106); - y[10] = f134 + f135; - y[22] = f136 - f135; - f139 = f104 - f117; - f140 = MUL_F(FRAC_CONST(-0.1386171691990915), f117); - f141 = MUL_F(FRAC_CONST(0.7730104533627370), f139); - f142 = MUL_C(COEF_CONST(1.4074037375263826), f104); - y[14] = f141 - f140; - y[18] = f142 - f141; - f145 = f2 - f4; - f146 = f2 + f4; - f147 = f6 - f8; - f148 = f6 + f8; - f149 = f10 - f12; - f150 = f10 + f12; - f151 = f14 - f16; - f152 = f14 + f16; - f153 = f18 - f20; - f154 = f18 + f20; - f155 = f22 - f24; - f156 = f22 + f24; - f157 = f26 - f28; - f158 = f26 + f28; - f159 = MUL_F(FRAC_CONST(0.7071067811865476), f152); - f160 = f0 - f159; - f161 = f0 + f159; - f162 = f148 + f156; - f163 = MUL_C(COEF_CONST(1.3065629648763766), f148); - f164 = MUL_F(FRAC_CONST(-0.9238795325112866), f162); - f165 = MUL_F(FRAC_CONST(-0.5411961001461967), f156); - f166 = f163 + f164; - f167 = f165 - f164; - f168 = f161 - f167; - f169 = f161 + f167; - f170 = f160 - f166; - f171 = f160 + f166; - f172 = f146 + f158; - f173 = MUL_C(COEF_CONST(1.1758756024193588), f146); - f174 = MUL_F(FRAC_CONST(-0.9807852804032304), f172); - f175 = MUL_F(FRAC_CONST(-0.7856949583871021), f158); - f176 = f173 + f174; - f177 = f175 - f174; - f178 = f150 + f154; - f179 = MUL_C(COEF_CONST(1.3870398453221473), f150); - f180 = MUL_F(FRAC_CONST(-0.8314696123025455), f178); - f181 = MUL_F(FRAC_CONST(-0.2758993792829436), f154); - f182 = f179 + f180; - f183 = f181 - f180; - f184 = f177 - f183; - f185 = f177 + f183; - f186 = MUL_F(FRAC_CONST(0.7071067811865476), f184); - f187 = f176 - f182; - f188 = f176 + f182; - f189 = MUL_F(FRAC_CONST(0.7071067811865476), f188); - f190 = f186 - f189; - f191 = f186 + f189; - f192 = f169 - f185; - f193 = f169 + f185; - f194 = f171 - f191; - f195 = f171 + f191; - f196 = f170 - f190; - f197 = f170 + f190; - f198 = f168 - f187; - f199 = f168 + f187; - f200 = MUL_F(FRAC_CONST(0.7071067811865476), f151); - f201 = f30 - f200; - f202 = f30 + f200; - f203 = f155 + f147; - f204 = MUL_C(COEF_CONST(1.3065629648763766), f155); - f205 = MUL_F(FRAC_CONST(-0.9238795325112866), f203); - f206 = MUL_F(FRAC_CONST(-0.5411961001461967), f147); - f207 = f204 + f205; - f208 = f206 - f205; - f209 = f202 - f208; - f210 = f202 + f208; - f211 = f201 - f207; - f212 = f201 + f207; - f213 = f157 + f145; - f214 = MUL_C(COEF_CONST(1.1758756024193588), f157); - f215 = MUL_F(FRAC_CONST(-0.9807852804032304), f213); - f216 = MUL_F(FRAC_CONST(-0.7856949583871021), f145); - f217 = f214 + f215; - f218 = f216 - f215; - f219 = f153 + f149; - f220 = MUL_C(COEF_CONST(1.3870398453221473), f153); - f221 = MUL_F(FRAC_CONST(-0.8314696123025455), f219); - f222 = MUL_F(FRAC_CONST(-0.2758993792829436), f149); - f223 = f220 + f221; - f224 = f222 - f221; - f225 = f218 - f224; - f226 = f218 + f224; - f227 = MUL_F(FRAC_CONST(0.7071067811865476), f225); - f228 = f217 - f223; - f229 = f217 + f223; - f230 = MUL_F(FRAC_CONST(0.7071067811865476), f229); - f231 = f227 - f230; - f232 = f227 + f230; - f233 = f210 - f226; - f234 = f210 + f226; - f235 = f212 - f232; - f236 = f212 + f232; - f237 = f211 - f231; - f238 = f211 + f231; - f239 = f209 - f228; - f240 = f209 + f228; - f241 = f234 + f193; - f242 = MUL_F(FRAC_CONST(-0.9497277818777543), f234); - f243 = MUL_F(FRAC_CONST(0.9987954562051724), f241); - f244 = MUL_C(COEF_CONST(1.0478631305325905), f193); - y[1] = f242 + f243; - y[31] = f244 - f243; - f247 = f195 - f236; - f248 = MUL_F(FRAC_CONST(-0.8424460355094192), f236); - f249 = MUL_F(FRAC_CONST(0.9891765099647810), f247); - f250 = MUL_C(COEF_CONST(1.1359069844201428), f195); - y[3] = f249 - f248; - y[29] = f250 - f249; - f253 = f238 + f197; - f254 = MUL_F(FRAC_CONST(-0.7270510732912801), f238); - f255 = MUL_F(FRAC_CONST(0.9700312531945440), f253); - f256 = MUL_C(COEF_CONST(1.2130114330978079), f197); - y[5] = f254 + f255; - y[27] = f256 - f255; - f259 = f199 - f240; - f260 = MUL_F(FRAC_CONST(-0.6046542117908007), f240); - f261 = MUL_F(FRAC_CONST(0.9415440651830208), f259); - f262 = MUL_C(COEF_CONST(1.2784339185752409), f199); - y[7] = f261 - f260; - y[25] = f262 - f261; - f265 = f239 + f198; - f266 = MUL_F(FRAC_CONST(-0.4764341996931611), f239); - f267 = MUL_F(FRAC_CONST(0.9039892931234433), f265); - f268 = MUL_C(COEF_CONST(1.3315443865537255), f198); - y[9] = f266 + f267; - y[23] = f268 - f267; - f271 = f196 - f237; - f272 = MUL_F(FRAC_CONST(-0.3436258658070505), f237); - f273 = MUL_F(FRAC_CONST(0.8577286100002721), f271); - f274 = MUL_C(COEF_CONST(1.3718313541934939), f196); - y[11] = f273 - f272; - y[21] = f274 - f273; - f277 = f235 + f194; - f278 = MUL_F(FRAC_CONST(-0.2075082269882114), f235); - f279 = MUL_F(FRAC_CONST(0.8032075314806448), f277); - f280 = MUL_C(COEF_CONST(1.3989068359730783), f194); - y[13] = f278 + f279; - y[19] = f280 - f279; - f283 = f192 - f233; - f284 = MUL_F(FRAC_CONST(-0.0693921705079408), f233); - f285 = MUL_F(FRAC_CONST(0.7409511253549591), f283); - f286 = MUL_C(COEF_CONST(1.4125100802019774), f192); - y[15] = f285 - f284; - y[17] = f286 - f285; -} - -#else - - -#define n 32 -#define log2n 5 - -// w_array_real[i] = cos(2*M_PI*i/32) -static const real_t w_array_real[] = { - FRAC_CONST(1.000000000000000), FRAC_CONST(0.980785279337272), - FRAC_CONST(0.923879528329380), FRAC_CONST(0.831469603195765), - FRAC_CONST(0.707106765732237), FRAC_CONST(0.555570210304169), - FRAC_CONST(0.382683402077046), FRAC_CONST(0.195090284503576), - FRAC_CONST(0.000000000000000), FRAC_CONST(-0.195090370246552), - FRAC_CONST(-0.382683482845162), FRAC_CONST(-0.555570282993553), - FRAC_CONST(-0.707106827549476), FRAC_CONST(-0.831469651765257), - FRAC_CONST(-0.923879561784627), FRAC_CONST(-0.980785296392607) -}; - -// w_array_imag[i] = sin(-2*M_PI*i/32) -static const real_t w_array_imag[] = { - FRAC_CONST(0.000000000000000), FRAC_CONST(-0.195090327375064), - FRAC_CONST(-0.382683442461104), FRAC_CONST(-0.555570246648862), - FRAC_CONST(-0.707106796640858), FRAC_CONST(-0.831469627480512), - FRAC_CONST(-0.923879545057005), FRAC_CONST(-0.980785287864940), - FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.980785270809601), - FRAC_CONST(-0.923879511601754), FRAC_CONST(-0.831469578911016), - FRAC_CONST(-0.707106734823616), FRAC_CONST(-0.555570173959476), - FRAC_CONST(-0.382683361692986), FRAC_CONST(-0.195090241632088) -}; - -// FFT decimation in frequency -// 4*16*2+16=128+16=144 multiplications -// 6*16*2+10*8+4*16*2=192+80+128=400 additions -static void fft_dif(real_t * Real, real_t * Imag) -{ - real_t w_real, w_imag; // For faster access - real_t point1_real, point1_imag, point2_real, point2_imag; // For faster access - uint32_t j, i, i2, w_index; // Counters - - // First 2 stages of 32 point FFT decimation in frequency - // 4*16*2=64*2=128 multiplications - // 6*16*2=96*2=192 additions - // Stage 1 of 32 point FFT decimation in frequency - for (i = 0; i < 16; i++) - { - point1_real = Real[i]; - point1_imag = Imag[i]; - i2 = i+16; - point2_real = Real[i2]; - point2_imag = Imag[i2]; - - w_real = w_array_real[i]; - w_imag = w_array_imag[i]; - - // temp1 = x[i] - x[i2] - point1_real -= point2_real; - point1_imag -= point2_imag; - - // x[i1] = x[i] + x[i2] - Real[i] += point2_real; - Imag[i] += point2_imag; - - // x[i2] = (x[i] - x[i2]) * w - Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag)); - Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real)); - } - // Stage 2 of 32 point FFT decimation in frequency - for (j = 0, w_index = 0; j < 8; j++, w_index += 2) - { - w_real = w_array_real[w_index]; - w_imag = w_array_imag[w_index]; - - i = j; - point1_real = Real[i]; - point1_imag = Imag[i]; - i2 = i+8; - point2_real = Real[i2]; - point2_imag = Imag[i2]; - - // temp1 = x[i] - x[i2] - point1_real -= point2_real; - point1_imag -= point2_imag; - - // x[i1] = x[i] + x[i2] - Real[i] += point2_real; - Imag[i] += point2_imag; - - // x[i2] = (x[i] - x[i2]) * w - Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag)); - Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real)); - - i = j+16; - point1_real = Real[i]; - point1_imag = Imag[i]; - i2 = i+8; - point2_real = Real[i2]; - point2_imag = Imag[i2]; - - // temp1 = x[i] - x[i2] - point1_real -= point2_real; - point1_imag -= point2_imag; - - // x[i1] = x[i] + x[i2] - Real[i] += point2_real; - Imag[i] += point2_imag; - - // x[i2] = (x[i] - x[i2]) * w - Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag)); - Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real)); - } - - // Stage 3 of 32 point FFT decimation in frequency - // 2*4*2=16 multiplications - // 4*4*2+6*4*2=10*8=80 additions - for (i = 0; i < n; i += 8) - { - i2 = i+4; - point1_real = Real[i]; - point1_imag = Imag[i]; - - point2_real = Real[i2]; - point2_imag = Imag[i2]; - - // out[i1] = point1 + point2 - Real[i] += point2_real; - Imag[i] += point2_imag; - - // out[i2] = point1 - point2 - Real[i2] = point1_real - point2_real; - Imag[i2] = point1_imag - point2_imag; - } - w_real = w_array_real[4]; // = sqrt(2)/2 - // w_imag = -w_real; // = w_array_imag[4]; // = -sqrt(2)/2 - for (i = 1; i < n; i += 8) - { - i2 = i+4; - point1_real = Real[i]; - point1_imag = Imag[i]; - - point2_real = Real[i2]; - point2_imag = Imag[i2]; - - // temp1 = x[i] - x[i2] - point1_real -= point2_real; - point1_imag -= point2_imag; - - // x[i1] = x[i] + x[i2] - Real[i] += point2_real; - Imag[i] += point2_imag; - - // x[i2] = (x[i] - x[i2]) * w - Real[i2] = MUL_F(point1_real+point1_imag, w_real); - Imag[i2] = MUL_F(point1_imag-point1_real, w_real); - } - for (i = 2; i < n; i += 8) - { - i2 = i+4; - point1_real = Real[i]; - point1_imag = Imag[i]; - - point2_real = Real[i2]; - point2_imag = Imag[i2]; - - // x[i] = x[i] + x[i2] - Real[i] += point2_real; - Imag[i] += point2_imag; - - // x[i2] = (x[i] - x[i2]) * (-i) - Real[i2] = point1_imag - point2_imag; - Imag[i2] = point2_real - point1_real; - } - w_real = w_array_real[12]; // = -sqrt(2)/2 - // w_imag = w_real; // = w_array_imag[12]; // = -sqrt(2)/2 - for (i = 3; i < n; i += 8) - { - i2 = i+4; - point1_real = Real[i]; - point1_imag = Imag[i]; - - point2_real = Real[i2]; - point2_imag = Imag[i2]; - - // temp1 = x[i] - x[i2] - point1_real -= point2_real; - point1_imag -= point2_imag; - - // x[i1] = x[i] + x[i2] - Real[i] += point2_real; - Imag[i] += point2_imag; - - // x[i2] = (x[i] - x[i2]) * w - Real[i2] = MUL_F(point1_real-point1_imag, w_real); - Imag[i2] = MUL_F(point1_real+point1_imag, w_real); - } - - - // Stage 4 of 32 point FFT decimation in frequency (no multiplications) - // 16*4=64 additions - for (i = 0; i < n; i += 4) - { - i2 = i+2; - point1_real = Real[i]; - point1_imag = Imag[i]; - - point2_real = Real[i2]; - point2_imag = Imag[i2]; - - // x[i1] = x[i] + x[i2] - Real[i] += point2_real; - Imag[i] += point2_imag; - - // x[i2] = x[i] - x[i2] - Real[i2] = point1_real - point2_real; - Imag[i2] = point1_imag - point2_imag; - } - for (i = 1; i < n; i += 4) - { - i2 = i+2; - point1_real = Real[i]; - point1_imag = Imag[i]; - - point2_real = Real[i2]; - point2_imag = Imag[i2]; - - // x[i] = x[i] + x[i2] - Real[i] += point2_real; - Imag[i] += point2_imag; - - // x[i2] = (x[i] - x[i2]) * (-i) - Real[i2] = point1_imag - point2_imag; - Imag[i2] = point2_real - point1_real; - } - - // Stage 5 of 32 point FFT decimation in frequency (no multiplications) - // 16*4=64 additions - for (i = 0; i < n; i += 2) - { - i2 = i+1; - point1_real = Real[i]; - point1_imag = Imag[i]; - - point2_real = Real[i2]; - point2_imag = Imag[i2]; - - // out[i1] = point1 + point2 - Real[i] += point2_real; - Imag[i] += point2_imag; - - // out[i2] = point1 - point2 - Real[i2] = point1_real - point2_real; - Imag[i2] = point1_imag - point2_imag; - } - -#ifdef REORDER_IN_FFT - FFTReorder(Real, Imag); -#endif // #ifdef REORDER_IN_FFT -} -#undef n -#undef log2n - -static const real_t dct4_64_tab[] = { - COEF_CONST(0.999924719333649), COEF_CONST(0.998118102550507), - COEF_CONST(0.993906974792480), COEF_CONST(0.987301409244537), - COEF_CONST(0.978317379951477), COEF_CONST(0.966976463794708), - COEF_CONST(0.953306019306183), COEF_CONST(0.937339007854462), - COEF_CONST(0.919113874435425), COEF_CONST(0.898674488067627), - COEF_CONST(0.876070082187653), COEF_CONST(0.851355195045471), - COEF_CONST(0.824589252471924), COEF_CONST(0.795836925506592), - COEF_CONST(0.765167236328125), COEF_CONST(0.732654273509979), - COEF_CONST(0.698376238346100), COEF_CONST(0.662415742874146), - COEF_CONST(0.624859452247620), COEF_CONST(0.585797846317291), - COEF_CONST(0.545324981212616), COEF_CONST(0.503538429737091), - COEF_CONST(0.460538715124130), COEF_CONST(0.416429549455643), - COEF_CONST(0.371317148208618), COEF_CONST(0.325310230255127), - COEF_CONST(0.278519600629807), COEF_CONST(0.231058135628700), - COEF_CONST(0.183039888739586), COEF_CONST(0.134580686688423), - COEF_CONST(0.085797272622585), COEF_CONST(0.036807164549828), - COEF_CONST(-1.012196302413940), COEF_CONST(-1.059438824653626), - COEF_CONST(-1.104129195213318), COEF_CONST(-1.146159529685974), - COEF_CONST(-1.185428738594055), COEF_CONST(-1.221842169761658), - COEF_CONST(-1.255311965942383), COEF_CONST(-1.285757660865784), - COEF_CONST(-1.313105940818787), COEF_CONST(-1.337290763854981), - COEF_CONST(-1.358253836631775), COEF_CONST(-1.375944852828980), - COEF_CONST(-1.390321016311646), COEF_CONST(-1.401347875595093), - COEF_CONST(-1.408998727798462), COEF_CONST(-1.413255214691162), - COEF_CONST(-1.414107084274292), COEF_CONST(-1.411552190780640), - COEF_CONST(-1.405596733093262), COEF_CONST(-1.396255016326904), - COEF_CONST(-1.383549690246582), COEF_CONST(-1.367511272430420), - COEF_CONST(-1.348178386688232), COEF_CONST(-1.325597524642944), - COEF_CONST(-1.299823284149170), COEF_CONST(-1.270917654037476), - COEF_CONST(-1.238950133323669), COEF_CONST(-1.203998088836670), - COEF_CONST(-1.166145324707031), COEF_CONST(-1.125483393669128), - COEF_CONST(-1.082109928131104), COEF_CONST(-1.036129593849182), - COEF_CONST(-0.987653195858002), COEF_CONST(-0.936797380447388), - COEF_CONST(-0.883684754371643), COEF_CONST(-0.828443288803101), - COEF_CONST(-0.771206021308899), COEF_CONST(-0.712110757827759), - COEF_CONST(-0.651300072669983), COEF_CONST(-0.588920354843140), - COEF_CONST(-0.525121808052063), COEF_CONST(-0.460058242082596), - COEF_CONST(-0.393886327743530), COEF_CONST(-0.326765477657318), - COEF_CONST(-0.258857429027557), COEF_CONST(-0.190325915813446), - COEF_CONST(-0.121335685253143), COEF_CONST(-0.052053272724152), - COEF_CONST(0.017354607582092), COEF_CONST(0.086720645427704), - COEF_CONST(0.155877828598022), COEF_CONST(0.224659323692322), - COEF_CONST(0.292899727821350), COEF_CONST(0.360434412956238), - COEF_CONST(0.427100926637650), COEF_CONST(0.492738455533981), - COEF_CONST(0.557188928127289), COEF_CONST(0.620297133922577), - COEF_CONST(0.681910991668701), COEF_CONST(0.741881847381592), - COEF_CONST(0.800065577030182), COEF_CONST(0.856321990489960), - COEF_CONST(0.910515367984772), COEF_CONST(0.962515234947205), - COEF_CONST(1.000000000000000), COEF_CONST(0.998795449733734), - COEF_CONST(0.995184719562531), COEF_CONST(0.989176511764526), - COEF_CONST(0.980785250663757), COEF_CONST(0.970031261444092), - COEF_CONST(0.956940352916718), COEF_CONST(0.941544055938721), - COEF_CONST(0.923879504203796), COEF_CONST(0.903989315032959), - COEF_CONST(0.881921231746674), COEF_CONST(0.857728600502014), - COEF_CONST(0.831469595432281), COEF_CONST(0.803207516670227), - COEF_CONST(0.773010432720184), COEF_CONST(0.740951120853424), - COEF_CONST(0.707106769084930), COEF_CONST(0.671558916568756), - COEF_CONST(0.634393274784088), COEF_CONST(0.595699310302734), - COEF_CONST(0.555570185184479), COEF_CONST(0.514102697372437), - COEF_CONST(0.471396654844284), COEF_CONST(0.427555114030838), - COEF_CONST(0.382683426141739), COEF_CONST(0.336889833211899), - COEF_CONST(0.290284633636475), COEF_CONST(0.242980122566223), - COEF_CONST(0.195090234279633), COEF_CONST(0.146730497479439), - COEF_CONST(0.098017133772373), COEF_CONST(0.049067649990320), - COEF_CONST(-1.000000000000000), COEF_CONST(-1.047863125801086), - COEF_CONST(-1.093201875686646), COEF_CONST(-1.135906934738159), - COEF_CONST(-1.175875544548035), COEF_CONST(-1.213011503219605), - COEF_CONST(-1.247225046157837), COEF_CONST(-1.278433918952942), - COEF_CONST(-1.306562900543213), COEF_CONST(-1.331544399261475), - COEF_CONST(-1.353317975997925), COEF_CONST(-1.371831417083740), - COEF_CONST(-1.387039899826050), COEF_CONST(-1.398906826972961), - COEF_CONST(-1.407403707504273), COEF_CONST(-1.412510156631470), - COEF_CONST(0), COEF_CONST(-1.412510156631470), - COEF_CONST(-1.407403707504273), COEF_CONST(-1.398906826972961), - COEF_CONST(-1.387039899826050), COEF_CONST(-1.371831417083740), - COEF_CONST(-1.353317975997925), COEF_CONST(-1.331544399261475), - COEF_CONST(-1.306562900543213), COEF_CONST(-1.278433918952942), - COEF_CONST(-1.247225046157837), COEF_CONST(-1.213011384010315), - COEF_CONST(-1.175875544548035), COEF_CONST(-1.135907053947449), - COEF_CONST(-1.093201875686646), COEF_CONST(-1.047863125801086), - COEF_CONST(-1.000000000000000), COEF_CONST(-0.949727773666382), - COEF_CONST(-0.897167563438416), COEF_CONST(-0.842446029186249), - COEF_CONST(-0.785694956779480), COEF_CONST(-0.727051079273224), - COEF_CONST(-0.666655659675598), COEF_CONST(-0.604654192924500), - COEF_CONST(-0.541196048259735), COEF_CONST(-0.476434230804443), - COEF_CONST(-0.410524487495422), COEF_CONST(-0.343625843524933), - COEF_CONST(-0.275899350643158), COEF_CONST(-0.207508206367493), - COEF_CONST(-0.138617098331451), COEF_CONST(-0.069392144680023), - COEF_CONST(0), COEF_CONST(0.069392263889313), - COEF_CONST(0.138617157936096), COEF_CONST(0.207508206367493), - COEF_CONST(0.275899469852448), COEF_CONST(0.343625962734222), - COEF_CONST(0.410524636507034), COEF_CONST(0.476434201002121), - COEF_CONST(0.541196107864380), COEF_CONST(0.604654192924500), - COEF_CONST(0.666655719280243), COEF_CONST(0.727051138877869), - COEF_CONST(0.785695075988770), COEF_CONST(0.842446029186249), - COEF_CONST(0.897167563438416), COEF_CONST(0.949727773666382) -}; - -/* size 64 only! */ -void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag) -{ - // Tables with bit reverse values for 5 bits, bit reverse of i at i-th position - const uint8_t bit_rev_tab[32] = { 0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31 }; - uint16_t i, i_rev; - - /* Step 2: modulate */ - // 3*32=96 multiplications - // 3*32=96 additions - for (i = 0; i < 32; i++) - { - real_t x_re, x_im, tmp; - x_re = in_real[i]; - x_im = in_imag[i]; - tmp = MUL_C(x_re + x_im, dct4_64_tab[i]); - in_real[i] = MUL_C(x_im, dct4_64_tab[i + 64]) + tmp; - in_imag[i] = MUL_C(x_re, dct4_64_tab[i + 32]) + tmp; - } - - /* Step 3: FFT, but with output in bit reverse order */ - fft_dif(in_real, in_imag); - - /* Step 4: modulate + bitreverse reordering */ - // 3*31+2=95 multiplications - // 3*31+2=95 additions - for (i = 0; i < 16; i++) - { - real_t x_re, x_im, tmp; - i_rev = bit_rev_tab[i]; - x_re = in_real[i_rev]; - x_im = in_imag[i_rev]; - - tmp = MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]); - out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp; - out_imag[i] = MUL_C(x_re, dct4_64_tab[i + 4*32]) + tmp; - } - // i = 16, i_rev = 1 = rev(16); - out_imag[16] = MUL_C(in_imag[1] - in_real[1], dct4_64_tab[16 + 3*32]); - out_real[16] = MUL_C(in_real[1] + in_imag[1], dct4_64_tab[16 + 3*32]); - for (i = 17; i < 32; i++) - { - real_t x_re, x_im, tmp; - i_rev = bit_rev_tab[i]; - x_re = in_real[i_rev]; - x_im = in_imag[i_rev]; - tmp = MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]); - out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp; - out_imag[i] = MUL_C(x_re, dct4_64_tab[i + 4*32]) + tmp; - } - -} - -void DST4_32(real_t *y, real_t *x) -{ - real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9; - real_t f10, f11, f12, f13, f14, f15, f16, f17, f18, f19; - real_t f20, f21, f22, f23, f24, f25, f26, f27, f28, f29; - real_t f30, f31, f32, f33, f34, f35, f36, f37, f38, f39; - real_t f40, f41, f42, f43, f44, f45, f46, f47, f48, f49; - real_t f50, f51, f52, f53, f54, f55, f56, f57, f58, f59; - real_t f60, f61, f62, f63, f64, f65, f66, f67, f68, f69; - real_t f70, f71, f72, f73, f74, f75, f76, f77, f78, f79; - real_t f80, f81, f82, f83, f84, f85, f86, f87, f88, f89; - real_t f90, f91, f92, f93, f94, f95, f96, f97, f98, f99; - real_t f100, f101, f102, f103, f104, f105, f106, f107, f108, f109; - real_t f110, f111, f112, f113, f114, f115, f116, f117, f118, f119; - real_t f120, f121, f122, f123, f124, f125, f126, f127, f128, f129; - real_t f130, f131, f132, f133, f134, f135, f136, f137, f138, f139; - real_t f140, f141, f142, f143, f144, f145, f146, f147, f148, f149; - real_t f150, f151, f152, f153, f154, f155, f156, f157, f158, f159; - real_t f160, f161, f162, f163, f164, f165, f166, f167, f168, f169; - real_t f170, f171, f172, f173, f174, f175, f176, f177, f178, f179; - real_t f180, f181, f182, f183, f184, f185, f186, f187, f188, f189; - real_t f190, f191, f192, f193, f194, f195, f196, f197, f198, f199; - real_t f200, f201, f202, f203, f204, f205, f206, f207, f208, f209; - real_t f210, f211, f212, f213, f214, f215, f216, f217, f218, f219; - real_t f220, f221, f222, f223, f224, f225, f226, f227, f228, f229; - real_t f230, f231, f232, f233, f234, f235, f236, f237, f238, f239; - real_t f240, f241, f242, f243, f244, f245, f246, f247, f248, f249; - real_t f250, f251, f252, f253, f254, f255, f256, f257, f258, f259; - real_t f260, f261, f262, f263, f264, f265, f266, f267, f268, f269; - real_t f270, f271, f272, f273, f274, f275, f276, f277, f278, f279; - real_t f280, f281, f282, f283, f284, f285, f286, f287, f288, f289; - real_t f290, f291, f292, f293, f294, f295, f296, f297, f298, f299; - real_t f300, f301, f302, f303, f304, f305, f306, f307, f308, f309; - real_t f310, f311, f312, f313, f314, f315, f316, f317, f318, f319; - real_t f320, f321, f322, f323, f324, f325, f326, f327, f328, f329; - real_t f330, f331, f332, f333, f334, f335; - - f0 = x[0] - x[1]; - f1 = x[2] - x[1]; - f2 = x[2] - x[3]; - f3 = x[4] - x[3]; - f4 = x[4] - x[5]; - f5 = x[6] - x[5]; - f6 = x[6] - x[7]; - f7 = x[8] - x[7]; - f8 = x[8] - x[9]; - f9 = x[10] - x[9]; - f10 = x[10] - x[11]; - f11 = x[12] - x[11]; - f12 = x[12] - x[13]; - f13 = x[14] - x[13]; - f14 = x[14] - x[15]; - f15 = x[16] - x[15]; - f16 = x[16] - x[17]; - f17 = x[18] - x[17]; - f18 = x[18] - x[19]; - f19 = x[20] - x[19]; - f20 = x[20] - x[21]; - f21 = x[22] - x[21]; - f22 = x[22] - x[23]; - f23 = x[24] - x[23]; - f24 = x[24] - x[25]; - f25 = x[26] - x[25]; - f26 = x[26] - x[27]; - f27 = x[28] - x[27]; - f28 = x[28] - x[29]; - f29 = x[30] - x[29]; - f30 = x[30] - x[31]; - f31 = MUL_F(FRAC_CONST(0.7071067811865476), f15); - f32 = x[0] - f31; - f33 = x[0] + f31; - f34 = f7 + f23; - f35 = MUL_C(COEF_CONST(1.3065629648763766), f7); - f36 = MUL_F(FRAC_CONST(-0.9238795325112866), f34); - f37 = MUL_F(FRAC_CONST(-0.5411961001461967), f23); - f38 = f35 + f36; - f39 = f37 - f36; - f40 = f33 - f39; - f41 = f33 + f39; - f42 = f32 - f38; - f43 = f32 + f38; - f44 = f11 - f19; - f45 = f11 + f19; - f46 = MUL_F(FRAC_CONST(0.7071067811865476), f45); - f47 = f3 - f46; - f48 = f3 + f46; - f49 = MUL_F(FRAC_CONST(0.7071067811865476), f44); - f50 = f49 - f27; - f51 = f49 + f27; - f52 = f51 + f48; - f53 = MUL_F(FRAC_CONST(-0.7856949583871021), f51); - f54 = MUL_F(FRAC_CONST(0.9807852804032304), f52); - f55 = MUL_C(COEF_CONST(1.1758756024193588), f48); - f56 = f53 + f54; - f57 = f55 - f54; - f58 = f50 + f47; - f59 = MUL_F(FRAC_CONST(-0.2758993792829430), f50); - f60 = MUL_F(FRAC_CONST(0.8314696123025452), f58); - f61 = MUL_C(COEF_CONST(1.3870398453221475), f47); - f62 = f59 + f60; - f63 = f61 - f60; - f64 = f41 - f56; - f65 = f41 + f56; - f66 = f43 - f62; - f67 = f43 + f62; - f68 = f42 - f63; - f69 = f42 + f63; - f70 = f40 - f57; - f71 = f40 + f57; - f72 = f5 - f9; - f73 = f5 + f9; - f74 = f13 - f17; - f75 = f13 + f17; - f76 = f21 - f25; - f77 = f21 + f25; - f78 = MUL_F(FRAC_CONST(0.7071067811865476), f75); - f79 = f1 - f78; - f80 = f1 + f78; - f81 = f73 + f77; - f82 = MUL_C(COEF_CONST(1.3065629648763766), f73); - f83 = MUL_F(FRAC_CONST(-0.9238795325112866), f81); - f84 = MUL_F(FRAC_CONST(-0.5411961001461967), f77); - f85 = f82 + f83; - f86 = f84 - f83; - f87 = f80 - f86; - f88 = f80 + f86; - f89 = f79 - f85; - f90 = f79 + f85; - f91 = MUL_F(FRAC_CONST(0.7071067811865476), f74); - f92 = f29 - f91; - f93 = f29 + f91; - f94 = f76 + f72; - f95 = MUL_C(COEF_CONST(1.3065629648763766), f76); - f96 = MUL_F(FRAC_CONST(-0.9238795325112866), f94); - f97 = MUL_F(FRAC_CONST(-0.5411961001461967), f72); - f98 = f95 + f96; - f99 = f97 - f96; - f100 = f93 - f99; - f101 = f93 + f99; - f102 = f92 - f98; - f103 = f92 + f98; - f104 = f101 + f88; - f105 = MUL_F(FRAC_CONST(-0.8971675863426361), f101); - f106 = MUL_F(FRAC_CONST(0.9951847266721968), f104); - f107 = MUL_C(COEF_CONST(1.0932018670017576), f88); - f108 = f105 + f106; - f109 = f107 - f106; - f110 = f90 - f103; - f111 = MUL_F(FRAC_CONST(-0.6666556584777466), f103); - f112 = MUL_F(FRAC_CONST(0.9569403357322089), f110); - f113 = MUL_C(COEF_CONST(1.2472250129866713), f90); - f114 = f112 - f111; - f115 = f113 - f112; - f116 = f102 + f89; - f117 = MUL_F(FRAC_CONST(-0.4105245275223571), f102); - f118 = MUL_F(FRAC_CONST(0.8819212643483549), f116); - f119 = MUL_C(COEF_CONST(1.3533180011743529), f89); - f120 = f117 + f118; - f121 = f119 - f118; - f122 = f87 - f100; - f123 = MUL_F(FRAC_CONST(-0.1386171691990915), f100); - f124 = MUL_F(FRAC_CONST(0.7730104533627370), f122); - f125 = MUL_C(COEF_CONST(1.4074037375263826), f87); - f126 = f124 - f123; - f127 = f125 - f124; - f128 = f65 - f108; - f129 = f65 + f108; - f130 = f67 - f114; - f131 = f67 + f114; - f132 = f69 - f120; - f133 = f69 + f120; - f134 = f71 - f126; - f135 = f71 + f126; - f136 = f70 - f127; - f137 = f70 + f127; - f138 = f68 - f121; - f139 = f68 + f121; - f140 = f66 - f115; - f141 = f66 + f115; - f142 = f64 - f109; - f143 = f64 + f109; - f144 = f0 + f30; - f145 = MUL_C(COEF_CONST(1.0478631305325901), f0); - f146 = MUL_F(FRAC_CONST(-0.9987954562051724), f144); - f147 = MUL_F(FRAC_CONST(-0.9497277818777548), f30); - f148 = f145 + f146; - f149 = f147 - f146; - f150 = f4 + f26; - f151 = MUL_F(FRAC_CONST(1.2130114330978077), f4); - f152 = MUL_F(FRAC_CONST(-0.9700312531945440), f150); - f153 = MUL_F(FRAC_CONST(-0.7270510732912803), f26); - f154 = f151 + f152; - f155 = f153 - f152; - f156 = f8 + f22; - f157 = MUL_C(COEF_CONST(1.3315443865537255), f8); - f158 = MUL_F(FRAC_CONST(-0.9039892931234433), f156); - f159 = MUL_F(FRAC_CONST(-0.4764341996931612), f22); - f160 = f157 + f158; - f161 = f159 - f158; - f162 = f12 + f18; - f163 = MUL_C(COEF_CONST(1.3989068359730781), f12); - f164 = MUL_F(FRAC_CONST(-0.8032075314806453), f162); - f165 = MUL_F(FRAC_CONST(-0.2075082269882124), f18); - f166 = f163 + f164; - f167 = f165 - f164; - f168 = f16 + f14; - f169 = MUL_C(COEF_CONST(1.4125100802019777), f16); - f170 = MUL_F(FRAC_CONST(-0.6715589548470187), f168); - f171 = MUL_F(FRAC_CONST(0.0693921705079402), f14); - f172 = f169 + f170; - f173 = f171 - f170; - f174 = f20 + f10; - f175 = MUL_C(COEF_CONST(1.3718313541934939), f20); - f176 = MUL_F(FRAC_CONST(-0.5141027441932219), f174); - f177 = MUL_F(FRAC_CONST(0.3436258658070501), f10); - f178 = f175 + f176; - f179 = f177 - f176; - f180 = f24 + f6; - f181 = MUL_C(COEF_CONST(1.2784339185752409), f24); - f182 = MUL_F(FRAC_CONST(-0.3368898533922200), f180); - f183 = MUL_F(FRAC_CONST(0.6046542117908008), f6); - f184 = f181 + f182; - f185 = f183 - f182; - f186 = f28 + f2; - f187 = MUL_C(COEF_CONST(1.1359069844201433), f28); - f188 = MUL_F(FRAC_CONST(-0.1467304744553624), f186); - f189 = MUL_F(FRAC_CONST(0.8424460355094185), f2); - f190 = f187 + f188; - f191 = f189 - f188; - f192 = f149 - f173; - f193 = f149 + f173; - f194 = f148 - f172; - f195 = f148 + f172; - f196 = f155 - f179; - f197 = f155 + f179; - f198 = f154 - f178; - f199 = f154 + f178; - f200 = f161 - f185; - f201 = f161 + f185; - f202 = f160 - f184; - f203 = f160 + f184; - f204 = f167 - f191; - f205 = f167 + f191; - f206 = f166 - f190; - f207 = f166 + f190; - f208 = f192 + f194; - f209 = MUL_C(COEF_CONST(1.1758756024193588), f192); - f210 = MUL_F(FRAC_CONST(-0.9807852804032304), f208); - f211 = MUL_F(FRAC_CONST(-0.7856949583871021), f194); - f212 = f209 + f210; - f213 = f211 - f210; - f214 = f196 + f198; - f215 = MUL_C(COEF_CONST(1.3870398453221475), f196); - f216 = MUL_F(FRAC_CONST(-0.5555702330196022), f214); - f217 = MUL_F(FRAC_CONST(0.2758993792829431), f198); - f218 = f215 + f216; - f219 = f217 - f216; - f220 = f200 + f202; - f221 = MUL_F(FRAC_CONST(0.7856949583871022), f200); - f222 = MUL_F(FRAC_CONST(0.1950903220161283), f220); - f223 = MUL_C(COEF_CONST(1.1758756024193586), f202); - f224 = f221 + f222; - f225 = f223 - f222; - f226 = f204 + f206; - f227 = MUL_F(FRAC_CONST(-0.2758993792829430), f204); - f228 = MUL_F(FRAC_CONST(0.8314696123025452), f226); - f229 = MUL_C(COEF_CONST(1.3870398453221475), f206); - f230 = f227 + f228; - f231 = f229 - f228; - f232 = f193 - f201; - f233 = f193 + f201; - f234 = f195 - f203; - f235 = f195 + f203; - f236 = f197 - f205; - f237 = f197 + f205; - f238 = f199 - f207; - f239 = f199 + f207; - f240 = f213 - f225; - f241 = f213 + f225; - f242 = f212 - f224; - f243 = f212 + f224; - f244 = f219 - f231; - f245 = f219 + f231; - f246 = f218 - f230; - f247 = f218 + f230; - f248 = f232 + f234; - f249 = MUL_C(COEF_CONST(1.3065629648763766), f232); - f250 = MUL_F(FRAC_CONST(-0.9238795325112866), f248); - f251 = MUL_F(FRAC_CONST(-0.5411961001461967), f234); - f252 = f249 + f250; - f253 = f251 - f250; - f254 = f236 + f238; - f255 = MUL_F(FRAC_CONST(0.5411961001461969), f236); - f256 = MUL_F(FRAC_CONST(0.3826834323650898), f254); - f257 = MUL_C(COEF_CONST(1.3065629648763766), f238); - f258 = f255 + f256; - f259 = f257 - f256; - f260 = f240 + f242; - f261 = MUL_C(COEF_CONST(1.3065629648763766), f240); - f262 = MUL_F(FRAC_CONST(-0.9238795325112866), f260); - f263 = MUL_F(FRAC_CONST(-0.5411961001461967), f242); - f264 = f261 + f262; - f265 = f263 - f262; - f266 = f244 + f246; - f267 = MUL_F(FRAC_CONST(0.5411961001461969), f244); - f268 = MUL_F(FRAC_CONST(0.3826834323650898), f266); - f269 = MUL_C(COEF_CONST(1.3065629648763766), f246); - f270 = f267 + f268; - f271 = f269 - f268; - f272 = f233 - f237; - f273 = f233 + f237; - f274 = f235 - f239; - f275 = f235 + f239; - f276 = f253 - f259; - f277 = f253 + f259; - f278 = f252 - f258; - f279 = f252 + f258; - f280 = f241 - f245; - f281 = f241 + f245; - f282 = f243 - f247; - f283 = f243 + f247; - f284 = f265 - f271; - f285 = f265 + f271; - f286 = f264 - f270; - f287 = f264 + f270; - f288 = f272 - f274; - f289 = f272 + f274; - f290 = MUL_F(FRAC_CONST(0.7071067811865474), f288); - f291 = MUL_F(FRAC_CONST(0.7071067811865474), f289); - f292 = f276 - f278; - f293 = f276 + f278; - f294 = MUL_F(FRAC_CONST(0.7071067811865474), f292); - f295 = MUL_F(FRAC_CONST(0.7071067811865474), f293); - f296 = f280 - f282; - f297 = f280 + f282; - f298 = MUL_F(FRAC_CONST(0.7071067811865474), f296); - f299 = MUL_F(FRAC_CONST(0.7071067811865474), f297); - f300 = f284 - f286; - f301 = f284 + f286; - f302 = MUL_F(FRAC_CONST(0.7071067811865474), f300); - f303 = MUL_F(FRAC_CONST(0.7071067811865474), f301); - f304 = f129 - f273; - f305 = f129 + f273; - f306 = f131 - f281; - f307 = f131 + f281; - f308 = f133 - f285; - f309 = f133 + f285; - f310 = f135 - f277; - f311 = f135 + f277; - f312 = f137 - f295; - f313 = f137 + f295; - f314 = f139 - f303; - f315 = f139 + f303; - f316 = f141 - f299; - f317 = f141 + f299; - f318 = f143 - f291; - f319 = f143 + f291; - f320 = f142 - f290; - f321 = f142 + f290; - f322 = f140 - f298; - f323 = f140 + f298; - f324 = f138 - f302; - f325 = f138 + f302; - f326 = f136 - f294; - f327 = f136 + f294; - f328 = f134 - f279; - f329 = f134 + f279; - f330 = f132 - f287; - f331 = f132 + f287; - f332 = f130 - f283; - f333 = f130 + f283; - f334 = f128 - f275; - f335 = f128 + f275; - y[31] = MUL_F(FRAC_CONST(0.5001506360206510), f305); - y[30] = MUL_F(FRAC_CONST(0.5013584524464084), f307); - y[29] = MUL_F(FRAC_CONST(0.5037887256810443), f309); - y[28] = MUL_F(FRAC_CONST(0.5074711720725553), f311); - y[27] = MUL_F(FRAC_CONST(0.5124514794082247), f313); - y[26] = MUL_F(FRAC_CONST(0.5187927131053328), f315); - y[25] = MUL_F(FRAC_CONST(0.5265773151542700), f317); - y[24] = MUL_F(FRAC_CONST(0.5359098169079920), f319); - y[23] = MUL_F(FRAC_CONST(0.5469204379855088), f321); - y[22] = MUL_F(FRAC_CONST(0.5597698129470802), f323); - y[21] = MUL_F(FRAC_CONST(0.5746551840326600), f325); - y[20] = MUL_F(FRAC_CONST(0.5918185358574165), f327); - y[19] = MUL_F(FRAC_CONST(0.6115573478825099), f329); - y[18] = MUL_F(FRAC_CONST(0.6342389366884031), f331); - y[17] = MUL_F(FRAC_CONST(0.6603198078137061), f333); - y[16] = MUL_F(FRAC_CONST(0.6903721282002123), f335); - y[15] = MUL_F(FRAC_CONST(0.7251205223771985), f334); - y[14] = MUL_F(FRAC_CONST(0.7654941649730891), f332); - y[13] = MUL_F(FRAC_CONST(0.8127020908144905), f330); - y[12] = MUL_F(FRAC_CONST(0.8683447152233481), f328); - y[11] = MUL_F(FRAC_CONST(0.9345835970364075), f326); - y[10] = MUL_C(COEF_CONST(1.0144082649970547), f324); - y[9] = MUL_C(COEF_CONST(1.1120716205797176), f322); - y[8] = MUL_C(COEF_CONST(1.2338327379765710), f320); - y[7] = MUL_C(COEF_CONST(1.3892939586328277), f318); - y[6] = MUL_C(COEF_CONST(1.5939722833856311), f316); - y[5] = MUL_C(COEF_CONST(1.8746759800084078), f314); - y[4] = MUL_C(COEF_CONST(2.2820500680051619), f312); - y[3] = MUL_C(COEF_CONST(2.9246284281582162), f310); - y[2] = MUL_C(COEF_CONST(4.0846110781292477), f308); - y[1] = MUL_C(COEF_CONST(6.7967507116736332), f306); - y[0] = MUL_R(REAL_CONST(20.3738781672314530), f304); -} - -#endif - -#endif diff --git a/mplayer/libfaad2/sbr_dct.h b/mplayer/libfaad2/sbr_dct.h deleted file mode 100644 index b77dec74..00000000 --- a/mplayer/libfaad2/sbr_dct.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_dct.h,v 1.15 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __SBR_DCT_H__ -#define __SBR_DCT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag); - -void DCT3_32_unscaled(real_t *y, real_t *x); -void DCT4_32(real_t *y, real_t *x); -void DST4_32(real_t *y, real_t *x); -void DCT2_32_unscaled(real_t *y, real_t *x); -void DCT4_16(real_t *y, real_t *x); -void DCT2_16_unscaled(real_t *y, real_t *x); - - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/mplayer/libfaad2/sbr_dec.c b/mplayer/libfaad2/sbr_dec.c deleted file mode 100644 index 286a1680..00000000 --- a/mplayer/libfaad2/sbr_dec.c +++ /dev/null @@ -1,617 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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 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. -**/ - - -#include "common.h" -#include "structs.h" - -#ifdef SBR_DEC - -#include -#include - -#include "syntax.h" -#include "bits.h" -#include "sbr_syntax.h" -#include "sbr_qmf.h" -#include "sbr_hfgen.h" -#include "sbr_hfadj.h" - - -/* static function declarations */ -static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch); -static void sbr_save_matrix(sbr_info *sbr, uint8_t ch); - - -sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, - uint32_t sample_rate, uint8_t downSampledSBR -#ifdef DRM - , uint8_t IsDRM -#endif - ) -{ - sbr_info *sbr = faad_malloc(sizeof(sbr_info)); - memset(sbr, 0, sizeof(sbr_info)); - - /* save id of the parent element */ - sbr->id_aac = id_aac; - sbr->sample_rate = sample_rate; - - sbr->bs_freq_scale = 2; - sbr->bs_alter_scale = 1; - sbr->bs_noise_bands = 2; - sbr->bs_limiter_bands = 2; - sbr->bs_limiter_gains = 2; - sbr->bs_interpol_freq = 1; - sbr->bs_smoothing_mode = 1; - sbr->bs_start_freq = 5; - sbr->bs_amp_res = 1; - sbr->bs_samplerate_mode = 1; - sbr->prevEnvIsShort[0] = -1; - sbr->prevEnvIsShort[1] = -1; - sbr->header_count = 0; - sbr->Reset = 1; - -#ifdef DRM - sbr->Is_DRM_SBR = IsDRM; -#endif - sbr->tHFGen = T_HFGEN; - sbr->tHFAdj = T_HFADJ; - - sbr->bsco = 0; - sbr->bsco_prev = 0; - sbr->M_prev = 0; - sbr->frame_len = framelength; - - /* force sbr reset */ - sbr->bs_start_freq_prev = -1; - - if (framelength == 960) - { - sbr->numTimeSlotsRate = RATE * NO_TIME_SLOTS_960; - sbr->numTimeSlots = NO_TIME_SLOTS_960; - } else { - sbr->numTimeSlotsRate = RATE * NO_TIME_SLOTS; - sbr->numTimeSlots = NO_TIME_SLOTS; - } - - sbr->GQ_ringbuf_index[0] = 0; - sbr->GQ_ringbuf_index[1] = 0; - - if (id_aac == ID_CPE) - { - /* stereo */ - uint8_t j; - sbr->qmfa[0] = qmfa_init(32); - sbr->qmfa[1] = qmfa_init(32); - sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64); - sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64); - - for (j = 0; j < 5; j++) - { - sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); - sbr->G_temp_prev[1][j] = faad_malloc(64*sizeof(real_t)); - sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); - sbr->Q_temp_prev[1][j] = faad_malloc(64*sizeof(real_t)); - } - - memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); - memset(sbr->Xsbr[1], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); - } else { - /* mono */ - uint8_t j; - sbr->qmfa[0] = qmfa_init(32); - sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64); - sbr->qmfs[1] = NULL; - - for (j = 0; j < 5; j++) - { - sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); - sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); - } - - memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); - } - - return sbr; -} - -void sbrDecodeEnd(sbr_info *sbr) -{ - uint8_t j; - - if (sbr) - { - qmfa_end(sbr->qmfa[0]); - qmfs_end(sbr->qmfs[0]); - if (sbr->qmfs[1] != NULL) - { - qmfa_end(sbr->qmfa[1]); - qmfs_end(sbr->qmfs[1]); - } - - for (j = 0; j < 5; j++) - { - if (sbr->G_temp_prev[0][j]) faad_free(sbr->G_temp_prev[0][j]); - if (sbr->Q_temp_prev[0][j]) faad_free(sbr->Q_temp_prev[0][j]); - if (sbr->G_temp_prev[1][j]) faad_free(sbr->G_temp_prev[1][j]); - if (sbr->Q_temp_prev[1][j]) faad_free(sbr->Q_temp_prev[1][j]); - } - -#ifdef PS_DEC - if (sbr->ps != NULL) - ps_free(sbr->ps); -#endif - -#ifdef DRM_PS - if (sbr->drm_ps != NULL) - drm_ps_free(sbr->drm_ps); -#endif - - faad_free(sbr); - } -} - -static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch) -{ - uint8_t i; - - /* save data for next frame */ - sbr->kx_prev = sbr->kx; - sbr->M_prev = sbr->M; - sbr->bsco_prev = sbr->bsco; - - sbr->L_E_prev[ch] = sbr->L_E[ch]; - - /* sbr->L_E[ch] can become 0 on files with bit errors */ - if (sbr->L_E[ch] <= 0) - return 19; - - sbr->f_prev[ch] = sbr->f[ch][sbr->L_E[ch] - 1]; - for (i = 0; i < MAX_M; i++) - { - sbr->E_prev[ch][i] = sbr->E[ch][i][sbr->L_E[ch] - 1]; - sbr->Q_prev[ch][i] = sbr->Q[ch][i][sbr->L_Q[ch] - 1]; - } - - for (i = 0; i < MAX_M; i++) - { - sbr->bs_add_harmonic_prev[ch][i] = sbr->bs_add_harmonic[ch][i]; - } - sbr->bs_add_harmonic_flag_prev[ch] = sbr->bs_add_harmonic_flag[ch]; - - if (sbr->l_A[ch] == sbr->L_E[ch]) - sbr->prevEnvIsShort[ch] = 0; - else - sbr->prevEnvIsShort[ch] = -1; - - return 0; -} - -static void sbr_save_matrix(sbr_info *sbr, uint8_t ch) -{ - uint8_t i; - - for (i = 0; i < sbr->tHFGen; i++) - { - memmove(sbr->Xsbr[ch][i], sbr->Xsbr[ch][i+sbr->numTimeSlotsRate], 64 * sizeof(qmf_t)); - } - for (i = sbr->tHFGen; i < MAX_NTSRHFG; i++) - { - memset(sbr->Xsbr[ch][i], 0, 64 * sizeof(qmf_t)); - } -} - -static void sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[MAX_NTSR][64], - uint8_t ch, uint8_t dont_process, - const uint8_t downSampledSBR) -{ - int16_t k, l; - -#ifdef SBR_LOW_POWER - ALIGN real_t deg[64]; -#endif - -#ifdef DRM - if (sbr->Is_DRM_SBR) - { - sbr->bsco = max((int32_t)sbr->maxAACLine*32/(int32_t)sbr->frame_len - (int32_t)sbr->kx, 0); - } else { -#endif - sbr->bsco = 0; -#ifdef DRM - } -#endif - - -//#define PRE_QMF_PRINT -#ifdef PRE_QMF_PRINT - { - int i; - for (i = 0; i < 1024; i++) - { - printf("%d\n", channel_buf[i]); - } - } -#endif - - - /* subband analysis */ - if (dont_process) - sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, 32); - else - sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, sbr->kx); - - if (!dont_process) - { -#if 1 - /* insert high frequencies here */ - /* hf generation using patching */ - hf_generation(sbr, sbr->Xsbr[ch], sbr->Xsbr[ch] -#ifdef SBR_LOW_POWER - ,deg -#endif - ,ch); -#endif - -#ifdef SBR_LOW_POWER - for (l = sbr->t_E[ch][0]; l < sbr->t_E[ch][sbr->L_E[ch]]; l++) - { - for (k = 0; k < sbr->kx; k++) - { - QMF_RE(sbr->Xsbr[ch][sbr->tHFAdj + l][k]) = 0; - } - } -#endif - -#if 1 - /* hf adjustment */ - hf_adjustment(sbr, sbr->Xsbr[ch] -#ifdef SBR_LOW_POWER - ,deg -#endif - ,ch); -#endif - } - - if ((sbr->just_seeked != 0) || dont_process) - { - for (l = 0; l < sbr->numTimeSlotsRate; l++) - { - for (k = 0; k < 32; k++) - { - QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); -#ifndef SBR_LOW_POWER - QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); -#endif - } - for (k = 32; k < 64; k++) - { - QMF_RE(X[l][k]) = 0; -#ifndef SBR_LOW_POWER - QMF_IM(X[l][k]) = 0; -#endif - } - } - } else { - for (l = 0; l < sbr->numTimeSlotsRate; l++) - { - uint8_t kx_band, M_band, bsco_band; - - if (l < sbr->t_E[ch][0]) - { - kx_band = sbr->kx_prev; - M_band = sbr->M_prev; - bsco_band = sbr->bsco_prev; - } else { - kx_band = sbr->kx; - M_band = sbr->M; - bsco_band = sbr->bsco; - } - -#ifndef SBR_LOW_POWER - for (k = 0; k < kx_band + bsco_band; k++) - { - QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); - QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); - } - for (k = kx_band + bsco_band; k < kx_band + M_band; k++) - { - QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); - QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); - } - for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++) - { - QMF_RE(X[l][k]) = 0; - QMF_IM(X[l][k]) = 0; - } -#else - for (k = 0; k < kx_band + bsco_band; k++) - { - QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); - } - for (k = kx_band + bsco_band; k < min(kx_band + M_band, 63); k++) - { - QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); - } - for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++) - { - QMF_RE(X[l][k]) = 0; - } - QMF_RE(X[l][kx_band - 1 + bsco_band]) += - QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][kx_band - 1 + bsco_band]); -#endif - } - } -} - -uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan, - const uint8_t just_seeked, const uint8_t downSampledSBR) -{ - uint8_t dont_process = 0; - uint8_t ret = 0; - ALIGN qmf_t X[MAX_NTSR][64]; - - if (sbr == NULL) - return 20; - - /* case can occur due to bit errors */ - if (sbr->id_aac != ID_CPE) - return 21; - - if (sbr->ret || (sbr->header_count == 0)) - { - /* don't process just upsample */ - dont_process = 1; - - /* Re-activate reset for next frame */ - if (sbr->ret && sbr->Reset) - sbr->bs_start_freq_prev = -1; - } - - if (just_seeked) - { - sbr->just_seeked = 1; - } else { - sbr->just_seeked = 0; - } - - sbr_process_channel(sbr, left_chan, X, 0, dont_process, downSampledSBR); - /* subband synthesis */ - if (downSampledSBR) - { - sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, left_chan); - } else { - sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, left_chan); - } - - sbr_process_channel(sbr, right_chan, X, 1, dont_process, downSampledSBR); - /* subband synthesis */ - if (downSampledSBR) - { - sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X, right_chan); - } else { - sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X, right_chan); - } - - if (sbr->bs_header_flag) - sbr->just_seeked = 0; - - if (sbr->header_count != 0 && sbr->ret == 0) - { - ret = sbr_save_prev_data(sbr, 0); - if (ret) return ret; - ret = sbr_save_prev_data(sbr, 1); - if (ret) return ret; - } - - sbr_save_matrix(sbr, 0); - sbr_save_matrix(sbr, 1); - - sbr->frame++; - -//#define POST_QMF_PRINT -#ifdef POST_QMF_PRINT - { - int i; - for (i = 0; i < 2048; i++) - { - printf("%d\n", left_chan[i]); - } - for (i = 0; i < 2048; i++) - { - printf("%d\n", right_chan[i]); - } - } -#endif - - return 0; -} - -uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, - const uint8_t just_seeked, const uint8_t downSampledSBR) -{ - uint8_t dont_process = 0; - uint8_t ret = 0; - ALIGN qmf_t X[MAX_NTSR][64]; - - if (sbr == NULL) - return 20; - - /* case can occur due to bit errors */ - if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE) - return 21; - - if (sbr->ret || (sbr->header_count == 0)) - { - /* don't process just upsample */ - dont_process = 1; - - /* Re-activate reset for next frame */ - if (sbr->ret && sbr->Reset) - sbr->bs_start_freq_prev = -1; - } - - if (just_seeked) - { - sbr->just_seeked = 1; - } else { - sbr->just_seeked = 0; - } - - sbr_process_channel(sbr, channel, X, 0, dont_process, downSampledSBR); - /* subband synthesis */ - if (downSampledSBR) - { - sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, channel); - } else { - sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, channel); - } - - if (sbr->bs_header_flag) - sbr->just_seeked = 0; - - if (sbr->header_count != 0 && sbr->ret == 0) - { - ret = sbr_save_prev_data(sbr, 0); - if (ret) return ret; - } - - sbr_save_matrix(sbr, 0); - - sbr->frame++; - -//#define POST_QMF_PRINT -#ifdef POST_QMF_PRINT - { - int i; - for (i = 0; i < 2048; i++) - { - printf("%d\n", channel[i]); - } - } -#endif - - return 0; -} - -#if (defined(PS_DEC) || defined(DRM_PS)) -uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, - const uint8_t just_seeked, const uint8_t downSampledSBR) -{ - 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 */ - - if (sbr == NULL) - return 20; - - /* case can occur due to bit errors */ - if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE) - return 21; - - if (sbr->ret || (sbr->header_count == 0)) - { - /* don't process just upsample */ - dont_process = 1; - - /* Re-activate reset for next frame */ - if (sbr->ret && sbr->Reset) - sbr->bs_start_freq_prev = -1; - } - - if (just_seeked) - { - sbr->just_seeked = 1; - } else { - sbr->just_seeked = 0; - } - - if (sbr->qmfs[1] == NULL) - { - sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64); - } - - sbr_process_channel(sbr, left_channel, X_left, 0, dont_process, downSampledSBR); - - /* copy some extra data for PS */ - for (l = 32; l < 38; l++) - { - for (k = 0; k < 5; k++) - { - QMF_RE(X_left[l][k]) = QMF_RE(sbr->Xsbr[0][sbr->tHFAdj+l][k]); - QMF_IM(X_left[l][k]) = QMF_IM(sbr->Xsbr[0][sbr->tHFAdj+l][k]); - } - } - - /* perform parametric stereo */ -#ifdef DRM_PS - if (sbr->Is_DRM_SBR) - { - drm_ps_decode(sbr->drm_ps, (sbr->ret > 0), sbr->sample_rate, X_left, X_right); - } else { -#endif -#ifdef PS_DEC - ps_decode(sbr->ps, X_left, X_right); -#endif -#ifdef DRM_PS - } -#endif - - /* subband synthesis */ - if (downSampledSBR) - { - sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X_left, left_channel); - sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X_right, right_channel); - } else { - sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X_left, left_channel); - sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X_right, right_channel); - } - - if (sbr->bs_header_flag) - sbr->just_seeked = 0; - - if (sbr->header_count != 0 && sbr->ret == 0) - { - ret = sbr_save_prev_data(sbr, 0); - if (ret) return ret; - } - - sbr_save_matrix(sbr, 0); - - sbr->frame++; - - return 0; -} -#endif - -#endif diff --git a/mplayer/libfaad2/sbr_dec.h b/mplayer/libfaad2/sbr_dec.h deleted file mode 100644 index eab1ab1a..00000000 --- a/mplayer/libfaad2/sbr_dec.h +++ /dev/null @@ -1,249 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_dec.h,v 1.35 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __SBR_DEC_H__ -#define __SBR_DEC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef PS_DEC -#include "ps_dec.h" -#endif -#ifdef DRM_PS -#include "drm_dec.h" -#endif - -/* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. 16*2+8 */ -#define MAX_NTSRHFG 40 -#define MAX_NTSR 32 /* max number_time_slots * rate, ok for DRM and not DRM mode */ - -/* MAX_M: maximum value for M */ -#define MAX_M 49 -/* MAX_L_E: maximum value for L_E */ -#define MAX_L_E 5 - -typedef struct { - real_t *x; - int16_t x_index; - uint8_t channels; -} qmfa_info; - -typedef struct { - real_t *v; - int16_t v_index; - uint8_t channels; -} qmfs_info; - -typedef struct -{ - uint32_t sample_rate; - uint32_t maxAACLine; - - uint8_t rate; - uint8_t just_seeked; - uint8_t ret; - - uint8_t amp_res[2]; - - uint8_t k0; - uint8_t kx; - uint8_t M; - uint8_t N_master; - uint8_t N_high; - uint8_t N_low; - uint8_t N_Q; - uint8_t N_L[4]; - uint8_t n[2]; - - uint8_t f_master[64]; - uint8_t f_table_res[2][64]; - uint8_t f_table_noise[64]; - uint8_t f_table_lim[4][64]; -#ifdef SBR_LOW_POWER - uint8_t f_group[5][64]; - uint8_t N_G[5]; -#endif - - uint8_t table_map_k_to_g[64]; - - uint8_t abs_bord_lead[2]; - uint8_t abs_bord_trail[2]; - uint8_t n_rel_lead[2]; - uint8_t n_rel_trail[2]; - - uint8_t L_E[2]; - uint8_t L_E_prev[2]; - uint8_t L_Q[2]; - - uint8_t t_E[2][MAX_L_E+1]; - uint8_t t_Q[2][3]; - uint8_t f[2][MAX_L_E+1]; - uint8_t f_prev[2]; - - real_t *G_temp_prev[2][5]; - real_t *Q_temp_prev[2][5]; - int8_t GQ_ringbuf_index[2]; - - int16_t E[2][64][MAX_L_E]; - int16_t E_prev[2][64]; -#ifndef FIXED_POINT - real_t E_orig[2][64][MAX_L_E]; -#endif - real_t E_curr[2][64][MAX_L_E]; - int32_t Q[2][64][2]; -#ifndef FIXED_POINT - real_t Q_div[2][64][2]; - real_t Q_div2[2][64][2]; -#endif - int32_t Q_prev[2][64]; - - int8_t l_A[2]; - int8_t l_A_prev[2]; - - uint8_t bs_invf_mode[2][MAX_L_E]; - uint8_t bs_invf_mode_prev[2][MAX_L_E]; - real_t bwArray[2][64]; - real_t bwArray_prev[2][64]; - - uint8_t noPatches; - uint8_t patchNoSubbands[64]; - uint8_t patchStartSubband[64]; - - uint8_t bs_add_harmonic[2][64]; - uint8_t bs_add_harmonic_prev[2][64]; - - uint16_t index_noise_prev[2]; - uint8_t psi_is_prev[2]; - - uint8_t bs_start_freq_prev; - uint8_t bs_stop_freq_prev; - uint8_t bs_xover_band_prev; - uint8_t bs_freq_scale_prev; - uint8_t bs_alter_scale_prev; - uint8_t bs_noise_bands_prev; - - int8_t prevEnvIsShort[2]; - - int8_t kx_prev; - uint8_t bsco; - uint8_t bsco_prev; - uint8_t M_prev; - uint16_t frame_len; - - uint8_t Reset; - uint32_t frame; - uint32_t header_count; - - uint8_t id_aac; - qmfa_info *qmfa[2]; - qmfs_info *qmfs[2]; - - qmf_t Xsbr[2][MAX_NTSRHFG][64]; - -#ifdef DRM - uint8_t Is_DRM_SBR; -#ifdef DRM_PS - drm_ps_info *drm_ps; -#endif -#endif - - uint8_t numTimeSlotsRate; - uint8_t numTimeSlots; - uint8_t tHFGen; - uint8_t tHFAdj; - -#ifdef PS_DEC - ps_info *ps; -#endif -#if (defined(PS_DEC) || defined(DRM_PS)) - uint8_t ps_used; -#endif - - /* to get it compiling */ - /* we'll see during the coding of all the tools, whether - these are all used or not. - */ - uint8_t bs_header_flag; - uint8_t bs_crc_flag; - uint16_t bs_sbr_crc_bits; - uint8_t bs_protocol_version; - uint8_t bs_amp_res; - uint8_t bs_start_freq; - uint8_t bs_stop_freq; - uint8_t bs_xover_band; - uint8_t bs_freq_scale; - uint8_t bs_alter_scale; - uint8_t bs_noise_bands; - uint8_t bs_limiter_bands; - uint8_t bs_limiter_gains; - uint8_t bs_interpol_freq; - uint8_t bs_smoothing_mode; - uint8_t bs_samplerate_mode; - uint8_t bs_add_harmonic_flag[2]; - uint8_t bs_add_harmonic_flag_prev[2]; - uint8_t bs_extended_data; - uint8_t bs_extension_id; - uint8_t bs_extension_data; - uint8_t bs_coupling; - uint8_t bs_frame_class[2]; - uint8_t bs_rel_bord[2][9]; - uint8_t bs_rel_bord_0[2][9]; - uint8_t bs_rel_bord_1[2][9]; - uint8_t bs_pointer[2]; - uint8_t bs_abs_bord_0[2]; - uint8_t bs_abs_bord_1[2]; - uint8_t bs_num_rel_0[2]; - uint8_t bs_num_rel_1[2]; - uint8_t bs_df_env[2][9]; - uint8_t bs_df_noise[2][3]; -} sbr_info; - -sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, - uint32_t sample_rate, uint8_t downSampledSBR -#ifdef DRM - , uint8_t IsDRM -#endif - ); -void sbrDecodeEnd(sbr_info *sbr); - -uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan, - const uint8_t just_seeked, const uint8_t downSampledSBR); -uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, - const uint8_t just_seeked, const uint8_t downSampledSBR); -#if (defined(PS_DEC) || defined(DRM_PS)) -uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, - const uint8_t just_seeked, const uint8_t downSampledSBR); -#endif - - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/mplayer/libfaad2/sbr_e_nf.c b/mplayer/libfaad2/sbr_e_nf.c deleted file mode 100644 index f699897d..00000000 --- a/mplayer/libfaad2/sbr_e_nf.c +++ /dev/null @@ -1,507 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_e_nf.c,v 1.17 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#ifdef SBR_DEC - -#include - -#include "sbr_syntax.h" -#include "sbr_e_nf.h" - -void extract_envelope_data(sbr_info *sbr, uint8_t ch) -{ - uint8_t l, k; - - for (l = 0; l < sbr->L_E[ch]; l++) - { - if (sbr->bs_df_env[ch][l] == 0) - { - for (k = 1; k < sbr->n[sbr->f[ch][l]]; k++) - { - sbr->E[ch][k][l] = sbr->E[ch][k - 1][l] + sbr->E[ch][k][l]; - if (sbr->E[ch][k][l] < 0) - sbr->E[ch][k][l] = 0; - } - - } else { /* bs_df_env == 1 */ - - uint8_t g = (l == 0) ? sbr->f_prev[ch] : sbr->f[ch][l-1]; - int16_t E_prev; - - if (sbr->f[ch][l] == g) - { - for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++) - { - if (l == 0) - E_prev = sbr->E_prev[ch][k]; - else - E_prev = sbr->E[ch][k][l - 1]; - - sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l]; - } - - } else if ((g == 1) && (sbr->f[ch][l] == 0)) { - uint8_t i; - - for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++) - { - for (i = 0; i < sbr->N_high; i++) - { - if (sbr->f_table_res[HI_RES][i] == sbr->f_table_res[LO_RES][k]) - { - if (l == 0) - E_prev = sbr->E_prev[ch][i]; - else - E_prev = sbr->E[ch][i][l - 1]; - - sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l]; - } - } - } - - } else if ((g == 0) && (sbr->f[ch][l] == 1)) { - uint8_t i; - - for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++) - { - for (i = 0; i < sbr->N_low; i++) - { - if ((sbr->f_table_res[LO_RES][i] <= sbr->f_table_res[HI_RES][k]) && - (sbr->f_table_res[HI_RES][k] < sbr->f_table_res[LO_RES][i + 1])) - { - if (l == 0) - E_prev = sbr->E_prev[ch][i]; - else - E_prev = sbr->E[ch][i][l - 1]; - - sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l]; - } - } - } - } - } - } -} - -void extract_noise_floor_data(sbr_info *sbr, uint8_t ch) -{ - uint8_t l, k; - - for (l = 0; l < sbr->L_Q[ch]; l++) - { - if (sbr->bs_df_noise[ch][l] == 0) - { - for (k = 1; k < sbr->N_Q; k++) - { - sbr->Q[ch][k][l] = sbr->Q[ch][k][l] + sbr->Q[ch][k-1][l]; - } - } else { - if (l == 0) - { - for (k = 0; k < sbr->N_Q; k++) - { - sbr->Q[ch][k][l] = sbr->Q_prev[ch][k] + sbr->Q[ch][k][0]; - } - } else { - for (k = 0; k < sbr->N_Q; k++) - { - sbr->Q[ch][k][l] = sbr->Q[ch][k][l - 1] + sbr->Q[ch][k][l]; - } - } - } - } -} - -#ifndef FIXED_POINT - -/* table for Q_div values when no coupling */ -static const real_t Q_div_tab[31] = { - FRAC_CONST(0.0153846), FRAC_CONST(0.030303), - FRAC_CONST(0.0588235), FRAC_CONST(0.111111), - FRAC_CONST(0.2), FRAC_CONST(0.333333), - FRAC_CONST(0.5), FRAC_CONST(0.666667), - FRAC_CONST(0.8), FRAC_CONST(0.888889), - FRAC_CONST(0.941176), FRAC_CONST(0.969697), - FRAC_CONST(0.984615), FRAC_CONST(0.992248), - FRAC_CONST(0.996109), FRAC_CONST(0.998051), - FRAC_CONST(0.999024), FRAC_CONST(0.999512), - FRAC_CONST(0.999756), FRAC_CONST(0.999878), - FRAC_CONST(0.999939), FRAC_CONST(0.999969), - FRAC_CONST(0.999985), FRAC_CONST(0.999992), - FRAC_CONST(0.999996), FRAC_CONST(0.999998), - FRAC_CONST(0.999999), FRAC_CONST(1), - FRAC_CONST(1), FRAC_CONST(1), - FRAC_CONST(1) -}; - -static const real_t Q_div_tab_left[31][13] = { - { FRAC_CONST(0.969704), FRAC_CONST(0.888985), FRAC_CONST(0.667532), FRAC_CONST(0.336788), FRAC_CONST(0.117241), FRAC_CONST(0.037594), FRAC_CONST(0.0153846), FRAC_CONST(0.00967118), FRAC_CONST(0.00823245), FRAC_CONST(0.00787211), FRAC_CONST(0.00778198), FRAC_CONST(0.00775945), FRAC_CONST(0.00775382) }, - { FRAC_CONST(0.984619), FRAC_CONST(0.94123), FRAC_CONST(0.800623), FRAC_CONST(0.503876), FRAC_CONST(0.209877), FRAC_CONST(0.0724638), FRAC_CONST(0.030303), FRAC_CONST(0.0191571), FRAC_CONST(0.0163305), FRAC_CONST(0.0156212), FRAC_CONST(0.0154438), FRAC_CONST(0.0153994), FRAC_CONST(0.0153883) }, - { FRAC_CONST(0.99225), FRAC_CONST(0.969726), FRAC_CONST(0.889273), FRAC_CONST(0.670103), FRAC_CONST(0.346939), FRAC_CONST(0.135135), FRAC_CONST(0.0588235), FRAC_CONST(0.037594), FRAC_CONST(0.0321361), FRAC_CONST(0.0307619), FRAC_CONST(0.0304178), FRAC_CONST(0.0303317), FRAC_CONST(0.0303102) }, - { FRAC_CONST(0.99611), FRAC_CONST(0.98463), FRAC_CONST(0.941392), FRAC_CONST(0.802469), FRAC_CONST(0.515152), FRAC_CONST(0.238095), FRAC_CONST(0.111111), FRAC_CONST(0.0724638), FRAC_CONST(0.0622711), FRAC_CONST(0.0596878), FRAC_CONST(0.0590397), FRAC_CONST(0.0588776), FRAC_CONST(0.058837) }, - { FRAC_CONST(0.998051), FRAC_CONST(0.992256), FRAC_CONST(0.969811), FRAC_CONST(0.890411), FRAC_CONST(0.68), FRAC_CONST(0.384615), FRAC_CONST(0.2), FRAC_CONST(0.135135), FRAC_CONST(0.117241), FRAC_CONST(0.112652), FRAC_CONST(0.111497), FRAC_CONST(0.111208), FRAC_CONST(0.111135) }, - { FRAC_CONST(0.999025), FRAC_CONST(0.996113), FRAC_CONST(0.984674), FRAC_CONST(0.942029), FRAC_CONST(0.809524), FRAC_CONST(0.555556), FRAC_CONST(0.333333), FRAC_CONST(0.238095), FRAC_CONST(0.209877), FRAC_CONST(0.202492), FRAC_CONST(0.200625), FRAC_CONST(0.200156), FRAC_CONST(0.200039) }, - { FRAC_CONST(0.999512), FRAC_CONST(0.998053), FRAC_CONST(0.992278), FRAC_CONST(0.970149), FRAC_CONST(0.894737), FRAC_CONST(0.714286), FRAC_CONST(0.5), FRAC_CONST(0.384615), FRAC_CONST(0.346939), FRAC_CONST(0.336788), FRAC_CONST(0.3342), FRAC_CONST(0.33355), FRAC_CONST(0.333388) }, - { FRAC_CONST(0.999756), FRAC_CONST(0.999025), FRAC_CONST(0.996124), FRAC_CONST(0.984848), FRAC_CONST(0.944444), FRAC_CONST(0.833333), FRAC_CONST(0.666667), FRAC_CONST(0.555556), FRAC_CONST(0.515152), FRAC_CONST(0.503876), FRAC_CONST(0.500975), FRAC_CONST(0.500244), FRAC_CONST(0.500061) }, - { FRAC_CONST(0.999878), FRAC_CONST(0.999512), FRAC_CONST(0.998058), FRAC_CONST(0.992366), FRAC_CONST(0.971429), FRAC_CONST(0.909091), FRAC_CONST(0.8), FRAC_CONST(0.714286), FRAC_CONST(0.68), FRAC_CONST(0.670103), FRAC_CONST(0.667532), FRAC_CONST(0.666884), FRAC_CONST(0.666721) }, - { FRAC_CONST(0.999939), FRAC_CONST(0.999756), FRAC_CONST(0.999028), FRAC_CONST(0.996169), FRAC_CONST(0.985507), FRAC_CONST(0.952381), FRAC_CONST(0.888889), FRAC_CONST(0.833333), FRAC_CONST(0.809524), FRAC_CONST(0.802469), FRAC_CONST(0.800623), FRAC_CONST(0.800156), FRAC_CONST(0.800039) }, - { FRAC_CONST(0.999969), FRAC_CONST(0.999878), FRAC_CONST(0.999514), FRAC_CONST(0.998081), FRAC_CONST(0.992701), FRAC_CONST(0.97561), FRAC_CONST(0.941176), FRAC_CONST(0.909091), FRAC_CONST(0.894737), FRAC_CONST(0.890411), FRAC_CONST(0.889273), FRAC_CONST(0.888985), FRAC_CONST(0.888913) }, - { FRAC_CONST(0.999985), FRAC_CONST(0.999939), FRAC_CONST(0.999757), FRAC_CONST(0.999039), FRAC_CONST(0.996337), FRAC_CONST(0.987654), FRAC_CONST(0.969697), FRAC_CONST(0.952381), FRAC_CONST(0.944444), FRAC_CONST(0.942029), FRAC_CONST(0.941392), FRAC_CONST(0.94123), FRAC_CONST(0.94119) }, - { FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.999878), FRAC_CONST(0.999519), FRAC_CONST(0.998165), FRAC_CONST(0.993789), FRAC_CONST(0.984615), FRAC_CONST(0.97561), FRAC_CONST(0.971429), FRAC_CONST(0.970149), FRAC_CONST(0.969811), FRAC_CONST(0.969726), FRAC_CONST(0.969704) }, - { FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.999939), FRAC_CONST(0.99976), FRAC_CONST(0.999082), FRAC_CONST(0.996885), FRAC_CONST(0.992248), FRAC_CONST(0.987654), FRAC_CONST(0.985507), FRAC_CONST(0.984848), FRAC_CONST(0.984674), FRAC_CONST(0.98463), FRAC_CONST(0.984619) }, - { FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.99988), FRAC_CONST(0.999541), FRAC_CONST(0.99844), FRAC_CONST(0.996109), FRAC_CONST(0.993789), FRAC_CONST(0.992701), FRAC_CONST(0.992366), FRAC_CONST(0.992278), FRAC_CONST(0.992256), FRAC_CONST(0.99225) }, - { FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.99994), FRAC_CONST(0.99977), FRAC_CONST(0.999219), FRAC_CONST(0.998051), FRAC_CONST(0.996885), FRAC_CONST(0.996337), FRAC_CONST(0.996169), FRAC_CONST(0.996124), FRAC_CONST(0.996113), FRAC_CONST(0.99611) }, - { FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.999885), FRAC_CONST(0.99961), FRAC_CONST(0.999024), FRAC_CONST(0.99844), FRAC_CONST(0.998165), FRAC_CONST(0.998081), FRAC_CONST(0.998058), FRAC_CONST(0.998053), FRAC_CONST(0.998051) }, - { FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.999943), FRAC_CONST(0.999805), FRAC_CONST(0.999512), FRAC_CONST(0.999219), FRAC_CONST(0.999082), FRAC_CONST(0.999039), FRAC_CONST(0.999028), FRAC_CONST(0.999025), FRAC_CONST(0.999025) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.999971), FRAC_CONST(0.999902), FRAC_CONST(0.999756), FRAC_CONST(0.99961), FRAC_CONST(0.999541), FRAC_CONST(0.999519), FRAC_CONST(0.999514), FRAC_CONST(0.999512), FRAC_CONST(0.999512) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999986), FRAC_CONST(0.999951), FRAC_CONST(0.999878), FRAC_CONST(0.999805), FRAC_CONST(0.99977), FRAC_CONST(0.99976), FRAC_CONST(0.999757), FRAC_CONST(0.999756), FRAC_CONST(0.999756) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999993), FRAC_CONST(0.999976), FRAC_CONST(0.999939), FRAC_CONST(0.999902), FRAC_CONST(0.999885), FRAC_CONST(0.99988), FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.999878) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999988), FRAC_CONST(0.999969), FRAC_CONST(0.999951), FRAC_CONST(0.999943), FRAC_CONST(0.99994), FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.999939) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999994), FRAC_CONST(0.999985), FRAC_CONST(0.999976), FRAC_CONST(0.999971), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.999969) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999997), FRAC_CONST(0.999992), FRAC_CONST(0.999988), FRAC_CONST(0.999986), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999996), FRAC_CONST(0.999994), FRAC_CONST(0.999993), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999998), FRAC_CONST(0.999997), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) } -}; - -static const real_t Q_div_tab_right[31][13] = { - { FRAC_CONST(0.00775382), FRAC_CONST(0.00775945), FRAC_CONST(0.00778198), FRAC_CONST(0.00787211), FRAC_CONST(0.00823245), FRAC_CONST(0.00967118), FRAC_CONST(0.0153846), FRAC_CONST(0.037594), FRAC_CONST(0.117241), FRAC_CONST(0.336788), FRAC_CONST(0.667532), FRAC_CONST(0.888985), FRAC_CONST(0.969704) }, - { FRAC_CONST(0.0153883), FRAC_CONST(0.0153994), FRAC_CONST(0.0154438), FRAC_CONST(0.0156212), FRAC_CONST(0.0163305), FRAC_CONST(0.0191571), FRAC_CONST(0.030303), FRAC_CONST(0.0724638), FRAC_CONST(0.209877), FRAC_CONST(0.503876), FRAC_CONST(0.800623), FRAC_CONST(0.94123), FRAC_CONST(0.984619) }, - { FRAC_CONST(0.0303102), FRAC_CONST(0.0303317), FRAC_CONST(0.0304178), FRAC_CONST(0.0307619), FRAC_CONST(0.0321361), FRAC_CONST(0.037594), FRAC_CONST(0.0588235), FRAC_CONST(0.135135), FRAC_CONST(0.346939), FRAC_CONST(0.670103), FRAC_CONST(0.889273), FRAC_CONST(0.969726), FRAC_CONST(0.99225) }, - { FRAC_CONST(0.058837), FRAC_CONST(0.0588776), FRAC_CONST(0.0590397), FRAC_CONST(0.0596878), FRAC_CONST(0.0622711), FRAC_CONST(0.0724638), FRAC_CONST(0.111111), FRAC_CONST(0.238095), FRAC_CONST(0.515152), FRAC_CONST(0.802469), FRAC_CONST(0.941392), FRAC_CONST(0.98463), FRAC_CONST(0.99611) }, - { FRAC_CONST(0.111135), FRAC_CONST(0.111208), FRAC_CONST(0.111497), FRAC_CONST(0.112652), FRAC_CONST(0.117241), FRAC_CONST(0.135135), FRAC_CONST(0.2), FRAC_CONST(0.384615), FRAC_CONST(0.68), FRAC_CONST(0.890411), FRAC_CONST(0.969811), FRAC_CONST(0.992256), FRAC_CONST(0.998051) }, - { FRAC_CONST(0.200039), FRAC_CONST(0.200156), FRAC_CONST(0.200625), FRAC_CONST(0.202492), FRAC_CONST(0.209877), FRAC_CONST(0.238095), FRAC_CONST(0.333333), FRAC_CONST(0.555556), FRAC_CONST(0.809524), FRAC_CONST(0.942029), FRAC_CONST(0.984674), FRAC_CONST(0.996113), FRAC_CONST(0.999025) }, - { FRAC_CONST(0.333388), FRAC_CONST(0.33355), FRAC_CONST(0.3342), FRAC_CONST(0.336788), FRAC_CONST(0.346939), FRAC_CONST(0.384615), FRAC_CONST(0.5), FRAC_CONST(0.714286), FRAC_CONST(0.894737), FRAC_CONST(0.970149), FRAC_CONST(0.992278), FRAC_CONST(0.998053), FRAC_CONST(0.999512) }, - { FRAC_CONST(0.500061), FRAC_CONST(0.500244), FRAC_CONST(0.500975), FRAC_CONST(0.503876), FRAC_CONST(0.515152), FRAC_CONST(0.555556), FRAC_CONST(0.666667), FRAC_CONST(0.833333), FRAC_CONST(0.944444), FRAC_CONST(0.984848), FRAC_CONST(0.996124), FRAC_CONST(0.999025), FRAC_CONST(0.999756) }, - { FRAC_CONST(0.666721), FRAC_CONST(0.666884), FRAC_CONST(0.667532), FRAC_CONST(0.670103), FRAC_CONST(0.68), FRAC_CONST(0.714286), FRAC_CONST(0.8), FRAC_CONST(0.909091), FRAC_CONST(0.971429), FRAC_CONST(0.992366), FRAC_CONST(0.998058), FRAC_CONST(0.999512), FRAC_CONST(0.999878) }, - { FRAC_CONST(0.800039), FRAC_CONST(0.800156), FRAC_CONST(0.800623), FRAC_CONST(0.802469), FRAC_CONST(0.809524), FRAC_CONST(0.833333), FRAC_CONST(0.888889), FRAC_CONST(0.952381), FRAC_CONST(0.985507), FRAC_CONST(0.996169), FRAC_CONST(0.999028), FRAC_CONST(0.999756), FRAC_CONST(0.999939) }, - { FRAC_CONST(0.888913), FRAC_CONST(0.888985), FRAC_CONST(0.889273), FRAC_CONST(0.890411), FRAC_CONST(0.894737), FRAC_CONST(0.909091), FRAC_CONST(0.941176), FRAC_CONST(0.97561), FRAC_CONST(0.992701), FRAC_CONST(0.998081), FRAC_CONST(0.999514), FRAC_CONST(0.999878), FRAC_CONST(0.999969) }, - { FRAC_CONST(0.94119), FRAC_CONST(0.94123), FRAC_CONST(0.941392), FRAC_CONST(0.942029), FRAC_CONST(0.944444), FRAC_CONST(0.952381), FRAC_CONST(0.969697), FRAC_CONST(0.987654), FRAC_CONST(0.996337), FRAC_CONST(0.999039), FRAC_CONST(0.999757), FRAC_CONST(0.999939), FRAC_CONST(0.999985) }, - { FRAC_CONST(0.969704), FRAC_CONST(0.969726), FRAC_CONST(0.969811), FRAC_CONST(0.970149), FRAC_CONST(0.971429), FRAC_CONST(0.97561), FRAC_CONST(0.984615), FRAC_CONST(0.993789), FRAC_CONST(0.998165), FRAC_CONST(0.999519), FRAC_CONST(0.999878), FRAC_CONST(0.99997), FRAC_CONST(0.999992) }, - { FRAC_CONST(0.984619), FRAC_CONST(0.98463), FRAC_CONST(0.984674), FRAC_CONST(0.984848), FRAC_CONST(0.985507), FRAC_CONST(0.987654), FRAC_CONST(0.992248), FRAC_CONST(0.996885), FRAC_CONST(0.999082), FRAC_CONST(0.99976), FRAC_CONST(0.999939), FRAC_CONST(0.999985), FRAC_CONST(0.999996) }, - { FRAC_CONST(0.99225), FRAC_CONST(0.992256), FRAC_CONST(0.992278), FRAC_CONST(0.992366), FRAC_CONST(0.992701), FRAC_CONST(0.993789), FRAC_CONST(0.996109), FRAC_CONST(0.99844), FRAC_CONST(0.999541), FRAC_CONST(0.99988), FRAC_CONST(0.99997), FRAC_CONST(0.999992), FRAC_CONST(0.999998) }, - { FRAC_CONST(0.99611), FRAC_CONST(0.996113), FRAC_CONST(0.996124), FRAC_CONST(0.996169), FRAC_CONST(0.996337), FRAC_CONST(0.996885), FRAC_CONST(0.998051), FRAC_CONST(0.999219), FRAC_CONST(0.99977), FRAC_CONST(0.99994), FRAC_CONST(0.999985), FRAC_CONST(0.999996), FRAC_CONST(0.999999) }, - { FRAC_CONST(0.998051), FRAC_CONST(0.998053), FRAC_CONST(0.998058), FRAC_CONST(0.998081), FRAC_CONST(0.998165), FRAC_CONST(0.99844), FRAC_CONST(0.999024), FRAC_CONST(0.99961), FRAC_CONST(0.999885), FRAC_CONST(0.99997), FRAC_CONST(0.999992), FRAC_CONST(0.999998), FRAC_CONST(1) }, - { FRAC_CONST(0.999025), FRAC_CONST(0.999025), FRAC_CONST(0.999028), FRAC_CONST(0.999039), FRAC_CONST(0.999082), FRAC_CONST(0.999219), FRAC_CONST(0.999512), FRAC_CONST(0.999805), FRAC_CONST(0.999943), FRAC_CONST(0.999985), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1) }, - { FRAC_CONST(0.999512), FRAC_CONST(0.999512), FRAC_CONST(0.999514), FRAC_CONST(0.999519), FRAC_CONST(0.999541), FRAC_CONST(0.99961), FRAC_CONST(0.999756), FRAC_CONST(0.999902), FRAC_CONST(0.999971), FRAC_CONST(0.999992), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(0.999756), FRAC_CONST(0.999756), FRAC_CONST(0.999757), FRAC_CONST(0.99976), FRAC_CONST(0.99977), FRAC_CONST(0.999805), FRAC_CONST(0.999878), FRAC_CONST(0.999951), FRAC_CONST(0.999986), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.99988), FRAC_CONST(0.999885), FRAC_CONST(0.999902), FRAC_CONST(0.999939), FRAC_CONST(0.999976), FRAC_CONST(0.999993), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.99994), FRAC_CONST(0.999943), FRAC_CONST(0.999951), FRAC_CONST(0.999969), FRAC_CONST(0.999988), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(0.999969), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.999971), FRAC_CONST(0.999976), FRAC_CONST(0.999985), FRAC_CONST(0.999994), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999986), FRAC_CONST(0.999988), FRAC_CONST(0.999992), FRAC_CONST(0.999997), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999993), FRAC_CONST(0.999994), FRAC_CONST(0.999996), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999997), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, - { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) } -}; - -/* calculates 1/(1+Q) */ -/* [0..1] */ -real_t calc_Q_div(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l) -{ - if (sbr->bs_coupling) - { - /* left channel */ - if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) || - (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */)) - { - return 0; - } else { - /* the pan parameter is always even */ - if (ch == 0) - { - return Q_div_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1]; - } else { - return Q_div_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1]; - } - } - } else { - /* no coupling */ - if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30) - { - return 0; - } else { - return Q_div_tab[sbr->Q[ch][m][l]]; - } - } -} - -/* table for Q_div2 values when no coupling */ -static const real_t Q_div2_tab[31] = { - FRAC_CONST(0.984615), FRAC_CONST(0.969697), - FRAC_CONST(0.941176), FRAC_CONST(0.888889), - FRAC_CONST(0.8), FRAC_CONST(0.666667), - FRAC_CONST(0.5), FRAC_CONST(0.333333), - FRAC_CONST(0.2), FRAC_CONST(0.111111), - FRAC_CONST(0.0588235), FRAC_CONST(0.030303), - FRAC_CONST(0.0153846), FRAC_CONST(0.00775194), - FRAC_CONST(0.00389105), FRAC_CONST(0.00194932), - FRAC_CONST(0.00097561), FRAC_CONST(0.000488043), - FRAC_CONST(0.000244081), FRAC_CONST(0.000122055), - FRAC_CONST(6.10314E-005), FRAC_CONST(3.05166E-005), - FRAC_CONST(1.52586E-005), FRAC_CONST(7.62934E-006), - FRAC_CONST(3.81468E-006), FRAC_CONST(1.90734E-006), - FRAC_CONST(9.53673E-007), FRAC_CONST(4.76837E-007), - FRAC_CONST(2.38419E-007), FRAC_CONST(1.19209E-007), - FRAC_CONST(5.96046E-008) -}; - -static const real_t Q_div2_tab_left[31][13] = { - { FRAC_CONST(0.0302959), FRAC_CONST(0.111015), FRAC_CONST(0.332468), FRAC_CONST(0.663212), FRAC_CONST(0.882759), FRAC_CONST(0.962406), FRAC_CONST(0.984615), FRAC_CONST(0.990329), FRAC_CONST(0.991768), FRAC_CONST(0.992128), FRAC_CONST(0.992218), FRAC_CONST(0.992241), FRAC_CONST(0.992246) }, - { FRAC_CONST(0.0153809), FRAC_CONST(0.0587695), FRAC_CONST(0.199377), FRAC_CONST(0.496124), FRAC_CONST(0.790123), FRAC_CONST(0.927536), FRAC_CONST(0.969697), FRAC_CONST(0.980843), FRAC_CONST(0.98367), FRAC_CONST(0.984379), FRAC_CONST(0.984556), FRAC_CONST(0.984601), FRAC_CONST(0.984612) }, - { FRAC_CONST(0.00775006), FRAC_CONST(0.0302744), FRAC_CONST(0.110727), FRAC_CONST(0.329897), FRAC_CONST(0.653061), FRAC_CONST(0.864865), FRAC_CONST(0.941176), FRAC_CONST(0.962406), FRAC_CONST(0.967864), FRAC_CONST(0.969238), FRAC_CONST(0.969582), FRAC_CONST(0.969668), FRAC_CONST(0.96969) }, - { FRAC_CONST(0.0038901), FRAC_CONST(0.0153698), FRAC_CONST(0.0586081), FRAC_CONST(0.197531), FRAC_CONST(0.484848), FRAC_CONST(0.761905), FRAC_CONST(0.888889), FRAC_CONST(0.927536), FRAC_CONST(0.937729), FRAC_CONST(0.940312), FRAC_CONST(0.94096), FRAC_CONST(0.941122), FRAC_CONST(0.941163) }, - { FRAC_CONST(0.00194884), FRAC_CONST(0.00774443), FRAC_CONST(0.0301887), FRAC_CONST(0.109589), FRAC_CONST(0.32), FRAC_CONST(0.615385), FRAC_CONST(0.8), FRAC_CONST(0.864865), FRAC_CONST(0.882759), FRAC_CONST(0.887348), FRAC_CONST(0.888503), FRAC_CONST(0.888792), FRAC_CONST(0.888865) }, - { FRAC_CONST(0.000975372), FRAC_CONST(0.00388727), FRAC_CONST(0.0153257), FRAC_CONST(0.057971), FRAC_CONST(0.190476), FRAC_CONST(0.444444), FRAC_CONST(0.666667), FRAC_CONST(0.761905), FRAC_CONST(0.790123), FRAC_CONST(0.797508), FRAC_CONST(0.799375), FRAC_CONST(0.799844), FRAC_CONST(0.799961) }, - { FRAC_CONST(0.000487924), FRAC_CONST(0.00194742), FRAC_CONST(0.00772201), FRAC_CONST(0.0298507), FRAC_CONST(0.105263), FRAC_CONST(0.285714), FRAC_CONST(0.5), FRAC_CONST(0.615385), FRAC_CONST(0.653061), FRAC_CONST(0.663212), FRAC_CONST(0.6658), FRAC_CONST(0.66645), FRAC_CONST(0.666612) }, - { FRAC_CONST(0.000244021), FRAC_CONST(0.000974659), FRAC_CONST(0.00387597), FRAC_CONST(0.0151515), FRAC_CONST(0.0555556), FRAC_CONST(0.166667), FRAC_CONST(0.333333), FRAC_CONST(0.444444), FRAC_CONST(0.484848), FRAC_CONST(0.496124), FRAC_CONST(0.499025), FRAC_CONST(0.499756), FRAC_CONST(0.499939) }, - { FRAC_CONST(0.000122026), FRAC_CONST(0.000487567), FRAC_CONST(0.00194175), FRAC_CONST(0.00763359), FRAC_CONST(0.0285714), FRAC_CONST(0.0909091), FRAC_CONST(0.2), FRAC_CONST(0.285714), FRAC_CONST(0.32), FRAC_CONST(0.329897), FRAC_CONST(0.332468), FRAC_CONST(0.333116), FRAC_CONST(0.333279) }, - { FRAC_CONST(6.10165E-005), FRAC_CONST(0.000243843), FRAC_CONST(0.000971817), FRAC_CONST(0.00383142), FRAC_CONST(0.0144928), FRAC_CONST(0.047619), FRAC_CONST(0.111111), FRAC_CONST(0.166667), FRAC_CONST(0.190476), FRAC_CONST(0.197531), FRAC_CONST(0.199377), FRAC_CONST(0.199844), FRAC_CONST(0.199961) }, - { FRAC_CONST(3.05092E-005), FRAC_CONST(0.000121936), FRAC_CONST(0.000486145), FRAC_CONST(0.00191939), FRAC_CONST(0.00729927), FRAC_CONST(0.0243902), FRAC_CONST(0.0588235), FRAC_CONST(0.0909091), FRAC_CONST(0.105263), FRAC_CONST(0.109589), FRAC_CONST(0.110727), FRAC_CONST(0.111015), FRAC_CONST(0.111087) }, - { FRAC_CONST(1.52548E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(0.000243132), FRAC_CONST(0.000960615), FRAC_CONST(0.003663), FRAC_CONST(0.0123457), FRAC_CONST(0.030303), FRAC_CONST(0.047619), FRAC_CONST(0.0555556), FRAC_CONST(0.057971), FRAC_CONST(0.0586081), FRAC_CONST(0.0587695), FRAC_CONST(0.05881) }, - { FRAC_CONST(7.62747E-006), FRAC_CONST(3.04869E-005), FRAC_CONST(0.000121581), FRAC_CONST(0.000480538), FRAC_CONST(0.00183486), FRAC_CONST(0.00621118), FRAC_CONST(0.0153846), FRAC_CONST(0.0243902), FRAC_CONST(0.0285714), FRAC_CONST(0.0298507), FRAC_CONST(0.0301887), FRAC_CONST(0.0302744), FRAC_CONST(0.0302959) }, - { FRAC_CONST(3.81375E-006), FRAC_CONST(1.52437E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(0.000240327), FRAC_CONST(0.000918274), FRAC_CONST(0.00311526), FRAC_CONST(0.00775194), FRAC_CONST(0.0123457), FRAC_CONST(0.0144928), FRAC_CONST(0.0151515), FRAC_CONST(0.0153257), FRAC_CONST(0.0153698), FRAC_CONST(0.0153809) }, - { FRAC_CONST(1.90688E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(3.03979E-005), FRAC_CONST(0.000120178), FRAC_CONST(0.000459348), FRAC_CONST(0.00156006), FRAC_CONST(0.00389105), FRAC_CONST(0.00621118), FRAC_CONST(0.00729927), FRAC_CONST(0.00763359), FRAC_CONST(0.00772201), FRAC_CONST(0.00774443), FRAC_CONST(0.00775006) }, - { FRAC_CONST(9.53441E-007), FRAC_CONST(3.81096E-006), FRAC_CONST(1.51992E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(0.000229727), FRAC_CONST(0.00078064), FRAC_CONST(0.00194932), FRAC_CONST(0.00311526), FRAC_CONST(0.003663), FRAC_CONST(0.00383142), FRAC_CONST(0.00387597), FRAC_CONST(0.00388727), FRAC_CONST(0.0038901) }, - { FRAC_CONST(4.76721E-007), FRAC_CONST(1.90548E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(3.00472E-005), FRAC_CONST(0.000114877), FRAC_CONST(0.000390472), FRAC_CONST(0.00097561), FRAC_CONST(0.00156006), FRAC_CONST(0.00183486), FRAC_CONST(0.00191939), FRAC_CONST(0.00194175), FRAC_CONST(0.00194742), FRAC_CONST(0.00194884) }, - { FRAC_CONST(2.3836E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(3.79984E-006), FRAC_CONST(1.50238E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(0.000195274), FRAC_CONST(0.000488043), FRAC_CONST(0.00078064), FRAC_CONST(0.000918274), FRAC_CONST(0.000960615), FRAC_CONST(0.000971817), FRAC_CONST(0.000974659), FRAC_CONST(0.000975372) }, - { FRAC_CONST(1.1918E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(1.89992E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(2.87216E-005), FRAC_CONST(9.76467E-005), FRAC_CONST(0.000244081), FRAC_CONST(0.000390472), FRAC_CONST(0.000459348), FRAC_CONST(0.000480538), FRAC_CONST(0.000486145), FRAC_CONST(0.000487567), FRAC_CONST(0.000487924) }, - { FRAC_CONST(5.95901E-008), FRAC_CONST(2.38186E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(3.756E-006), FRAC_CONST(1.4361E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(0.000122055), FRAC_CONST(0.000195274), FRAC_CONST(0.000229727), FRAC_CONST(0.000240327), FRAC_CONST(0.000243132), FRAC_CONST(0.000243843), FRAC_CONST(0.000244021) }, - { FRAC_CONST(2.9795E-008), FRAC_CONST(1.19093E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(1.878E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(2.44135E-005), FRAC_CONST(6.10314E-005), FRAC_CONST(9.76467E-005), FRAC_CONST(0.000114877), FRAC_CONST(0.000120178), FRAC_CONST(0.000121581), FRAC_CONST(0.000121936), FRAC_CONST(0.000122026) }, - { FRAC_CONST(1.48975E-008), FRAC_CONST(5.95465E-008), FRAC_CONST(2.37491E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(3.59029E-006), FRAC_CONST(1.22069E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(6.10165E-005) }, - { FRAC_CONST(7.44876E-009), FRAC_CONST(2.97732E-008), FRAC_CONST(1.18745E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(1.79515E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(1.52586E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(3.00472E-005), FRAC_CONST(3.03979E-005), FRAC_CONST(3.04869E-005), FRAC_CONST(3.05092E-005) }, - { FRAC_CONST(3.72438E-009), FRAC_CONST(1.48866E-008), FRAC_CONST(5.93727E-008), FRAC_CONST(2.34751E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(3.05175E-006), FRAC_CONST(7.62934E-006), FRAC_CONST(1.22069E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(1.52548E-005) }, - { FRAC_CONST(1.86219E-009), FRAC_CONST(7.44331E-009), FRAC_CONST(2.96864E-008), FRAC_CONST(1.17375E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(1.52588E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(7.62747E-006) }, - { FRAC_CONST(9.31095E-010), FRAC_CONST(3.72166E-009), FRAC_CONST(1.48432E-008), FRAC_CONST(5.86876E-008), FRAC_CONST(2.24394E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(1.90734E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(3.59029E-006), FRAC_CONST(3.756E-006), FRAC_CONST(3.79984E-006), FRAC_CONST(3.81096E-006), FRAC_CONST(3.81375E-006) }, - { FRAC_CONST(4.65548E-010), FRAC_CONST(1.86083E-009), FRAC_CONST(7.42159E-009), FRAC_CONST(2.93438E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(9.53673E-007), FRAC_CONST(1.52588E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(1.878E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(1.90688E-006) }, - { FRAC_CONST(2.32774E-010), FRAC_CONST(9.30414E-010), FRAC_CONST(3.71079E-009), FRAC_CONST(1.46719E-008), FRAC_CONST(5.60985E-008), FRAC_CONST(1.90735E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(9.53441E-007) }, - { FRAC_CONST(1.16387E-010), FRAC_CONST(4.65207E-010), FRAC_CONST(1.8554E-009), FRAC_CONST(7.33596E-009), FRAC_CONST(2.80492E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(2.38419E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(4.76721E-007) }, - { FRAC_CONST(5.81935E-011), FRAC_CONST(2.32603E-010), FRAC_CONST(9.27699E-010), FRAC_CONST(3.66798E-009), FRAC_CONST(1.40246E-008), FRAC_CONST(4.76837E-008), FRAC_CONST(1.19209E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(2.3836E-007) }, - { FRAC_CONST(2.90967E-011), FRAC_CONST(1.16302E-010), FRAC_CONST(4.63849E-010), FRAC_CONST(1.83399E-009), FRAC_CONST(7.01231E-009), FRAC_CONST(2.38419E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.1918E-007) } -}; - -static const real_t Q_div2_tab_right[31][13] = { - { FRAC_CONST(0.992246), FRAC_CONST(0.992241), FRAC_CONST(0.992218), FRAC_CONST(0.992128), FRAC_CONST(0.991768), FRAC_CONST(0.990329), FRAC_CONST(0.984615), FRAC_CONST(0.962406), FRAC_CONST(0.882759), FRAC_CONST(0.663212), FRAC_CONST(0.332468), FRAC_CONST(0.111015), FRAC_CONST(0.0302959) }, - { FRAC_CONST(0.984612), FRAC_CONST(0.984601), FRAC_CONST(0.984556), FRAC_CONST(0.984379), FRAC_CONST(0.98367), FRAC_CONST(0.980843), FRAC_CONST(0.969697), FRAC_CONST(0.927536), FRAC_CONST(0.790123), FRAC_CONST(0.496124), FRAC_CONST(0.199377), FRAC_CONST(0.0587695), FRAC_CONST(0.0153809) }, - { FRAC_CONST(0.96969), FRAC_CONST(0.969668), FRAC_CONST(0.969582), FRAC_CONST(0.969238), FRAC_CONST(0.967864), FRAC_CONST(0.962406), FRAC_CONST(0.941176), FRAC_CONST(0.864865), FRAC_CONST(0.653061), FRAC_CONST(0.329897), FRAC_CONST(0.110727), FRAC_CONST(0.0302744), FRAC_CONST(0.00775006) }, - { FRAC_CONST(0.941163), FRAC_CONST(0.941122), FRAC_CONST(0.94096), FRAC_CONST(0.940312), FRAC_CONST(0.937729), FRAC_CONST(0.927536), FRAC_CONST(0.888889), FRAC_CONST(0.761905), FRAC_CONST(0.484848), FRAC_CONST(0.197531), FRAC_CONST(0.0586081), FRAC_CONST(0.0153698), FRAC_CONST(0.0038901) }, - { FRAC_CONST(0.888865), FRAC_CONST(0.888792), FRAC_CONST(0.888503), FRAC_CONST(0.887348), FRAC_CONST(0.882759), FRAC_CONST(0.864865), FRAC_CONST(0.8), FRAC_CONST(0.615385), FRAC_CONST(0.32), FRAC_CONST(0.109589), FRAC_CONST(0.0301887), FRAC_CONST(0.00774443), FRAC_CONST(0.00194884) }, - { FRAC_CONST(0.799961), FRAC_CONST(0.799844), FRAC_CONST(0.799375), FRAC_CONST(0.797508), FRAC_CONST(0.790123), FRAC_CONST(0.761905), FRAC_CONST(0.666667), FRAC_CONST(0.444444), FRAC_CONST(0.190476), FRAC_CONST(0.057971), FRAC_CONST(0.0153257), FRAC_CONST(0.00388727), FRAC_CONST(0.000975372) }, - { FRAC_CONST(0.666612), FRAC_CONST(0.66645), FRAC_CONST(0.6658), FRAC_CONST(0.663212), FRAC_CONST(0.653061), FRAC_CONST(0.615385), FRAC_CONST(0.5), FRAC_CONST(0.285714), FRAC_CONST(0.105263), FRAC_CONST(0.0298507), FRAC_CONST(0.00772201), FRAC_CONST(0.00194742), FRAC_CONST(0.000487924) }, - { FRAC_CONST(0.499939), FRAC_CONST(0.499756), FRAC_CONST(0.499025), FRAC_CONST(0.496124), FRAC_CONST(0.484848), FRAC_CONST(0.444444), FRAC_CONST(0.333333), FRAC_CONST(0.166667), FRAC_CONST(0.0555556), FRAC_CONST(0.0151515), FRAC_CONST(0.00387597), FRAC_CONST(0.000974659), FRAC_CONST(0.000244021) }, - { FRAC_CONST(0.333279), FRAC_CONST(0.333116), FRAC_CONST(0.332468), FRAC_CONST(0.329897), FRAC_CONST(0.32), FRAC_CONST(0.285714), FRAC_CONST(0.2), FRAC_CONST(0.0909091), FRAC_CONST(0.0285714), FRAC_CONST(0.00763359), FRAC_CONST(0.00194175), FRAC_CONST(0.000487567), FRAC_CONST(0.000122026) }, - { FRAC_CONST(0.199961), FRAC_CONST(0.199844), FRAC_CONST(0.199377), FRAC_CONST(0.197531), FRAC_CONST(0.190476), FRAC_CONST(0.166667), FRAC_CONST(0.111111), FRAC_CONST(0.047619), FRAC_CONST(0.0144928), FRAC_CONST(0.00383142), FRAC_CONST(0.000971817), FRAC_CONST(0.000243843), FRAC_CONST(6.10165E-005) }, - { FRAC_CONST(0.111087), FRAC_CONST(0.111015), FRAC_CONST(0.110727), FRAC_CONST(0.109589), FRAC_CONST(0.105263), FRAC_CONST(0.0909091), FRAC_CONST(0.0588235), FRAC_CONST(0.0243902), FRAC_CONST(0.00729927), FRAC_CONST(0.00191939), FRAC_CONST(0.000486145), FRAC_CONST(0.000121936), FRAC_CONST(3.05092E-005) }, - { FRAC_CONST(0.05881), FRAC_CONST(0.0587695), FRAC_CONST(0.0586081), FRAC_CONST(0.057971), FRAC_CONST(0.0555556), FRAC_CONST(0.047619), FRAC_CONST(0.030303), FRAC_CONST(0.0123457), FRAC_CONST(0.003663), FRAC_CONST(0.000960615), FRAC_CONST(0.000243132), FRAC_CONST(6.09719E-005), FRAC_CONST(1.52548E-005) }, - { FRAC_CONST(0.0302959), FRAC_CONST(0.0302744), FRAC_CONST(0.0301887), FRAC_CONST(0.0298507), FRAC_CONST(0.0285714), FRAC_CONST(0.0243902), FRAC_CONST(0.0153846), FRAC_CONST(0.00621118), FRAC_CONST(0.00183486), FRAC_CONST(0.000480538), FRAC_CONST(0.000121581), FRAC_CONST(3.04869E-005), FRAC_CONST(7.62747E-006) }, - { FRAC_CONST(0.0153809), FRAC_CONST(0.0153698), FRAC_CONST(0.0153257), FRAC_CONST(0.0151515), FRAC_CONST(0.0144928), FRAC_CONST(0.0123457), FRAC_CONST(0.00775194), FRAC_CONST(0.00311526), FRAC_CONST(0.000918274), FRAC_CONST(0.000240327), FRAC_CONST(6.0794E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(3.81375E-006) }, - { FRAC_CONST(0.00775006), FRAC_CONST(0.00774443), FRAC_CONST(0.00772201), FRAC_CONST(0.00763359), FRAC_CONST(0.00729927), FRAC_CONST(0.00621118), FRAC_CONST(0.00389105), FRAC_CONST(0.00156006), FRAC_CONST(0.000459348), FRAC_CONST(0.000120178), FRAC_CONST(3.03979E-005), FRAC_CONST(7.62189E-006), FRAC_CONST(1.90688E-006) }, - { FRAC_CONST(0.0038901), FRAC_CONST(0.00388727), FRAC_CONST(0.00387597), FRAC_CONST(0.00383142), FRAC_CONST(0.003663), FRAC_CONST(0.00311526), FRAC_CONST(0.00194932), FRAC_CONST(0.00078064), FRAC_CONST(0.000229727), FRAC_CONST(6.00925E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(3.81096E-006), FRAC_CONST(9.53441E-007) }, - { FRAC_CONST(0.00194884), FRAC_CONST(0.00194742), FRAC_CONST(0.00194175), FRAC_CONST(0.00191939), FRAC_CONST(0.00183486), FRAC_CONST(0.00156006), FRAC_CONST(0.00097561), FRAC_CONST(0.000390472), FRAC_CONST(0.000114877), FRAC_CONST(3.00472E-005), FRAC_CONST(7.59965E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(4.76721E-007) }, - { FRAC_CONST(0.000975372), FRAC_CONST(0.000974659), FRAC_CONST(0.000971817), FRAC_CONST(0.000960615), FRAC_CONST(0.000918274), FRAC_CONST(0.00078064), FRAC_CONST(0.000488043), FRAC_CONST(0.000195274), FRAC_CONST(5.74416E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(3.79984E-006), FRAC_CONST(9.52743E-007), FRAC_CONST(2.3836E-007) }, - { FRAC_CONST(0.000487924), FRAC_CONST(0.000487567), FRAC_CONST(0.000486145), FRAC_CONST(0.000480538), FRAC_CONST(0.000459348), FRAC_CONST(0.000390472), FRAC_CONST(0.000244081), FRAC_CONST(9.76467E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(7.51196E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(4.76372E-007), FRAC_CONST(1.1918E-007) }, - { FRAC_CONST(0.000244021), FRAC_CONST(0.000243843), FRAC_CONST(0.000243132), FRAC_CONST(0.000240327), FRAC_CONST(0.000229727), FRAC_CONST(0.000195274), FRAC_CONST(0.000122055), FRAC_CONST(4.88257E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(3.756E-006), FRAC_CONST(9.49963E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(5.95901E-008) }, - { FRAC_CONST(0.000122026), FRAC_CONST(0.000121936), FRAC_CONST(0.000121581), FRAC_CONST(0.000120178), FRAC_CONST(0.000114877), FRAC_CONST(9.76467E-005), FRAC_CONST(6.10314E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(7.18056E-006), FRAC_CONST(1.878E-006), FRAC_CONST(4.74982E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(2.9795E-008) }, - { FRAC_CONST(6.10165E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(1.22069E-005), FRAC_CONST(3.59029E-006), FRAC_CONST(9.39002E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(5.95465E-008), FRAC_CONST(1.48975E-008) }, - { FRAC_CONST(3.05092E-005), FRAC_CONST(3.04869E-005), FRAC_CONST(3.03979E-005), FRAC_CONST(3.00472E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(1.52586E-005), FRAC_CONST(6.10348E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(4.69501E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(2.97732E-008), FRAC_CONST(7.44876E-009) }, - { FRAC_CONST(1.52548E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(1.22069E-005), FRAC_CONST(7.62934E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(8.97575E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(5.93727E-008), FRAC_CONST(1.48866E-008), FRAC_CONST(3.72438E-009) }, - { FRAC_CONST(7.62747E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(1.52588E-006), FRAC_CONST(4.48788E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(2.96864E-008), FRAC_CONST(7.44331E-009), FRAC_CONST(1.86219E-009) }, - { FRAC_CONST(3.81375E-006), FRAC_CONST(3.81096E-006), FRAC_CONST(3.79984E-006), FRAC_CONST(3.756E-006), FRAC_CONST(3.59029E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(1.90734E-006), FRAC_CONST(7.62939E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(5.86876E-008), FRAC_CONST(1.48432E-008), FRAC_CONST(3.72166E-009), FRAC_CONST(9.31095E-010) }, - { FRAC_CONST(1.90688E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(1.878E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(1.52588E-006), FRAC_CONST(9.53673E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(1.12197E-007), FRAC_CONST(2.93438E-008), FRAC_CONST(7.42159E-009), FRAC_CONST(1.86083E-009), FRAC_CONST(4.65548E-010) }, - { FRAC_CONST(9.53441E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(5.60985E-008), FRAC_CONST(1.46719E-008), FRAC_CONST(3.71079E-009), FRAC_CONST(9.30414E-010), FRAC_CONST(2.32774E-010) }, - { FRAC_CONST(4.76721E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(2.38419E-007), FRAC_CONST(9.53674E-008), FRAC_CONST(2.80492E-008), FRAC_CONST(7.33596E-009), FRAC_CONST(1.8554E-009), FRAC_CONST(4.65207E-010), FRAC_CONST(1.16387E-010) }, - { FRAC_CONST(2.3836E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(1.19209E-007), FRAC_CONST(4.76837E-008), FRAC_CONST(1.40246E-008), FRAC_CONST(3.66798E-009), FRAC_CONST(9.27699E-010), FRAC_CONST(2.32603E-010), FRAC_CONST(5.81935E-011) }, - { FRAC_CONST(1.1918E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.12197E-007), FRAC_CONST(9.53674E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(2.38419E-008), FRAC_CONST(7.01231E-009), FRAC_CONST(1.83399E-009), FRAC_CONST(4.63849E-010), FRAC_CONST(1.16302E-010), FRAC_CONST(2.90967E-011) } -}; - -/* calculates Q/(1+Q) */ -/* [0..1] */ -real_t calc_Q_div2(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l) -{ - if (sbr->bs_coupling) - { - if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) || - (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */)) - { - return 0; - } else { - /* the pan parameter is always even */ - if (ch == 0) - { - return Q_div2_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1]; - } else { - return Q_div2_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1]; - } - } - } else { - /* no coupling */ - if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30) - { - return 0; - } else { - return Q_div2_tab[sbr->Q[ch][m][l]]; - } - } -} - -static const real_t E_deq_tab[64] = { - 64.0f, 128.0f, 256.0f, 512.0f, 1024.0f, 2048.0f, 4096.0f, 8192.0f, - 16384.0f, 32768.0f, 65536.0f, 131072.0f, 262144.0f, 524288.0f, 1.04858E+006f, 2.09715E+006f, - 4.1943E+006f, 8.38861E+006f, 1.67772E+007f, 3.35544E+007f, 6.71089E+007f, 1.34218E+008f, 2.68435E+008f, 5.36871E+008f, - 1.07374E+009f, 2.14748E+009f, 4.29497E+009f, 8.58993E+009f, 1.71799E+010f, 3.43597E+010f, 6.87195E+010f, 1.37439E+011f, - 2.74878E+011f, 5.49756E+011f, 1.09951E+012f, 2.19902E+012f, 4.39805E+012f, 8.79609E+012f, 1.75922E+013f, 3.51844E+013f, - 7.03687E+013f, 1.40737E+014f, 2.81475E+014f, 5.6295E+014f, 1.1259E+015f, 2.2518E+015f, 4.5036E+015f, 9.0072E+015f, - 1.80144E+016f, 3.60288E+016f, 7.20576E+016f, 1.44115E+017f, 2.8823E+017f, 5.76461E+017f, 1.15292E+018f, 2.30584E+018f, - 4.61169E+018f, 9.22337E+018f, 1.84467E+019f, 3.68935E+019f, 7.3787E+019f, 1.47574E+020f, 2.95148E+020f, 5.90296E+020f -}; - -void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch) -{ - if (sbr->bs_coupling == 0) - { - int16_t exp; - uint8_t l, k; - uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1; - - for (l = 0; l < sbr->L_E[ch]; l++) - { - for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++) - { - /* +6 for the *64 and -10 for the /32 in the synthesis QMF (fixed) - * since this is a energy value: (x/32)^2 = (x^2)/1024 - */ - /* exp = (sbr->E[ch][k][l] >> amp) + 6; */ - exp = (sbr->E[ch][k][l] >> amp); - - if ((exp < 0) || (exp >= 64)) - { - sbr->E_orig[ch][k][l] = 0; - } else { - sbr->E_orig[ch][k][l] = E_deq_tab[exp]; - - /* save half the table size at the cost of 1 multiply */ - if (amp && (sbr->E[ch][k][l] & 1)) - { - sbr->E_orig[ch][k][l] = MUL_C(sbr->E_orig[ch][k][l], COEF_CONST(1.414213562)); - } - } - } - } - - for (l = 0; l < sbr->L_Q[ch]; l++) - { - for (k = 0; k < sbr->N_Q; k++) - { - sbr->Q_div[ch][k][l] = calc_Q_div(sbr, ch, k, l); - sbr->Q_div2[ch][k][l] = calc_Q_div2(sbr, ch, k, l); - } - } - } -} - -static const real_t E_pan_tab[25] = { - FRAC_CONST(0.000244081), FRAC_CONST(0.000488043), - FRAC_CONST(0.00097561), FRAC_CONST(0.00194932), - FRAC_CONST(0.00389105), FRAC_CONST(0.00775194), - FRAC_CONST(0.0153846), FRAC_CONST(0.030303), - FRAC_CONST(0.0588235), FRAC_CONST(0.111111), - FRAC_CONST(0.2), FRAC_CONST(0.333333), - FRAC_CONST(0.5), FRAC_CONST(0.666667), - FRAC_CONST(0.8), FRAC_CONST(0.888889), - FRAC_CONST(0.941176), FRAC_CONST(0.969697), - FRAC_CONST(0.984615), FRAC_CONST(0.992248), - FRAC_CONST(0.996109), FRAC_CONST(0.998051), - FRAC_CONST(0.999024), FRAC_CONST(0.999512), - FRAC_CONST(0.999756) -}; - -void unmap_envelope_noise(sbr_info *sbr) -{ - real_t tmp; - int16_t exp0, exp1; - uint8_t l, k; - uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1; - uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1; - - for (l = 0; l < sbr->L_E[0]; l++) - { - for (k = 0; k < sbr->n[sbr->f[0][l]]; k++) - { - /* +6: * 64 ; +1: * 2 ; */ - exp0 = (sbr->E[0][k][l] >> amp0) + 1; - - /* UN_MAP removed: (x / 4096) same as (x >> 12) */ - /* E[1] is always even so no need for compensating the divide by 2 with - * an extra multiplication - */ - /* exp1 = (sbr->E[1][k][l] >> amp1) - 12; */ - exp1 = (sbr->E[1][k][l] >> amp1); - - if ((exp0 < 0) || (exp0 >= 64) || - (exp1 < 0) || (exp1 > 24)) - { - sbr->E_orig[1][k][l] = 0; - sbr->E_orig[0][k][l] = 0; - } else { - tmp = E_deq_tab[exp0]; - if (amp0 && (sbr->E[0][k][l] & 1)) - { - tmp = MUL_C(tmp, COEF_CONST(1.414213562)); - } - - /* panning */ - sbr->E_orig[0][k][l] = MUL_F(tmp, E_pan_tab[exp1]); - sbr->E_orig[1][k][l] = MUL_F(tmp, E_pan_tab[24 - exp1]); - } - } - } - - for (l = 0; l < sbr->L_Q[0]; l++) - { - for (k = 0; k < sbr->N_Q; k++) - { - sbr->Q_div[0][k][l] = calc_Q_div(sbr, 0, k, l); - sbr->Q_div[1][k][l] = calc_Q_div(sbr, 1, k, l); - sbr->Q_div2[0][k][l] = calc_Q_div2(sbr, 0, k, l); - sbr->Q_div2[1][k][l] = calc_Q_div2(sbr, 1, k, l); - } - } -} - -#endif - -#endif diff --git a/mplayer/libfaad2/sbr_e_nf.h b/mplayer/libfaad2/sbr_e_nf.h deleted file mode 100644 index 70100af6..00000000 --- a/mplayer/libfaad2/sbr_e_nf.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_e_nf.h,v 1.14 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __SBR_E_NF_H__ -#define __SBR_E_NF_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -void extract_envelope_data(sbr_info *sbr, uint8_t ch); -void extract_noise_floor_data(sbr_info *sbr, uint8_t ch); -#ifndef FIXED_POINT -void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch); -void unmap_envelope_noise(sbr_info *sbr); -#endif - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/mplayer/libfaad2/sbr_fbt.c b/mplayer/libfaad2/sbr_fbt.c deleted file mode 100644 index 5ad5766d..00000000 --- a/mplayer/libfaad2/sbr_fbt.c +++ /dev/null @@ -1,761 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_fbt.c,v 1.17 2004/09/08 09:43:11 gcp Exp $ -**/ - -/* Calculate frequency band tables */ - -#include "common.h" -#include "structs.h" - -#ifdef SBR_DEC - -#include - -#include "sbr_syntax.h" -#include "sbr_fbt.h" - -/* static function declarations */ -static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1); - - -/* calculate the start QMF channel for the master frequency band table */ -/* parameter is also called k0 */ -uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode, - uint32_t sample_rate) -{ - static const uint8_t startMinTable[12] = { 7, 7, 10, 11, 12, 16, 16, - 17, 24, 32, 35, 48 }; - static const uint8_t offsetIndexTable[12] = { 5, 5, 4, 4, 4, 3, 2, 1, 0, - 6, 6, 6 }; - static const int8_t offset[7][16] = { - { -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 }, - { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13 }, - { -5, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 }, - { -6, -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 }, - { -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20 }, - { -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24 }, - { 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24, 28, 33 } - }; - uint8_t startMin = startMinTable[get_sr_index(sample_rate)]; - uint8_t offsetIndex = offsetIndexTable[get_sr_index(sample_rate)]; - -#if 0 /* replaced with table (startMinTable) */ - if (sample_rate >= 64000) - { - startMin = (uint8_t)((5000.*128.)/(float)sample_rate + 0.5); - } else if (sample_rate < 32000) { - startMin = (uint8_t)((3000.*128.)/(float)sample_rate + 0.5); - } else { - startMin = (uint8_t)((4000.*128.)/(float)sample_rate + 0.5); - } -#endif - - if (bs_samplerate_mode) - { - return startMin + offset[offsetIndex][bs_start_freq]; - -#if 0 /* replaced by offsetIndexTable */ - switch (sample_rate) - { - case 16000: - return startMin + offset[0][bs_start_freq]; - case 22050: - return startMin + offset[1][bs_start_freq]; - case 24000: - return startMin + offset[2][bs_start_freq]; - case 32000: - return startMin + offset[3][bs_start_freq]; - default: - if (sample_rate > 64000) - { - return startMin + offset[5][bs_start_freq]; - } else { /* 44100 <= sample_rate <= 64000 */ - return startMin + offset[4][bs_start_freq]; - } - } -#endif - } else { - return startMin + offset[6][bs_start_freq]; - } -} - -static int longcmp(const void *a, const void *b) -{ - return ((int)(*(int32_t*)a - *(int32_t*)b)); -} - -/* calculate the stop QMF channel for the master frequency band table */ -/* parameter is also called k2 */ -uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate, - uint8_t k0) -{ - if (bs_stop_freq == 15) - { - return min(64, k0 * 3); - } else if (bs_stop_freq == 14) { - return min(64, k0 * 2); - } else { - static const uint8_t stopMinTable[12] = { 13, 15, 20, 21, 23, - 32, 32, 35, 48, 64, 70, 96 }; - static const int8_t offset[12][14] = { - { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 37, 44, 51 }, - { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 36, 42, 49 }, - { 0, 2, 4, 6, 8, 11, 14, 17, 21, 25, 29, 34, 39, 44 }, - { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 33, 38, 43 }, - { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 32, 36, 41 }, - { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 }, - { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 }, - { 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 20, 23, 26, 29 }, - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, -1, -2, -3, -4, -5, -6, -6, -6, -6, -6, -6, -6, -6 }, - { 0, -3, -6, -9, -12, -15, -18, -20, -22, -24, -26, -28, -30, -32 } - }; -#if 0 - uint8_t i; - int32_t stopDk[13], stopDk_t[14], k2; -#endif - uint8_t stopMin = stopMinTable[get_sr_index(sample_rate)]; - -#if 0 /* replaced by table lookup */ - if (sample_rate >= 64000) - { - stopMin = (uint8_t)((10000.*128.)/(float)sample_rate + 0.5); - } else if (sample_rate < 32000) { - stopMin = (uint8_t)((6000.*128.)/(float)sample_rate + 0.5); - } else { - stopMin = (uint8_t)((8000.*128.)/(float)sample_rate + 0.5); - } -#endif - -#if 0 /* replaced by table lookup */ - /* diverging power series */ - for (i = 0; i <= 13; i++) - { - stopDk_t[i] = (int32_t)(stopMin*pow(64.0/stopMin, i/13.0) + 0.5); - } - for (i = 0; i < 13; i++) - { - stopDk[i] = stopDk_t[i+1] - stopDk_t[i]; - } - - /* needed? */ - qsort(stopDk, 13, sizeof(stopDk[0]), longcmp); - - k2 = stopMin; - for (i = 0; i < bs_stop_freq; i++) - { - k2 += stopDk[i]; - } - return min(64, k2); -#endif - /* bs_stop_freq <= 13 */ - return min(64, stopMin + offset[get_sr_index(sample_rate)][min(bs_stop_freq, 13)]); - } - - return 0; -} - -/* calculate the master frequency table from k0, k2, bs_freq_scale - and bs_alter_scale - - version for bs_freq_scale = 0 -*/ -uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2, - uint8_t bs_alter_scale) -{ - int8_t incr; - uint8_t k; - uint8_t dk; - uint32_t nrBands, k2Achieved; - int32_t k2Diff, vDk[64] = {0}; - - /* mft only defined for k2 > k0 */ - if (k2 <= k0) - { - sbr->N_master = 0; - return 1; - } - - dk = bs_alter_scale ? 2 : 1; - -#if 0 /* replaced by float-less design */ - nrBands = 2 * (int32_t)((float)(k2-k0)/(dk*2) + (-1+dk)/2.0f); -#else - if (bs_alter_scale) - { - nrBands = (((k2-k0+2)>>2)<<1); - } else { - nrBands = (((k2-k0)>>1)<<1); - } -#endif - nrBands = min(nrBands, 63); - if (nrBands <= 0) - return 1; - - k2Achieved = k0 + nrBands * dk; - k2Diff = k2 - k2Achieved; - for (k = 0; k < nrBands; k++) - vDk[k] = dk; - - if (k2Diff) - { - incr = (k2Diff > 0) ? -1 : 1; - k = (uint8_t) ((k2Diff > 0) ? (nrBands-1) : 0); - - while (k2Diff != 0) - { - vDk[k] -= incr; - k += incr; - k2Diff += incr; - } - } - - sbr->f_master[0] = k0; - for (k = 1; k <= nrBands; k++) - sbr->f_master[k] = (uint8_t)(sbr->f_master[k-1] + vDk[k-1]); - - sbr->N_master = (uint8_t)nrBands; - sbr->N_master = (min(sbr->N_master, 64)); - -#if 0 - printf("f_master[%d]: ", nrBands); - for (k = 0; k <= nrBands; k++) - { - printf("%d ", sbr->f_master[k]); - } - printf("\n"); -#endif - - return 0; -} - -/* - This function finds the number of bands using this formula: - bands * log(a1/a0)/log(2.0) + 0.5 -*/ -static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1) -{ -#ifdef FIXED_POINT - /* table with log2() values */ - static const real_t log2Table[65] = { - COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(1.0000000000), COEF_CONST(1.5849625007), - COEF_CONST(2.0000000000), COEF_CONST(2.3219280949), COEF_CONST(2.5849625007), COEF_CONST(2.8073549221), - COEF_CONST(3.0000000000), COEF_CONST(3.1699250014), COEF_CONST(3.3219280949), COEF_CONST(3.4594316186), - COEF_CONST(3.5849625007), COEF_CONST(3.7004397181), COEF_CONST(3.8073549221), COEF_CONST(3.9068905956), - COEF_CONST(4.0000000000), COEF_CONST(4.0874628413), COEF_CONST(4.1699250014), COEF_CONST(4.2479275134), - COEF_CONST(4.3219280949), COEF_CONST(4.3923174228), COEF_CONST(4.4594316186), COEF_CONST(4.5235619561), - COEF_CONST(4.5849625007), COEF_CONST(4.6438561898), COEF_CONST(4.7004397181), COEF_CONST(4.7548875022), - COEF_CONST(4.8073549221), COEF_CONST(4.8579809951), COEF_CONST(4.9068905956), COEF_CONST(4.9541963104), - COEF_CONST(5.0000000000), COEF_CONST(5.0443941194), COEF_CONST(5.0874628413), COEF_CONST(5.1292830169), - COEF_CONST(5.1699250014), COEF_CONST(5.2094533656), COEF_CONST(5.2479275134), COEF_CONST(5.2854022189), - COEF_CONST(5.3219280949), COEF_CONST(5.3575520046), COEF_CONST(5.3923174228), COEF_CONST(5.4262647547), - COEF_CONST(5.4594316186), COEF_CONST(5.4918530963), COEF_CONST(5.5235619561), COEF_CONST(5.5545888517), - COEF_CONST(5.5849625007), COEF_CONST(5.6147098441), COEF_CONST(5.6438561898), COEF_CONST(5.6724253420), - COEF_CONST(5.7004397181), COEF_CONST(5.7279204546), COEF_CONST(5.7548875022), COEF_CONST(5.7813597135), - COEF_CONST(5.8073549221), COEF_CONST(5.8328900142), COEF_CONST(5.8579809951), COEF_CONST(5.8826430494), - COEF_CONST(5.9068905956), COEF_CONST(5.9307373376), COEF_CONST(5.9541963104), COEF_CONST(5.9772799235), - COEF_CONST(6.0) - }; - real_t r0 = log2Table[a0]; /* coef */ - real_t r1 = log2Table[a1]; /* coef */ - real_t r2 = (r1 - r0); /* coef */ - - if (warp) - r2 = MUL_C(r2, COEF_CONST(1.0/1.3)); - - /* convert r2 to real and then multiply and round */ - r2 = (r2 >> (COEF_BITS-REAL_BITS)) * bands + (1<<(REAL_BITS-1)); - - return (r2 >> REAL_BITS); -#else - real_t div = (real_t)log(2.0); - if (warp) div *= (real_t)1.3; - - return (int32_t)(bands * log((float)a1/(float)a0)/div + 0.5); -#endif -} - -static real_t find_initial_power(uint8_t bands, uint8_t a0, uint8_t a1) -{ -#ifdef FIXED_POINT - /* table with log() values */ - static const real_t logTable[65] = { - COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(0.6931471806), COEF_CONST(1.0986122887), - COEF_CONST(1.3862943611), COEF_CONST(1.6094379124), COEF_CONST(1.7917594692), COEF_CONST(1.9459101491), - COEF_CONST(2.0794415417), COEF_CONST(2.1972245773), COEF_CONST(2.3025850930), COEF_CONST(2.3978952728), - COEF_CONST(2.4849066498), COEF_CONST(2.5649493575), COEF_CONST(2.6390573296), COEF_CONST(2.7080502011), - COEF_CONST(2.7725887222), COEF_CONST(2.8332133441), COEF_CONST(2.8903717579), COEF_CONST(2.9444389792), - COEF_CONST(2.9957322736), COEF_CONST(3.0445224377), COEF_CONST(3.0910424534), COEF_CONST(3.1354942159), - COEF_CONST(3.1780538303), COEF_CONST(3.2188758249), COEF_CONST(3.2580965380), COEF_CONST(3.2958368660), - COEF_CONST(3.3322045102), COEF_CONST(3.3672958300), COEF_CONST(3.4011973817), COEF_CONST(3.4339872045), - COEF_CONST(3.4657359028), COEF_CONST(3.4965075615), COEF_CONST(3.5263605246), COEF_CONST(3.5553480615), - COEF_CONST(3.5835189385), COEF_CONST(3.6109179126), COEF_CONST(3.6375861597), COEF_CONST(3.6635616461), - COEF_CONST(3.6888794541), COEF_CONST(3.7135720667), COEF_CONST(3.7376696183), COEF_CONST(3.7612001157), - COEF_CONST(3.7841896339), COEF_CONST(3.8066624898), COEF_CONST(3.8286413965), COEF_CONST(3.8501476017), - COEF_CONST(3.8712010109), COEF_CONST(3.8918202981), COEF_CONST(3.9120230054), COEF_CONST(3.9318256327), - COEF_CONST(3.9512437186), COEF_CONST(3.9702919136), COEF_CONST(3.9889840466), COEF_CONST(4.0073331852), - COEF_CONST(4.0253516907), COEF_CONST(4.0430512678), COEF_CONST(4.0604430105), COEF_CONST(4.0775374439), - COEF_CONST(4.0943445622), COEF_CONST(4.1108738642), COEF_CONST(4.1271343850), COEF_CONST(4.1431347264), - COEF_CONST(4.158883083) - }; - /* standard Taylor polynomial coefficients for exp(x) around 0 */ - /* a polynomial around x=1 is more precise, as most values are around 1.07, - but this is just fine already */ - static const real_t c1 = COEF_CONST(1.0); - static const real_t c2 = COEF_CONST(1.0/2.0); - static const real_t c3 = COEF_CONST(1.0/6.0); - static const real_t c4 = COEF_CONST(1.0/24.0); - - real_t r0 = logTable[a0]; /* coef */ - real_t r1 = logTable[a1]; /* coef */ - real_t r2 = (r1 - r0) / bands; /* coef */ - real_t rexp = c1 + MUL_C((c1 + MUL_C((c2 + MUL_C((c3 + MUL_C(c4,r2)), r2)), r2)), r2); - - return (rexp >> (COEF_BITS-REAL_BITS)); /* real */ -#else - return (real_t)pow((real_t)a1/(real_t)a0, 1.0/(real_t)bands); -#endif -} - -/* - version for bs_freq_scale > 0 -*/ -uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2, - uint8_t bs_freq_scale, uint8_t bs_alter_scale) -{ - uint8_t k, bands, twoRegions; - uint8_t k1; - uint8_t nrBand0, nrBand1; - int32_t vDk0[64] = {0}, vDk1[64] = {0}; - int32_t vk0[64] = {0}, vk1[64] = {0}; - uint8_t temp1[] = { 6, 5, 4 }; - real_t q, qk; - int32_t A_1; -#ifdef FIXED_POINT - real_t rk2, rk0; -#endif - - /* mft only defined for k2 > k0 */ - if (k2 <= k0) - { - sbr->N_master = 0; - return 1; - } - - bands = temp1[bs_freq_scale-1]; - -#ifdef FIXED_POINT - rk0 = (real_t)k0 << REAL_BITS; - rk2 = (real_t)k2 << REAL_BITS; - if (rk2 > MUL_C(rk0, COEF_CONST(2.2449))) -#else - if ((float)k2/(float)k0 > 2.2449) -#endif - { - twoRegions = 1; - k1 = k0 << 1; - } else { - twoRegions = 0; - k1 = k2; - } - - nrBand0 = (uint8_t)(2 * find_bands(0, bands, k0, k1)); - nrBand0 = min(nrBand0, 63); - if (nrBand0 <= 0) - return 1; - - q = find_initial_power(nrBand0, k0, k1); -#ifdef FIXED_POINT - qk = (real_t)k0 << REAL_BITS; - //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); - A_1 = k0; -#else - qk = REAL_CONST(k0); - A_1 = (int32_t)(qk + .5); -#endif - for (k = 0; k <= nrBand0; k++) - { - int32_t A_0 = A_1; -#ifdef FIXED_POINT - qk = MUL_R(qk,q); - A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); -#else - qk *= q; - A_1 = (int32_t)(qk + 0.5); -#endif - vDk0[k] = A_1 - A_0; - } - - /* needed? */ - qsort(vDk0, nrBand0, sizeof(vDk0[0]), longcmp); - - vk0[0] = k0; - for (k = 1; k <= nrBand0; k++) - { - vk0[k] = vk0[k-1] + vDk0[k-1]; - if (vDk0[k-1] == 0) - return 1; - } - - if (!twoRegions) - { - for (k = 0; k <= nrBand0; k++) - sbr->f_master[k] = (uint8_t) vk0[k]; - - sbr->N_master = nrBand0; - sbr->N_master = min(sbr->N_master, 64); - return 0; - } - - nrBand1 = (uint8_t)(2 * find_bands(1 /* warped */, bands, k1, k2)); - nrBand1 = min(nrBand1, 63); - - q = find_initial_power(nrBand1, k1, k2); -#ifdef FIXED_POINT - qk = (real_t)k1 << REAL_BITS; - //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); - A_1 = k1; -#else - qk = REAL_CONST(k1); - A_1 = (int32_t)(qk + .5); -#endif - for (k = 0; k <= nrBand1 - 1; k++) - { - int32_t A_0 = A_1; -#ifdef FIXED_POINT - qk = MUL_R(qk,q); - A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); -#else - qk *= q; - A_1 = (int32_t)(qk + 0.5); -#endif - vDk1[k] = A_1 - A_0; - } - - if (vDk1[0] < vDk0[nrBand0 - 1]) - { - int32_t change; - - /* needed? */ - qsort(vDk1, nrBand1 + 1, sizeof(vDk1[0]), longcmp); - change = vDk0[nrBand0 - 1] - vDk1[0]; - vDk1[0] = vDk0[nrBand0 - 1]; - vDk1[nrBand1 - 1] = vDk1[nrBand1 - 1] - change; - } - - /* needed? */ - qsort(vDk1, nrBand1, sizeof(vDk1[0]), longcmp); - vk1[0] = k1; - for (k = 1; k <= nrBand1; k++) - { - vk1[k] = vk1[k-1] + vDk1[k-1]; - if (vDk1[k-1] == 0) - return 1; - } - - sbr->N_master = nrBand0 + nrBand1; - sbr->N_master = min(sbr->N_master, 64); - for (k = 0; k <= nrBand0; k++) - { - sbr->f_master[k] = (uint8_t) vk0[k]; - } - for (k = nrBand0 + 1; k <= sbr->N_master; k++) - { - sbr->f_master[k] = (uint8_t) vk1[k - nrBand0]; - } - -#if 0 - printf("f_master[%d]: ", sbr->N_master); - for (k = 0; k <= sbr->N_master; k++) - { - printf("%d ", sbr->f_master[k]); - } - printf("\n"); -#endif - - return 0; -} - -/* calculate the derived frequency border tables from f_master */ -uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band, - uint8_t k2) -{ - uint8_t k, i; - uint32_t minus; - - /* The following relation shall be satisfied: bs_xover_band < N_Master */ - if (sbr->N_master <= bs_xover_band) - return 1; - - sbr->N_high = sbr->N_master - bs_xover_band; - sbr->N_low = (sbr->N_high>>1) + (sbr->N_high - ((sbr->N_high>>1)<<1)); - - sbr->n[0] = sbr->N_low; - sbr->n[1] = sbr->N_high; - - for (k = 0; k <= sbr->N_high; k++) - { - sbr->f_table_res[HI_RES][k] = sbr->f_master[k + bs_xover_band]; - } - - sbr->M = sbr->f_table_res[HI_RES][sbr->N_high] - sbr->f_table_res[HI_RES][0]; - sbr->kx = sbr->f_table_res[HI_RES][0]; - if (sbr->kx > 32) - return 1; - if (sbr->kx + sbr->M > 64) - return 1; - - minus = (sbr->N_high & 1) ? 1 : 0; - - for (k = 0; k <= sbr->N_low; k++) - { - if (k == 0) - i = 0; - else - i = (uint8_t)(2*k - minus); - sbr->f_table_res[LO_RES][k] = sbr->f_table_res[HI_RES][i]; - } - -#if 0 - printf("bs_freq_scale: %d\n", sbr->bs_freq_scale); - printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands); - printf("f_table_res[HI_RES][%d]: ", sbr->N_high); - for (k = 0; k <= sbr->N_high; k++) - { - printf("%d ", sbr->f_table_res[HI_RES][k]); - } - printf("\n"); -#endif -#if 0 - printf("f_table_res[LO_RES][%d]: ", sbr->N_low); - for (k = 0; k <= sbr->N_low; k++) - { - printf("%d ", sbr->f_table_res[LO_RES][k]); - } - printf("\n"); -#endif - - sbr->N_Q = 0; - if (sbr->bs_noise_bands == 0) - { - sbr->N_Q = 1; - } else { -#if 0 - sbr->N_Q = max(1, (int32_t)(sbr->bs_noise_bands*(log(k2/(float)sbr->kx)/log(2.0)) + 0.5)); -#else - sbr->N_Q = (uint8_t)(max(1, find_bands(0, sbr->bs_noise_bands, sbr->kx, k2))); -#endif - sbr->N_Q = min(5, sbr->N_Q); - } - - for (k = 0; k <= sbr->N_Q; k++) - { - if (k == 0) - { - i = 0; - } else { - /* i = i + (int32_t)((sbr->N_low - i)/(sbr->N_Q + 1 - k)); */ - i = i + (sbr->N_low - i)/(sbr->N_Q + 1 - k); - } - sbr->f_table_noise[k] = sbr->f_table_res[LO_RES][i]; - } - - /* build table for mapping k to g in hf patching */ - for (k = 0; k < 64; k++) - { - uint8_t g; - for (g = 0; g < sbr->N_Q; g++) - { - if ((sbr->f_table_noise[g] <= k) && - (k < sbr->f_table_noise[g+1])) - { - sbr->table_map_k_to_g[k] = g; - break; - } - } - } - -#if 0 - printf("f_table_noise[%d]: ", sbr->N_Q); - for (k = 0; k <= sbr->N_Q; k++) - { - printf("%d ", sbr->f_table_noise[k] - sbr->kx); - } - printf("\n"); -#endif - - return 0; -} - -/* TODO: blegh, ugly */ -/* Modified to calculate for all possible bs_limiter_bands always - * This reduces the number calls to this functions needed (now only on - * header reset) - */ -void limiter_frequency_table(sbr_info *sbr) -{ -#if 0 - static const real_t limiterBandsPerOctave[] = { REAL_CONST(1.2), - REAL_CONST(2), REAL_CONST(3) }; -#else - static const real_t limiterBandsCompare[] = { REAL_CONST(1.327152), - REAL_CONST(1.185093), REAL_CONST(1.119872) }; -#endif - uint8_t k, s; - int8_t nrLim; -#if 0 - real_t limBands; -#endif - - sbr->f_table_lim[0][0] = sbr->f_table_res[LO_RES][0] - sbr->kx; - sbr->f_table_lim[0][1] = sbr->f_table_res[LO_RES][sbr->N_low] - sbr->kx; - sbr->N_L[0] = 1; - -#if 0 - printf("f_table_lim[%d][%d]: ", 0, sbr->N_L[0]); - for (k = 0; k <= sbr->N_L[0]; k++) - { - printf("%d ", sbr->f_table_lim[0][k]); - } - printf("\n"); -#endif - - for (s = 1; s < 4; s++) - { - int32_t limTable[100 /*TODO*/] = {0}; - uint8_t patchBorders[64/*??*/] = {0}; - -#if 0 - limBands = limiterBandsPerOctave[s - 1]; -#endif - - patchBorders[0] = sbr->kx; - for (k = 1; k <= sbr->noPatches; k++) - { - patchBorders[k] = patchBorders[k-1] + sbr->patchNoSubbands[k-1]; - } - - for (k = 0; k <= sbr->N_low; k++) - { - limTable[k] = sbr->f_table_res[LO_RES][k]; - } - for (k = 1; k < sbr->noPatches; k++) - { - limTable[k+sbr->N_low] = patchBorders[k]; - } - - /* needed */ - qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp); - k = 1; - nrLim = sbr->noPatches + sbr->N_low - 1; - - if (nrLim < 0) // TODO: BIG FAT PROBLEM - return; - -restart: - if (k <= nrLim) - { - real_t nOctaves; - - if (limTable[k-1] != 0) -#if 0 - nOctaves = REAL_CONST(log((float)limTable[k]/(float)limTable[k-1])/log(2.0)); -#else -#ifdef FIXED_POINT - nOctaves = DIV_R((limTable[k]<noPatches; i++) - { - if (limTable[k] == patchBorders[i]) - found = 1; - } - if (found) - { - found2 = 0; - for (i = 0; i <= sbr->noPatches; i++) - { - if (limTable[k-1] == patchBorders[i]) - found2 = 1; - } - if (found2) - { - k++; - goto restart; - } else { - /* remove (k-1)th element */ - limTable[k-1] = sbr->f_table_res[LO_RES][sbr->N_low]; - qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp); - nrLim--; - goto restart; - } - } - } - /* remove kth element */ - limTable[k] = sbr->f_table_res[LO_RES][sbr->N_low]; - qsort(limTable, nrLim, sizeof(limTable[0]), longcmp); - nrLim--; - goto restart; - } else { - k++; - goto restart; - } - } - - sbr->N_L[s] = nrLim; - for (k = 0; k <= nrLim; k++) - { - sbr->f_table_lim[s][k] = limTable[k] - sbr->kx; - } - -#if 0 - printf("f_table_lim[%d][%d]: ", s, sbr->N_L[s]); - for (k = 0; k <= sbr->N_L[s]; k++) - { - printf("%d ", sbr->f_table_lim[s][k]); - } - printf("\n"); -#endif - } -} - -#endif diff --git a/mplayer/libfaad2/sbr_fbt.h b/mplayer/libfaad2/sbr_fbt.h deleted file mode 100644 index fde41356..00000000 --- a/mplayer/libfaad2/sbr_fbt.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_fbt.h,v 1.14 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __SBR_FBT_H__ -#define __SBR_FBT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode, - uint32_t sample_rate); -uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate, - uint8_t k0); -uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2, - uint8_t bs_alter_scale); -uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2, - uint8_t bs_freq_scale, uint8_t bs_alter_scale); -uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band, - uint8_t k2); -void limiter_frequency_table(sbr_info *sbr); - - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/mplayer/libfaad2/sbr_hfadj.c b/mplayer/libfaad2/sbr_hfadj.c deleted file mode 100644 index a1e50e8c..00000000 --- a/mplayer/libfaad2/sbr_hfadj.c +++ /dev/null @@ -1,1720 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_hfadj.c,v 1.18 2004/09/04 14:56:28 menno Exp $ -**/ - -/* High Frequency adjustment */ - -#include "common.h" -#include "structs.h" - -#ifdef SBR_DEC - -#include "sbr_syntax.h" -#include "sbr_hfadj.h" - -#include "sbr_noise.h" - - -/* static function declarations */ -static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj, - qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch); -static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch); -#ifdef SBR_LOW_POWER -static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch); -static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch); -#endif -static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch); - - -void hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64] -#ifdef SBR_LOW_POWER - ,real_t *deg /* aliasing degree */ -#endif - ,uint8_t ch) -{ - ALIGN sbr_hfadj_info adj = {{{0}}}; - - if (sbr->bs_frame_class[ch] == FIXFIX) - { - sbr->l_A[ch] = -1; - } else if (sbr->bs_frame_class[ch] == VARFIX) { - if (sbr->bs_pointer[ch] > 1) - sbr->l_A[ch] = -1; - else - sbr->l_A[ch] = sbr->bs_pointer[ch] - 1; - } else { - if (sbr->bs_pointer[ch] == 0) - sbr->l_A[ch] = -1; - else - sbr->l_A[ch] = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch]; - } - - estimate_current_envelope(sbr, &adj, Xsbr, ch); - - calculate_gain(sbr, &adj, ch); - -#ifdef SBR_LOW_POWER - calc_gain_groups(sbr, &adj, deg, ch); - aliasing_reduction(sbr, &adj, deg, ch); -#endif - - hf_assembly(sbr, &adj, Xsbr, ch); -} - -static uint8_t get_S_mapped(sbr_info *sbr, uint8_t ch, uint8_t l, uint8_t current_band) -{ - if (sbr->f[ch][l] == HI_RES) - { - /* in case of using f_table_high we just have 1 to 1 mapping - * from bs_add_harmonic[l][k] - */ - if ((l >= sbr->l_A[ch]) || - (sbr->bs_add_harmonic_prev[ch][current_band] && sbr->bs_add_harmonic_flag_prev[ch])) - { - return sbr->bs_add_harmonic[ch][current_band]; - } - } else { - uint8_t b, lb, ub; - - /* in case of f_table_low we check if any of the HI_RES bands - * within this LO_RES band has bs_add_harmonic[l][k] turned on - * (note that borders in the LO_RES table are also present in - * the HI_RES table) - */ - - /* find first HI_RES band in current LO_RES band */ - lb = 2*current_band - ((sbr->N_high & 1) ? 1 : 0); - /* find first HI_RES band in next LO_RES band */ - ub = 2*(current_band+1) - ((sbr->N_high & 1) ? 1 : 0); - - /* check all HI_RES bands in current LO_RES band for sinusoid */ - for (b = lb; b < ub; b++) - { - if ((l >= sbr->l_A[ch]) || - (sbr->bs_add_harmonic_prev[ch][b] && sbr->bs_add_harmonic_flag_prev[ch])) - { - if (sbr->bs_add_harmonic[ch][b] == 1) - return 1; - } - } - } - - return 0; -} - -static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj, - qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch) -{ - uint8_t m, l, j, k, k_l, k_h, p; - real_t nrg, div; - - if (sbr->bs_interpol_freq == 1) - { - for (l = 0; l < sbr->L_E[ch]; l++) - { - uint8_t i, l_i, u_i; - - l_i = sbr->t_E[ch][l]; - u_i = sbr->t_E[ch][l+1]; - - div = (real_t)(u_i - l_i); - - for (m = 0; m < sbr->M; m++) - { - nrg = 0; - - for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++) - { -#ifdef FIXED_POINT -#ifdef SBR_LOW_POWER - nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS); -#else - nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS) + - ((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS); -#endif -#else - nrg += MUL_R(QMF_RE(Xsbr[i][m + sbr->kx]), QMF_RE(Xsbr[i][m + sbr->kx])) -#ifndef SBR_LOW_POWER - + MUL_R(QMF_IM(Xsbr[i][m + sbr->kx]), QMF_IM(Xsbr[i][m + sbr->kx])) -#endif - ; -#endif - } - - sbr->E_curr[ch][m][l] = nrg / div; -#ifdef SBR_LOW_POWER -#ifdef FIXED_POINT - sbr->E_curr[ch][m][l] <<= 1; -#else - sbr->E_curr[ch][m][l] *= 2; -#endif -#endif - } - } - } else { - for (l = 0; l < sbr->L_E[ch]; l++) - { - for (p = 0; p < sbr->n[sbr->f[ch][l]]; p++) - { - k_l = sbr->f_table_res[sbr->f[ch][l]][p]; - k_h = sbr->f_table_res[sbr->f[ch][l]][p+1]; - - for (k = k_l; k < k_h; k++) - { - uint8_t i, l_i, u_i; - nrg = 0; - - l_i = sbr->t_E[ch][l]; - u_i = sbr->t_E[ch][l+1]; - - div = (real_t)((u_i - l_i)*(k_h - k_l)); - - for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++) - { - for (j = k_l; j < k_h; j++) - { -#ifdef FIXED_POINT -#ifdef SBR_LOW_POWER - nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS); -#else - nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS) + - ((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS); -#endif -#else - nrg += MUL_R(QMF_RE(Xsbr[i][j]), QMF_RE(Xsbr[i][j])) -#ifndef SBR_LOW_POWER - + MUL_R(QMF_IM(Xsbr[i][j]), QMF_IM(Xsbr[i][j])) -#endif - ; -#endif - } - } - - sbr->E_curr[ch][k - sbr->kx][l] = nrg / div; -#ifdef SBR_LOW_POWER -#ifdef FIXED_POINT - sbr->E_curr[ch][k - sbr->kx][l] <<= 1; -#else - sbr->E_curr[ch][k - sbr->kx][l] *= 2; -#endif -#endif - } - } - } - } -} - -#ifdef FIXED_POINT -#define EPS (1) /* smallest number available in fixed point */ -#else -#define EPS (1e-12) -#endif - - - -#ifdef FIXED_POINT - -/* log2 values of [0..63] */ -static const real_t log2_int_tab[] = { - LOG2_MIN_INF, REAL_CONST(0.000000000000000), REAL_CONST(1.000000000000000), REAL_CONST(1.584962500721156), - REAL_CONST(2.000000000000000), REAL_CONST(2.321928094887362), REAL_CONST(2.584962500721156), REAL_CONST(2.807354922057604), - REAL_CONST(3.000000000000000), REAL_CONST(3.169925001442313), REAL_CONST(3.321928094887363), REAL_CONST(3.459431618637297), - REAL_CONST(3.584962500721156), REAL_CONST(3.700439718141092), REAL_CONST(3.807354922057604), REAL_CONST(3.906890595608519), - REAL_CONST(4.000000000000000), REAL_CONST(4.087462841250339), REAL_CONST(4.169925001442312), REAL_CONST(4.247927513443585), - REAL_CONST(4.321928094887362), REAL_CONST(4.392317422778761), REAL_CONST(4.459431618637297), REAL_CONST(4.523561956057013), - REAL_CONST(4.584962500721156), REAL_CONST(4.643856189774724), REAL_CONST(4.700439718141093), REAL_CONST(4.754887502163468), - REAL_CONST(4.807354922057604), REAL_CONST(4.857980995127572), REAL_CONST(4.906890595608519), REAL_CONST(4.954196310386875), - REAL_CONST(5.000000000000000), REAL_CONST(5.044394119358453), REAL_CONST(5.087462841250340), REAL_CONST(5.129283016944966), - REAL_CONST(5.169925001442312), REAL_CONST(5.209453365628949), REAL_CONST(5.247927513443585), REAL_CONST(5.285402218862248), - REAL_CONST(5.321928094887363), REAL_CONST(5.357552004618084), REAL_CONST(5.392317422778761), REAL_CONST(5.426264754702098), - REAL_CONST(5.459431618637297), REAL_CONST(5.491853096329675), REAL_CONST(5.523561956057013), REAL_CONST(5.554588851677637), - REAL_CONST(5.584962500721156), REAL_CONST(5.614709844115208), REAL_CONST(5.643856189774724), REAL_CONST(5.672425341971495), - REAL_CONST(5.700439718141093), REAL_CONST(5.727920454563200), REAL_CONST(5.754887502163469), REAL_CONST(5.781359713524660), - REAL_CONST(5.807354922057605), REAL_CONST(5.832890014164742), REAL_CONST(5.857980995127572), REAL_CONST(5.882643049361842), - REAL_CONST(5.906890595608518), REAL_CONST(5.930737337562887), REAL_CONST(5.954196310386876), REAL_CONST(5.977279923499916) -}; - -static const real_t pan_log2_tab[] = { - REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), - REAL_CONST(0.044394119358453), REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), REAL_CONST(0.002815015607054), - REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), - REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667) -}; - -static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) -{ - /* check for coupled energy/noise data */ - if (sbr->bs_coupling == 1) - { - uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1; - uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1; - real_t tmp = (7 << REAL_BITS) + (sbr->E[0][k][l] << (REAL_BITS-amp0)); - real_t pan; - - /* E[1] should always be even so shifting is OK */ - uint8_t E = sbr->E[1][k][l] >> amp1; - - if (ch == 0) - { - if (E > 12) - { - /* negative */ - pan = pan_log2_tab[-12 + E]; - } else { - /* positive */ - pan = pan_log2_tab[12 - E] + ((12 - E)<amp_res[ch]) ? 0 : 1; - - return (6 << REAL_BITS) + (sbr->E[ch][k][l] << (REAL_BITS-amp)); - } -} - -static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) -{ - /* check for coupled energy/noise data */ - if (sbr->bs_coupling == 1) - { - real_t tmp = (7 << REAL_BITS) - (sbr->Q[0][k][l] << REAL_BITS); - real_t pan; - - uint8_t Q = sbr->Q[1][k][l]; - - if (ch == 0) - { - if (Q > 12) - { - /* negative */ - pan = pan_log2_tab[-12 + Q]; - } else { - /* positive */ - pan = pan_log2_tab[12 - Q] + ((12 - Q)<Q[ch][k][l] << REAL_BITS); - } -} - -static const real_t log_Qplus1_pan[31][13] = { - { REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) }, - { REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) }, - { REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) }, - { REAL_CONST(0.005623178556561), REAL_CONST(0.022346137091517), REAL_CONST(0.087132595479488), REAL_CONST(0.317482173442841), REAL_CONST(0.956931233406067), REAL_CONST(2.070389270782471), REAL_CONST(3.169924974441528), REAL_CONST(3.786596298217773), REAL_CONST(4.005294322967529), REAL_CONST(4.066420555114746), REAL_CONST(4.082170009613037), REAL_CONST(4.086137294769287), REAL_CONST(4.087131500244141) }, - { REAL_CONST(0.002814328996465), REAL_CONST(0.011216334067285), REAL_CONST(0.044224001467228), REAL_CONST(0.167456731200218), REAL_CONST(0.556393325328827), REAL_CONST(1.378511548042297), REAL_CONST(2.321928024291992), REAL_CONST(2.887525320053101), REAL_CONST(3.092446088790894), REAL_CONST(3.150059700012207), REAL_CONST(3.164926528930664), REAL_CONST(3.168673276901245), REAL_CONST(3.169611930847168) }, - { REAL_CONST(0.001407850766554), REAL_CONST(0.005619067233056), REAL_CONST(0.022281449288130), REAL_CONST(0.086156636476517), REAL_CONST(0.304854571819305), REAL_CONST(0.847996890544891), REAL_CONST(1.584962487220764), REAL_CONST(2.070389270782471), REAL_CONST(2.252387046813965), REAL_CONST(2.304061651229858), REAL_CONST(2.317430257797241), REAL_CONST(2.320801734924316), REAL_CONST(2.321646213531494) }, - { REAL_CONST(0.000704097095877), REAL_CONST(0.002812269143760), REAL_CONST(0.011183738708496), REAL_CONST(0.043721374124289), REAL_CONST(0.160464659333229), REAL_CONST(0.485426813364029), REAL_CONST(1.000000000000000), REAL_CONST(1.378511548042297), REAL_CONST(1.527246952056885), REAL_CONST(1.570089221000671), REAL_CONST(1.581215262413025), REAL_CONST(1.584023833274841), REAL_CONST(1.584727644920349) }, - { REAL_CONST(0.000352177477907), REAL_CONST(0.001406819908880), REAL_CONST(0.005602621007711), REAL_CONST(0.022026389837265), REAL_CONST(0.082462236285210), REAL_CONST(0.263034462928772), REAL_CONST(0.584962487220764), REAL_CONST(0.847996890544891), REAL_CONST(0.956931233406067), REAL_CONST(0.988859415054321), REAL_CONST(0.997190535068512), REAL_CONST(0.999296069145203), REAL_CONST(0.999823868274689) }, - { REAL_CONST(0.000176099492819), REAL_CONST(0.000703581434209), REAL_CONST(0.002804030198604), REAL_CONST(0.011055230163038), REAL_CONST(0.041820213198662), REAL_CONST(0.137503549456596), REAL_CONST(0.321928083896637), REAL_CONST(0.485426813364029), REAL_CONST(0.556393325328827), REAL_CONST(0.577544987201691), REAL_CONST(0.583090126514435), REAL_CONST(0.584493279457092), REAL_CONST(0.584845066070557) }, - { REAL_CONST(0.000088052431238), REAL_CONST(0.000351833587047), REAL_CONST(0.001402696361765), REAL_CONST(0.005538204684854), REAL_CONST(0.021061634644866), REAL_CONST(0.070389263331890), REAL_CONST(0.169925004243851), REAL_CONST(0.263034462928772), REAL_CONST(0.304854571819305), REAL_CONST(0.317482173442841), REAL_CONST(0.320804953575134), REAL_CONST(0.321646571159363), REAL_CONST(0.321857661008835) }, - { REAL_CONST(0.000044026888645), REAL_CONST(0.000175927518285), REAL_CONST(0.000701518612914), REAL_CONST(0.002771759871393), REAL_CONST(0.010569252073765), REAL_CONST(0.035623874515295), REAL_CONST(0.087462842464447), REAL_CONST(0.137503549456596), REAL_CONST(0.160464659333229), REAL_CONST(0.167456731200218), REAL_CONST(0.169301137328148), REAL_CONST(0.169768601655960), REAL_CONST(0.169885858893394) }, - { REAL_CONST(0.000022013611670), REAL_CONST(0.000088052431238), REAL_CONST(0.000350801943569), REAL_CONST(0.001386545598507), REAL_CONST(0.005294219125062), REAL_CONST(0.017921976745129), REAL_CONST(0.044394120573997), REAL_CONST(0.070389263331890), REAL_CONST(0.082462236285210), REAL_CONST(0.086156636476517), REAL_CONST(0.087132595479488), REAL_CONST(0.087379962205887), REAL_CONST(0.087442122399807) }, - { REAL_CONST(0.000011006847672), REAL_CONST(0.000044026888645), REAL_CONST(0.000175411638338), REAL_CONST(0.000693439331371), REAL_CONST(0.002649537986144), REAL_CONST(0.008988817222416), REAL_CONST(0.022367812693119), REAL_CONST(0.035623874515295), REAL_CONST(0.041820213198662), REAL_CONST(0.043721374124289), REAL_CONST(0.044224001467228), REAL_CONST(0.044351425021887), REAL_CONST(0.044383447617292) }, - { REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000087708482170), REAL_CONST(0.000346675369656), REAL_CONST(0.001325377263129), REAL_CONST(0.004501323681325), REAL_CONST(0.011227255687118), REAL_CONST(0.017921976745129), REAL_CONST(0.021061634644866), REAL_CONST(0.022026389837265), REAL_CONST(0.022281449288130), REAL_CONST(0.022346137091517), REAL_CONST(0.022362394258380) }, - { REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043854910473), REAL_CONST(0.000173348103999), REAL_CONST(0.000662840844598), REAL_CONST(0.002252417383716), REAL_CONST(0.005624548997730), REAL_CONST(0.008988817222416), REAL_CONST(0.010569252073765), REAL_CONST(0.011055230163038), REAL_CONST(0.011183738708496), REAL_CONST(0.011216334067285), REAL_CONST(0.011224525049329) }, - { REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000086676649516), REAL_CONST(0.000331544462824), REAL_CONST(0.001126734190620), REAL_CONST(0.002815015614033), REAL_CONST(0.004501323681325), REAL_CONST(0.005294219125062), REAL_CONST(0.005538204684854), REAL_CONST(0.005602621007711), REAL_CONST(0.005619067233056), REAL_CONST(0.005623178556561) }, - { REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043338975956), REAL_CONST(0.000165781748365), REAL_CONST(0.000563477107789), REAL_CONST(0.001408194424585), REAL_CONST(0.002252417383716), REAL_CONST(0.002649537986144), REAL_CONST(0.002771759871393), REAL_CONST(0.002804030198604), REAL_CONST(0.002812269143760), REAL_CONST(0.002814328996465) }, - { REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000021669651687), REAL_CONST(0.000082893253420), REAL_CONST(0.000281680084299), REAL_CONST(0.000704268983100), REAL_CONST(0.001126734190620), REAL_CONST(0.001325377263129), REAL_CONST(0.001386545598507), REAL_CONST(0.001402696361765), REAL_CONST(0.001406819908880), REAL_CONST(0.001407850766554) }, - { REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010834866771), REAL_CONST(0.000041447223339), REAL_CONST(0.000140846910654), REAL_CONST(0.000352177477907), REAL_CONST(0.000563477107789), REAL_CONST(0.000662840844598), REAL_CONST(0.000693439331371), REAL_CONST(0.000701518612914), REAL_CONST(0.000703581434209), REAL_CONST(0.000704097095877) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000020637769921), REAL_CONST(0.000070511166996), REAL_CONST(0.000176099492819), REAL_CONST(0.000281680084299), REAL_CONST(0.000331544462824), REAL_CONST(0.000346675369656), REAL_CONST(0.000350801943569), REAL_CONST(0.000351833587047), REAL_CONST(0.000352177477907) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010318922250), REAL_CONST(0.000035256012779), REAL_CONST(0.000088052431238), REAL_CONST(0.000140846910654), REAL_CONST(0.000165781748365), REAL_CONST(0.000173348103999), REAL_CONST(0.000175411638338), REAL_CONST(0.000175927518285), REAL_CONST(0.000176099492819) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005159470220), REAL_CONST(0.000017542124624), REAL_CONST(0.000044026888645), REAL_CONST(0.000070511166996), REAL_CONST(0.000082893253420), REAL_CONST(0.000086676649516), REAL_CONST(0.000087708482170), REAL_CONST(0.000088052431238), REAL_CONST(0.000088052431238) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002579737384), REAL_CONST(0.000008771088687), REAL_CONST(0.000022013611670), REAL_CONST(0.000035256012779), REAL_CONST(0.000041447223339), REAL_CONST(0.000043338975956), REAL_CONST(0.000043854910473), REAL_CONST(0.000044026888645), REAL_CONST(0.000044026888645) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000004471542070), REAL_CONST(0.000011006847672), REAL_CONST(0.000017542124624), REAL_CONST(0.000020637769921), REAL_CONST(0.000021669651687), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002235772627), REAL_CONST(0.000005503434295), REAL_CONST(0.000008771088687), REAL_CONST(0.000010318922250), REAL_CONST(0.000010834866771), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001031895522), REAL_CONST(0.000002751719876), REAL_CONST(0.000004471542070), REAL_CONST(0.000005159470220), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000515947875), REAL_CONST(0.000001375860506), REAL_CONST(0.000002235772627), REAL_CONST(0.000002579737384), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000000687930424), REAL_CONST(0.000001031895522), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000515947875), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) } -}; - -static const real_t log_Qplus1[31] = { - REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339), - REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156), - REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), - REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453), - REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), - REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), - REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), - REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667), - REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551), - REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641), - REAL_CONST(0.000000000000000) -}; - -static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) -{ - /* check for coupled energy/noise data */ - if (sbr->bs_coupling == 1) - { - if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) && - (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24)) - { - if (ch == 0) - { - return log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1]; - } else { - return log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)]; - } - } else { - return 0; - } - } else { - if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30) - { - return log_Qplus1[sbr->Q[ch][k][l]]; - } else { - return 0; - } - } -} - -static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch) -{ - /* log2 values of limiter gains */ - static real_t limGain[] = { - REAL_CONST(-1.0), REAL_CONST(0.0), REAL_CONST(1.0), REAL_CONST(33.219) - }; - uint8_t m, l, k; - - uint8_t current_t_noise_band = 0; - uint8_t S_mapped; - - ALIGN real_t Q_M_lim[MAX_M]; - ALIGN real_t G_lim[MAX_M]; - ALIGN real_t G_boost; - ALIGN real_t S_M[MAX_M]; - - - for (l = 0; l < sbr->L_E[ch]; l++) - { - uint8_t current_f_noise_band = 0; - uint8_t current_res_band = 0; - uint8_t current_res_band2 = 0; - uint8_t current_hi_res_band = 0; - - real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1; - - S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); - - if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1]) - { - current_t_noise_band++; - } - - for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) - { - real_t Q_M = 0; - real_t G_max; - real_t den = 0; - real_t acc1 = 0; - real_t acc2 = 0; - uint8_t current_res_band_size = 0; - uint8_t Q_M_size = 0; - - uint8_t ml1, ml2; - - /* bounds of current limiter bands */ - ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k]; - ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; - - - /* calculate the accumulated E_orig and E_curr over the limiter band */ - for (m = ml1; m < ml2; m++) - { - if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1]) - { - current_res_band_size++; - } else { - acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)); - - current_res_band++; - current_res_band_size = 1; - } - - acc2 += sbr->E_curr[ch][m][l]; - } - acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)); - - - if (acc1 == 0) - acc1 = LOG2_MIN_INF; - else - acc1 = log2_int(acc1); - - - /* calculate the maximum gain */ - /* ratio of the energy of the original signal and the energy - * of the HF generated signal - */ - G_max = acc1 - log2_int(acc2) + limGain[sbr->bs_limiter_gains]; - G_max = min(G_max, limGain[3]); - - - for (m = ml1; m < ml2; m++) - { - real_t G; - real_t E_curr, E_orig; - real_t Q_orig, Q_orig_plus1; - uint8_t S_index_mapped; - - - /* check if m is on a noise band border */ - if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1]) - { - /* step to next noise band */ - current_f_noise_band++; - } - - - /* check if m is on a resolution band border */ - if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1]) - { - /* accumulate a whole range of equal Q_Ms */ - if (Q_M_size > 0) - den += pow2_int(log2_int_tab[Q_M_size] + Q_M); - Q_M_size = 0; - - /* step to next resolution band */ - current_res_band2++; - - /* if we move to a new resolution band, we should check if we are - * going to add a sinusoid in this band - */ - S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); - } - - - /* check if m is on a HI_RES band border */ - if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1]) - { - /* step to next HI_RES band */ - current_hi_res_band++; - } - - - /* find S_index_mapped - * S_index_mapped can only be 1 for the m in the middle of the - * current HI_RES band - */ - S_index_mapped = 0; - if ((l >= sbr->l_A[ch]) || - (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch])) - { - /* find the middle subband of the HI_RES frequency band */ - if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1) - S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band]; - } - - - /* find bitstream parameters */ - if (sbr->E_curr[ch][m][l] == 0) - E_curr = LOG2_MIN_INF; - else - E_curr = log2_int(sbr->E_curr[ch][m][l]); - E_orig = -REAL_CONST(10) + find_log2_E(sbr, current_res_band2, l, ch); - - - Q_orig = find_log2_Q(sbr, current_f_noise_band, current_t_noise_band, ch); - Q_orig_plus1 = find_log2_Qplus1(sbr, current_f_noise_band, current_t_noise_band, ch); - - - /* Q_M only depends on E_orig and Q_div2: - * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on - * a change of current res band (HI or LO) - */ - Q_M = E_orig + Q_orig - Q_orig_plus1; - - - /* S_M only depends on E_orig, Q_div and S_index_mapped: - * S_index_mapped can only be non-zero once per HI_RES band - */ - if (S_index_mapped == 0) - { - S_M[m] = LOG2_MIN_INF; /* -inf */ - } else { - S_M[m] = E_orig - Q_orig_plus1; - - /* accumulate sinusoid part of the total energy */ - den += pow2_int(S_M[m]); - } - - - /* calculate gain */ - /* ratio of the energy of the original signal and the energy - * of the HF generated signal - */ - /* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */ - /* scaled by -10 */ - G = E_orig - max(-REAL_CONST(10), E_curr); - if ((S_mapped == 0) && (delta == 1)) - { - /* G = G * 1/(1+Q) */ - G -= Q_orig_plus1; - } else if (S_mapped == 1) { - /* G = G * Q/(1+Q) */ - G += Q_orig - Q_orig_plus1; - } - - - /* limit the additional noise energy level */ - /* and apply the limiter */ - if (G_max > G) - { - Q_M_lim[m] = Q_M; - G_lim[m] = G; - - if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) - { - Q_M_size++; - } - } else { - /* G > G_max */ - Q_M_lim[m] = Q_M + G_max - G; - G_lim[m] = G_max; - - /* accumulate limited Q_M */ - if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) - { - den += pow2_int(Q_M_lim[m]); - } - } - - - /* accumulate the total energy */ - /* E_curr changes for every m so we do need to accumulate every m */ - den += pow2_int(E_curr + G_lim[m]); - } - - /* accumulate last range of equal Q_Ms */ - if (Q_M_size > 0) - { - den += pow2_int(log2_int_tab[Q_M_size] + Q_M); - } - - - /* calculate the final gain */ - /* G_boost: [0..2.51188643] */ - G_boost = acc1 - log2_int(den /*+ EPS*/); - G_boost = min(G_boost, REAL_CONST(1.328771237) /* log2(1.584893192 ^ 2) */); - - - for (m = ml1; m < ml2; m++) - { - /* apply compensation to gain, noise floor sf's and sinusoid levels */ -#ifndef SBR_LOW_POWER - adj->G_lim_boost[l][m] = pow2_fix((G_lim[m] + G_boost) >> 1); -#else - /* sqrt() will be done after the aliasing reduction to save a - * few multiplies - */ - adj->G_lim_boost[l][m] = pow2_fix(G_lim[m] + G_boost); -#endif - adj->Q_M_lim_boost[l][m] = pow2_fix((Q_M_lim[m] + G_boost) >> 1); - - if (S_M[m] != LOG2_MIN_INF) - { - adj->S_M_boost[l][m] = pow2_int((S_M[m] + G_boost) >> 1); - } else { - adj->S_M_boost[l][m] = 0; - } - } - } - } -} - -#else - -//#define LOG2_TEST - -#ifdef LOG2_TEST - -#define LOG2_MIN_INF -100000 - -__inline float pow2(float val) -{ - return pow(2.0, val); -} -__inline float log2(float val) -{ - return log(val)/log(2.0); -} - -#define RB 14 - -float QUANTISE2REAL(float val) -{ - __int32 ival = (__int32)(val * (1<bs_coupling == 1) - { - real_t amp0 = (sbr->amp_res[0]) ? 1.0 : 0.5; - real_t amp1 = (sbr->amp_res[1]) ? 1.0 : 0.5; - float tmp = QUANTISE2REAL(7.0 + (real_t)sbr->E[0][k][l] * amp0); - float pan; - - int E = (int)(sbr->E[1][k][l] * amp1); - - if (ch == 0) - { - if (E > 12) - { - /* negative */ - pan = QUANTISE2REAL(pan_log2_tab[-12 + E]); - } else { - /* positive */ - pan = QUANTISE2REAL(pan_log2_tab[12 - E] + (12 - E)); - } - } else { - if (E < 12) - { - /* negative */ - pan = QUANTISE2REAL(pan_log2_tab[-E + 12]); - } else { - /* positive */ - pan = QUANTISE2REAL(pan_log2_tab[E - 12] + (E - 12)); - } - } - - /* tmp / pan in log2 */ - return QUANTISE2REAL(tmp - pan); - } else { - real_t amp = (sbr->amp_res[ch]) ? 1.0 : 0.5; - - return QUANTISE2REAL(6.0 + (real_t)sbr->E[ch][k][l] * amp); - } -} - -static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) -{ - /* check for coupled energy/noise data */ - if (sbr->bs_coupling == 1) - { - float tmp = QUANTISE2REAL(7.0 - (real_t)sbr->Q[0][k][l]); - float pan; - - int Q = (int)(sbr->Q[1][k][l]); - - if (ch == 0) - { - if (Q > 12) - { - /* negative */ - pan = QUANTISE2REAL(pan_log2_tab[-12 + Q]); - } else { - /* positive */ - pan = QUANTISE2REAL(pan_log2_tab[12 - Q] + (12 - Q)); - } - } else { - if (Q < 12) - { - /* negative */ - pan = QUANTISE2REAL(pan_log2_tab[-Q + 12]); - } else { - /* positive */ - pan = QUANTISE2REAL(pan_log2_tab[Q - 12] + (Q - 12)); - } - } - - /* tmp / pan in log2 */ - return QUANTISE2REAL(tmp - pan); - } else { - return QUANTISE2REAL(6.0 - (real_t)sbr->Q[ch][k][l]); - } -} - -static const real_t log_Qplus1_pan[31][13] = { - { REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) }, - { REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) }, - { REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) }, - { REAL_CONST(0.005623178556561), REAL_CONST(0.022346137091517), REAL_CONST(0.087132595479488), REAL_CONST(0.317482173442841), REAL_CONST(0.956931233406067), REAL_CONST(2.070389270782471), REAL_CONST(3.169924974441528), REAL_CONST(3.786596298217773), REAL_CONST(4.005294322967529), REAL_CONST(4.066420555114746), REAL_CONST(4.082170009613037), REAL_CONST(4.086137294769287), REAL_CONST(4.087131500244141) }, - { REAL_CONST(0.002814328996465), REAL_CONST(0.011216334067285), REAL_CONST(0.044224001467228), REAL_CONST(0.167456731200218), REAL_CONST(0.556393325328827), REAL_CONST(1.378511548042297), REAL_CONST(2.321928024291992), REAL_CONST(2.887525320053101), REAL_CONST(3.092446088790894), REAL_CONST(3.150059700012207), REAL_CONST(3.164926528930664), REAL_CONST(3.168673276901245), REAL_CONST(3.169611930847168) }, - { REAL_CONST(0.001407850766554), REAL_CONST(0.005619067233056), REAL_CONST(0.022281449288130), REAL_CONST(0.086156636476517), REAL_CONST(0.304854571819305), REAL_CONST(0.847996890544891), REAL_CONST(1.584962487220764), REAL_CONST(2.070389270782471), REAL_CONST(2.252387046813965), REAL_CONST(2.304061651229858), REAL_CONST(2.317430257797241), REAL_CONST(2.320801734924316), REAL_CONST(2.321646213531494) }, - { REAL_CONST(0.000704097095877), REAL_CONST(0.002812269143760), REAL_CONST(0.011183738708496), REAL_CONST(0.043721374124289), REAL_CONST(0.160464659333229), REAL_CONST(0.485426813364029), REAL_CONST(1.000000000000000), REAL_CONST(1.378511548042297), REAL_CONST(1.527246952056885), REAL_CONST(1.570089221000671), REAL_CONST(1.581215262413025), REAL_CONST(1.584023833274841), REAL_CONST(1.584727644920349) }, - { REAL_CONST(0.000352177477907), REAL_CONST(0.001406819908880), REAL_CONST(0.005602621007711), REAL_CONST(0.022026389837265), REAL_CONST(0.082462236285210), REAL_CONST(0.263034462928772), REAL_CONST(0.584962487220764), REAL_CONST(0.847996890544891), REAL_CONST(0.956931233406067), REAL_CONST(0.988859415054321), REAL_CONST(0.997190535068512), REAL_CONST(0.999296069145203), REAL_CONST(0.999823868274689) }, - { REAL_CONST(0.000176099492819), REAL_CONST(0.000703581434209), REAL_CONST(0.002804030198604), REAL_CONST(0.011055230163038), REAL_CONST(0.041820213198662), REAL_CONST(0.137503549456596), REAL_CONST(0.321928083896637), REAL_CONST(0.485426813364029), REAL_CONST(0.556393325328827), REAL_CONST(0.577544987201691), REAL_CONST(0.583090126514435), REAL_CONST(0.584493279457092), REAL_CONST(0.584845066070557) }, - { REAL_CONST(0.000088052431238), REAL_CONST(0.000351833587047), REAL_CONST(0.001402696361765), REAL_CONST(0.005538204684854), REAL_CONST(0.021061634644866), REAL_CONST(0.070389263331890), REAL_CONST(0.169925004243851), REAL_CONST(0.263034462928772), REAL_CONST(0.304854571819305), REAL_CONST(0.317482173442841), REAL_CONST(0.320804953575134), REAL_CONST(0.321646571159363), REAL_CONST(0.321857661008835) }, - { REAL_CONST(0.000044026888645), REAL_CONST(0.000175927518285), REAL_CONST(0.000701518612914), REAL_CONST(0.002771759871393), REAL_CONST(0.010569252073765), REAL_CONST(0.035623874515295), REAL_CONST(0.087462842464447), REAL_CONST(0.137503549456596), REAL_CONST(0.160464659333229), REAL_CONST(0.167456731200218), REAL_CONST(0.169301137328148), REAL_CONST(0.169768601655960), REAL_CONST(0.169885858893394) }, - { REAL_CONST(0.000022013611670), REAL_CONST(0.000088052431238), REAL_CONST(0.000350801943569), REAL_CONST(0.001386545598507), REAL_CONST(0.005294219125062), REAL_CONST(0.017921976745129), REAL_CONST(0.044394120573997), REAL_CONST(0.070389263331890), REAL_CONST(0.082462236285210), REAL_CONST(0.086156636476517), REAL_CONST(0.087132595479488), REAL_CONST(0.087379962205887), REAL_CONST(0.087442122399807) }, - { REAL_CONST(0.000011006847672), REAL_CONST(0.000044026888645), REAL_CONST(0.000175411638338), REAL_CONST(0.000693439331371), REAL_CONST(0.002649537986144), REAL_CONST(0.008988817222416), REAL_CONST(0.022367812693119), REAL_CONST(0.035623874515295), REAL_CONST(0.041820213198662), REAL_CONST(0.043721374124289), REAL_CONST(0.044224001467228), REAL_CONST(0.044351425021887), REAL_CONST(0.044383447617292) }, - { REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000087708482170), REAL_CONST(0.000346675369656), REAL_CONST(0.001325377263129), REAL_CONST(0.004501323681325), REAL_CONST(0.011227255687118), REAL_CONST(0.017921976745129), REAL_CONST(0.021061634644866), REAL_CONST(0.022026389837265), REAL_CONST(0.022281449288130), REAL_CONST(0.022346137091517), REAL_CONST(0.022362394258380) }, - { REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043854910473), REAL_CONST(0.000173348103999), REAL_CONST(0.000662840844598), REAL_CONST(0.002252417383716), REAL_CONST(0.005624548997730), REAL_CONST(0.008988817222416), REAL_CONST(0.010569252073765), REAL_CONST(0.011055230163038), REAL_CONST(0.011183738708496), REAL_CONST(0.011216334067285), REAL_CONST(0.011224525049329) }, - { REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000086676649516), REAL_CONST(0.000331544462824), REAL_CONST(0.001126734190620), REAL_CONST(0.002815015614033), REAL_CONST(0.004501323681325), REAL_CONST(0.005294219125062), REAL_CONST(0.005538204684854), REAL_CONST(0.005602621007711), REAL_CONST(0.005619067233056), REAL_CONST(0.005623178556561) }, - { REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043338975956), REAL_CONST(0.000165781748365), REAL_CONST(0.000563477107789), REAL_CONST(0.001408194424585), REAL_CONST(0.002252417383716), REAL_CONST(0.002649537986144), REAL_CONST(0.002771759871393), REAL_CONST(0.002804030198604), REAL_CONST(0.002812269143760), REAL_CONST(0.002814328996465) }, - { REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000021669651687), REAL_CONST(0.000082893253420), REAL_CONST(0.000281680084299), REAL_CONST(0.000704268983100), REAL_CONST(0.001126734190620), REAL_CONST(0.001325377263129), REAL_CONST(0.001386545598507), REAL_CONST(0.001402696361765), REAL_CONST(0.001406819908880), REAL_CONST(0.001407850766554) }, - { REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010834866771), REAL_CONST(0.000041447223339), REAL_CONST(0.000140846910654), REAL_CONST(0.000352177477907), REAL_CONST(0.000563477107789), REAL_CONST(0.000662840844598), REAL_CONST(0.000693439331371), REAL_CONST(0.000701518612914), REAL_CONST(0.000703581434209), REAL_CONST(0.000704097095877) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000020637769921), REAL_CONST(0.000070511166996), REAL_CONST(0.000176099492819), REAL_CONST(0.000281680084299), REAL_CONST(0.000331544462824), REAL_CONST(0.000346675369656), REAL_CONST(0.000350801943569), REAL_CONST(0.000351833587047), REAL_CONST(0.000352177477907) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010318922250), REAL_CONST(0.000035256012779), REAL_CONST(0.000088052431238), REAL_CONST(0.000140846910654), REAL_CONST(0.000165781748365), REAL_CONST(0.000173348103999), REAL_CONST(0.000175411638338), REAL_CONST(0.000175927518285), REAL_CONST(0.000176099492819) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005159470220), REAL_CONST(0.000017542124624), REAL_CONST(0.000044026888645), REAL_CONST(0.000070511166996), REAL_CONST(0.000082893253420), REAL_CONST(0.000086676649516), REAL_CONST(0.000087708482170), REAL_CONST(0.000088052431238), REAL_CONST(0.000088052431238) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002579737384), REAL_CONST(0.000008771088687), REAL_CONST(0.000022013611670), REAL_CONST(0.000035256012779), REAL_CONST(0.000041447223339), REAL_CONST(0.000043338975956), REAL_CONST(0.000043854910473), REAL_CONST(0.000044026888645), REAL_CONST(0.000044026888645) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000004471542070), REAL_CONST(0.000011006847672), REAL_CONST(0.000017542124624), REAL_CONST(0.000020637769921), REAL_CONST(0.000021669651687), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002235772627), REAL_CONST(0.000005503434295), REAL_CONST(0.000008771088687), REAL_CONST(0.000010318922250), REAL_CONST(0.000010834866771), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001031895522), REAL_CONST(0.000002751719876), REAL_CONST(0.000004471542070), REAL_CONST(0.000005159470220), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000515947875), REAL_CONST(0.000001375860506), REAL_CONST(0.000002235772627), REAL_CONST(0.000002579737384), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000000687930424), REAL_CONST(0.000001031895522), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000515947875), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269) }, - { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) } -}; - -static const real_t log_Qplus1[31] = { - REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339), - REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156), - REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), - REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453), - REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), - REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), - REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), - REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667), - REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551), - REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641), - REAL_CONST(0.000000000000000) -}; - -static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) -{ - /* check for coupled energy/noise data */ - if (sbr->bs_coupling == 1) - { - if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) && - (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24)) - { - if (ch == 0) - { - return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1]); - } else { - return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)]); - } - } else { - return 0; - } - } else { - if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30) - { - return QUANTISE2REAL(log_Qplus1[sbr->Q[ch][k][l]]); - } else { - return 0; - } - } -} - -static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch) -{ - /* log2 values of limiter gains */ - static real_t limGain[] = { -1.0, 0.0, 1.0, 33.219 }; - uint8_t m, l, k; - - uint8_t current_t_noise_band = 0; - uint8_t S_mapped; - - ALIGN real_t Q_M_lim[MAX_M]; - ALIGN real_t G_lim[MAX_M]; - ALIGN real_t G_boost; - ALIGN real_t S_M[MAX_M]; - - - for (l = 0; l < sbr->L_E[ch]; l++) - { - uint8_t current_f_noise_band = 0; - uint8_t current_res_band = 0; - uint8_t current_res_band2 = 0; - uint8_t current_hi_res_band = 0; - - real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1; - - S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); - - if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1]) - { - current_t_noise_band++; - } - - for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) - { - real_t Q_M = 0; - real_t G_max; - real_t den = 0; - real_t acc1 = 0; - real_t acc2 = 0; - uint8_t current_res_band_size = 0; - uint8_t Q_M_size = 0; - - uint8_t ml1, ml2; - - /* bounds of current limiter bands */ - ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k]; - ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; - - - /* calculate the accumulated E_orig and E_curr over the limiter band */ - for (m = ml1; m < ml2; m++) - { - if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1]) - { - current_res_band_size++; - } else { - acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch))); - - current_res_band++; - current_res_band_size = 1; - } - - acc2 += QUANTISE2INT(sbr->E_curr[ch][m][l]/1024.0); - } - acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch))); - - acc1 = QUANTISE2REAL( log2(EPS + acc1) ); - - - /* calculate the maximum gain */ - /* ratio of the energy of the original signal and the energy - * of the HF generated signal - */ - G_max = acc1 - QUANTISE2REAL(log2(EPS + acc2)) + QUANTISE2REAL(limGain[sbr->bs_limiter_gains]); - G_max = min(G_max, QUANTISE2REAL(limGain[3])); - - - for (m = ml1; m < ml2; m++) - { - real_t G; - real_t E_curr, E_orig; - real_t Q_orig, Q_orig_plus1; - uint8_t S_index_mapped; - - - /* check if m is on a noise band border */ - if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1]) - { - /* step to next noise band */ - current_f_noise_band++; - } - - - /* check if m is on a resolution band border */ - if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1]) - { - /* accumulate a whole range of equal Q_Ms */ - if (Q_M_size > 0) - den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M)); - Q_M_size = 0; - - /* step to next resolution band */ - current_res_band2++; - - /* if we move to a new resolution band, we should check if we are - * going to add a sinusoid in this band - */ - S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); - } - - - /* check if m is on a HI_RES band border */ - if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1]) - { - /* step to next HI_RES band */ - current_hi_res_band++; - } - - - /* find S_index_mapped - * S_index_mapped can only be 1 for the m in the middle of the - * current HI_RES band - */ - S_index_mapped = 0; - if ((l >= sbr->l_A[ch]) || - (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch])) - { - /* find the middle subband of the HI_RES frequency band */ - if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1) - S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band]; - } - - - /* find bitstream parameters */ - if (sbr->E_curr[ch][m][l] == 0) - E_curr = LOG2_MIN_INF; - else - E_curr = -10 + log2(sbr->E_curr[ch][m][l]); - E_orig = -10 + find_log2_E(sbr, current_res_band2, l, ch); - - Q_orig = find_log2_Q(sbr, current_f_noise_band, current_t_noise_band, ch); - Q_orig_plus1 = find_log2_Qplus1(sbr, current_f_noise_band, current_t_noise_band, ch); - - - /* Q_M only depends on E_orig and Q_div2: - * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on - * a change of current res band (HI or LO) - */ - Q_M = E_orig + Q_orig - Q_orig_plus1; - - - /* S_M only depends on E_orig, Q_div and S_index_mapped: - * S_index_mapped can only be non-zero once per HI_RES band - */ - if (S_index_mapped == 0) - { - S_M[m] = LOG2_MIN_INF; /* -inf */ - } else { - S_M[m] = E_orig - Q_orig_plus1; - - /* accumulate sinusoid part of the total energy */ - den += pow2(S_M[m]); - } - - - /* calculate gain */ - /* ratio of the energy of the original signal and the energy - * of the HF generated signal - */ - /* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */ - /* scaled by -10 */ - G = E_orig - max(-10, E_curr); - if ((S_mapped == 0) && (delta == 1)) - { - /* G = G * 1/(1+Q) */ - G -= Q_orig_plus1; - } else if (S_mapped == 1) { - /* G = G * Q/(1+Q) */ - G += Q_orig - Q_orig_plus1; - } - - - /* limit the additional noise energy level */ - /* and apply the limiter */ - if (G_max > G) - { - Q_M_lim[m] = QUANTISE2REAL(Q_M); - G_lim[m] = QUANTISE2REAL(G); - - if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) - { - Q_M_size++; - } - } else { - /* G > G_max */ - Q_M_lim[m] = QUANTISE2REAL(Q_M) + G_max - QUANTISE2REAL(G); - G_lim[m] = G_max; - - /* accumulate limited Q_M */ - if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) - { - den += QUANTISE2INT(pow2(Q_M_lim[m])); - } - } - - - /* accumulate the total energy */ - /* E_curr changes for every m so we do need to accumulate every m */ - den += QUANTISE2INT(pow2(E_curr + G_lim[m])); - } - - /* accumulate last range of equal Q_Ms */ - if (Q_M_size > 0) - { - den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M)); - } - - - /* calculate the final gain */ - /* G_boost: [0..2.51188643] */ - G_boost = acc1 - QUANTISE2REAL(log2(den + EPS)); - G_boost = min(G_boost, QUANTISE2REAL(1.328771237) /* log2(1.584893192 ^ 2) */); - - - for (m = ml1; m < ml2; m++) - { - /* apply compensation to gain, noise floor sf's and sinusoid levels */ -#ifndef SBR_LOW_POWER - adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2((G_lim[m] + G_boost) / 2.0)); -#else - /* sqrt() will be done after the aliasing reduction to save a - * few multiplies - */ - adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2(G_lim[m] + G_boost)); -#endif - adj->Q_M_lim_boost[l][m] = QUANTISE2REAL(pow2((Q_M_lim[m] + 10 + G_boost) / 2.0)); - - if (S_M[m] != LOG2_MIN_INF) - { - adj->S_M_boost[l][m] = QUANTISE2REAL(pow2((S_M[m] + 10 + G_boost) / 2.0)); - } else { - adj->S_M_boost[l][m] = 0; - } - } - } - } -} - -#else - -static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch) -{ - static real_t limGain[] = { 0.5, 1.0, 2.0, 1e10 }; - uint8_t m, l, k; - - uint8_t current_t_noise_band = 0; - uint8_t S_mapped; - - ALIGN real_t Q_M_lim[MAX_M]; - ALIGN real_t G_lim[MAX_M]; - ALIGN real_t G_boost; - ALIGN real_t S_M[MAX_M]; - - for (l = 0; l < sbr->L_E[ch]; l++) - { - uint8_t current_f_noise_band = 0; - uint8_t current_res_band = 0; - uint8_t current_res_band2 = 0; - uint8_t current_hi_res_band = 0; - - real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1; - - S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); - - if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1]) - { - current_t_noise_band++; - } - - for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) - { - real_t G_max; - real_t den = 0; - real_t acc1 = 0; - real_t acc2 = 0; - uint8_t current_res_band_size = 0; - - uint8_t ml1, ml2; - - ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k]; - ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; - - - /* calculate the accumulated E_orig and E_curr over the limiter band */ - for (m = ml1; m < ml2; m++) - { - if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band+1]) - { - current_res_band++; - } - acc1 += sbr->E_orig[ch][current_res_band][l]; - acc2 += sbr->E_curr[ch][m][l]; - } - - - /* calculate the maximum gain */ - /* ratio of the energy of the original signal and the energy - * of the HF generated signal - */ - G_max = ((EPS + acc1) / (EPS + acc2)) * limGain[sbr->bs_limiter_gains]; - G_max = min(G_max, 1e10); - - - for (m = ml1; m < ml2; m++) - { - real_t Q_M, G; - real_t Q_div, Q_div2; - uint8_t S_index_mapped; - - - /* check if m is on a noise band border */ - if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1]) - { - /* step to next noise band */ - current_f_noise_band++; - } - - - /* check if m is on a resolution band border */ - if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1]) - { - /* step to next resolution band */ - current_res_band2++; - - /* if we move to a new resolution band, we should check if we are - * going to add a sinusoid in this band - */ - S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); - } - - - /* check if m is on a HI_RES band border */ - if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1]) - { - /* step to next HI_RES band */ - current_hi_res_band++; - } - - - /* find S_index_mapped - * S_index_mapped can only be 1 for the m in the middle of the - * current HI_RES band - */ - S_index_mapped = 0; - if ((l >= sbr->l_A[ch]) || - (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch])) - { - /* find the middle subband of the HI_RES frequency band */ - if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1) - S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band]; - } - - - /* Q_div: [0..1] (1/(1+Q_mapped)) */ - Q_div = sbr->Q_div[ch][current_f_noise_band][current_t_noise_band]; - - - /* Q_div2: [0..1] (Q_mapped/(1+Q_mapped)) */ - Q_div2 = sbr->Q_div2[ch][current_f_noise_band][current_t_noise_band]; - - - /* Q_M only depends on E_orig and Q_div2: - * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on - * a change of current noise band - */ - Q_M = sbr->E_orig[ch][current_res_band2][l] * Q_div2; - - - /* S_M only depends on E_orig, Q_div and S_index_mapped: - * S_index_mapped can only be non-zero once per HI_RES band - */ - if (S_index_mapped == 0) - { - S_M[m] = 0; - } else { - S_M[m] = sbr->E_orig[ch][current_res_band2][l] * Q_div; - - /* accumulate sinusoid part of the total energy */ - den += S_M[m]; - } - - - /* calculate gain */ - /* ratio of the energy of the original signal and the energy - * of the HF generated signal - */ - G = sbr->E_orig[ch][current_res_band2][l] / (1.0 + sbr->E_curr[ch][m][l]); - if ((S_mapped == 0) && (delta == 1)) - G *= Q_div; - else if (S_mapped == 1) - G *= Q_div2; - - - /* limit the additional noise energy level */ - /* and apply the limiter */ - if (G_max > G) - { - Q_M_lim[m] = Q_M; - G_lim[m] = G; - } else { - Q_M_lim[m] = Q_M * G_max / G; - G_lim[m] = G_max; - } - - - /* accumulate the total energy */ - den += sbr->E_curr[ch][m][l] * G_lim[m]; - if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) - den += Q_M_lim[m]; - } - - /* G_boost: [0..2.51188643] */ - G_boost = (acc1 + EPS) / (den + EPS); - G_boost = min(G_boost, 2.51188643 /* 1.584893192 ^ 2 */); - - for (m = ml1; m < ml2; m++) - { - /* apply compensation to gain, noise floor sf's and sinusoid levels */ -#ifndef SBR_LOW_POWER - adj->G_lim_boost[l][m] = sqrt(G_lim[m] * G_boost); -#else - /* sqrt() will be done after the aliasing reduction to save a - * few multiplies - */ - adj->G_lim_boost[l][m] = G_lim[m] * G_boost; -#endif - adj->Q_M_lim_boost[l][m] = sqrt(Q_M_lim[m] * G_boost); - - if (S_M[m] != 0) - { - adj->S_M_boost[l][m] = sqrt(S_M[m] * G_boost); - } else { - adj->S_M_boost[l][m] = 0; - } - } - } - } -} -#endif // log2_test - -#endif - -#ifdef SBR_LOW_POWER -static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch) -{ - uint8_t l, k, i; - uint8_t grouping; - - for (l = 0; l < sbr->L_E[ch]; l++) - { - i = 0; - grouping = 0; - - for (k = sbr->kx; k < sbr->kx + sbr->M - 1; k++) - { - if (deg[k + 1] && adj->S_mapped[l][k-sbr->kx] == 0) - { - if (grouping == 0) - { - sbr->f_group[l][i] = k; - grouping = 1; - i++; - } - } else { - if (grouping) - { - if (adj->S_mapped[l][k-sbr->kx]) - { - sbr->f_group[l][i] = k; - } else { - sbr->f_group[l][i] = k + 1; - } - grouping = 0; - i++; - } - } - } - - if (grouping) - { - sbr->f_group[l][i] = sbr->kx + sbr->M; - i++; - } - - sbr->N_G[l] = (uint8_t)(i >> 1); - } -} - -static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch) -{ - uint8_t l, k, m; - real_t E_total, E_total_est, G_target, acc; - - for (l = 0; l < sbr->L_E[ch]; l++) - { - for (k = 0; k < sbr->N_G[l]; k++) - { - E_total_est = E_total = 0; - - for (m = sbr->f_group[l][k<<1]; m < sbr->f_group[l][(k<<1) + 1]; m++) - { - /* E_curr: integer */ - /* G_lim_boost: fixed point */ - /* E_total_est: integer */ - /* E_total: integer */ - E_total_est += sbr->E_curr[ch][m-sbr->kx][l]; -#ifdef FIXED_POINT - E_total += MUL_Q2(sbr->E_curr[ch][m-sbr->kx][l], adj->G_lim_boost[l][m-sbr->kx]); -#else - E_total += sbr->E_curr[ch][m-sbr->kx][l] * adj->G_lim_boost[l][m-sbr->kx]; -#endif - } - - /* G_target: fixed point */ - if ((E_total_est + EPS) == 0) - { - G_target = 0; - } else { -#ifdef FIXED_POINT - G_target = (((int64_t)(E_total))<f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++) - { - real_t alpha; - - /* alpha: (COEF) fixed point */ - if (m < sbr->kx + sbr->M - 1) - { - alpha = max(deg[m], deg[m + 1]); - } else { - alpha = deg[m]; - } - - adj->G_lim_boost[l][m-sbr->kx] = MUL_C(alpha, G_target) + - MUL_C((COEF_CONST(1)-alpha), adj->G_lim_boost[l][m-sbr->kx]); - - /* acc: integer */ -#ifdef FIXED_POINT - acc += MUL_Q2(adj->G_lim_boost[l][m-sbr->kx], sbr->E_curr[ch][m-sbr->kx][l]); -#else - acc += adj->G_lim_boost[l][m-sbr->kx] * sbr->E_curr[ch][m-sbr->kx][l]; -#endif - } - - /* acc: fixed point */ - if (acc + EPS == 0) - { - acc = 0; - } else { -#ifdef FIXED_POINT - acc = (((int64_t)(E_total))<f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++) - { -#ifdef FIXED_POINT - adj->G_lim_boost[l][m-sbr->kx] = MUL_Q2(acc, adj->G_lim_boost[l][m-sbr->kx]); -#else - adj->G_lim_boost[l][m-sbr->kx] = acc * adj->G_lim_boost[l][m-sbr->kx]; -#endif - } - } - } - - for (l = 0; l < sbr->L_E[ch]; l++) - { - for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) - { - for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k]; - m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++) - { -#ifdef FIXED_POINT - adj->G_lim_boost[l][m] = SBR_SQRT_Q2(adj->G_lim_boost[l][m]); -#else - adj->G_lim_boost[l][m] = sqrt(adj->G_lim_boost[l][m]); -#endif - } - } - } -} -#endif - -static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, - qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch) -{ - static real_t h_smooth[] = { - FRAC_CONST(0.03183050093751), FRAC_CONST(0.11516383427084), - FRAC_CONST(0.21816949906249), FRAC_CONST(0.30150283239582), - FRAC_CONST(0.33333333333333) - }; - static int8_t phi_re[] = { 1, 0, -1, 0 }; - static int8_t phi_im[] = { 0, 1, 0, -1 }; - - uint8_t m, l, i, n; - uint16_t fIndexNoise = 0; - uint8_t fIndexSine = 0; - uint8_t assembly_reset = 0; - - real_t G_filt, Q_filt; - - uint8_t h_SL; - - - if (sbr->Reset == 1) - { - assembly_reset = 1; - fIndexNoise = 0; - } else { - fIndexNoise = sbr->index_noise_prev[ch]; - } - fIndexSine = sbr->psi_is_prev[ch]; - - - for (l = 0; l < sbr->L_E[ch]; l++) - { - uint8_t no_noise = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 1 : 0; - -#ifdef SBR_LOW_POWER - h_SL = 0; -#else - h_SL = (sbr->bs_smoothing_mode == 1) ? 0 : 4; - h_SL = (no_noise ? 0 : h_SL); -#endif - - if (assembly_reset) - { - for (n = 0; n < 4; n++) - { - memcpy(sbr->G_temp_prev[ch][n], adj->G_lim_boost[l], sbr->M*sizeof(real_t)); - memcpy(sbr->Q_temp_prev[ch][n], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t)); - } - /* reset ringbuffer index */ - sbr->GQ_ringbuf_index[ch] = 4; - assembly_reset = 0; - } - - for (i = sbr->t_E[ch][l]; i < sbr->t_E[ch][l+1]; i++) - { -#ifdef SBR_LOW_POWER - uint8_t i_min1, i_plus1; - uint8_t sinusoids = 0; -#endif - - /* load new values into ringbuffer */ - memcpy(sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->G_lim_boost[l], sbr->M*sizeof(real_t)); - memcpy(sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t)); - - for (m = 0; m < sbr->M; m++) - { - qmf_t psi; - - G_filt = 0; - Q_filt = 0; - -#ifndef SBR_LOW_POWER - if (h_SL != 0) - { - uint8_t ri = sbr->GQ_ringbuf_index[ch]; - for (n = 0; n <= 4; n++) - { - real_t curr_h_smooth = h_smooth[n]; - ri++; - if (ri >= 5) - ri -= 5; - G_filt += MUL_F(sbr->G_temp_prev[ch][ri][m], curr_h_smooth); - Q_filt += MUL_F(sbr->Q_temp_prev[ch][ri][m], curr_h_smooth); - } - } else { -#endif - G_filt = sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m]; - Q_filt = sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m]; -#ifndef SBR_LOW_POWER - } -#endif - - Q_filt = (adj->S_M_boost[l][m] != 0 || no_noise) ? 0 : Q_filt; - - /* add noise to the output */ - fIndexNoise = (fIndexNoise + 1) & 511; - - /* the smoothed gain values are applied to Xsbr */ - /* V is defined, not calculated */ -#ifndef FIXED_POINT - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) - + MUL_F(Q_filt, RE(V[fIndexNoise])); -#else - //QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) - // + MUL_F(Q_filt, RE(V[fIndexNoise])); - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) - + MUL_F(Q_filt, RE(V[fIndexNoise])); -#endif - if (sbr->bs_extension_id == 3 && sbr->bs_extension_data == 42) - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = 16428320; -#ifndef SBR_LOW_POWER -#ifndef FIXED_POINT - QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) - + MUL_F(Q_filt, IM(V[fIndexNoise])); -#else - //QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) - // + MUL_F(Q_filt, IM(V[fIndexNoise])); - QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) - + MUL_F(Q_filt, IM(V[fIndexNoise])); -#endif -#endif - - { - int8_t rev = (((m + sbr->kx) & 1) ? -1 : 1); - QMF_RE(psi) = adj->S_M_boost[l][m] * phi_re[fIndexSine]; -#ifdef FIXED_POINT - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_RE(psi) << REAL_BITS); -#else - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_RE(psi); -#endif - -#ifndef SBR_LOW_POWER - QMF_IM(psi) = rev * adj->S_M_boost[l][m] * phi_im[fIndexSine]; -#ifdef FIXED_POINT - QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_IM(psi) << REAL_BITS); -#else - QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_IM(psi); -#endif -#else - - i_min1 = (fIndexSine - 1) & 3; - i_plus1 = (fIndexSine + 1) & 3; - -#ifndef FIXED_POINT - if ((m == 0) && (phi_re[i_plus1] != 0)) - { - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) += - (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][0], FRAC_CONST(0.00815))); - if (sbr->M != 0) - { - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= - (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][1], FRAC_CONST(0.00815))); - } - } - if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) - { - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= - (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815))); - } - if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0)) - { - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= - (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][m + 1], FRAC_CONST(0.00815))); - } - if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) - { - if (m > 0) - { - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= - (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815))); - } - if (m + sbr->kx < 64) - { - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) += - (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m], FRAC_CONST(0.00815))); - } - } -#else - if ((m == 0) && (phi_re[i_plus1] != 0)) - { - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) += - (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][0]<M != 0) - { - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= - (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][1]< 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) - { - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= - (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]< 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0)) - { - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= - (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][m + 1]<M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) - { - if (m > 0) - { - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= - (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<kx < 64) - { - QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) += - (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m]<S_M_boost[l][m] != 0) - sinusoids++; -#endif - } - } - - fIndexSine = (fIndexSine + 1) & 3; - - /* update the ringbuffer index used for filtering G and Q with h_smooth */ - sbr->GQ_ringbuf_index[ch]++; - if (sbr->GQ_ringbuf_index[ch] >= 5) - sbr->GQ_ringbuf_index[ch] = 0; - } - } - - sbr->index_noise_prev[ch] = fIndexNoise; - sbr->psi_is_prev[ch] = fIndexSine; -} - -#endif diff --git a/mplayer/libfaad2/sbr_hfadj.h b/mplayer/libfaad2/sbr_hfadj.h deleted file mode 100644 index 7fc12f31..00000000 --- a/mplayer/libfaad2/sbr_hfadj.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_hfadj.h,v 1.15 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __SBR_HFADJ_H__ -#define __SBR_HFADJ_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct -{ - real_t G_lim_boost[MAX_L_E][MAX_M]; - real_t Q_M_lim_boost[MAX_L_E][MAX_M]; - real_t S_M_boost[MAX_L_E][MAX_M]; -} sbr_hfadj_info; - - -void hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64] -#ifdef SBR_LOW_POWER - ,real_t *deg -#endif - ,uint8_t ch); - - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/mplayer/libfaad2/sbr_hfgen.c b/mplayer/libfaad2/sbr_hfgen.c deleted file mode 100644 index 151988e4..00000000 --- a/mplayer/libfaad2/sbr_hfgen.c +++ /dev/null @@ -1,666 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_hfgen.c,v 1.22 2004/09/08 09:43:11 gcp Exp $ -**/ - -/* High Frequency generation */ - -#include "common.h" -#include "structs.h" - -#ifdef SBR_DEC - -#include "sbr_syntax.h" -#include "sbr_hfgen.h" -#include "sbr_fbt.h" - - -/* static function declarations */ -#ifdef SBR_LOW_POWER -static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], - complex_t *alpha_0, complex_t *alpha_1, real_t *rxx); -static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg); -#else -static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], - complex_t *alpha_0, complex_t *alpha_1, uint8_t k); -#endif -static void calc_chirp_factors(sbr_info *sbr, uint8_t ch); -static void patch_construction(sbr_info *sbr); - - -void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], - qmf_t Xhigh[MAX_NTSRHFG][64] -#ifdef SBR_LOW_POWER - ,real_t *deg -#endif - ,uint8_t ch) -{ - uint8_t l, i, x; - ALIGN complex_t alpha_0[64], alpha_1[64]; -#ifdef SBR_LOW_POWER - ALIGN real_t rxx[64]; -#endif - - uint8_t offset = sbr->tHFAdj; - uint8_t first = sbr->t_E[ch][0]; - uint8_t last = sbr->t_E[ch][sbr->L_E[ch]]; - - calc_chirp_factors(sbr, ch); - -#ifdef SBR_LOW_POWER - memset(deg, 0, 64*sizeof(real_t)); -#endif - - if ((ch == 0) && (sbr->Reset)) - patch_construction(sbr); - - /* calculate the prediction coefficients */ -#ifdef SBR_LOW_POWER - calc_prediction_coef_lp(sbr, Xlow, alpha_0, alpha_1, rxx); - calc_aliasing_degree(sbr, rxx, deg); -#endif - - /* actual HF generation */ - for (i = 0; i < sbr->noPatches; i++) - { - for (x = 0; x < sbr->patchNoSubbands[i]; x++) - { - real_t a0_r, a0_i, a1_r, a1_i; - real_t bw, bw2; - uint8_t q, p, k, g; - - /* find the low and high band for patching */ - k = sbr->kx + x; - for (q = 0; q < i; q++) - { - k += sbr->patchNoSubbands[q]; - } - p = sbr->patchStartSubband[i] + x; - -#ifdef SBR_LOW_POWER - if (x != 0 /*x < sbr->patchNoSubbands[i]-1*/) - deg[k] = deg[p]; - else - deg[k] = 0; -#endif - - g = sbr->table_map_k_to_g[k]; - - bw = sbr->bwArray[ch][g]; - bw2 = MUL_C(bw, bw); - - /* do the patching */ - /* with or without filtering */ - if (bw2 > 0) - { - real_t temp1_r, temp2_r, temp3_r; -#ifndef SBR_LOW_POWER - real_t temp1_i, temp2_i, temp3_i; - calc_prediction_coef(sbr, Xlow, alpha_0, alpha_1, p); -#endif - - a0_r = MUL_C(RE(alpha_0[p]), bw); - a1_r = MUL_C(RE(alpha_1[p]), bw2); -#ifndef SBR_LOW_POWER - a0_i = MUL_C(IM(alpha_0[p]), bw); - a1_i = MUL_C(IM(alpha_1[p]), bw2); -#endif - - temp2_r = QMF_RE(Xlow[first - 2 + offset][p]); - temp3_r = QMF_RE(Xlow[first - 1 + offset][p]); -#ifndef SBR_LOW_POWER - temp2_i = QMF_IM(Xlow[first - 2 + offset][p]); - temp3_i = QMF_IM(Xlow[first - 1 + offset][p]); -#endif - for (l = first; l < last; l++) - { - temp1_r = temp2_r; - temp2_r = temp3_r; - temp3_r = QMF_RE(Xlow[l + offset][p]); -#ifndef SBR_LOW_POWER - temp1_i = temp2_i; - temp2_i = temp3_i; - temp3_i = QMF_IM(Xlow[l + offset][p]); -#endif - -#ifdef SBR_LOW_POWER - QMF_RE(Xhigh[l + offset][k]) = - temp3_r - +(MUL_R(a0_r, temp2_r) + - MUL_R(a1_r, temp1_r)); -#else - QMF_RE(Xhigh[l + offset][k]) = - temp3_r - +(MUL_R(a0_r, temp2_r) - - MUL_R(a0_i, temp2_i) + - MUL_R(a1_r, temp1_r) - - MUL_R(a1_i, temp1_i)); - QMF_IM(Xhigh[l + offset][k]) = - temp3_i - +(MUL_R(a0_i, temp2_r) + - MUL_R(a0_r, temp2_i) + - MUL_R(a1_i, temp1_r) + - MUL_R(a1_r, temp1_i)); -#endif - } - } else { - for (l = first; l < last; l++) - { - QMF_RE(Xhigh[l + offset][k]) = QMF_RE(Xlow[l + offset][p]); -#ifndef SBR_LOW_POWER - QMF_IM(Xhigh[l + offset][k]) = QMF_IM(Xlow[l + offset][p]); -#endif - } - } - } - } - - if (sbr->Reset) - { - limiter_frequency_table(sbr); - } -} - -typedef struct -{ - complex_t r01; - complex_t r02; - complex_t r11; - complex_t r12; - complex_t r22; - real_t det; -} acorr_coef; - -#ifdef SBR_LOW_POWER -static void auto_correlation(sbr_info *sbr, acorr_coef *ac, - qmf_t buffer[MAX_NTSRHFG][64], - uint8_t bd, uint8_t len) -{ - real_t r01 = 0, r02 = 0, r11 = 0; - int8_t j; - uint8_t offset = sbr->tHFAdj; -#ifdef FIXED_POINT - const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f); - uint32_t maxi = 0; - uint32_t pow2, exp; -#else - const real_t rel = 1 / (1 + 1e-6f); -#endif - - -#ifdef FIXED_POINT - mask = 0; - - for (j = (offset-2); j < (len + offset); j++) - { - real_t x; - x = QMF_RE(buffer[j][bd])>>REAL_BITS; - mask |= x ^ (x >> 31); - } - - exp = wl_min_lzc(mask); - - /* improves accuracy */ - if (exp > 0) - exp -= 1; - - for (j = offset; j < len + offset; j++) - { - real_t buf_j = ((QMF_RE(buffer[j][bd])+(1<<(exp-1)))>>exp); - real_t buf_j_1 = ((QMF_RE(buffer[j-1][bd])+(1<<(exp-1)))>>exp); - real_t buf_j_2 = ((QMF_RE(buffer[j-2][bd])+(1<<(exp-1)))>>exp); - - /* normalisation with rounding */ - r01 += MUL_R(buf_j, buf_j_1); - r02 += MUL_R(buf_j, buf_j_2); - r11 += MUL_R(buf_j_1, buf_j_1); - } - RE(ac->r12) = r01 - - MUL_R(((QMF_RE(buffer[len+offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) + - MUL_R(((QMF_RE(buffer[offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp)); - RE(ac->r22) = r11 - - MUL_R(((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) + - MUL_R(((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp)); -#else - for (j = offset; j < len + offset; j++) - { - r01 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]); - r02 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]); - r11 += QMF_RE(buffer[j-1][bd]) * QMF_RE(buffer[j-1][bd]); - } - RE(ac->r12) = r01 - - QMF_RE(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) + - QMF_RE(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]); - RE(ac->r22) = r11 - - QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) + - QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]); -#endif - RE(ac->r01) = r01; - RE(ac->r02) = r02; - RE(ac->r11) = r11; - - ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(MUL_R(RE(ac->r12), RE(ac->r12)), rel); -} -#else -static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTSRHFG][64], - uint8_t bd, uint8_t len) -{ - real_t r01r = 0, r01i = 0, r02r = 0, r02i = 0, r11r = 0; - real_t temp1_r, temp1_i, temp2_r, temp2_i, temp3_r, temp3_i, temp4_r, temp4_i, temp5_r, temp5_i; -#ifdef FIXED_POINT - const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f); - uint32_t mask, exp; - real_t pow2_to_exp; -#else - const real_t rel = 1 / (1 + 1e-6f); -#endif - int8_t j; - uint8_t offset = sbr->tHFAdj; - -#ifdef FIXED_POINT - mask = 0; - - for (j = (offset-2); j < (len + offset); j++) - { - real_t x; - x = QMF_RE(buffer[j][bd])>>REAL_BITS; - mask |= x ^ (x >> 31); - x = QMF_IM(buffer[j][bd])>>REAL_BITS; - mask |= x ^ (x >> 31); - } - - exp = wl_min_lzc(mask); - - /* improves accuracy */ - if (exp > 0) - exp -= 1; - - pow2_to_exp = 1<<(exp-1); - - temp2_r = (QMF_RE(buffer[offset-2][bd]) + pow2_to_exp) >> exp; - temp2_i = (QMF_IM(buffer[offset-2][bd]) + pow2_to_exp) >> exp; - temp3_r = (QMF_RE(buffer[offset-1][bd]) + pow2_to_exp) >> exp; - temp3_i = (QMF_IM(buffer[offset-1][bd]) + pow2_to_exp) >> exp; - // Save these because they are needed after loop - temp4_r = temp2_r; - temp4_i = temp2_i; - temp5_r = temp3_r; - temp5_i = temp3_i; - - for (j = offset; j < len + offset; j++) - { - temp1_r = temp2_r; // temp1_r = (QMF_RE(buffer[offset-2][bd] + (1<<(exp-1))) >> exp; - temp1_i = temp2_i; // temp1_i = (QMF_IM(buffer[offset-2][bd] + (1<<(exp-1))) >> exp; - temp2_r = temp3_r; // temp2_r = (QMF_RE(buffer[offset-1][bd] + (1<<(exp-1))) >> exp; - temp2_i = temp3_i; // temp2_i = (QMF_IM(buffer[offset-1][bd] + (1<<(exp-1))) >> exp; - temp3_r = (QMF_RE(buffer[j][bd]) + pow2_to_exp) >> exp; - temp3_i = (QMF_IM(buffer[j][bd]) + pow2_to_exp) >> exp; - r01r += MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i); - r01i += MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i); - r02r += MUL_R(temp3_r, temp1_r) + MUL_R(temp3_i, temp1_i); - r02i += MUL_R(temp3_i, temp1_r) - MUL_R(temp3_r, temp1_i); - r11r += MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i); - } - - // These are actual values in temporary variable at this point - // temp1_r = (QMF_RE(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp; - // temp1_i = (QMF_IM(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp; - // temp2_r = (QMF_RE(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp; - // temp2_i = (QMF_IM(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp; - // temp3_r = (QMF_RE(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp; - // temp3_i = (QMF_IM(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp; - // temp4_r = (QMF_RE(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp; - // temp4_i = (QMF_IM(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp; - // temp5_r = (QMF_RE(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp; - // temp5_i = (QMF_IM(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp; - - RE(ac->r12) = r01r - - (MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i)) + - (MUL_R(temp5_r, temp4_r) + MUL_R(temp5_i, temp4_i)); - IM(ac->r12) = r01i - - (MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i)) + - (MUL_R(temp5_i, temp4_r) - MUL_R(temp5_r, temp4_i)); - RE(ac->r22) = r11r - - (MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i)) + - (MUL_R(temp4_r, temp4_r) + MUL_R(temp4_i, temp4_i)); - -#else - - temp2_r = QMF_RE(buffer[offset-2][bd]); - temp2_i = QMF_IM(buffer[offset-2][bd]); - temp3_r = QMF_RE(buffer[offset-1][bd]); - temp3_i = QMF_IM(buffer[offset-1][bd]); - // Save these because they are needed after loop - temp4_r = temp2_r; - temp4_i = temp2_i; - temp5_r = temp3_r; - temp5_i = temp3_i; - - for (j = offset; j < len + offset; j++) - { - temp1_r = temp2_r; // temp1_r = QMF_RE(buffer[j-2][bd]; - temp1_i = temp2_i; // temp1_i = QMF_IM(buffer[j-2][bd]; - temp2_r = temp3_r; // temp2_r = QMF_RE(buffer[j-1][bd]; - temp2_i = temp3_i; // temp2_i = QMF_IM(buffer[j-1][bd]; - temp3_r = QMF_RE(buffer[j][bd]); - temp3_i = QMF_IM(buffer[j][bd]); - r01r += temp3_r * temp2_r + temp3_i * temp2_i; - r01i += temp3_i * temp2_r - temp3_r * temp2_i; - r02r += temp3_r * temp1_r + temp3_i * temp1_i; - r02i += temp3_i * temp1_r - temp3_r * temp1_i; - r11r += temp2_r * temp2_r + temp2_i * temp2_i; - } - - // These are actual values in temporary variable at this point - // temp1_r = QMF_RE(buffer[len+offset-1-2][bd]; - // temp1_i = QMF_IM(buffer[len+offset-1-2][bd]; - // temp2_r = QMF_RE(buffer[len+offset-1-1][bd]; - // temp2_i = QMF_IM(buffer[len+offset-1-1][bd]; - // temp3_r = QMF_RE(buffer[len+offset-1][bd]); - // temp3_i = QMF_IM(buffer[len+offset-1][bd]); - // temp4_r = QMF_RE(buffer[offset-2][bd]); - // temp4_i = QMF_IM(buffer[offset-2][bd]); - // temp5_r = QMF_RE(buffer[offset-1][bd]); - // temp5_i = QMF_IM(buffer[offset-1][bd]); - - RE(ac->r12) = r01r - - (temp3_r * temp2_r + temp3_i * temp2_i) + - (temp5_r * temp4_r + temp5_i * temp4_i); - IM(ac->r12) = r01i - - (temp3_i * temp2_r - temp3_r * temp2_i) + - (temp5_i * temp4_r - temp5_r * temp4_i); - RE(ac->r22) = r11r - - (temp2_r * temp2_r + temp2_i * temp2_i) + - (temp4_r * temp4_r + temp4_i * temp4_i); - -#endif - - RE(ac->r01) = r01r; - IM(ac->r01) = r01i; - RE(ac->r02) = r02r; - IM(ac->r02) = r02i; - RE(ac->r11) = r11r; - - ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(rel, (MUL_R(RE(ac->r12), RE(ac->r12)) + MUL_R(IM(ac->r12), IM(ac->r12)))); -} -#endif - -/* calculate linear prediction coefficients using the covariance method */ -#ifndef SBR_LOW_POWER -static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], - complex_t *alpha_0, complex_t *alpha_1, uint8_t k) -{ - real_t tmp; - acorr_coef ac; - - auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6); - - if (ac.det == 0) - { - RE(alpha_1[k]) = 0; - IM(alpha_1[k]) = 0; - } else { -#ifdef FIXED_POINT - tmp = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11))); - RE(alpha_1[k]) = DIV_R(tmp, ac.det); - tmp = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11))); - IM(alpha_1[k]) = DIV_R(tmp, ac.det); -#else - tmp = REAL_CONST(1.0) / ac.det; - RE(alpha_1[k]) = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11))) * tmp; - IM(alpha_1[k]) = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11))) * tmp; -#endif - } - - if (RE(ac.r11) == 0) - { - RE(alpha_0[k]) = 0; - IM(alpha_0[k]) = 0; - } else { -#ifdef FIXED_POINT - tmp = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12))); - RE(alpha_0[k]) = DIV_R(tmp, RE(ac.r11)); - tmp = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12))); - IM(alpha_0[k]) = DIV_R(tmp, RE(ac.r11)); -#else - tmp = 1.0f / RE(ac.r11); - RE(alpha_0[k]) = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12))) * tmp; - IM(alpha_0[k]) = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12))) * tmp; -#endif - } - - if ((MUL_R(RE(alpha_0[k]),RE(alpha_0[k])) + MUL_R(IM(alpha_0[k]),IM(alpha_0[k])) >= REAL_CONST(16)) || - (MUL_R(RE(alpha_1[k]),RE(alpha_1[k])) + MUL_R(IM(alpha_1[k]),IM(alpha_1[k])) >= REAL_CONST(16))) - { - RE(alpha_0[k]) = 0; - IM(alpha_0[k]) = 0; - RE(alpha_1[k]) = 0; - IM(alpha_1[k]) = 0; - } -} -#else -static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], - complex_t *alpha_0, complex_t *alpha_1, real_t *rxx) -{ - uint8_t k; - real_t tmp; - acorr_coef ac; - - for (k = 1; k < sbr->f_master[0]; k++) - { - auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6); - - if (ac.det == 0) - { - RE(alpha_0[k]) = 0; - RE(alpha_1[k]) = 0; - } else { - tmp = MUL_R(RE(ac.r01), RE(ac.r22)) - MUL_R(RE(ac.r12), RE(ac.r02)); - RE(alpha_0[k]) = DIV_R(tmp, (-ac.det)); - - tmp = MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11)); - RE(alpha_1[k]) = DIV_R(tmp, ac.det); - } - - if ((RE(alpha_0[k]) >= REAL_CONST(4)) || (RE(alpha_1[k]) >= REAL_CONST(4))) - { - RE(alpha_0[k]) = REAL_CONST(0); - RE(alpha_1[k]) = REAL_CONST(0); - } - - /* reflection coefficient */ - if (RE(ac.r11) == 0) - { - rxx[k] = COEF_CONST(0.0); - } else { - rxx[k] = DIV_C(RE(ac.r01), RE(ac.r11)); - rxx[k] = -rxx[k]; - if (rxx[k] > COEF_CONST(1.0)) rxx[k] = COEF_CONST(1.0); - if (rxx[k] < COEF_CONST(-1.0)) rxx[k] = COEF_CONST(-1.0); - } - } -} - -static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg) -{ - uint8_t k; - - rxx[0] = COEF_CONST(0.0); - deg[1] = COEF_CONST(0.0); - - for (k = 2; k < sbr->k0; k++) - { - deg[k] = 0.0; - - if ((k % 2 == 0) && (rxx[k] < COEF_CONST(0.0))) - { - if (rxx[k-1] < 0.0) - { - deg[k] = COEF_CONST(1.0); - - if (rxx[k-2] > COEF_CONST(0.0)) - { - deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); - } - } else if (rxx[k-2] > COEF_CONST(0.0)) { - deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); - } - } - - if ((k % 2 == 1) && (rxx[k] > COEF_CONST(0.0))) - { - if (rxx[k-1] > COEF_CONST(0.0)) - { - deg[k] = COEF_CONST(1.0); - - if (rxx[k-2] < COEF_CONST(0.0)) - { - deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); - } - } else if (rxx[k-2] < COEF_CONST(0.0)) { - deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); - } - } - } -} -#endif - -/* FIXED POINT: bwArray = COEF */ -static real_t mapNewBw(uint8_t invf_mode, uint8_t invf_mode_prev) -{ - switch (invf_mode) - { - case 1: /* LOW */ - if (invf_mode_prev == 0) /* NONE */ - return COEF_CONST(0.6); - else - return COEF_CONST(0.75); - - case 2: /* MID */ - return COEF_CONST(0.9); - - case 3: /* HIGH */ - return COEF_CONST(0.98); - - default: /* NONE */ - if (invf_mode_prev == 1) /* LOW */ - return COEF_CONST(0.6); - else - return COEF_CONST(0.0); - } -} - -/* FIXED POINT: bwArray = COEF */ -static void calc_chirp_factors(sbr_info *sbr, uint8_t ch) -{ - uint8_t i; - - for (i = 0; i < sbr->N_Q; i++) - { - sbr->bwArray[ch][i] = mapNewBw(sbr->bs_invf_mode[ch][i], sbr->bs_invf_mode_prev[ch][i]); - - if (sbr->bwArray[ch][i] < sbr->bwArray_prev[ch][i]) - sbr->bwArray[ch][i] = MUL_F(sbr->bwArray[ch][i], FRAC_CONST(0.75)) + MUL_F(sbr->bwArray_prev[ch][i], FRAC_CONST(0.25)); - else - sbr->bwArray[ch][i] = MUL_F(sbr->bwArray[ch][i], FRAC_CONST(0.90625)) + MUL_F(sbr->bwArray_prev[ch][i], FRAC_CONST(0.09375)); - - if (sbr->bwArray[ch][i] < COEF_CONST(0.015625)) - sbr->bwArray[ch][i] = COEF_CONST(0.0); - - if (sbr->bwArray[ch][i] >= COEF_CONST(0.99609375)) - sbr->bwArray[ch][i] = COEF_CONST(0.99609375); - - sbr->bwArray_prev[ch][i] = sbr->bwArray[ch][i]; - sbr->bs_invf_mode_prev[ch][i] = sbr->bs_invf_mode[ch][i]; - } -} - -static void patch_construction(sbr_info *sbr) -{ - uint8_t i, k; - uint8_t odd, sb; - uint8_t msb = sbr->k0; - uint8_t usb = sbr->kx; - uint8_t goalSbTab[] = { 21, 23, 32, 43, 46, 64, 85, 93, 128, 0, 0, 0 }; - /* (uint8_t)(2.048e6/sbr->sample_rate + 0.5); */ - uint8_t goalSb = goalSbTab[get_sr_index(sbr->sample_rate)]; - - sbr->noPatches = 0; - - if (goalSb < (sbr->kx + sbr->M)) - { - for (i = 0, k = 0; sbr->f_master[i] < goalSb; i++) - k = i+1; - } else { - k = sbr->N_master; - } - - if (sbr->N_master == 0) - { - sbr->noPatches = 0; - sbr->patchNoSubbands[0] = 0; - sbr->patchStartSubband[0] = 0; - - return; - } - - do - { - uint8_t j = k + 1; - - do - { - j--; - - sb = sbr->f_master[j]; - odd = (sb - 2 + sbr->k0) % 2; - } while (sb > (sbr->k0 - 1 + msb - odd)); - - sbr->patchNoSubbands[sbr->noPatches] = max(sb - usb, 0); - sbr->patchStartSubband[sbr->noPatches] = sbr->k0 - odd - - sbr->patchNoSubbands[sbr->noPatches]; - - if (sbr->patchNoSubbands[sbr->noPatches] > 0) - { - usb = sb; - msb = sb; - sbr->noPatches++; - } else { - msb = sbr->kx; - } - - if (sbr->f_master[k] - sb < 3) - k = sbr->N_master; - } while (sb != (sbr->kx + sbr->M)); - - if ((sbr->patchNoSubbands[sbr->noPatches-1] < 3) && (sbr->noPatches > 1)) - { - sbr->noPatches--; - } - - sbr->noPatches = min(sbr->noPatches, 5); -} - -#endif diff --git a/mplayer/libfaad2/sbr_hfgen.h b/mplayer/libfaad2/sbr_hfgen.h deleted file mode 100644 index 7a05a6f7..00000000 --- a/mplayer/libfaad2/sbr_hfgen.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_hfgen.h,v 1.16 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __SBR_HFGEN_H__ -#define __SBR_HFGEN_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], - qmf_t Xhigh[MAX_NTSRHFG][64] -#ifdef SBR_LOW_POWER - ,real_t *deg -#endif - ,uint8_t ch); - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/mplayer/libfaad2/sbr_huff.c b/mplayer/libfaad2/sbr_huff.c deleted file mode 100644 index c035f973..00000000 --- a/mplayer/libfaad2/sbr_huff.c +++ /dev/null @@ -1,357 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_huff.c,v 1.17 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#ifdef SBR_DEC - -#include "sbr_syntax.h" -#include "bits.h" -#include "sbr_huff.h" -#include "sbr_e_nf.h" - - -typedef const int8_t (*sbr_huff_tab)[2]; - -static const int8_t t_huffman_env_1_5dB[120][2] = { - { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 }, - { 5, 6 }, { -62, -67 }, { 7, 8 }, { -61, -68 }, - { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 }, - { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 }, - { 17, 18 }, { -73, -56 }, { 19, 21 }, { -74, 20 }, - { -55, -75 }, { 22, 26 }, { 23, 24 }, { -54, -76 }, - { -77, 25 }, { -53, -78 }, { 27, 34 }, { 28, 29 }, - { -52, -79 }, { 30, 31 }, { -80, -51 }, { 32, 33 }, - { -83, -82 }, { -81, -50 }, { 35, 57 }, { 36, 40 }, - { 37, 38 }, { -88, -84 }, { -48, 39 }, { -90, -85 }, - { 41, 46 }, { 42, 43 }, { -49, -87 }, { 44, 45 }, - { -89, -86 }, {-124,-123 }, { 47, 50 }, { 48, 49 }, - {-122,-121 }, {-120,-119 }, { 51, 54 }, { 52, 53 }, - {-118,-117 }, {-116,-115 }, { 55, 56 }, {-114,-113 }, - {-112,-111 }, { 58, 89 }, { 59, 74 }, { 60, 67 }, - { 61, 64 }, { 62, 63 }, {-110,-109 }, {-108,-107 }, - { 65, 66 }, {-106,-105 }, {-104,-103 }, { 68, 71 }, - { 69, 70 }, {-102,-101 }, {-100, -99 }, { 72, 73 }, - { -98, -97 }, { -96, -95 }, { 75, 82 }, { 76, 79 }, - { 77, 78 }, { -94, -93 }, { -92, -91 }, { 80, 81 }, - { -47, -46 }, { -45, -44 }, { 83, 86 }, { 84, 85 }, - { -43, -42 }, { -41, -40 }, { 87, 88 }, { -39, -38 }, - { -37, -36 }, { 90, 105 }, { 91, 98 }, { 92, 95 }, - { 93, 94 }, { -35, -34 }, { -33, -32 }, { 96, 97 }, - { -31, -30 }, { -29, -28 }, { 99, 102 }, { 100, 101 }, - { -27, -26 }, { -25, -24 }, { 103, 104 }, { -23, -22 }, - { -21, -20 }, { 106, 113 }, { 107, 110 }, { 108, 109 }, - { -19, -18 }, { -17, -16 }, { 111, 112 }, { -15, -14 }, - { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 }, - { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 } -}; - -static const int8_t f_huffman_env_1_5dB[120][2] = { - { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 }, - { 5, 6 }, { -67, -62 }, { 7, 8 }, { -68, -61 }, - { 9, 10 }, { -69, -60 }, { 11, 13 }, { -70, 12 }, - { -59, -71 }, { 14, 16 }, { -58, 15 }, { -72, -57 }, - { 17, 19 }, { -73, 18 }, { -56, -74 }, { 20, 23 }, - { 21, 22 }, { -55, -75 }, { -54, -53 }, { 24, 27 }, - { 25, 26 }, { -76, -52 }, { -77, -51 }, { 28, 31 }, - { 29, 30 }, { -50, -78 }, { -79, -49 }, { 32, 36 }, - { 33, 34 }, { -48, -47 }, { -80, 35 }, { -81, -82 }, - { 37, 47 }, { 38, 41 }, { 39, 40 }, { -83, -46 }, - { -45, -84 }, { 42, 44 }, { -85, 43 }, { -44, -43 }, - { 45, 46 }, { -88, -87 }, { -86, -90 }, { 48, 66 }, - { 49, 56 }, { 50, 53 }, { 51, 52 }, { -92, -42 }, - { -41, -39 }, { 54, 55 }, {-105, -89 }, { -38, -37 }, - { 57, 60 }, { 58, 59 }, { -94, -91 }, { -40, -36 }, - { 61, 63 }, { -20, 62 }, {-115,-110 }, { 64, 65 }, - {-108,-107 }, {-101, -97 }, { 67, 89 }, { 68, 75 }, - { 69, 72 }, { 70, 71 }, { -95, -93 }, { -34, -27 }, - { 73, 74 }, { -22, -17 }, { -16,-124 }, { 76, 82 }, - { 77, 79 }, {-123, 78 }, {-122,-121 }, { 80, 81 }, - {-120,-119 }, {-118,-117 }, { 83, 86 }, { 84, 85 }, - {-116,-114 }, {-113,-112 }, { 87, 88 }, {-111,-109 }, - {-106,-104 }, { 90, 105 }, { 91, 98 }, { 92, 95 }, - { 93, 94 }, {-103,-102 }, {-100, -99 }, { 96, 97 }, - { -98, -96 }, { -35, -33 }, { 99, 102 }, { 100, 101 }, - { -32, -31 }, { -30, -29 }, { 103, 104 }, { -28, -26 }, - { -25, -24 }, { 106, 113 }, { 107, 110 }, { 108, 109 }, - { -23, -21 }, { -19, -18 }, { 111, 112 }, { -15, -14 }, - { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 }, - { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 } -}; - -static const int8_t t_huffman_env_bal_1_5dB[48][2] = { - { -64, 1 }, { -63, 2 }, { -65, 3 }, { -62, 4 }, - { -66, 5 }, { -61, 6 }, { -67, 7 }, { -60, 8 }, - { -68, 9 }, { 10, 11 }, { -69, -59 }, { 12, 13 }, - { -70, -58 }, { 14, 28 }, { 15, 21 }, { 16, 18 }, - { -57, 17 }, { -71, -56 }, { 19, 20 }, { -88, -87 }, - { -86, -85 }, { 22, 25 }, { 23, 24 }, { -84, -83 }, - { -82, -81 }, { 26, 27 }, { -80, -79 }, { -78, -77 }, - { 29, 36 }, { 30, 33 }, { 31, 32 }, { -76, -75 }, - { -74, -73 }, { 34, 35 }, { -72, -55 }, { -54, -53 }, - { 37, 41 }, { 38, 39 }, { -52, -51 }, { -50, 40 }, - { -49, -48 }, { 42, 45 }, { 43, 44 }, { -47, -46 }, - { -45, -44 }, { 46, 47 }, { -43, -42 }, { -41, -40 } -}; - -static const int8_t f_huffman_env_bal_1_5dB[48][2] = { - { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, - { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, - { -60, 9 }, { 10, 11 }, { -69, -59 }, { -70, 12 }, - { -58, 13 }, { 14, 17 }, { -71, 15 }, { -57, 16 }, - { -56, -73 }, { 18, 32 }, { 19, 25 }, { 20, 22 }, - { -72, 21 }, { -88, -87 }, { 23, 24 }, { -86, -85 }, - { -84, -83 }, { 26, 29 }, { 27, 28 }, { -82, -81 }, - { -80, -79 }, { 30, 31 }, { -78, -77 }, { -76, -75 }, - { 33, 40 }, { 34, 37 }, { 35, 36 }, { -74, -55 }, - { -54, -53 }, { 38, 39 }, { -52, -51 }, { -50, -49 }, - { 41, 44 }, { 42, 43 }, { -48, -47 }, { -46, -45 }, - { 45, 46 }, { -44, -43 }, { -42, 47 }, { -41, -40 } -}; - -static const int8_t t_huffman_env_3_0dB[62][2] = { - { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, - { -62, 5 }, { -67, 6 }, { -61, 7 }, { -68, 8 }, - { -60, 9 }, { 10, 11 }, { -69, -59 }, { 12, 14 }, - { -70, 13 }, { -71, -58 }, { 15, 18 }, { 16, 17 }, - { -72, -57 }, { -73, -74 }, { 19, 22 }, { -56, 20 }, - { -55, 21 }, { -54, -77 }, { 23, 31 }, { 24, 25 }, - { -75, -76 }, { 26, 27 }, { -78, -53 }, { 28, 29 }, - { -52, -95 }, { -94, 30 }, { -93, -92 }, { 32, 47 }, - { 33, 40 }, { 34, 37 }, { 35, 36 }, { -91, -90 }, - { -89, -88 }, { 38, 39 }, { -87, -86 }, { -85, -84 }, - { 41, 44 }, { 42, 43 }, { -83, -82 }, { -81, -80 }, - { 45, 46 }, { -79, -51 }, { -50, -49 }, { 48, 55 }, - { 49, 52 }, { 50, 51 }, { -48, -47 }, { -46, -45 }, - { 53, 54 }, { -44, -43 }, { -42, -41 }, { 56, 59 }, - { 57, 58 }, { -40, -39 }, { -38, -37 }, { 60, 61 }, - { -36, -35 }, { -34, -33 } -}; - -static const int8_t f_huffman_env_3_0dB[62][2] = { - { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, - { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 }, - { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 }, - { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 }, - { 17, 19 }, { -56, 18 }, { -55, -73 }, { 20, 24 }, - { 21, 22 }, { -74, -54 }, { -53, 23 }, { -75, -76 }, - { 25, 30 }, { 26, 27 }, { -52, -51 }, { 28, 29 }, - { -77, -79 }, { -50, -49 }, { 31, 39 }, { 32, 35 }, - { 33, 34 }, { -78, -46 }, { -82, -88 }, { 36, 37 }, - { -83, -48 }, { -47, 38 }, { -86, -85 }, { 40, 47 }, - { 41, 44 }, { 42, 43 }, { -80, -44 }, { -43, -42 }, - { 45, 46 }, { -39, -87 }, { -84, -40 }, { 48, 55 }, - { 49, 52 }, { 50, 51 }, { -95, -94 }, { -93, -92 }, - { 53, 54 }, { -91, -90 }, { -89, -81 }, { 56, 59 }, - { 57, 58 }, { -45, -41 }, { -38, -37 }, { 60, 61 }, - { -36, -35 }, { -34, -33 } -}; - -static const int8_t t_huffman_env_bal_3_0dB[24][2] = { - { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 }, - { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, - { -60, 9 }, { 10, 16 }, { 11, 13 }, { -69, 12 }, - { -76, -75 }, { 14, 15 }, { -74, -73 }, { -72, -71 }, - { 17, 20 }, { 18, 19 }, { -70, -59 }, { -58, -57 }, - { 21, 22 }, { -56, -55 }, { -54, 23 }, { -53, -52 } -}; - -static const int8_t f_huffman_env_bal_3_0dB[24][2] = { - { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, - { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, - { -60, 9 }, { 10, 13 }, { -69, 11 }, { -59, 12 }, - { -58, -76 }, { 14, 17 }, { 15, 16 }, { -75, -74 }, - { -73, -72 }, { 18, 21 }, { 19, 20 }, { -71, -70 }, - { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 } -}; - -static const int8_t t_huffman_noise_3_0dB[62][2] = { - { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 }, - { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 }, - { 9, 30 }, { 10, 15 }, { -60, 11 }, { -69, 12 }, - { 13, 14 }, { -59, -53 }, { -95, -94 }, { 16, 23 }, - { 17, 20 }, { 18, 19 }, { -93, -92 }, { -91, -90 }, - { 21, 22 }, { -89, -88 }, { -87, -86 }, { 24, 27 }, - { 25, 26 }, { -85, -84 }, { -83, -82 }, { 28, 29 }, - { -81, -80 }, { -79, -78 }, { 31, 46 }, { 32, 39 }, - { 33, 36 }, { 34, 35 }, { -77, -76 }, { -75, -74 }, - { 37, 38 }, { -73, -72 }, { -71, -70 }, { 40, 43 }, - { 41, 42 }, { -58, -57 }, { -56, -55 }, { 44, 45 }, - { -54, -52 }, { -51, -50 }, { 47, 54 }, { 48, 51 }, - { 49, 50 }, { -49, -48 }, { -47, -46 }, { 52, 53 }, - { -45, -44 }, { -43, -42 }, { 55, 58 }, { 56, 57 }, - { -41, -40 }, { -39, -38 }, { 59, 60 }, { -37, -36 }, - { -35, 61 }, { -34, -33 } -}; - -static const int8_t t_huffman_noise_bal_3_0dB[24][2] = { - { -64, 1 }, { -65, 2 }, { -63, 3 }, { 4, 9 }, - { -66, 5 }, { -62, 6 }, { 7, 8 }, { -76, -75 }, - { -74, -73 }, { 10, 17 }, { 11, 14 }, { 12, 13 }, - { -72, -71 }, { -70, -69 }, { 15, 16 }, { -68, -67 }, - { -61, -60 }, { 18, 21 }, { 19, 20 }, { -59, -58 }, - { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 } -}; - - -static INLINE int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff) -{ - uint8_t bit; - int16_t index = 0; - - while (index >= 0) - { - bit = (uint8_t)faad_get1bit(ld); - index = t_huff[index][bit]; - } - - return index + 64; -} - -/* table 10 */ -void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch) -{ - uint8_t env, band; - int8_t delta = 0; - sbr_huff_tab t_huff, f_huff; - - if ((sbr->L_E[ch] == 1) && (sbr->bs_frame_class[ch] == FIXFIX)) - sbr->amp_res[ch] = 0; - else - sbr->amp_res[ch] = sbr->bs_amp_res; - - if ((sbr->bs_coupling) && (ch == 1)) - { - delta = 1; - if (sbr->amp_res[ch]) - { - t_huff = t_huffman_env_bal_3_0dB; - f_huff = f_huffman_env_bal_3_0dB; - } else { - t_huff = t_huffman_env_bal_1_5dB; - f_huff = f_huffman_env_bal_1_5dB; - } - } else { - delta = 0; - if (sbr->amp_res[ch]) - { - t_huff = t_huffman_env_3_0dB; - f_huff = f_huffman_env_3_0dB; - } else { - t_huff = t_huffman_env_1_5dB; - f_huff = f_huffman_env_1_5dB; - } - } - - for (env = 0; env < sbr->L_E[ch]; env++) - { - if (sbr->bs_df_env[ch][env] == 0) - { - if ((sbr->bs_coupling == 1) && (ch == 1)) - { - if (sbr->amp_res[ch]) - { - sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 5 - DEBUGVAR(1,272,"sbr_envelope(): bs_data_env")) << delta); - } else { - sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6 - DEBUGVAR(1,273,"sbr_envelope(): bs_data_env")) << delta); - } - } else { - if (sbr->amp_res[ch]) - { - sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6 - DEBUGVAR(1,274,"sbr_envelope(): bs_data_env")) << delta); - } else { - sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 7 - DEBUGVAR(1,275,"sbr_envelope(): bs_data_env")) << delta); - } - } - - for (band = 1; band < sbr->n[sbr->f[ch][env]]; band++) - { - sbr->E[ch][band][env] = (sbr_huff_dec(ld, f_huff) << delta); - } - - } else { - for (band = 0; band < sbr->n[sbr->f[ch][env]]; band++) - { - sbr->E[ch][band][env] = (sbr_huff_dec(ld, t_huff) << delta); - } - } - } - - extract_envelope_data(sbr, ch); -} - -/* table 11 */ -void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch) -{ - uint8_t noise, band; - int8_t delta = 0; - sbr_huff_tab t_huff, f_huff; - - if ((sbr->bs_coupling == 1) && (ch == 1)) - { - delta = 1; - t_huff = t_huffman_noise_bal_3_0dB; - f_huff = f_huffman_env_bal_3_0dB; - } else { - delta = 0; - t_huff = t_huffman_noise_3_0dB; - f_huff = f_huffman_env_3_0dB; - } - - for (noise = 0; noise < sbr->L_Q[ch]; noise++) - { - if(sbr->bs_df_noise[ch][noise] == 0) - { - if ((sbr->bs_coupling == 1) && (ch == 1)) - { - sbr->Q[ch][0][noise] = (faad_getbits(ld, 5 - DEBUGVAR(1,276,"sbr_noise(): bs_data_noise")) << delta); - } else { - sbr->Q[ch][0][noise] = (faad_getbits(ld, 5 - DEBUGVAR(1,277,"sbr_noise(): bs_data_noise")) << delta); - } - for (band = 1; band < sbr->N_Q; band++) - { - sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, f_huff) << delta); - } - } else { - for (band = 0; band < sbr->N_Q; band++) - { - sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, t_huff) << delta); - } - } - } - - extract_noise_floor_data(sbr, ch); -} - -#endif diff --git a/mplayer/libfaad2/sbr_huff.h b/mplayer/libfaad2/sbr_huff.h deleted file mode 100644 index db8a364e..00000000 --- a/mplayer/libfaad2/sbr_huff.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_huff.h,v 1.17 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __SBR_HUFF_H__ -#define __SBR_HUFF_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch); -void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch); - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/mplayer/libfaad2/sbr_noise.h b/mplayer/libfaad2/sbr_noise.h deleted file mode 100644 index cd2fb83f..00000000 --- a/mplayer/libfaad2/sbr_noise.h +++ /dev/null @@ -1,561 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_noise.h,v 1.13 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __SBR_NOISE_H__ -#define __SBR_NOISE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _MSC_VER -#pragma warning(disable:4305) -#pragma warning(disable:4244) -#endif - - -/* Table 1.A.13 Noise table V */ -ALIGN static const complex_t V[] = { - { FRAC_CONST(-0.99948155879974), FRAC_CONST(-0.59483414888382) }, - { FRAC_CONST(0.97113454341888), FRAC_CONST(-0.67528516054153) }, - { FRAC_CONST(0.14130051434040), FRAC_CONST(-0.95090985298157) }, - { FRAC_CONST(-0.47005495429039), FRAC_CONST(-0.37340548634529) }, - { FRAC_CONST(0.80705064535141), FRAC_CONST(0.29653668403625) }, - { FRAC_CONST(-0.38981479406357), FRAC_CONST(0.89572608470917) }, - { FRAC_CONST(-0.01053049881011), FRAC_CONST(-0.66959059238434) }, - { FRAC_CONST(-0.91266369819641), FRAC_CONST(-0.11522938311100) }, - { FRAC_CONST(0.54840421676636), FRAC_CONST(0.75221365690231) }, - { FRAC_CONST(0.40009254217148), FRAC_CONST(-0.98929399251938) }, - { FRAC_CONST(-0.99867975711823), FRAC_CONST(-0.88147068023682) }, - { FRAC_CONST(-0.95531076192856), FRAC_CONST(0.90908759832382) }, - { FRAC_CONST(-0.45725932717323), FRAC_CONST(-0.56716322898865) }, - { FRAC_CONST(-0.72929674386978), FRAC_CONST(-0.98008275032043) }, - { FRAC_CONST(0.75622802972794), FRAC_CONST(0.20950329303741) }, - { FRAC_CONST(0.07069442421198), FRAC_CONST(-0.78247898817062) }, - { FRAC_CONST(0.74496251344681), FRAC_CONST(-0.91169005632401) }, - { FRAC_CONST(-0.96440184116364), FRAC_CONST(-0.94739919900894) }, - { FRAC_CONST(0.30424630641937), FRAC_CONST(-0.49438267946243) }, - { FRAC_CONST(0.66565030813217), FRAC_CONST(0.64652937650681) }, - { FRAC_CONST(0.91697007417679), FRAC_CONST(0.17514097690582) }, - { FRAC_CONST(-0.70774918794632), FRAC_CONST(0.52548652887344) }, - { FRAC_CONST(-0.70051413774490), FRAC_CONST(-0.45340028405190) }, - { FRAC_CONST(-0.99496513605118), FRAC_CONST(-0.90071910619736) }, - { FRAC_CONST(0.98164492845535), FRAC_CONST(-0.77463155984879) }, - { FRAC_CONST(-0.54671579599380), FRAC_CONST(-0.02570928446949) }, - { FRAC_CONST(-0.01689629070461), FRAC_CONST(0.00287506449968) }, - { FRAC_CONST(-0.86110347509384), FRAC_CONST(0.42548584938049) }, - { FRAC_CONST(-0.98892980813980), FRAC_CONST(-0.87881129980087) }, - { FRAC_CONST(0.51756626367569), FRAC_CONST(0.66926783323288) }, - { FRAC_CONST(-0.99635028839111), FRAC_CONST(-0.58107727766037) }, - { FRAC_CONST(-0.99969369173050), FRAC_CONST(0.98369991779327) }, - { FRAC_CONST(0.55266261100769), FRAC_CONST(0.59449058771133) }, - { FRAC_CONST(0.34581178426743), FRAC_CONST(0.94879418611526) }, - { FRAC_CONST(0.62664210796356), FRAC_CONST(-0.74402970075607) }, - { FRAC_CONST(-0.77149701118469), FRAC_CONST(-0.33883658051491) }, - { FRAC_CONST(-0.91592246294022), FRAC_CONST(0.03687901422381) }, - { FRAC_CONST(-0.76285493373871), FRAC_CONST(-0.91371870040894) }, - { FRAC_CONST(0.79788339138031), FRAC_CONST(-0.93180972337723) }, - { FRAC_CONST(0.54473078250885), FRAC_CONST(-0.11919206380844) }, - { FRAC_CONST(-0.85639280080795), FRAC_CONST(0.42429855465889) }, - { FRAC_CONST(-0.92882400751114), FRAC_CONST(0.27871808409691) }, - { FRAC_CONST(-0.11708371341228), FRAC_CONST(-0.99800843000412) }, - { FRAC_CONST(0.21356749534607), FRAC_CONST(-0.90716296434402) }, - { FRAC_CONST(-0.76191693544388), FRAC_CONST(0.99768120050430) }, - { FRAC_CONST(0.98111045360565), FRAC_CONST(-0.95854461193085) }, - { FRAC_CONST(-0.85913270711899), FRAC_CONST(0.95766568183899) }, - { FRAC_CONST(-0.93307244777679), FRAC_CONST(0.49431759119034) }, - { FRAC_CONST(0.30485755205154), FRAC_CONST(-0.70540034770966) }, - { FRAC_CONST(0.85289651155472), FRAC_CONST(0.46766132116318) }, - { FRAC_CONST(0.91328084468842), FRAC_CONST(-0.99839597940445) }, - { FRAC_CONST(-0.05890199914575), FRAC_CONST(0.70741826295853) }, - { FRAC_CONST(0.28398686647415), FRAC_CONST(0.34633556008339) }, - { FRAC_CONST(0.95258164405823), FRAC_CONST(-0.54893416166306) }, - { FRAC_CONST(-0.78566324710846), FRAC_CONST(-0.75568538904190) }, - { FRAC_CONST(-0.95789498090744), FRAC_CONST(-0.20423194766045) }, - { FRAC_CONST(0.82411158084869), FRAC_CONST(0.96654617786407) }, - { FRAC_CONST(-0.65185445547104), FRAC_CONST(-0.88734990358353) }, - { FRAC_CONST(-0.93643605709076), FRAC_CONST(0.99870789051056) }, - { FRAC_CONST(0.91427159309387), FRAC_CONST(-0.98290503025055) }, - { FRAC_CONST(-0.70395684242249), FRAC_CONST(0.58796799182892) }, - { FRAC_CONST(0.00563771976158), FRAC_CONST(0.61768198013306) }, - { FRAC_CONST(0.89065051078796), FRAC_CONST(0.52783352136612) }, - { FRAC_CONST(-0.68683707714081), FRAC_CONST(0.80806946754456) }, - { FRAC_CONST(0.72165340185165), FRAC_CONST(-0.69259858131409) }, - { FRAC_CONST(-0.62928247451782), FRAC_CONST(0.13627037405968) }, - { FRAC_CONST(0.29938435554504), FRAC_CONST(-0.46051329374313) }, - { FRAC_CONST(-0.91781955957413), FRAC_CONST(-0.74012714624405) }, - { FRAC_CONST(0.99298715591431), FRAC_CONST(0.40816611051559) }, - { FRAC_CONST(0.82368296384811), FRAC_CONST(-0.74036049842834) }, - { FRAC_CONST(-0.98512834310532), FRAC_CONST(-0.99972331523895) }, - { FRAC_CONST(-0.95915371179581), FRAC_CONST(-0.99237799644470) }, - { FRAC_CONST(-0.21411126852036), FRAC_CONST(-0.93424820899963) }, - { FRAC_CONST(-0.68821477890015), FRAC_CONST(-0.26892307400703) }, - { FRAC_CONST(0.91851997375488), FRAC_CONST(0.09358228743076) }, - { FRAC_CONST(-0.96062767505646), FRAC_CONST(0.36099094152451) }, - { FRAC_CONST(0.51646184921265), FRAC_CONST(-0.71373331546783) }, - { FRAC_CONST(0.61130720376968), FRAC_CONST(0.46950140595436) }, - { FRAC_CONST(0.47336128354073), FRAC_CONST(-0.27333179116249) }, - { FRAC_CONST(0.90998309850693), FRAC_CONST(0.96715664863586) }, - { FRAC_CONST(0.44844800233841), FRAC_CONST(0.99211573600769) }, - { FRAC_CONST(0.66614890098572), FRAC_CONST(0.96590173244476) }, - { FRAC_CONST(0.74922239780426), FRAC_CONST(-0.89879858493805) }, - { FRAC_CONST(-0.99571585655212), FRAC_CONST(0.52785521745682) }, - { FRAC_CONST(0.97401082515717), FRAC_CONST(-0.16855870187283) }, - { FRAC_CONST(0.72683745622635), FRAC_CONST(-0.48060774803162) }, - { FRAC_CONST(0.95432192087173), FRAC_CONST(0.68849605321884) }, - { FRAC_CONST(-0.72962206602097), FRAC_CONST(-0.76608443260193) }, - { FRAC_CONST(-0.85359477996826), FRAC_CONST(0.88738125562668) }, - { FRAC_CONST(-0.81412428617477), FRAC_CONST(-0.97480767965317) }, - { FRAC_CONST(-0.87930774688721), FRAC_CONST(0.74748307466507) }, - { FRAC_CONST(-0.71573328971863), FRAC_CONST(-0.98570609092712) }, - { FRAC_CONST(0.83524298667908), FRAC_CONST(0.83702534437180) }, - { FRAC_CONST(-0.48086065053940), FRAC_CONST(-0.98848503828049) }, - { FRAC_CONST(0.97139126062393), FRAC_CONST(0.80093622207642) }, - { FRAC_CONST(0.51992827653885), FRAC_CONST(0.80247628688812) }, - { FRAC_CONST(-0.00848591234535), FRAC_CONST(-0.76670128107071) }, - { FRAC_CONST(-0.70294374227524), FRAC_CONST(0.55359911918640) }, - { FRAC_CONST(-0.95894426107407), FRAC_CONST(-0.43265503644943) }, - { FRAC_CONST(0.97079253196716), FRAC_CONST(0.09325857460499) }, - { FRAC_CONST(-0.92404294013977), FRAC_CONST(0.85507702827454) }, - { FRAC_CONST(-0.69506472349167), FRAC_CONST(0.98633414506912) }, - { FRAC_CONST(0.26559203863144), FRAC_CONST(0.73314309120178) }, - { FRAC_CONST(0.28038442134857), FRAC_CONST(0.14537914097309) }, - { FRAC_CONST(-0.74138122797012), FRAC_CONST(0.99310338497162) }, - { FRAC_CONST(-0.01752796024084), FRAC_CONST(-0.82616633176804) }, - { FRAC_CONST(-0.55126774311066), FRAC_CONST(-0.98898541927338) }, - { FRAC_CONST(0.97960901260376), FRAC_CONST(-0.94021445512772) }, - { FRAC_CONST(-0.99196308851242), FRAC_CONST(0.67019015550613) }, - { FRAC_CONST(-0.67684930562973), FRAC_CONST(0.12631492316723) }, - { FRAC_CONST(0.09140039235353), FRAC_CONST(-0.20537731051445) }, - { FRAC_CONST(-0.71658962965012), FRAC_CONST(-0.97788202762604) }, - { FRAC_CONST(0.81014639139175), FRAC_CONST(0.53722649812698) }, - { FRAC_CONST(0.40616992115974), FRAC_CONST(-0.26469007134438) }, - { FRAC_CONST(-0.67680186033249), FRAC_CONST(0.94502049684525) }, - { FRAC_CONST(0.86849772930145), FRAC_CONST(-0.18333598971367) }, - { FRAC_CONST(-0.99500381946564), FRAC_CONST(-0.02634122036397) }, - { FRAC_CONST(0.84329187870026), FRAC_CONST(0.10406957566738) }, - { FRAC_CONST(-0.09215968847275), FRAC_CONST(0.69540011882782) }, - { FRAC_CONST(0.99956172704697), FRAC_CONST(-0.12358541786671) }, - { FRAC_CONST(-0.79732781648636), FRAC_CONST(-0.91582524776459) }, - { FRAC_CONST(0.96349972486496), FRAC_CONST(0.96640455722809) }, - { FRAC_CONST(-0.79942780733109), FRAC_CONST(0.64323902130127) }, - { FRAC_CONST(-0.11566039919853), FRAC_CONST(0.28587844967842) }, - { FRAC_CONST(-0.39922955632210), FRAC_CONST(0.94129604101181) }, - { FRAC_CONST(0.99089199304581), FRAC_CONST(-0.92062628269196) }, - { FRAC_CONST(0.28631284832954), FRAC_CONST(-0.91035044193268) }, - { FRAC_CONST(-0.83302724361420), FRAC_CONST(-0.67330408096313) }, - { FRAC_CONST(0.95404446125031), FRAC_CONST(0.49162766337395) }, - { FRAC_CONST(-0.06449863314629), FRAC_CONST(0.03250560909510) }, - { FRAC_CONST(-0.99575054645538), FRAC_CONST(0.42389783263206) }, - { FRAC_CONST(-0.65501141548157), FRAC_CONST(0.82546114921570) }, - { FRAC_CONST(-0.81254440546036), FRAC_CONST(-0.51627236604691) }, - { FRAC_CONST(-0.99646371603012), FRAC_CONST(0.84490531682968) }, - { FRAC_CONST(0.00287840608507), FRAC_CONST(0.64768260717392) }, - { FRAC_CONST(0.70176988840103), FRAC_CONST(-0.20453028380871) }, - { FRAC_CONST(0.96361881494522), FRAC_CONST(0.40706968307495) }, - { FRAC_CONST(-0.68883758783340), FRAC_CONST(0.91338956356049) }, - { FRAC_CONST(-0.34875586628914), FRAC_CONST(0.71472293138504) }, - { FRAC_CONST(0.91980081796646), FRAC_CONST(0.66507452726364) }, - { FRAC_CONST(-0.99009048938751), FRAC_CONST(0.85868018865585) }, - { FRAC_CONST(0.68865793943405), FRAC_CONST(0.55660319328308) }, - { FRAC_CONST(-0.99484401941299), FRAC_CONST(-0.20052559673786) }, - { FRAC_CONST(0.94214510917664), FRAC_CONST(-0.99696427583694) }, - { FRAC_CONST(-0.67414629459381), FRAC_CONST(0.49548220634460) }, - { FRAC_CONST(-0.47339352965355), FRAC_CONST(-0.85904330015182) }, - { FRAC_CONST(0.14323651790619), FRAC_CONST(-0.94145596027374) }, - { FRAC_CONST(-0.29268294572830), FRAC_CONST(0.05759225040674) }, - { FRAC_CONST(0.43793860077858), FRAC_CONST(-0.78904968500137) }, - { FRAC_CONST(-0.36345127224922), FRAC_CONST(0.64874434471130) }, - { FRAC_CONST(-0.08750604838133), FRAC_CONST(0.97686946392059) }, - { FRAC_CONST(-0.96495270729065), FRAC_CONST(-0.53960305452347) }, - { FRAC_CONST(0.55526942014694), FRAC_CONST(0.78891521692276) }, - { FRAC_CONST(0.73538213968277), FRAC_CONST(0.96452075242996) }, - { FRAC_CONST(-0.30889773368835), FRAC_CONST(-0.80664390325546) }, - { FRAC_CONST(0.03574995696545), FRAC_CONST(-0.97325617074966) }, - { FRAC_CONST(0.98720687627792), FRAC_CONST(0.48409134149551) }, - { FRAC_CONST(-0.81689298152924), FRAC_CONST(-0.90827703475952) }, - { FRAC_CONST(0.67866861820221), FRAC_CONST(0.81284505128860) }, - { FRAC_CONST(-0.15808570384979), FRAC_CONST(0.85279554128647) }, - { FRAC_CONST(0.80723392963409), FRAC_CONST(-0.24717418849468) }, - { FRAC_CONST(0.47788757085800), FRAC_CONST(-0.46333149075508) }, - { FRAC_CONST(0.96367555856705), FRAC_CONST(0.38486748933792) }, - { FRAC_CONST(-0.99143874645233), FRAC_CONST(-0.24945276975632) }, - { FRAC_CONST(0.83081877231598), FRAC_CONST(-0.94780850410461) }, - { FRAC_CONST(-0.58753192424774), FRAC_CONST(0.01290772389621) }, - { FRAC_CONST(0.95538109540939), FRAC_CONST(-0.85557049512863) }, - { FRAC_CONST(-0.96490919589996), FRAC_CONST(-0.64020973443985) }, - { FRAC_CONST(-0.97327101230621), FRAC_CONST(0.12378127872944) }, - { FRAC_CONST(0.91400367021561), FRAC_CONST(0.57972472906113) }, - { FRAC_CONST(-0.99925839900970), FRAC_CONST(0.71084845066071) }, - { FRAC_CONST(-0.86875903606415), FRAC_CONST(-0.20291699469090) }, - { FRAC_CONST(-0.26240035891533), FRAC_CONST(-0.68264555931091) }, - { FRAC_CONST(-0.24664412438869), FRAC_CONST(-0.87642270326614) }, - { FRAC_CONST(0.02416275814176), FRAC_CONST(0.27192914485931) }, - { FRAC_CONST(0.82068622112274), FRAC_CONST(-0.85087788105011) }, - { FRAC_CONST(0.88547372817993), FRAC_CONST(-0.89636802673340) }, - { FRAC_CONST(-0.18173077702522), FRAC_CONST(-0.26152145862579) }, - { FRAC_CONST(0.09355476498604), FRAC_CONST(0.54845124483109) }, - { FRAC_CONST(-0.54668414592743), FRAC_CONST(0.95980775356293) }, - { FRAC_CONST(0.37050989270210), FRAC_CONST(-0.59910142421722) }, - { FRAC_CONST(-0.70373594760895), FRAC_CONST(0.91227668523788) }, - { FRAC_CONST(-0.34600785374641), FRAC_CONST(-0.99441426992416) }, - { FRAC_CONST(-0.68774479627609), FRAC_CONST(-0.30238837003708) }, - { FRAC_CONST(-0.26843291521072), FRAC_CONST(0.83115667104721) }, - { FRAC_CONST(0.49072334170341), FRAC_CONST(-0.45359709858894) }, - { FRAC_CONST(0.38975992798805), FRAC_CONST(0.95515358448029) }, - { FRAC_CONST(-0.97757124900818), FRAC_CONST(0.05305894464254) }, - { FRAC_CONST(-0.17325553297997), FRAC_CONST(-0.92770671844482) }, - { FRAC_CONST(0.99948036670685), FRAC_CONST(0.58285546302795) }, - { FRAC_CONST(-0.64946246147156), FRAC_CONST(0.68645507097244) }, - { FRAC_CONST(-0.12016920745373), FRAC_CONST(-0.57147324085236) }, - { FRAC_CONST(-0.58947455883026), FRAC_CONST(-0.34847131371498) }, - { FRAC_CONST(-0.41815140843391), FRAC_CONST(0.16276422142982) }, - { FRAC_CONST(0.99885648488998), FRAC_CONST(0.11136095225811) }, - { FRAC_CONST(-0.56649613380432), FRAC_CONST(-0.90494865179062) }, - { FRAC_CONST(0.94138020277023), FRAC_CONST(0.35281917452812) }, - { FRAC_CONST(-0.75725078582764), FRAC_CONST(0.53650552034378) }, - { FRAC_CONST(0.20541973412037), FRAC_CONST(-0.94435143470764) }, - { FRAC_CONST(0.99980372190475), FRAC_CONST(0.79835915565491) }, - { FRAC_CONST(0.29078277945518), FRAC_CONST(0.35393777489662) }, - { FRAC_CONST(-0.62858772277832), FRAC_CONST(0.38765692710876) }, - { FRAC_CONST(0.43440905213356), FRAC_CONST(-0.98546332120895) }, - { FRAC_CONST(-0.98298585414886), FRAC_CONST(0.21021524071693) }, - { FRAC_CONST(0.19513028860092), FRAC_CONST(-0.94239830970764) }, - { FRAC_CONST(-0.95476663112640), FRAC_CONST(0.98364555835724) }, - { FRAC_CONST(0.93379634618759), FRAC_CONST(-0.70881992578506) }, - { FRAC_CONST(-0.85235410928726), FRAC_CONST(-0.08342348039150) }, - { FRAC_CONST(-0.86425095796585), FRAC_CONST(-0.45795026421547) }, - { FRAC_CONST(0.38879778981209), FRAC_CONST(0.97274428606033) }, - { FRAC_CONST(0.92045122385025), FRAC_CONST(-0.62433654069901) }, - { FRAC_CONST(0.89162534475327), FRAC_CONST(0.54950958490372) }, - { FRAC_CONST(-0.36834338307381), FRAC_CONST(0.96458297967911) }, - { FRAC_CONST(0.93891763687134), FRAC_CONST(-0.89968353509903) }, - { FRAC_CONST(0.99267655611038), FRAC_CONST(-0.03757034242153) }, - { FRAC_CONST(-0.94063472747803), FRAC_CONST(0.41332337260246) }, - { FRAC_CONST(0.99740225076675), FRAC_CONST(-0.16830494999886) }, - { FRAC_CONST(-0.35899412631989), FRAC_CONST(-0.46633225679398) }, - { FRAC_CONST(0.05237237364054), FRAC_CONST(-0.25640362501144) }, - { FRAC_CONST(0.36703583598137), FRAC_CONST(-0.38653266429901) }, - { FRAC_CONST(0.91653180122375), FRAC_CONST(-0.30587628483772) }, - { FRAC_CONST(0.69000804424286), FRAC_CONST(0.90952169895172) }, - { FRAC_CONST(-0.38658750057220), FRAC_CONST(0.99501574039459) }, - { FRAC_CONST(-0.29250815510750), FRAC_CONST(0.37444993853569) }, - { FRAC_CONST(-0.60182201862335), FRAC_CONST(0.86779648065567) }, - { FRAC_CONST(-0.97418588399887), FRAC_CONST(0.96468526124954) }, - { FRAC_CONST(0.88461571931839), FRAC_CONST(0.57508403062820) }, - { FRAC_CONST(0.05198933184147), FRAC_CONST(0.21269661188126) }, - { FRAC_CONST(-0.53499621152878), FRAC_CONST(0.97241556644440) }, - { FRAC_CONST(-0.49429559707642), FRAC_CONST(0.98183864355087) }, - { FRAC_CONST(-0.98935145139694), FRAC_CONST(-0.40249159932137) }, - { FRAC_CONST(-0.98081380128860), FRAC_CONST(-0.72856897115707) }, - { FRAC_CONST(-0.27338150143623), FRAC_CONST(0.99950921535492) }, - { FRAC_CONST(0.06310802698135), FRAC_CONST(-0.54539585113525) }, - { FRAC_CONST(-0.20461677014828), FRAC_CONST(-0.14209978282452) }, - { FRAC_CONST(0.66223841905594), FRAC_CONST(0.72528582811356) }, - { FRAC_CONST(-0.84764343500137), FRAC_CONST(0.02372316829860) }, - { FRAC_CONST(-0.89039862155914), FRAC_CONST(0.88866579532623) }, - { FRAC_CONST(0.95903307199478), FRAC_CONST(0.76744925975800) }, - { FRAC_CONST(0.73504126071930), FRAC_CONST(-0.03747203201056) }, - { FRAC_CONST(-0.31744435429573), FRAC_CONST(-0.36834111809731) }, - { FRAC_CONST(-0.34110826253891), FRAC_CONST(0.40211221575737) }, - { FRAC_CONST(0.47803884744644), FRAC_CONST(-0.39423218369484) }, - { FRAC_CONST(0.98299193382263), FRAC_CONST(0.01989791356027) }, - { FRAC_CONST(-0.30963072180748), FRAC_CONST(-0.18076720833778) }, - { FRAC_CONST(0.99992591142654), FRAC_CONST(-0.26281872391701) }, - { FRAC_CONST(-0.93149733543396), FRAC_CONST(-0.98313164710999) }, - { FRAC_CONST(0.99923473596573), FRAC_CONST(-0.80142992734909) }, - { FRAC_CONST(-0.26024168729782), FRAC_CONST(-0.75999760627747) }, - { FRAC_CONST(-0.35712513327599), FRAC_CONST(0.19298963248730) }, - { FRAC_CONST(-0.99899083375931), FRAC_CONST(0.74645155668259) }, - { FRAC_CONST(0.86557173728943), FRAC_CONST(0.55593866109848) }, - { FRAC_CONST(0.33408042788506), FRAC_CONST(0.86185956001282) }, - { FRAC_CONST(0.99010735750198), FRAC_CONST(0.04602397605777) }, - { FRAC_CONST(-0.66694271564484), FRAC_CONST(-0.91643613576889) }, - { FRAC_CONST(0.64016789197922), FRAC_CONST(0.15649530291557) }, - { FRAC_CONST(0.99570536613464), FRAC_CONST(0.45844584703445) }, - { FRAC_CONST(-0.63431465625763), FRAC_CONST(0.21079117059708) }, - { FRAC_CONST(-0.07706847041845), FRAC_CONST(-0.89581435918808) }, - { FRAC_CONST(0.98590087890625), FRAC_CONST(0.88241720199585) }, - { FRAC_CONST(0.80099332332611), FRAC_CONST(-0.36851897835732) }, - { FRAC_CONST(0.78368133306503), FRAC_CONST(0.45506998896599) }, - { FRAC_CONST(0.08707806468010), FRAC_CONST(0.80938994884491) }, - { FRAC_CONST(-0.86811882257462), FRAC_CONST(0.39347308874130) }, - { FRAC_CONST(-0.39466530084610), FRAC_CONST(-0.66809433698654) }, - { FRAC_CONST(0.97875326871872), FRAC_CONST(-0.72467839717865) }, - { FRAC_CONST(-0.95038563013077), FRAC_CONST(0.89563220739365) }, - { FRAC_CONST(0.17005239427090), FRAC_CONST(0.54683053493500) }, - { FRAC_CONST(-0.76910793781281), FRAC_CONST(-0.96226614713669) }, - { FRAC_CONST(0.99743282794952), FRAC_CONST(0.42697158455849) }, - { FRAC_CONST(0.95437383651733), FRAC_CONST(0.97002321481705) }, - { FRAC_CONST(0.99578905105591), FRAC_CONST(-0.54106825590134) }, - { FRAC_CONST(0.28058260679245), FRAC_CONST(-0.85361421108246) }, - { FRAC_CONST(0.85256522893906), FRAC_CONST(-0.64567607641220) }, - { FRAC_CONST(-0.50608539581299), FRAC_CONST(-0.65846014022827) }, - { FRAC_CONST(-0.97210735082626), FRAC_CONST(-0.23095212876797) }, - { FRAC_CONST(0.95424050092697), FRAC_CONST(-0.99240148067474) }, - { FRAC_CONST(-0.96926569938660), FRAC_CONST(0.73775655031204) }, - { FRAC_CONST(0.30872163176537), FRAC_CONST(0.41514959931374) }, - { FRAC_CONST(-0.24523839354515), FRAC_CONST(0.63206630945206) }, - { FRAC_CONST(-0.33813264966011), FRAC_CONST(-0.38661777973175) }, - { FRAC_CONST(-0.05826828256249), FRAC_CONST(-0.06940773874521) }, - { FRAC_CONST(-0.22898460924625), FRAC_CONST(0.97054851055145) }, - { FRAC_CONST(-0.18509915471077), FRAC_CONST(0.47565764188766) }, - { FRAC_CONST(-0.10488238185644), FRAC_CONST(-0.87769949436188) }, - { FRAC_CONST(-0.71886587142944), FRAC_CONST(0.78030979633331) }, - { FRAC_CONST(0.99793875217438), FRAC_CONST(0.90041309595108) }, - { FRAC_CONST(0.57563304901123), FRAC_CONST(-0.91034334897995) }, - { FRAC_CONST(0.28909647464752), FRAC_CONST(0.96307784318924) }, - { FRAC_CONST(0.42188999056816), FRAC_CONST(0.48148649930954) }, - { FRAC_CONST(0.93335050344467), FRAC_CONST(-0.43537023663521) }, - { FRAC_CONST(-0.97087377309799), FRAC_CONST(0.86636447906494) }, - { FRAC_CONST(0.36722871661186), FRAC_CONST(0.65291655063629) }, - { FRAC_CONST(-0.81093025207520), FRAC_CONST(0.08778370171785) }, - { FRAC_CONST(-0.26240602135658), FRAC_CONST(-0.92774093151093) }, - { FRAC_CONST(0.83996498584747), FRAC_CONST(0.55839848518372) }, - { FRAC_CONST(-0.99909615516663), FRAC_CONST(-0.96024608612061) }, - { FRAC_CONST(0.74649465084076), FRAC_CONST(0.12144893407822) }, - { FRAC_CONST(-0.74774593114853), FRAC_CONST(-0.26898062229156) }, - { FRAC_CONST(0.95781666040421), FRAC_CONST(-0.79047924280167) }, - { FRAC_CONST(0.95472306013107), FRAC_CONST(-0.08588775992393) }, - { FRAC_CONST(0.48708331584930), FRAC_CONST(0.99999040365219) }, - { FRAC_CONST(0.46332037448883), FRAC_CONST(0.10964126139879) }, - { FRAC_CONST(-0.76497006416321), FRAC_CONST(0.89210927486420) }, - { FRAC_CONST(0.57397389411926), FRAC_CONST(0.35289704799652) }, - { FRAC_CONST(0.75374317169189), FRAC_CONST(0.96705216169357) }, - { FRAC_CONST(-0.59174400568008), FRAC_CONST(-0.89405369758606) }, - { FRAC_CONST(0.75087904930115), FRAC_CONST(-0.29612672328949) }, - { FRAC_CONST(-0.98607856035233), FRAC_CONST(0.25034910440445) }, - { FRAC_CONST(-0.40761056542397), FRAC_CONST(-0.90045571327209) }, - { FRAC_CONST(0.66929268836975), FRAC_CONST(0.98629492521286) }, - { FRAC_CONST(-0.97463697195053), FRAC_CONST(-0.00190223299433) }, - { FRAC_CONST(0.90145510435104), FRAC_CONST(0.99781388044357) }, - { FRAC_CONST(-0.87259286642075), FRAC_CONST(0.99233585596085) }, - { FRAC_CONST(-0.91529458761215), FRAC_CONST(-0.15698707103729) }, - { FRAC_CONST(-0.03305738791823), FRAC_CONST(-0.37205263972282) }, - { FRAC_CONST(0.07223051041365), FRAC_CONST(-0.88805001974106) }, - { FRAC_CONST(0.99498009681702), FRAC_CONST(0.97094357013702) }, - { FRAC_CONST(-0.74904936552048), FRAC_CONST(0.99985486268997) }, - { FRAC_CONST(0.04585228487849), FRAC_CONST(0.99812334775925) }, - { FRAC_CONST(-0.89054954051971), FRAC_CONST(-0.31791913509369) }, - { FRAC_CONST(-0.83782142400742), FRAC_CONST(0.97637635469437) }, - { FRAC_CONST(0.33454805612564), FRAC_CONST(-0.86231517791748) }, - { FRAC_CONST(-0.99707579612732), FRAC_CONST(0.93237990140915) }, - { FRAC_CONST(-0.22827528417110), FRAC_CONST(0.18874759972095) }, - { FRAC_CONST(0.67248046398163), FRAC_CONST(-0.03646211326122) }, - { FRAC_CONST(-0.05146538093686), FRAC_CONST(-0.92599701881409) }, - { FRAC_CONST(0.99947297573090), FRAC_CONST(0.93625229597092) }, - { FRAC_CONST(0.66951125860214), FRAC_CONST(0.98905825614929) }, - { FRAC_CONST(-0.99602955579758), FRAC_CONST(-0.44654715061188) }, - { FRAC_CONST(0.82104903459549), FRAC_CONST(0.99540740251541) }, - { FRAC_CONST(0.99186509847641), FRAC_CONST(0.72022998332977) }, - { FRAC_CONST(-0.65284591913223), FRAC_CONST(0.52186721563339) }, - { FRAC_CONST(0.93885445594788), FRAC_CONST(-0.74895310401917) }, - { FRAC_CONST(0.96735250949860), FRAC_CONST(0.90891814231873) }, - { FRAC_CONST(-0.22225968539715), FRAC_CONST(0.57124030590057) }, - { FRAC_CONST(-0.44132784008980), FRAC_CONST(-0.92688840627670) }, - { FRAC_CONST(-0.85694974660873), FRAC_CONST(0.88844531774521) }, - { FRAC_CONST(0.91783040761948), FRAC_CONST(-0.46356892585754) }, - { FRAC_CONST(0.72556972503662), FRAC_CONST(-0.99899554252625) }, - { FRAC_CONST(-0.99711579084396), FRAC_CONST(0.58211559057236) }, - { FRAC_CONST(0.77638977766037), FRAC_CONST(0.94321835041046) }, - { FRAC_CONST(0.07717324048281), FRAC_CONST(0.58638399839401) }, - { FRAC_CONST(-0.56049829721451), FRAC_CONST(0.82522302865982) }, - { FRAC_CONST(0.98398894071579), FRAC_CONST(0.39467439055443) }, - { FRAC_CONST(0.47546947002411), FRAC_CONST(0.68613046407700) }, - { FRAC_CONST(0.65675091743469), FRAC_CONST(0.18331636488438) }, - { FRAC_CONST(0.03273375332355), FRAC_CONST(-0.74933111667633) }, - { FRAC_CONST(-0.38684144616127), FRAC_CONST(0.51337349414825) }, - { FRAC_CONST(-0.97346270084381), FRAC_CONST(-0.96549361944199) }, - { FRAC_CONST(-0.53282153606415), FRAC_CONST(-0.91423267126083) }, - { FRAC_CONST(0.99817311763763), FRAC_CONST(0.61133575439453) }, - { FRAC_CONST(-0.50254499912262), FRAC_CONST(-0.88829338550568) }, - { FRAC_CONST(0.01995873264968), FRAC_CONST(0.85223513841629) }, - { FRAC_CONST(0.99930381774902), FRAC_CONST(0.94578897953033) }, - { FRAC_CONST(0.82907766103745), FRAC_CONST(-0.06323442608118) }, - { FRAC_CONST(-0.58660709857941), FRAC_CONST(0.96840775012970) }, - { FRAC_CONST(-0.17573736608028), FRAC_CONST(-0.48166921734810) }, - { FRAC_CONST(0.83434289693832), FRAC_CONST(-0.13023450970650) }, - { FRAC_CONST(0.05946491286159), FRAC_CONST(0.20511047542095) }, - { FRAC_CONST(0.81505483388901), FRAC_CONST(-0.94685947895050) }, - { FRAC_CONST(-0.44976380467415), FRAC_CONST(0.40894573926926) }, - { FRAC_CONST(-0.89746475219727), FRAC_CONST(0.99846577644348) }, - { FRAC_CONST(0.39677256345749), FRAC_CONST(-0.74854665994644) }, - { FRAC_CONST(-0.07588948309422), FRAC_CONST(0.74096214771271) }, - { FRAC_CONST(0.76343196630478), FRAC_CONST(0.41746628284454) }, - { FRAC_CONST(-0.74490106105804), FRAC_CONST(0.94725912809372) }, - { FRAC_CONST(0.64880120754242), FRAC_CONST(0.41336661577225) }, - { FRAC_CONST(0.62319535017014), FRAC_CONST(-0.93098312616348) }, - { FRAC_CONST(0.42215818166733), FRAC_CONST(-0.07712787389755) }, - { FRAC_CONST(0.02704554051161), FRAC_CONST(-0.05417517945170) }, - { FRAC_CONST(0.80001771450043), FRAC_CONST(0.91542196273804) }, - { FRAC_CONST(-0.79351830482483), FRAC_CONST(-0.36208897829056) }, - { FRAC_CONST(0.63872361183167), FRAC_CONST(0.08128252625465) }, - { FRAC_CONST(0.52890521287918), FRAC_CONST(0.60048872232437) }, - { FRAC_CONST(0.74238550662994), FRAC_CONST(0.04491915181279) }, - { FRAC_CONST(0.99096131324768), FRAC_CONST(-0.19451183080673) }, - { FRAC_CONST(-0.80412328243256), FRAC_CONST(-0.88513815402985) }, - { FRAC_CONST(-0.64612615108490), FRAC_CONST(0.72198677062988) }, - { FRAC_CONST(0.11657770723104), FRAC_CONST(-0.83662831783295) }, - { FRAC_CONST(-0.95053184032440), FRAC_CONST(-0.96939903497696) }, - { FRAC_CONST(-0.62228870391846), FRAC_CONST(0.82767260074615) }, - { FRAC_CONST(0.03004475869238), FRAC_CONST(-0.99738895893097) }, - { FRAC_CONST(-0.97987216711044), FRAC_CONST(0.36526128649712) }, - { FRAC_CONST(-0.99986982345581), FRAC_CONST(-0.36021611094475) }, - { FRAC_CONST(0.89110648632050), FRAC_CONST(-0.97894251346588) }, - { FRAC_CONST(0.10407960414886), FRAC_CONST(0.77357792854309) }, - { FRAC_CONST(0.95964735746384), FRAC_CONST(-0.35435819625854) }, - { FRAC_CONST(0.50843232870102), FRAC_CONST(0.96107691526413) }, - { FRAC_CONST(0.17006334662437), FRAC_CONST(-0.76854026317596) }, - { FRAC_CONST(0.25872674584389), FRAC_CONST(0.99893301725388) }, - { FRAC_CONST(-0.01115998718888), FRAC_CONST(0.98496019840240) }, - { FRAC_CONST(-0.79598701000214), FRAC_CONST(0.97138410806656) }, - { FRAC_CONST(-0.99264711141586), FRAC_CONST(-0.99542820453644) }, - { FRAC_CONST(-0.99829661846161), FRAC_CONST(0.01877138763666) }, - { FRAC_CONST(-0.70801013708115), FRAC_CONST(0.33680686354637) }, - { FRAC_CONST(-0.70467054843903), FRAC_CONST(0.93272775411606) }, - { FRAC_CONST(0.99846023321152), FRAC_CONST(-0.98725748062134) }, - { FRAC_CONST(-0.63364970684052), FRAC_CONST(-0.16473594307899) }, - { FRAC_CONST(-0.16258217394352), FRAC_CONST(-0.95939123630524) }, - { FRAC_CONST(-0.43645593523979), FRAC_CONST(-0.94805032014847) }, - { FRAC_CONST(-0.99848473072052), FRAC_CONST(0.96245169639587) }, - { FRAC_CONST(-0.16796459257603), FRAC_CONST(-0.98987513780594) }, - { FRAC_CONST(-0.87979227304459), FRAC_CONST(-0.71725726127625) }, - { FRAC_CONST(0.44183099269867), FRAC_CONST(-0.93568974733353) }, - { FRAC_CONST(0.93310177326202), FRAC_CONST(-0.99913311004639) }, - { FRAC_CONST(-0.93941932916641), FRAC_CONST(-0.56409376859665) }, - { FRAC_CONST(-0.88590002059937), FRAC_CONST(0.47624599933624) }, - { FRAC_CONST(0.99971461296082), FRAC_CONST(-0.83889955282211) }, - { FRAC_CONST(-0.75376385450363), FRAC_CONST(0.00814643409103) }, - { FRAC_CONST(0.93887686729431), FRAC_CONST(-0.11284527927637) }, - { FRAC_CONST(0.85126435756683), FRAC_CONST(0.52349251508713) }, - { FRAC_CONST(0.39701420068741), FRAC_CONST(0.81779634952545) }, - { FRAC_CONST(-0.37024465203285), FRAC_CONST(-0.87071657180786) }, - { FRAC_CONST(-0.36024826765060), FRAC_CONST(0.34655734896660) }, - { FRAC_CONST(-0.93388813734055), FRAC_CONST(-0.84476542472839) }, - { FRAC_CONST(-0.65298801660538), FRAC_CONST(-0.18439576029778) }, - { FRAC_CONST(0.11960318684578), FRAC_CONST(0.99899345636368) }, - { FRAC_CONST(0.94292563199997), FRAC_CONST(0.83163905143738) }, - { FRAC_CONST(0.75081145763397), FRAC_CONST(-0.35533222556114) }, - { FRAC_CONST(0.56721979379654), FRAC_CONST(-0.24076835811138) }, - { FRAC_CONST(0.46857765316963), FRAC_CONST(-0.30140233039856) }, - { FRAC_CONST(0.97312313318253), FRAC_CONST(-0.99548190832138) }, - { FRAC_CONST(-0.38299977779388), FRAC_CONST(0.98516911268234) }, - { FRAC_CONST(0.41025799512863), FRAC_CONST(0.02116736955941) }, - { FRAC_CONST(0.09638062119484), FRAC_CONST(0.04411984235048) }, - { FRAC_CONST(-0.85283249616623), FRAC_CONST(0.91475564241409) }, - { FRAC_CONST(0.88866806030273), FRAC_CONST(-0.99735265970230) }, - { FRAC_CONST(-0.48202428221703), FRAC_CONST(-0.96805608272552) }, - { FRAC_CONST(0.27572581171989), FRAC_CONST(0.58634752035141) }, - { FRAC_CONST(-0.65889132022858), FRAC_CONST(0.58835631608963) }, - { FRAC_CONST(0.98838084936142), FRAC_CONST(0.99994349479675) }, - { FRAC_CONST(-0.20651349425316), FRAC_CONST(0.54593044519424) }, - { FRAC_CONST(-0.62126415967941), FRAC_CONST(-0.59893679618835) }, - { FRAC_CONST(0.20320105552673), FRAC_CONST(-0.86879181861877) }, - { FRAC_CONST(-0.97790551185608), FRAC_CONST(0.96290808916092) }, - { FRAC_CONST(0.11112534999847), FRAC_CONST(0.21484763920307) }, - { FRAC_CONST(-0.41368338465691), FRAC_CONST(0.28216838836670) }, - { FRAC_CONST(0.24133038520813), FRAC_CONST(0.51294362545013) }, - { FRAC_CONST(-0.66393411159515), FRAC_CONST(-0.08249679952860) }, - { FRAC_CONST(-0.53697830438614), FRAC_CONST(-0.97649902105331) }, - { FRAC_CONST(-0.97224736213684), FRAC_CONST(0.22081333398819) }, - { FRAC_CONST(0.87392479181290), FRAC_CONST(-0.12796173989773) }, - { FRAC_CONST(0.19050361216068), FRAC_CONST(0.01602615416050) }, - { FRAC_CONST(-0.46353441476822), FRAC_CONST(-0.95249038934708) }, - { FRAC_CONST(-0.07064096629620), FRAC_CONST(-0.94479805231094) }, - { FRAC_CONST(-0.92444086074829), FRAC_CONST(-0.10457590222359) }, - { FRAC_CONST(-0.83822596073151), FRAC_CONST(-0.01695043221116) }, - { FRAC_CONST(0.75214684009552), FRAC_CONST(-0.99955683946609) }, - { FRAC_CONST(-0.42102998495102), FRAC_CONST(0.99720942974091) }, - { FRAC_CONST(-0.72094786167145), FRAC_CONST(-0.35008960962296) }, - { FRAC_CONST(0.78843313455582), FRAC_CONST(0.52851396799088) }, - { FRAC_CONST(0.97394025325775), FRAC_CONST(-0.26695942878723) }, - { FRAC_CONST(0.99206465482712), FRAC_CONST(-0.57010120153427) }, - { FRAC_CONST(0.76789611577988), FRAC_CONST(-0.76519358158112) }, - { FRAC_CONST(-0.82002419233322), FRAC_CONST(-0.73530179262161) }, - { FRAC_CONST(0.81924992799759), FRAC_CONST(0.99698424339294) }, - { FRAC_CONST(-0.26719850301743), FRAC_CONST(0.68903368711472) }, - { FRAC_CONST(-0.43311259150505), FRAC_CONST(0.85321813821793) }, - { FRAC_CONST(0.99194979667664), FRAC_CONST(0.91876250505447) }, - { FRAC_CONST(-0.80691999197006), FRAC_CONST(-0.32627540826797) }, - { FRAC_CONST(0.43080005049706), FRAC_CONST(-0.21919095516205) }, - { FRAC_CONST(0.67709493637085), FRAC_CONST(-0.95478075742722) }, - { FRAC_CONST(0.56151771545410), FRAC_CONST(-0.70693808794022) }, - { FRAC_CONST(0.10831862688065), FRAC_CONST(-0.08628837019205) }, - { FRAC_CONST(0.91229414939880), FRAC_CONST(-0.65987348556519) }, - { FRAC_CONST(-0.48972892761230), FRAC_CONST(0.56289243698120) }, - { FRAC_CONST(-0.89033657312393), FRAC_CONST(-0.71656566858292) }, - { FRAC_CONST(0.65269446372986), FRAC_CONST(0.65916007757187) }, - { FRAC_CONST(0.67439478635788), FRAC_CONST(-0.81684380769730) }, - { FRAC_CONST(-0.47770830988884), FRAC_CONST(-0.16789555549622) }, - { FRAC_CONST(-0.99715977907181), FRAC_CONST(-0.93565785884857) }, - { FRAC_CONST(-0.90889590978622), FRAC_CONST(0.62034398317337) }, - { FRAC_CONST(-0.06618622690439), FRAC_CONST(-0.23812216520309) }, - { FRAC_CONST(0.99430269002914), FRAC_CONST(0.18812555074692) }, - { FRAC_CONST(0.97686403989792), FRAC_CONST(-0.28664535284042) }, - { FRAC_CONST(0.94813650846481), FRAC_CONST(-0.97506642341614) }, - { FRAC_CONST(-0.95434498786926), FRAC_CONST(-0.79607981443405) }, - { FRAC_CONST(-0.49104782938957), FRAC_CONST(0.32895213365555) }, - { FRAC_CONST(0.99881172180176), FRAC_CONST(0.88993984460831) }, - { FRAC_CONST(0.50449168682098), FRAC_CONST(-0.85995072126389) }, - { FRAC_CONST(0.47162890434265), FRAC_CONST(-0.18680204451084) }, - { FRAC_CONST(-0.62081581354141), FRAC_CONST(0.75000673532486) }, - { FRAC_CONST(-0.43867015838623), FRAC_CONST(0.99998068809509) }, - { FRAC_CONST(0.98630565404892), FRAC_CONST(-0.53578901290894) }, - { FRAC_CONST(-0.61510360240936), FRAC_CONST(-0.89515018463135) }, - { FRAC_CONST(-0.03841517493129), FRAC_CONST(-0.69888818264008) }, - { FRAC_CONST(-0.30102157592773), FRAC_CONST(-0.07667808979750) }, - { FRAC_CONST(0.41881284117699), FRAC_CONST(0.02188098989427) }, - { FRAC_CONST(-0.86135452985764), FRAC_CONST(0.98947483301163) }, - { FRAC_CONST(0.67226862907410), FRAC_CONST(-0.13494388759136) }, - { FRAC_CONST(-0.70737397670746), FRAC_CONST(-0.76547348499298) }, - { FRAC_CONST(0.94044947624207), FRAC_CONST(0.09026201069355) }, - { FRAC_CONST(-0.82386350631714), FRAC_CONST(0.08924768865108) }, - { FRAC_CONST(-0.32070666551590), FRAC_CONST(0.50143420696259) }, - { FRAC_CONST(0.57593160867691), FRAC_CONST(-0.98966425657272) }, - { FRAC_CONST(-0.36326017975807), FRAC_CONST(0.07440242916346) }, - { FRAC_CONST(0.99979043006897), FRAC_CONST(-0.14130286872387) }, - { FRAC_CONST(-0.92366021871567), FRAC_CONST(-0.97979295253754) }, - { FRAC_CONST(-0.44607177376747), FRAC_CONST(-0.54233253002167) }, - { FRAC_CONST(0.44226801395416), FRAC_CONST(0.71326756477356) }, - { FRAC_CONST(0.03671907261014), FRAC_CONST(0.63606387376785) }, - { FRAC_CONST(0.52175426483154), FRAC_CONST(-0.85396826267242) }, - { FRAC_CONST(-0.94701141119003), FRAC_CONST(-0.01826348155737) }, - { FRAC_CONST(-0.98759609460831), FRAC_CONST(0.82288712263107) }, - { FRAC_CONST(0.87434792518616), FRAC_CONST(0.89399492740631) }, - { FRAC_CONST(-0.93412041664124), FRAC_CONST(0.41374051570892) }, - { FRAC_CONST(0.96063941717148), FRAC_CONST(0.93116706609726) }, - { FRAC_CONST(0.97534251213074), FRAC_CONST(0.86150932312012) }, - { FRAC_CONST(0.99642467498779), FRAC_CONST(0.70190042257309) }, - { FRAC_CONST(-0.94705086946487), FRAC_CONST(-0.29580041766167) }, - { FRAC_CONST(0.91599804162979), FRAC_CONST(-0.98147833347321) } -}; - -#ifdef __cplusplus - -#endif -#endif - diff --git a/mplayer/libfaad2/sbr_qmf.c b/mplayer/libfaad2/sbr_qmf.c deleted file mode 100644 index c8d51473..00000000 --- a/mplayer/libfaad2/sbr_qmf.c +++ /dev/null @@ -1,633 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_qmf.c,v 1.27 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#ifdef SBR_DEC - - -#include -#include -#include "sbr_dct.h" -#include "sbr_qmf.h" -#include "sbr_qmf_c.h" -#include "sbr_syntax.h" - -qmfa_info *qmfa_init(uint8_t channels) -{ - qmfa_info *qmfa = (qmfa_info*)faad_malloc(sizeof(qmfa_info)); - - /* x is implemented as double ringbuffer */ - qmfa->x = (real_t*)faad_malloc(2 * channels * 10 * sizeof(real_t)); - memset(qmfa->x, 0, 2 * channels * 10 * sizeof(real_t)); - - /* ringbuffer index */ - qmfa->x_index = 0; - - qmfa->channels = channels; - - return qmfa; -} - -void qmfa_end(qmfa_info *qmfa) -{ - if (qmfa) - { - if (qmfa->x) faad_free(qmfa->x); - faad_free(qmfa); - } -} - -void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input, - qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx) -{ - ALIGN real_t u[64]; -#ifndef SBR_LOW_POWER - ALIGN real_t in_real[32], in_imag[32], out_real[32], out_imag[32]; -#else - ALIGN real_t y[32]; -#endif - uint16_t in = 0; - uint8_t l; - - /* qmf subsample l */ - for (l = 0; l < sbr->numTimeSlotsRate; l++) - { - int16_t n; - - /* shift input buffer x */ - /* input buffer is not shifted anymore, x is implemented as double ringbuffer */ - //memmove(qmfa->x + 32, qmfa->x, (320-32)*sizeof(real_t)); - - /* add new samples to input buffer x */ - for (n = 32 - 1; n >= 0; n--) - { -#ifdef FIXED_POINT - qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = (input[in++]) >> 4; -#else - qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = input[in++]; -#endif - } - - /* window and summation to create array u */ - for (n = 0; n < 64; n++) - { - u[n] = MUL_F(qmfa->x[qmfa->x_index + n], qmf_c[2*n]) + - MUL_F(qmfa->x[qmfa->x_index + n + 64], qmf_c[2*(n + 64)]) + - MUL_F(qmfa->x[qmfa->x_index + n + 128], qmf_c[2*(n + 128)]) + - MUL_F(qmfa->x[qmfa->x_index + n + 192], qmf_c[2*(n + 192)]) + - MUL_F(qmfa->x[qmfa->x_index + n + 256], qmf_c[2*(n + 256)]); - } - - /* update ringbuffer index */ - qmfa->x_index -= 32; - if (qmfa->x_index < 0) - qmfa->x_index = (320-32); - - /* calculate 32 subband samples by introducing X */ -#ifdef SBR_LOW_POWER - y[0] = u[48]; - for (n = 1; n < 16; n++) - y[n] = u[n+48] + u[48-n]; - for (n = 16; n < 32; n++) - y[n] = -u[n-16] + u[48-n]; - - DCT3_32_unscaled(u, y); - - for (n = 0; n < 32; n++) - { - if (n < kx) - { -#ifdef FIXED_POINT - QMF_RE(X[l + offset][n]) = u[n] /*<< 1*/; -#else - QMF_RE(X[l + offset][n]) = 2. * u[n]; -#endif - } else { - QMF_RE(X[l + offset][n]) = 0; - } - } -#else - - // Reordering of data moved from DCT_IV to here - in_imag[31] = u[1]; - in_real[0] = u[0]; - for (n = 1; n < 31; n++) - { - in_imag[31 - n] = u[n+1]; - in_real[n] = -u[64-n]; - } - in_imag[0] = u[32]; - in_real[31] = -u[33]; - - // dct4_kernel is DCT_IV without reordering which is done before and after FFT - dct4_kernel(in_real, in_imag, out_real, out_imag); - - // Reordering of data moved from DCT_IV to here - for (n = 0; n < 16; n++) { - if (2*n+1 < kx) { -#ifdef FIXED_POINT - QMF_RE(X[l + offset][2*n]) = out_real[n]; - QMF_IM(X[l + offset][2*n]) = out_imag[n]; - QMF_RE(X[l + offset][2*n+1]) = -out_imag[31-n]; - QMF_IM(X[l + offset][2*n+1]) = -out_real[31-n]; -#else - QMF_RE(X[l + offset][2*n]) = 2. * out_real[n]; - QMF_IM(X[l + offset][2*n]) = 2. * out_imag[n]; - QMF_RE(X[l + offset][2*n+1]) = -2. * out_imag[31-n]; - QMF_IM(X[l + offset][2*n+1]) = -2. * out_real[31-n]; -#endif - } else { - if (2*n < kx) { -#ifdef FIXED_POINT - QMF_RE(X[l + offset][2*n]) = out_real[n]; - QMF_IM(X[l + offset][2*n]) = out_imag[n]; -#else - QMF_RE(X[l + offset][2*n]) = 2. * out_real[n]; - QMF_IM(X[l + offset][2*n]) = 2. * out_imag[n]; -#endif - } - else { - QMF_RE(X[l + offset][2*n]) = 0; - QMF_IM(X[l + offset][2*n]) = 0; - } - QMF_RE(X[l + offset][2*n+1]) = 0; - QMF_IM(X[l + offset][2*n+1]) = 0; - } - } -#endif - } -} - -static const complex_t qmf32_pre_twiddle[] = -{ - { FRAC_CONST(0.999924701839145), FRAC_CONST(-0.012271538285720) }, - { FRAC_CONST(0.999322384588350), FRAC_CONST(-0.036807222941359) }, - { FRAC_CONST(0.998118112900149), FRAC_CONST(-0.061320736302209) }, - { FRAC_CONST(0.996312612182778), FRAC_CONST(-0.085797312344440) }, - { FRAC_CONST(0.993906970002356), FRAC_CONST(-0.110222207293883) }, - { FRAC_CONST(0.990902635427780), FRAC_CONST(-0.134580708507126) }, - { FRAC_CONST(0.987301418157858), FRAC_CONST(-0.158858143333861) }, - { FRAC_CONST(0.983105487431216), FRAC_CONST(-0.183039887955141) }, - { FRAC_CONST(0.978317370719628), FRAC_CONST(-0.207111376192219) }, - { FRAC_CONST(0.972939952205560), FRAC_CONST(-0.231058108280671) }, - { FRAC_CONST(0.966976471044852), FRAC_CONST(-0.254865659604515) }, - { FRAC_CONST(0.960430519415566), FRAC_CONST(-0.278519689385053) }, - { FRAC_CONST(0.953306040354194), FRAC_CONST(-0.302005949319228) }, - { FRAC_CONST(0.945607325380521), FRAC_CONST(-0.325310292162263) }, - { FRAC_CONST(0.937339011912575), FRAC_CONST(-0.348418680249435) }, - { FRAC_CONST(0.928506080473216), FRAC_CONST(-0.371317193951838) }, - { FRAC_CONST(0.919113851690058), FRAC_CONST(-0.393992040061048) }, - { FRAC_CONST(0.909167983090522), FRAC_CONST(-0.416429560097637) }, - { FRAC_CONST(0.898674465693954), FRAC_CONST(-0.438616238538528) }, - { FRAC_CONST(0.887639620402854), FRAC_CONST(-0.460538710958240) }, - { FRAC_CONST(0.876070094195407), FRAC_CONST(-0.482183772079123) }, - { FRAC_CONST(0.863972856121587), FRAC_CONST(-0.503538383725718) }, - { FRAC_CONST(0.851355193105265), FRAC_CONST(-0.524589682678469) }, - { FRAC_CONST(0.838224705554838), FRAC_CONST(-0.545324988422046) }, - { FRAC_CONST(0.824589302785025), FRAC_CONST(-0.565731810783613) }, - { FRAC_CONST(0.810457198252595), FRAC_CONST(-0.585797857456439) }, - { FRAC_CONST(0.795836904608884), FRAC_CONST(-0.605511041404326) }, - { FRAC_CONST(0.780737228572094), FRAC_CONST(-0.624859488142386) }, - { FRAC_CONST(0.765167265622459), FRAC_CONST(-0.643831542889791) }, - { FRAC_CONST(0.749136394523459), FRAC_CONST(-0.662415777590172) }, - { FRAC_CONST(0.732654271672413), FRAC_CONST(-0.680600997795453) }, - { FRAC_CONST(0.715730825283819), FRAC_CONST(-0.698376249408973) } -}; - -qmfs_info *qmfs_init(uint8_t channels) -{ - qmfs_info *qmfs = (qmfs_info*)faad_malloc(sizeof(qmfs_info)); - - /* v is a double ringbuffer */ - qmfs->v = (real_t*)faad_malloc(2 * channels * 20 * sizeof(real_t)); - memset(qmfs->v, 0, 2 * channels * 20 * sizeof(real_t)); - - qmfs->v_index = 0; - - qmfs->channels = channels; - - return qmfs; -} - -void qmfs_end(qmfs_info *qmfs) -{ - if (qmfs) - { - if (qmfs->v) faad_free(qmfs->v); - faad_free(qmfs); - } -} - -#ifdef SBR_LOW_POWER - -void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], - real_t *output) -{ - ALIGN real_t x[16]; - ALIGN real_t y[16]; - int16_t n, k, out = 0; - uint8_t l; - - /* qmf subsample l */ - for (l = 0; l < sbr->numTimeSlotsRate; l++) - { - /* shift buffers */ - /* we are not shifting v, it is a double ringbuffer */ - //memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t)); - - /* calculate 64 samples */ - for (k = 0; k < 16; k++) - { -#ifdef FIXED_POINT - y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k])); - x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][31 - k])); -#else - y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k])) / 32.0; - x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][31 - k])) / 32.0; -#endif - } - - /* even n samples */ - DCT2_16_unscaled(x, x); - /* odd n samples */ - DCT4_16(y, y); - - for (n = 8; n < 24; n++) - { - qmfs->v[qmfs->v_index + n*2] = qmfs->v[qmfs->v_index + 640 + n*2] = x[n-8]; - qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 640 + n*2+1] = y[n-8]; - } - for (n = 0; n < 16; n++) - { - qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 640 + n] = qmfs->v[qmfs->v_index + 32-n]; - } - qmfs->v[qmfs->v_index + 48] = qmfs->v[qmfs->v_index + 640 + 48] = 0; - for (n = 1; n < 16; n++) - { - qmfs->v[qmfs->v_index + 48+n] = qmfs->v[qmfs->v_index + 640 + 48+n] = -qmfs->v[qmfs->v_index + 48-n]; - } - - /* calculate 32 output samples and window */ - for (k = 0; k < 32; k++) - { - output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]); - } - - /* update the ringbuffer index */ - qmfs->v_index -= 64; - if (qmfs->v_index < 0) - qmfs->v_index = (640-64); - } -} - -void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], - real_t *output) -{ - ALIGN real_t x[64]; - ALIGN real_t y[64]; - int16_t n, k, out = 0; - uint8_t l; - - - /* qmf subsample l */ - for (l = 0; l < sbr->numTimeSlotsRate; l++) - { - /* shift buffers */ - /* we are not shifting v, it is a double ringbuffer */ - //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t)); - - /* calculate 128 samples */ - for (k = 0; k < 32; k++) - { -#ifdef FIXED_POINT - y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k])); - x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k])); -#else - y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k])) / 32.0; - x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k])) / 32.0; -#endif - } - - /* even n samples */ - DCT2_32_unscaled(x, x); - /* odd n samples */ - DCT4_32(y, y); - - for (n = 16; n < 48; n++) - { - qmfs->v[qmfs->v_index + n*2] = qmfs->v[qmfs->v_index + 1280 + n*2] = x[n-16]; - qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 1280 + n*2+1] = y[n-16]; - } - for (n = 0; n < 32; n++) - { - qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 1280 + n] = qmfs->v[qmfs->v_index + 64-n]; - } - qmfs->v[qmfs->v_index + 96] = qmfs->v[qmfs->v_index + 1280 + 96] = 0; - for (n = 1; n < 32; n++) - { - qmfs->v[qmfs->v_index + 96+n] = qmfs->v[qmfs->v_index + 1280 + 96+n] = -qmfs->v[qmfs->v_index + 96-n]; - } - - /* calculate 64 output samples and window */ - for (k = 0; k < 64; k++) - { - output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[k]) + - MUL_F(qmfs->v[qmfs->v_index + 192 + k], qmf_c[64 + k]) + - MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[128 + k]) + - MUL_F(qmfs->v[qmfs->v_index + 256 + 192 + k], qmf_c[128 + 64 + k]) + - MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[256 + k]) + - MUL_F(qmfs->v[qmfs->v_index + 512 + 192 + k], qmf_c[256 + 64 + k]) + - MUL_F(qmfs->v[qmfs->v_index + 768 + k], qmf_c[384 + k]) + - MUL_F(qmfs->v[qmfs->v_index + 768 + 192 + k], qmf_c[384 + 64 + k]) + - MUL_F(qmfs->v[qmfs->v_index + 1024 + k], qmf_c[512 + k]) + - MUL_F(qmfs->v[qmfs->v_index + 1024 + 192 + k], qmf_c[512 + 64 + k]); - } - - /* update the ringbuffer index */ - qmfs->v_index -= 128; - if (qmfs->v_index < 0) - qmfs->v_index = (1280-128); - } -} -#else -void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], - real_t *output) -{ - ALIGN real_t x1[32], x2[32]; -#ifndef FIXED_POINT - real_t scale = 1.f/64.f; -#endif - int16_t n, k, out = 0; - uint8_t l; - - - /* qmf subsample l */ - for (l = 0; l < sbr->numTimeSlotsRate; l++) - { - /* shift buffer v */ - /* buffer is not shifted, we are using a ringbuffer */ - //memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t)); - - /* calculate 64 samples */ - /* complex pre-twiddle */ - for (k = 0; k < 32; k++) - { - x1[k] = MUL_F(QMF_RE(X[l][k]), RE(qmf32_pre_twiddle[k])) - MUL_F(QMF_IM(X[l][k]), IM(qmf32_pre_twiddle[k])); - x2[k] = MUL_F(QMF_IM(X[l][k]), RE(qmf32_pre_twiddle[k])) + MUL_F(QMF_RE(X[l][k]), IM(qmf32_pre_twiddle[k])); - -#ifndef FIXED_POINT - x1[k] *= scale; - x2[k] *= scale; -#else - x1[k] >>= 1; - x2[k] >>= 1; -#endif - } - - /* transform */ - DCT4_32(x1, x1); - DST4_32(x2, x2); - - for (n = 0; n < 32; n++) - { - qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 640 + n] = -x1[n] + x2[n]; - qmfs->v[qmfs->v_index + 63 - n] = qmfs->v[qmfs->v_index + 640 + 63 - n] = x1[n] + x2[n]; - } - - /* calculate 32 output samples and window */ - for (k = 0; k < 32; k++) - { - output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) + - MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]); - } - - /* update ringbuffer index */ - qmfs->v_index -= 64; - if (qmfs->v_index < 0) - qmfs->v_index = (640 - 64); - } -} - -void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], - real_t *output) -{ -// ALIGN real_t x1[64], x2[64]; -#ifndef SBR_LOW_POWER - ALIGN real_t in_real1[32], in_imag1[32], out_real1[32], out_imag1[32]; - ALIGN real_t in_real2[32], in_imag2[32], out_real2[32], out_imag2[32]; -#endif - qmf_t * pX; - real_t * pring_buffer_1, * pring_buffer_3; -// real_t * ptemp_1, * ptemp_2; -#ifdef PREFER_POINTERS - // These pointers are used if target platform has autoinc address generators - real_t * pring_buffer_2, * pring_buffer_4; - real_t * pring_buffer_5, * pring_buffer_6; - real_t * pring_buffer_7, * pring_buffer_8; - real_t * pring_buffer_9, * pring_buffer_10; - const real_t * pqmf_c_1, * pqmf_c_2, * pqmf_c_3, * pqmf_c_4; - const real_t * pqmf_c_5, * pqmf_c_6, * pqmf_c_7, * pqmf_c_8; - const real_t * pqmf_c_9, * pqmf_c_10; -#endif // #ifdef PREFER_POINTERS -#ifndef FIXED_POINT - real_t scale = 1.f/64.f; -#endif - int16_t n, k, out = 0; - uint8_t l; - - - /* qmf subsample l */ - for (l = 0; l < sbr->numTimeSlotsRate; l++) - { - /* shift buffer v */ - /* buffer is not shifted, we use double ringbuffer */ - //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t)); - - /* calculate 128 samples */ -#ifndef FIXED_POINT - - pX = X[l]; - - in_imag1[31] = scale*QMF_RE(pX[1]); - in_real1[0] = scale*QMF_RE(pX[0]); - in_imag2[31] = scale*QMF_IM(pX[63-1]); - in_real2[0] = scale*QMF_IM(pX[63-0]); - for (k = 1; k < 31; k++) - { - in_imag1[31 - k] = scale*QMF_RE(pX[2*k + 1]); - in_real1[ k] = scale*QMF_RE(pX[2*k ]); - in_imag2[31 - k] = scale*QMF_IM(pX[63 - (2*k + 1)]); - in_real2[ k] = scale*QMF_IM(pX[63 - (2*k )]); - } - in_imag1[0] = scale*QMF_RE(pX[63]); - in_real1[31] = scale*QMF_RE(pX[62]); - in_imag2[0] = scale*QMF_IM(pX[63-63]); - in_real2[31] = scale*QMF_IM(pX[63-62]); - -#else - - pX = X[l]; - - in_imag1[31] = QMF_RE(pX[1]) >> 1; - in_real1[0] = QMF_RE(pX[0]) >> 1; - in_imag2[31] = QMF_IM(pX[62]) >> 1; - in_real2[0] = QMF_IM(pX[63]) >> 1; - for (k = 1; k < 31; k++) - { - in_imag1[31 - k] = QMF_RE(pX[2*k + 1]) >> 1; - in_real1[ k] = QMF_RE(pX[2*k ]) >> 1; - in_imag2[31 - k] = QMF_IM(pX[63 - (2*k + 1)]) >> 1; - in_real2[ k] = QMF_IM(pX[63 - (2*k )]) >> 1; - } - in_imag1[0] = QMF_RE(pX[63]) >> 1; - in_real1[31] = QMF_RE(pX[62]) >> 1; - in_imag2[0] = QMF_IM(pX[0]) >> 1; - in_real2[31] = QMF_IM(pX[1]) >> 1; - -#endif - - - // dct4_kernel is DCT_IV without reordering which is done before and after FFT - dct4_kernel(in_real1, in_imag1, out_real1, out_imag1); - dct4_kernel(in_real2, in_imag2, out_real2, out_imag2); - - - pring_buffer_1 = qmfs->v + qmfs->v_index; - pring_buffer_3 = pring_buffer_1 + 1280; -#ifdef PREFER_POINTERS - pring_buffer_2 = pring_buffer_1 + 127; - pring_buffer_4 = pring_buffer_1 + (1280 + 127); -#endif // #ifdef PREFER_POINTERS -// ptemp_1 = x1; -// ptemp_2 = x2; -#ifdef PREFER_POINTERS - for (n = 0; n < 32; n ++) - { - //real_t x1 = *ptemp_1++; - //real_t x2 = *ptemp_2++; - // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer - *pring_buffer_1++ = *pring_buffer_3++ = out_real2[n] - out_real1[n]; - *pring_buffer_2-- = *pring_buffer_4-- = out_real2[n] + out_real1[n]; - //x1 = *ptemp_1++; - //x2 = *ptemp_2++; - *pring_buffer_1++ = *pring_buffer_3++ = out_imag2[31-n] + out_imag1[31-n]; - *pring_buffer_2-- = *pring_buffer_4-- = out_imag2[31-n] - out_imag1[31-n]; - } -#else // #ifdef PREFER_POINTERS - - for (n = 0; n < 32; n++) - { - // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer - pring_buffer_1[2*n] = pring_buffer_3[2*n] = out_real2[n] - out_real1[n]; - pring_buffer_1[127-2*n] = pring_buffer_3[127-2*n] = out_real2[n] + out_real1[n]; - pring_buffer_1[2*n+1] = pring_buffer_3[2*n+1] = out_imag2[31-n] + out_imag1[31-n]; - pring_buffer_1[127-(2*n+1)] = pring_buffer_3[127-(2*n+1)] = out_imag2[31-n] - out_imag1[31-n]; - } - -#endif // #ifdef PREFER_POINTERS - - pring_buffer_1 = qmfs->v + qmfs->v_index; -#ifdef PREFER_POINTERS - pring_buffer_2 = pring_buffer_1 + 192; - pring_buffer_3 = pring_buffer_1 + 256; - pring_buffer_4 = pring_buffer_1 + (256 + 192); - pring_buffer_5 = pring_buffer_1 + 512; - pring_buffer_6 = pring_buffer_1 + (512 + 192); - pring_buffer_7 = pring_buffer_1 + 768; - pring_buffer_8 = pring_buffer_1 + (768 + 192); - pring_buffer_9 = pring_buffer_1 + 1024; - pring_buffer_10 = pring_buffer_1 + (1024 + 192); - pqmf_c_1 = qmf_c; - pqmf_c_2 = qmf_c + 64; - pqmf_c_3 = qmf_c + 128; - pqmf_c_4 = qmf_c + 192; - pqmf_c_5 = qmf_c + 256; - pqmf_c_6 = qmf_c + 320; - pqmf_c_7 = qmf_c + 384; - pqmf_c_8 = qmf_c + 448; - pqmf_c_9 = qmf_c + 512; - pqmf_c_10 = qmf_c + 576; -#endif // #ifdef PREFER_POINTERS - - /* calculate 64 output samples and window */ - for (k = 0; k < 64; k++) - { -#ifdef PREFER_POINTERS - output[out++] = - MUL_F(*pring_buffer_1++, *pqmf_c_1++) + - MUL_F(*pring_buffer_2++, *pqmf_c_2++) + - MUL_F(*pring_buffer_3++, *pqmf_c_3++) + - MUL_F(*pring_buffer_4++, *pqmf_c_4++) + - MUL_F(*pring_buffer_5++, *pqmf_c_5++) + - MUL_F(*pring_buffer_6++, *pqmf_c_6++) + - MUL_F(*pring_buffer_7++, *pqmf_c_7++) + - MUL_F(*pring_buffer_8++, *pqmf_c_8++) + - MUL_F(*pring_buffer_9++, *pqmf_c_9++) + - MUL_F(*pring_buffer_10++, *pqmf_c_10++); -#else // #ifdef PREFER_POINTERS - output[out++] = - MUL_F(pring_buffer_1[k+0], qmf_c[k+0]) + - MUL_F(pring_buffer_1[k+192], qmf_c[k+64]) + - MUL_F(pring_buffer_1[k+256], qmf_c[k+128]) + - MUL_F(pring_buffer_1[k+(256+192)], qmf_c[k+192]) + - MUL_F(pring_buffer_1[k+512], qmf_c[k+256]) + - MUL_F(pring_buffer_1[k+(512+192)], qmf_c[k+320]) + - MUL_F(pring_buffer_1[k+768], qmf_c[k+384]) + - MUL_F(pring_buffer_1[k+(768+192)], qmf_c[k+448]) + - MUL_F(pring_buffer_1[k+1024], qmf_c[k+512]) + - MUL_F(pring_buffer_1[k+(1024+192)], qmf_c[k+576]); -#endif // #ifdef PREFER_POINTERS - } - - /* update ringbuffer index */ - qmfs->v_index -= 128; - if (qmfs->v_index < 0) - qmfs->v_index = (1280 - 128); - } -} -#endif - -#endif diff --git a/mplayer/libfaad2/sbr_qmf.h b/mplayer/libfaad2/sbr_qmf.h deleted file mode 100644 index 7c8b7b70..00000000 --- a/mplayer/libfaad2/sbr_qmf.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_qmf.h,v 1.21 2004/09/08 09:43:11 gcp Exp $ -**/ - -#ifndef __SBR_QMF_H__ -#define __SBR_QMF_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -qmfa_info *qmfa_init(uint8_t channels); -void qmfa_end(qmfa_info *qmfa); -qmfs_info *qmfs_init(uint8_t channels); -void qmfs_end(qmfs_info *qmfs); - -void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input, - qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx); -void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], - real_t *output); -void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], - real_t *output); - - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/mplayer/libfaad2/sbr_qmf_c.h b/mplayer/libfaad2/sbr_qmf_c.h deleted file mode 100644 index 66437ee9..00000000 --- a/mplayer/libfaad2/sbr_qmf_c.h +++ /dev/null @@ -1,365 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_qmf_c.h,v 1.13 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __SBR_QMF_C_H__ -#define __SBR_QMF_C_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef _MSC_VER -#pragma warning(disable:4305) -#pragma warning(disable:4244) -#endif - -ALIGN static const real_t qmf_c[640] = { - FRAC_CONST(0), FRAC_CONST(-0.00055252865047), - FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00049475180896), - FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00048937912498), - FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00052265642972), - FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00056778025613), - FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00061327473938), - FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00065403333621), - FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00069416146273), - FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00072550431222), - FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00074905980532), - FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00077248485949), - FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077798694927), - FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00078014496257), - FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00076307935757), - FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00073193571525), - FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00069179375372), - FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00063415949025), - FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00055645763906), - FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00046063254803), - FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00035011758756), - FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.0002098337344), - FRAC_CONST(-0.00014463809349), FRAC_CONST(-6.173344072E-005), - FRAC_CONST(1.349497418E-005), FRAC_CONST(0.00010943831274), - FRAC_CONST(0.00020430170688), FRAC_CONST(0.00029495311041), - FRAC_CONST(0.0004026540216), FRAC_CONST(0.00051073884952), - FRAC_CONST(0.00062393761391), FRAC_CONST(0.00074580258865), - FRAC_CONST(0.00086084433262), FRAC_CONST(0.00098859883015), - FRAC_CONST(0.00112501551307), FRAC_CONST(0.00125778846475), - FRAC_CONST(0.00139024948272), FRAC_CONST(0.00154432198471), - FRAC_CONST(0.00168680832531), FRAC_CONST(0.00183482654224), - FRAC_CONST(0.00198411407369), FRAC_CONST(0.00214615835557), - FRAC_CONST(0.00230172547746), FRAC_CONST(0.00246256169126), - FRAC_CONST(0.00262017586902), FRAC_CONST(0.00278704643465), - FRAC_CONST(0.00294694477165), FRAC_CONST(0.00311254206525), - FRAC_CONST(0.00327396134847), FRAC_CONST(0.00344188741828), - FRAC_CONST(0.00360082681231), FRAC_CONST(0.00376039229104), - FRAC_CONST(0.00392074323703), FRAC_CONST(0.00408197531935), - FRAC_CONST(0.0042264269227), FRAC_CONST(0.00437307196781), - FRAC_CONST(0.00452098527825), FRAC_CONST(0.00466064606118), - FRAC_CONST(0.00479325608498), FRAC_CONST(0.00491376035745), - FRAC_CONST(0.00503930226013), FRAC_CONST(0.00514073539032), - FRAC_CONST(0.00524611661324), FRAC_CONST(0.00534716811982), - FRAC_CONST(0.00541967759307), FRAC_CONST(0.00548760401507), - FRAC_CONST(0.00554757145088), FRAC_CONST(0.00559380230045), - FRAC_CONST(0.00562206432097), FRAC_CONST(0.00564551969164), - FRAC_CONST(0.00563891995151), FRAC_CONST(0.00562661141932), - FRAC_CONST(0.0055917128663), FRAC_CONST(0.005540436394), - FRAC_CONST(0.0054753783077), FRAC_CONST(0.0053838975897), - FRAC_CONST(0.00527157587272), FRAC_CONST(0.00513822754514), - FRAC_CONST(0.00498396877629), FRAC_CONST(0.004810946906), - FRAC_CONST(0.00460395301471), FRAC_CONST(0.00438018617447), - FRAC_CONST(0.0041251642327), FRAC_CONST(0.00384564081246), - FRAC_CONST(0.00354012465507), FRAC_CONST(0.00320918858098), - FRAC_CONST(0.00284467578623), FRAC_CONST(0.00245085400321), - FRAC_CONST(0.0020274176185), FRAC_CONST(0.00157846825768), - FRAC_CONST(0.00109023290512), FRAC_CONST(0.0005832264248), - FRAC_CONST(2.760451905E-005), FRAC_CONST(-0.00054642808664), - FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00180394725893), - FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.003193377839), - FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.004722259624), - FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.00637922932685), - FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00817982333726), - FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.01011502154986), - FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01218499959508), - FRAC_CONST(0.01327182200351), FRAC_CONST(0.01439046660792), - FRAC_CONST(0.01554055533423), FRAC_CONST(0.01673247129989), - FRAC_CONST(0.01794333813443), FRAC_CONST(0.01918724313698), - FRAC_CONST(0.02045317933555), FRAC_CONST(0.02174675502535), - FRAC_CONST(0.02306801692862), FRAC_CONST(0.02441609920285), - FRAC_CONST(0.02578758475467), FRAC_CONST(0.02718594296329), - FRAC_CONST(0.02860721736385), FRAC_CONST(0.03005026574279), - FRAC_CONST(0.03150176087389), FRAC_CONST(0.03297540810337), - FRAC_CONST(0.03446209487686), FRAC_CONST(0.03596975605542), - FRAC_CONST(0.03748128504252), FRAC_CONST(0.03900536794745), - FRAC_CONST(0.04053491705584), FRAC_CONST(0.04206490946367), - FRAC_CONST(0.04360975421304), FRAC_CONST(0.04514884056413), - FRAC_CONST(0.04668430272642), FRAC_CONST(0.04821657200672), - FRAC_CONST(0.04973857556014), FRAC_CONST(0.05125561555216), - FRAC_CONST(0.05276307465207), FRAC_CONST(0.05424527683589), - FRAC_CONST(0.05571736482138), FRAC_CONST(0.05716164501299), - FRAC_CONST(0.0585915683626), FRAC_CONST(0.05998374801761), - FRAC_CONST(0.06134551717207), FRAC_CONST(0.06268578081172), - FRAC_CONST(0.06397158980681), FRAC_CONST(0.0652247106438), - FRAC_CONST(0.06643675122104), FRAC_CONST(0.06760759851228), - FRAC_CONST(0.06870438283512), FRAC_CONST(0.06976302447127), - FRAC_CONST(0.07076287107266), FRAC_CONST(0.07170026731102), - FRAC_CONST(0.07256825833083), FRAC_CONST(0.07336202550803), - FRAC_CONST(0.07410036424342), FRAC_CONST(0.07474525581194), - FRAC_CONST(0.07531373362019), FRAC_CONST(0.07580083586584), - FRAC_CONST(0.07619924793396), FRAC_CONST(0.07649921704119), - FRAC_CONST(0.07670934904245), FRAC_CONST(0.07681739756964), - FRAC_CONST(0.07682300113923), FRAC_CONST(0.07672049241746), - FRAC_CONST(0.07650507183194), FRAC_CONST(0.07617483218536), - FRAC_CONST(0.07573057565061), FRAC_CONST(0.0751576255287), - FRAC_CONST(0.07446643947564), FRAC_CONST(0.0736406005762), - FRAC_CONST(0.07267746427299), FRAC_CONST(0.07158263647903), - FRAC_CONST(0.07035330735093), FRAC_CONST(0.06896640131951), - FRAC_CONST(0.06745250215166), FRAC_CONST(0.06576906686508), - FRAC_CONST(0.06394448059633), FRAC_CONST(0.06196027790387), - FRAC_CONST(0.0598166570809), FRAC_CONST(0.05751526919867), - FRAC_CONST(0.05504600343009), FRAC_CONST(0.05240938217366), - FRAC_CONST(0.04959786763445), FRAC_CONST(0.04663033051701), - FRAC_CONST(0.04347687821958), FRAC_CONST(0.04014582784127), - FRAC_CONST(0.03664181168133), FRAC_CONST(0.03295839306691), - FRAC_CONST(0.02908240060125), FRAC_CONST(0.02503075618909), - FRAC_CONST(0.02079970728622), FRAC_CONST(0.01637012582228), - FRAC_CONST(0.01176238327857), FRAC_CONST(0.00696368621617), - FRAC_CONST(0.00197656014503), FRAC_CONST(-0.00320868968304), - FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.01412888273558), - FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.02582272888064), - FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.03827765720822), - FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.05148041767934), - FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.06544098531359), - FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.08013729344279), - FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.09555333528914), - FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.1116826931773), - FRAC_CONST(-0.120007798468), FRAC_CONST(-0.12850028503878), - FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.1459766491187), - FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.16409588556669), - FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.18281725485142), - FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.20212501768103), - FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.22196526964149), - FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.24230168845974), - FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.26310532994603), - FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.28432141891085), - FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.30590985751916), - FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.32781137272105), - FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.3499914122931), - FRAC_CONST(0.36115899031355), FRAC_CONST(0.37237955463061), - FRAC_CONST(0.38363500139043), FRAC_CONST(0.39492117615675), - FRAC_CONST(0.40623176767625), FRAC_CONST(0.41756968968409), - FRAC_CONST(0.42891199207373), FRAC_CONST(0.44025537543665), - FRAC_CONST(0.45159965356824), FRAC_CONST(0.46293080852757), - FRAC_CONST(0.47424532146115), FRAC_CONST(0.48552530911099), - FRAC_CONST(0.49677082545707), FRAC_CONST(0.50798175000434), - FRAC_CONST(0.51912349702391), FRAC_CONST(0.53022408956855), - FRAC_CONST(0.54125534487322), FRAC_CONST(0.55220512585061), - FRAC_CONST(0.5630789140137), FRAC_CONST(0.57385241316923), - FRAC_CONST(0.58454032354679), FRAC_CONST(0.59511230862496), - FRAC_CONST(0.6055783538918), FRAC_CONST(0.61591099320291), - FRAC_CONST(0.62612426956055), FRAC_CONST(0.63619801077286), - FRAC_CONST(0.64612696959461), FRAC_CONST(0.65590163024671), - FRAC_CONST(0.66551398801627), FRAC_CONST(0.67496631901712), - FRAC_CONST(0.68423532934598), FRAC_CONST(0.69332823767032), - FRAC_CONST(0.70223887193539), FRAC_CONST(0.71094104263095), - FRAC_CONST(0.71944626349561), FRAC_CONST(0.72774489002994), - FRAC_CONST(0.73582117582769), FRAC_CONST(0.74368278636488), - FRAC_CONST(0.75131374561237), FRAC_CONST(0.75870807608242), - FRAC_CONST(0.76586748650939), FRAC_CONST(0.77277808813327), - FRAC_CONST(0.77942875190216), FRAC_CONST(0.7858353120392), - FRAC_CONST(0.79197358416424), FRAC_CONST(0.797846641377), - FRAC_CONST(0.80344857518505), FRAC_CONST(0.80876950044491), - FRAC_CONST(0.81381912706217), FRAC_CONST(0.81857760046468), - FRAC_CONST(0.82304198905409), FRAC_CONST(0.8272275347336), - FRAC_CONST(0.8311038457152), FRAC_CONST(0.83469373618402), - FRAC_CONST(0.83797173378865), FRAC_CONST(0.84095413924722), - FRAC_CONST(0.84362382812005), FRAC_CONST(0.84598184698206), - FRAC_CONST(0.84803157770763), FRAC_CONST(0.84978051984268), - FRAC_CONST(0.85119715249343), FRAC_CONST(0.85230470352147), - FRAC_CONST(0.85310209497017), FRAC_CONST(0.85357205739107), - FRAC_CONST(0.85373856005937 /*max*/), FRAC_CONST(0.85357205739107), - FRAC_CONST(0.85310209497017), FRAC_CONST(0.85230470352147), - FRAC_CONST(0.85119715249343), FRAC_CONST(0.84978051984268), - FRAC_CONST(0.84803157770763), FRAC_CONST(0.84598184698206), - FRAC_CONST(0.84362382812005), FRAC_CONST(0.84095413924722), - FRAC_CONST(0.83797173378865), FRAC_CONST(0.83469373618402), - FRAC_CONST(0.8311038457152), FRAC_CONST(0.8272275347336), - FRAC_CONST(0.82304198905409), FRAC_CONST(0.81857760046468), - FRAC_CONST(0.81381912706217), FRAC_CONST(0.80876950044491), - FRAC_CONST(0.80344857518505), FRAC_CONST(0.797846641377), - FRAC_CONST(0.79197358416424), FRAC_CONST(0.7858353120392), - FRAC_CONST(0.77942875190216), FRAC_CONST(0.77277808813327), - FRAC_CONST(0.76586748650939), FRAC_CONST(0.75870807608242), - FRAC_CONST(0.75131374561237), FRAC_CONST(0.74368278636488), - FRAC_CONST(0.73582117582769), FRAC_CONST(0.72774489002994), - FRAC_CONST(0.71944626349561), FRAC_CONST(0.71094104263095), - FRAC_CONST(0.70223887193539), FRAC_CONST(0.69332823767032), - FRAC_CONST(0.68423532934598), FRAC_CONST(0.67496631901712), - FRAC_CONST(0.66551398801627), FRAC_CONST(0.65590163024671), - FRAC_CONST(0.64612696959461), FRAC_CONST(0.63619801077286), - FRAC_CONST(0.62612426956055), FRAC_CONST(0.61591099320291), - FRAC_CONST(0.6055783538918), FRAC_CONST(0.59511230862496), - FRAC_CONST(0.58454032354679), FRAC_CONST(0.57385241316923), - FRAC_CONST(0.5630789140137), FRAC_CONST(0.55220512585061), - FRAC_CONST(0.54125534487322), FRAC_CONST(0.53022408956855), - FRAC_CONST(0.51912349702391), FRAC_CONST(0.50798175000434), - FRAC_CONST(0.49677082545707), FRAC_CONST(0.48552530911099), - FRAC_CONST(0.47424532146115), FRAC_CONST(0.46293080852757), - FRAC_CONST(0.45159965356824), FRAC_CONST(0.44025537543665), - FRAC_CONST(0.42891199207373), FRAC_CONST(0.41756968968409), - FRAC_CONST(0.40623176767625), FRAC_CONST(0.39492117615675), - FRAC_CONST(0.38363500139043), FRAC_CONST(0.37237955463061), - FRAC_CONST(-0.36115899031355), FRAC_CONST(-0.3499914122931), - FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.32781137272105), - FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.30590985751916), - FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.28432141891085), - FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.26310532994603), - FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.24230168845974), - FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.22196526964149), - FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.20212501768103), - FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.18281725485142), - FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.16409588556669), - FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.1459766491187), - FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.12850028503878), - FRAC_CONST(-0.120007798468), FRAC_CONST(-0.1116826931773), - FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.09555333528914), - FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.08013729344279), - FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.06544098531359), - FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.05148041767934), - FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.03827765720822), - FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.02582272888064), - FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.01412888273558), - FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.00320868968304), - FRAC_CONST(0.00197656014503), FRAC_CONST(0.00696368621617), - FRAC_CONST(0.01176238327857), FRAC_CONST(0.01637012582228), - FRAC_CONST(0.02079970728622), FRAC_CONST(0.02503075618909), - FRAC_CONST(0.02908240060125), FRAC_CONST(0.03295839306691), - FRAC_CONST(0.03664181168133), FRAC_CONST(0.04014582784127), - FRAC_CONST(0.04347687821958), FRAC_CONST(0.04663033051701), - FRAC_CONST(0.04959786763445), FRAC_CONST(0.05240938217366), - FRAC_CONST(0.05504600343009), FRAC_CONST(0.05751526919867), - FRAC_CONST(0.0598166570809), FRAC_CONST(0.06196027790387), - FRAC_CONST(0.06394448059633), FRAC_CONST(0.06576906686508), - FRAC_CONST(0.06745250215166), FRAC_CONST(0.06896640131951), - FRAC_CONST(0.07035330735093), FRAC_CONST(0.07158263647903), - FRAC_CONST(0.07267746427299), FRAC_CONST(0.0736406005762), - FRAC_CONST(0.07446643947564), FRAC_CONST(0.0751576255287), - FRAC_CONST(0.07573057565061), FRAC_CONST(0.07617483218536), - FRAC_CONST(0.07650507183194), FRAC_CONST(0.07672049241746), - FRAC_CONST(0.07682300113923), FRAC_CONST(0.07681739756964), - FRAC_CONST(0.07670934904245), FRAC_CONST(0.07649921704119), - FRAC_CONST(0.07619924793396), FRAC_CONST(0.07580083586584), - FRAC_CONST(0.07531373362019), FRAC_CONST(0.07474525581194), - FRAC_CONST(0.07410036424342), FRAC_CONST(0.07336202550803), - FRAC_CONST(0.07256825833083), FRAC_CONST(0.07170026731102), - FRAC_CONST(0.07076287107266), FRAC_CONST(0.06976302447127), - FRAC_CONST(0.06870438283512), FRAC_CONST(0.06760759851228), - FRAC_CONST(0.06643675122104), FRAC_CONST(0.0652247106438), - FRAC_CONST(0.06397158980681), FRAC_CONST(0.06268578081172), - FRAC_CONST(0.06134551717207), FRAC_CONST(0.05998374801761), - FRAC_CONST(0.0585915683626), FRAC_CONST(0.05716164501299), - FRAC_CONST(0.05571736482138), FRAC_CONST(0.05424527683589), - FRAC_CONST(0.05276307465207), FRAC_CONST(0.05125561555216), - FRAC_CONST(0.04973857556014), FRAC_CONST(0.04821657200672), - FRAC_CONST(0.04668430272642), FRAC_CONST(0.04514884056413), - FRAC_CONST(0.04360975421304), FRAC_CONST(0.04206490946367), - FRAC_CONST(0.04053491705584), FRAC_CONST(0.03900536794745), - FRAC_CONST(0.03748128504252), FRAC_CONST(0.03596975605542), - FRAC_CONST(0.03446209487686), FRAC_CONST(0.03297540810337), - FRAC_CONST(0.03150176087389), FRAC_CONST(0.03005026574279), - FRAC_CONST(0.02860721736385), FRAC_CONST(0.02718594296329), - FRAC_CONST(0.02578758475467), FRAC_CONST(0.02441609920285), - FRAC_CONST(0.02306801692862), FRAC_CONST(0.02174675502535), - FRAC_CONST(0.02045317933555), FRAC_CONST(0.01918724313698), - FRAC_CONST(0.01794333813443), FRAC_CONST(0.01673247129989), - FRAC_CONST(0.01554055533423), FRAC_CONST(0.01439046660792), - FRAC_CONST(-0.01327182200351), FRAC_CONST(-0.01218499959508), - FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01011502154986), - FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.00817982333726), - FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00637922932685), - FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.004722259624), - FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.003193377839), - FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.00180394725893), - FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00054642808664), - FRAC_CONST(2.760451905E-005), FRAC_CONST(0.0005832264248), - FRAC_CONST(0.00109023290512), FRAC_CONST(0.00157846825768), - FRAC_CONST(0.0020274176185), FRAC_CONST(0.00245085400321), - FRAC_CONST(0.00284467578623), FRAC_CONST(0.00320918858098), - FRAC_CONST(0.00354012465507), FRAC_CONST(0.00384564081246), - FRAC_CONST(0.0041251642327), FRAC_CONST(0.00438018617447), - FRAC_CONST(0.00460395301471), FRAC_CONST(0.004810946906), - FRAC_CONST(0.00498396877629), FRAC_CONST(0.00513822754514), - FRAC_CONST(0.00527157587272), FRAC_CONST(0.0053838975897), - FRAC_CONST(0.0054753783077), FRAC_CONST(0.005540436394), - FRAC_CONST(0.0055917128663), FRAC_CONST(0.00562661141932), - FRAC_CONST(0.00563891995151), FRAC_CONST(0.00564551969164), - FRAC_CONST(0.00562206432097), FRAC_CONST(0.00559380230045), - FRAC_CONST(0.00554757145088), FRAC_CONST(0.00548760401507), - FRAC_CONST(0.00541967759307), FRAC_CONST(0.00534716811982), - FRAC_CONST(0.00524611661324), FRAC_CONST(0.00514073539032), - FRAC_CONST(0.00503930226013), FRAC_CONST(0.00491376035745), - FRAC_CONST(0.00479325608498), FRAC_CONST(0.00466064606118), - FRAC_CONST(0.00452098527825), FRAC_CONST(0.00437307196781), - FRAC_CONST(0.0042264269227), FRAC_CONST(0.00408197531935), - FRAC_CONST(0.00392074323703), FRAC_CONST(0.00376039229104), - FRAC_CONST(0.00360082681231), FRAC_CONST(0.00344188741828), - FRAC_CONST(0.00327396134847), FRAC_CONST(0.00311254206525), - FRAC_CONST(0.00294694477165), FRAC_CONST(0.00278704643465), - FRAC_CONST(0.00262017586902), FRAC_CONST(0.00246256169126), - FRAC_CONST(0.00230172547746), FRAC_CONST(0.00214615835557), - FRAC_CONST(0.00198411407369), FRAC_CONST(0.00183482654224), - FRAC_CONST(0.00168680832531), FRAC_CONST(0.00154432198471), - FRAC_CONST(0.00139024948272), FRAC_CONST(0.00125778846475), - FRAC_CONST(0.00112501551307), FRAC_CONST(0.00098859883015), - FRAC_CONST(0.00086084433262), FRAC_CONST(0.00074580258865), - FRAC_CONST(0.00062393761391), FRAC_CONST(0.00051073884952), - FRAC_CONST(0.0004026540216), FRAC_CONST(0.00029495311041), - FRAC_CONST(0.00020430170688), FRAC_CONST(0.00010943831274), - FRAC_CONST(1.349497418E-005), FRAC_CONST(-6.173344072E-005), - FRAC_CONST(-0.00014463809349), FRAC_CONST(-0.0002098337344), - FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.00035011758756), - FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00046063254803), - FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00055645763906), - FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00063415949025), - FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00069179375372), - FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00073193571525), - FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00076307935757), - FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00078014496257), - FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00077798694927), - FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077248485949), - FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00074905980532), - FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00072550431222), - FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00069416146273), - FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00065403333621), - FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00061327473938), - FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00056778025613), - FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00052265642972), - FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00048937912498), - FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00049475180896), - FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00055252865047) -}; - -#endif - diff --git a/mplayer/libfaad2/sbr_syntax.c b/mplayer/libfaad2/sbr_syntax.c deleted file mode 100644 index 65f71623..00000000 --- a/mplayer/libfaad2/sbr_syntax.c +++ /dev/null @@ -1,871 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_syntax.c,v 1.34 2004/09/04 14:56:28 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#ifdef SBR_DEC - -#include "sbr_syntax.h" -#include "syntax.h" -#include "sbr_huff.h" -#include "sbr_fbt.h" -#include "sbr_tf_grid.h" -#include "sbr_e_nf.h" -#include "bits.h" -#ifdef PS_DEC -#include "ps_dec.h" -#endif -#ifdef DRM_PS -#include "drm_dec.h" -#endif -#include "analysis.h" - -/* static function declarations */ -static void sbr_header(bitfile *ld, sbr_info *sbr); -static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq, - uint8_t samplerate_mode, uint8_t freq_scale, - uint8_t alter_scale, uint8_t xover_band); -static uint8_t sbr_data(bitfile *ld, sbr_info *sbr); -static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr, - uint8_t bs_extension_id, uint16_t num_bits_left); -static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr); -static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr); -static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch); -static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch); -static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch); -static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch); - - -static void sbr_reset(sbr_info *sbr) -{ -#if 0 - printf("%d\n", sbr->bs_start_freq_prev); - printf("%d\n", sbr->bs_stop_freq_prev); - printf("%d\n", sbr->bs_freq_scale_prev); - printf("%d\n", sbr->bs_alter_scale_prev); - printf("%d\n", sbr->bs_xover_band_prev); - printf("%d\n\n", sbr->bs_noise_bands_prev); -#endif - - /* if these are different from the previous frame: Reset = 1 */ - if ((sbr->bs_start_freq != sbr->bs_start_freq_prev) || - (sbr->bs_stop_freq != sbr->bs_stop_freq_prev) || - (sbr->bs_freq_scale != sbr->bs_freq_scale_prev) || - (sbr->bs_alter_scale != sbr->bs_alter_scale_prev) || - (sbr->bs_xover_band != sbr->bs_xover_band_prev) || - (sbr->bs_noise_bands != sbr->bs_noise_bands_prev)) - { - sbr->Reset = 1; - } else { - sbr->Reset = 0; - } - - sbr->bs_start_freq_prev = sbr->bs_start_freq; - sbr->bs_stop_freq_prev = sbr->bs_stop_freq; - sbr->bs_freq_scale_prev = sbr->bs_freq_scale; - sbr->bs_alter_scale_prev = sbr->bs_alter_scale; - sbr->bs_xover_band_prev = sbr->bs_xover_band; - sbr->bs_noise_bands_prev = sbr->bs_noise_bands; -} - -static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq, - uint8_t samplerate_mode, uint8_t freq_scale, - uint8_t alter_scale, uint8_t xover_band) -{ - uint8_t result = 0; - uint8_t k2; - - /* calculate the Master Frequency Table */ - sbr->k0 = qmf_start_channel(start_freq, samplerate_mode, sbr->sample_rate); - k2 = qmf_stop_channel(stop_freq, sbr->sample_rate, sbr->k0); - - /* check k0 and k2 */ - if (sbr->sample_rate >= 48000) - { - if ((k2 - sbr->k0) > 32) - result += 1; - } else if (sbr->sample_rate <= 32000) { - if ((k2 - sbr->k0) > 48) - result += 1; - } else { /* (sbr->sample_rate == 44100) */ - if ((k2 - sbr->k0) > 45) - result += 1; - } - - if (freq_scale == 0) - { - result += master_frequency_table_fs0(sbr, sbr->k0, k2, alter_scale); - } else { - result += master_frequency_table(sbr, sbr->k0, k2, freq_scale, alter_scale); - } - result += derived_frequency_table(sbr, xover_band, k2); - - result = (result > 0) ? 1 : 0; - - return result; -} - -/* table 2 */ -uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt) -{ - uint8_t result = 0; - uint16_t num_align_bits = 0; - uint16_t num_sbr_bits = (uint16_t)faad_get_processed_bits(ld); - - uint8_t saved_start_freq, saved_samplerate_mode; - uint8_t saved_stop_freq, saved_freq_scale; - uint8_t saved_alter_scale, saved_xover_band; - -#ifdef DRM - if (!sbr->Is_DRM_SBR) -#endif - { - uint8_t bs_extension_type = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,198,"sbr_bitstream(): bs_extension_type")); - - if (bs_extension_type == EXT_SBR_DATA_CRC) - { - sbr->bs_sbr_crc_bits = (uint16_t)faad_getbits(ld, 10 - DEBUGVAR(1,199,"sbr_bitstream(): bs_sbr_crc_bits")); - } - } - - /* save old header values, in case the new ones are corrupted */ - saved_start_freq = sbr->bs_start_freq; - saved_samplerate_mode = sbr->bs_samplerate_mode; - saved_stop_freq = sbr->bs_stop_freq; - saved_freq_scale = sbr->bs_freq_scale; - saved_alter_scale = sbr->bs_alter_scale; - saved_xover_band = sbr->bs_xover_band; - - sbr->bs_header_flag = faad_get1bit(ld - DEBUGVAR(1,200,"sbr_bitstream(): bs_header_flag")); - - if (sbr->bs_header_flag) - sbr_header(ld, sbr); - - /* Reset? */ - sbr_reset(sbr); - - /* first frame should have a header */ - //if (!(sbr->frame == 0 && sbr->bs_header_flag == 0)) - if (sbr->header_count != 0) - { - if (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked)) - { - uint8_t rt = calc_sbr_tables(sbr, sbr->bs_start_freq, sbr->bs_stop_freq, - sbr->bs_samplerate_mode, sbr->bs_freq_scale, - sbr->bs_alter_scale, sbr->bs_xover_band); - - /* if an error occured with the new header values revert to the old ones */ - if (rt > 0) - { - calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq, - saved_samplerate_mode, saved_freq_scale, - saved_alter_scale, saved_xover_band); - } - } - - if (result == 0) - { - result = sbr_data(ld, sbr); - - /* sbr_data() returning an error means that there was an error in - envelope_time_border_vector(). - In this case the old time border vector is saved and all the previous - data normally read after sbr_grid() is saved. - */ - /* to be on the safe side, calculate old sbr tables in case of error */ - if ((result > 0) && - (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked))) - { - calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq, - saved_samplerate_mode, saved_freq_scale, - saved_alter_scale, saved_xover_band); - } - - /* we should be able to safely set result to 0 now */ - result = 0; - } - } else { - result = 1; - } - -#ifdef DRM - if (!sbr->Is_DRM_SBR) -#endif - { - num_sbr_bits = (uint16_t)faad_get_processed_bits(ld) - num_sbr_bits; - - /* check if we read more bits then were available for sbr */ - if (8*cnt < num_sbr_bits) - return 1; - - /* -4 does not apply, bs_extension_type is re-read in this function */ - num_align_bits = 8*cnt /*- 4*/ - num_sbr_bits; - - while (num_align_bits > 7) - { - faad_getbits(ld, 8 - DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits")); - num_align_bits -= 8; - } - faad_getbits(ld, num_align_bits - DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits")); - } - - return result; -} - -/* table 3 */ -static void sbr_header(bitfile *ld, sbr_info *sbr) -{ - uint8_t bs_header_extra_1, bs_header_extra_2; - - sbr->header_count++; - - sbr->bs_amp_res = faad_get1bit(ld - DEBUGVAR(1,203,"sbr_header(): bs_amp_res")); - - /* bs_start_freq and bs_stop_freq must define a fequency band that does - not exceed 48 channels */ - sbr->bs_start_freq = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,204,"sbr_header(): bs_start_freq")); - sbr->bs_stop_freq = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,205,"sbr_header(): bs_stop_freq")); - sbr->bs_xover_band = (uint8_t)faad_getbits(ld, 3 - DEBUGVAR(1,206,"sbr_header(): bs_xover_band")); - faad_getbits(ld, 2 - DEBUGVAR(1,207,"sbr_header(): bs_reserved_bits_hdr")); - bs_header_extra_1 = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,208,"sbr_header(): bs_header_extra_1")); - bs_header_extra_2 = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,209,"sbr_header(): bs_header_extra_2")); - - if (bs_header_extra_1) - { - sbr->bs_freq_scale = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,211,"sbr_header(): bs_freq_scale")); - sbr->bs_alter_scale = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,212,"sbr_header(): bs_alter_scale")); - sbr->bs_noise_bands = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,213,"sbr_header(): bs_noise_bands")); - } else { - /* Default values */ - sbr->bs_freq_scale = 2; - sbr->bs_alter_scale = 1; - sbr->bs_noise_bands = 2; - } - - if (bs_header_extra_2) - { - sbr->bs_limiter_bands = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,214,"sbr_header(): bs_limiter_bands")); - sbr->bs_limiter_gains = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,215,"sbr_header(): bs_limiter_gains")); - sbr->bs_interpol_freq = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,216,"sbr_header(): bs_interpol_freq")); - sbr->bs_smoothing_mode = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,217,"sbr_header(): bs_smoothing_mode")); - } else { - /* Default values */ - sbr->bs_limiter_bands = 2; - sbr->bs_limiter_gains = 2; - sbr->bs_interpol_freq = 1; - sbr->bs_smoothing_mode = 1; - } - -#if 0 - /* print the header to screen */ - printf("bs_amp_res: %d\n", sbr->bs_amp_res); - printf("bs_start_freq: %d\n", sbr->bs_start_freq); - printf("bs_stop_freq: %d\n", sbr->bs_stop_freq); - printf("bs_xover_band: %d\n", sbr->bs_xover_band); - if (bs_header_extra_1) - { - printf("bs_freq_scale: %d\n", sbr->bs_freq_scale); - printf("bs_alter_scale: %d\n", sbr->bs_alter_scale); - printf("bs_noise_bands: %d\n", sbr->bs_noise_bands); - } - if (bs_header_extra_2) - { - printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands); - printf("bs_limiter_gains: %d\n", sbr->bs_limiter_gains); - printf("bs_interpol_freq: %d\n", sbr->bs_interpol_freq); - printf("bs_smoothing_mode: %d\n", sbr->bs_smoothing_mode); - } - printf("\n"); -#endif -} - -/* table 4 */ -static uint8_t sbr_data(bitfile *ld, sbr_info *sbr) -{ - uint8_t result; -#if 0 - sbr->bs_samplerate_mode = faad_get1bit(ld - DEBUGVAR(1,219,"sbr_data(): bs_samplerate_mode")); -#endif - - sbr->rate = (sbr->bs_samplerate_mode) ? 2 : 1; - - switch (sbr->id_aac) - { - case ID_SCE: - if ((result = sbr_single_channel_element(ld, sbr)) > 0) - return result; - break; - case ID_CPE: - if ((result = sbr_channel_pair_element(ld, sbr)) > 0) - return result; - break; - } - - return 0; -} - -/* table 5 */ -static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr) -{ - uint8_t result; - - if (faad_get1bit(ld - DEBUGVAR(1,220,"sbr_single_channel_element(): bs_data_extra"))) - { - faad_getbits(ld, 4 - DEBUGVAR(1,221,"sbr_single_channel_element(): bs_reserved_bits_data")); - } - -#ifdef DRM - /* bs_coupling, from sbr_channel_pair_base_element(bs_amp_res) */ - if (sbr->Is_DRM_SBR) - faad_get1bit(ld); -#endif - - if ((result = sbr_grid(ld, sbr, 0)) > 0) - return result; - sbr_dtdf(ld, sbr, 0); - invf_mode(ld, sbr, 0); - sbr_envelope(ld, sbr, 0); - sbr_noise(ld, sbr, 0); - -#ifndef FIXED_POINT - envelope_noise_dequantisation(sbr, 0); -#endif - - memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t)); - - sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld - DEBUGVAR(1,223,"sbr_single_channel_element(): bs_add_harmonic_flag[0]")); - if (sbr->bs_add_harmonic_flag[0]) - sinusoidal_coding(ld, sbr, 0); - - sbr->bs_extended_data = faad_get1bit(ld - DEBUGVAR(1,224,"sbr_single_channel_element(): bs_extended_data[0]")); - - if (sbr->bs_extended_data) - { - uint16_t nr_bits_left; -#if (defined(PS_DEC) || defined(DRM_PS)) - uint8_t ps_ext_read = 0; -#endif - uint16_t cnt = (uint16_t)faad_getbits(ld, 4 - DEBUGVAR(1,225,"sbr_single_channel_element(): bs_extension_size")); - if (cnt == 15) - { - cnt += (uint16_t)faad_getbits(ld, 8 - DEBUGVAR(1,226,"sbr_single_channel_element(): bs_esc_count")); - } - - nr_bits_left = 8 * cnt; - while (nr_bits_left > 7) - { - uint16_t tmp_nr_bits = 0; - - sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,227,"sbr_single_channel_element(): bs_extension_id")); - tmp_nr_bits += 2; - - /* allow only 1 PS extension element per extension data */ -#if (defined(PS_DEC) || defined(DRM_PS)) -#if (defined(PS_DEC) && defined(DRM_PS)) - if (sbr->bs_extension_id == EXTENSION_ID_PS || sbr->bs_extension_id == DRM_PARAMETRIC_STEREO) -#else -#ifdef PS_DEC - if (sbr->bs_extension_id == EXTENSION_ID_PS) -#else -#ifdef DRM_PS - if (sbr->bs_extension_id == DRM_PARAMETRIC_STEREO) -#endif -#endif -#endif - { - if (ps_ext_read == 0) - { - ps_ext_read = 1; - } else { - /* to be safe make it 3, will switch to "default" - * in sbr_extension() */ - sbr->bs_extension_id = 3; - } - } -#endif - - tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left); - - /* check if the data read is bigger than the number of available bits */ - if (tmp_nr_bits > nr_bits_left) - return 1; - - nr_bits_left -= tmp_nr_bits; - } - - /* Corrigendum */ - if (nr_bits_left > 0) - { - faad_getbits(ld, nr_bits_left - DEBUGVAR(1,280,"sbr_single_channel_element(): nr_bits_left")); - } - } - - return 0; -} - -/* table 6 */ -static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr) -{ - uint8_t n, result; - - if (faad_get1bit(ld - DEBUGVAR(1,228,"sbr_single_channel_element(): bs_data_extra"))) - { - faad_getbits(ld, 4 - DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data")); - faad_getbits(ld, 4 - DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data")); - } - - sbr->bs_coupling = faad_get1bit(ld - DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_coupling")); - - if (sbr->bs_coupling) - { - if ((result = sbr_grid(ld, sbr, 0)) > 0) - return result; - - /* need to copy some data from left to right */ - sbr->bs_frame_class[1] = sbr->bs_frame_class[0]; - sbr->L_E[1] = sbr->L_E[0]; - sbr->L_Q[1] = sbr->L_Q[0]; - sbr->bs_pointer[1] = sbr->bs_pointer[0]; - - for (n = 0; n <= sbr->L_E[0]; n++) - { - sbr->t_E[1][n] = sbr->t_E[0][n]; - sbr->f[1][n] = sbr->f[0][n]; - } - for (n = 0; n <= sbr->L_Q[0]; n++) - sbr->t_Q[1][n] = sbr->t_Q[0][n]; - - sbr_dtdf(ld, sbr, 0); - sbr_dtdf(ld, sbr, 1); - invf_mode(ld, sbr, 0); - - /* more copying */ - for (n = 0; n < sbr->N_Q; n++) - sbr->bs_invf_mode[1][n] = sbr->bs_invf_mode[0][n]; - - sbr_envelope(ld, sbr, 0); - sbr_noise(ld, sbr, 0); - sbr_envelope(ld, sbr, 1); - sbr_noise(ld, sbr, 1); - - memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t)); - memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t)); - - sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld - DEBUGVAR(1,231,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]")); - if (sbr->bs_add_harmonic_flag[0]) - sinusoidal_coding(ld, sbr, 0); - - sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld - DEBUGVAR(1,232,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]")); - if (sbr->bs_add_harmonic_flag[1]) - sinusoidal_coding(ld, sbr, 1); - } else { - uint8_t saved_t_E[6] = {0}, saved_t_Q[3] = {0}; - uint8_t saved_L_E = sbr->L_E[0]; - uint8_t saved_L_Q = sbr->L_Q[0]; - uint8_t saved_frame_class = sbr->bs_frame_class[0]; - - for (n = 0; n < saved_L_E; n++) - saved_t_E[n] = sbr->t_E[0][n]; - for (n = 0; n < saved_L_Q; n++) - saved_t_Q[n] = sbr->t_Q[0][n]; - - if ((result = sbr_grid(ld, sbr, 0)) > 0) - return result; - if ((result = sbr_grid(ld, sbr, 1)) > 0) - { - /* restore first channel data as well */ - sbr->bs_frame_class[0] = saved_frame_class; - sbr->L_E[0] = saved_L_E; - sbr->L_Q[0] = saved_L_Q; - for (n = 0; n < 6; n++) - sbr->t_E[0][n] = saved_t_E[n]; - for (n = 0; n < 3; n++) - sbr->t_Q[0][n] = saved_t_Q[n]; - - return result; - } - sbr_dtdf(ld, sbr, 0); - sbr_dtdf(ld, sbr, 1); - invf_mode(ld, sbr, 0); - invf_mode(ld, sbr, 1); - sbr_envelope(ld, sbr, 0); - sbr_envelope(ld, sbr, 1); - sbr_noise(ld, sbr, 0); - sbr_noise(ld, sbr, 1); - - memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t)); - memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t)); - - sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld - DEBUGVAR(1,239,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]")); - if (sbr->bs_add_harmonic_flag[0]) - sinusoidal_coding(ld, sbr, 0); - - sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld - DEBUGVAR(1,240,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]")); - if (sbr->bs_add_harmonic_flag[1]) - sinusoidal_coding(ld, sbr, 1); - } -#ifndef FIXED_POINT - envelope_noise_dequantisation(sbr, 0); - envelope_noise_dequantisation(sbr, 1); - - if (sbr->bs_coupling) - unmap_envelope_noise(sbr); -#endif - - sbr->bs_extended_data = faad_get1bit(ld - DEBUGVAR(1,233,"sbr_channel_pair_element(): bs_extended_data[0]")); - if (sbr->bs_extended_data) - { - uint16_t nr_bits_left; - uint16_t cnt = (uint16_t)faad_getbits(ld, 4 - DEBUGVAR(1,234,"sbr_channel_pair_element(): bs_extension_size")); - if (cnt == 15) - { - cnt += (uint16_t)faad_getbits(ld, 8 - DEBUGVAR(1,235,"sbr_channel_pair_element(): bs_esc_count")); - } - - nr_bits_left = 8 * cnt; - while (nr_bits_left > 7) - { - uint16_t tmp_nr_bits = 0; - - sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,236,"sbr_channel_pair_element(): bs_extension_id")); - tmp_nr_bits += 2; - tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left); - - /* check if the data read is bigger than the number of available bits */ - if (tmp_nr_bits > nr_bits_left) - return 1; - - nr_bits_left -= tmp_nr_bits; - } - - /* Corrigendum */ - if (nr_bits_left > 0) - { - faad_getbits(ld, nr_bits_left - DEBUGVAR(1,280,"sbr_channel_pair_element(): nr_bits_left")); - } - } - - return 0; -} - -/* integer log[2](x): input range [0,10) */ -static int8_t sbr_log2(const int8_t val) -{ - int8_t log2tab[] = { 0, 0, 1, 2, 2, 3, 3, 3, 3, 4 }; - if (val < 10 && val >= 0) - return log2tab[val]; - else - return 0; -} - - -/* table 7 */ -static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch) -{ - uint8_t i, env, rel, result; - uint8_t bs_abs_bord, bs_abs_bord_1; - uint8_t bs_num_env = 0; - uint8_t saved_L_E = sbr->L_E[ch]; - uint8_t saved_L_Q = sbr->L_Q[ch]; - uint8_t saved_frame_class = sbr->bs_frame_class[ch]; - - sbr->bs_frame_class[ch] = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,248,"sbr_grid(): bs_frame_class")); - - switch (sbr->bs_frame_class[ch]) - { - case FIXFIX: - i = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,249,"sbr_grid(): bs_num_env_raw")); - - bs_num_env = min(1 << i, 5); - - i = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,250,"sbr_grid(): bs_freq_res_flag")); - for (env = 0; env < bs_num_env; env++) - sbr->f[ch][env] = i; - - sbr->abs_bord_lead[ch] = 0; - sbr->abs_bord_trail[ch] = sbr->numTimeSlots; - sbr->n_rel_lead[ch] = bs_num_env - 1; - sbr->n_rel_trail[ch] = 0; - break; - - case FIXVAR: - bs_abs_bord = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,251,"sbr_grid(): bs_abs_bord")) + sbr->numTimeSlots; - bs_num_env = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,252,"sbr_grid(): bs_num_env")) + 1; - - for (rel = 0; rel < bs_num_env-1; rel++) - { - sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,253,"sbr_grid(): bs_rel_bord")) + 2; - } - i = sbr_log2(bs_num_env + 1); - sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i - DEBUGVAR(1,254,"sbr_grid(): bs_pointer")); - - for (env = 0; env < bs_num_env; env++) - { - sbr->f[ch][bs_num_env - env - 1] = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,255,"sbr_grid(): bs_freq_res")); - } - - sbr->abs_bord_lead[ch] = 0; - sbr->abs_bord_trail[ch] = bs_abs_bord; - sbr->n_rel_lead[ch] = 0; - sbr->n_rel_trail[ch] = bs_num_env - 1; - break; - - case VARFIX: - bs_abs_bord = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,256,"sbr_grid(): bs_abs_bord")); - bs_num_env = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,257,"sbr_grid(): bs_num_env")) + 1; - - for (rel = 0; rel < bs_num_env-1; rel++) - { - sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,258,"sbr_grid(): bs_rel_bord")) + 2; - } - i = sbr_log2(bs_num_env + 1); - sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i - DEBUGVAR(1,259,"sbr_grid(): bs_pointer")); - - for (env = 0; env < bs_num_env; env++) - { - sbr->f[ch][env] = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,260,"sbr_grid(): bs_freq_res")); - } - - sbr->abs_bord_lead[ch] = bs_abs_bord; - sbr->abs_bord_trail[ch] = sbr->numTimeSlots; - sbr->n_rel_lead[ch] = bs_num_env - 1; - sbr->n_rel_trail[ch] = 0; - break; - - case VARVAR: - bs_abs_bord = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,261,"sbr_grid(): bs_abs_bord_0")); - bs_abs_bord_1 = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,262,"sbr_grid(): bs_abs_bord_1")) + sbr->numTimeSlots; - sbr->bs_num_rel_0[ch] = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,263,"sbr_grid(): bs_num_rel_0")); - sbr->bs_num_rel_1[ch] = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,264,"sbr_grid(): bs_num_rel_1")); - - bs_num_env = min(5, sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 1); - - for (rel = 0; rel < sbr->bs_num_rel_0[ch]; rel++) - { - sbr->bs_rel_bord_0[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,265,"sbr_grid(): bs_rel_bord")) + 2; - } - for(rel = 0; rel < sbr->bs_num_rel_1[ch]; rel++) - { - sbr->bs_rel_bord_1[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,266,"sbr_grid(): bs_rel_bord")) + 2; - } - i = sbr_log2(sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 2); - sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i - DEBUGVAR(1,267,"sbr_grid(): bs_pointer")); - - for (env = 0; env < bs_num_env; env++) - { - sbr->f[ch][env] = (uint8_t)faad_get1bit(ld - DEBUGVAR(1,268,"sbr_grid(): bs_freq_res")); - } - - sbr->abs_bord_lead[ch] = bs_abs_bord; - sbr->abs_bord_trail[ch] = bs_abs_bord_1; - sbr->n_rel_lead[ch] = sbr->bs_num_rel_0[ch]; - sbr->n_rel_trail[ch] = sbr->bs_num_rel_1[ch]; - break; - } - - if (sbr->bs_frame_class[ch] == VARVAR) - sbr->L_E[ch] = min(bs_num_env, 5); - else - sbr->L_E[ch] = min(bs_num_env, 4); - - if (sbr->L_E[ch] <= 0) - return 1; - - if (sbr->L_E[ch] > 1) - sbr->L_Q[ch] = 2; - else - sbr->L_Q[ch] = 1; - - /* TODO: this code can probably be integrated into the code above! */ - if ((result = envelope_time_border_vector(sbr, ch)) > 0) - { - sbr->bs_frame_class[ch] = saved_frame_class; - sbr->L_E[ch] = saved_L_E; - sbr->L_Q[ch] = saved_L_Q; - return result; - } - noise_floor_time_border_vector(sbr, ch); - -#if 0 - for (env = 0; env < bs_num_env; env++) - { - printf("freq_res[ch:%d][env:%d]: %d\n", ch, env, sbr->f[ch][env]); - } -#endif - - return 0; -} - -/* table 8 */ -static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch) -{ - uint8_t i; - - for (i = 0; i < sbr->L_E[ch]; i++) - { - sbr->bs_df_env[ch][i] = faad_get1bit(ld - DEBUGVAR(1,269,"sbr_dtdf(): bs_df_env")); - } - - for (i = 0; i < sbr->L_Q[ch]; i++) - { - sbr->bs_df_noise[ch][i] = faad_get1bit(ld - DEBUGVAR(1,270,"sbr_dtdf(): bs_df_noise")); - } -} - -/* table 9 */ -static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch) -{ - uint8_t n; - - for (n = 0; n < sbr->N_Q; n++) - { - sbr->bs_invf_mode[ch][n] = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,271,"invf_mode(): bs_invf_mode")); - } -} - -static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr, - uint8_t bs_extension_id, uint16_t num_bits_left) -{ -#ifdef PS_DEC - uint8_t header; - uint16_t ret; -#endif - - switch (bs_extension_id) - { -#ifdef PS_DEC - case EXTENSION_ID_PS: - if (!sbr->ps) - { - sbr->ps = ps_init(get_sr_index(sbr->sample_rate)); - } - ret = ps_data(sbr->ps, ld, &header); - - /* enable PS if and only if: a header has been decoded */ - if (sbr->ps_used == 0 && header == 1) - { - sbr->ps_used = 1; - } - - return ret; -#endif -#ifdef DRM_PS - case DRM_PARAMETRIC_STEREO: - sbr->ps_used = 1; - if (!sbr->drm_ps) - { - sbr->drm_ps = drm_ps_init(); - } - return drm_ps_data(sbr->drm_ps, ld); -#endif - default: - sbr->bs_extension_data = (uint8_t)faad_getbits(ld, 6 - DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data")); - return 6; - } -} - -/* table 12 */ -static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch) -{ - uint8_t n; - - for (n = 0; n < sbr->N_high; n++) - { - sbr->bs_add_harmonic[ch][n] = faad_get1bit(ld - DEBUGVAR(1,278,"sinusoidal_coding(): bs_add_harmonic")); - } -} - - -#endif /* SBR_DEC */ diff --git a/mplayer/libfaad2/sbr_syntax.h b/mplayer/libfaad2/sbr_syntax.h deleted file mode 100644 index 2ece1834..00000000 --- a/mplayer/libfaad2/sbr_syntax.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_syntax.h,v 1.19 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __SBR_SYNTAX_H__ -#define __SBR_SYNTAX_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "bits.h" - -#define T_HFGEN 8 -#define T_HFADJ 2 - -#define EXT_SBR_DATA 13 -#define EXT_SBR_DATA_CRC 14 - -#define FIXFIX 0 -#define FIXVAR 1 -#define VARFIX 2 -#define VARVAR 3 - -#define LO_RES 0 -#define HI_RES 1 - -#define NO_TIME_SLOTS_960 15 -#define NO_TIME_SLOTS 16 -#define RATE 2 - -#define NOISE_FLOOR_OFFSET 6 - - -uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt); - -#ifdef __cplusplus -} -#endif -#endif /* __SBR_SYNTAX_H__ */ - diff --git a/mplayer/libfaad2/sbr_tf_grid.c b/mplayer/libfaad2/sbr_tf_grid.c deleted file mode 100644 index c63115f1..00000000 --- a/mplayer/libfaad2/sbr_tf_grid.c +++ /dev/null @@ -1,258 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_tf_grid.c,v 1.15 2004/09/04 14:56:28 menno Exp $ -**/ - -/* Time/Frequency grid */ - -#include "common.h" -#include "structs.h" - -#ifdef SBR_DEC - -#include - -#include "sbr_syntax.h" -#include "sbr_tf_grid.h" - - -/* static function declarations */ -#if 0 -static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l); -static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l); -#endif -static uint8_t middleBorder(sbr_info *sbr, uint8_t ch); - - -/* function constructs new time border vector */ -/* first build into temp vector to be able to use previous vector on error */ -uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch) -{ - uint8_t l, border, temp; - uint8_t t_E_temp[6] = {0}; - - t_E_temp[0] = sbr->rate * sbr->abs_bord_lead[ch]; - t_E_temp[sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch]; - - switch (sbr->bs_frame_class[ch]) - { - case FIXFIX: - switch (sbr->L_E[ch]) - { - case 4: - temp = (int) (sbr->numTimeSlots / 4); - t_E_temp[3] = sbr->rate * 3 * temp; - t_E_temp[2] = sbr->rate * 2 * temp; - t_E_temp[1] = sbr->rate * temp; - break; - case 2: - t_E_temp[1] = sbr->rate * (int) (sbr->numTimeSlots / 2); - break; - default: - break; - } - break; - - case FIXVAR: - if (sbr->L_E[ch] > 1) - { - int8_t i = sbr->L_E[ch]; - border = sbr->abs_bord_trail[ch]; - - for (l = 0; l < (sbr->L_E[ch] - 1); l++) - { - if (border < sbr->bs_rel_bord[ch][l]) - return 1; - - border -= sbr->bs_rel_bord[ch][l]; - t_E_temp[--i] = sbr->rate * border; - } - } - break; - - case VARFIX: - if (sbr->L_E[ch] > 1) - { - int8_t i = 1; - border = sbr->abs_bord_lead[ch]; - - for (l = 0; l < (sbr->L_E[ch] - 1); l++) - { - border += sbr->bs_rel_bord[ch][l]; - - if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen) - return 1; - - t_E_temp[i++] = sbr->rate * border; - } - } - break; - - case VARVAR: - if (sbr->bs_num_rel_0[ch]) - { - int8_t i = 1; - border = sbr->abs_bord_lead[ch]; - - for (l = 0; l < sbr->bs_num_rel_0[ch]; l++) - { - border += sbr->bs_rel_bord_0[ch][l]; - - if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen) - return 1; - - t_E_temp[i++] = sbr->rate * border; - } - } - - if (sbr->bs_num_rel_1[ch]) - { - int8_t i = sbr->L_E[ch]; - border = sbr->abs_bord_trail[ch]; - - for (l = 0; l < sbr->bs_num_rel_1[ch]; l++) - { - if (border < sbr->bs_rel_bord_1[ch][l]) - return 1; - - border -= sbr->bs_rel_bord_1[ch][l]; - t_E_temp[--i] = sbr->rate * border; - } - } - break; - } - - /* no error occured, we can safely use this t_E vector */ - for (l = 0; l < 6; l++) - { - sbr->t_E[ch][l] = t_E_temp[l]; - } - - return 0; -} - -void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch) -{ - sbr->t_Q[ch][0] = sbr->t_E[ch][0]; - - if (sbr->L_E[ch] == 1) - { - sbr->t_Q[ch][1] = sbr->t_E[ch][1]; - sbr->t_Q[ch][2] = 0; - } else { - uint8_t index = middleBorder(sbr, ch); - sbr->t_Q[ch][1] = sbr->t_E[ch][index]; - sbr->t_Q[ch][2] = sbr->t_E[ch][sbr->L_E[ch]]; - } -} - -#if 0 -static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l) -{ - uint8_t i; - int16_t acc = 0; - - switch (sbr->bs_frame_class[ch]) - { - case FIXFIX: - return sbr->numTimeSlots/sbr->L_E[ch]; - case FIXVAR: - return 0; - case VARFIX: - for (i = 0; i < l; i++) - { - acc += sbr->bs_rel_bord[ch][i]; - } - return acc; - case VARVAR: - for (i = 0; i < l; i++) - { - acc += sbr->bs_rel_bord_0[ch][i]; - } - return acc; - } - - return 0; -} - -static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l) -{ - uint8_t i; - int16_t acc = 0; - - switch (sbr->bs_frame_class[ch]) - { - case FIXFIX: - case VARFIX: - return 0; - case FIXVAR: - for (i = 0; i < l; i++) - { - acc += sbr->bs_rel_bord[ch][i]; - } - return acc; - case VARVAR: - for (i = 0; i < l; i++) - { - acc += sbr->bs_rel_bord_1[ch][i]; - } - return acc; - } - - return 0; -} -#endif - -static uint8_t middleBorder(sbr_info *sbr, uint8_t ch) -{ - int8_t retval = 0; - - switch (sbr->bs_frame_class[ch]) - { - case FIXFIX: - retval = sbr->L_E[ch]/2; - break; - case VARFIX: - if (sbr->bs_pointer[ch] == 0) - retval = 1; - else if (sbr->bs_pointer[ch] == 1) - retval = sbr->L_E[ch] - 1; - else - retval = sbr->bs_pointer[ch] - 1; - break; - case FIXVAR: - case VARVAR: - if (sbr->bs_pointer[ch] > 1) - retval = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch]; - else - retval = sbr->L_E[ch] - 1; - break; - } - - return (retval > 0) ? retval : 0; -} - - -#endif diff --git a/mplayer/libfaad2/sbr_tf_grid.h b/mplayer/libfaad2/sbr_tf_grid.h deleted file mode 100644 index 930552b9..00000000 --- a/mplayer/libfaad2/sbr_tf_grid.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sbr_tf_grid.h,v 1.13 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __SBR_TF_GRID_H__ -#define __SBR_TF_GRID_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch); -void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch); - - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/mplayer/libfaad2/sine_win.h b/mplayer/libfaad2/sine_win.h deleted file mode 100644 index 76f46a47..00000000 --- a/mplayer/libfaad2/sine_win.h +++ /dev/null @@ -1,4301 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: sine_win.h,v 1.15 2004/09/04 14:56:28 menno Exp $ -**/ - -#ifndef __SINE_WIN_H__ -#define __SINE_WIN_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _MSC_VER -#pragma warning(disable:4305) -#pragma warning(disable:4244) -#endif - -ALIGN static const real_t sine_long_1024[] = -{ - FRAC_CONST(0.00076699031874270449), - FRAC_CONST(0.002300969151425805), - FRAC_CONST(0.0038349425697062275), - FRAC_CONST(0.0053689069639963425), - FRAC_CONST(0.0069028587247297558), - FRAC_CONST(0.0084367942423697988), - FRAC_CONST(0.0099707099074180308), - FRAC_CONST(0.011504602110422714), - FRAC_CONST(0.013038467241987334), - FRAC_CONST(0.014572301692779064), - FRAC_CONST(0.016106101853537287), - FRAC_CONST(0.017639864115082053), - FRAC_CONST(0.019173584868322623), - FRAC_CONST(0.020707260504265895), - FRAC_CONST(0.022240887414024961), - FRAC_CONST(0.023774461988827555), - FRAC_CONST(0.025307980620024571), - FRAC_CONST(0.026841439699098531), - FRAC_CONST(0.028374835617672099), - FRAC_CONST(0.029908164767516555), - FRAC_CONST(0.031441423540560301), - FRAC_CONST(0.032974608328897335), - FRAC_CONST(0.03450771552479575), - FRAC_CONST(0.036040741520706229), - FRAC_CONST(0.037573682709270494), - FRAC_CONST(0.039106535483329888), - FRAC_CONST(0.040639296235933736), - FRAC_CONST(0.042171961360347947), - FRAC_CONST(0.043704527250063421), - FRAC_CONST(0.04523699029880459), - FRAC_CONST(0.046769346900537863), - FRAC_CONST(0.048301593449480144), - FRAC_CONST(0.049833726340107277), - FRAC_CONST(0.051365741967162593), - FRAC_CONST(0.052897636725665324), - FRAC_CONST(0.054429407010919133), - FRAC_CONST(0.055961049218520569), - FRAC_CONST(0.057492559744367566), - FRAC_CONST(0.059023934984667931), - FRAC_CONST(0.060555171335947788), - FRAC_CONST(0.062086265195060088), - FRAC_CONST(0.063617212959193106), - FRAC_CONST(0.065148011025878833), - FRAC_CONST(0.066678655793001557), - FRAC_CONST(0.068209143658806329), - FRAC_CONST(0.069739471021907307), - FRAC_CONST(0.071269634281296401), - FRAC_CONST(0.072799629836351673), - FRAC_CONST(0.074329454086845756), - FRAC_CONST(0.075859103432954447), - FRAC_CONST(0.077388574275265049), - FRAC_CONST(0.078917863014784942), - FRAC_CONST(0.080446966052950014), - FRAC_CONST(0.081975879791633066), - FRAC_CONST(0.083504600633152432), - FRAC_CONST(0.085033124980280275), - FRAC_CONST(0.08656144923625117), - FRAC_CONST(0.088089569804770507), - FRAC_CONST(0.089617483090022959), - FRAC_CONST(0.091145185496681005), - FRAC_CONST(0.09267267342991331), - FRAC_CONST(0.094199943295393204), - FRAC_CONST(0.095726991499307162), - FRAC_CONST(0.097253814448363271), - FRAC_CONST(0.098780408549799623), - FRAC_CONST(0.10030677021139286), - FRAC_CONST(0.10183289584146653), - FRAC_CONST(0.10335878184889961), - FRAC_CONST(0.10488442464313497), - FRAC_CONST(0.10640982063418768), - FRAC_CONST(0.10793496623265365), - FRAC_CONST(0.10945985784971798), - FRAC_CONST(0.11098449189716339), - FRAC_CONST(0.11250886478737869), - FRAC_CONST(0.1140329729333672), - FRAC_CONST(0.11555681274875526), - FRAC_CONST(0.11708038064780059), - FRAC_CONST(0.11860367304540072), - FRAC_CONST(0.1201266863571015), - FRAC_CONST(0.12164941699910553), - FRAC_CONST(0.12317186138828048), - FRAC_CONST(0.12469401594216764), - FRAC_CONST(0.12621587707899035), - FRAC_CONST(0.12773744121766231), - FRAC_CONST(0.12925870477779614), - FRAC_CONST(0.13077966417971171), - FRAC_CONST(0.13230031584444465), - FRAC_CONST(0.13382065619375472), - FRAC_CONST(0.13534068165013421), - FRAC_CONST(0.13686038863681638), - FRAC_CONST(0.13837977357778389), - FRAC_CONST(0.13989883289777721), - FRAC_CONST(0.14141756302230302), - FRAC_CONST(0.14293596037764267), - FRAC_CONST(0.14445402139086047), - FRAC_CONST(0.14597174248981221), - FRAC_CONST(0.14748912010315357), - FRAC_CONST(0.14900615066034845), - FRAC_CONST(0.1505228305916774), - FRAC_CONST(0.15203915632824605), - FRAC_CONST(0.15355512430199345), - FRAC_CONST(0.15507073094570051), - FRAC_CONST(0.15658597269299843), - FRAC_CONST(0.15810084597837698), - FRAC_CONST(0.15961534723719306), - FRAC_CONST(0.16112947290567881), - FRAC_CONST(0.16264321942095031), - FRAC_CONST(0.16415658322101581), - FRAC_CONST(0.16566956074478412), - FRAC_CONST(0.16718214843207294), - FRAC_CONST(0.16869434272361733), - FRAC_CONST(0.17020614006107807), - FRAC_CONST(0.17171753688704997), - FRAC_CONST(0.17322852964507032), - FRAC_CONST(0.1747391147796272), - FRAC_CONST(0.17624928873616788), - FRAC_CONST(0.17775904796110717), - FRAC_CONST(0.17926838890183575), - FRAC_CONST(0.18077730800672859), - FRAC_CONST(0.1822858017251533), - FRAC_CONST(0.18379386650747845), - FRAC_CONST(0.1853014988050819), - FRAC_CONST(0.18680869507035927), - FRAC_CONST(0.18831545175673212), - FRAC_CONST(0.18982176531865641), - FRAC_CONST(0.1913276322116309), - FRAC_CONST(0.19283304889220523), - FRAC_CONST(0.1943380118179886), - FRAC_CONST(0.19584251744765785), - FRAC_CONST(0.19734656224096592), - FRAC_CONST(0.19885014265875009), - FRAC_CONST(0.20035325516294045), - FRAC_CONST(0.20185589621656805), - FRAC_CONST(0.20335806228377332), - FRAC_CONST(0.20485974982981442), - FRAC_CONST(0.20636095532107551), - FRAC_CONST(0.20786167522507507), - FRAC_CONST(0.20936190601047416), - FRAC_CONST(0.21086164414708486), - FRAC_CONST(0.21236088610587842), - FRAC_CONST(0.21385962835899375), - FRAC_CONST(0.21535786737974555), - FRAC_CONST(0.21685559964263262), - FRAC_CONST(0.21835282162334632), - FRAC_CONST(0.2198495297987787), - FRAC_CONST(0.22134572064703081), - FRAC_CONST(0.22284139064742112), - FRAC_CONST(0.2243365362804936), - FRAC_CONST(0.22583115402802617), - FRAC_CONST(0.22732524037303886), - FRAC_CONST(0.22881879179980222), - FRAC_CONST(0.23031180479384544), - FRAC_CONST(0.23180427584196478), - FRAC_CONST(0.23329620143223159), - FRAC_CONST(0.23478757805400097), - FRAC_CONST(0.23627840219791957), - FRAC_CONST(0.23776867035593419), - FRAC_CONST(0.23925837902129998), - FRAC_CONST(0.24074752468858843), - FRAC_CONST(0.24223610385369601), - FRAC_CONST(0.24372411301385216), - FRAC_CONST(0.24521154866762754), - FRAC_CONST(0.24669840731494241), - FRAC_CONST(0.24818468545707478), - FRAC_CONST(0.24967037959666857), - FRAC_CONST(0.25115548623774192), - FRAC_CONST(0.25264000188569552), - FRAC_CONST(0.25412392304732062), - FRAC_CONST(0.25560724623080738), - FRAC_CONST(0.25708996794575312), - FRAC_CONST(0.25857208470317034), - FRAC_CONST(0.26005359301549519), - FRAC_CONST(0.26153448939659552), - FRAC_CONST(0.263014770361779), - FRAC_CONST(0.26449443242780163), - FRAC_CONST(0.26597347211287559), - FRAC_CONST(0.26745188593667762), - FRAC_CONST(0.26892967042035726), - FRAC_CONST(0.27040682208654482), - FRAC_CONST(0.27188333745935972), - FRAC_CONST(0.27335921306441868), - FRAC_CONST(0.27483444542884394), - FRAC_CONST(0.27630903108127108), - FRAC_CONST(0.27778296655185769), - FRAC_CONST(0.27925624837229118), - FRAC_CONST(0.28072887307579719), - FRAC_CONST(0.28220083719714756), - FRAC_CONST(0.28367213727266843), - FRAC_CONST(0.28514276984024867), - FRAC_CONST(0.28661273143934779), - FRAC_CONST(0.28808201861100413), - FRAC_CONST(0.28955062789784303), - FRAC_CONST(0.29101855584408509), - FRAC_CONST(0.29248579899555388), - FRAC_CONST(0.29395235389968466), - FRAC_CONST(0.29541821710553201), - FRAC_CONST(0.29688338516377827), - FRAC_CONST(0.2983478546267414), - FRAC_CONST(0.29981162204838335), - FRAC_CONST(0.30127468398431795), - FRAC_CONST(0.30273703699181914), - FRAC_CONST(0.30419867762982911), - FRAC_CONST(0.30565960245896612), - FRAC_CONST(0.3071198080415331), - FRAC_CONST(0.30857929094152509), - FRAC_CONST(0.31003804772463789), - FRAC_CONST(0.31149607495827591), - FRAC_CONST(0.3129533692115602), - FRAC_CONST(0.31440992705533666), - FRAC_CONST(0.31586574506218396), - FRAC_CONST(0.31732081980642174), - FRAC_CONST(0.31877514786411848), - FRAC_CONST(0.32022872581309986), - FRAC_CONST(0.32168155023295658), - FRAC_CONST(0.32313361770505233), - FRAC_CONST(0.32458492481253215), - FRAC_CONST(0.32603546814033024), - FRAC_CONST(0.327485244275178), - FRAC_CONST(0.3289342498056122), - FRAC_CONST(0.33038248132198278), - FRAC_CONST(0.33182993541646111), - FRAC_CONST(0.33327660868304793), - FRAC_CONST(0.33472249771758122), - FRAC_CONST(0.33616759911774452), - FRAC_CONST(0.33761190948307462), - FRAC_CONST(0.33905542541496964), - FRAC_CONST(0.34049814351669716), - FRAC_CONST(0.34194006039340219), - FRAC_CONST(0.34338117265211504), - FRAC_CONST(0.34482147690175929), - FRAC_CONST(0.34626096975316001), - FRAC_CONST(0.34769964781905138), - FRAC_CONST(0.34913750771408497), - FRAC_CONST(0.35057454605483751), - FRAC_CONST(0.35201075945981908), - FRAC_CONST(0.35344614454948081), - FRAC_CONST(0.35488069794622279), - FRAC_CONST(0.35631441627440241), - FRAC_CONST(0.3577472961603419), - FRAC_CONST(0.3591793342323365), - FRAC_CONST(0.36061052712066227), - FRAC_CONST(0.36204087145758418), - FRAC_CONST(0.36347036387736376), - FRAC_CONST(0.36489900101626732), - FRAC_CONST(0.36632677951257359), - FRAC_CONST(0.36775369600658198), - FRAC_CONST(0.36917974714062002), - FRAC_CONST(0.37060492955905167), - FRAC_CONST(0.37202923990828501), - FRAC_CONST(0.3734526748367803), - FRAC_CONST(0.37487523099505754), - FRAC_CONST(0.37629690503570479), - FRAC_CONST(0.37771769361338564), - FRAC_CONST(0.37913759338484732), - FRAC_CONST(0.38055660100892852), - FRAC_CONST(0.38197471314656722), - FRAC_CONST(0.38339192646080866), - FRAC_CONST(0.38480823761681288), - FRAC_CONST(0.38622364328186298), - FRAC_CONST(0.38763814012537273), - FRAC_CONST(0.38905172481889438), - FRAC_CONST(0.39046439403612659), - FRAC_CONST(0.39187614445292235), - FRAC_CONST(0.3932869727472964), - FRAC_CONST(0.39469687559943356), - FRAC_CONST(0.39610584969169627), - FRAC_CONST(0.39751389170863233), - FRAC_CONST(0.39892099833698291), - FRAC_CONST(0.40032716626569009), - FRAC_CONST(0.40173239218590501), - FRAC_CONST(0.4031366727909953), - FRAC_CONST(0.404540004776553), - FRAC_CONST(0.40594238484040251), - FRAC_CONST(0.40734380968260797), - FRAC_CONST(0.40874427600548136), - FRAC_CONST(0.41014378051359024), - FRAC_CONST(0.41154231991376522), - FRAC_CONST(0.41293989091510808), - FRAC_CONST(0.4143364902289991), - FRAC_CONST(0.41573211456910536), - FRAC_CONST(0.41712676065138787), - FRAC_CONST(0.4185204251941097), - FRAC_CONST(0.41991310491784362), - FRAC_CONST(0.42130479654547964), - FRAC_CONST(0.42269549680223295), - FRAC_CONST(0.42408520241565156), - FRAC_CONST(0.4254739101156238), - FRAC_CONST(0.42686161663438643), - FRAC_CONST(0.42824831870653196), - FRAC_CONST(0.42963401306901638), - FRAC_CONST(0.43101869646116703), - FRAC_CONST(0.43240236562469014), - FRAC_CONST(0.43378501730367852), - FRAC_CONST(0.43516664824461926), - FRAC_CONST(0.4365472551964012), - FRAC_CONST(0.43792683491032286), - FRAC_CONST(0.43930538414009995), - FRAC_CONST(0.4406828996418729), - FRAC_CONST(0.4420593781742147), - FRAC_CONST(0.44343481649813848), - FRAC_CONST(0.44480921137710488), - FRAC_CONST(0.44618255957703007), - FRAC_CONST(0.44755485786629301), - FRAC_CONST(0.44892610301574326), - FRAC_CONST(0.45029629179870861), - FRAC_CONST(0.45166542099100249), - FRAC_CONST(0.45303348737093158), - FRAC_CONST(0.45440048771930358), - FRAC_CONST(0.45576641881943464), - FRAC_CONST(0.45713127745715698), - FRAC_CONST(0.45849506042082627), - FRAC_CONST(0.45985776450132954), - FRAC_CONST(0.46121938649209238), - FRAC_CONST(0.46257992318908681), - FRAC_CONST(0.46393937139083852), - FRAC_CONST(0.4652977278984346), - FRAC_CONST(0.46665498951553092), - FRAC_CONST(0.46801115304835983), - FRAC_CONST(0.46936621530573752), - FRAC_CONST(0.4707201730990716), - FRAC_CONST(0.47207302324236866), - FRAC_CONST(0.47342476255224153), - FRAC_CONST(0.47477538784791712), - FRAC_CONST(0.47612489595124358), - FRAC_CONST(0.47747328368669806), - FRAC_CONST(0.47882054788139389), - FRAC_CONST(0.48016668536508839), - FRAC_CONST(0.48151169297018986), - FRAC_CONST(0.48285556753176567), - FRAC_CONST(0.48419830588754903), - FRAC_CONST(0.48553990487794696), - FRAC_CONST(0.48688036134604734), - FRAC_CONST(0.48821967213762679), - FRAC_CONST(0.48955783410115744), - FRAC_CONST(0.49089484408781509), - FRAC_CONST(0.49223069895148602), - FRAC_CONST(0.49356539554877477), - FRAC_CONST(0.49489893073901126), - FRAC_CONST(0.49623130138425825), - FRAC_CONST(0.49756250434931915), - FRAC_CONST(0.49889253650174459), - FRAC_CONST(0.50022139471184068), - FRAC_CONST(0.50154907585267539), - FRAC_CONST(0.50287557680008699), - FRAC_CONST(0.50420089443269034), - FRAC_CONST(0.50552502563188539), - FRAC_CONST(0.50684796728186321), - FRAC_CONST(0.5081697162696146), - FRAC_CONST(0.50949026948493636), - FRAC_CONST(0.51080962382043904), - FRAC_CONST(0.51212777617155469), - FRAC_CONST(0.51344472343654346), - FRAC_CONST(0.5147604625165012), - FRAC_CONST(0.51607499031536663), - FRAC_CONST(0.51738830373992906), - FRAC_CONST(0.51870039969983495), - FRAC_CONST(0.52001127510759604), - FRAC_CONST(0.52132092687859566), - FRAC_CONST(0.52262935193109661), - FRAC_CONST(0.5239365471862486), - FRAC_CONST(0.52524250956809471), - FRAC_CONST(0.52654723600357944), - FRAC_CONST(0.52785072342255523), - FRAC_CONST(0.52915296875779061), - FRAC_CONST(0.53045396894497632), - FRAC_CONST(0.53175372092273332), - FRAC_CONST(0.53305222163261945), - FRAC_CONST(0.53434946801913752), - FRAC_CONST(0.53564545702974109), - FRAC_CONST(0.53694018561484291), - FRAC_CONST(0.5382336507278217), - FRAC_CONST(0.53952584932502889), - FRAC_CONST(0.54081677836579667), - FRAC_CONST(0.54210643481244392), - FRAC_CONST(0.5433948156302848), - FRAC_CONST(0.54468191778763453), - FRAC_CONST(0.54596773825581757), - FRAC_CONST(0.54725227400917409), - FRAC_CONST(0.54853552202506739), - FRAC_CONST(0.54981747928389091), - FRAC_CONST(0.55109814276907543), - FRAC_CONST(0.55237750946709607), - FRAC_CONST(0.55365557636747931), - FRAC_CONST(0.55493234046281037), - FRAC_CONST(0.55620779874873993), - FRAC_CONST(0.55748194822399155), - FRAC_CONST(0.55875478589036831), - FRAC_CONST(0.56002630875276038), - FRAC_CONST(0.56129651381915147), - FRAC_CONST(0.56256539810062656), - FRAC_CONST(0.56383295861137817), - FRAC_CONST(0.56509919236871398), - FRAC_CONST(0.56636409639306384), - FRAC_CONST(0.56762766770798623), - FRAC_CONST(0.56888990334017586), - FRAC_CONST(0.5701508003194703), - FRAC_CONST(0.57141035567885723), - FRAC_CONST(0.57266856645448116), - FRAC_CONST(0.57392542968565075), - FRAC_CONST(0.57518094241484508), - FRAC_CONST(0.57643510168772183), - FRAC_CONST(0.5776879045531228), - FRAC_CONST(0.57893934806308178), - FRAC_CONST(0.58018942927283168), - FRAC_CONST(0.58143814524081017), - FRAC_CONST(0.58268549302866846), - FRAC_CONST(0.58393146970127618), - FRAC_CONST(0.58517607232673041), - FRAC_CONST(0.5864192979763605), - FRAC_CONST(0.58766114372473666), - FRAC_CONST(0.58890160664967572), - FRAC_CONST(0.59014068383224882), - FRAC_CONST(0.59137837235678758), - FRAC_CONST(0.59261466931089113), - FRAC_CONST(0.59384957178543363), - FRAC_CONST(0.59508307687456996), - FRAC_CONST(0.59631518167574371), - FRAC_CONST(0.59754588328969316), - FRAC_CONST(0.59877517882045872), - FRAC_CONST(0.60000306537538894), - FRAC_CONST(0.6012295400651485), - FRAC_CONST(0.60245460000372375), - FRAC_CONST(0.60367824230843037), - FRAC_CONST(0.60490046409991982), - FRAC_CONST(0.60612126250218612), - FRAC_CONST(0.60734063464257293), - FRAC_CONST(0.60855857765177945), - FRAC_CONST(0.60977508866386843), - FRAC_CONST(0.61099016481627166), - FRAC_CONST(0.61220380324979795), - FRAC_CONST(0.61341600110863859), - FRAC_CONST(0.61462675554037505), - FRAC_CONST(0.61583606369598509), - FRAC_CONST(0.61704392272984976), - FRAC_CONST(0.61825032979976025), - FRAC_CONST(0.61945528206692402), - FRAC_CONST(0.62065877669597214), - FRAC_CONST(0.62186081085496536), - FRAC_CONST(0.62306138171540126), - FRAC_CONST(0.62426048645222065), - FRAC_CONST(0.62545812224381436), - FRAC_CONST(0.62665428627202935), - FRAC_CONST(0.62784897572217646), - FRAC_CONST(0.629042187783036), - FRAC_CONST(0.63023391964686437), - FRAC_CONST(0.63142416850940186), - FRAC_CONST(0.63261293156987741), - FRAC_CONST(0.63380020603101728), - FRAC_CONST(0.63498598909904946), - FRAC_CONST(0.63617027798371217), - FRAC_CONST(0.63735306989825913), - FRAC_CONST(0.63853436205946679), - FRAC_CONST(0.63971415168764045), - FRAC_CONST(0.64089243600662138), - FRAC_CONST(0.64206921224379254), - FRAC_CONST(0.64324447763008585), - FRAC_CONST(0.64441822939998838), - FRAC_CONST(0.64559046479154869), - FRAC_CONST(0.64676118104638392), - FRAC_CONST(0.64793037540968534), - FRAC_CONST(0.64909804513022595), - FRAC_CONST(0.65026418746036585), - FRAC_CONST(0.65142879965605982), - FRAC_CONST(0.65259187897686244), - FRAC_CONST(0.65375342268593606), - FRAC_CONST(0.65491342805005603), - FRAC_CONST(0.6560718923396176), - FRAC_CONST(0.65722881282864254), - FRAC_CONST(0.65838418679478505), - FRAC_CONST(0.65953801151933866), - FRAC_CONST(0.6606902842872423), - FRAC_CONST(0.66184100238708687), - FRAC_CONST(0.66299016311112147), - FRAC_CONST(0.66413776375526001), - FRAC_CONST(0.66528380161908718), - FRAC_CONST(0.66642827400586524), - FRAC_CONST(0.66757117822254031), - FRAC_CONST(0.66871251157974798), - FRAC_CONST(0.66985227139182102), - FRAC_CONST(0.67099045497679422), - FRAC_CONST(0.67212705965641173), - FRAC_CONST(0.67326208275613297), - FRAC_CONST(0.67439552160513905), - FRAC_CONST(0.67552737353633852), - FRAC_CONST(0.67665763588637495), - FRAC_CONST(0.6777863059956315), - FRAC_CONST(0.67891338120823841), - FRAC_CONST(0.68003885887207893), - FRAC_CONST(0.68116273633879543), - FRAC_CONST(0.68228501096379557), - FRAC_CONST(0.68340568010625868), - FRAC_CONST(0.6845247411291423), - FRAC_CONST(0.68564219139918747), - FRAC_CONST(0.68675802828692589), - FRAC_CONST(0.68787224916668555), - FRAC_CONST(0.68898485141659704), - FRAC_CONST(0.69009583241859995), - FRAC_CONST(0.69120518955844845), - FRAC_CONST(0.69231292022571822), - FRAC_CONST(0.69341902181381176), - FRAC_CONST(0.69452349171996552), - FRAC_CONST(0.69562632734525487), - FRAC_CONST(0.6967275260946012), - FRAC_CONST(0.69782708537677729), - FRAC_CONST(0.69892500260441415), - FRAC_CONST(0.70002127519400625), - FRAC_CONST(0.70111590056591866), - FRAC_CONST(0.70220887614439187), - FRAC_CONST(0.70330019935754873), - FRAC_CONST(0.70438986763740041), - FRAC_CONST(0.7054778784198521), - FRAC_CONST(0.70656422914470951), - FRAC_CONST(0.70764891725568435), - FRAC_CONST(0.70873194020040065), - FRAC_CONST(0.70981329543040084), - FRAC_CONST(0.71089298040115168), - FRAC_CONST(0.71197099257204999), - FRAC_CONST(0.71304732940642923), - FRAC_CONST(0.71412198837156471), - FRAC_CONST(0.71519496693868001), - FRAC_CONST(0.71626626258295312), - FRAC_CONST(0.71733587278352173), - FRAC_CONST(0.71840379502348972), - FRAC_CONST(0.71947002678993299), - FRAC_CONST(0.72053456557390527), - FRAC_CONST(0.72159740887044366), - FRAC_CONST(0.72265855417857561), - FRAC_CONST(0.72371799900132339), - FRAC_CONST(0.72477574084571128), - FRAC_CONST(0.72583177722277037), - FRAC_CONST(0.72688610564754497), - FRAC_CONST(0.72793872363909862), - FRAC_CONST(0.72898962872051931), - FRAC_CONST(0.73003881841892615), - FRAC_CONST(0.73108629026547423), - FRAC_CONST(0.73213204179536129), - FRAC_CONST(0.73317607054783274), - FRAC_CONST(0.73421837406618817), - FRAC_CONST(0.73525894989778673), - FRAC_CONST(0.73629779559405306), - FRAC_CONST(0.73733490871048279), - FRAC_CONST(0.73837028680664851), - FRAC_CONST(0.73940392744620576), - FRAC_CONST(0.74043582819689802), - FRAC_CONST(0.74146598663056329), - FRAC_CONST(0.74249440032313918), - FRAC_CONST(0.74352106685466912), - FRAC_CONST(0.74454598380930725), - FRAC_CONST(0.74556914877532543), - FRAC_CONST(0.74659055934511731), - FRAC_CONST(0.74761021311520515), - FRAC_CONST(0.74862810768624533), - FRAC_CONST(0.74964424066303348), - FRAC_CONST(0.75065860965451059), - FRAC_CONST(0.75167121227376843), - FRAC_CONST(0.75268204613805523), - FRAC_CONST(0.75369110886878121), - FRAC_CONST(0.75469839809152439), - FRAC_CONST(0.75570391143603588), - FRAC_CONST(0.75670764653624567), - FRAC_CONST(0.75770960103026808), - FRAC_CONST(0.75870977256040739), - FRAC_CONST(0.75970815877316344), - FRAC_CONST(0.76070475731923692), - FRAC_CONST(0.76169956585353527), - FRAC_CONST(0.76269258203517787), - FRAC_CONST(0.76368380352750187), - FRAC_CONST(0.76467322799806714), - FRAC_CONST(0.76566085311866239), - FRAC_CONST(0.76664667656531038), - FRAC_CONST(0.76763069601827327), - FRAC_CONST(0.76861290916205827), - FRAC_CONST(0.76959331368542294), - FRAC_CONST(0.7705719072813807), - FRAC_CONST(0.7715486876472063), - FRAC_CONST(0.77252365248444133), - FRAC_CONST(0.77349679949889905), - FRAC_CONST(0.77446812640067086), - FRAC_CONST(0.77543763090413043), - FRAC_CONST(0.77640531072794039), - FRAC_CONST(0.7773711635950562), - FRAC_CONST(0.77833518723273309), - FRAC_CONST(0.7792973793725303), - FRAC_CONST(0.78025773775031659), - FRAC_CONST(0.78121626010627609), - FRAC_CONST(0.7821729441849129), - FRAC_CONST(0.78312778773505731), - FRAC_CONST(0.78408078850986995), - FRAC_CONST(0.78503194426684808), - FRAC_CONST(0.78598125276783015), - FRAC_CONST(0.7869287117790017), - FRAC_CONST(0.78787431907090011), - FRAC_CONST(0.78881807241842017), - FRAC_CONST(0.78975996960081907), - FRAC_CONST(0.79070000840172161), - FRAC_CONST(0.79163818660912577), - FRAC_CONST(0.79257450201540758), - FRAC_CONST(0.79350895241732666), - FRAC_CONST(0.79444153561603059), - FRAC_CONST(0.79537224941706119), - FRAC_CONST(0.79630109163035911), - FRAC_CONST(0.7972280600702687), - FRAC_CONST(0.79815315255554375), - FRAC_CONST(0.79907636690935235), - FRAC_CONST(0.79999770095928191), - FRAC_CONST(0.8009171525373443), - FRAC_CONST(0.80183471947998131), - FRAC_CONST(0.80275039962806916), - FRAC_CONST(0.80366419082692409), - FRAC_CONST(0.804576090926307), - FRAC_CONST(0.80548609778042912), - FRAC_CONST(0.80639420924795624), - FRAC_CONST(0.80730042319201445), - FRAC_CONST(0.80820473748019472), - FRAC_CONST(0.80910714998455813), - FRAC_CONST(0.81000765858164114), - FRAC_CONST(0.81090626115245967), - FRAC_CONST(0.81180295558251536), - FRAC_CONST(0.81269773976179949), - FRAC_CONST(0.81359061158479851), - FRAC_CONST(0.81448156895049861), - FRAC_CONST(0.81537060976239129), - FRAC_CONST(0.81625773192847739), - FRAC_CONST(0.81714293336127297), - FRAC_CONST(0.81802621197781344), - FRAC_CONST(0.81890756569965895), - FRAC_CONST(0.81978699245289899), - FRAC_CONST(0.82066449016815746), - FRAC_CONST(0.82154005678059761), - FRAC_CONST(0.82241369022992639), - FRAC_CONST(0.82328538846040011), - FRAC_CONST(0.82415514942082857), - FRAC_CONST(0.82502297106458022), - FRAC_CONST(0.82588885134958678), - FRAC_CONST(0.82675278823834852), - FRAC_CONST(0.8276147796979384), - FRAC_CONST(0.82847482370000713), - FRAC_CONST(0.82933291822078825), - FRAC_CONST(0.83018906124110237), - FRAC_CONST(0.83104325074636232), - FRAC_CONST(0.83189548472657759), - FRAC_CONST(0.83274576117635946), - FRAC_CONST(0.83359407809492514), - FRAC_CONST(0.83444043348610319), - FRAC_CONST(0.83528482535833737), - FRAC_CONST(0.83612725172469216), - FRAC_CONST(0.83696771060285702), - FRAC_CONST(0.83780620001515094), - FRAC_CONST(0.8386427179885273), - FRAC_CONST(0.83947726255457855), - FRAC_CONST(0.84030983174954077), - FRAC_CONST(0.84114042361429808), - FRAC_CONST(0.84196903619438768), - FRAC_CONST(0.84279566754000412), - FRAC_CONST(0.84362031570600404), - FRAC_CONST(0.84444297875191066), - FRAC_CONST(0.84526365474191822), - FRAC_CONST(0.84608234174489694), - FRAC_CONST(0.84689903783439735), - FRAC_CONST(0.84771374108865427), - FRAC_CONST(0.84852644959059265), - FRAC_CONST(0.84933716142783067), - FRAC_CONST(0.85014587469268521), - FRAC_CONST(0.85095258748217573), - FRAC_CONST(0.85175729789802912), - FRAC_CONST(0.85256000404668397), - FRAC_CONST(0.85336070403929543), - FRAC_CONST(0.85415939599173873), - FRAC_CONST(0.85495607802461482), - FRAC_CONST(0.85575074826325392), - FRAC_CONST(0.85654340483771996), - FRAC_CONST(0.85733404588281559), - FRAC_CONST(0.85812266953808602), - FRAC_CONST(0.8589092739478239), - FRAC_CONST(0.85969385726107261), - FRAC_CONST(0.86047641763163207), - FRAC_CONST(0.86125695321806206), - FRAC_CONST(0.86203546218368721), - FRAC_CONST(0.86281194269660033), - FRAC_CONST(0.86358639292966799), - FRAC_CONST(0.86435881106053403), - FRAC_CONST(0.86512919527162369), - FRAC_CONST(0.86589754375014882), - FRAC_CONST(0.86666385468811102), - FRAC_CONST(0.86742812628230692), - FRAC_CONST(0.86819035673433131), - FRAC_CONST(0.86895054425058238), - FRAC_CONST(0.86970868704226556), - FRAC_CONST(0.87046478332539767), - FRAC_CONST(0.8712188313208109), - FRAC_CONST(0.8719708292541577), - FRAC_CONST(0.8727207753559143), - FRAC_CONST(0.87346866786138488), - FRAC_CONST(0.8742145050107063), - FRAC_CONST(0.87495828504885154), - FRAC_CONST(0.8757000062256346), - FRAC_CONST(0.87643966679571361), - FRAC_CONST(0.87717726501859594), - FRAC_CONST(0.87791279915864173), - FRAC_CONST(0.87864626748506813), - FRAC_CONST(0.87937766827195318), - FRAC_CONST(0.88010699979824036), - FRAC_CONST(0.88083426034774204), - FRAC_CONST(0.88155944820914378), - FRAC_CONST(0.8822825616760086), - FRAC_CONST(0.88300359904678072), - FRAC_CONST(0.88372255862478966), - FRAC_CONST(0.8844394387182537), - FRAC_CONST(0.88515423764028511), - FRAC_CONST(0.88586695370889279), - FRAC_CONST(0.88657758524698704), - FRAC_CONST(0.88728613058238315), - FRAC_CONST(0.88799258804780556), - FRAC_CONST(0.88869695598089171), - FRAC_CONST(0.88939923272419552), - FRAC_CONST(0.89009941662519221), - FRAC_CONST(0.89079750603628149), - FRAC_CONST(0.89149349931479138), - FRAC_CONST(0.89218739482298248), - FRAC_CONST(0.89287919092805168), - FRAC_CONST(0.89356888600213602), - FRAC_CONST(0.89425647842231604), - FRAC_CONST(0.89494196657062075), - FRAC_CONST(0.89562534883403), - FRAC_CONST(0.89630662360447966), - FRAC_CONST(0.89698578927886397), - FRAC_CONST(0.89766284425904075), - FRAC_CONST(0.89833778695183419), - FRAC_CONST(0.89901061576903907), - FRAC_CONST(0.89968132912742393), - FRAC_CONST(0.9003499254487356), - FRAC_CONST(0.90101640315970233), - FRAC_CONST(0.90168076069203773), - FRAC_CONST(0.9023429964824442), - FRAC_CONST(0.90300310897261704), - FRAC_CONST(0.90366109660924798), - FRAC_CONST(0.90431695784402832), - FRAC_CONST(0.90497069113365325), - FRAC_CONST(0.90562229493982516), - FRAC_CONST(0.90627176772925766), - FRAC_CONST(0.90691910797367803), - FRAC_CONST(0.90756431414983252), - FRAC_CONST(0.9082073847394887), - FRAC_CONST(0.90884831822943912), - FRAC_CONST(0.90948711311150543), - FRAC_CONST(0.91012376788254157), - FRAC_CONST(0.91075828104443757), - FRAC_CONST(0.91139065110412232), - FRAC_CONST(0.91202087657356823), - FRAC_CONST(0.9126489559697939), - FRAC_CONST(0.91327488781486776), - FRAC_CONST(0.91389867063591168), - FRAC_CONST(0.91452030296510445), - FRAC_CONST(0.91513978333968526), - FRAC_CONST(0.91575711030195672), - FRAC_CONST(0.91637228239928914), - FRAC_CONST(0.91698529818412289), - FRAC_CONST(0.91759615621397295), - FRAC_CONST(0.9182048550514309), - FRAC_CONST(0.91881139326416994), - FRAC_CONST(0.91941576942494696), - FRAC_CONST(0.92001798211160657), - FRAC_CONST(0.92061802990708386), - FRAC_CONST(0.92121591139940873), - FRAC_CONST(0.92181162518170812), - FRAC_CONST(0.92240516985220988), - FRAC_CONST(0.92299654401424625), - FRAC_CONST(0.92358574627625656), - FRAC_CONST(0.9241727752517912), - FRAC_CONST(0.92475762955951391), - FRAC_CONST(0.9253403078232062), - FRAC_CONST(0.92592080867176996), - FRAC_CONST(0.92649913073923051), - FRAC_CONST(0.9270752726647401), - FRAC_CONST(0.92764923309258118), - FRAC_CONST(0.92822101067216944), - FRAC_CONST(0.92879060405805702), - FRAC_CONST(0.9293580119099355), - FRAC_CONST(0.92992323289263956), - FRAC_CONST(0.93048626567614978), - FRAC_CONST(0.93104710893559517), - FRAC_CONST(0.93160576135125783), - FRAC_CONST(0.93216222160857432), - FRAC_CONST(0.93271648839814025), - FRAC_CONST(0.93326856041571205), - FRAC_CONST(0.93381843636221096), - FRAC_CONST(0.9343661149437259), - FRAC_CONST(0.93491159487151609), - FRAC_CONST(0.93545487486201462), - FRAC_CONST(0.9359959536368313), - FRAC_CONST(0.9365348299227555), - FRAC_CONST(0.93707150245175919), - FRAC_CONST(0.93760596996099999), - FRAC_CONST(0.93813823119282436), - FRAC_CONST(0.93866828489477017), - FRAC_CONST(0.9391961298195699), - FRAC_CONST(0.93972176472515334), - FRAC_CONST(0.94024518837465088), - FRAC_CONST(0.94076639953639607), - FRAC_CONST(0.94128539698392866), - FRAC_CONST(0.94180217949599765), - FRAC_CONST(0.94231674585656378), - FRAC_CONST(0.94282909485480271), - FRAC_CONST(0.94333922528510772), - FRAC_CONST(0.94384713594709269), - FRAC_CONST(0.94435282564559475), - FRAC_CONST(0.94485629319067721), - FRAC_CONST(0.94535753739763229), - FRAC_CONST(0.94585655708698391), - FRAC_CONST(0.94635335108449059), - FRAC_CONST(0.946847918221148), - FRAC_CONST(0.94734025733319194), - FRAC_CONST(0.94783036726210101), - FRAC_CONST(0.94831824685459909), - FRAC_CONST(0.94880389496265838), - FRAC_CONST(0.94928731044350201), - FRAC_CONST(0.94976849215960668), - FRAC_CONST(0.95024743897870523), - FRAC_CONST(0.95072414977378961), - FRAC_CONST(0.95119862342311323), - FRAC_CONST(0.95167085881019386), - FRAC_CONST(0.95214085482381583), - FRAC_CONST(0.95260861035803324), - FRAC_CONST(0.9530741243121722), - FRAC_CONST(0.95353739559083328), - FRAC_CONST(0.95399842310389449), - FRAC_CONST(0.95445720576651349), - FRAC_CONST(0.95491374249913052), - FRAC_CONST(0.95536803222747024), - FRAC_CONST(0.95582007388254542), - FRAC_CONST(0.95626986640065814), - FRAC_CONST(0.95671740872340305), - FRAC_CONST(0.9571626997976701), - FRAC_CONST(0.95760573857564624), - FRAC_CONST(0.9580465240148186), - FRAC_CONST(0.9584850550779761), - FRAC_CONST(0.95892133073321306), - FRAC_CONST(0.95935534995393079), - FRAC_CONST(0.9597871117188399), - FRAC_CONST(0.96021661501196343), - FRAC_CONST(0.96064385882263847), - FRAC_CONST(0.96106884214551935), - FRAC_CONST(0.961491563980579), - FRAC_CONST(0.9619120233331121), - FRAC_CONST(0.9623302192137374), - FRAC_CONST(0.96274615063839941), - FRAC_CONST(0.96315981662837136), - FRAC_CONST(0.96357121621025721), - FRAC_CONST(0.96398034841599411), - FRAC_CONST(0.96438721228285429), - FRAC_CONST(0.9647918068534479), - FRAC_CONST(0.96519413117572472), - FRAC_CONST(0.96559418430297683), - FRAC_CONST(0.96599196529384057), - FRAC_CONST(0.96638747321229879), - FRAC_CONST(0.96678070712768327), - FRAC_CONST(0.96717166611467664), - FRAC_CONST(0.96756034925331436), - FRAC_CONST(0.9679467556289878), - FRAC_CONST(0.9683308843324453), - FRAC_CONST(0.96871273445979478), - FRAC_CONST(0.9690923051125061), - FRAC_CONST(0.96946959539741295), - FRAC_CONST(0.96984460442671483), - FRAC_CONST(0.97021733131797916), - FRAC_CONST(0.97058777519414363), - FRAC_CONST(0.97095593518351797), - FRAC_CONST(0.97132181041978616), - FRAC_CONST(0.97168540004200854), - FRAC_CONST(0.9720467031946235), - FRAC_CONST(0.97240571902744977), - FRAC_CONST(0.97276244669568857), - FRAC_CONST(0.97311688535992513), - FRAC_CONST(0.97346903418613095), - FRAC_CONST(0.9738188923456661), - FRAC_CONST(0.97416645901528032), - FRAC_CONST(0.97451173337711572), - FRAC_CONST(0.97485471461870843), - FRAC_CONST(0.97519540193299037), - FRAC_CONST(0.97553379451829136), - FRAC_CONST(0.97586989157834103), - FRAC_CONST(0.97620369232227056), - FRAC_CONST(0.97653519596461447), - FRAC_CONST(0.97686440172531264), - FRAC_CONST(0.97719130882971228), - FRAC_CONST(0.97751591650856928), - FRAC_CONST(0.97783822399805043), - FRAC_CONST(0.97815823053973505), - FRAC_CONST(0.97847593538061683), - FRAC_CONST(0.97879133777310567), - FRAC_CONST(0.97910443697502925), - FRAC_CONST(0.97941523224963478), - FRAC_CONST(0.97972372286559117), - FRAC_CONST(0.98002990809698998), - FRAC_CONST(0.98033378722334796), - FRAC_CONST(0.98063535952960812), - FRAC_CONST(0.98093462430614164), - FRAC_CONST(0.98123158084874973), - FRAC_CONST(0.98152622845866466), - FRAC_CONST(0.9818185664425525), - FRAC_CONST(0.98210859411251361), - FRAC_CONST(0.98239631078608469), - FRAC_CONST(0.98268171578624086), - FRAC_CONST(0.98296480844139644), - FRAC_CONST(0.98324558808540707), - FRAC_CONST(0.98352405405757126), - FRAC_CONST(0.98380020570263149), - FRAC_CONST(0.98407404237077645), - FRAC_CONST(0.9843455634176419), - FRAC_CONST(0.9846147682043126), - FRAC_CONST(0.9848816560973237), - FRAC_CONST(0.98514622646866223), - FRAC_CONST(0.98540847869576842), - FRAC_CONST(0.98566841216153755), - FRAC_CONST(0.98592602625432113), - FRAC_CONST(0.98618132036792827), - FRAC_CONST(0.98643429390162707), - FRAC_CONST(0.98668494626014669), - FRAC_CONST(0.98693327685367771), - FRAC_CONST(0.98717928509787434), - FRAC_CONST(0.98742297041385541), - FRAC_CONST(0.98766433222820571), - FRAC_CONST(0.98790336997297779), - FRAC_CONST(0.98814008308569257), - FRAC_CONST(0.98837447100934128), - FRAC_CONST(0.98860653319238645), - FRAC_CONST(0.98883626908876354), - FRAC_CONST(0.98906367815788154), - FRAC_CONST(0.98928875986462517), - FRAC_CONST(0.98951151367935519), - FRAC_CONST(0.98973193907791057), - FRAC_CONST(0.98995003554160899), - FRAC_CONST(0.9901658025572484), - FRAC_CONST(0.99037923961710816), - FRAC_CONST(0.99059034621895015), - FRAC_CONST(0.99079912186602037), - FRAC_CONST(0.99100556606704937), - FRAC_CONST(0.99120967833625406), - FRAC_CONST(0.99141145819333854), - FRAC_CONST(0.99161090516349537), - FRAC_CONST(0.99180801877740643), - FRAC_CONST(0.99200279857124452), - FRAC_CONST(0.99219524408667392), - FRAC_CONST(0.99238535487085167), - FRAC_CONST(0.99257313047642881), - FRAC_CONST(0.99275857046155114), - FRAC_CONST(0.99294167438986047), - FRAC_CONST(0.99312244183049558), - FRAC_CONST(0.99330087235809328), - FRAC_CONST(0.99347696555278919), - FRAC_CONST(0.99365072100021912), - FRAC_CONST(0.99382213829151966), - FRAC_CONST(0.99399121702332938), - FRAC_CONST(0.99415795679778973), - FRAC_CONST(0.99432235722254581), - FRAC_CONST(0.9944844179107476), - FRAC_CONST(0.99464413848105071), - FRAC_CONST(0.99480151855761711), - FRAC_CONST(0.99495655777011638), - FRAC_CONST(0.99510925575372611), - FRAC_CONST(0.99525961214913339), - FRAC_CONST(0.9954076266025349), - FRAC_CONST(0.99555329876563847), - FRAC_CONST(0.99569662829566352), - FRAC_CONST(0.99583761485534161), - FRAC_CONST(0.99597625811291779), - FRAC_CONST(0.99611255774215113), - FRAC_CONST(0.99624651342231552), - FRAC_CONST(0.99637812483820021), - FRAC_CONST(0.99650739168011082), - FRAC_CONST(0.9966343136438699), - FRAC_CONST(0.996758890430818), - FRAC_CONST(0.99688112174781385), - FRAC_CONST(0.99700100730723529), - FRAC_CONST(0.99711854682697998), - FRAC_CONST(0.99723374003046616), - FRAC_CONST(0.99734658664663323), - FRAC_CONST(0.99745708640994191), - FRAC_CONST(0.99756523906037575), - FRAC_CONST(0.997671044343441), - FRAC_CONST(0.99777450201016782), - FRAC_CONST(0.99787561181711015), - FRAC_CONST(0.99797437352634699), - FRAC_CONST(0.99807078690548234), - FRAC_CONST(0.99816485172764624), - FRAC_CONST(0.99825656777149518), - FRAC_CONST(0.99834593482121237), - FRAC_CONST(0.99843295266650844), - FRAC_CONST(0.99851762110262221), - FRAC_CONST(0.99859993993032037), - FRAC_CONST(0.99867990895589909), - FRAC_CONST(0.99875752799118334), - FRAC_CONST(0.99883279685352799), - FRAC_CONST(0.99890571536581829), - FRAC_CONST(0.99897628335646982), - FRAC_CONST(0.99904450065942929), - FRAC_CONST(0.99911036711417489), - FRAC_CONST(0.99917388256571638), - FRAC_CONST(0.99923504686459585), - FRAC_CONST(0.99929385986688779), - FRAC_CONST(0.99935032143419944), - FRAC_CONST(0.9994044314336713), - FRAC_CONST(0.99945618973797734), - FRAC_CONST(0.99950559622532531), - FRAC_CONST(0.99955265077945699), - FRAC_CONST(0.99959735328964838), - FRAC_CONST(0.9996397036507102), - FRAC_CONST(0.99967970176298793), - FRAC_CONST(0.99971734753236219), - FRAC_CONST(0.99975264087024884), - FRAC_CONST(0.99978558169359921), - FRAC_CONST(0.99981616992490041), - FRAC_CONST(0.99984440549217524), - FRAC_CONST(0.99987028832898295), - FRAC_CONST(0.99989381837441849), - FRAC_CONST(0.99991499557311347), - FRAC_CONST(0.999933819875236), - FRAC_CONST(0.99995029123649048), - FRAC_CONST(0.99996440961811828), - FRAC_CONST(0.99997617498689761), - FRAC_CONST(0.9999855873151432), - FRAC_CONST(0.99999264658070719), - FRAC_CONST(0.99999735276697821), - FRAC_CONST(0.99999970586288223) -}; - -#ifdef ALLOW_SMALL_FRAMELENGTH -ALIGN static const real_t sine_long_960[] = -{ - FRAC_CONST(0.00081812299560725323), - FRAC_CONST(0.0024543667964602917), - FRAC_CONST(0.0040906040262347889), - FRAC_CONST(0.0057268303042312674), - FRAC_CONST(0.0073630412497795667), - FRAC_CONST(0.0089992324822505774), - FRAC_CONST(0.010635399621067975), - FRAC_CONST(0.012271538285719924), - FRAC_CONST(0.013907644095770845), - FRAC_CONST(0.015543712670873098), - FRAC_CONST(0.017179739630778748), - FRAC_CONST(0.018815720595351273), - FRAC_CONST(0.020451651184577292), - FRAC_CONST(0.022087527018578291), - FRAC_CONST(0.023723343717622358), - FRAC_CONST(0.025359096902135895), - FRAC_CONST(0.02699478219271537), - FRAC_CONST(0.028630395210139003), - FRAC_CONST(0.030265931575378519), - FRAC_CONST(0.031901386909610863), - FRAC_CONST(0.033536756834229922), - FRAC_CONST(0.035172036970858266), - FRAC_CONST(0.036807222941358832), - FRAC_CONST(0.038442310367846677), - FRAC_CONST(0.040077294872700696), - FRAC_CONST(0.041712172078575326), - FRAC_CONST(0.043346937608412288), - FRAC_CONST(0.044981587085452281), - FRAC_CONST(0.046616116133246711), - FRAC_CONST(0.048250520375669431), - FRAC_CONST(0.049884795436928406), - FRAC_CONST(0.051518936941577477), - FRAC_CONST(0.053152940514528055), - FRAC_CONST(0.05478680178106083), - FRAC_CONST(0.056420516366837495), - FRAC_CONST(0.05805407989791244), - FRAC_CONST(0.059687488000744485), - FRAC_CONST(0.061320736302208578), - FRAC_CONST(0.062953820429607482), - FRAC_CONST(0.064586736010683557), - FRAC_CONST(0.066219478673630344), - FRAC_CONST(0.06785204404710439), - FRAC_CONST(0.069484427760236861), - FRAC_CONST(0.071116625442645326), - FRAC_CONST(0.072748632724445372), - FRAC_CONST(0.07438044523626236), - FRAC_CONST(0.076012058609243122), - FRAC_CONST(0.077643468475067631), - FRAC_CONST(0.079274670465960706), - FRAC_CONST(0.080905660214703745), - FRAC_CONST(0.082536433354646319), - FRAC_CONST(0.084166985519717977), - FRAC_CONST(0.085797312344439894), - FRAC_CONST(0.08742740946393647), - FRAC_CONST(0.089057272513947183), - FRAC_CONST(0.090686897130838162), - FRAC_CONST(0.092316278951613845), - FRAC_CONST(0.093945413613928788), - FRAC_CONST(0.095574296756099186), - FRAC_CONST(0.097202924017114667), - FRAC_CONST(0.098831291036649963), - FRAC_CONST(0.10045939345507648), - FRAC_CONST(0.10208722691347409), - FRAC_CONST(0.10371478705364276), - FRAC_CONST(0.10534206951811415), - FRAC_CONST(0.10696906995016341), - FRAC_CONST(0.10859578399382072), - FRAC_CONST(0.11022220729388306), - FRAC_CONST(0.11184833549592579), - FRAC_CONST(0.11347416424631435), - FRAC_CONST(0.11509968919221586), - FRAC_CONST(0.11672490598161089), - FRAC_CONST(0.11834981026330495), - FRAC_CONST(0.11997439768694031), - FRAC_CONST(0.12159866390300751), - FRAC_CONST(0.12322260456285709), - FRAC_CONST(0.12484621531871121), - FRAC_CONST(0.12646949182367517), - FRAC_CONST(0.12809242973174936), - FRAC_CONST(0.12971502469784052), - FRAC_CONST(0.13133727237777362), - FRAC_CONST(0.13295916842830346), - FRAC_CONST(0.13458070850712617), - FRAC_CONST(0.13620188827289101), - FRAC_CONST(0.1378227033852118), - FRAC_CONST(0.13944314950467873), - FRAC_CONST(0.14106322229286994), - FRAC_CONST(0.14268291741236291), - FRAC_CONST(0.14430223052674654), - FRAC_CONST(0.1459211573006321), - FRAC_CONST(0.14753969339966552), - FRAC_CONST(0.14915783449053857), - FRAC_CONST(0.15077557624100058), - FRAC_CONST(0.15239291431987001), - FRAC_CONST(0.1540098443970461), - FRAC_CONST(0.15562636214352044), - FRAC_CONST(0.15724246323138855), - FRAC_CONST(0.15885814333386142), - FRAC_CONST(0.16047339812527725), - FRAC_CONST(0.16208822328111283), - FRAC_CONST(0.16370261447799525), - FRAC_CONST(0.16531656739371339), - FRAC_CONST(0.16693007770722967), - FRAC_CONST(0.16854314109869134), - FRAC_CONST(0.17015575324944232), - FRAC_CONST(0.17176790984203447), - FRAC_CONST(0.17337960656023954), - FRAC_CONST(0.1749908390890603), - FRAC_CONST(0.17660160311474243), - FRAC_CONST(0.17821189432478593), - FRAC_CONST(0.17982170840795647), - FRAC_CONST(0.18143104105429744), - FRAC_CONST(0.18303988795514095), - FRAC_CONST(0.1846482448031197), - FRAC_CONST(0.18625610729217834), - FRAC_CONST(0.1878634711175852), - FRAC_CONST(0.18947033197594348), - FRAC_CONST(0.19107668556520319), - FRAC_CONST(0.19268252758467228), - FRAC_CONST(0.19428785373502844), - FRAC_CONST(0.19589265971833042), - FRAC_CONST(0.19749694123802966), - FRAC_CONST(0.19910069399898173), - FRAC_CONST(0.20070391370745785), - FRAC_CONST(0.20230659607115639), - FRAC_CONST(0.20390873679921437), - FRAC_CONST(0.20551033160221882), - FRAC_CONST(0.20711137619221856), - FRAC_CONST(0.2087118662827353), - FRAC_CONST(0.21031179758877552), - FRAC_CONST(0.21191116582684155), - FRAC_CONST(0.21350996671494335), - FRAC_CONST(0.21510819597260972), - FRAC_CONST(0.21670584932089998), - FRAC_CONST(0.2183029224824154), - FRAC_CONST(0.21989941118131037), - FRAC_CONST(0.22149531114330431), - FRAC_CONST(0.22309061809569264), - FRAC_CONST(0.22468532776735861), - FRAC_CONST(0.22627943588878449), - FRAC_CONST(0.22787293819206314), - FRAC_CONST(0.22946583041090929), - FRAC_CONST(0.23105810828067114), - FRAC_CONST(0.23264976753834157), - FRAC_CONST(0.23424080392256985), - FRAC_CONST(0.2358312131736727), - FRAC_CONST(0.23742099103364595), - FRAC_CONST(0.23901013324617584), - FRAC_CONST(0.24059863555665045), - FRAC_CONST(0.24218649371217096), - FRAC_CONST(0.24377370346156332), - FRAC_CONST(0.24536026055538934), - FRAC_CONST(0.24694616074595824), - FRAC_CONST(0.24853139978733788), - FRAC_CONST(0.25011597343536629), - FRAC_CONST(0.25169987744766298), - FRAC_CONST(0.25328310758364025), - FRAC_CONST(0.25486565960451457), - FRAC_CONST(0.25644752927331788), - FRAC_CONST(0.25802871235490898), - FRAC_CONST(0.25960920461598508), - FRAC_CONST(0.26118900182509258), - FRAC_CONST(0.26276809975263904), - FRAC_CONST(0.264346494170904), - FRAC_CONST(0.26592418085405067), - FRAC_CONST(0.26750115557813692), - FRAC_CONST(0.2690774141211269), - FRAC_CONST(0.27065295226290209), - FRAC_CONST(0.2722277657852728), - FRAC_CONST(0.27380185047198918), - FRAC_CONST(0.27537520210875299), - FRAC_CONST(0.2769478164832283), - FRAC_CONST(0.27851968938505312), - FRAC_CONST(0.28009081660585067), - FRAC_CONST(0.28166119393924061), - FRAC_CONST(0.28323081718085019), - FRAC_CONST(0.28479968212832563), - FRAC_CONST(0.28636778458134327), - FRAC_CONST(0.28793512034162105), - FRAC_CONST(0.2895016852129294), - FRAC_CONST(0.29106747500110264), - FRAC_CONST(0.29263248551405047), - FRAC_CONST(0.2941967125617686), - FRAC_CONST(0.29576015195635058), - FRAC_CONST(0.29732279951199847), - FRAC_CONST(0.29888465104503475), - FRAC_CONST(0.30044570237391266), - FRAC_CONST(0.30200594931922808), - FRAC_CONST(0.30356538770373032), - FRAC_CONST(0.30512401335233358), - FRAC_CONST(0.30668182209212791), - FRAC_CONST(0.3082388097523906), - FRAC_CONST(0.30979497216459695), - FRAC_CONST(0.31135030516243201), - FRAC_CONST(0.3129048045818012), - FRAC_CONST(0.31445846626084178), - FRAC_CONST(0.31601128603993378), - FRAC_CONST(0.31756325976171151), - FRAC_CONST(0.31911438327107416), - FRAC_CONST(0.32066465241519732), - FRAC_CONST(0.32221406304354389), - FRAC_CONST(0.3237626110078754), - FRAC_CONST(0.32531029216226293), - FRAC_CONST(0.32685710236309828), - FRAC_CONST(0.32840303746910487), - FRAC_CONST(0.32994809334134939), - FRAC_CONST(0.3314922658432522), - FRAC_CONST(0.33303555084059877), - FRAC_CONST(0.33457794420155085), - FRAC_CONST(0.33611944179665709), - FRAC_CONST(0.33766003949886464), - FRAC_CONST(0.33919973318352969), - FRAC_CONST(0.34073851872842903), - FRAC_CONST(0.34227639201377064), - FRAC_CONST(0.34381334892220483), - FRAC_CONST(0.34534938533883547), - FRAC_CONST(0.34688449715123082), - FRAC_CONST(0.34841868024943456), - FRAC_CONST(0.34995193052597684), - FRAC_CONST(0.35148424387588523), - FRAC_CONST(0.3530156161966958), - FRAC_CONST(0.35454604338846402), - FRAC_CONST(0.35607552135377557), - FRAC_CONST(0.35760404599775775), - FRAC_CONST(0.35913161322809023), - FRAC_CONST(0.36065821895501554), - FRAC_CONST(0.36218385909135092), - FRAC_CONST(0.36370852955249849), - FRAC_CONST(0.36523222625645668), - FRAC_CONST(0.36675494512383078), - FRAC_CONST(0.36827668207784414), - FRAC_CONST(0.36979743304434909), - FRAC_CONST(0.37131719395183754), - FRAC_CONST(0.37283596073145214), - FRAC_CONST(0.37435372931699717), - FRAC_CONST(0.37587049564494951), - FRAC_CONST(0.37738625565446909), - FRAC_CONST(0.37890100528741022), - FRAC_CONST(0.38041474048833229), - FRAC_CONST(0.38192745720451066), - FRAC_CONST(0.38343915138594736), - FRAC_CONST(0.38494981898538222), - FRAC_CONST(0.38645945595830333), - FRAC_CONST(0.38796805826295838), - FRAC_CONST(0.38947562186036483), - FRAC_CONST(0.39098214271432141), - FRAC_CONST(0.39248761679141814), - FRAC_CONST(0.3939920400610481), - FRAC_CONST(0.39549540849541737), - FRAC_CONST(0.39699771806955625), - FRAC_CONST(0.39849896476132979), - FRAC_CONST(0.39999914455144892), - FRAC_CONST(0.40149825342348083), - FRAC_CONST(0.4029962873638599), - FRAC_CONST(0.40449324236189854), - FRAC_CONST(0.40598911440979762), - FRAC_CONST(0.40748389950265762), - FRAC_CONST(0.40897759363848879), - FRAC_CONST(0.41047019281822261), - FRAC_CONST(0.41196169304572178), - FRAC_CONST(0.4134520903277914), - FRAC_CONST(0.41494138067418929), - FRAC_CONST(0.41642956009763715), - FRAC_CONST(0.41791662461383078), - FRAC_CONST(0.41940257024145089), - FRAC_CONST(0.42088739300217382), - FRAC_CONST(0.42237108892068231), - FRAC_CONST(0.42385365402467584), - FRAC_CONST(0.42533508434488143), - FRAC_CONST(0.42681537591506419), - FRAC_CONST(0.42829452477203828), - FRAC_CONST(0.42977252695567697), - FRAC_CONST(0.43124937850892364), - FRAC_CONST(0.4327250754778022), - FRAC_CONST(0.43419961391142781), - FRAC_CONST(0.43567298986201736), - FRAC_CONST(0.43714519938489987), - FRAC_CONST(0.43861623853852766), - FRAC_CONST(0.44008610338448595), - FRAC_CONST(0.44155478998750436), - FRAC_CONST(0.44302229441546676), - FRAC_CONST(0.4444886127394222), - FRAC_CONST(0.44595374103359531), - FRAC_CONST(0.44741767537539667), - FRAC_CONST(0.44888041184543348), - FRAC_CONST(0.45034194652752002), - FRAC_CONST(0.45180227550868812), - FRAC_CONST(0.45326139487919759), - FRAC_CONST(0.45471930073254679), - FRAC_CONST(0.45617598916548296), - FRAC_CONST(0.45763145627801283), - FRAC_CONST(0.45908569817341294), - FRAC_CONST(0.46053871095824001), - FRAC_CONST(0.46199049074234161), - FRAC_CONST(0.46344103363886635), - FRAC_CONST(0.46489033576427435), - FRAC_CONST(0.46633839323834758), - FRAC_CONST(0.46778520218420055), - FRAC_CONST(0.46923075872829029), - FRAC_CONST(0.47067505900042683), - FRAC_CONST(0.47211809913378361), - FRAC_CONST(0.47355987526490806), - FRAC_CONST(0.47500038353373153), - FRAC_CONST(0.47643962008357982), - FRAC_CONST(0.47787758106118372), - FRAC_CONST(0.47931426261668875), - FRAC_CONST(0.48074966090366611), - FRAC_CONST(0.48218377207912272), - FRAC_CONST(0.48361659230351117), - FRAC_CONST(0.48504811774074069), - FRAC_CONST(0.48647834455818684), - FRAC_CONST(0.48790726892670194), - FRAC_CONST(0.48933488702062544), - FRAC_CONST(0.49076119501779414), - FRAC_CONST(0.49218618909955225), - FRAC_CONST(0.4936098654507618), - FRAC_CONST(0.49503222025981269), - FRAC_CONST(0.49645324971863303), - FRAC_CONST(0.49787295002269943), - FRAC_CONST(0.49929131737104687), - FRAC_CONST(0.50070834796627917), - FRAC_CONST(0.50212403801457872), - FRAC_CONST(0.50353838372571758), - FRAC_CONST(0.50495138131306638), - FRAC_CONST(0.50636302699360547), - FRAC_CONST(0.50777331698793449), - FRAC_CONST(0.50918224752028263), - FRAC_CONST(0.51058981481851906), - FRAC_CONST(0.51199601511416237), - FRAC_CONST(0.51340084464239111), - FRAC_CONST(0.51480429964205421), - FRAC_CONST(0.51620637635567967), - FRAC_CONST(0.51760707102948678), - FRAC_CONST(0.51900637991339404), - FRAC_CONST(0.5204042992610306), - FRAC_CONST(0.52180082532974559), - FRAC_CONST(0.5231959543806185), - FRAC_CONST(0.52458968267846895), - FRAC_CONST(0.52598200649186677), - FRAC_CONST(0.52737292209314235), - FRAC_CONST(0.52876242575839572), - FRAC_CONST(0.53015051376750777), - FRAC_CONST(0.53153718240414882), - FRAC_CONST(0.53292242795578992), - FRAC_CONST(0.53430624671371152), - FRAC_CONST(0.53568863497301467), - FRAC_CONST(0.5370695890326298), - FRAC_CONST(0.5384491051953274), - FRAC_CONST(0.53982717976772743), - FRAC_CONST(0.54120380906030963), - FRAC_CONST(0.54257898938742311), - FRAC_CONST(0.54395271706729609), - FRAC_CONST(0.54532498842204646), - FRAC_CONST(0.54669579977769045), - FRAC_CONST(0.54806514746415402), - FRAC_CONST(0.54943302781528081), - FRAC_CONST(0.55079943716884383), - FRAC_CONST(0.55216437186655387), - FRAC_CONST(0.55352782825406999), - FRAC_CONST(0.55488980268100907), - FRAC_CONST(0.55625029150095584), - FRAC_CONST(0.55760929107147217), - FRAC_CONST(0.55896679775410718), - FRAC_CONST(0.56032280791440714), - FRAC_CONST(0.56167731792192455), - FRAC_CONST(0.56303032415022869), - FRAC_CONST(0.56438182297691453), - FRAC_CONST(0.56573181078361312), - FRAC_CONST(0.56708028395600085), - FRAC_CONST(0.56842723888380908), - FRAC_CONST(0.56977267196083425), - FRAC_CONST(0.57111657958494688), - FRAC_CONST(0.5724589581581021), - FRAC_CONST(0.57379980408634845), - FRAC_CONST(0.57513911377983773), - FRAC_CONST(0.57647688365283478), - FRAC_CONST(0.57781311012372738), - FRAC_CONST(0.57914778961503466), - FRAC_CONST(0.58048091855341843), - FRAC_CONST(0.5818124933696911), - FRAC_CONST(0.58314251049882604), - FRAC_CONST(0.58447096637996743), - FRAC_CONST(0.58579785745643886), - FRAC_CONST(0.5871231801757536), - FRAC_CONST(0.58844693098962408), - FRAC_CONST(0.58976910635397084), - FRAC_CONST(0.59108970272893235), - FRAC_CONST(0.59240871657887517), - FRAC_CONST(0.59372614437240179), - FRAC_CONST(0.59504198258236196), - FRAC_CONST(0.5963562276858605), - FRAC_CONST(0.59766887616426767), - FRAC_CONST(0.5989799245032289), - FRAC_CONST(0.60028936919267273), - FRAC_CONST(0.60159720672682204), - FRAC_CONST(0.60290343360420195), - FRAC_CONST(0.60420804632765002), - FRAC_CONST(0.60551104140432543), - FRAC_CONST(0.60681241534571839), - FRAC_CONST(0.60811216466765883), - FRAC_CONST(0.60941028589032709), - FRAC_CONST(0.61070677553826169), - FRAC_CONST(0.61200163014036979), - FRAC_CONST(0.61329484622993602), - FRAC_CONST(0.6145864203446314), - FRAC_CONST(0.61587634902652377), - FRAC_CONST(0.61716462882208556), - FRAC_CONST(0.61845125628220421), - FRAC_CONST(0.61973622796219074), - FRAC_CONST(0.6210195404217892), - FRAC_CONST(0.62230119022518593), - FRAC_CONST(0.62358117394101897), - FRAC_CONST(0.62485948814238634), - FRAC_CONST(0.62613612940685637), - FRAC_CONST(0.62741109431647646), - FRAC_CONST(0.62868437945778133), - FRAC_CONST(0.62995598142180387), - FRAC_CONST(0.6312258968040827), - FRAC_CONST(0.63249412220467238), - FRAC_CONST(0.63376065422815175), - FRAC_CONST(0.63502548948363347), - FRAC_CONST(0.63628862458477287), - FRAC_CONST(0.63755005614977711), - FRAC_CONST(0.63880978080141437), - FRAC_CONST(0.6400677951670225), - FRAC_CONST(0.6413240958785188), - FRAC_CONST(0.64257867957240766), - FRAC_CONST(0.6438315428897915), - FRAC_CONST(0.64508268247637779), - FRAC_CONST(0.64633209498248945), - FRAC_CONST(0.64757977706307335), - FRAC_CONST(0.64882572537770888), - FRAC_CONST(0.65006993659061751), - FRAC_CONST(0.65131240737067142), - FRAC_CONST(0.65255313439140239), - FRAC_CONST(0.65379211433101081), - FRAC_CONST(0.65502934387237444), - FRAC_CONST(0.6562648197030575), - FRAC_CONST(0.65749853851531959), - FRAC_CONST(0.65873049700612374), - FRAC_CONST(0.65996069187714679), - FRAC_CONST(0.66118911983478657), - FRAC_CONST(0.66241577759017178), - FRAC_CONST(0.66364066185917048), - FRAC_CONST(0.66486376936239888), - FRAC_CONST(0.66608509682523009), - FRAC_CONST(0.66730464097780284), - FRAC_CONST(0.66852239855503071), - FRAC_CONST(0.66973836629660977), - FRAC_CONST(0.67095254094702894), - FRAC_CONST(0.67216491925557675), - FRAC_CONST(0.67337549797635199), - FRAC_CONST(0.67458427386827102), - FRAC_CONST(0.67579124369507693), - FRAC_CONST(0.67699640422534846), - FRAC_CONST(0.67819975223250772), - FRAC_CONST(0.6794012844948305), - FRAC_CONST(0.68060099779545302), - FRAC_CONST(0.68179888892238183), - FRAC_CONST(0.6829949546685018), - FRAC_CONST(0.68418919183158522), - FRAC_CONST(0.68538159721429948), - FRAC_CONST(0.6865721676242168), - FRAC_CONST(0.68776089987382172), - FRAC_CONST(0.68894779078052026), - FRAC_CONST(0.69013283716664853), - FRAC_CONST(0.69131603585948032), - FRAC_CONST(0.69249738369123692), - FRAC_CONST(0.69367687749909468), - FRAC_CONST(0.69485451412519361), - FRAC_CONST(0.69603029041664599), - FRAC_CONST(0.6972042032255451), - FRAC_CONST(0.6983762494089728), - FRAC_CONST(0.69954642582900894), - FRAC_CONST(0.70071472935273893), - FRAC_CONST(0.70188115685226271), - FRAC_CONST(0.703045705204703), - FRAC_CONST(0.70420837129221303), - FRAC_CONST(0.70536915200198613), - FRAC_CONST(0.70652804422626281), - FRAC_CONST(0.70768504486233985), - FRAC_CONST(0.70884015081257845), - FRAC_CONST(0.70999335898441229), - FRAC_CONST(0.711144666290356), - FRAC_CONST(0.71229406964801356), - FRAC_CONST(0.71344156598008623), - FRAC_CONST(0.71458715221438096), - FRAC_CONST(0.71573082528381871), - FRAC_CONST(0.71687258212644234), - FRAC_CONST(0.7180124196854254), - FRAC_CONST(0.71915033490907943), - FRAC_CONST(0.72028632475086318), - FRAC_CONST(0.72142038616938997), - FRAC_CONST(0.72255251612843596), - FRAC_CONST(0.72368271159694852), - FRAC_CONST(0.72481096954905444), - FRAC_CONST(0.72593728696406756), - FRAC_CONST(0.72706166082649704), - FRAC_CONST(0.72818408812605595), - FRAC_CONST(0.72930456585766834), - FRAC_CONST(0.73042309102147851), - FRAC_CONST(0.73153966062285747), - FRAC_CONST(0.73265427167241282), - FRAC_CONST(0.73376692118599507), - FRAC_CONST(0.73487760618470677), - FRAC_CONST(0.73598632369490979), - FRAC_CONST(0.73709307074823405), - FRAC_CONST(0.73819784438158409), - FRAC_CONST(0.73930064163714881), - FRAC_CONST(0.74040145956240788), - FRAC_CONST(0.74150029521014049), - FRAC_CONST(0.74259714563843304), - FRAC_CONST(0.74369200791068657), - FRAC_CONST(0.74478487909562552), - FRAC_CONST(0.74587575626730485), - FRAC_CONST(0.74696463650511791), - FRAC_CONST(0.74805151689380456), - FRAC_CONST(0.74913639452345926), - FRAC_CONST(0.75021926648953785), - FRAC_CONST(0.75130012989286621), - FRAC_CONST(0.7523789818396478), - FRAC_CONST(0.75345581944147111), - FRAC_CONST(0.75453063981531809), - FRAC_CONST(0.75560344008357094), - FRAC_CONST(0.75667421737402052), - FRAC_CONST(0.7577429688198738), - FRAC_CONST(0.75880969155976163), - FRAC_CONST(0.75987438273774599), - FRAC_CONST(0.76093703950332836), - FRAC_CONST(0.76199765901145666), - FRAC_CONST(0.76305623842253345), - FRAC_CONST(0.76411277490242291), - FRAC_CONST(0.76516726562245885), - FRAC_CONST(0.76621970775945258), - FRAC_CONST(0.76727009849569949), - FRAC_CONST(0.76831843501898767), - FRAC_CONST(0.76936471452260458), - FRAC_CONST(0.77040893420534517), - FRAC_CONST(0.77145109127151923), - FRAC_CONST(0.77249118293095853), - FRAC_CONST(0.77352920639902467), - FRAC_CONST(0.77456515889661659), - FRAC_CONST(0.77559903765017746), - FRAC_CONST(0.7766308398917029), - FRAC_CONST(0.77766056285874774), - FRAC_CONST(0.77868820379443371), - FRAC_CONST(0.77971375994745684), - FRAC_CONST(0.78073722857209438), - FRAC_CONST(0.7817586069282132), - FRAC_CONST(0.78277789228127592), - FRAC_CONST(0.78379508190234881), - FRAC_CONST(0.78481017306810918), - FRAC_CONST(0.78582316306085265), - FRAC_CONST(0.78683404916849986), - FRAC_CONST(0.78784282868460476), - FRAC_CONST(0.78884949890836087), - FRAC_CONST(0.78985405714460888), - FRAC_CONST(0.7908565007038445), - FRAC_CONST(0.79185682690222425), - FRAC_CONST(0.79285503306157412), - FRAC_CONST(0.79385111650939566), - FRAC_CONST(0.79484507457887377), - FRAC_CONST(0.79583690460888357), - FRAC_CONST(0.79682660394399751), - FRAC_CONST(0.79781416993449272), - FRAC_CONST(0.79879959993635785), - FRAC_CONST(0.7997828913113002), - FRAC_CONST(0.80076404142675273), - FRAC_CONST(0.80174304765588156), - FRAC_CONST(0.80271990737759213), - FRAC_CONST(0.80369461797653707), - FRAC_CONST(0.80466717684312306), - FRAC_CONST(0.80563758137351682), - FRAC_CONST(0.80660582896965372), - FRAC_CONST(0.80757191703924336), - FRAC_CONST(0.80853584299577752), - FRAC_CONST(0.80949760425853612), - FRAC_CONST(0.81045719825259477), - FRAC_CONST(0.81141462240883167), - FRAC_CONST(0.81236987416393436), - FRAC_CONST(0.81332295096040608), - FRAC_CONST(0.81427385024657373), - FRAC_CONST(0.81522256947659355), - FRAC_CONST(0.81616910611045879), - FRAC_CONST(0.817113457614006), - FRAC_CONST(0.81805562145892186), - FRAC_CONST(0.81899559512275044), - FRAC_CONST(0.81993337608889916), - FRAC_CONST(0.82086896184664637), - FRAC_CONST(0.8218023498911472), - FRAC_CONST(0.82273353772344116), - FRAC_CONST(0.82366252285045805), - FRAC_CONST(0.82458930278502529), - FRAC_CONST(0.82551387504587381), - FRAC_CONST(0.82643623715764558), - FRAC_CONST(0.82735638665089983), - FRAC_CONST(0.82827432106211907), - FRAC_CONST(0.82919003793371693), - FRAC_CONST(0.83010353481404364), - FRAC_CONST(0.83101480925739324), - FRAC_CONST(0.83192385882400965), - FRAC_CONST(0.83283068108009373), - FRAC_CONST(0.8337352735978093), - FRAC_CONST(0.83463763395529011), - FRAC_CONST(0.83553775973664579), - FRAC_CONST(0.83643564853196872), - FRAC_CONST(0.83733129793734051), - FRAC_CONST(0.83822470555483797), - FRAC_CONST(0.83911586899254031), - FRAC_CONST(0.84000478586453453), - FRAC_CONST(0.84089145379092289), - FRAC_CONST(0.84177587039782842), - FRAC_CONST(0.84265803331740163), - FRAC_CONST(0.84353794018782702), - FRAC_CONST(0.844415588653329), - FRAC_CONST(0.8452909763641786), - FRAC_CONST(0.84616410097669936), - FRAC_CONST(0.84703496015327406), - FRAC_CONST(0.84790355156235053), - FRAC_CONST(0.84876987287844818), - FRAC_CONST(0.8496339217821639), - FRAC_CONST(0.85049569596017938), - FRAC_CONST(0.85135519310526508), - FRAC_CONST(0.85221241091628896), - FRAC_CONST(0.85306734709822085), - FRAC_CONST(0.85391999936213903), - FRAC_CONST(0.85477036542523732), - FRAC_CONST(0.85561844301082923), - FRAC_CONST(0.85646422984835635), - FRAC_CONST(0.85730772367339259), - FRAC_CONST(0.85814892222765116), - FRAC_CONST(0.85898782325899026), - FRAC_CONST(0.85982442452141961), - FRAC_CONST(0.86065872377510555), - FRAC_CONST(0.86149071878637817), - FRAC_CONST(0.8623204073277364), - FRAC_CONST(0.86314778717785412), - FRAC_CONST(0.8639728561215867), - FRAC_CONST(0.86479561194997623), - FRAC_CONST(0.86561605246025763), - FRAC_CONST(0.86643417545586487), - FRAC_CONST(0.8672499787464365), - FRAC_CONST(0.86806346014782154), - FRAC_CONST(0.8688746174820855), - FRAC_CONST(0.86968344857751589), - FRAC_CONST(0.87048995126862883), - FRAC_CONST(0.87129412339617363), - FRAC_CONST(0.87209596280713941), - FRAC_CONST(0.8728954673547612), - FRAC_CONST(0.87369263489852422), - FRAC_CONST(0.87448746330417149), - FRAC_CONST(0.87527995044370765), - FRAC_CONST(0.8760700941954066), - FRAC_CONST(0.87685789244381551), - FRAC_CONST(0.87764334307976144), - FRAC_CONST(0.87842644400035663), - FRAC_CONST(0.8792071931090043), - FRAC_CONST(0.87998558831540408), - FRAC_CONST(0.88076162753555787), - FRAC_CONST(0.88153530869177488), - FRAC_CONST(0.88230662971267804), - FRAC_CONST(0.88307558853320878), - FRAC_CONST(0.88384218309463292), - FRAC_CONST(0.8846064113445461), - FRAC_CONST(0.88536827123687933), - FRAC_CONST(0.88612776073190425), - FRAC_CONST(0.88688487779623937), - FRAC_CONST(0.88763962040285393), - FRAC_CONST(0.8883919865310751), - FRAC_CONST(0.88914197416659235), - FRAC_CONST(0.88988958130146301), - FRAC_CONST(0.8906348059341177), - FRAC_CONST(0.89137764606936609), - FRAC_CONST(0.89211809971840139), - FRAC_CONST(0.89285616489880615), - FRAC_CONST(0.89359183963455813), - FRAC_CONST(0.89432512195603453), - FRAC_CONST(0.89505600990001799), - FRAC_CONST(0.89578450150970124), - FRAC_CONST(0.8965105948346932), - FRAC_CONST(0.89723428793102367), - FRAC_CONST(0.89795557886114807), - FRAC_CONST(0.89867446569395382), - FRAC_CONST(0.89939094650476448), - FRAC_CONST(0.90010501937534515), - FRAC_CONST(0.900816682393908), - FRAC_CONST(0.90152593365511691), - FRAC_CONST(0.90223277126009283), - FRAC_CONST(0.90293719331641886), - FRAC_CONST(0.90363919793814496), - FRAC_CONST(0.90433878324579353), - FRAC_CONST(0.90503594736636439), - FRAC_CONST(0.90573068843333915), - FRAC_CONST(0.90642300458668679), - FRAC_CONST(0.90711289397286898), - FRAC_CONST(0.90780035474484411), - FRAC_CONST(0.90848538506207266), - FRAC_CONST(0.90916798309052227), - FRAC_CONST(0.90984814700267291), - FRAC_CONST(0.9105258749775208), - FRAC_CONST(0.91120116520058425), - FRAC_CONST(0.91187401586390815), - FRAC_CONST(0.91254442516606893), - FRAC_CONST(0.9132123913121788), - FRAC_CONST(0.91387791251389161), - FRAC_CONST(0.91454098698940678), - FRAC_CONST(0.91520161296347435), - FRAC_CONST(0.91585978866739981), - FRAC_CONST(0.91651551233904871), - FRAC_CONST(0.91716878222285148), - FRAC_CONST(0.91781959656980805), - FRAC_CONST(0.91846795363749245), - FRAC_CONST(0.91911385169005766), - FRAC_CONST(0.9197572889982405), - FRAC_CONST(0.9203982638393654), - FRAC_CONST(0.92103677449734989), - FRAC_CONST(0.92167281926270861), - FRAC_CONST(0.92230639643255874), - FRAC_CONST(0.92293750431062316), - FRAC_CONST(0.92356614120723612), - FRAC_CONST(0.92419230543934783), - FRAC_CONST(0.92481599533052783), - FRAC_CONST(0.92543720921097061), - FRAC_CONST(0.92605594541749991), - FRAC_CONST(0.92667220229357261), - FRAC_CONST(0.92728597818928349), - FRAC_CONST(0.9278972714613698), - FRAC_CONST(0.92850608047321548), - FRAC_CONST(0.9291124035948557), - FRAC_CONST(0.92971623920298097), - FRAC_CONST(0.93031758568094147), - FRAC_CONST(0.93091644141875196), - FRAC_CONST(0.93151280481309506), - FRAC_CONST(0.93210667426732674), - FRAC_CONST(0.93269804819147983), - FRAC_CONST(0.93328692500226818), - FRAC_CONST(0.93387330312309147), - FRAC_CONST(0.93445718098403896), - FRAC_CONST(0.93503855702189376), - FRAC_CONST(0.9356174296801375), - FRAC_CONST(0.93619379740895381), - FRAC_CONST(0.93676765866523259), - FRAC_CONST(0.93733901191257496), - FRAC_CONST(0.93790785562129597), - FRAC_CONST(0.93847418826842988), - FRAC_CONST(0.93903800833773399), - FRAC_CONST(0.93959931431969212), - FRAC_CONST(0.94015810471151917), - FRAC_CONST(0.94071437801716529), - FRAC_CONST(0.94126813274731924), - FRAC_CONST(0.94181936741941319), - FRAC_CONST(0.94236808055762578), - FRAC_CONST(0.94291427069288691), - FRAC_CONST(0.94345793636288133), - FRAC_CONST(0.94399907611205225), - FRAC_CONST(0.9445376884916058), - FRAC_CONST(0.94507377205951448), - FRAC_CONST(0.94560732538052128), - FRAC_CONST(0.94613834702614352), - FRAC_CONST(0.94666683557467624), - FRAC_CONST(0.94719278961119657), - FRAC_CONST(0.94771620772756759), - FRAC_CONST(0.94823708852244104), - FRAC_CONST(0.94875543060126255), - FRAC_CONST(0.94927123257627433), - FRAC_CONST(0.94978449306651924), - FRAC_CONST(0.95029521069784428), - FRAC_CONST(0.9508033841029051), - FRAC_CONST(0.95130901192116835), - FRAC_CONST(0.9518120927989161), - FRAC_CONST(0.95231262538924943), - FRAC_CONST(0.95281060835209208), - FRAC_CONST(0.95330604035419386), - FRAC_CONST(0.95379892006913403), - FRAC_CONST(0.95428924617732525), - FRAC_CONST(0.95477701736601728), - FRAC_CONST(0.95526223232929941), - FRAC_CONST(0.95574488976810545), - FRAC_CONST(0.95622498839021619), - FRAC_CONST(0.95670252691026292), - FRAC_CONST(0.95717750404973156), - FRAC_CONST(0.95764991853696524), - FRAC_CONST(0.95811976910716812), - FRAC_CONST(0.95858705450240911), - FRAC_CONST(0.95905177347162429), - FRAC_CONST(0.95951392477062125), - FRAC_CONST(0.95997350716208196), - FRAC_CONST(0.96043051941556579), - FRAC_CONST(0.96088496030751369), - FRAC_CONST(0.96133682862125036), - FRAC_CONST(0.96178612314698864), - FRAC_CONST(0.96223284268183173), - FRAC_CONST(0.9626769860297768), - FRAC_CONST(0.96311855200171881), - FRAC_CONST(0.96355753941545252), - FRAC_CONST(0.96399394709567654), - FRAC_CONST(0.96442777387399625), - FRAC_CONST(0.96485901858892686), - FRAC_CONST(0.96528768008589627), - FRAC_CONST(0.96571375721724895), - FRAC_CONST(0.96613724884224783), - FRAC_CONST(0.96655815382707866), - FRAC_CONST(0.96697647104485207), - FRAC_CONST(0.96739219937560694), - FRAC_CONST(0.96780533770631338), - FRAC_CONST(0.96821588493087585), - FRAC_CONST(0.9686238399501359), - FRAC_CONST(0.96902920167187501), - FRAC_CONST(0.96943196901081796), - FRAC_CONST(0.96983214088863534), - FRAC_CONST(0.9702297162339466), - FRAC_CONST(0.97062469398232287), - FRAC_CONST(0.97101707307629004), - FRAC_CONST(0.97140685246533098), - FRAC_CONST(0.97179403110588902), - FRAC_CONST(0.97217860796137046), - FRAC_CONST(0.97256058200214734), - FRAC_CONST(0.97293995220556007), - FRAC_CONST(0.97331671755592064), - FRAC_CONST(0.97369087704451474), - FRAC_CONST(0.97406242966960455), - FRAC_CONST(0.97443137443643235), - FRAC_CONST(0.97479771035722163), - FRAC_CONST(0.97516143645118103), - FRAC_CONST(0.97552255174450631), - FRAC_CONST(0.97588105527038305), - FRAC_CONST(0.97623694606898959), - FRAC_CONST(0.97659022318749911), - FRAC_CONST(0.97694088568008242), - FRAC_CONST(0.97728893260791039), - FRAC_CONST(0.97763436303915685), - FRAC_CONST(0.97797717604900047), - FRAC_CONST(0.97831737071962765), - FRAC_CONST(0.97865494614023485), - FRAC_CONST(0.97898990140703124), - FRAC_CONST(0.97932223562324061), - FRAC_CONST(0.97965194789910426), - FRAC_CONST(0.9799790373518833), - FRAC_CONST(0.98030350310586067), - FRAC_CONST(0.98062534429234405), - FRAC_CONST(0.98094456004966768), - FRAC_CONST(0.98126114952319499), - FRAC_CONST(0.98157511186532054), - FRAC_CONST(0.98188644623547261), - FRAC_CONST(0.98219515180011563), - FRAC_CONST(0.98250122773275184), - FRAC_CONST(0.98280467321392362), - FRAC_CONST(0.98310548743121629), - FRAC_CONST(0.98340366957925973), - FRAC_CONST(0.98369921885973044), - FRAC_CONST(0.98399213448135414), - FRAC_CONST(0.98428241565990748), - FRAC_CONST(0.98457006161822058), - FRAC_CONST(0.98485507158617835), - FRAC_CONST(0.98513744480072363), - FRAC_CONST(0.98541718050585803), - FRAC_CONST(0.98569427795264519), - FRAC_CONST(0.98596873639921168), - FRAC_CONST(0.98624055511074971), - FRAC_CONST(0.98650973335951875), - FRAC_CONST(0.98677627042484772), - FRAC_CONST(0.98704016559313645), - FRAC_CONST(0.98730141815785832), - FRAC_CONST(0.98756002741956173), - FRAC_CONST(0.9878159926858715), - FRAC_CONST(0.98806931327149194), - FRAC_CONST(0.98831998849820735), - FRAC_CONST(0.98856801769488489), - FRAC_CONST(0.98881340019747566), - FRAC_CONST(0.98905613534901682), - FRAC_CONST(0.98929622249963345), - FRAC_CONST(0.98953366100653983), - FRAC_CONST(0.98976845023404181), - FRAC_CONST(0.99000058955353776), - FRAC_CONST(0.99023007834352106), - FRAC_CONST(0.99045691598958097), - FRAC_CONST(0.99068110188440506), - FRAC_CONST(0.99090263542778001), - FRAC_CONST(0.99112151602659404), - FRAC_CONST(0.99133774309483769), - FRAC_CONST(0.99155131605360625), - FRAC_CONST(0.99176223433110056), - FRAC_CONST(0.99197049736262888), - FRAC_CONST(0.99217610459060845), - FRAC_CONST(0.99237905546456673), - FRAC_CONST(0.99257934944114334), - FRAC_CONST(0.99277698598409092), - FRAC_CONST(0.99297196456427694), - FRAC_CONST(0.99316428465968509), - FRAC_CONST(0.99335394575541669), - FRAC_CONST(0.99354094734369169), - FRAC_CONST(0.99372528892385081), - FRAC_CONST(0.99390697000235606), - FRAC_CONST(0.99408599009279242), - FRAC_CONST(0.99426234871586938), - FRAC_CONST(0.99443604539942176), - FRAC_CONST(0.99460707967841133), - FRAC_CONST(0.99477545109492771), - FRAC_CONST(0.99494115919819004), - FRAC_CONST(0.99510420354454787), - FRAC_CONST(0.99526458369748239), - FRAC_CONST(0.99542229922760772), - FRAC_CONST(0.99557734971267187), - FRAC_CONST(0.9957297347375581), - FRAC_CONST(0.99587945389428578), - FRAC_CONST(0.99602650678201154), - FRAC_CONST(0.99617089300703077), - FRAC_CONST(0.996312612182778), - FRAC_CONST(0.99645166392982831), - FRAC_CONST(0.99658804787589839), - FRAC_CONST(0.99672176365584741), - FRAC_CONST(0.99685281091167788), - FRAC_CONST(0.99698118929253687), - FRAC_CONST(0.99710689845471678), - FRAC_CONST(0.99722993806165661), - FRAC_CONST(0.99735030778394196), - FRAC_CONST(0.99746800729930707), - FRAC_CONST(0.99758303629263489), - FRAC_CONST(0.99769539445595812), - FRAC_CONST(0.99780508148846014), - FRAC_CONST(0.99791209709647588), - FRAC_CONST(0.99801644099349218), - FRAC_CONST(0.99811811290014918), - FRAC_CONST(0.9982171125442405), - FRAC_CONST(0.9983134396607144), - FRAC_CONST(0.99840709399167404), - FRAC_CONST(0.99849807528637868), - FRAC_CONST(0.99858638330124405), - FRAC_CONST(0.99867201779984294), - FRAC_CONST(0.99875497855290607), - FRAC_CONST(0.99883526533832245), - FRAC_CONST(0.99891287794114036), - FRAC_CONST(0.99898781615356746), - FRAC_CONST(0.99906007977497147), - FRAC_CONST(0.99912966861188113), - FRAC_CONST(0.99919658247798593), - FRAC_CONST(0.99926082119413751), - FRAC_CONST(0.99932238458834954), - FRAC_CONST(0.999381272495798), - FRAC_CONST(0.99943748475882255), - FRAC_CONST(0.9994910212269259), - FRAC_CONST(0.99954188175677483), - FRAC_CONST(0.99959006621220048), - FRAC_CONST(0.99963557446419837), - FRAC_CONST(0.99967840639092931), - FRAC_CONST(0.99971856187771946), - FRAC_CONST(0.99975604081706027), - FRAC_CONST(0.99979084310860955), - FRAC_CONST(0.99982296865919107), - FRAC_CONST(0.99985241738279484), - FRAC_CONST(0.99987918920057806), - FRAC_CONST(0.99990328404086426), - FRAC_CONST(0.9999247018391445), - FRAC_CONST(0.99994344253807688), - FRAC_CONST(0.99995950608748674), - FRAC_CONST(0.99997289244436727), - FRAC_CONST(0.99998360157287902), - FRAC_CONST(0.9999916334443506), - FRAC_CONST(0.99999698803727821), - FRAC_CONST(0.99999966533732598) -}; -#endif - -ALIGN static const real_t sine_short_128[] = -{ - FRAC_CONST(0.0061358846491544753), - FRAC_CONST(0.01840672990580482), - FRAC_CONST(0.030674803176636626), - FRAC_CONST(0.04293825693494082), - FRAC_CONST(0.055195244349689934), - FRAC_CONST(0.067443919563664051), - FRAC_CONST(0.079682437971430126), - FRAC_CONST(0.091908956497132724), - FRAC_CONST(0.10412163387205459), - FRAC_CONST(0.11631863091190475), - FRAC_CONST(0.12849811079379317), - FRAC_CONST(0.14065823933284921), - FRAC_CONST(0.15279718525844344), - FRAC_CONST(0.16491312048996989), - FRAC_CONST(0.17700422041214875), - FRAC_CONST(0.18906866414980619), - FRAC_CONST(0.2011046348420919), - FRAC_CONST(0.21311031991609136), - FRAC_CONST(0.22508391135979283), - FRAC_CONST(0.2370236059943672), - FRAC_CONST(0.24892760574572015), - FRAC_CONST(0.26079411791527551), - FRAC_CONST(0.27262135544994898), - FRAC_CONST(0.28440753721127188), - FRAC_CONST(0.29615088824362379), - FRAC_CONST(0.30784964004153487), - FRAC_CONST(0.31950203081601569), - FRAC_CONST(0.33110630575987643), - FRAC_CONST(0.34266071731199438), - FRAC_CONST(0.35416352542049034), - FRAC_CONST(0.36561299780477385), - FRAC_CONST(0.37700741021641826), - FRAC_CONST(0.38834504669882625), - FRAC_CONST(0.39962419984564679), - FRAC_CONST(0.41084317105790391), - FRAC_CONST(0.42200027079979968), - FRAC_CONST(0.43309381885315196), - FRAC_CONST(0.4441221445704292), - FRAC_CONST(0.45508358712634384), - FRAC_CONST(0.46597649576796618), - FRAC_CONST(0.47679923006332209), - FRAC_CONST(0.487550160148436), - FRAC_CONST(0.49822766697278187), - FRAC_CONST(0.50883014254310699), - FRAC_CONST(0.51935599016558964), - FRAC_CONST(0.52980362468629461), - FRAC_CONST(0.54017147272989285), - FRAC_CONST(0.55045797293660481), - FRAC_CONST(0.56066157619733603), - FRAC_CONST(0.57078074588696726), - FRAC_CONST(0.58081395809576453), - FRAC_CONST(0.59075970185887416), - FRAC_CONST(0.60061647938386897), - FRAC_CONST(0.61038280627630948), - FRAC_CONST(0.6200572117632891), - FRAC_CONST(0.62963823891492698), - FRAC_CONST(0.63912444486377573), - FRAC_CONST(0.64851440102211244), - FRAC_CONST(0.65780669329707864), - FRAC_CONST(0.66699992230363747), - FRAC_CONST(0.67609270357531592), - FRAC_CONST(0.68508366777270036), - FRAC_CONST(0.693971460889654), - FRAC_CONST(0.7027547444572253), - FRAC_CONST(0.71143219574521643), - FRAC_CONST(0.72000250796138165), - FRAC_CONST(0.7284643904482252), - FRAC_CONST(0.73681656887736979), - FRAC_CONST(0.74505778544146595), - FRAC_CONST(0.75318679904361241), - FRAC_CONST(0.76120238548426178), - FRAC_CONST(0.76910333764557959), - FRAC_CONST(0.77688846567323244), - FRAC_CONST(0.78455659715557524), - FRAC_CONST(0.79210657730021239), - FRAC_CONST(0.79953726910790501), - FRAC_CONST(0.80684755354379922), - FRAC_CONST(0.8140363297059483), - FRAC_CONST(0.82110251499110465), - FRAC_CONST(0.8280450452577558), - FRAC_CONST(0.83486287498638001), - FRAC_CONST(0.84155497743689833), - FRAC_CONST(0.84812034480329712), - FRAC_CONST(0.85455798836540053), - FRAC_CONST(0.86086693863776731), - FRAC_CONST(0.86704624551569265), - FRAC_CONST(0.87309497841829009), - FRAC_CONST(0.87901222642863341), - FRAC_CONST(0.88479709843093779), - FRAC_CONST(0.89044872324475788), - FRAC_CONST(0.89596624975618511), - FRAC_CONST(0.90134884704602203), - FRAC_CONST(0.90659570451491533), - FRAC_CONST(0.91170603200542988), - FRAC_CONST(0.9166790599210427), - FRAC_CONST(0.9215140393420419), - FRAC_CONST(0.92621024213831127), - FRAC_CONST(0.93076696107898371), - FRAC_CONST(0.9351835099389475), - FRAC_CONST(0.93945922360218992), - FRAC_CONST(0.94359345816196039), - FRAC_CONST(0.94758559101774109), - FRAC_CONST(0.95143502096900834), - FRAC_CONST(0.95514116830577067), - FRAC_CONST(0.9587034748958716), - FRAC_CONST(0.96212140426904158), - FRAC_CONST(0.9653944416976894), - FRAC_CONST(0.96852209427441727), - FRAC_CONST(0.97150389098625178), - FRAC_CONST(0.97433938278557586), - FRAC_CONST(0.97702814265775439), - FRAC_CONST(0.97956976568544052), - FRAC_CONST(0.98196386910955524), - FRAC_CONST(0.98421009238692903), - FRAC_CONST(0.98630809724459867), - FRAC_CONST(0.98825756773074946), - FRAC_CONST(0.99005821026229712), - FRAC_CONST(0.99170975366909953), - FRAC_CONST(0.9932119492347945), - FRAC_CONST(0.99456457073425542), - FRAC_CONST(0.99576741446765982), - FRAC_CONST(0.99682029929116567), - FRAC_CONST(0.99772306664419164), - FRAC_CONST(0.99847558057329477), - FRAC_CONST(0.99907772775264536), - FRAC_CONST(0.99952941750109314), - FRAC_CONST(0.9998305817958234), - FRAC_CONST(0.99998117528260111) -}; - -#ifdef ALLOW_SMALL_FRAMELENGTH -ALIGN static const real_t sine_short_120[] = -{ - FRAC_CONST(0.0065449379673518581), - FRAC_CONST(0.019633692460628301), - FRAC_CONST(0.032719082821776137), - FRAC_CONST(0.045798866936520771), - FRAC_CONST(0.058870803651189033), - FRAC_CONST(0.071932653156719387), - FRAC_CONST(0.084982177372441667), - FRAC_CONST(0.09801714032956059), - FRAC_CONST(0.11103530855427769), - FRAC_CONST(0.12403445145048532), - FRAC_CONST(0.13701234168196802), - FRAC_CONST(0.14996675555404498), - FRAC_CONST(0.16289547339458874), - FRAC_CONST(0.17579627993435451), - FRAC_CONST(0.18866696468655525), - FRAC_CONST(0.2015053223256171), - FRAC_CONST(0.21430915306505074), - FRAC_CONST(0.2270762630343732), - FRAC_CONST(0.23980446465501654), - FRAC_CONST(0.25249157701515795), - FRAC_CONST(0.26513542624340797), - FRAC_CONST(0.27773384588129219), - FRAC_CONST(0.29028467725446233), - FRAC_CONST(0.3027857698425746), - FRAC_CONST(0.31523498164776964), - FRAC_CONST(0.32763017956169349), - FRAC_CONST(0.33996923973099424), - FRAC_CONST(0.35225004792123354), - FRAC_CONST(0.36447049987914965), - FRAC_CONST(0.37662850169321077), - FRAC_CONST(0.38872197015239557), - FRAC_CONST(0.40074883310314097), - FRAC_CONST(0.41270702980439467), - FRAC_CONST(0.42459451128071307), - FRAC_CONST(0.43640924067334208), - FRAC_CONST(0.44814919358922256), - FRAC_CONST(0.45981235844785984), - FRAC_CONST(0.47139673682599764), - FRAC_CONST(0.48290034380003727), - FRAC_CONST(0.49432120828614462), - FRAC_CONST(0.50565737337798455), - FRAC_CONST(0.51690689668202761), - FRAC_CONST(0.52806785065036799), - FRAC_CONST(0.53913832291100017), - FRAC_CONST(0.55011641659549337), - FRAC_CONST(0.56100025066400983), - FRAC_CONST(0.57178796022761225), - FRAC_CONST(0.58247769686780215), - FRAC_CONST(0.59306762895323706), - FRAC_CONST(0.60355594195357143), - FRAC_CONST(0.61394083875036642), - FRAC_CONST(0.62422053994501758), - FRAC_CONST(0.63439328416364549), - FRAC_CONST(0.64445732835889735), - FRAC_CONST(0.65441094810861034), - FRAC_CONST(0.66425243791128175), - FRAC_CONST(0.67398011147829784), - FRAC_CONST(0.68359230202287125), - FRAC_CONST(0.69308736254563585), - FRAC_CONST(0.70246366611685174), - FRAC_CONST(0.71171960615517138), - FRAC_CONST(0.72085359670291882), - FRAC_CONST(0.7298640726978356), - FRAC_CONST(0.73874949024124625), - FRAC_CONST(0.74750832686259672), - FRAC_CONST(0.75613908178032285), - FRAC_CONST(0.76464027615900032), - FRAC_CONST(0.77301045336273699), - FRAC_CONST(0.78124817920475853), - FRAC_CONST(0.78935204219315003), - FRAC_CONST(0.79732065377270711), - FRAC_CONST(0.80515264856285829), - FRAC_CONST(0.81284668459161513), - FRAC_CONST(0.82040144352551359), - FRAC_CONST(0.82781563089550203), - FRAC_CONST(0.83508797631874299), - FRAC_CONST(0.84221723371628654), - FRAC_CONST(0.84920218152657889), - FRAC_CONST(0.85604162291477137), - FRAC_CONST(0.86273438597779184), - FRAC_CONST(0.86927932394514362), - FRAC_CONST(0.87567531537539967), - FRAC_CONST(0.88192126434835494), - FRAC_CONST(0.88801610065280734), - FRAC_CONST(0.89395877996993212), - FRAC_CONST(0.8997482840522214), - FRAC_CONST(0.90538362089795521), - FRAC_CONST(0.91086382492117568), - FRAC_CONST(0.91618795711713596), - FRAC_CONST(0.92135510522319242), - FRAC_CONST(0.9263643838751181), - FRAC_CONST(0.93121493475880346), - FRAC_CONST(0.93590592675732565), - FRAC_CONST(0.94043655609335486), - FRAC_CONST(0.94480604646687805), - FRAC_CONST(0.94901364918821385), - FRAC_CONST(0.95305864330629697), - FRAC_CONST(0.95694033573220882), - FRAC_CONST(0.9606580613579353), - FRAC_CONST(0.96421118317032928), - FRAC_CONST(0.96759909236025976), - FRAC_CONST(0.9708212084269281), - FRAC_CONST(0.97387697927733363), - FRAC_CONST(0.97676588132087239), - FRAC_CONST(0.97948741955905139), - FRAC_CONST(0.98204112767030394), - FRAC_CONST(0.98442656808989171), - FRAC_CONST(0.98664333208487898), - FRAC_CONST(0.98869103982416728), - FRAC_CONST(0.99056934044357725), - FRAC_CONST(0.99227791210596705), - FRAC_CONST(0.99381646205637808), - FRAC_CONST(0.99518472667219682), - FRAC_CONST(0.99638247150832537), - FRAC_CONST(0.99740949133735191), - FRAC_CONST(0.99826561018471593), - FRAC_CONST(0.99895068135886012), - FRAC_CONST(0.99946458747636568), - FRAC_CONST(0.99980724048206482), - FRAC_CONST(0.99997858166412923) -}; -#endif - -#ifdef LD_DEC -ALIGN static const real_t sine_mid_512[] = -{ - FRAC_CONST(0.0015339801862847655), - FRAC_CONST(0.0046019261204485705), - FRAC_CONST(0.007669828739531097), - FRAC_CONST(0.010737659167264491), - FRAC_CONST(0.013805388528060391), - FRAC_CONST(0.01687298794728171), - FRAC_CONST(0.019940428551514441), - FRAC_CONST(0.023007681468839369), - FRAC_CONST(0.026074717829103901), - FRAC_CONST(0.029141508764193722), - FRAC_CONST(0.032208025408304586), - FRAC_CONST(0.035274238898213947), - FRAC_CONST(0.038340120373552694), - FRAC_CONST(0.041405640977076739), - FRAC_CONST(0.044470771854938668), - FRAC_CONST(0.047535484156959303), - FRAC_CONST(0.050599749036899282), - FRAC_CONST(0.05366353765273052), - FRAC_CONST(0.056726821166907748), - FRAC_CONST(0.059789570746639868), - FRAC_CONST(0.062851757564161406), - FRAC_CONST(0.065913352797003805), - FRAC_CONST(0.068974327628266746), - FRAC_CONST(0.072034653246889332), - FRAC_CONST(0.075094300847921305), - FRAC_CONST(0.078153241632794232), - FRAC_CONST(0.081211446809592441), - FRAC_CONST(0.084268887593324071), - FRAC_CONST(0.087325535206192059), - FRAC_CONST(0.090381360877864983), - FRAC_CONST(0.093436335845747787), - FRAC_CONST(0.096490431355252593), - FRAC_CONST(0.099543618660069319), - FRAC_CONST(0.10259586902243628), - FRAC_CONST(0.10564715371341062), - FRAC_CONST(0.10869744401313872), - FRAC_CONST(0.11174671121112659), - FRAC_CONST(0.11479492660651008), - FRAC_CONST(0.11784206150832498), - FRAC_CONST(0.12088808723577708), - FRAC_CONST(0.12393297511851216), - FRAC_CONST(0.12697669649688587), - FRAC_CONST(0.13001922272223335), - FRAC_CONST(0.13306052515713906), - FRAC_CONST(0.1361005751757062), - FRAC_CONST(0.1391393441638262), - FRAC_CONST(0.14217680351944803), - FRAC_CONST(0.14521292465284746), - FRAC_CONST(0.14824767898689603), - FRAC_CONST(0.15128103795733022), - FRAC_CONST(0.1543129730130201), - FRAC_CONST(0.15734345561623825), - FRAC_CONST(0.16037245724292828), - FRAC_CONST(0.16339994938297323), - FRAC_CONST(0.1664259035404641), - FRAC_CONST(0.16945029123396796), - FRAC_CONST(0.17247308399679595), - FRAC_CONST(0.17549425337727143), - FRAC_CONST(0.17851377093899751), - FRAC_CONST(0.18153160826112497), - FRAC_CONST(0.18454773693861962), - FRAC_CONST(0.1875621285825296), - FRAC_CONST(0.19057475482025274), - FRAC_CONST(0.19358558729580361), - FRAC_CONST(0.19659459767008022), - FRAC_CONST(0.19960175762113097), - FRAC_CONST(0.20260703884442113), - FRAC_CONST(0.20561041305309924), - FRAC_CONST(0.20861185197826349), - FRAC_CONST(0.21161132736922755), - FRAC_CONST(0.21460881099378676), - FRAC_CONST(0.21760427463848364), - FRAC_CONST(0.22059769010887351), - FRAC_CONST(0.22358902922978999), - FRAC_CONST(0.22657826384561), - FRAC_CONST(0.22956536582051887), - FRAC_CONST(0.23255030703877524), - FRAC_CONST(0.23553305940497549), - FRAC_CONST(0.23851359484431842), - FRAC_CONST(0.24149188530286933), - FRAC_CONST(0.24446790274782415), - FRAC_CONST(0.24744161916777327), - FRAC_CONST(0.25041300657296522), - FRAC_CONST(0.25338203699557016), - FRAC_CONST(0.25634868248994291), - FRAC_CONST(0.25931291513288623), - FRAC_CONST(0.26227470702391359), - FRAC_CONST(0.26523403028551179), - FRAC_CONST(0.26819085706340318), - FRAC_CONST(0.27114515952680801), - FRAC_CONST(0.27409690986870638), - FRAC_CONST(0.2770460803060999), - FRAC_CONST(0.27999264308027322), - FRAC_CONST(0.28293657045705539), - FRAC_CONST(0.28587783472708062), - FRAC_CONST(0.28881640820604948), - FRAC_CONST(0.29175226323498926), - FRAC_CONST(0.29468537218051433), - FRAC_CONST(0.2976157074350862), - FRAC_CONST(0.30054324141727345), - FRAC_CONST(0.30346794657201132), - FRAC_CONST(0.30638979537086092), - FRAC_CONST(0.30930876031226873), - FRAC_CONST(0.31222481392182488), - FRAC_CONST(0.31513792875252244), - FRAC_CONST(0.31804807738501495), - FRAC_CONST(0.32095523242787521), - FRAC_CONST(0.32385936651785285), - FRAC_CONST(0.32676045232013173), - FRAC_CONST(0.32965846252858749), - FRAC_CONST(0.33255336986604422), - FRAC_CONST(0.3354451470845316), - FRAC_CONST(0.33833376696554113), - FRAC_CONST(0.34121920232028236), - FRAC_CONST(0.34410142598993881), - FRAC_CONST(0.34698041084592368), - FRAC_CONST(0.34985612979013492), - FRAC_CONST(0.35272855575521073), - FRAC_CONST(0.35559766170478385), - FRAC_CONST(0.35846342063373654), - FRAC_CONST(0.36132580556845428), - FRAC_CONST(0.36418478956707989), - FRAC_CONST(0.36704034571976718), - FRAC_CONST(0.3698924471489341), - FRAC_CONST(0.37274106700951576), - FRAC_CONST(0.37558617848921722), - FRAC_CONST(0.37842775480876556), - FRAC_CONST(0.38126576922216238), - FRAC_CONST(0.38410019501693504), - FRAC_CONST(0.38693100551438858), - FRAC_CONST(0.38975817406985641), - FRAC_CONST(0.39258167407295147), - FRAC_CONST(0.39540147894781635), - FRAC_CONST(0.39821756215337356), - FRAC_CONST(0.40102989718357562), - FRAC_CONST(0.40383845756765407), - FRAC_CONST(0.40664321687036903), - FRAC_CONST(0.40944414869225759), - FRAC_CONST(0.41224122666988289), - FRAC_CONST(0.41503442447608163), - FRAC_CONST(0.41782371582021227), - FRAC_CONST(0.42060907444840251), - FRAC_CONST(0.42339047414379605), - FRAC_CONST(0.42616788872679962), - FRAC_CONST(0.42894129205532949), - FRAC_CONST(0.43171065802505726), - FRAC_CONST(0.43447596056965565), - FRAC_CONST(0.43723717366104409), - FRAC_CONST(0.43999427130963326), - FRAC_CONST(0.44274722756457002), - FRAC_CONST(0.44549601651398174), - FRAC_CONST(0.44824061228521989), - FRAC_CONST(0.45098098904510386), - FRAC_CONST(0.45371712100016387), - FRAC_CONST(0.45644898239688392), - FRAC_CONST(0.45917654752194409), - FRAC_CONST(0.46189979070246273), - FRAC_CONST(0.46461868630623782), - FRAC_CONST(0.46733320874198842), - FRAC_CONST(0.47004333245959562), - FRAC_CONST(0.47274903195034279), - FRAC_CONST(0.47545028174715587), - FRAC_CONST(0.47814705642484301), - FRAC_CONST(0.48083933060033396), - FRAC_CONST(0.48352707893291874), - FRAC_CONST(0.48621027612448642), - FRAC_CONST(0.48888889691976317), - FRAC_CONST(0.4915629161065499), - FRAC_CONST(0.49423230851595967), - FRAC_CONST(0.49689704902265447), - FRAC_CONST(0.49955711254508184), - FRAC_CONST(0.50221247404571079), - FRAC_CONST(0.50486310853126759), - FRAC_CONST(0.50750899105297087), - FRAC_CONST(0.51015009670676681), - FRAC_CONST(0.51278640063356296), - FRAC_CONST(0.51541787801946293), - FRAC_CONST(0.51804450409599934), - FRAC_CONST(0.52066625414036716), - FRAC_CONST(0.52328310347565643), - FRAC_CONST(0.52589502747108463), - FRAC_CONST(0.52850200154222848), - FRAC_CONST(0.531104001151255), - FRAC_CONST(0.53370100180715296), - FRAC_CONST(0.53629297906596318), - FRAC_CONST(0.53887990853100842), - FRAC_CONST(0.54146176585312344), - FRAC_CONST(0.54403852673088382), - FRAC_CONST(0.54661016691083486), - FRAC_CONST(0.54917666218771966), - FRAC_CONST(0.55173798840470734), - FRAC_CONST(0.55429412145362), - FRAC_CONST(0.5568450372751601), - FRAC_CONST(0.55939071185913614), - FRAC_CONST(0.56193112124468947), - FRAC_CONST(0.5644662415205195), - FRAC_CONST(0.56699604882510868), - FRAC_CONST(0.56952051934694714), - FRAC_CONST(0.57203962932475705), - FRAC_CONST(0.57455335504771576), - FRAC_CONST(0.57706167285567944), - FRAC_CONST(0.57956455913940563), - FRAC_CONST(0.58206199034077544), - FRAC_CONST(0.58455394295301533), - FRAC_CONST(0.58704039352091797), - FRAC_CONST(0.58952131864106394), - FRAC_CONST(0.59199669496204099), - FRAC_CONST(0.59446649918466443), - FRAC_CONST(0.5969307080621965), - FRAC_CONST(0.59938929840056454), - FRAC_CONST(0.60184224705858003), - FRAC_CONST(0.60428953094815596), - FRAC_CONST(0.60673112703452448), - FRAC_CONST(0.60916701233645321), - FRAC_CONST(0.61159716392646191), - FRAC_CONST(0.61402155893103838), - FRAC_CONST(0.61644017453085365), - FRAC_CONST(0.61885298796097632), - FRAC_CONST(0.62125997651108755), - FRAC_CONST(0.62366111752569453), - FRAC_CONST(0.62605638840434352), - FRAC_CONST(0.62844576660183271), - FRAC_CONST(0.63082922962842447), - FRAC_CONST(0.63320675505005719), - FRAC_CONST(0.63557832048855611), - FRAC_CONST(0.63794390362184406), - FRAC_CONST(0.64030348218415167), - FRAC_CONST(0.64265703396622686), - FRAC_CONST(0.64500453681554393), - FRAC_CONST(0.64734596863651206), - FRAC_CONST(0.64968130739068319), - FRAC_CONST(0.6520105310969595), - FRAC_CONST(0.65433361783180044), - FRAC_CONST(0.65665054572942894), - FRAC_CONST(0.65896129298203732), - FRAC_CONST(0.66126583783999227), - FRAC_CONST(0.66356415861203977), - FRAC_CONST(0.66585623366550972), - FRAC_CONST(0.66814204142651845), - FRAC_CONST(0.67042156038017309), - FRAC_CONST(0.67269476907077286), - FRAC_CONST(0.67496164610201193), - FRAC_CONST(0.67722217013718033), - FRAC_CONST(0.67947631989936497), - FRAC_CONST(0.68172407417164971), - FRAC_CONST(0.6839654117973154), - FRAC_CONST(0.68620031168003859), - FRAC_CONST(0.68842875278409044), - FRAC_CONST(0.6906507141345346), - FRAC_CONST(0.69286617481742463), - FRAC_CONST(0.69507511398000088), - FRAC_CONST(0.69727751083088652), - FRAC_CONST(0.69947334464028377), - FRAC_CONST(0.70166259474016845), - FRAC_CONST(0.70384524052448494), - FRAC_CONST(0.70602126144933974), - FRAC_CONST(0.70819063703319529), - FRAC_CONST(0.71035334685706231), - FRAC_CONST(0.71250937056469232), - FRAC_CONST(0.71465868786276898), - FRAC_CONST(0.71680127852109954), - FRAC_CONST(0.71893712237280438), - FRAC_CONST(0.72106619931450811), - FRAC_CONST(0.72318848930652735), - FRAC_CONST(0.72530397237306066), - FRAC_CONST(0.72741262860237577), - FRAC_CONST(0.7295144381469969), - FRAC_CONST(0.73160938122389252), - FRAC_CONST(0.73369743811466026), - FRAC_CONST(0.73577858916571348), - FRAC_CONST(0.73785281478846598), - FRAC_CONST(0.73992009545951609), - FRAC_CONST(0.74198041172083096), - FRAC_CONST(0.74403374417992918), - FRAC_CONST(0.74608007351006378), - FRAC_CONST(0.74811938045040349), - FRAC_CONST(0.75015164580621496), - FRAC_CONST(0.7521768504490427), - FRAC_CONST(0.75419497531688917), - FRAC_CONST(0.75620600141439454), - FRAC_CONST(0.75820990981301528), - FRAC_CONST(0.76020668165120242), - FRAC_CONST(0.7621962981345789), - FRAC_CONST(0.76417874053611667), - FRAC_CONST(0.76615399019631281), - FRAC_CONST(0.76812202852336531), - FRAC_CONST(0.7700828369933479), - FRAC_CONST(0.77203639715038441), - FRAC_CONST(0.77398269060682279), - FRAC_CONST(0.77592169904340758), - FRAC_CONST(0.77785340420945304), - FRAC_CONST(0.77977778792301444), - FRAC_CONST(0.78169483207105939), - FRAC_CONST(0.7836045186096382), - FRAC_CONST(0.78550682956405393), - FRAC_CONST(0.78740174702903132), - FRAC_CONST(0.78928925316888565), - FRAC_CONST(0.79116933021769009), - FRAC_CONST(0.79304196047944364), - FRAC_CONST(0.79490712632823701), - FRAC_CONST(0.79676481020841872), - FRAC_CONST(0.79861499463476082), - FRAC_CONST(0.80045766219262271), - FRAC_CONST(0.80229279553811572), - FRAC_CONST(0.8041203773982657), - FRAC_CONST(0.80594039057117628), - FRAC_CONST(0.80775281792619036), - FRAC_CONST(0.80955764240405126), - FRAC_CONST(0.81135484701706373), - FRAC_CONST(0.81314441484925359), - FRAC_CONST(0.81492632905652662), - FRAC_CONST(0.81670057286682785), - FRAC_CONST(0.81846712958029866), - FRAC_CONST(0.82022598256943469), - FRAC_CONST(0.82197711527924155), - FRAC_CONST(0.82372051122739132), - FRAC_CONST(0.82545615400437744), - FRAC_CONST(0.82718402727366902), - FRAC_CONST(0.82890411477186487), - FRAC_CONST(0.8306164003088462), - FRAC_CONST(0.83232086776792968), - FRAC_CONST(0.83401750110601813), - FRAC_CONST(0.8357062843537526), - FRAC_CONST(0.83738720161566194), - FRAC_CONST(0.83906023707031263), - FRAC_CONST(0.84072537497045807), - FRAC_CONST(0.84238259964318596), - FRAC_CONST(0.84403189549006641), - FRAC_CONST(0.84567324698729907), - FRAC_CONST(0.84730663868585832), - FRAC_CONST(0.84893205521163961), - FRAC_CONST(0.85054948126560337), - FRAC_CONST(0.85215890162391983), - FRAC_CONST(0.8537603011381113), - FRAC_CONST(0.85535366473519603), - FRAC_CONST(0.85693897741782865), - FRAC_CONST(0.85851622426444274), - FRAC_CONST(0.86008539042939014), - FRAC_CONST(0.8616464611430813), - FRAC_CONST(0.86319942171212416), - FRAC_CONST(0.86474425751946238), - FRAC_CONST(0.86628095402451299), - FRAC_CONST(0.86780949676330321), - FRAC_CONST(0.86932987134860673), - FRAC_CONST(0.87084206347007886), - FRAC_CONST(0.87234605889439154), - FRAC_CONST(0.87384184346536675), - FRAC_CONST(0.87532940310411078), - FRAC_CONST(0.87680872380914576), - FRAC_CONST(0.87827979165654146), - FRAC_CONST(0.87974259280004741), - FRAC_CONST(0.88119711347122198), - FRAC_CONST(0.88264333997956279), - FRAC_CONST(0.88408125871263499), - FRAC_CONST(0.88551085613619995), - FRAC_CONST(0.88693211879434208), - FRAC_CONST(0.88834503330959624), - FRAC_CONST(0.88974958638307289), - FRAC_CONST(0.89114576479458318), - FRAC_CONST(0.89253355540276469), - FRAC_CONST(0.89391294514520325), - FRAC_CONST(0.89528392103855758), - FRAC_CONST(0.89664647017868015), - FRAC_CONST(0.89800057974073988), - FRAC_CONST(0.89934623697934146), - FRAC_CONST(0.90068342922864686), - FRAC_CONST(0.90201214390249307), - FRAC_CONST(0.90333236849451182), - FRAC_CONST(0.90464409057824624), - FRAC_CONST(0.90594729780726846), - FRAC_CONST(0.90724197791529593), - FRAC_CONST(0.90852811871630612), - FRAC_CONST(0.90980570810465222), - FRAC_CONST(0.91107473405517625), - FRAC_CONST(0.91233518462332275), - FRAC_CONST(0.91358704794525081), - FRAC_CONST(0.91483031223794609), - FRAC_CONST(0.91606496579933161), - FRAC_CONST(0.91729099700837791), - FRAC_CONST(0.91850839432521225), - FRAC_CONST(0.91971714629122736), - FRAC_CONST(0.92091724152918952), - FRAC_CONST(0.92210866874334507), - FRAC_CONST(0.92329141671952764), - FRAC_CONST(0.9244654743252626), - FRAC_CONST(0.92563083050987272), - FRAC_CONST(0.92678747430458175), - FRAC_CONST(0.92793539482261789), - FRAC_CONST(0.92907458125931575), - FRAC_CONST(0.93020502289221907), - FRAC_CONST(0.93132670908118043), - FRAC_CONST(0.93243962926846236), - FRAC_CONST(0.93354377297883617), - FRAC_CONST(0.93463912981968078), - FRAC_CONST(0.93572568948108037), - FRAC_CONST(0.93680344173592156), - FRAC_CONST(0.93787237643998989), - FRAC_CONST(0.93893248353206449), - FRAC_CONST(0.93998375303401394), - FRAC_CONST(0.94102617505088926), - FRAC_CONST(0.94205973977101731), - FRAC_CONST(0.94308443746609349), - FRAC_CONST(0.94410025849127266), - FRAC_CONST(0.94510719328526061), - FRAC_CONST(0.94610523237040334), - FRAC_CONST(0.94709436635277722), - FRAC_CONST(0.94807458592227623), - FRAC_CONST(0.94904588185270056), - FRAC_CONST(0.950008245001843), - FRAC_CONST(0.95096166631157508), - FRAC_CONST(0.95190613680793223), - FRAC_CONST(0.95284164760119872), - FRAC_CONST(0.95376818988599033), - FRAC_CONST(0.95468575494133834), - FRAC_CONST(0.95559433413077111), - FRAC_CONST(0.95649391890239499), - FRAC_CONST(0.95738450078897586), - FRAC_CONST(0.95826607140801767), - FRAC_CONST(0.95913862246184189), - FRAC_CONST(0.96000214573766585), - FRAC_CONST(0.96085663310767966), - FRAC_CONST(0.96170207652912254), - FRAC_CONST(0.96253846804435916), - FRAC_CONST(0.96336579978095405), - FRAC_CONST(0.96418406395174572), - FRAC_CONST(0.96499325285492032), - FRAC_CONST(0.96579335887408357), - FRAC_CONST(0.96658437447833312), - FRAC_CONST(0.96736629222232851), - FRAC_CONST(0.96813910474636233), - FRAC_CONST(0.96890280477642887), - FRAC_CONST(0.96965738512429245), - FRAC_CONST(0.9704028386875555), - FRAC_CONST(0.97113915844972509), - FRAC_CONST(0.9718663374802794), - FRAC_CONST(0.97258436893473221), - FRAC_CONST(0.97329324605469825), - FRAC_CONST(0.97399296216795583), - FRAC_CONST(0.97468351068851067), - FRAC_CONST(0.97536488511665687), - FRAC_CONST(0.97603707903903902), - FRAC_CONST(0.97670008612871184), - FRAC_CONST(0.97735390014519996), - FRAC_CONST(0.97799851493455714), - FRAC_CONST(0.9786339244294231), - FRAC_CONST(0.97926012264908202), - FRAC_CONST(0.97987710369951764), - FRAC_CONST(0.98048486177346938), - FRAC_CONST(0.98108339115048659), - FRAC_CONST(0.98167268619698311), - FRAC_CONST(0.98225274136628937), - FRAC_CONST(0.98282355119870524), - FRAC_CONST(0.98338511032155118), - FRAC_CONST(0.98393741344921892), - FRAC_CONST(0.98448045538322093), - FRAC_CONST(0.98501423101223984), - FRAC_CONST(0.98553873531217606), - FRAC_CONST(0.98605396334619544), - FRAC_CONST(0.98655991026477541), - FRAC_CONST(0.98705657130575097), - FRAC_CONST(0.98754394179435923), - FRAC_CONST(0.98802201714328353), - FRAC_CONST(0.98849079285269659), - FRAC_CONST(0.98895026451030299), - FRAC_CONST(0.98940042779138038), - FRAC_CONST(0.98984127845882053), - FRAC_CONST(0.99027281236316911), - FRAC_CONST(0.99069502544266463), - FRAC_CONST(0.99110791372327678), - FRAC_CONST(0.9915114733187439), - FRAC_CONST(0.99190570043060933), - FRAC_CONST(0.99229059134825737), - FRAC_CONST(0.99266614244894802), - FRAC_CONST(0.99303235019785141), - FRAC_CONST(0.99338921114808065), - FRAC_CONST(0.9937367219407246), - FRAC_CONST(0.99407487930487937), - FRAC_CONST(0.9944036800576791), - FRAC_CONST(0.9947231211043257), - FRAC_CONST(0.99503319943811863), - FRAC_CONST(0.99533391214048228), - FRAC_CONST(0.99562525638099431), - FRAC_CONST(0.99590722941741172), - FRAC_CONST(0.99617982859569687), - FRAC_CONST(0.99644305135004263), - FRAC_CONST(0.99669689520289606), - FRAC_CONST(0.99694135776498216), - FRAC_CONST(0.99717643673532619), - FRAC_CONST(0.9974021299012753), - FRAC_CONST(0.99761843513851955), - FRAC_CONST(0.99782535041111164), - FRAC_CONST(0.99802287377148624), - FRAC_CONST(0.99821100336047819), - FRAC_CONST(0.99838973740734016), - FRAC_CONST(0.99855907422975931), - FRAC_CONST(0.99871901223387294), - FRAC_CONST(0.99886954991428356), - FRAC_CONST(0.99901068585407338), - FRAC_CONST(0.99914241872481691), - FRAC_CONST(0.99926474728659442), - FRAC_CONST(0.99937767038800285), - FRAC_CONST(0.99948118696616695), - FRAC_CONST(0.99957529604674922), - FRAC_CONST(0.99965999674395922), - FRAC_CONST(0.99973528826056168), - FRAC_CONST(0.99980116988788426), - FRAC_CONST(0.99985764100582386), - FRAC_CONST(0.9999047010828529), - FRAC_CONST(0.99994234967602391), - FRAC_CONST(0.99997058643097414), - FRAC_CONST(0.9999894110819284), - FRAC_CONST(0.99999882345170188) -}; - -#ifdef ALLOW_SMALL_FRAMELENGTH -ALIGN static const real_t sine_mid_480[] = -{ - FRAC_CONST(0.0016362454436240478), - FRAC_CONST(0.00490871880799799), - FRAC_CONST(0.0081811396039371282), - FRAC_CONST(0.011453472786443779), - FRAC_CONST(0.014725683311458524), - FRAC_CONST(0.017997736136235509), - FRAC_CONST(0.021269596219717739), - FRAC_CONST(0.024541228522912285), - FRAC_CONST(0.027812598009265607), - FRAC_CONST(0.03108366964503869), - FRAC_CONST(0.034354408399682276), - FRAC_CONST(0.037624779246211978), - FRAC_CONST(0.04089474716158345), - FRAC_CONST(0.044164277127067358), - FRAC_CONST(0.047433334128624507), - FRAC_CONST(0.050701883157280733), - FRAC_CONST(0.053969889209501881), - FRAC_CONST(0.057237317287568618), - FRAC_CONST(0.060504132399951269), - FRAC_CONST(0.063770299561684493), - FRAC_CONST(0.06703578379474201), - FRAC_CONST(0.070300550128411174), - FRAC_CONST(0.073564563599667426), - FRAC_CONST(0.076827789253548759), - FRAC_CONST(0.080090192143530081), - FRAC_CONST(0.083351737331897449), - FRAC_CONST(0.086612389890122182), - FRAC_CONST(0.089872114899234967), - FRAC_CONST(0.093130877450199795), - FRAC_CONST(0.096388642644287828), - FRAC_CONST(0.09964537559345106), - FRAC_CONST(0.1029010414206961), - FRAC_CONST(0.10615560526045748), - FRAC_CONST(0.10940903225897117), - FRAC_CONST(0.11266128757464781), - FRAC_CONST(0.11591233637844581), - FRAC_CONST(0.11916214385424433), - FRAC_CONST(0.1224106751992162), - FRAC_CONST(0.12565789562420052), - FRAC_CONST(0.12890377035407541), - FRAC_CONST(0.13214826462813015), - FRAC_CONST(0.13539134370043773), - FRAC_CONST(0.13863297284022669), - FRAC_CONST(0.14187311733225325), - FRAC_CONST(0.14511174247717309), - FRAC_CONST(0.14834881359191271), - FRAC_CONST(0.15158429601004111), - FRAC_CONST(0.15481815508214106), - FRAC_CONST(0.1580503561761798), - FRAC_CONST(0.16128086467788047), - FRAC_CONST(0.16450964599109233), - FRAC_CONST(0.16773666553816149), - FRAC_CONST(0.17096188876030122), - FRAC_CONST(0.17418528111796186), - FRAC_CONST(0.17740680809120093), - FRAC_CONST(0.18062643518005275), - FRAC_CONST(0.18384412790489776), - FRAC_CONST(0.18705985180683199), - FRAC_CONST(0.19027357244803589), - FRAC_CONST(0.19348525541214331), - FRAC_CONST(0.19669486630460997), - FRAC_CONST(0.19990237075308173), - FRAC_CONST(0.20310773440776286), - FRAC_CONST(0.20631092294178383), - FRAC_CONST(0.20951190205156878), - FRAC_CONST(0.21271063745720317), - FRAC_CONST(0.21590709490280058), - FRAC_CONST(0.2191012401568698), - FRAC_CONST(0.22229303901268133), - FRAC_CONST(0.22548245728863364), - FRAC_CONST(0.22866946082861941), - FRAC_CONST(0.23185401550239115), - FRAC_CONST(0.23503608720592667), - FRAC_CONST(0.23821564186179459), - FRAC_CONST(0.24139264541951888), - FRAC_CONST(0.24456706385594387), - FRAC_CONST(0.24773886317559846), - FRAC_CONST(0.25090800941106001), - FRAC_CONST(0.25407446862331851), - FRAC_CONST(0.25723820690213967), - FRAC_CONST(0.26039919036642817), - FRAC_CONST(0.26355738516459076), - FRAC_CONST(0.26671275747489837), - FRAC_CONST(0.2698652735058486), - FRAC_CONST(0.27301489949652735), - FRAC_CONST(0.27616160171697068), - FRAC_CONST(0.27930534646852595), - FRAC_CONST(0.28244610008421245), - FRAC_CONST(0.2855838289290823), - FRAC_CONST(0.28871849940058025), - FRAC_CONST(0.29185007792890405), - FRAC_CONST(0.29497853097736348), - FRAC_CONST(0.2981038250427398), - FRAC_CONST(0.30122592665564446), - FRAC_CONST(0.30434480238087736), - FRAC_CONST(0.30746041881778519), - FRAC_CONST(0.31057274260061901), - FRAC_CONST(0.31368174039889146), - FRAC_CONST(0.31678737891773395), - FRAC_CONST(0.31988962489825296), - FRAC_CONST(0.32298844511788638), - FRAC_CONST(0.32608380639075912), - FRAC_CONST(0.32917567556803889), - FRAC_CONST(0.33226401953829071), - FRAC_CONST(0.33534880522783189), - FRAC_CONST(0.33842999960108583), - FRAC_CONST(0.34150756966093632), - FRAC_CONST(0.34458148244908043), - FRAC_CONST(0.34765170504638188), - FRAC_CONST(0.35071820457322322), - FRAC_CONST(0.35378094818985806), - FRAC_CONST(0.35683990309676283), - FRAC_CONST(0.35989503653498811), - FRAC_CONST(0.36294631578650921), - FRAC_CONST(0.36599370817457672), - FRAC_CONST(0.36903718106406647), - FRAC_CONST(0.37207670186182878), - FRAC_CONST(0.37511223801703802), - FRAC_CONST(0.37814375702154046), - FRAC_CONST(0.38117122641020335), - FRAC_CONST(0.38419461376126157), - FRAC_CONST(0.38721388669666562), - FRAC_CONST(0.39022901288242801), - FRAC_CONST(0.39323996002896966), - FRAC_CONST(0.39624669589146555), - FRAC_CONST(0.39924918827019029), - FRAC_CONST(0.40224740501086254), - FRAC_CONST(0.40524131400498986), - FRAC_CONST(0.40823088319021217), - FRAC_CONST(0.41121608055064529), - FRAC_CONST(0.41419687411722372), - FRAC_CONST(0.41717323196804335), - FRAC_CONST(0.42014512222870243), - FRAC_CONST(0.42311251307264408), - FRAC_CONST(0.42607537272149631), - FRAC_CONST(0.4290336694454126), - FRAC_CONST(0.43198737156341183), - FRAC_CONST(0.43493644744371707), - FRAC_CONST(0.43788086550409511), - FRAC_CONST(0.44082059421219388), - FRAC_CONST(0.44375560208588088), - FRAC_CONST(0.44668585769357955), - FRAC_CONST(0.4496113296546066), - FRAC_CONST(0.45253198663950756), - FRAC_CONST(0.45544779737039259), - FRAC_CONST(0.45835873062127125), - FRAC_CONST(0.46126475521838717), - FRAC_CONST(0.46416584004055156), - FRAC_CONST(0.46706195401947659), - FRAC_CONST(0.46995306614010829), - FRAC_CONST(0.47283914544095862), - FRAC_CONST(0.47572016101443682), - FRAC_CONST(0.47859608200718085), - FRAC_CONST(0.4814668776203872), - FRAC_CONST(0.48433251711014125), - FRAC_CONST(0.4871929697877464), - FRAC_CONST(0.49004820502005247), - FRAC_CONST(0.49289819222978404), - FRAC_CONST(0.49574290089586776), - FRAC_CONST(0.49858230055375902), - FRAC_CONST(0.50141636079576901), - FRAC_CONST(0.50424505127138919), - FRAC_CONST(0.50706834168761705), - FRAC_CONST(0.50988620180928057), - FRAC_CONST(0.51269860145936175), - FRAC_CONST(0.51550551051931948), - FRAC_CONST(0.51830689892941317), - FRAC_CONST(0.5211027366890234), - FRAC_CONST(0.52389299385697385), - FRAC_CONST(0.52667764055185196), - FRAC_CONST(0.52945664695232897), - FRAC_CONST(0.53222998329747884), - FRAC_CONST(0.53499761988709726), - FRAC_CONST(0.53775952708201991), - FRAC_CONST(0.54051567530443978), - FRAC_CONST(0.54326603503822357), - FRAC_CONST(0.54601057682922816), - FRAC_CONST(0.54874927128561579), - FRAC_CONST(0.55148208907816942), - FRAC_CONST(0.55420900094060566), - FRAC_CONST(0.55692997766988939), - FRAC_CONST(0.559644990126546), - FRAC_CONST(0.56235400923497314), - FRAC_CONST(0.56505700598375252), - FRAC_CONST(0.56775395142596052), - FRAC_CONST(0.57044481667947822), - FRAC_CONST(0.57312957292730071), - FRAC_CONST(0.57580819141784534), - FRAC_CONST(0.57848064346525996), - FRAC_CONST(0.58114690044973039), - FRAC_CONST(0.58380693381778626), - FRAC_CONST(0.58646071508260733), - FRAC_CONST(0.58910821582432815), - FRAC_CONST(0.5917494076903429), - FRAC_CONST(0.5943842623956086), - FRAC_CONST(0.59701275172294799), - FRAC_CONST(0.59963484752335228), - FRAC_CONST(0.60225052171628191), - FRAC_CONST(0.60485974628996786), - FRAC_CONST(0.60746249330171098), - FRAC_CONST(0.61005873487818185), - FRAC_CONST(0.61264844321571899), - FRAC_CONST(0.61523159058062682), - FRAC_CONST(0.61780814930947225), - FRAC_CONST(0.62037809180938108), - FRAC_CONST(0.62294139055833397), - FRAC_CONST(0.6254980181054608), - FRAC_CONST(0.62804794707133416), - FRAC_CONST(0.63059115014826372), - FRAC_CONST(0.63312760010058777), - FRAC_CONST(0.63565726976496484), - FRAC_CONST(0.63818013205066515), - FRAC_CONST(0.64069615993986073), - FRAC_CONST(0.64320532648791406), - FRAC_CONST(0.64570760482366729), - FRAC_CONST(0.64820296814972966), - FRAC_CONST(0.65069138974276486), - FRAC_CONST(0.65317284295377676), - FRAC_CONST(0.65564730120839498), - FRAC_CONST(0.65811473800715958), - FRAC_CONST(0.660575126925805), - FRAC_CONST(0.66302844161554231), - FRAC_CONST(0.6654746558033422), - FRAC_CONST(0.66791374329221598), - FRAC_CONST(0.67034567796149647), - FRAC_CONST(0.67277043376711676), - FRAC_CONST(0.67518798474189046), - FRAC_CONST(0.67759830499578866), - FRAC_CONST(0.68000136871621808), - FRAC_CONST(0.68239715016829683), - FRAC_CONST(0.6847856236951303), - FRAC_CONST(0.68716676371808583), - FRAC_CONST(0.68954054473706683), - FRAC_CONST(0.69190694133078579), - FRAC_CONST(0.69426592815703603), - FRAC_CONST(0.69661747995296419), - FRAC_CONST(0.69896157153533944), - FRAC_CONST(0.70129817780082437), - FRAC_CONST(0.7036272737262429), - FRAC_CONST(0.70594883436884903), - FRAC_CONST(0.70826283486659336), - FRAC_CONST(0.71056925043838959), - FRAC_CONST(0.71286805638437978), - FRAC_CONST(0.71515922808619936), - FRAC_CONST(0.71744274100723993), - FRAC_CONST(0.71971857069291278), - FRAC_CONST(0.7219866927709101), - FRAC_CONST(0.72424708295146689), - FRAC_CONST(0.72649971702762028), - FRAC_CONST(0.72874457087546896), - FRAC_CONST(0.73098162045443171), - FRAC_CONST(0.73321084180750484), - FRAC_CONST(0.73543221106151868), - FRAC_CONST(0.73764570442739286), - FRAC_CONST(0.73985129820039208), - FRAC_CONST(0.74204896876037885), - FRAC_CONST(0.7442386925720671), - FRAC_CONST(0.74642044618527381), - FRAC_CONST(0.74859420623517081), - FRAC_CONST(0.75075994944253421), - FRAC_CONST(0.75291765261399446), - FRAC_CONST(0.75506729264228367), - FRAC_CONST(0.75720884650648446), - FRAC_CONST(0.75934229127227548), - FRAC_CONST(0.76146760409217706), - FRAC_CONST(0.76358476220579641), - FRAC_CONST(0.7656937429400712), - FRAC_CONST(0.76779452370951196), - FRAC_CONST(0.76988708201644451), - FRAC_CONST(0.77197139545125026), - FRAC_CONST(0.7740474416926072), - FRAC_CONST(0.77611519850772781), - FRAC_CONST(0.77817464375259782), - FRAC_CONST(0.78022575537221317), - FRAC_CONST(0.78226851140081632), - FRAC_CONST(0.78430288996213138), - FRAC_CONST(0.78632886926959822), - FRAC_CONST(0.78834642762660623), - FRAC_CONST(0.79035554342672631), - FRAC_CONST(0.79235619515394229), - FRAC_CONST(0.79434836138288134), - FRAC_CONST(0.79633202077904397), - FRAC_CONST(0.79830715209903147), - FRAC_CONST(0.8002737341907743), - FRAC_CONST(0.80223174599375802), - FRAC_CONST(0.80418116653924954), - FRAC_CONST(0.80612197495052085), - FRAC_CONST(0.80805415044307316), - FRAC_CONST(0.80997767232485907), - FRAC_CONST(0.81189251999650469), - FRAC_CONST(0.81379867295152986), - FRAC_CONST(0.81569611077656778), - FRAC_CONST(0.81758481315158371), - FRAC_CONST(0.81946475985009259), - FRAC_CONST(0.82133593073937561), - FRAC_CONST(0.82319830578069586), - FRAC_CONST(0.82505186502951278), - FRAC_CONST(0.82689658863569615), - FRAC_CONST(0.82873245684373809), - FRAC_CONST(0.83055944999296494), - FRAC_CONST(0.83237754851774781), - FRAC_CONST(0.83418673294771239), - FRAC_CONST(0.83598698390794668), - FRAC_CONST(0.83777828211920935), - FRAC_CONST(0.83956060839813562), - FRAC_CONST(0.84133394365744296), - FRAC_CONST(0.84309826890613537), - FRAC_CONST(0.84485356524970701), - FRAC_CONST(0.84659981389034411), - FRAC_CONST(0.84833699612712676), - FRAC_CONST(0.85006509335622882), - FRAC_CONST(0.8517840870711173), - FRAC_CONST(0.85349395886275037), - FRAC_CONST(0.85519469041977514), - FRAC_CONST(0.85688626352872277), - FRAC_CONST(0.85856866007420429), - FRAC_CONST(0.86024186203910447), - FRAC_CONST(0.86190585150477417), - FRAC_CONST(0.86356061065122347), - FRAC_CONST(0.86520612175731115), - FRAC_CONST(0.86684236720093533), - FRAC_CONST(0.86846932945922151), - FRAC_CONST(0.87008699110871135), - FRAC_CONST(0.87169533482554817), - FRAC_CONST(0.87329434338566281), - FRAC_CONST(0.87488399966495822), - FRAC_CONST(0.87646428663949283), - FRAC_CONST(0.87803518738566277), - FRAC_CONST(0.87959668508038291), - FRAC_CONST(0.88114876300126743), - FRAC_CONST(0.88269140452680916), - FRAC_CONST(0.8842245931365561), - FRAC_CONST(0.88574831241129048), - FRAC_CONST(0.88726254603320276), - FRAC_CONST(0.88876727778606746), - FRAC_CONST(0.89026249155541637), - FRAC_CONST(0.8917481713287112), - FRAC_CONST(0.89322430119551532), - FRAC_CONST(0.89469086534766362), - FRAC_CONST(0.89614784807943237), - FRAC_CONST(0.89759523378770689), - FRAC_CONST(0.89903300697214927), - FRAC_CONST(0.9004611522353636), - FRAC_CONST(0.90187965428306172), - FRAC_CONST(0.90328849792422594), - FRAC_CONST(0.90468766807127299), - FRAC_CONST(0.90607714974021469), - FRAC_CONST(0.90745692805081868), - FRAC_CONST(0.90882698822676755), - FRAC_CONST(0.91018731559581767), - FRAC_CONST(0.91153789558995579), - FRAC_CONST(0.91287871374555518), - FRAC_CONST(0.91420975570353069), - FRAC_CONST(0.9155310072094921), - FRAC_CONST(0.91684245411389753), - FRAC_CONST(0.91814408237220391), - FRAC_CONST(0.91943587804501858), - FRAC_CONST(0.92071782729824769), - FRAC_CONST(0.92198991640324446), - FRAC_CONST(0.92325213173695675), - FRAC_CONST(0.92450445978207241), - FRAC_CONST(0.92574688712716402), - FRAC_CONST(0.92697940046683291), - FRAC_CONST(0.92820198660185149), - FRAC_CONST(0.92941463243930444), - FRAC_CONST(0.93061732499272909), - FRAC_CONST(0.93181005138225426), - FRAC_CONST(0.93299279883473885), - FRAC_CONST(0.93416555468390772), - FRAC_CONST(0.93532830637048769), - FRAC_CONST(0.93648104144234268), - FRAC_CONST(0.93762374755460598), - FRAC_CONST(0.93875641246981323), - FRAC_CONST(0.93987902405803303), - FRAC_CONST(0.94099157029699743), - FRAC_CONST(0.94209403927222979), - FRAC_CONST(0.94318641917717327), - FRAC_CONST(0.9442686983133165), - FRAC_CONST(0.94534086509031956), - FRAC_CONST(0.9464029080261378), - FRAC_CONST(0.94745481574714419), - FRAC_CONST(0.94849657698825252), - FRAC_CONST(0.94952818059303667), - FRAC_CONST(0.95054961551385087), - FRAC_CONST(0.95156087081194762), - FRAC_CONST(0.95256193565759528), - FRAC_CONST(0.95355279933019343), - FRAC_CONST(0.9545334512183884), - FRAC_CONST(0.95550388082018611), - FRAC_CONST(0.95646407774306541), - FRAC_CONST(0.95741403170408834), - FRAC_CONST(0.95835373253001133), - FRAC_CONST(0.95928317015739362), - FRAC_CONST(0.96020233463270466), - FRAC_CONST(0.96111121611243155), - FRAC_CONST(0.96200980486318388), - FRAC_CONST(0.96289809126179782), - FRAC_CONST(0.96377606579543984), - FRAC_CONST(0.96464371906170809), - FRAC_CONST(0.96550104176873297), - FRAC_CONST(0.96634802473527726), - FRAC_CONST(0.96718465889083372), - FRAC_CONST(0.96801093527572268), - FRAC_CONST(0.96882684504118799), - FRAC_CONST(0.96963237944949143), - FRAC_CONST(0.97042752987400682), - FRAC_CONST(0.97121228779931179), - FRAC_CONST(0.97198664482127939), - FRAC_CONST(0.97275059264716823), - FRAC_CONST(0.97350412309571066), - FRAC_CONST(0.97424722809720088), - FRAC_CONST(0.97497989969358168), - FRAC_CONST(0.97570213003852857), - FRAC_CONST(0.97641391139753486), - FRAC_CONST(0.97711523614799412), - FRAC_CONST(0.97780609677928154), - FRAC_CONST(0.97848648589283505), - FRAC_CONST(0.97915639620223371), - FRAC_CONST(0.9798158205332762), - FRAC_CONST(0.98046475182405801), - FRAC_CONST(0.98110318312504607), - FRAC_CONST(0.98173110759915416), - FRAC_CONST(0.98234851852181571), - FRAC_CONST(0.98295540928105563), - FRAC_CONST(0.9835517733775615), - FRAC_CONST(0.98413760442475307), - FRAC_CONST(0.98471289614885038), - FRAC_CONST(0.98527764238894122), - FRAC_CONST(0.98583183709704714), - FRAC_CONST(0.98637547433818806), - FRAC_CONST(0.98690854829044583), - FRAC_CONST(0.98743105324502667), - FRAC_CONST(0.98794298360632238), - FRAC_CONST(0.98844433389196995), - FRAC_CONST(0.98893509873291074), - FRAC_CONST(0.98941527287344755), - FRAC_CONST(0.98988485117130098), - FRAC_CONST(0.99034382859766479), - FRAC_CONST(0.99079220023725967), - FRAC_CONST(0.99122996128838525), - FRAC_CONST(0.9916571070629725), - FRAC_CONST(0.99207363298663342), - FRAC_CONST(0.99247953459870997), - FRAC_CONST(0.99287480755232194), - FRAC_CONST(0.99325944761441354), - FRAC_CONST(0.99363345066579889), - FRAC_CONST(0.99399681270120555), - FRAC_CONST(0.99434952982931812), - FRAC_CONST(0.9946915982728195), - FRAC_CONST(0.99502301436843166), - FRAC_CONST(0.99534377456695422), - FRAC_CONST(0.9956538754333033), - FRAC_CONST(0.99595331364654771), - FRAC_CONST(0.99624208599994479), - FRAC_CONST(0.99652018940097464), - FRAC_CONST(0.99678762087137318), - FRAC_CONST(0.99704437754716424), - FRAC_CONST(0.99729045667869021), - FRAC_CONST(0.99752585563064111), - FRAC_CONST(0.99775057188208349), - FRAC_CONST(0.9979646030264866), - FRAC_CONST(0.99816794677174903), - FRAC_CONST(0.9983606009402225), - FRAC_CONST(0.99854256346873571), - FRAC_CONST(0.99871383240861611), - FRAC_CONST(0.99887440592571108), - FRAC_CONST(0.99902428230040718), - FRAC_CONST(0.99916345992764877), - FRAC_CONST(0.99929193731695531), - FRAC_CONST(0.99940971309243731), - FRAC_CONST(0.99951678599281069), - FRAC_CONST(0.99961315487141078), - FRAC_CONST(0.99969881869620425), - FRAC_CONST(0.99977377654980037), - FRAC_CONST(0.99983802762946083), - FRAC_CONST(0.99989157124710804), - FRAC_CONST(0.9999344068293331), - FRAC_CONST(0.99996653391740109), - FRAC_CONST(0.99998795216725689), - FRAC_CONST(0.99999866134952808) -}; -#endif - -ALIGN static const real_t ld_mid_512[] = -{ - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0.0061358846491544753), - FRAC_CONST(0.01840672990580482), - FRAC_CONST(0.030674803176636626), - FRAC_CONST(0.04293825693494082), - FRAC_CONST(0.055195244349689934), - FRAC_CONST(0.067443919563664051), - FRAC_CONST(0.079682437971430126), - FRAC_CONST(0.091908956497132724), - FRAC_CONST(0.10412163387205459), - FRAC_CONST(0.11631863091190475), - FRAC_CONST(0.12849811079379317), - FRAC_CONST(0.14065823933284921), - FRAC_CONST(0.15279718525844344), - FRAC_CONST(0.16491312048996989), - FRAC_CONST(0.17700422041214875), - FRAC_CONST(0.18906866414980619), - FRAC_CONST(0.2011046348420919), - FRAC_CONST(0.21311031991609136), - FRAC_CONST(0.22508391135979283), - FRAC_CONST(0.2370236059943672), - FRAC_CONST(0.24892760574572015), - FRAC_CONST(0.26079411791527551), - FRAC_CONST(0.27262135544994898), - FRAC_CONST(0.28440753721127188), - FRAC_CONST(0.29615088824362379), - FRAC_CONST(0.30784964004153487), - FRAC_CONST(0.31950203081601569), - FRAC_CONST(0.33110630575987643), - FRAC_CONST(0.34266071731199438), - FRAC_CONST(0.35416352542049034), - FRAC_CONST(0.36561299780477385), - FRAC_CONST(0.37700741021641826), - FRAC_CONST(0.38834504669882625), - FRAC_CONST(0.39962419984564679), - FRAC_CONST(0.41084317105790391), - FRAC_CONST(0.42200027079979968), - FRAC_CONST(0.43309381885315196), - FRAC_CONST(0.4441221445704292), - FRAC_CONST(0.45508358712634384), - FRAC_CONST(0.46597649576796618), - FRAC_CONST(0.47679923006332209), - FRAC_CONST(0.487550160148436), - FRAC_CONST(0.49822766697278187), - FRAC_CONST(0.50883014254310699), - FRAC_CONST(0.51935599016558964), - FRAC_CONST(0.52980362468629461), - FRAC_CONST(0.54017147272989285), - FRAC_CONST(0.55045797293660481), - FRAC_CONST(0.56066157619733603), - FRAC_CONST(0.57078074588696726), - FRAC_CONST(0.58081395809576453), - FRAC_CONST(0.59075970185887416), - FRAC_CONST(0.60061647938386897), - FRAC_CONST(0.61038280627630948), - FRAC_CONST(0.6200572117632891), - FRAC_CONST(0.62963823891492698), - FRAC_CONST(0.63912444486377573), - FRAC_CONST(0.64851440102211244), - FRAC_CONST(0.65780669329707864), - FRAC_CONST(0.66699992230363747), - FRAC_CONST(0.67609270357531592), - FRAC_CONST(0.68508366777270036), - FRAC_CONST(0.693971460889654), - FRAC_CONST(0.7027547444572253), - FRAC_CONST(0.71143219574521643), - FRAC_CONST(0.72000250796138165), - FRAC_CONST(0.7284643904482252), - FRAC_CONST(0.73681656887736979), - FRAC_CONST(0.74505778544146595), - FRAC_CONST(0.75318679904361241), - FRAC_CONST(0.76120238548426178), - FRAC_CONST(0.76910333764557959), - FRAC_CONST(0.77688846567323244), - FRAC_CONST(0.78455659715557524), - FRAC_CONST(0.79210657730021239), - FRAC_CONST(0.79953726910790501), - FRAC_CONST(0.80684755354379922), - FRAC_CONST(0.8140363297059483), - FRAC_CONST(0.82110251499110465), - FRAC_CONST(0.8280450452577558), - FRAC_CONST(0.83486287498638001), - FRAC_CONST(0.84155497743689833), - FRAC_CONST(0.84812034480329712), - FRAC_CONST(0.85455798836540053), - FRAC_CONST(0.86086693863776731), - FRAC_CONST(0.86704624551569265), - FRAC_CONST(0.87309497841829009), - FRAC_CONST(0.87901222642863341), - FRAC_CONST(0.88479709843093779), - FRAC_CONST(0.89044872324475788), - FRAC_CONST(0.89596624975618511), - FRAC_CONST(0.90134884704602203), - FRAC_CONST(0.90659570451491533), - FRAC_CONST(0.91170603200542988), - FRAC_CONST(0.9166790599210427), - FRAC_CONST(0.9215140393420419), - FRAC_CONST(0.92621024213831127), - FRAC_CONST(0.93076696107898371), - FRAC_CONST(0.9351835099389475), - FRAC_CONST(0.93945922360218992), - FRAC_CONST(0.94359345816196039), - FRAC_CONST(0.94758559101774109), - FRAC_CONST(0.95143502096900834), - FRAC_CONST(0.95514116830577067), - FRAC_CONST(0.9587034748958716), - FRAC_CONST(0.96212140426904158), - FRAC_CONST(0.9653944416976894), - FRAC_CONST(0.96852209427441727), - FRAC_CONST(0.97150389098625178), - FRAC_CONST(0.97433938278557586), - FRAC_CONST(0.97702814265775439), - FRAC_CONST(0.97956976568544052), - FRAC_CONST(0.98196386910955524), - FRAC_CONST(0.98421009238692903), - FRAC_CONST(0.98630809724459867), - FRAC_CONST(0.98825756773074946), - FRAC_CONST(0.99005821026229712), - FRAC_CONST(0.99170975366909953), - FRAC_CONST(0.9932119492347945), - FRAC_CONST(0.99456457073425542), - FRAC_CONST(0.99576741446765982), - FRAC_CONST(0.99682029929116567), - FRAC_CONST(0.99772306664419164), - FRAC_CONST(0.99847558057329477), - FRAC_CONST(0.99907772775264536), - FRAC_CONST(0.99952941750109314), - FRAC_CONST(0.9998305817958234), - FRAC_CONST(0.99998117528260111), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1) -}; - -#ifdef ALLOW_SMALL_FRAMELENGTH -ALIGN static const real_t ld_mid_480[] = -{ - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0), - FRAC_CONST(0.0065449379673518581), - FRAC_CONST(0.019633692460628301), - FRAC_CONST(0.032719082821776137), - FRAC_CONST(0.045798866936520771), - FRAC_CONST(0.058870803651189033), - FRAC_CONST(0.071932653156719387), - FRAC_CONST(0.084982177372441667), - FRAC_CONST(0.09801714032956059), - FRAC_CONST(0.11103530855427769), - FRAC_CONST(0.12403445145048532), - FRAC_CONST(0.13701234168196802), - FRAC_CONST(0.14996675555404498), - FRAC_CONST(0.16289547339458874), - FRAC_CONST(0.17579627993435451), - FRAC_CONST(0.18866696468655525), - FRAC_CONST(0.2015053223256171), - FRAC_CONST(0.21430915306505074), - FRAC_CONST(0.2270762630343732), - FRAC_CONST(0.23980446465501654), - FRAC_CONST(0.25249157701515795), - FRAC_CONST(0.26513542624340797), - FRAC_CONST(0.27773384588129219), - FRAC_CONST(0.29028467725446233), - FRAC_CONST(0.3027857698425746), - FRAC_CONST(0.31523498164776964), - FRAC_CONST(0.32763017956169349), - FRAC_CONST(0.33996923973099424), - FRAC_CONST(0.35225004792123354), - FRAC_CONST(0.36447049987914965), - FRAC_CONST(0.37662850169321077), - FRAC_CONST(0.38872197015239557), - FRAC_CONST(0.40074883310314097), - FRAC_CONST(0.41270702980439467), - FRAC_CONST(0.42459451128071307), - FRAC_CONST(0.43640924067334208), - FRAC_CONST(0.44814919358922256), - FRAC_CONST(0.45981235844785984), - FRAC_CONST(0.47139673682599764), - FRAC_CONST(0.48290034380003727), - FRAC_CONST(0.49432120828614462), - FRAC_CONST(0.50565737337798455), - FRAC_CONST(0.51690689668202761), - FRAC_CONST(0.52806785065036799), - FRAC_CONST(0.53913832291100017), - FRAC_CONST(0.55011641659549337), - FRAC_CONST(0.56100025066400983), - FRAC_CONST(0.57178796022761225), - FRAC_CONST(0.58247769686780215), - FRAC_CONST(0.59306762895323706), - FRAC_CONST(0.60355594195357143), - FRAC_CONST(0.61394083875036642), - FRAC_CONST(0.62422053994501758), - FRAC_CONST(0.63439328416364549), - FRAC_CONST(0.64445732835889735), - FRAC_CONST(0.65441094810861034), - FRAC_CONST(0.66425243791128175), - FRAC_CONST(0.67398011147829784), - FRAC_CONST(0.68359230202287125), - FRAC_CONST(0.69308736254563585), - FRAC_CONST(0.70246366611685174), - FRAC_CONST(0.71171960615517138), - FRAC_CONST(0.72085359670291882), - FRAC_CONST(0.7298640726978356), - FRAC_CONST(0.73874949024124625), - FRAC_CONST(0.74750832686259672), - FRAC_CONST(0.75613908178032285), - FRAC_CONST(0.76464027615900032), - FRAC_CONST(0.77301045336273699), - FRAC_CONST(0.78124817920475853), - FRAC_CONST(0.78935204219315003), - FRAC_CONST(0.79732065377270711), - FRAC_CONST(0.80515264856285829), - FRAC_CONST(0.81284668459161513), - FRAC_CONST(0.82040144352551359), - FRAC_CONST(0.82781563089550203), - FRAC_CONST(0.83508797631874299), - FRAC_CONST(0.84221723371628654), - FRAC_CONST(0.84920218152657889), - FRAC_CONST(0.85604162291477137), - FRAC_CONST(0.86273438597779184), - FRAC_CONST(0.86927932394514362), - FRAC_CONST(0.87567531537539967), - FRAC_CONST(0.88192126434835494), - FRAC_CONST(0.88801610065280734), - FRAC_CONST(0.89395877996993212), - FRAC_CONST(0.8997482840522214), - FRAC_CONST(0.90538362089795521), - FRAC_CONST(0.91086382492117568), - FRAC_CONST(0.91618795711713596), - FRAC_CONST(0.92135510522319242), - FRAC_CONST(0.9263643838751181), - FRAC_CONST(0.93121493475880346), - FRAC_CONST(0.93590592675732565), - FRAC_CONST(0.94043655609335486), - FRAC_CONST(0.94480604646687805), - FRAC_CONST(0.94901364918821385), - FRAC_CONST(0.95305864330629697), - FRAC_CONST(0.95694033573220882), - FRAC_CONST(0.9606580613579353), - FRAC_CONST(0.96421118317032928), - FRAC_CONST(0.96759909236025976), - FRAC_CONST(0.9708212084269281), - FRAC_CONST(0.97387697927733363), - FRAC_CONST(0.97676588132087239), - FRAC_CONST(0.97948741955905139), - FRAC_CONST(0.98204112767030394), - FRAC_CONST(0.98442656808989171), - FRAC_CONST(0.98664333208487898), - FRAC_CONST(0.98869103982416728), - FRAC_CONST(0.99056934044357725), - FRAC_CONST(0.99227791210596705), - FRAC_CONST(0.99381646205637808), - FRAC_CONST(0.99518472667219682), - FRAC_CONST(0.99638247150832537), - FRAC_CONST(0.99740949133735191), - FRAC_CONST(0.99826561018471593), - FRAC_CONST(0.99895068135886012), - FRAC_CONST(0.99946458747636568), - FRAC_CONST(0.99980724048206482), - FRAC_CONST(0.99997858166412923), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1), - FRAC_CONST(1) -}; -#endif -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/specrec.c b/mplayer/libfaad2/specrec.c deleted file mode 100644 index fd8edf2c..00000000 --- a/mplayer/libfaad2/specrec.c +++ /dev/null @@ -1,1241 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** Any non-GPL usage of this software or parts of this software is strictly -** forbidden. -** -** 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. -**/ - -/* - Spectral reconstruction: - - grouping/sectioning - - inverse quantization - - applying scalefactors -*/ - -#include "common.h" -#include "structs.h" - -#include -#include -#include "specrec.h" -#include "filtbank.h" -#include "syntax.h" -#include "iq_table.h" -#include "ms.h" -#include "is.h" -#include "pns.h" -#include "tns.h" -#include "drc.h" -#include "lt_predict.h" -#include "ic_predict.h" -#ifdef SSR_DEC -#include "ssr.h" -#include "ssr_fb.h" -#endif - - -/* static function declarations */ -static uint8_t quant_to_spec(NeAACDecHandle hDecoder, - ic_stream *ics, int16_t *quant_data, - real_t *spec_data, uint16_t frame_len); - - -#ifdef LD_DEC -ALIGN static const uint8_t num_swb_512_window[] = -{ - 0, 0, 0, 36, 36, 37, 31, 31, 0, 0, 0, 0 -}; -ALIGN static const uint8_t num_swb_480_window[] = -{ - 0, 0, 0, 35, 35, 37, 30, 30, 0, 0, 0, 0 -}; -#endif - -ALIGN static const uint8_t num_swb_960_window[] = -{ - 40, 40, 45, 49, 49, 49, 46, 46, 42, 42, 42, 40 -}; - -ALIGN static const uint8_t num_swb_1024_window[] = -{ - 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40 -}; - -ALIGN static const uint8_t num_swb_128_window[] = -{ - 12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15 -}; - -ALIGN static const uint16_t swb_offset_1024_96[] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, - 64, 72, 80, 88, 96, 108, 120, 132, 144, 156, 172, 188, 212, 240, - 276, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960, 1024 -}; - -ALIGN static const uint16_t swb_offset_128_96[] = -{ - 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128 -}; - -ALIGN static const uint16_t swb_offset_1024_64[] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, - 64, 72, 80, 88, 100, 112, 124, 140, 156, 172, 192, 216, 240, 268, - 304, 344, 384, 424, 464, 504, 544, 584, 624, 664, 704, 744, 784, 824, - 864, 904, 944, 984, 1024 -}; - -ALIGN static const uint16_t swb_offset_128_64[] = -{ - 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128 -}; - -ALIGN static const uint16_t swb_offset_1024_48[] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, - 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292, - 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, - 768, 800, 832, 864, 896, 928, 1024 -}; - -#ifdef LD_DEC -ALIGN static const uint16_t swb_offset_512_48[] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 68, 76, 84, - 92, 100, 112, 124, 136, 148, 164, 184, 208, 236, 268, 300, 332, 364, 396, - 428, 460, 512 -}; - -ALIGN static const uint16_t swb_offset_480_48[] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72 ,80 ,88, - 96, 108, 120, 132, 144, 156, 172, 188, 212, 240, 272, 304, 336, 368, 400, - 432, 480 -}; -#endif - -ALIGN static const uint16_t swb_offset_128_48[] = -{ - 0, 4, 8, 12, 16, 20, 28, 36, 44, 56, 68, 80, 96, 112, 128 -}; - -ALIGN static const uint16_t swb_offset_1024_32[] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, - 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292, - 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, - 768, 800, 832, 864, 896, 928, 960, 992, 1024 -}; - -#ifdef LD_DEC -ALIGN static const uint16_t swb_offset_512_32[] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, - 88, 96, 108, 120, 132, 144, 160, 176, 192, 212, 236, 260, 288, 320, 352, - 384, 416, 448, 480, 512 -}; - -ALIGN static const uint16_t swb_offset_480_32[] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, - 88, 96, 104, 112, 124, 136, 148, 164, 180, 200, 224, 256, 288, 320, 352, - 384, 416, 448, 480 -}; -#endif - -ALIGN static const uint16_t swb_offset_1024_24[] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, - 76, 84, 92, 100, 108, 116, 124, 136, 148, 160, 172, 188, 204, 220, - 240, 260, 284, 308, 336, 364, 396, 432, 468, 508, 552, 600, 652, 704, - 768, 832, 896, 960, 1024 -}; - -#ifdef LD_DEC -ALIGN static const uint16_t swb_offset_512_24[] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, - 80, 92, 104, 120, 140, 164, 192, 224, 256, 288, 320, 352, 384, 416, - 448, 480, 512 -}; - -ALIGN static const uint16_t swb_offset_480_24[] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, 80, 92, 104, 120, - 140, 164, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 -}; -#endif - -ALIGN static const uint16_t swb_offset_128_24[] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 64, 76, 92, 108, 128 -}; - -ALIGN static const uint16_t swb_offset_1024_16[] = -{ - 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 100, 112, 124, - 136, 148, 160, 172, 184, 196, 212, 228, 244, 260, 280, 300, 320, 344, - 368, 396, 424, 456, 492, 532, 572, 616, 664, 716, 772, 832, 896, 960, 1024 -}; - -ALIGN static const uint16_t swb_offset_128_16[] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 60, 72, 88, 108, 128 -}; - -ALIGN static const uint16_t swb_offset_1024_8[] = -{ - 0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 172, - 188, 204, 220, 236, 252, 268, 288, 308, 328, 348, 372, 396, 420, 448, - 476, 508, 544, 580, 620, 664, 712, 764, 820, 880, 944, 1024 -}; - -ALIGN static const uint16_t swb_offset_128_8[] = -{ - 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 60, 72, 88, 108, 128 -}; - -ALIGN static const uint16_t *swb_offset_1024_window[] = -{ - swb_offset_1024_96, /* 96000 */ - swb_offset_1024_96, /* 88200 */ - swb_offset_1024_64, /* 64000 */ - swb_offset_1024_48, /* 48000 */ - swb_offset_1024_48, /* 44100 */ - swb_offset_1024_32, /* 32000 */ - swb_offset_1024_24, /* 24000 */ - swb_offset_1024_24, /* 22050 */ - swb_offset_1024_16, /* 16000 */ - swb_offset_1024_16, /* 12000 */ - swb_offset_1024_16, /* 11025 */ - swb_offset_1024_8 /* 8000 */ -}; - -#ifdef LD_DEC -ALIGN static const uint16_t *swb_offset_512_window[] = -{ - 0, /* 96000 */ - 0, /* 88200 */ - 0, /* 64000 */ - swb_offset_512_48, /* 48000 */ - swb_offset_512_48, /* 44100 */ - swb_offset_512_32, /* 32000 */ - swb_offset_512_24, /* 24000 */ - swb_offset_512_24, /* 22050 */ - 0, /* 16000 */ - 0, /* 12000 */ - 0, /* 11025 */ - 0 /* 8000 */ -}; - -ALIGN static const uint16_t *swb_offset_480_window[] = -{ - 0, /* 96000 */ - 0, /* 88200 */ - 0, /* 64000 */ - swb_offset_480_48, /* 48000 */ - swb_offset_480_48, /* 44100 */ - swb_offset_480_32, /* 32000 */ - swb_offset_480_24, /* 24000 */ - swb_offset_480_24, /* 22050 */ - 0, /* 16000 */ - 0, /* 12000 */ - 0, /* 11025 */ - 0 /* 8000 */ -}; -#endif - -ALIGN static const uint16_t *swb_offset_128_window[] = -{ - swb_offset_128_96, /* 96000 */ - swb_offset_128_96, /* 88200 */ - swb_offset_128_64, /* 64000 */ - swb_offset_128_48, /* 48000 */ - swb_offset_128_48, /* 44100 */ - swb_offset_128_48, /* 32000 */ - swb_offset_128_24, /* 24000 */ - swb_offset_128_24, /* 22050 */ - swb_offset_128_16, /* 16000 */ - swb_offset_128_16, /* 12000 */ - swb_offset_128_16, /* 11025 */ - swb_offset_128_8 /* 8000 */ -}; - -#define bit_set(A, B) ((A) & (1<<(B))) - -/* 4.5.2.3.4 */ -/* - - determine the number of windows in a window_sequence named num_windows - - determine the number of window_groups named num_window_groups - - determine the number of windows in each group named window_group_length[g] - - determine the total number of scalefactor window bands named num_swb for - the actual window type - - determine swb_offset[swb], the offset of the first coefficient in - scalefactor window band named swb of the window actually used - - determine sect_sfb_offset[g][section],the offset of the first coefficient - in section named section. This offset depends on window_sequence and - scale_factor_grouping and is needed to decode the spectral_data(). -*/ -uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics) -{ - uint8_t i, g; - - uint8_t sf_index = hDecoder->sf_index; - - switch (ics->window_sequence) { - case ONLY_LONG_SEQUENCE: - case LONG_START_SEQUENCE: - case LONG_STOP_SEQUENCE: - ics->num_windows = 1; - ics->num_window_groups = 1; - ics->window_group_length[ics->num_window_groups-1] = 1; -#ifdef LD_DEC - if (hDecoder->object_type == LD) - { - if (hDecoder->frameLength == 512) - ics->num_swb = num_swb_512_window[sf_index]; - else /* if (hDecoder->frameLength == 480) */ - ics->num_swb = num_swb_480_window[sf_index]; - } else { -#endif - if (hDecoder->frameLength == 1024) - ics->num_swb = num_swb_1024_window[sf_index]; - else /* if (hDecoder->frameLength == 960) */ - ics->num_swb = num_swb_960_window[sf_index]; -#ifdef LD_DEC - } -#endif - - /* preparation of sect_sfb_offset for long blocks */ - /* also copy the last value! */ -#ifdef LD_DEC - if (hDecoder->object_type == LD) - { - if (hDecoder->frameLength == 512) - { - for (i = 0; i < ics->num_swb; i++) - { - ics->sect_sfb_offset[0][i] = swb_offset_512_window[sf_index][i]; - ics->swb_offset[i] = swb_offset_512_window[sf_index][i]; - } - } else /* if (hDecoder->frameLength == 480) */ { - for (i = 0; i < ics->num_swb; i++) - { - ics->sect_sfb_offset[0][i] = swb_offset_480_window[sf_index][i]; - ics->swb_offset[i] = swb_offset_480_window[sf_index][i]; - } - } - ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength; - ics->swb_offset[ics->num_swb] = hDecoder->frameLength; - } else { -#endif - for (i = 0; i < ics->num_swb; i++) - { - ics->sect_sfb_offset[0][i] = swb_offset_1024_window[sf_index][i]; - ics->swb_offset[i] = swb_offset_1024_window[sf_index][i]; - } - ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength; - ics->swb_offset[ics->num_swb] = hDecoder->frameLength; -#ifdef LD_DEC - } -#endif - return 0; - case EIGHT_SHORT_SEQUENCE: - ics->num_windows = 8; - ics->num_window_groups = 1; - ics->window_group_length[ics->num_window_groups-1] = 1; - ics->num_swb = num_swb_128_window[sf_index]; - - for (i = 0; i < ics->num_swb; i++) - ics->swb_offset[i] = swb_offset_128_window[sf_index][i]; - ics->swb_offset[ics->num_swb] = hDecoder->frameLength/8; - - for (i = 0; i < ics->num_windows-1; i++) { - if (bit_set(ics->scale_factor_grouping, 6-i) == 0) - { - ics->num_window_groups += 1; - ics->window_group_length[ics->num_window_groups-1] = 1; - } else { - ics->window_group_length[ics->num_window_groups-1] += 1; - } - } - - /* preparation of sect_sfb_offset for short blocks */ - for (g = 0; g < ics->num_window_groups; g++) - { - uint16_t width; - uint8_t sect_sfb = 0; - uint16_t offset = 0; - - for (i = 0; i < ics->num_swb; i++) - { - if (i+1 == ics->num_swb) - { - width = (hDecoder->frameLength/8) - swb_offset_128_window[sf_index][i]; - } else { - width = swb_offset_128_window[sf_index][i+1] - - swb_offset_128_window[sf_index][i]; - } - width *= ics->window_group_length[g]; - ics->sect_sfb_offset[g][sect_sfb++] = offset; - offset += width; - } - ics->sect_sfb_offset[g][sect_sfb] = offset; - } - return 0; - default: - return 1; - } -} - -/* iquant() * -/* output = sign(input)*abs(input)^(4/3) */ -/**/ -static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error) -{ -#ifdef FIXED_POINT -/* For FIXED_POINT the iq_table is prescaled by 3 bits (iq_table[]/8) */ -/* BIG_IQ_TABLE allows you to use the full 8192 value table, if this is not - * defined a 1026 value table and interpolation will be used - */ -#ifndef BIG_IQ_TABLE - static const real_t errcorr[] = { - REAL_CONST(0), REAL_CONST(1.0/8.0), REAL_CONST(2.0/8.0), REAL_CONST(3.0/8.0), - REAL_CONST(4.0/8.0), REAL_CONST(5.0/8.0), REAL_CONST(6.0/8.0), REAL_CONST(7.0/8.0), - REAL_CONST(0) - }; - real_t x1, x2; -#endif - int16_t sgn = 1; - - if (q < 0) - { - q = -q; - sgn = -1; - } - - if (q < IQ_TABLE_SIZE) - { -//#define IQUANT_PRINT -#ifdef IQUANT_PRINT - //printf("0x%.8X\n", sgn * tab[q]); - printf("%d\n", sgn * tab[q]); -#endif - return sgn * tab[q]; - } - -#ifndef BIG_IQ_TABLE - if (q >= 8192) - { - *error = 17; - return 0; - } - - /* linear interpolation */ - x1 = tab[q>>3]; - x2 = tab[(q>>3) + 1]; - return sgn * 16 * (MUL_R(errcorr[q&7],(x2-x1)) + x1); -#else - *error = 17; - return 0; -#endif - -#else - if (q < 0) - { - /* tab contains a value for all possible q [0,8192] */ - if (-q < IQ_TABLE_SIZE) - return -tab[-q]; - - *error = 17; - return 0; - } else { - /* tab contains a value for all possible q [0,8192] */ - if (q < IQ_TABLE_SIZE) - return tab[q]; - - *error = 17; - return 0; - } -#endif -} - -#ifndef FIXED_POINT -ALIGN static const real_t pow2sf_tab[] = { - 2.9802322387695313E-008, 5.9604644775390625E-008, 1.1920928955078125E-007, - 2.384185791015625E-007, 4.76837158203125E-007, 9.5367431640625E-007, - 1.9073486328125E-006, 3.814697265625E-006, 7.62939453125E-006, - 1.52587890625E-005, 3.0517578125E-005, 6.103515625E-005, - 0.0001220703125, 0.000244140625, 0.00048828125, - 0.0009765625, 0.001953125, 0.00390625, - 0.0078125, 0.015625, 0.03125, - 0.0625, 0.125, 0.25, - 0.5, 1.0, 2.0, - 4.0, 8.0, 16.0, 32.0, - 64.0, 128.0, 256.0, - 512.0, 1024.0, 2048.0, - 4096.0, 8192.0, 16384.0, - 32768.0, 65536.0, 131072.0, - 262144.0, 524288.0, 1048576.0, - 2097152.0, 4194304.0, 8388608.0, - 16777216.0, 33554432.0, 67108864.0, - 134217728.0, 268435456.0, 536870912.0, - 1073741824.0, 2147483648.0, 4294967296.0, - 8589934592.0, 17179869184.0, 34359738368.0, - 68719476736.0, 137438953472.0, 274877906944.0 -}; -#endif - -/* quant_to_spec: perform dequantisation and scaling - * and in case of short block it also does the deinterleaving - */ -/* - For ONLY_LONG_SEQUENCE windows (num_window_groups = 1, - window_group_length[0] = 1) the spectral data is in ascending spectral - order. - For the EIGHT_SHORT_SEQUENCE window, the spectral order depends on the - grouping in the following manner: - - Groups are ordered sequentially - - Within a group, a scalefactor band consists of the spectral data of all - grouped SHORT_WINDOWs for the associated scalefactor window band. To - clarify via example, the length of a group is in the range of one to eight - SHORT_WINDOWs. - - If there are eight groups each with length one (num_window_groups = 8, - window_group_length[0..7] = 1), the result is a sequence of eight spectra, - each in ascending spectral order. - - If there is only one group with length eight (num_window_groups = 1, - window_group_length[0] = 8), the result is that spectral data of all eight - SHORT_WINDOWs is interleaved by scalefactor window bands. - - Within a scalefactor window band, the coefficients are in ascending - spectral order. -*/ -static uint8_t quant_to_spec(NeAACDecHandle hDecoder, - ic_stream *ics, int16_t *quant_data, - real_t *spec_data, uint16_t frame_len) -{ - ALIGN static const real_t pow2_table[] = - { - COEF_CONST(1.0), - COEF_CONST(1.1892071150027210667174999705605), /* 2^0.25 */ - COEF_CONST(1.4142135623730950488016887242097), /* 2^0.5 */ - COEF_CONST(1.6817928305074290860622509524664) /* 2^0.75 */ - }; - const real_t *tab = iq_table; - - uint8_t g, sfb, win; - uint16_t width, bin, k, gindex, wa, wb; - uint8_t error = 0; /* Init error flag */ -#ifndef FIXED_POINT - real_t scf; -#endif - - k = 0; - gindex = 0; - - for (g = 0; g < ics->num_window_groups; g++) - { - uint16_t j = 0; - uint16_t gincrease = 0; - uint16_t win_inc = ics->swb_offset[ics->num_swb]; - - for (sfb = 0; sfb < ics->num_swb; sfb++) - { - int32_t exp, frac; - - width = ics->swb_offset[sfb+1] - ics->swb_offset[sfb]; - - /* this could be scalefactor for IS or PNS, those can be negative or bigger then 255 */ - /* just ignore them */ - if (ics->scale_factors[g][sfb] < 0 || ics->scale_factors[g][sfb] > 255) - { - exp = 0; - frac = 0; - } else { - /* ics->scale_factors[g][sfb] must be between 0 and 255 */ - exp = (ics->scale_factors[g][sfb] /* - 100 */) >> 2; - /* frac must always be > 0 */ - frac = (ics->scale_factors[g][sfb] /* - 100 */) & 3; - } - -#ifdef FIXED_POINT - exp -= 25; - /* IMDCT pre-scaling */ - if (hDecoder->object_type == LD) - { - exp -= 6 /*9*/; - } else { - if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) - exp -= 4 /*7*/; - else - exp -= 7 /*10*/; - } -#endif - - wa = gindex + j; - -#ifndef FIXED_POINT - scf = pow2sf_tab[exp/*+25*/] * pow2_table[frac]; -#endif - - for (win = 0; win < ics->window_group_length[g]; win++) - { - for (bin = 0; bin < width; bin += 4) - { -#ifndef FIXED_POINT - wb = wa + bin; - - spec_data[wb+0] = iquant(quant_data[k+0], tab, &error) * scf; - spec_data[wb+1] = iquant(quant_data[k+1], tab, &error) * scf; - spec_data[wb+2] = iquant(quant_data[k+2], tab, &error) * scf; - spec_data[wb+3] = iquant(quant_data[k+3], tab, &error) * scf; - -#else - real_t iq0 = iquant(quant_data[k+0], tab, &error); - real_t iq1 = iquant(quant_data[k+1], tab, &error); - real_t iq2 = iquant(quant_data[k+2], tab, &error); - real_t iq3 = iquant(quant_data[k+3], tab, &error); - - wb = wa + bin; - - if (exp < 0) - { - spec_data[wb+0] = iq0 >>= -exp; - spec_data[wb+1] = iq1 >>= -exp; - spec_data[wb+2] = iq2 >>= -exp; - spec_data[wb+3] = iq3 >>= -exp; - } else { - spec_data[wb+0] = iq0 <<= exp; - spec_data[wb+1] = iq1 <<= exp; - spec_data[wb+2] = iq2 <<= exp; - spec_data[wb+3] = iq3 <<= exp; - } - if (frac != 0) - { - spec_data[wb+0] = MUL_C(spec_data[wb+0],pow2_table[frac]); - spec_data[wb+1] = MUL_C(spec_data[wb+1],pow2_table[frac]); - spec_data[wb+2] = MUL_C(spec_data[wb+2],pow2_table[frac]); - spec_data[wb+3] = MUL_C(spec_data[wb+3],pow2_table[frac]); - } - -//#define SCFS_PRINT -#ifdef SCFS_PRINT - printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+0]); - printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+1]); - printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+2]); - printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+3]); - //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+0]); - //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+1]); - //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+2]); - //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+3]); -#endif -#endif - - gincrease += 4; - k += 4; - } - wa += win_inc; - } - j += width; - } - gindex += gincrease; - } - - return error; -} - -static uint8_t allocate_single_channel(NeAACDecHandle hDecoder, uint8_t channel, - uint8_t output_channels) -{ - uint8_t mul = 1; - -#ifdef MAIN_DEC - /* MAIN object type prediction */ - if (hDecoder->object_type == MAIN) - { - 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)) - { - 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 - - mul = 1; -#ifdef SBR_DEC - hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; - if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) - { - /* SBR requires 2 times as much output data */ - mul = 2; - hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; - } -#endif - 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) - { - 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 - - 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) - { - uint16_t k; - 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 - - return 0; -} - -static uint8_t allocate_channel_pair(NeAACDecHandle hDecoder, - uint8_t channel, uint8_t paired_channel) -{ - uint8_t mul = 1; - -#ifdef MAIN_DEC - /* 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)); - reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength); - } - if (hDecoder->pred_stat[paired_channel] == NULL) - { - hDecoder->pred_stat[paired_channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); - reset_all_predictors(hDecoder->pred_stat[paired_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)); - memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); - } - if (hDecoder->lt_pred_stat[paired_channel] == NULL) - { - hDecoder->lt_pred_stat[paired_channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); - memset(hDecoder->lt_pred_stat[paired_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; - if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) - { - /* SBR requires 2 times as much output data */ - mul = 2; - hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; - } -#endif - hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); - } - if (hDecoder->time_out[paired_channel] == NULL) - { - hDecoder->time_out[paired_channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->time_out[paired_channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); - } - - if (hDecoder->fb_intermed[channel] == NULL) - { - hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t)); - } - if (hDecoder->fb_intermed[paired_channel] == NULL) - { - hDecoder->fb_intermed[paired_channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->fb_intermed[paired_channel], 0, hDecoder->frameLength*sizeof(real_t)); - } - -#ifdef SSR_DEC - if (hDecoder->object_type == SSR) - { - if (hDecoder->ssr_overlap[cpe->channel] == NULL) - { - hDecoder->ssr_overlap[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->ssr_overlap[cpe->channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); - } - if (hDecoder->ssr_overlap[cpe->paired_channel] == NULL) - { - hDecoder->ssr_overlap[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->ssr_overlap[cpe->paired_channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); - } - if (hDecoder->prev_fmd[cpe->channel] == NULL) - { - uint16_t k; - hDecoder->prev_fmd[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); - for (k = 0; k < 2*hDecoder->frameLength; k++) - hDecoder->prev_fmd[cpe->channel][k] = REAL_CONST(-1); - } - if (hDecoder->prev_fmd[cpe->paired_channel] == NULL) - { - uint16_t k; - hDecoder->prev_fmd[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); - for (k = 0; k < 2*hDecoder->frameLength; k++) - hDecoder->prev_fmd[cpe->paired_channel][k] = REAL_CONST(-1); - } - } -#endif - - return 0; -} - -uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, - element *sce, int16_t *spec_data) -{ - uint8_t retval, output_channels; - ALIGN real_t spec_coef[1024]; - -#ifdef PROFILE - int64_t count = faad_get_ts(); -#endif - - - /* always allocate 2 channels, PS can always "suddenly" turn up */ -#if (defined(PS_DEC) || defined(DRM_PS)) - output_channels = hDecoder->ps_used[hDecoder->fr_ch_ele] ? 2 : 1; -#else - output_channels = 1; -#endif - - if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0 || - hDecoder->element_output_channels[hDecoder->fr_ch_ele] < output_channels) { - hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels; - retval = allocate_single_channel(hDecoder, sce->channel, output_channels); - if (retval > 0) - return retval; - - hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1; - } - - - /* dequantisation and scaling */ - retval = quant_to_spec(hDecoder, ics, spec_data, spec_coef, hDecoder->frameLength); - if (retval > 0) - return retval; - -#ifdef PROFILE - count = faad_get_ts() - count; - hDecoder->requant_cycles += count; -#endif - - - /* pns decoding */ - pns_decode(ics, NULL, spec_coef, NULL, hDecoder->frameLength, 0, hDecoder->object_type); - -#ifdef MAIN_DEC - /* MAIN object type prediction */ - if (hDecoder->object_type == MAIN) - { - /* intra channel prediction */ - ic_prediction(ics, spec_coef, hDecoder->pred_stat[sce->channel], hDecoder->frameLength, - hDecoder->sf_index); - - /* In addition, for scalefactor bands coded by perceptual - noise substitution the predictors belonging to the - corresponding spectral coefficients are reset. - */ - pns_reset_pred_state(ics, hDecoder->pred_stat[sce->channel]); - } -#endif - -#ifdef LTP_DEC - if (is_ltp_ot(hDecoder->object_type)) - { -#ifdef LD_DEC - if (hDecoder->object_type == LD) - { - if (ics->ltp.data_present) - { - if (ics->ltp.lag_update) - hDecoder->ltp_lag[sce->channel] = ics->ltp.lag; - } - ics->ltp.lag = hDecoder->ltp_lag[sce->channel]; - } -#endif - - /* long term prediction */ - lt_prediction(ics, &(ics->ltp), spec_coef, hDecoder->lt_pred_stat[sce->channel], hDecoder->fb, - ics->window_shape, hDecoder->window_shape_prev[sce->channel], - hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); - } -#endif - - /* tns decoding */ - tns_decode_frame(ics, &(ics->tns), hDecoder->sf_index, hDecoder->object_type, - spec_coef, hDecoder->frameLength); - - /* drc decoding */ - if (hDecoder->drc->present) - { - if (!hDecoder->drc->exclude_mask[sce->channel] || !hDecoder->drc->excluded_chns_present) - drc_decode(hDecoder->drc, spec_coef); - } - - /* filter bank */ -#ifdef SSR_DEC - if (hDecoder->object_type != SSR) - { -#endif - ifilter_bank(hDecoder->fb, ics->window_sequence, ics->window_shape, - hDecoder->window_shape_prev[sce->channel], spec_coef, - hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel], - hDecoder->object_type, hDecoder->frameLength); -#ifdef SSR_DEC - } else { - ssr_decode(&(ics->ssr), hDecoder->fb, ics->window_sequence, ics->window_shape, - hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel], - hDecoder->ssr_overlap[sce->channel], hDecoder->ipqf_buffer[sce->channel], hDecoder->prev_fmd[sce->channel], - hDecoder->frameLength); - } -#endif - - /* save window shape for next frame */ - hDecoder->window_shape_prev[sce->channel] = ics->window_shape; - -#ifdef LTP_DEC - if (is_ltp_ot(hDecoder->object_type)) - { - lt_update_state(hDecoder->lt_pred_stat[sce->channel], hDecoder->time_out[sce->channel], - hDecoder->fb_intermed[sce->channel], hDecoder->frameLength, hDecoder->object_type); - } -#endif - -#ifdef SBR_DEC - if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) - && hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) - { - uint8_t ele = hDecoder->fr_ch_ele; - uint8_t ch = sce->channel; - - /* following case can happen when forceUpSampling == 1 */ - if (hDecoder->sbr[ele] == NULL) - { - hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength, - hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index), - hDecoder->downSampledSBR -#ifdef DRM - , 0 -#endif - ); - } - - if (sce->ics1.window_sequence == EIGHT_SHORT_SEQUENCE) - hDecoder->sbr[ele]->maxAACLine = 8*sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)]; - else - hDecoder->sbr[ele]->maxAACLine = sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)]; - - /* check if any of the PS tools is used */ -#if (defined(PS_DEC) || defined(DRM_PS)) - if (hDecoder->ps_used[ele] == 0) - { -#endif - retval = sbrDecodeSingleFrame(hDecoder->sbr[ele], hDecoder->time_out[ch], - hDecoder->postSeekResetFlag, hDecoder->downSampledSBR); -#if (defined(PS_DEC) || defined(DRM_PS)) - } else { - retval = sbrDecodeSingleFramePS(hDecoder->sbr[ele], hDecoder->time_out[ch], - hDecoder->time_out[ch+1], hDecoder->postSeekResetFlag, - hDecoder->downSampledSBR); - } -#endif - if (retval > 0) - return retval; - } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) - && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) - { - return 23; - } - - /* 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) && (output_channels == 2)) - { - uint8_t ele = hDecoder->fr_ch_ele; - uint8_t ch = sce->channel; - uint16_t frame_size = (hDecoder->sbr_alloced[ele]) ? 2 : 1; - frame_size *= hDecoder->frameLength*sizeof(real_t); - - memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size); - } -#endif -#endif - - return 0; -} - -uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, - element *cpe, int16_t *spec_data1, int16_t *spec_data2) -{ - uint8_t retval; - ALIGN real_t spec_coef1[1024]; - ALIGN real_t spec_coef2[1024]; - -#ifdef PROFILE - int64_t count = faad_get_ts(); -#endif - if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) - { - retval = allocate_channel_pair(hDecoder, cpe->channel, (uint8_t)cpe->paired_channel); - if (retval > 0) - return retval; - - hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1; - } - - /* dequantisation and scaling */ - retval = quant_to_spec(hDecoder, ics1, spec_data1, spec_coef1, hDecoder->frameLength); - if (retval > 0) - return retval; - retval = quant_to_spec(hDecoder, ics2, spec_data2, spec_coef2, hDecoder->frameLength); - if (retval > 0) - return retval; - -#ifdef PROFILE - count = faad_get_ts() - count; - hDecoder->requant_cycles += count; -#endif - - - /* pns decoding */ - if (ics1->ms_mask_present) - { - pns_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength, 1, hDecoder->object_type); - } else { - pns_decode(ics1, NULL, spec_coef1, NULL, hDecoder->frameLength, 0, hDecoder->object_type); - pns_decode(ics2, NULL, spec_coef2, NULL, hDecoder->frameLength, 0, hDecoder->object_type); - } - - /* mid/side decoding */ - ms_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength); - -#if 0 - { - int i; - for (i = 0; i < 1024; i++) - { - //printf("%d\n", spec_coef1[i]); - printf("0x%.8X\n", spec_coef1[i]); - } - for (i = 0; i < 1024; i++) - { - //printf("%d\n", spec_coef2[i]); - printf("0x%.8X\n", spec_coef2[i]); - } - } -#endif - - /* intensity stereo decoding */ - is_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength); - -#if 0 - { - int i; - for (i = 0; i < 1024; i++) - { - printf("%d\n", spec_coef1[i]); - //printf("0x%.8X\n", spec_coef1[i]); - } - for (i = 0; i < 1024; i++) - { - printf("%d\n", spec_coef2[i]); - //printf("0x%.8X\n", spec_coef2[i]); - } - } -#endif - -#ifdef MAIN_DEC - /* MAIN object type prediction */ - if (hDecoder->object_type == MAIN) - { - /* intra channel prediction */ - ic_prediction(ics1, spec_coef1, hDecoder->pred_stat[cpe->channel], hDecoder->frameLength, - hDecoder->sf_index); - ic_prediction(ics2, spec_coef2, hDecoder->pred_stat[cpe->paired_channel], hDecoder->frameLength, - hDecoder->sf_index); - - /* In addition, for scalefactor bands coded by perceptual - noise substitution the predictors belonging to the - corresponding spectral coefficients are reset. - */ - pns_reset_pred_state(ics1, hDecoder->pred_stat[cpe->channel]); - pns_reset_pred_state(ics2, hDecoder->pred_stat[cpe->paired_channel]); - } -#endif - -#ifdef LTP_DEC - if (is_ltp_ot(hDecoder->object_type)) - { - ltp_info *ltp1 = &(ics1->ltp); - ltp_info *ltp2 = (cpe->common_window) ? &(ics2->ltp2) : &(ics2->ltp); -#ifdef LD_DEC - if (hDecoder->object_type == LD) - { - if (ltp1->data_present) - { - if (ltp1->lag_update) - hDecoder->ltp_lag[cpe->channel] = ltp1->lag; - } - ltp1->lag = hDecoder->ltp_lag[cpe->channel]; - if (ltp2->data_present) - { - if (ltp2->lag_update) - hDecoder->ltp_lag[cpe->paired_channel] = ltp2->lag; - } - ltp2->lag = hDecoder->ltp_lag[cpe->paired_channel]; - } -#endif - - /* long term prediction */ - lt_prediction(ics1, ltp1, spec_coef1, hDecoder->lt_pred_stat[cpe->channel], hDecoder->fb, - ics1->window_shape, hDecoder->window_shape_prev[cpe->channel], - hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); - lt_prediction(ics2, ltp2, spec_coef2, hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->fb, - ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel], - hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); - } -#endif - - /* tns decoding */ - tns_decode_frame(ics1, &(ics1->tns), hDecoder->sf_index, hDecoder->object_type, - spec_coef1, hDecoder->frameLength); - tns_decode_frame(ics2, &(ics2->tns), hDecoder->sf_index, hDecoder->object_type, - spec_coef2, hDecoder->frameLength); - - /* drc decoding */ - if (hDecoder->drc->present) - { - if (!hDecoder->drc->exclude_mask[cpe->channel] || !hDecoder->drc->excluded_chns_present) - drc_decode(hDecoder->drc, spec_coef1); - if (!hDecoder->drc->exclude_mask[cpe->paired_channel] || !hDecoder->drc->excluded_chns_present) - drc_decode(hDecoder->drc, spec_coef2); - } - - /* filter bank */ -#ifdef SSR_DEC - if (hDecoder->object_type != SSR) - { -#endif - ifilter_bank(hDecoder->fb, ics1->window_sequence, ics1->window_shape, - hDecoder->window_shape_prev[cpe->channel], spec_coef1, - hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel], - hDecoder->object_type, hDecoder->frameLength); - ifilter_bank(hDecoder->fb, ics2->window_sequence, ics2->window_shape, - hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, - hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel], - hDecoder->object_type, hDecoder->frameLength); -#ifdef SSR_DEC - } else { - ssr_decode(&(ics1->ssr), hDecoder->fb, ics1->window_sequence, ics1->window_shape, - hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel], - hDecoder->ssr_overlap[cpe->channel], hDecoder->ipqf_buffer[cpe->channel], - hDecoder->prev_fmd[cpe->channel], hDecoder->frameLength); - ssr_decode(&(ics2->ssr), hDecoder->fb, ics2->window_sequence, ics2->window_shape, - hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, hDecoder->time_out[cpe->paired_channel], - hDecoder->ssr_overlap[cpe->paired_channel], hDecoder->ipqf_buffer[cpe->paired_channel], - hDecoder->prev_fmd[cpe->paired_channel], hDecoder->frameLength); - } -#endif - - /* save window shape for next frame */ - hDecoder->window_shape_prev[cpe->channel] = ics1->window_shape; - hDecoder->window_shape_prev[cpe->paired_channel] = ics2->window_shape; - -#ifdef LTP_DEC - if (is_ltp_ot(hDecoder->object_type)) - { - lt_update_state(hDecoder->lt_pred_stat[cpe->channel], hDecoder->time_out[cpe->channel], - hDecoder->fb_intermed[cpe->channel], hDecoder->frameLength, hDecoder->object_type); - lt_update_state(hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->time_out[cpe->paired_channel], - hDecoder->fb_intermed[cpe->paired_channel], hDecoder->frameLength, hDecoder->object_type); - } -#endif - -#ifdef SBR_DEC - if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) - && hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) - { - uint8_t ele = hDecoder->fr_ch_ele; - uint8_t ch0 = cpe->channel; - uint8_t ch1 = cpe->paired_channel; - - /* following case can happen when forceUpSampling == 1 */ - if (hDecoder->sbr[ele] == NULL) - { - hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength, - hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index), - hDecoder->downSampledSBR -#ifdef DRM - , 0 -#endif - ); - } - - if (cpe->ics1.window_sequence == EIGHT_SHORT_SEQUENCE) - hDecoder->sbr[ele]->maxAACLine = 8*cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)]; - else - hDecoder->sbr[ele]->maxAACLine = cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)]; - - retval = sbrDecodeCoupleFrame(hDecoder->sbr[ele], - hDecoder->time_out[ch0], hDecoder->time_out[ch1], - hDecoder->postSeekResetFlag, hDecoder->downSampledSBR); - if (retval > 0) - return retval; - } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) - && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) - { - return 23; - } -#endif - - return 0; -} diff --git a/mplayer/libfaad2/specrec.h b/mplayer/libfaad2/specrec.h deleted file mode 100644 index 957190ec..00000000 --- a/mplayer/libfaad2/specrec.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: specrec.h,v 1.28 2004/09/04 14:56:29 menno Exp $ -**/ - -#ifndef __SPECREC_H__ -#define __SPECREC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "syntax.h" - -uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics); -uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, - element *cpe, int16_t *spec_data1, int16_t *spec_data2); -uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, element *sce, - int16_t *spec_data); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/ssr.c b/mplayer/libfaad2/ssr.c deleted file mode 100644 index 3a7413ea..00000000 --- a/mplayer/libfaad2/ssr.c +++ /dev/null @@ -1,172 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: ssr.c,v 1.15 2004/09/04 14:56:29 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#ifdef SSR_DEC - -#include "syntax.h" -#include "filtbank.h" -#include "ssr.h" -#include "ssr_fb.h" - -void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence, - uint8_t window_shape, uint8_t window_shape_prev, - real_t *freq_in, real_t *time_out, real_t *overlap, - real_t ipqf_buffer[SSR_BANDS][96/4], - real_t *prev_fmd, uint16_t frame_len) -{ - uint8_t band; - uint16_t ssr_frame_len = frame_len/SSR_BANDS; - real_t time_tmp[2048] = {0}; - real_t output[1024] = {0}; - - for (band = 0; band < SSR_BANDS; band++) - { - int16_t j; - - /* uneven bands have inverted frequency scale */ - if (band == 1 || band == 3) - { - for (j = 0; j < ssr_frame_len/2; j++) - { - real_t tmp; - tmp = freq_in[j + ssr_frame_len*band]; - freq_in[j + ssr_frame_len*band] = - freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band]; - freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band] = tmp; - } - } - - /* non-overlapping inverse filterbank for SSR */ - ssr_ifilter_bank(fb, window_sequence, window_shape, window_shape_prev, - freq_in + band*ssr_frame_len, time_tmp + band*ssr_frame_len, - ssr_frame_len); - - /* gain control */ - ssr_gain_control(ssr, time_tmp, output, overlap, prev_fmd, - band, window_sequence, ssr_frame_len); - } - - /* inverse pqf to bring subbands together again */ - ssr_ipqf(ssr, output, time_out, ipqf_buffer, frame_len, SSR_BANDS); -} - -static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output, - real_t *overlap, real_t *prev_fmd, uint8_t band, - uint8_t window_sequence, uint16_t frame_len) -{ - uint16_t i; - real_t gc_function[2*1024/SSR_BANDS]; - - if (window_sequence != EIGHT_SHORT_SEQUENCE) - { - ssr_gc_function(ssr, &prev_fmd[band * frame_len*2], - gc_function, window_sequence, band, frame_len); - - for (i = 0; i < frame_len*2; i++) - data[band * frame_len*2 + i] *= gc_function[i]; - for (i = 0; i < frame_len; i++) - { - output[band*frame_len + i] = overlap[band*frame_len + i] + - data[band*frame_len*2 + i]; - } - for (i = 0; i < frame_len; i++) - { - overlap[band*frame_len + i] = - data[band*frame_len*2 + frame_len + i]; - } - } else { - uint8_t w; - for (w = 0; w < 8; w++) - { - uint16_t frame_len8 = frame_len/8; - uint16_t frame_len16 = frame_len/16; - - ssr_gc_function(ssr, &prev_fmd[band*frame_len*2 + w*frame_len*2/8], - gc_function, window_sequence, frame_len); - - for (i = 0; i < frame_len8*2; i++) - data[band*frame_len*2 + w*frame_len8*2+i] *= gc_function[i]; - for (i = 0; i < frame_len8; i++) - { - overlap[band*frame_len + i + 7*frame_len16 + w*frame_len8] += - data[band*frame_len*2 + 2*w*frame_len8 + i]; - } - for (i = 0; i < frame_len8; i++) - { - overlap[band*frame_len + i + 7*frame_len16 + (w+1)*frame_len8] = - data[band*frame_len*2 + 2*w*frame_len8 + frame_len8 + i]; - } - } - for (i = 0; i < frame_len; i++) - output[band*frame_len + i] = overlap[band*frame_len + i]; - for (i = 0; i < frame_len; i++) - overlap[band*frame_len + i] = overlap[band*frame_len + i + frame_len]; - } -} - -static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd, - real_t *gc_function, uint8_t window_sequence, - uint8_t band, uint16_t frame_len) -{ - uint16_t i; - uint16_t len_area1, len_area2; - int32_t aloc[10]; - real_t alev[10]; - - switch (window_sequence) - { - case ONLY_LONG_SEQUENCE: - len_area1 = frame_len/SSR_BANDS; - len_area2 = 0; - break; - case LONG_START_SEQUENCE: - len_area1 = (frame_len/SSR_BANDS)*7/32; - len_area2 = (frame_len/SSR_BANDS)/16; - break; - case EIGHT_SHORT_SEQUENCE: - len_area1 = (frame_len/8)/SSR_BANDS; - len_area2 = 0; - break; - case LONG_STOP_SEQUENCE: - len_area1 = (frame_len/SSR_BANDS); - len_area2 = 0; - break; - } - - /* decode bitstream information */ - - /* build array M */ - - - for (i = 0; i < frame_len*2; i++) - gc_function[i] = 1; -} - -#endif diff --git a/mplayer/libfaad2/ssr.h b/mplayer/libfaad2/ssr.h deleted file mode 100644 index fd8b0029..00000000 --- a/mplayer/libfaad2/ssr.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: ssr.h,v 1.15 2004/09/04 14:56:29 menno Exp $ -**/ - -#ifndef __SSR_H__ -#define __SSR_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#define SSR_BANDS 4 -#define PQFTAPS 96 - -void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence, - uint8_t window_shape, uint8_t window_shape_prev, - real_t *freq_in, real_t *time_out, real_t *overlap, - real_t ipqf_buffer[SSR_BANDS][96/4], - real_t *prev_fmd, uint16_t frame_len); - - -static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output, - real_t *overlap, real_t *prev_fmd, uint8_t band, - uint8_t window_sequence, uint16_t frame_len); -static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd, - real_t *gc_function, uint8_t window_sequence, - uint16_t frame_len); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/ssr_fb.c b/mplayer/libfaad2/ssr_fb.c deleted file mode 100644 index f619ea30..00000000 --- a/mplayer/libfaad2/ssr_fb.c +++ /dev/null @@ -1,182 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: ssr_fb.c,v 1.13 2004/09/04 14:56:29 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#ifdef SSR_DEC - -#include -#include -#include "syntax.h" -#include "filtbank.h" -#include "mdct.h" -#include "ssr_fb.h" -#include "ssr_win.h" - -fb_info *ssr_filter_bank_init(uint16_t frame_len) -{ - uint16_t nshort = frame_len/8; - - fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info)); - memset(fb, 0, sizeof(fb_info)); - - /* normal */ - fb->mdct256 = faad_mdct_init(2*nshort); - fb->mdct2048 = faad_mdct_init(2*frame_len); - - fb->long_window[0] = sine_long_256; - fb->short_window[0] = sine_short_32; - fb->long_window[1] = kbd_long_256; - fb->short_window[1] = kbd_short_32; - - return fb; -} - -void ssr_filter_bank_end(fb_info *fb) -{ - faad_mdct_end(fb->mdct256); - faad_mdct_end(fb->mdct2048); - - if (fb) faad_free(fb); -} - -static INLINE void imdct_ssr(fb_info *fb, real_t *in_data, - real_t *out_data, uint16_t len) -{ - mdct_info *mdct; - - switch (len) - { - case 512: - mdct = fb->mdct2048; - break; - case 64: - mdct = fb->mdct256; - break; - } - - faad_imdct(mdct, in_data, out_data); -} - -/* NON-overlapping inverse filterbank for use with SSR */ -void ssr_ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, - uint8_t window_shape_prev, real_t *freq_in, - real_t *time_out, uint16_t frame_len) -{ - int16_t i; - real_t *transf_buf; - - real_t *window_long; - real_t *window_long_prev; - real_t *window_short; - real_t *window_short_prev; - - uint16_t nlong = frame_len; - uint16_t nshort = frame_len/8; - uint16_t trans = nshort/2; - - uint16_t nflat_ls = (nlong-nshort)/2; - - transf_buf = (real_t*)faad_malloc(2*nlong*sizeof(real_t)); - - window_long = fb->long_window[window_shape]; - window_long_prev = fb->long_window[window_shape_prev]; - window_short = fb->short_window[window_shape]; - window_short_prev = fb->short_window[window_shape_prev]; - - switch (window_sequence) - { - case ONLY_LONG_SEQUENCE: - imdct_ssr(fb, freq_in, transf_buf, 2*nlong); - for (i = nlong-1; i >= 0; i--) - { - time_out[i] = MUL_R_C(transf_buf[i],window_long_prev[i]); - time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]); - } - break; - - case LONG_START_SEQUENCE: - imdct_ssr(fb, freq_in, transf_buf, 2*nlong); - for (i = 0; i < nlong; i++) - time_out[i] = MUL_R_C(transf_buf[i],window_long_prev[i]); - for (i = 0; i < nflat_ls; i++) - time_out[nlong+i] = transf_buf[nlong+i]; - for (i = 0; i < nshort; i++) - time_out[nlong+nflat_ls+i] = MUL_R_C(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]); - for (i = 0; i < nflat_ls; i++) - time_out[nlong+nflat_ls+nshort+i] = 0; - break; - - case EIGHT_SHORT_SEQUENCE: - imdct_ssr(fb, freq_in+0*nshort, transf_buf+2*nshort*0, 2*nshort); - imdct_ssr(fb, freq_in+1*nshort, transf_buf+2*nshort*1, 2*nshort); - imdct_ssr(fb, freq_in+2*nshort, transf_buf+2*nshort*2, 2*nshort); - imdct_ssr(fb, freq_in+3*nshort, transf_buf+2*nshort*3, 2*nshort); - imdct_ssr(fb, freq_in+4*nshort, transf_buf+2*nshort*4, 2*nshort); - imdct_ssr(fb, freq_in+5*nshort, transf_buf+2*nshort*5, 2*nshort); - imdct_ssr(fb, freq_in+6*nshort, transf_buf+2*nshort*6, 2*nshort); - imdct_ssr(fb, freq_in+7*nshort, transf_buf+2*nshort*7, 2*nshort); - for(i = nshort-1; i >= 0; i--) - { - time_out[i+0*nshort] = MUL_R_C(transf_buf[nshort*0+i],window_short_prev[i]); - time_out[i+1*nshort] = MUL_R_C(transf_buf[nshort*1+i],window_short[i]); - time_out[i+2*nshort] = MUL_R_C(transf_buf[nshort*2+i],window_short_prev[i]); - time_out[i+3*nshort] = MUL_R_C(transf_buf[nshort*3+i],window_short[i]); - time_out[i+4*nshort] = MUL_R_C(transf_buf[nshort*4+i],window_short_prev[i]); - time_out[i+5*nshort] = MUL_R_C(transf_buf[nshort*5+i],window_short[i]); - time_out[i+6*nshort] = MUL_R_C(transf_buf[nshort*6+i],window_short_prev[i]); - time_out[i+7*nshort] = MUL_R_C(transf_buf[nshort*7+i],window_short[i]); - time_out[i+8*nshort] = MUL_R_C(transf_buf[nshort*8+i],window_short_prev[i]); - time_out[i+9*nshort] = MUL_R_C(transf_buf[nshort*9+i],window_short[i]); - time_out[i+10*nshort] = MUL_R_C(transf_buf[nshort*10+i],window_short_prev[i]); - time_out[i+11*nshort] = MUL_R_C(transf_buf[nshort*11+i],window_short[i]); - time_out[i+12*nshort] = MUL_R_C(transf_buf[nshort*12+i],window_short_prev[i]); - time_out[i+13*nshort] = MUL_R_C(transf_buf[nshort*13+i],window_short[i]); - time_out[i+14*nshort] = MUL_R_C(transf_buf[nshort*14+i],window_short_prev[i]); - time_out[i+15*nshort] = MUL_R_C(transf_buf[nshort*15+i],window_short[i]); - } - break; - - case LONG_STOP_SEQUENCE: - imdct_ssr(fb, freq_in, transf_buf, 2*nlong); - for (i = 0; i < nflat_ls; i++) - time_out[i] = 0; - for (i = 0; i < nshort; i++) - time_out[nflat_ls+i] = MUL_R_C(transf_buf[nflat_ls+i],window_short_prev[i]); - for (i = 0; i < nflat_ls; i++) - time_out[nflat_ls+nshort+i] = transf_buf[nflat_ls+nshort+i]; - for (i = 0; i < nlong; i++) - time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]); - break; - } - - faad_free(transf_buf); -} - - -#endif diff --git a/mplayer/libfaad2/ssr_fb.h b/mplayer/libfaad2/ssr_fb.h deleted file mode 100644 index da0a647e..00000000 --- a/mplayer/libfaad2/ssr_fb.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -** FAAD - Freeware Advanced Audio Decoder -** Copyright (C) 2002 M. Bakker -** -** 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. -** -** $Id: ssr_fb.h,v 1.13 2004/09/04 14:56:29 menno Exp $ -**/ - -#ifndef __SSR_FB_H__ -#define __SSR_FB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -fb_info *ssr_filter_bank_init(uint16_t frame_len); -void ssr_filter_bank_end(fb_info *fb); - -/*non overlapping inverse filterbank */ -void ssr_ifilter_bank(fb_info *fb, - uint8_t window_sequence, - uint8_t window_shape, - uint8_t window_shape_prev, - real_t *freq_in, - real_t *time_out, - uint16_t frame_len); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/ssr_ipqf.c b/mplayer/libfaad2/ssr_ipqf.c deleted file mode 100644 index 34e71a3d..00000000 --- a/mplayer/libfaad2/ssr_ipqf.c +++ /dev/null @@ -1,188 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: ssr_ipqf.c,v 1.14 2004/09/04 14:56:29 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#ifdef SSR_DEC - -#include "ssr.h" -#include "ssr_ipqf.h" - -static real_t **app_pqfbuf; -static real_t **pp_q0, **pp_t0, **pp_t1; - -void gc_set_protopqf(real_t *p_proto) -{ - int j; - static real_t a_half[48] = - { - 1.2206911375946939E-05, 1.7261986723798209E-05, 1.2300093657077942E-05, - -1.0833943097791965E-05, -5.7772498639901686E-05, -1.2764767618947719E-04, - -2.0965186675013334E-04, -2.8166673689263850E-04, -3.1234860429017460E-04, - -2.6738519958452353E-04, -1.1949424681824722E-04, 1.3965139412648678E-04, - 4.8864136409185725E-04, 8.7044629275148344E-04, 1.1949430269934793E-03, - 1.3519708175026700E-03, 1.2346314373964412E-03, 7.6953209114159191E-04, - -5.2242432579537141E-05, -1.1516092887213454E-03, -2.3538469841711277E-03, - -3.4033123072127277E-03, -4.0028551071986133E-03, -3.8745415659693259E-03, - -2.8321073426874310E-03, -8.5038892323704195E-04, 1.8856751185350931E-03, - 4.9688741735340923E-03, 7.8056704536795926E-03, 9.7027909685901654E-03, - 9.9960423120166159E-03, 8.2019366335594487E-03, 4.1642072876103365E-03, - -1.8364453822737758E-03, -9.0384863094167686E-03, -1.6241528177129844E-02, - -2.1939551286300665E-02, -2.4533179947088161E-02, -2.2591663337768787E-02, - -1.5122066420044672E-02, -1.7971713448186293E-03, 1.6903413428575379E-02, - 3.9672315874127042E-02, 6.4487527248102796E-02, 8.8850025474701726E-02, - 0.1101132906105560 , 0.1258540205143761 , 0.1342239368467012 - }; - - for (j = 0; j < 48; ++j) - { - p_proto[j] = p_proto[95-j] = a_half[j]; - } -} - -void gc_setcoef_eff_pqfsyn(int mm, - int kk, - real_t *p_proto, - real_t ***ppp_q0, - real_t ***ppp_t0, - real_t ***ppp_t1) -{ - int i, k, n; - real_t w; - - /* Set 1st Mul&Acc Coef's */ - *ppp_q0 = (real_t **) calloc(mm, sizeof(real_t *)); - for (n = 0; n < mm; ++n) - { - (*ppp_q0)[n] = (real_t *) calloc(mm, sizeof(real_t)); - } - for (n = 0; n < mm/2; ++n) - { - for (i = 0; i < mm; ++i) - { - w = (2*i+1)*(2*n+1-mm)*M_PI/(4*mm); - (*ppp_q0)[n][i] = 2.0 * cos((real_t) w); - - w = (2*i+1)*(2*(mm+n)+1-mm)*M_PI/(4*mm); - (*ppp_q0)[n + mm/2][i] = 2.0 * cos((real_t) w); - } - } - - /* Set 2nd Mul&Acc Coef's */ - *ppp_t0 = (real_t **) calloc(mm, sizeof(real_t *)); - *ppp_t1 = (real_t **) calloc(mm, sizeof(real_t *)); - for (n = 0; n < mm; ++n) - { - (*ppp_t0)[n] = (real_t *) calloc(kk, sizeof(real_t)); - (*ppp_t1)[n] = (real_t *) calloc(kk, sizeof(real_t)); - } - for (n = 0; n < mm; ++n) - { - for (k = 0; k < kk; ++k) - { - (*ppp_t0)[n][k] = mm * p_proto[2*k *mm + n]; - (*ppp_t1)[n][k] = mm * p_proto[(2*k+1)*mm + n]; - - if (k%2 != 0) - { - (*ppp_t0)[n][k] = -(*ppp_t0)[n][k]; - (*ppp_t1)[n][k] = -(*ppp_t1)[n][k]; - } - } - } -} - -void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data, - real_t buffer[SSR_BANDS][96/4], - uint16_t frame_len, uint8_t bands) -{ - static int initFlag = 0; - real_t a_pqfproto[PQFTAPS]; - - int i; - - if (initFlag == 0) - { - gc_set_protopqf(a_pqfproto); - gc_setcoef_eff_pqfsyn(SSR_BANDS, PQFTAPS/(2*SSR_BANDS), a_pqfproto, - &pp_q0, &pp_t0, &pp_t1); - initFlag = 1; - } - - for (i = 0; i < frame_len / SSR_BANDS; i++) - { - int l, n, k; - int mm = SSR_BANDS; - int kk = PQFTAPS/(2*SSR_BANDS); - - for (n = 0; n < mm; n++) - { - for (k = 0; k < 2*kk-1; k++) - { - buffer[n][k] = buffer[n][k+1]; - } - } - - for (n = 0; n < mm; n++) - { - real_t acc = 0.0; - for (l = 0; l < mm; l++) - { - acc += pp_q0[n][l] * in_data[l*frame_len/SSR_BANDS + i]; - } - buffer[n][2*kk-1] = acc; - } - - for (n = 0; n < mm/2; n++) - { - real_t acc = 0.0; - for (k = 0; k < kk; k++) - { - acc += pp_t0[n][k] * buffer[n][2*kk-1-2*k]; - } - for (k = 0; k < kk; ++k) - { - acc += pp_t1[n][k] * buffer[n + mm/2][2*kk-2-2*k]; - } - out_data[i*SSR_BANDS + n] = acc; - - acc = 0.0; - for (k = 0; k < kk; k++) - { - acc += pp_t0[mm-1-n][k] * buffer[n][2*kk-1-2*k]; - } - for (k = 0; k < kk; k++) - { - acc -= pp_t1[mm-1-n][k] * buffer[n + mm/2][2*kk-2-2*k]; - } - out_data[i*SSR_BANDS + mm-1-n] = acc; - } - } -} - -#endif diff --git a/mplayer/libfaad2/ssr_ipqf.h b/mplayer/libfaad2/ssr_ipqf.h deleted file mode 100644 index 4c45580f..00000000 --- a/mplayer/libfaad2/ssr_ipqf.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -** FAAD - Freeware Advanced Audio Decoder -** Copyright (C) 2002 M. Bakker -** -** 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. -** -** $Id: ssr_ipqf.h,v 1.14 2004/09/04 14:56:29 menno Exp $ -**/ - -#ifndef __SSR_IPQF_H__ -#define __SSR_IPQF_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data, - real_t buffer[SSR_BANDS][96/4], - uint16_t frame_len, uint8_t bands); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/ssr_win.h b/mplayer/libfaad2/ssr_win.h deleted file mode 100644 index c0c4cc53..00000000 --- a/mplayer/libfaad2/ssr_win.h +++ /dev/null @@ -1,626 +0,0 @@ -/* -** FAAD - Freeware Advanced Audio Decoder -** Copyright (C) 2002 M. Bakker -** -** 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. -** -** $Id: ssr_win.h,v 1.13 2004/09/04 14:56:29 menno Exp $ -**/ - -#ifndef __SSR_WIN_H__ -#define __SSR_WIN_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _MSC_VER -#pragma warning(disable:4305) -#pragma warning(disable:4244) -#endif - -static real_t sine_short_32[] = { - 0.0245412290, - 0.0735645667, - 0.1224106774, - 0.1709618866, - 0.2191012502, - 0.2667127550, - 0.3136817515, - 0.3598950505, - 0.4052413106, - 0.4496113360, - 0.4928981960, - 0.5349976420, - 0.5758082271, - 0.6152316332, - 0.6531728506, - 0.6895405650, - 0.7242470980, - 0.7572088838, - 0.7883464694, - 0.8175848126, - 0.8448535800, - 0.8700870275, - 0.8932242990, - 0.9142097831, - 0.9329928160, - 0.9495282173, - 0.9637760520, - 0.9757021666, - 0.9852776527, - 0.9924795628, - 0.9972904325, - 0.9996988177 -}; - -static real_t sine_long_256[] = { - 0.0030679568, - 0.0092037553, - 0.0153392069, - 0.0214740802, - 0.0276081469, - 0.0337411724, - 0.0398729295, - 0.0460031852, - 0.0521317050, - 0.0582582653, - 0.0643826351, - 0.0705045760, - 0.0766238645, - 0.0827402696, - 0.0888535529, - 0.0949634984, - 0.1010698676, - 0.1071724296, - 0.1132709533, - 0.1193652153, - 0.1254549921, - 0.1315400302, - 0.1376201212, - 0.1436950415, - 0.1497645378, - 0.1558284014, - 0.1618863940, - 0.1679383069, - 0.1739838719, - 0.1800229102, - 0.1860551536, - 0.1920804083, - 0.1980984211, - 0.2041089684, - 0.2101118416, - 0.2161068022, - 0.2220936269, - 0.2280720919, - 0.2340419590, - 0.2400030345, - 0.2459550500, - 0.2518978119, - 0.2578310966, - 0.2637546957, - 0.2696683407, - 0.2755718231, - 0.2814649343, - 0.2873474658, - 0.2932191789, - 0.2990798354, - 0.3049292266, - 0.3107671738, - 0.3165933788, - 0.3224076927, - 0.3282098472, - 0.3339996636, - 0.3397769034, - 0.3455413282, - 0.3512927592, - 0.3570309579, - 0.3627557456, - 0.3684668541, - 0.3741640747, - 0.3798472285, - 0.3855160773, - 0.3911703825, - 0.3968099952, - 0.4024346471, - 0.4080441594, - 0.4136383235, - 0.4192169011, - 0.4247796834, - 0.4303264916, - 0.4358570874, - 0.4413712919, - 0.4468688369, - 0.4523496032, - 0.4578133225, - 0.4632597864, - 0.4686888456, - 0.4741002321, - 0.4794937670, - 0.4848692715, - 0.4902265072, - 0.4955652654, - 0.5008853674, - 0.5061866641, - 0.5114688873, - 0.5167317986, - 0.5219752789, - 0.5271991491, - 0.5324031115, - 0.5375871062, - 0.5427507758, - 0.5478940606, - 0.5530167222, - 0.5581185222, - 0.5631993413, - 0.5682589412, - 0.5732972026, - 0.5783138275, - 0.5833086967, - 0.5882815719, - 0.5932323337, - 0.5981607437, - 0.6030666232, - 0.6079497933, - 0.6128100753, - 0.6176473498, - 0.6224613190, - 0.6272518039, - 0.6320187449, - 0.6367619038, - 0.6414810419, - 0.6461760402, - 0.6508467197, - 0.6554928422, - 0.6601143479, - 0.6647109985, - 0.6692826152, - 0.6738290191, - 0.6783500314, - 0.6828455329, - 0.6873153448, - 0.6917592883, - 0.6961771250, - 0.7005687952, - 0.7049341202, - 0.7092728615, - 0.7135848999, - 0.7178700566, - 0.7221282125, - 0.7263591886, - 0.7305628061, - 0.7347388864, - 0.7388873696, - 0.7430079579, - 0.7471006513, - 0.7511651516, - 0.7552013993, - 0.7592092156, - 0.7631884217, - 0.7671388984, - 0.7710605264, - 0.7749531269, - 0.7788165212, - 0.7826505899, - 0.7864552140, - 0.7902302146, - 0.7939754725, - 0.7976908684, - 0.8013761640, - 0.8050313592, - 0.8086562157, - 0.8122506142, - 0.8158144355, - 0.8193475604, - 0.8228498101, - 0.8263210654, - 0.8297612667, - 0.8331701756, - 0.8365477324, - 0.8398938179, - 0.8432082534, - 0.8464909792, - 0.8497417569, - 0.8529606462, - 0.8561473489, - 0.8593018055, - 0.8624239564, - 0.8655136228, - 0.8685707450, - 0.8715950847, - 0.8745866418, - 0.8775452971, - 0.8804709315, - 0.8833633661, - 0.8862225413, - 0.8890483975, - 0.8918406963, - 0.8945994973, - 0.8973246217, - 0.9000158906, - 0.9026733041, - 0.9052967429, - 0.9078861475, - 0.9104412794, - 0.9129621983, - 0.9154487252, - 0.9179008007, - 0.9203183055, - 0.9227011204, - 0.9250492454, - 0.9273625612, - 0.9296408892, - 0.9318842888, - 0.9340925813, - 0.9362657070, - 0.9384035468, - 0.9405061007, - 0.9425731897, - 0.9446048737, - 0.9466009140, - 0.9485613704, - 0.9504860640, - 0.9523749948, - 0.9542281032, - 0.9560452700, - 0.9578264356, - 0.9595715404, - 0.9612805247, - 0.9629532695, - 0.9645897746, - 0.9661900401, - 0.9677538276, - 0.9692812562, - 0.9707721472, - 0.9722265005, - 0.9736442566, - 0.9750253558, - 0.9763697386, - 0.9776773453, - 0.9789481759, - 0.9801821709, - 0.9813792109, - 0.9825392962, - 0.9836624265, - 0.9847484827, - 0.9857975245, - 0.9868094325, - 0.9877841473, - 0.9887216687, - 0.9896219969, - 0.9904850721, - 0.9913108945, - 0.9920993447, - 0.9928504229, - 0.9935641289, - 0.9942404628, - 0.9948793054, - 0.9954807758, - 0.9960446954, - 0.9965711236, - 0.9970600605, - 0.9975114465, - 0.9979252815, - 0.9983015656, - 0.9986402392, - 0.9989413023, - 0.9992047548, - 0.9994305968, - 0.9996188283, - 0.9997693896, - 0.9998823404, - 0.9999576211, - 0.9999952912 -}; - -static real_t kbd_short_32[] = { - 0.0000875914060105, - 0.0009321760265333, - 0.0032114611466596, - 0.0081009893216786, - 0.0171240286619181, - 0.0320720743527833, - 0.0548307856028528, - 0.0871361822564870, - 0.1302923415174603, - 0.1848955425508276, - 0.2506163195331889, - 0.3260874142923209, - 0.4089316830907141, - 0.4959414909423747, - 0.5833939894958904, - 0.6674601983218376, - 0.7446454751465113, - 0.8121892962974020, - 0.8683559394406505, - 0.9125649996381605, - 0.9453396205809574, - 0.9680864942677585, - 0.9827581789763112, - 0.9914756203467121, - 0.9961964092194694, - 0.9984956609571091, - 0.9994855586984285, - 0.9998533730714648, - 0.9999671864476404, - 0.9999948432453556, - 0.9999995655238333, - 0.9999999961638728 -}; - - -static real_t kbd_long_256[] = { - 0.0005851230124487, - 0.0009642149851497, - 0.0013558207534965, - 0.0017771849644394, - 0.0022352533849672, - 0.0027342299070304, - 0.0032773001022195, - 0.0038671998069216, - 0.0045064443384152, - 0.0051974336885144, - 0.0059425050016407, - 0.0067439602523141, - 0.0076040812644888, - 0.0085251378135895, - 0.0095093917383048, - 0.0105590986429280, - 0.0116765080854300, - 0.0128638627792770, - 0.0141233971318631, - 0.0154573353235409, - 0.0168678890600951, - 0.0183572550877256, - 0.0199276125319803, - 0.0215811201042484, - 0.0233199132076965, - 0.0251461009666641, - 0.0270617631981826, - 0.0290689473405856, - 0.0311696653515848, - 0.0333658905863535, - 0.0356595546648444, - 0.0380525443366107, - 0.0405466983507029, - 0.0431438043376910, - 0.0458455957104702, - 0.0486537485902075, - 0.0515698787635492, - 0.0545955386770205, - 0.0577322144743916, - 0.0609813230826460, - 0.0643442093520723, - 0.0678221432558827, - 0.0714163171546603, - 0.0751278431308314, - 0.0789577503982528, - 0.0829069827918993, - 0.0869763963425241, - 0.0911667569410503, - 0.0954787380973307, - 0.0999129187977865, - 0.1044697814663005, - 0.1091497100326053, - 0.1139529881122542, - 0.1188797973021148, - 0.1239302155951605, - 0.1291042159181728, - 0.1344016647957880, - 0.1398223211441467, - 0.1453658351972151, - 0.1510317475686540, - 0.1568194884519144, - 0.1627283769610327, - 0.1687576206143887, - 0.1749063149634756, - 0.1811734433685097, - 0.1875578769224857, - 0.1940583745250518, - 0.2006735831073503, - 0.2074020380087318, - 0.2142421635060113, - 0.2211922734956977, - 0.2282505723293797, - 0.2354151558022098, - 0.2426840122941792, - 0.2500550240636293, - 0.2575259686921987, - 0.2650945206801527, - 0.2727582531907993, - 0.2805146399424422, - 0.2883610572460804, - 0.2962947861868143, - 0.3043130149466800, - 0.3124128412663888, - 0.3205912750432127, - 0.3288452410620226, - 0.3371715818562547, - 0.3455670606953511, - 0.3540283646950029, - 0.3625521080463003, - 0.3711348353596863, - 0.3797730251194006, - 0.3884630932439016, - 0.3972013967475546, - 0.4059842374986933, - 0.4148078660689724, - 0.4236684856687616, - 0.4325622561631607, - 0.4414852981630577, - 0.4504336971855032, - 0.4594035078775303, - 0.4683907582974173, - 0.4773914542472655, - 0.4864015836506502, - 0.4954171209689973, - 0.5044340316502417, - 0.5134482766032377, - 0.5224558166913167, - 0.5314526172383208, - 0.5404346525403849, - 0.5493979103766972, - 0.5583383965124314, - 0.5672521391870222, - 0.5761351935809411, - 0.5849836462541291, - 0.5937936195492526, - 0.6025612759529649, - 0.6112828224083939, - 0.6199545145721097, - 0.6285726610088878, - 0.6371336273176413, - 0.6456338401819751, - 0.6540697913388968, - 0.6624380414593221, - 0.6707352239341151, - 0.6789580485595255, - 0.6871033051160131, - 0.6951678668345944, - 0.7031486937449871, - 0.7110428359000029, - 0.7188474364707993, - 0.7265597347077880, - 0.7341770687621900, - 0.7416968783634273, - 0.7491167073477523, - 0.7564342060337386, - 0.7636471334404891, - 0.7707533593446514, - 0.7777508661725849, - 0.7846377507242818, - 0.7914122257259034, - 0.7980726212080798, - 0.8046173857073919, - 0.8110450872887550, - 0.8173544143867162, - 0.8235441764639875, - 0.8296133044858474, - 0.8355608512093652, - 0.8413859912867303, - 0.8470880211822968, - 0.8526663589032990, - 0.8581205435445334, - 0.8634502346476508, - 0.8686552113760616, - 0.8737353715068081, - 0.8786907302411250, - 0.8835214188357692, - 0.8882276830575707, - 0.8928098814640207, - 0.8972684835130879, - 0.9016040675058185, - 0.9058173183656508, - 0.9099090252587376, - 0.9138800790599416, - 0.9177314696695282, - 0.9214642831859411, - 0.9250796989403991, - 0.9285789863994010, - 0.9319635019415643, - 0.9352346855155568, - 0.9383940571861993, - 0.9414432135761304, - 0.9443838242107182, - 0.9472176277741918, - 0.9499464282852282, - 0.9525720912004834, - 0.9550965394547873, - 0.9575217494469370, - 0.9598497469802043, - 0.9620826031668507, - 0.9642224303060783, - 0.9662713777449607, - 0.9682316277319895, - 0.9701053912729269, - 0.9718949039986892, - 0.9736024220549734, - 0.9752302180233160, - 0.9767805768831932, - 0.9782557920246753, - 0.9796581613210076, - 0.9809899832703159, - 0.9822535532154261, - 0.9834511596505429, - 0.9845850806232530, - 0.9856575802399989, - 0.9866709052828243, - 0.9876272819448033, - 0.9885289126911557, - 0.9893779732525968, - 0.9901766097569984, - 0.9909269360049311, - 0.9916310308941294, - 0.9922909359973702, - 0.9929086532976777, - 0.9934861430841844, - 0.9940253220113651, - 0.9945280613237534, - 0.9949961852476154, - 0.9954314695504363, - 0.9958356402684387, - 0.9962103726017252, - 0.9965572899760172, - 0.9968779632693499, - 0.9971739102014799, - 0.9974465948831872, - 0.9976974275220812, - 0.9979277642809907, - 0.9981389072844972, - 0.9983321047686901, - 0.9985085513687731, - 0.9986693885387259, - 0.9988157050968516, - 0.9989485378906924, - 0.9990688725744943, - 0.9991776444921379, - 0.9992757396582338, - 0.9993639958299003, - 0.9994432036616085, - 0.9995141079353859, - 0.9995774088586188, - 0.9996337634216871, - 0.9996837868076957, - 0.9997280538466377, - 0.9997671005064359, - 0.9998014254134544, - 0.9998314913952471, - 0.9998577270385304, - 0.9998805282555989, - 0.9999002598526793, - 0.9999172570940037, - 0.9999318272557038, - 0.9999442511639580, - 0.9999547847121726, - 0.9999636603523446, - 0.9999710885561258, - 0.9999772592414866, - 0.9999823431612708, - 0.9999864932503106, - 0.9999898459281599, - 0.9999925223548691, - 0.9999946296375997, - 0.9999962619864214, - 0.9999975018180320, - 0.9999984208055542, - 0.9999990808746198, - 0.9999995351446231, - 0.9999998288155155 -}; - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/structs.h b/mplayer/libfaad2/structs.h deleted file mode 100644 index c54f7398..00000000 --- a/mplayer/libfaad2/structs.h +++ /dev/null @@ -1,492 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: structs.h,v 1.42 2004/09/08 09:43:11 gcp Exp $ -**/ - -#ifndef __STRUCTS_H__ -#define __STRUCTS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "cfft.h" -#ifdef SBR_DEC -#include "sbr_dec.h" -#endif - -#define MAX_CHANNELS 64 -#define MAX_SYNTAX_ELEMENTS 48 -#define MAX_WINDOW_GROUPS 8 -#define MAX_SFB 51 -#define MAX_LTP_SFB 40 -#define MAX_LTP_SFB_S 8 - -/* used to save the prediction state */ -typedef struct { - int16_t r[2]; - int16_t COR[2]; - int16_t VAR[2]; -} pred_state; - -typedef struct { - uint16_t N; - cfft_info *cfft; - complex_t *sincos; -#ifdef PROFILE - int64_t cycles; - int64_t fft_cycles; -#endif -} mdct_info; - -typedef struct -{ - const real_t *long_window[2]; - const real_t *short_window[2]; -#ifdef LD_DEC - const real_t *ld_window[2]; -#endif - - mdct_info *mdct256; -#ifdef LD_DEC - mdct_info *mdct1024; -#endif - mdct_info *mdct2048; -#ifdef PROFILE - int64_t cycles; -#endif -} fb_info; - -typedef struct -{ - uint8_t present; - - uint8_t num_bands; - uint8_t pce_instance_tag; - uint8_t excluded_chns_present; - uint8_t band_top[17]; - uint8_t prog_ref_level; - uint8_t dyn_rng_sgn[17]; - uint8_t dyn_rng_ctl[17]; - uint8_t exclude_mask[MAX_CHANNELS]; - uint8_t additional_excluded_chns[MAX_CHANNELS]; - - real_t ctrl1; - real_t ctrl2; -} drc_info; - -typedef struct -{ - uint8_t element_instance_tag; - uint8_t object_type; - uint8_t sf_index; - uint8_t num_front_channel_elements; - uint8_t num_side_channel_elements; - uint8_t num_back_channel_elements; - uint8_t num_lfe_channel_elements; - uint8_t num_assoc_data_elements; - uint8_t num_valid_cc_elements; - uint8_t mono_mixdown_present; - uint8_t mono_mixdown_element_number; - uint8_t stereo_mixdown_present; - uint8_t stereo_mixdown_element_number; - uint8_t matrix_mixdown_idx_present; - uint8_t pseudo_surround_enable; - uint8_t matrix_mixdown_idx; - uint8_t front_element_is_cpe[16]; - uint8_t front_element_tag_select[16]; - uint8_t side_element_is_cpe[16]; - uint8_t side_element_tag_select[16]; - uint8_t back_element_is_cpe[16]; - uint8_t back_element_tag_select[16]; - uint8_t lfe_element_tag_select[16]; - uint8_t assoc_data_element_tag_select[16]; - uint8_t cc_element_is_ind_sw[16]; - uint8_t valid_cc_element_tag_select[16]; - - uint8_t channels; - - uint8_t comment_field_bytes; - uint8_t comment_field_data[257]; - - /* extra added values */ - uint8_t num_front_channels; - uint8_t num_side_channels; - uint8_t num_back_channels; - uint8_t num_lfe_channels; - uint8_t sce_channel[16]; - uint8_t cpe_channel[16]; -} program_config; - -typedef struct -{ - uint16_t syncword; - uint8_t id; - uint8_t layer; - uint8_t protection_absent; - uint8_t profile; - uint8_t sf_index; - uint8_t private_bit; - uint8_t channel_configuration; - uint8_t original; - uint8_t home; - uint8_t emphasis; - uint8_t copyright_identification_bit; - uint8_t copyright_identification_start; - uint16_t aac_frame_length; - uint16_t adts_buffer_fullness; - uint8_t no_raw_data_blocks_in_frame; - uint16_t crc_check; - - /* control param */ - uint8_t old_format; -} adts_header; - -typedef struct -{ - uint8_t copyright_id_present; - int8_t copyright_id[10]; - uint8_t original_copy; - uint8_t home; - uint8_t bitstream_type; - uint32_t bitrate; - uint8_t num_program_config_elements; - uint32_t adif_buffer_fullness; - - /* maximum of 16 PCEs */ - program_config pce[16]; -} adif_header; - -#ifdef LTP_DEC -typedef struct -{ - uint8_t last_band; - uint8_t data_present; - uint16_t lag; - uint8_t lag_update; - uint8_t coef; - uint8_t long_used[MAX_SFB]; - uint8_t short_used[8]; - uint8_t short_lag_present[8]; - uint8_t short_lag[8]; -} ltp_info; -#endif - -#ifdef MAIN_DEC -typedef struct -{ - uint8_t limit; - uint8_t predictor_reset; - uint8_t predictor_reset_group_number; - uint8_t prediction_used[MAX_SFB]; -} pred_info; -#endif - -typedef struct -{ - uint8_t number_pulse; - uint8_t pulse_start_sfb; - uint8_t pulse_offset[4]; - uint8_t pulse_amp[4]; -} pulse_info; - -typedef struct -{ - uint8_t n_filt[8]; - uint8_t coef_res[8]; - uint8_t length[8][4]; - uint8_t order[8][4]; - uint8_t direction[8][4]; - uint8_t coef_compress[8][4]; - uint8_t coef[8][4][32]; -} tns_info; - -#ifdef SSR_DEC -typedef struct -{ - uint8_t max_band; - - uint8_t adjust_num[4][8]; - uint8_t alevcode[4][8][8]; - uint8_t aloccode[4][8][8]; -} ssr_info; -#endif - -typedef struct -{ - uint8_t max_sfb; - - uint8_t num_swb; - uint8_t num_window_groups; - uint8_t num_windows; - uint8_t window_sequence; - uint8_t window_group_length[8]; - uint8_t window_shape; - uint8_t scale_factor_grouping; - uint16_t sect_sfb_offset[8][15*8]; - uint16_t swb_offset[52]; - - uint8_t sect_cb[8][15*8]; - uint16_t sect_start[8][15*8]; - uint16_t sect_end[8][15*8]; - uint8_t sfb_cb[8][8*15]; - uint8_t num_sec[8]; /* number of sections in a group */ - - uint8_t global_gain; - int16_t scale_factors[8][51]; /* [0..255] */ - - uint8_t ms_mask_present; - uint8_t ms_used[MAX_WINDOW_GROUPS][MAX_SFB]; - - uint8_t noise_used; - - uint8_t pulse_data_present; - uint8_t tns_data_present; - uint8_t gain_control_data_present; - uint8_t predictor_data_present; - - pulse_info pul; - tns_info tns; -#ifdef MAIN_DEC - pred_info pred; -#endif -#ifdef LTP_DEC - ltp_info ltp; - ltp_info ltp2; -#endif -#ifdef SSR_DEC - ssr_info ssr; -#endif - -#ifdef ERROR_RESILIENCE - /* ER HCR data */ - uint16_t length_of_reordered_spectral_data; - uint8_t length_of_longest_codeword; - /* ER RLVC data */ - uint8_t sf_concealment; - uint8_t rev_global_gain; - uint16_t length_of_rvlc_sf; - uint16_t dpcm_noise_nrg; - uint8_t sf_escapes_present; - uint8_t length_of_rvlc_escapes; - uint16_t dpcm_noise_last_position; -#endif -} ic_stream; /* individual channel stream */ - -typedef struct -{ - uint8_t channel; - int16_t paired_channel; - - uint8_t element_instance_tag; - uint8_t common_window; - - ic_stream ics1; - ic_stream ics2; -} element; /* syntax element (SCE, CPE, LFE) */ - -typedef struct mp4AudioSpecificConfig -{ - /* Audio Specific Info */ - /*uint8_t*/ unsigned char objectTypeIndex; - /*uint8_t*/ unsigned char samplingFrequencyIndex; - /*uint32_t*/ unsigned long samplingFrequency; - /*uint8_t*/ unsigned char channelsConfiguration; - - /* GA Specific Info */ - /*uint8_t*/ unsigned char frameLengthFlag; - /*uint8_t*/ unsigned char dependsOnCoreCoder; - /*uint16_t*/ unsigned short coreCoderDelay; - /*uint8_t*/ unsigned char extensionFlag; - /*uint8_t*/ unsigned char aacSectionDataResilienceFlag; - /*uint8_t*/ unsigned char aacScalefactorDataResilienceFlag; - /*uint8_t*/ unsigned char aacSpectralDataResilienceFlag; - /*uint8_t*/ unsigned char epConfig; - - /*uint8_t*/ char sbr_present_flag; - /*uint8_t*/ char forceUpSampling; - /*uint8_t*/ char downSampledSBR; -} mp4AudioSpecificConfig; - -#define MAX_ASC_BYTES 64 -typedef struct { - int inited; - int version, versionA; - int framelen_type; - int useSameStreamMux; - int allStreamsSameTimeFraming; - int numSubFrames; - int numPrograms; - int numLayers; - int otherDataPresent; - uint32_t otherDataLenBits; - uint32_t frameLength; - uint8_t ASC[MAX_ASC_BYTES]; - uint32_t ASCbits; -} latm_header; - -typedef struct NeAACDecConfiguration -{ - /*uint8_t*/ unsigned char defObjectType; - /*uint32_t*/ unsigned long defSampleRate; - /*uint8_t*/ unsigned char outputFormat; - /*uint8_t*/ unsigned char downMatrix; - /*uint8_t*/ unsigned char useOldADTSFormat; - /*uint8_t*/ unsigned char dontUpSampleImplicitSBR; -} NeAACDecConfiguration, *NeAACDecConfigurationPtr; - -typedef struct NeAACDecFrameInfo -{ - /*uint32_t*/ unsigned long bytesconsumed; - /*uint32_t*/ unsigned long samples; - /*uint8_t*/ unsigned char channels; - /*uint8_t*/ unsigned char error; - /*uint32_t*/ unsigned long samplerate; - - /* SBR: 0: off, 1: on; normal, 2: on; downsampled */ - /*uint8_t*/ unsigned char sbr; - - /* MPEG-4 ObjectType */ - /*uint8_t*/ unsigned char object_type; - - /* AAC header type; MP4 will be signalled as RAW also */ - /*uint8_t*/ unsigned char header_type; - - /* multichannel configuration */ - /*uint8_t*/ unsigned char num_front_channels; - /*uint8_t*/ unsigned char num_side_channels; - /*uint8_t*/ unsigned char num_back_channels; - /*uint8_t*/ unsigned char num_lfe_channels; - /*uint8_t*/ unsigned char channel_position[MAX_CHANNELS]; - - /* PS: 0: off, 1: on */ - /*uint8_t*/ unsigned char ps; -} NeAACDecFrameInfo; - -typedef struct -{ - uint8_t adts_header_present; - uint8_t adif_header_present; - uint8_t latm_header_present; - uint8_t sf_index; - uint8_t object_type; - uint8_t channelConfiguration; -#ifdef ERROR_RESILIENCE - uint8_t aacSectionDataResilienceFlag; - uint8_t aacScalefactorDataResilienceFlag; - uint8_t aacSpectralDataResilienceFlag; -#endif - uint16_t frameLength; - uint8_t postSeekResetFlag; - - uint32_t frame; - - uint8_t downMatrix; - uint8_t upMatrix; - uint8_t first_syn_ele; - uint8_t has_lfe; - /* number of channels in current frame */ - uint8_t fr_channels; - /* number of elements in current frame */ - uint8_t fr_ch_ele; - - /* element_output_channels: - determines the number of channels the element will output - */ - uint8_t element_output_channels[MAX_SYNTAX_ELEMENTS]; - /* element_alloced: - determines whether the data needed for the element is allocated or not - */ - uint8_t element_alloced[MAX_SYNTAX_ELEMENTS]; - /* alloced_channels: - determines the number of channels where output data is allocated for - */ - uint8_t alloced_channels; - - /* output data buffer */ - void *sample_buffer; - - uint8_t window_shape_prev[MAX_CHANNELS]; -#ifdef LTP_DEC - uint16_t ltp_lag[MAX_CHANNELS]; -#endif - fb_info *fb; - drc_info *drc; - - real_t *time_out[MAX_CHANNELS]; - real_t *fb_intermed[MAX_CHANNELS]; - -#ifdef SBR_DEC - int8_t sbr_present_flag; - int8_t forceUpSampling; - int8_t downSampledSBR; - /* determines whether SBR data is allocated for the gives element */ - uint8_t sbr_alloced[MAX_SYNTAX_ELEMENTS]; - - sbr_info *sbr[MAX_SYNTAX_ELEMENTS]; -#endif -#if (defined(PS_DEC) || defined(DRM_PS)) - uint8_t ps_used[MAX_SYNTAX_ELEMENTS]; - uint8_t ps_used_global; -#endif - -#ifdef SSR_DEC - real_t *ssr_overlap[MAX_CHANNELS]; - real_t *prev_fmd[MAX_CHANNELS]; - real_t ipqf_buffer[MAX_CHANNELS][4][96/4]; -#endif - -#ifdef MAIN_DEC - pred_state *pred_stat[MAX_CHANNELS]; -#endif -#ifdef LTP_DEC - int16_t *lt_pred_stat[MAX_CHANNELS]; -#endif - - /* Program Config Element */ - uint8_t pce_set; - program_config pce; - uint8_t element_id[MAX_CHANNELS]; - uint8_t internal_channel[MAX_CHANNELS]; - - /* Configuration data */ - NeAACDecConfiguration config; - -#ifdef PROFILE - int64_t cycles; - int64_t spectral_cycles; - int64_t output_cycles; - int64_t scalefac_cycles; - int64_t requant_cycles; -#endif - latm_header latm_config; -} NeAACDecStruct, *NeAACDecHandle; - - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/syntax.c b/mplayer/libfaad2/syntax.c deleted file mode 100644 index fc440c85..00000000 --- a/mplayer/libfaad2/syntax.c +++ /dev/null @@ -1,2516 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: syntax.c,v 1.82 2004/09/04 14:56:29 menno Exp $ -**/ - -/* - Reads the AAC bitstream as defined in 14496-3 (MPEG-4 Audio) -*/ - -#include "common.h" -#include "structs.h" - -#include -#include - -#include "decoder.h" -#include "syntax.h" -#include "specrec.h" -#include "huffman.h" -#include "bits.h" -#include "pulse.h" -#include "analysis.h" -#include "drc.h" -#ifdef ERROR_RESILIENCE -#include "rvlc.h" -#endif -#ifdef SBR_DEC -#include "sbr_syntax.h" -#endif -#include "mp4.h" - - -/* static function declarations */ -static void decode_sce_lfe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, - uint8_t id_syn_ele); -static void decode_cpe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, - uint8_t id_syn_ele); -static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld, - uint8_t channel, uint8_t *tag); -static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld, - uint8_t channel, uint8_t *tag); -#ifdef COUPLING_DEC -static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld); -#endif -static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld); -static uint8_t program_config_element(program_config *pce, bitfile *ld); -static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc -#ifdef SBR_DEC - ,uint8_t sbr_ele -#endif - ); -static uint8_t individual_channel_stream(NeAACDecHandle hDecoder, element *ele, - bitfile *ld, ic_stream *ics, uint8_t scal_flag, - int16_t *spec_data); -static uint8_t ics_info(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, - uint8_t common_window); -static uint8_t section_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld); -static uint8_t scale_factor_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld); -#ifdef SSR_DEC -static void gain_control_data(bitfile *ld, ic_stream *ics); -#endif -static uint8_t spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, - int16_t *spectral_data); -static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count); -static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld); -static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld); -#ifdef LTP_DEC -static uint8_t ltp_data(NeAACDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld); -#endif -static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld); -static void adts_variable_header(adts_header *adts, bitfile *ld); -static void adts_error_check(adts_header *adts, bitfile *ld); -static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc); -static uint8_t excluded_channels(bitfile *ld, drc_info *drc); -#ifdef SCALABLE_DEC -static int8_t aac_scalable_main_header(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, - bitfile *ld, uint8_t this_layer_stereo); -#endif - - -/* Table 4.4.1 */ -int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC, - program_config *pce_out) -{ - program_config pce; - - /* 1024 or 960 */ - mp4ASC->frameLengthFlag = faad_get1bit(ld - DEBUGVAR(1,138,"GASpecificConfig(): FrameLengthFlag")); -#ifndef ALLOW_SMALL_FRAMELENGTH - if (mp4ASC->frameLengthFlag == 1) - return -3; -#endif - - mp4ASC->dependsOnCoreCoder = faad_get1bit(ld - DEBUGVAR(1,139,"GASpecificConfig(): DependsOnCoreCoder")); - if (mp4ASC->dependsOnCoreCoder == 1) - { - mp4ASC->coreCoderDelay = (uint16_t)faad_getbits(ld, 14 - DEBUGVAR(1,140,"GASpecificConfig(): CoreCoderDelay")); - } - - mp4ASC->extensionFlag = faad_get1bit(ld DEBUGVAR(1,141,"GASpecificConfig(): ExtensionFlag")); - if (mp4ASC->channelsConfiguration == 0) - { - if (program_config_element(&pce, ld)) - return -3; - //mp4ASC->channelsConfiguration = pce.channels; - - if (pce_out != NULL) - memcpy(pce_out, &pce, sizeof(program_config)); - - /* - if (pce.num_valid_cc_elements) - return -3; - */ - } - -#ifdef ERROR_RESILIENCE - if (mp4ASC->extensionFlag == 1) - { - /* Error resilience not supported yet */ - if (mp4ASC->objectTypeIndex >= ER_OBJECT_START) - { - mp4ASC->aacSectionDataResilienceFlag = faad_get1bit(ld - DEBUGVAR(1,144,"GASpecificConfig(): aacSectionDataResilienceFlag")); - mp4ASC->aacScalefactorDataResilienceFlag = faad_get1bit(ld - DEBUGVAR(1,145,"GASpecificConfig(): aacScalefactorDataResilienceFlag")); - mp4ASC->aacSpectralDataResilienceFlag = faad_get1bit(ld - DEBUGVAR(1,146,"GASpecificConfig(): aacSpectralDataResilienceFlag")); - } - /* 1 bit: extensionFlag3 */ - faad_getbits(ld, 1); - } -#endif - - return 0; -} - -/* Table 4.4.2 */ -/* An MPEG-4 Audio decoder is only required to follow the Program - Configuration Element in GASpecificConfig(). The decoder shall ignore - any Program Configuration Elements that may occur in raw data blocks. - PCEs transmitted in raw data blocks cannot be used to convey decoder - configuration information. -*/ -static uint8_t program_config_element(program_config *pce, bitfile *ld) -{ - uint8_t i; - - memset(pce, 0, sizeof(program_config)); - - pce->channels = 0; - - pce->element_instance_tag = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,10,"program_config_element(): element_instance_tag")); - - pce->object_type = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,11,"program_config_element(): object_type")); - pce->sf_index = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,12,"program_config_element(): sf_index")); - pce->num_front_channel_elements = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,13,"program_config_element(): num_front_channel_elements")); - pce->num_side_channel_elements = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,14,"program_config_element(): num_side_channel_elements")); - pce->num_back_channel_elements = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,15,"program_config_element(): num_back_channel_elements")); - pce->num_lfe_channel_elements = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,16,"program_config_element(): num_lfe_channel_elements")); - pce->num_assoc_data_elements = (uint8_t)faad_getbits(ld, 3 - DEBUGVAR(1,17,"program_config_element(): num_assoc_data_elements")); - pce->num_valid_cc_elements = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,18,"program_config_element(): num_valid_cc_elements")); - - pce->mono_mixdown_present = faad_get1bit(ld - DEBUGVAR(1,19,"program_config_element(): mono_mixdown_present")); - if (pce->mono_mixdown_present == 1) - { - pce->mono_mixdown_element_number = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,20,"program_config_element(): mono_mixdown_element_number")); - } - - pce->stereo_mixdown_present = faad_get1bit(ld - DEBUGVAR(1,21,"program_config_element(): stereo_mixdown_present")); - if (pce->stereo_mixdown_present == 1) - { - pce->stereo_mixdown_element_number = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,22,"program_config_element(): stereo_mixdown_element_number")); - } - - pce->matrix_mixdown_idx_present = faad_get1bit(ld - DEBUGVAR(1,23,"program_config_element(): matrix_mixdown_idx_present")); - if (pce->matrix_mixdown_idx_present == 1) - { - pce->matrix_mixdown_idx = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,24,"program_config_element(): matrix_mixdown_idx")); - pce->pseudo_surround_enable = faad_get1bit(ld - DEBUGVAR(1,25,"program_config_element(): pseudo_surround_enable")); - } - - for (i = 0; i < pce->num_front_channel_elements; i++) - { - pce->front_element_is_cpe[i] = faad_get1bit(ld - DEBUGVAR(1,26,"program_config_element(): front_element_is_cpe")); - pce->front_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,27,"program_config_element(): front_element_tag_select")); - - if (pce->front_element_is_cpe[i] & 1) - { - pce->cpe_channel[pce->front_element_tag_select[i]] = pce->channels; - pce->num_front_channels += 2; - pce->channels += 2; - } else { - pce->sce_channel[pce->front_element_tag_select[i]] = pce->channels; - pce->num_front_channels++; - pce->channels++; - } - } - - for (i = 0; i < pce->num_side_channel_elements; i++) - { - pce->side_element_is_cpe[i] = faad_get1bit(ld - DEBUGVAR(1,28,"program_config_element(): side_element_is_cpe")); - pce->side_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,29,"program_config_element(): side_element_tag_select")); - - if (pce->side_element_is_cpe[i] & 1) - { - pce->cpe_channel[pce->side_element_tag_select[i]] = pce->channels; - pce->num_side_channels += 2; - pce->channels += 2; - } else { - pce->sce_channel[pce->side_element_tag_select[i]] = pce->channels; - pce->num_side_channels++; - pce->channels++; - } - } - - for (i = 0; i < pce->num_back_channel_elements; i++) - { - pce->back_element_is_cpe[i] = faad_get1bit(ld - DEBUGVAR(1,30,"program_config_element(): back_element_is_cpe")); - pce->back_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,31,"program_config_element(): back_element_tag_select")); - - if (pce->back_element_is_cpe[i] & 1) - { - pce->cpe_channel[pce->back_element_tag_select[i]] = pce->channels; - pce->channels += 2; - pce->num_back_channels += 2; - } else { - pce->sce_channel[pce->back_element_tag_select[i]] = pce->channels; - pce->num_back_channels++; - pce->channels++; - } - } - - for (i = 0; i < pce->num_lfe_channel_elements; i++) - { - pce->lfe_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,32,"program_config_element(): lfe_element_tag_select")); - - pce->sce_channel[pce->lfe_element_tag_select[i]] = pce->channels; - pce->num_lfe_channels++; - pce->channels++; - } - - for (i = 0; i < pce->num_assoc_data_elements; i++) - pce->assoc_data_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,33,"program_config_element(): assoc_data_element_tag_select")); - - for (i = 0; i < pce->num_valid_cc_elements; i++) - { - pce->cc_element_is_ind_sw[i] = faad_get1bit(ld - DEBUGVAR(1,34,"program_config_element(): cc_element_is_ind_sw")); - pce->valid_cc_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,35,"program_config_element(): valid_cc_element_tag_select")); - } - - faad_byte_align(ld); - - pce->comment_field_bytes = (uint8_t)faad_getbits(ld, 8 - DEBUGVAR(1,36,"program_config_element(): comment_field_bytes")); - - for (i = 0; i < pce->comment_field_bytes; i++) - { - pce->comment_field_data[i] = (uint8_t)faad_getbits(ld, 8 - DEBUGVAR(1,37,"program_config_element(): comment_field_data")); - } - pce->comment_field_data[i] = 0; - - if (pce->channels > MAX_CHANNELS) - return 22; - - return 0; -} - -static void decode_sce_lfe(NeAACDecHandle hDecoder, - NeAACDecFrameInfo *hInfo, bitfile *ld, - uint8_t id_syn_ele) -{ - uint8_t channels = hDecoder->fr_channels; - uint8_t tag = 0; - - if (channels+1 > MAX_CHANNELS) - { - hInfo->error = 12; - return; - } - if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS) - { - hInfo->error = 13; - return; - } - - /* for SCE hDecoder->element_output_channels[] is not set here because this - can become 2 when some form of Parametric Stereo coding is used - */ - - /* save the syntax element id */ - hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele; - - /* decode the element */ - hInfo->error = single_lfe_channel_element(hDecoder, ld, channels, &tag); - - /* map output channels position to internal data channels */ - if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2) - { - /* this might be faulty when pce_set is true */ - hDecoder->internal_channel[channels] = channels; - hDecoder->internal_channel[channels+1] = channels+1; - } else { - if (hDecoder->pce_set) - hDecoder->internal_channel[hDecoder->pce.sce_channel[tag]] = channels; - else - hDecoder->internal_channel[channels] = channels; - } - - hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele]; - hDecoder->fr_ch_ele++; -} - -static void decode_cpe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, - uint8_t id_syn_ele) -{ - uint8_t channels = hDecoder->fr_channels; - uint8_t tag = 0; - - if (channels+2 > MAX_CHANNELS) - { - hInfo->error = 12; - return; - } - if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS) - { - hInfo->error = 13; - return; - } - - /* for CPE the number of output channels is always 2 */ - if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) - { - /* element_output_channels not set yet */ - hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2; - } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != 2) { - /* element inconsistency */ - hInfo->error = 21; - return; - } - - /* save the syntax element id */ - hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele; - - /* decode the element */ - hInfo->error = channel_pair_element(hDecoder, ld, channels, &tag); - - /* map output channel position to internal data channels */ - if (hDecoder->pce_set) - { - hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]] = channels; - hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]+1] = channels+1; - } else { - hDecoder->internal_channel[channels] = channels; - hDecoder->internal_channel[channels+1] = channels+1; - } - - hDecoder->fr_channels += 2; - hDecoder->fr_ch_ele++; -} - -void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, - bitfile *ld, program_config *pce, drc_info *drc) -{ - uint8_t id_syn_ele; - - hDecoder->fr_channels = 0; - hDecoder->fr_ch_ele = 0; - hDecoder->first_syn_ele = 25; - hDecoder->has_lfe = 0; - -#ifdef ERROR_RESILIENCE - if (hDecoder->object_type < ER_OBJECT_START) - { -#endif - /* Table 4.4.3: raw_data_block() */ - while ((id_syn_ele = (uint8_t)faad_getbits(ld, LEN_SE_ID - DEBUGVAR(1,4,"NeAACDecDecode(): id_syn_ele"))) != ID_END) - { - switch (id_syn_ele) { - case ID_SCE: - if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele; - decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele); - if (hInfo->error > 0) - return; - break; - case ID_CPE: - if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele; - decode_cpe(hDecoder, hInfo, ld, id_syn_ele); - if (hInfo->error > 0) - return; - break; - case ID_LFE: - hDecoder->has_lfe++; - decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele); - if (hInfo->error > 0) - return; - break; - case ID_CCE: /* not implemented yet, but skip the bits */ -#ifdef COUPLING_DEC - hInfo->error = coupling_channel_element(hDecoder, ld); -#else - hInfo->error = 6; -#endif - if (hInfo->error > 0) - return; - break; - case ID_DSE: - data_stream_element(hDecoder, ld); - break; - case ID_PCE: - /* 14496-4: 5.6.4.1.2.1.3: */ - /* program_configuration_element()'s in access units shall be ignored */ - program_config_element(pce, ld); - //if ((hInfo->error = program_config_element(pce, ld)) > 0) - // return; - //hDecoder->pce_set = 1; - break; - case ID_FIL: - /* one sbr_info describes a channel_element not a channel! */ - /* if we encounter SBR data here: error */ - /* SBR data will be read directly in the SCE/LFE/CPE element */ - if ((hInfo->error = fill_element(hDecoder, ld, drc -#ifdef SBR_DEC - , INVALID_SBR_ELEMENT -#endif - )) > 0) - return; - break; - } - } -#ifdef ERROR_RESILIENCE - } else { - /* Table 262: er_raw_data_block() */ - switch (hDecoder->channelConfiguration) - { - case 1: - decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); - if (hInfo->error > 0) - return; - break; - case 2: - decode_cpe(hDecoder, hInfo, ld, ID_CPE); - if (hInfo->error > 0) - return; - break; - case 3: - decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); - decode_cpe(hDecoder, hInfo, ld, ID_CPE); - if (hInfo->error > 0) - return; - break; - case 4: - decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); - decode_cpe(hDecoder, hInfo, ld, ID_CPE); - decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); - if (hInfo->error > 0) - return; - break; - case 5: - decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); - decode_cpe(hDecoder, hInfo, ld, ID_CPE); - decode_cpe(hDecoder, hInfo, ld, ID_CPE); - if (hInfo->error > 0) - return; - break; - case 6: - decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); - decode_cpe(hDecoder, hInfo, ld, ID_CPE); - decode_cpe(hDecoder, hInfo, ld, ID_CPE); - decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE); - if (hInfo->error > 0) - return; - break; - case 7: /* 8 channels */ - decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); - decode_cpe(hDecoder, hInfo, ld, ID_CPE); - decode_cpe(hDecoder, hInfo, ld, ID_CPE); - decode_cpe(hDecoder, hInfo, ld, ID_CPE); - decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE); - if (hInfo->error > 0) - return; - break; - default: - hInfo->error = 7; - return; - } -#if 0 - cnt = bits_to_decode() / 8; - while (cnt >= 1) - { - cnt -= extension_payload(cnt); - } -#endif - } -#endif - - /* new in corrigendum 14496-3:2002 */ -#ifdef DRM - if (hDecoder->object_type != DRM_ER_LC && !hDecoder->latm_header_present) -#endif - { - faad_byte_align(ld); - } - - return; -} - -/* Table 4.4.4 and */ -/* Table 4.4.9 */ -static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld, - uint8_t channel, uint8_t *tag) -{ - uint8_t retval = 0; - element sce = {0}; - ic_stream *ics = &(sce.ics1); - ALIGN int16_t spec_data[1024] = {0}; - - sce.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG - DEBUGVAR(1,38,"single_lfe_channel_element(): element_instance_tag")); - - *tag = sce.element_instance_tag; - sce.channel = channel; - sce.paired_channel = -1; - - retval = individual_channel_stream(hDecoder, &sce, ld, ics, 0, spec_data); - if (retval > 0) - return retval; - -#ifdef SBR_DEC - /* check if next bitstream element is a fill element */ - /* if so, read it now so SBR decoding can be done in case of a file with SBR */ - if (faad_showbits(ld, LEN_SE_ID) == ID_FIL) - { - faad_flushbits(ld, LEN_SE_ID); - - /* one sbr_info describes a channel_element not a channel! */ - if ((retval = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0) - { - return retval; - } - } -#endif - - /* noiseless coding is done, spectral reconstruction is done now */ - retval = reconstruct_single_channel(hDecoder, ics, &sce, spec_data); - if (retval > 0) - return retval; - - return 0; -} - -/* Table 4.4.5 */ -static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld, - uint8_t channels, uint8_t *tag) -{ - ALIGN int16_t spec_data1[1024] = {0}; - ALIGN int16_t spec_data2[1024] = {0}; - element cpe = {0}; - ic_stream *ics1 = &(cpe.ics1); - ic_stream *ics2 = &(cpe.ics2); - uint8_t result; - - cpe.channel = channels; - cpe.paired_channel = channels+1; - - cpe.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG - DEBUGVAR(1,39,"channel_pair_element(): element_instance_tag")); - *tag = cpe.element_instance_tag; - - if ((cpe.common_window = faad_get1bit(ld - DEBUGVAR(1,40,"channel_pair_element(): common_window"))) & 1) - { - /* both channels have common ics information */ - if ((result = ics_info(hDecoder, ics1, ld, cpe.common_window)) > 0) - return result; - - ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,41,"channel_pair_element(): ms_mask_present")); - if (ics1->ms_mask_present == 1) - { - uint8_t g, sfb; - for (g = 0; g < ics1->num_window_groups; g++) - { - for (sfb = 0; sfb < ics1->max_sfb; sfb++) - { - ics1->ms_used[g][sfb] = faad_get1bit(ld - DEBUGVAR(1,42,"channel_pair_element(): faad_get1bit")); - } - } - } - -#ifdef ERROR_RESILIENCE - if ((hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present)) - { - if (( -#ifdef LTP_DEC - ics1->ltp.data_present = -#endif - faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1) - { -#ifdef LTP_DEC - if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp), ld)) > 0) - { - return result; - } -#else - return 26; -#endif - } - } -#endif - - memcpy(ics2, ics1, sizeof(ic_stream)); - } else { - ics1->ms_mask_present = 0; - } - - if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics1, - 0, spec_data1)) > 0) - { - return result; - } - -#ifdef ERROR_RESILIENCE - if (cpe.common_window && (hDecoder->object_type >= ER_OBJECT_START) && - (ics1->predictor_data_present)) - { - if (( -#ifdef LTP_DEC - ics1->ltp2.data_present = -#endif - faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1) - { -#ifdef LTP_DEC - if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp2), ld)) > 0) - { - return result; - } -#else - return 26; -#endif - } - } -#endif - - if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics2, - 0, spec_data2)) > 0) - { - return result; - } - -#ifdef SBR_DEC - /* check if next bitstream element is a fill element */ - /* if so, read it now so SBR decoding can be done in case of a file with SBR */ - if (faad_showbits(ld, LEN_SE_ID) == ID_FIL) - { - faad_flushbits(ld, LEN_SE_ID); - - /* one sbr_info describes a channel_element not a channel! */ - if ((result = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0) - { - return result; - } - } -#endif - - /* noiseless coding is done, spectral reconstruction is done now */ - if ((result = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe, - spec_data1, spec_data2)) > 0) - { - return result; - } - - return 0; -} - -/* Table 4.4.6 */ -static uint8_t ics_info(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, - uint8_t common_window) -{ - uint8_t retval = 0; - - /* ics->ics_reserved_bit = */ faad_get1bit(ld - DEBUGVAR(1,43,"ics_info(): ics_reserved_bit")); - ics->window_sequence = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,44,"ics_info(): window_sequence")); - ics->window_shape = faad_get1bit(ld - DEBUGVAR(1,45,"ics_info(): window_shape")); - - if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) - { - ics->max_sfb = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,46,"ics_info(): max_sfb (short)")); - ics->scale_factor_grouping = (uint8_t)faad_getbits(ld, 7 - DEBUGVAR(1,47,"ics_info(): scale_factor_grouping")); - } else { - ics->max_sfb = (uint8_t)faad_getbits(ld, 6 - DEBUGVAR(1,48,"ics_info(): max_sfb (long)")); - } - - /* get the grouping information */ - if ((retval = window_grouping_info(hDecoder, ics)) > 0) - return retval; - - /* should be an error */ - /* check the range of max_sfb */ - if (ics->max_sfb > ics->num_swb) - return 16; - - if (ics->window_sequence != EIGHT_SHORT_SEQUENCE) - { - if ((ics->predictor_data_present = faad_get1bit(ld - DEBUGVAR(1,49,"ics_info(): predictor_data_present"))) & 1) - { - if (hDecoder->object_type == MAIN) /* MPEG2 style AAC predictor */ - { - uint8_t sfb; - - uint8_t limit = min(ics->max_sfb, max_pred_sfb(hDecoder->sf_index)); -#ifdef MAIN_DEC - ics->pred.limit = limit; -#endif - - if (( -#ifdef MAIN_DEC - ics->pred.predictor_reset = -#endif - faad_get1bit(ld DEBUGVAR(1,53,"ics_info(): pred.predictor_reset"))) & 1) - { -#ifdef MAIN_DEC - ics->pred.predictor_reset_group_number = -#endif - (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,54,"ics_info(): pred.predictor_reset_group_number")); - } - - for (sfb = 0; sfb < limit; sfb++) - { -#ifdef MAIN_DEC - ics->pred.prediction_used[sfb] = -#endif - faad_get1bit(ld DEBUGVAR(1,55,"ics_info(): pred.prediction_used")); - } - } -#ifdef LTP_DEC - else { /* Long Term Prediction */ - if (hDecoder->object_type < ER_OBJECT_START) - { - if ((ics->ltp.data_present = faad_get1bit(ld - DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1) - { - if ((retval = ltp_data(hDecoder, ics, &(ics->ltp), ld)) > 0) - { - return retval; - } - } - if (common_window) - { - if ((ics->ltp2.data_present = faad_get1bit(ld - DEBUGVAR(1,51,"ics_info(): ltp2.data_present"))) & 1) - { - if ((retval = ltp_data(hDecoder, ics, &(ics->ltp2), ld)) > 0) - { - return retval; - } - } - } - } -#ifdef ERROR_RESILIENCE - if (!common_window && (hDecoder->object_type >= ER_OBJECT_START)) - { - if ((ics->ltp.data_present = faad_get1bit(ld - DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1) - { - ltp_data(hDecoder, ics, &(ics->ltp), ld); - } - } -#endif - } -#endif - } - } - - return retval; -} - -/* Table 4.4.7 */ -static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld) -{ - uint8_t i; - - pul->number_pulse = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,56,"pulse_data(): number_pulse")); - pul->pulse_start_sfb = (uint8_t)faad_getbits(ld, 6 - DEBUGVAR(1,57,"pulse_data(): pulse_start_sfb")); - - /* check the range of pulse_start_sfb */ - if (pul->pulse_start_sfb > ics->num_swb) - return 16; - - for (i = 0; i < pul->number_pulse+1; i++) - { - pul->pulse_offset[i] = (uint8_t)faad_getbits(ld, 5 - DEBUGVAR(1,58,"pulse_data(): pulse_offset")); -#if 0 - printf("%d\n", pul->pulse_offset[i]); -#endif - pul->pulse_amp[i] = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,59,"pulse_data(): pulse_amp")); -#if 0 - printf("%d\n", pul->pulse_amp[i]); -#endif - } - - return 0; -} - -#ifdef COUPLING_DEC -/* Table 4.4.8: Currently just for skipping the bits... */ -static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld) -{ - uint8_t c, result = 0; - uint8_t ind_sw_cce_flag = 0; - uint8_t num_gain_element_lists = 0; - uint8_t num_coupled_elements = 0; - - element el_empty = {0}; - ic_stream ics_empty = {0}; - int16_t sh_data[1024]; - - c = faad_getbits(ld, LEN_TAG - DEBUGVAR(1,900,"coupling_channel_element(): element_instance_tag")); - - ind_sw_cce_flag = faad_get1bit(ld - DEBUGVAR(1,901,"coupling_channel_element(): ind_sw_cce_flag")); - num_coupled_elements = faad_getbits(ld, 3 - DEBUGVAR(1,902,"coupling_channel_element(): num_coupled_elements")); - - for (c = 0; c < num_coupled_elements + 1; c++) - { - uint8_t cc_target_is_cpe, cc_target_tag_select; - - num_gain_element_lists++; - - cc_target_is_cpe = faad_get1bit(ld - DEBUGVAR(1,903,"coupling_channel_element(): cc_target_is_cpe")); - cc_target_tag_select = faad_getbits(ld, 4 - DEBUGVAR(1,904,"coupling_channel_element(): cc_target_tag_select")); - - if (cc_target_is_cpe) - { - uint8_t cc_l = faad_get1bit(ld - DEBUGVAR(1,905,"coupling_channel_element(): cc_l")); - uint8_t cc_r = faad_get1bit(ld - DEBUGVAR(1,906,"coupling_channel_element(): cc_r")); - - if (cc_l && cc_r) - num_gain_element_lists++; - } - } - - faad_get1bit(ld - DEBUGVAR(1,907,"coupling_channel_element(): cc_domain")); - faad_get1bit(ld - DEBUGVAR(1,908,"coupling_channel_element(): gain_element_sign")); - faad_getbits(ld, 2 - DEBUGVAR(1,909,"coupling_channel_element(): gain_element_scale")); - - if ((result = individual_channel_stream(hDecoder, &el_empty, ld, &ics_empty, - 0, sh_data)) > 0) - { - return result; - } - - for (c = 1; c < num_gain_element_lists; c++) - { - uint8_t cge; - - if (ind_sw_cce_flag) - { - cge = 1; - } else { - cge = faad_get1bit(ld - DEBUGVAR(1,910,"coupling_channel_element(): common_gain_element_present")); - } - - if (cge) - { - huffman_scale_factor(ld); - } else { - uint8_t g, sfb; - - for (g = 0; g < ics_empty.num_window_groups; g++) - { - for (sfb = 0; sfb < ics_empty.max_sfb; sfb++) - { - if (ics_empty.sfb_cb[g][sfb] != ZERO_HCB) - huffman_scale_factor(ld); - } - } - } - } - - return 0; -} -#endif - -/* Table 4.4.10 */ -static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld) -{ - uint8_t byte_aligned; - uint16_t i, count; - - /* element_instance_tag = */ faad_getbits(ld, LEN_TAG - DEBUGVAR(1,60,"data_stream_element(): element_instance_tag")); - byte_aligned = faad_get1bit(ld - DEBUGVAR(1,61,"data_stream_element(): byte_aligned")); - count = (uint16_t)faad_getbits(ld, 8 - DEBUGVAR(1,62,"data_stream_element(): count")); - if (count == 255) - { - count += (uint16_t)faad_getbits(ld, 8 - DEBUGVAR(1,63,"data_stream_element(): extra count")); - } - if (byte_aligned) - faad_byte_align(ld); - - for (i = 0; i < count; i++) - { - faad_getbits(ld, LEN_BYTE - DEBUGVAR(1,64,"data_stream_element(): data_stream_byte")); - } - - return count; -} - -/* Table 4.4.11 */ -static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc -#ifdef SBR_DEC - ,uint8_t sbr_ele -#endif - ) -{ - uint16_t count; -#ifdef SBR_DEC - uint8_t bs_extension_type; -#endif - - count = (uint16_t)faad_getbits(ld, 4 - DEBUGVAR(1,65,"fill_element(): count")); - if (count == 15) - { - count += (uint16_t)faad_getbits(ld, 8 - DEBUGVAR(1,66,"fill_element(): extra count")) - 1; - } - - if (count > 0) - { -#ifdef SBR_DEC - bs_extension_type = (uint8_t)faad_showbits(ld, 4); - - if ((bs_extension_type == EXT_SBR_DATA) || - (bs_extension_type == EXT_SBR_DATA_CRC)) - { - if (sbr_ele == INVALID_SBR_ELEMENT) - return 24; - - if (!hDecoder->sbr[sbr_ele]) - { - hDecoder->sbr[sbr_ele] = sbrDecodeInit(hDecoder->frameLength, - hDecoder->element_id[sbr_ele], 2*get_sample_rate(hDecoder->sf_index), - hDecoder->downSampledSBR -#ifdef DRM - , 0 -#endif - ); - } - - hDecoder->sbr_present_flag = 1; - - /* parse the SBR data */ - hDecoder->sbr[sbr_ele]->ret = sbr_extension_data(ld, hDecoder->sbr[sbr_ele], count); - -#if 0 - if (hDecoder->sbr[sbr_ele]->ret > 0) - { - printf("%s\n", NeAACDecGetErrorMessage(hDecoder->sbr[sbr_ele]->ret)); - } -#endif - -#if (defined(PS_DEC) || defined(DRM_PS)) - if (hDecoder->sbr[sbr_ele]->ps_used) - { - hDecoder->ps_used[sbr_ele] = 1; - - /* set element independent flag to 1 as well */ - hDecoder->ps_used_global = 1; - } -#endif - } else { -#endif - while (count > 0) - { - count -= extension_payload(ld, drc, count); - } -#ifdef SBR_DEC - } -#endif - } - - return 0; -} - -/* Table 4.4.12 */ -#ifdef SSR_DEC -static void gain_control_data(bitfile *ld, ic_stream *ics) -{ - uint8_t bd, wd, ad; - ssr_info *ssr = &(ics->ssr); - - ssr->max_band = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,1000,"gain_control_data(): max_band")); - - if (ics->window_sequence == ONLY_LONG_SEQUENCE) - { - for (bd = 1; bd <= ssr->max_band; bd++) - { - for (wd = 0; wd < 1; wd++) - { - ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 - DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); - - for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) - { - ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,1002,"gain_control_data(): alevcode")); - ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5 - DEBUGVAR(1,1003,"gain_control_data(): aloccode")); - } - } - } - } else if (ics->window_sequence == LONG_START_SEQUENCE) { - for (bd = 1; bd <= ssr->max_band; bd++) - { - for (wd = 0; wd < 2; wd++) - { - ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 - DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); - - for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) - { - ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,1002,"gain_control_data(): alevcode")); - if (wd == 0) - { - ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,1003,"gain_control_data(): aloccode")); - } else { - ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,1003,"gain_control_data(): aloccode")); - } - } - } - } - } else if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) { - for (bd = 1; bd <= ssr->max_band; bd++) - { - for (wd = 0; wd < 8; wd++) - { - ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 - DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); - - for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) - { - ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,1002,"gain_control_data(): alevcode")); - ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,1003,"gain_control_data(): aloccode")); - } - } - } - } else if (ics->window_sequence == LONG_STOP_SEQUENCE) { - for (bd = 1; bd <= ssr->max_band; bd++) - { - for (wd = 0; wd < 2; wd++) - { - ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 - DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); - - for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) - { - ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,1002,"gain_control_data(): alevcode")); - - if (wd == 0) - { - ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,1003,"gain_control_data(): aloccode")); - } else { - ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5 - DEBUGVAR(1,1003,"gain_control_data(): aloccode")); - } - } - } - } - } -} -#endif - -#ifdef SCALABLE_DEC -/* Table 4.4.13 ASME */ -void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, - bitfile *ld, program_config *pce, drc_info *drc) -{ - uint8_t retval = 0; - uint8_t channels = hDecoder->fr_channels = 0; - uint8_t ch; - uint8_t this_layer_stereo = (hDecoder->channelConfiguration > 1) ? 1 : 0; - element cpe = {0}; - ic_stream *ics1 = &(cpe.ics1); - ic_stream *ics2 = &(cpe.ics2); - int16_t *spec_data; - ALIGN int16_t spec_data1[1024] = {0}; - ALIGN int16_t spec_data2[1024] = {0}; - - hDecoder->fr_ch_ele = 0; - - hInfo->error = aac_scalable_main_header(hDecoder, ics1, ics2, ld, this_layer_stereo); - if (hInfo->error > 0) - return; - - cpe.common_window = 1; - if (this_layer_stereo) - { - hDecoder->element_id[0] = ID_CPE; - if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) - hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2; - } else { - hDecoder->element_id[0] = ID_SCE; - } - - for (ch = 0; ch < (this_layer_stereo ? 2 : 1); ch++) - { - ic_stream *ics; - if (ch == 0) - { - ics = ics1; - spec_data = spec_data1; - } else { - ics = ics2; - spec_data = spec_data2; - } - - hInfo->error = individual_channel_stream(hDecoder, &cpe, ld, ics, 1, spec_data); - if (hInfo->error > 0) - return; - } - -#ifdef DRM -#ifdef SBR_DEC - /* In case of DRM we need to read the SBR info before channel reconstruction */ - if ((hDecoder->sbr_present_flag == 1) && (hDecoder->object_type == DRM_ER_LC)) - { - bitfile ld_sbr = {0}; - uint32_t i; - uint16_t count = 0; - uint8_t *revbuffer; - uint8_t *prevbufstart; - uint8_t *pbufend; - - /* all forward bitreading should be finished at this point */ - uint32_t bitsconsumed = faad_get_processed_bits(ld); - uint32_t buffer_size = faad_origbitbuffer_size(ld); - uint8_t *buffer = (uint8_t*)faad_origbitbuffer(ld); - - if (bitsconsumed + 8 > buffer_size*8) - { - hInfo->error = 14; - return; - } - - if (!hDecoder->sbr[0]) - { - hDecoder->sbr[0] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[0], - 2*get_sample_rate(hDecoder->sf_index), 0 /* ds SBR */, 1); - } - - /* Reverse bit reading of SBR data in DRM audio frame */ - revbuffer = (uint8_t*)faad_malloc(buffer_size*sizeof(uint8_t)); - prevbufstart = revbuffer; - pbufend = &buffer[buffer_size - 1]; - for (i = 0; i < buffer_size; i++) - *prevbufstart++ = tabFlipbits[*pbufend--]; - - /* Set SBR data */ - /* consider 8 bits from AAC-CRC */ - count = (uint16_t)bit2byte(buffer_size*8 - bitsconsumed); - faad_initbits(&ld_sbr, revbuffer, count); - - hDecoder->sbr[0]->sample_rate = get_sample_rate(hDecoder->sf_index); - hDecoder->sbr[0]->sample_rate *= 2; - - faad_getbits(&ld_sbr, 8); /* Skip 8-bit CRC */ - - hDecoder->sbr[0]->ret = sbr_extension_data(&ld_sbr, hDecoder->sbr[0], count); -#if (defined(PS_DEC) || defined(DRM_PS)) - if (hDecoder->sbr[0]->ps_used) - { - hDecoder->ps_used[0] = 1; - hDecoder->ps_used_global = 1; - } -#endif - - /* check CRC */ - /* no need to check it if there was already an error */ - if (hDecoder->sbr[0]->ret == 0) - hDecoder->sbr[0]->ret = (uint8_t)faad_check_CRC(&ld_sbr, (uint16_t)faad_get_processed_bits(&ld_sbr) - 8); - - /* SBR data was corrupted, disable it until the next header */ - if (hDecoder->sbr[0]->ret != 0) - { - hDecoder->sbr[0]->header_count = 0; - } - - faad_endbits(&ld_sbr); - - if (revbuffer) - faad_free(revbuffer); - } -#endif -#endif - - if (this_layer_stereo) - { - hInfo->error = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe, spec_data1, spec_data2); - if (hInfo->error > 0) - return; - } else { - hInfo->error = reconstruct_single_channel(hDecoder, ics1, &cpe, spec_data1); - if (hInfo->error > 0) - return; - } - - /* map output channels position to internal data channels */ - if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2) - { - /* this might be faulty when pce_set is true */ - hDecoder->internal_channel[channels] = channels; - hDecoder->internal_channel[channels+1] = channels+1; - } else { - hDecoder->internal_channel[channels] = channels; - } - - hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele]; - hDecoder->fr_ch_ele++; - - return; -} - -/* Table 4.4.15 */ -static int8_t aac_scalable_main_header(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, - bitfile *ld, uint8_t this_layer_stereo) -{ - uint8_t retval = 0; - uint8_t ch; - ic_stream *ics; - - /* ics1->ics_reserved_bit = */ faad_get1bit(ld - DEBUGVAR(1,300,"aac_scalable_main_header(): ics_reserved_bits")); - ics1->window_sequence = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,301,"aac_scalable_main_header(): window_sequence")); - ics1->window_shape = faad_get1bit(ld - DEBUGVAR(1,302,"aac_scalable_main_header(): window_shape")); - - if (ics1->window_sequence == EIGHT_SHORT_SEQUENCE) - { - ics1->max_sfb = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,303,"aac_scalable_main_header(): max_sfb (short)")); - ics1->scale_factor_grouping = (uint8_t)faad_getbits(ld, 7 - DEBUGVAR(1,304,"aac_scalable_main_header(): scale_factor_grouping")); - } else { - ics1->max_sfb = (uint8_t)faad_getbits(ld, 6 - DEBUGVAR(1,305,"aac_scalable_main_header(): max_sfb (long)")); - } - - /* get the grouping information */ - if ((retval = window_grouping_info(hDecoder, ics1)) > 0) - return retval; - - /* should be an error */ - /* check the range of max_sfb */ - if (ics1->max_sfb > ics1->num_swb) - return 16; - - if (this_layer_stereo) - { - ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,306,"aac_scalable_main_header(): ms_mask_present")); - if (ics1->ms_mask_present == 1) - { - uint8_t g, sfb; - for (g = 0; g < ics1->num_window_groups; g++) - { - for (sfb = 0; sfb < ics1->max_sfb; sfb++) - { - ics1->ms_used[g][sfb] = faad_get1bit(ld - DEBUGVAR(1,307,"aac_scalable_main_header(): faad_get1bit")); - } - } - } - - memcpy(ics2, ics1, sizeof(ic_stream)); - } else { - ics1->ms_mask_present = 0; - } - - if (0) - { - faad_get1bit(ld - DEBUGVAR(1,308,"aac_scalable_main_header(): tns_channel_mono_layer")); - } - - for (ch = 0; ch < (this_layer_stereo ? 2 : 1); ch++) - { - if (ch == 0) - ics = ics1; - else - ics = ics2; - - if ( 1 /*!tvq_layer_pesent || (tns_aac_tvq_en[ch] == 1)*/) - { - if ((ics->tns_data_present = faad_get1bit(ld - DEBUGVAR(1,309,"aac_scalable_main_header(): tns_data_present"))) & 1) - { -#ifdef DRM - /* different order of data units in DRM */ - if (hDecoder->object_type != DRM_ER_LC) -#endif - { - tns_data(ics, &(ics->tns), ld); - } - } - } -#if 0 - if (0 /*core_flag || tvq_layer_pesent*/) - { - if ((ch==0) || ((ch==1) && (core_stereo || tvq_stereo)) - diff_control_data(); - if (mono_stereo_flag) - diff_control_data_lr(); - } else { -#endif - if (( -#ifdef LTP_DEC - ics->ltp.data_present = -#endif - faad_get1bit(ld DEBUGVAR(1,310,"aac_scalable_main_header(): ltp.data_present"))) & 1) - { -#ifdef LTP_DEC - if ((retval = ltp_data(hDecoder, ics, &(ics->ltp), ld)) > 0) - { - return retval; - } -#else - return 26; -#endif - } -#if 0 - } -#endif - } - - return 0; -} -#endif - -/* Table 4.4.24 */ -static uint8_t individual_channel_stream(NeAACDecHandle hDecoder, element *ele, - bitfile *ld, ic_stream *ics, uint8_t scal_flag, - int16_t *spec_data) -{ - uint8_t result; - - ics->global_gain = (uint8_t)faad_getbits(ld, 8 - DEBUGVAR(1,67,"individual_channel_stream(): global_gain")); - - if (!ele->common_window && !scal_flag) - { - if ((result = ics_info(hDecoder, ics, ld, ele->common_window)) > 0) - return result; - } - - if ((result = section_data(hDecoder, ics, ld)) > 0) - return result; - - if ((result = scale_factor_data(hDecoder, ics, ld)) > 0) - return result; - - if (!scal_flag) - { - /** - ** NOTE: It could be that pulse data is available in scalable AAC too, - ** as said in Amendment 1, this could be only the case for ER AAC, - ** though. (have to check this out later) - **/ - /* get pulse data */ - if ((ics->pulse_data_present = faad_get1bit(ld - DEBUGVAR(1,68,"individual_channel_stream(): pulse_data_present"))) & 1) - { - if ((result = pulse_data(ics, &(ics->pul), ld)) > 0) - return result; - } - - /* get tns data */ - if ((ics->tns_data_present = faad_get1bit(ld - DEBUGVAR(1,69,"individual_channel_stream(): tns_data_present"))) & 1) - { -#ifdef ERROR_RESILIENCE - if (hDecoder->object_type < ER_OBJECT_START) -#endif - tns_data(ics, &(ics->tns), ld); - } - - /* get gain control data */ - if ((ics->gain_control_data_present = faad_get1bit(ld - DEBUGVAR(1,70,"individual_channel_stream(): gain_control_data_present"))) & 1) - { -#ifdef SSR_DEC - if (hDecoder->object_type != SSR) - return 1; - else - gain_control_data(ld, ics); -#else - return 1; -#endif - } - } - -#ifdef ERROR_RESILIENCE - if (hDecoder->aacSpectralDataResilienceFlag) - { - ics->length_of_reordered_spectral_data = (uint16_t)faad_getbits(ld, 14 - DEBUGVAR(1,147,"individual_channel_stream(): length_of_reordered_spectral_data")); - - if (hDecoder->channelConfiguration == 2) - { - if (ics->length_of_reordered_spectral_data > 6144) - ics->length_of_reordered_spectral_data = 6144; - } else { - if (ics->length_of_reordered_spectral_data > 12288) - ics->length_of_reordered_spectral_data = 12288; - } - - ics->length_of_longest_codeword = (uint8_t)faad_getbits(ld, 6 - DEBUGVAR(1,148,"individual_channel_stream(): length_of_longest_codeword")); - if (ics->length_of_longest_codeword >= 49) - ics->length_of_longest_codeword = 49; - } - - /* RVLC spectral data is put here */ - if (hDecoder->aacScalefactorDataResilienceFlag) - { - if ((result = rvlc_decode_scale_factors(ics, ld)) > 0) - return result; - } - - if (hDecoder->object_type >= ER_OBJECT_START) - { - if (ics->tns_data_present) - tns_data(ics, &(ics->tns), ld); - } - -#ifdef DRM - /* CRC check */ - if (hDecoder->object_type == DRM_ER_LC) - if ((result = (uint8_t)faad_check_CRC(ld, (uint16_t)faad_get_processed_bits(ld) - 8)) > 0) - return result; -#endif - - if (hDecoder->aacSpectralDataResilienceFlag) - { - /* error resilient spectral data decoding */ - if ((result = reordered_spectral_data(hDecoder, ics, ld, spec_data)) > 0) - { - return result; - } - } else { -#endif - /* decode the spectral data */ - if ((result = spectral_data(hDecoder, ics, ld, spec_data)) > 0) - { - return result; - } -#ifdef ERROR_RESILIENCE - } -#endif - - /* pulse coding reconstruction */ - if (ics->pulse_data_present) - { - if (ics->window_sequence != EIGHT_SHORT_SEQUENCE) - { - if ((result = pulse_decode(ics, spec_data, hDecoder->frameLength)) > 0) - return result; - } else { - return 2; /* pulse coding not allowed for short blocks */ - } - } - - return 0; -} - -/* Table 4.4.25 */ -static uint8_t section_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld) -{ - uint8_t g; - uint8_t sect_esc_val, sect_bits; - - if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) - sect_bits = 3; - else - sect_bits = 5; - sect_esc_val = (1<max_sfb); - printf(" sect top cb\n"); -#endif - - for (g = 0; g < ics->num_window_groups; g++) - { - uint8_t k = 0; - uint8_t i = 0; - - while (k < ics->max_sfb) - { -#ifdef ERROR_RESILIENCE - uint8_t vcb11 = 0; -#endif - uint8_t sfb; - uint8_t sect_len_incr; - uint16_t sect_len = 0; - uint8_t sect_cb_bits = 4; - - /* if "faad_getbits" detects error and returns "0", "k" is never - incremented and we cannot leave the while loop */ - if ((ld->error != 0) || (ld->no_more_reading)) - return 14; - -#ifdef ERROR_RESILIENCE - if (hDecoder->aacSectionDataResilienceFlag) - sect_cb_bits = 5; -#endif - - ics->sect_cb[g][i] = (uint8_t)faad_getbits(ld, sect_cb_bits - DEBUGVAR(1,71,"section_data(): sect_cb")); - -#if 0 - printf("%d\n", ics->sect_cb[g][i]); -#endif - - if (ics->sect_cb[g][i] == NOISE_HCB) - ics->noise_used = 1; - -#ifdef ERROR_RESILIENCE - if (hDecoder->aacSectionDataResilienceFlag) - { - if ((ics->sect_cb[g][i] == 11) || - ((ics->sect_cb[g][i] >= 16) && (ics->sect_cb[g][i] <= 32))) - { - vcb11 = 1; - } - } - if (vcb11) - { - sect_len_incr = 1; - } else { -#endif - sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits - DEBUGVAR(1,72,"section_data(): sect_len_incr")); -#ifdef ERROR_RESILIENCE - } -#endif - while ((sect_len_incr == sect_esc_val) /* && - (k+sect_len < ics->max_sfb)*/) - { - sect_len += sect_len_incr; - sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits - DEBUGVAR(1,72,"section_data(): sect_len_incr")); - } - - sect_len += sect_len_incr; - - ics->sect_start[g][i] = k; - ics->sect_end[g][i] = k + sect_len; - -#if 0 - printf("%d\n", ics->sect_start[g][i]); -#endif -#if 0 - printf("%d\n", ics->sect_end[g][i]); -#endif - - if (k + sect_len >= 8*15) - return 15; - if (i >= 8*15) - return 15; - - for (sfb = k; sfb < k + sect_len; sfb++) - { - ics->sfb_cb[g][sfb] = ics->sect_cb[g][i]; -#if 0 - printf("%d\n", ics->sfb_cb[g][sfb]); -#endif - } - -#if 0 - printf(" %6d %6d %6d\n", - i, - ics->sect_end[g][i], - ics->sect_cb[g][i]); -#endif - - k += sect_len; - i++; - } - ics->num_sec[g] = i; -#if 0 - printf("%d\n", ics->num_sec[g]); -#endif - } - -#if 0 - printf("\n"); -#endif - - return 0; -} - -/* - * decode_scale_factors() - * decodes the scalefactors from the bitstream - */ -/* - * All scalefactors (and also the stereo positions and pns energies) are - * transmitted using Huffman coded DPCM relative to the previous active - * scalefactor (respectively previous stereo position or previous pns energy, - * see subclause 4.6.2 and 4.6.3). The first active scalefactor is - * differentially coded relative to the global gain. - */ -static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld) -{ - uint8_t g, sfb; - int16_t t; - int8_t noise_pcm_flag = 1; - - int16_t scale_factor = ics->global_gain; - int16_t is_position = 0; - int16_t noise_energy = ics->global_gain - 90; - - for (g = 0; g < ics->num_window_groups; g++) - { - for (sfb = 0; sfb < ics->max_sfb; sfb++) - { - switch (ics->sfb_cb[g][sfb]) - { - case ZERO_HCB: /* zero book */ - ics->scale_factors[g][sfb] = 0; -//#define SF_PRINT -#ifdef SF_PRINT - printf("%d\n", ics->scale_factors[g][sfb]); -#endif - break; - case INTENSITY_HCB: /* intensity books */ - case INTENSITY_HCB2: - - /* decode intensity position */ - t = huffman_scale_factor(ld); - is_position += (t - 60); - ics->scale_factors[g][sfb] = is_position; -#ifdef SF_PRINT - printf("%d\n", ics->scale_factors[g][sfb]); -#endif - - break; - case NOISE_HCB: /* noise books */ - - /* decode noise energy */ - if (noise_pcm_flag) - { - noise_pcm_flag = 0; - t = (int16_t)faad_getbits(ld, 9 - DEBUGVAR(1,73,"scale_factor_data(): first noise")) - 256; - } else { - t = huffman_scale_factor(ld); - t -= 60; - } - noise_energy += t; - ics->scale_factors[g][sfb] = noise_energy; -#ifdef SF_PRINT - printf("%d\n", ics->scale_factors[g][sfb]); -#endif - - break; - default: /* spectral books */ - - /* ics->scale_factors[g][sfb] must be between 0 and 255 */ - - ics->scale_factors[g][sfb] = 0; - - /* decode scale factor */ - t = huffman_scale_factor(ld); - scale_factor += (t - 60); - if (scale_factor < 0 || scale_factor > 255) - return 4; - ics->scale_factors[g][sfb] = scale_factor; -#ifdef SF_PRINT - printf("%d\n", ics->scale_factors[g][sfb]); -#endif - - break; - } - } - } - - return 0; -} - -/* Table 4.4.26 */ -static uint8_t scale_factor_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld) -{ - uint8_t ret = 0; -#ifdef PROFILE - int64_t count = faad_get_ts(); -#endif - -#ifdef ERROR_RESILIENCE - if (!hDecoder->aacScalefactorDataResilienceFlag) - { -#endif - ret = decode_scale_factors(ics, ld); -#ifdef ERROR_RESILIENCE - } else { - /* In ER AAC the parameters for RVLC are seperated from the actual - data that holds the scale_factors. - Strangely enough, 2 parameters for HCR are put inbetween them. - */ - ret = rvlc_scale_factor_data(ics, ld); - } -#endif - -#ifdef PROFILE - count = faad_get_ts() - count; - hDecoder->scalefac_cycles += count; -#endif - - return ret; -} - -/* Table 4.4.27 */ -static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld) -{ - uint8_t w, filt, i, start_coef_bits, coef_bits; - uint8_t n_filt_bits = 2; - uint8_t length_bits = 6; - uint8_t order_bits = 5; - - if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) - { - n_filt_bits = 1; - length_bits = 4; - order_bits = 3; - } - - for (w = 0; w < ics->num_windows; w++) - { - tns->n_filt[w] = (uint8_t)faad_getbits(ld, n_filt_bits - DEBUGVAR(1,74,"tns_data(): n_filt")); -#if 0 - printf("%d\n", tns->n_filt[w]); -#endif - - if (tns->n_filt[w]) - { - if ((tns->coef_res[w] = faad_get1bit(ld - DEBUGVAR(1,75,"tns_data(): coef_res"))) & 1) - { - start_coef_bits = 4; - } else { - start_coef_bits = 3; - } -#if 0 - printf("%d\n", tns->coef_res[w]); -#endif - } - - for (filt = 0; filt < tns->n_filt[w]; filt++) - { - tns->length[w][filt] = (uint8_t)faad_getbits(ld, length_bits - DEBUGVAR(1,76,"tns_data(): length")); -#if 0 - printf("%d\n", tns->length[w][filt]); -#endif - tns->order[w][filt] = (uint8_t)faad_getbits(ld, order_bits - DEBUGVAR(1,77,"tns_data(): order")); -#if 0 - printf("%d\n", tns->order[w][filt]); -#endif - if (tns->order[w][filt]) - { - tns->direction[w][filt] = faad_get1bit(ld - DEBUGVAR(1,78,"tns_data(): direction")); -#if 0 - printf("%d\n", tns->direction[w][filt]); -#endif - tns->coef_compress[w][filt] = faad_get1bit(ld - DEBUGVAR(1,79,"tns_data(): coef_compress")); -#if 0 - printf("%d\n", tns->coef_compress[w][filt]); -#endif - - coef_bits = start_coef_bits - tns->coef_compress[w][filt]; - for (i = 0; i < tns->order[w][filt]; i++) - { - tns->coef[w][filt][i] = (uint8_t)faad_getbits(ld, coef_bits - DEBUGVAR(1,80,"tns_data(): coef")); -#if 0 - printf("%d\n", tns->coef[w][filt][i]); -#endif - } - } - } - } -} - -#ifdef LTP_DEC -/* Table 4.4.28 */ -static uint8_t ltp_data(NeAACDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld) -{ - uint8_t sfb, w; - - ltp->lag = 0; - -#ifdef LD_DEC - if (hDecoder->object_type == LD) - { - ltp->lag_update = (uint8_t)faad_getbits(ld, 1 - DEBUGVAR(1,142,"ltp_data(): lag_update")); - - if (ltp->lag_update) - { - ltp->lag = (uint16_t)faad_getbits(ld, 10 - DEBUGVAR(1,81,"ltp_data(): lag")); - } - } else { -#endif - ltp->lag = (uint16_t)faad_getbits(ld, 11 - DEBUGVAR(1,81,"ltp_data(): lag")); -#ifdef LD_DEC - } -#endif - - /* Check length of lag */ - if (ltp->lag > (hDecoder->frameLength << 1)) - return 18; - - ltp->coef = (uint8_t)faad_getbits(ld, 3 - DEBUGVAR(1,82,"ltp_data(): coef")); - - if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) - { - for (w = 0; w < ics->num_windows; w++) - { - if ((ltp->short_used[w] = faad_get1bit(ld - DEBUGVAR(1,83,"ltp_data(): short_used"))) & 1) - { - ltp->short_lag_present[w] = faad_get1bit(ld - DEBUGVAR(1,84,"ltp_data(): short_lag_present")); - if (ltp->short_lag_present[w]) - { - ltp->short_lag[w] = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,85,"ltp_data(): short_lag")); - } - } - } - } else { - ltp->last_band = (ics->max_sfb < MAX_LTP_SFB ? ics->max_sfb : MAX_LTP_SFB); - - for (sfb = 0; sfb < ltp->last_band; sfb++) - { - ltp->long_used[sfb] = faad_get1bit(ld - DEBUGVAR(1,86,"ltp_data(): long_used")); - } - } - - return 0; -} -#endif - -/* Table 4.4.29 */ -static uint8_t spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, - int16_t *spectral_data) -{ - int8_t i; - uint8_t g; - uint16_t inc, k, p = 0; - uint8_t groups = 0; - uint8_t sect_cb; - uint8_t result; - uint16_t nshort = hDecoder->frameLength/8; - -#ifdef PROFILE - int64_t count = faad_get_ts(); -#endif - - for(g = 0; g < ics->num_window_groups; g++) - { - p = groups*nshort; - - for (i = 0; i < ics->num_sec[g]; i++) - { - sect_cb = ics->sect_cb[g][i]; - - inc = (sect_cb >= FIRST_PAIR_HCB) ? 2 : 4; - - switch (sect_cb) - { - case ZERO_HCB: - case NOISE_HCB: - case INTENSITY_HCB: - case INTENSITY_HCB2: -//#define SD_PRINT -#ifdef SD_PRINT - { - int j; - for (j = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; j < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; j++) - { - printf("%d\n", 0); - } - } -#endif -//#define SFBO_PRINT -#ifdef SFBO_PRINT - printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]); -#endif - p += (ics->sect_sfb_offset[g][ics->sect_end[g][i]] - - ics->sect_sfb_offset[g][ics->sect_start[g][i]]); - break; - default: -#ifdef SFBO_PRINT - printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]); -#endif - for (k = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; - k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += inc) - { - if ((result = huffman_spectral_data(sect_cb, ld, &spectral_data[p])) > 0) - return result; -#ifdef SD_PRINT - { - int j; - for (j = p; j < p+inc; j++) - { - printf("%d\n", spectral_data[j]); - } - } -#endif - p += inc; - } - break; - } - } - groups += ics->window_group_length[g]; - } - -#ifdef PROFILE - count = faad_get_ts() - count; - hDecoder->spectral_cycles += count; -#endif - - return 0; -} - -/* Table 4.4.30 */ -static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count) -{ - uint16_t i, n, dataElementLength; - uint8_t dataElementLengthPart; - uint8_t align = 4, data_element_version, loopCounter; - - uint8_t extension_type = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,87,"extension_payload(): extension_type")); - - switch (extension_type) - { - case EXT_DYNAMIC_RANGE: - drc->present = 1; - n = dynamic_range_info(ld, drc); - return n; - case EXT_FILL_DATA: - /* fill_nibble = */ faad_getbits(ld, 4 - DEBUGVAR(1,136,"extension_payload(): fill_nibble")); /* must be 0000 */ - for (i = 0; i < count-1; i++) - { - /* fill_byte[i] = */ faad_getbits(ld, 8 - DEBUGVAR(1,88,"extension_payload(): fill_byte")); /* must be 10100101 */ - } - return count; - case EXT_DATA_ELEMENT: - data_element_version = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,400,"extension_payload(): data_element_version")); - switch (data_element_version) - { - case ANC_DATA: - loopCounter = 0; - dataElementLength = 0; - do { - dataElementLengthPart = (uint8_t)faad_getbits(ld, 8 - DEBUGVAR(1,401,"extension_payload(): dataElementLengthPart")); - dataElementLength += dataElementLengthPart; - loopCounter++; - } while (dataElementLengthPart == 255); - - for (i = 0; i < dataElementLength; i++) - { - /* data_element_byte[i] = */ faad_getbits(ld, 8 - DEBUGVAR(1,402,"extension_payload(): data_element_byte")); - return (dataElementLength+loopCounter+1); - } - default: - align = 0; - } - case EXT_FIL: - default: - faad_getbits(ld, align - DEBUGVAR(1,88,"extension_payload(): fill_nibble")); - for (i = 0; i < count-1; i++) - { - /* other_bits[i] = */ faad_getbits(ld, 8 - DEBUGVAR(1,89,"extension_payload(): fill_bit")); - } - return count; - } -} - -/* Table 4.4.31 */ -static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc) -{ - uint8_t i, n = 1; - uint8_t band_incr; - - drc->num_bands = 1; - - if (faad_get1bit(ld - DEBUGVAR(1,90,"dynamic_range_info(): has instance_tag")) & 1) - { - drc->pce_instance_tag = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,91,"dynamic_range_info(): pce_instance_tag")); - /* drc->drc_tag_reserved_bits = */ faad_getbits(ld, 4 - DEBUGVAR(1,92,"dynamic_range_info(): drc_tag_reserved_bits")); - n++; - } - - drc->excluded_chns_present = faad_get1bit(ld - DEBUGVAR(1,93,"dynamic_range_info(): excluded_chns_present")); - if (drc->excluded_chns_present == 1) - { - n += excluded_channels(ld, drc); - } - - if (faad_get1bit(ld - DEBUGVAR(1,94,"dynamic_range_info(): has bands data")) & 1) - { - band_incr = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,95,"dynamic_range_info(): band_incr")); - /* drc->drc_bands_reserved_bits = */ faad_getbits(ld, 4 - DEBUGVAR(1,96,"dynamic_range_info(): drc_bands_reserved_bits")); - n++; - drc->num_bands += band_incr; - - for (i = 0; i < drc->num_bands; i++); - { - drc->band_top[i] = (uint8_t)faad_getbits(ld, 8 - DEBUGVAR(1,97,"dynamic_range_info(): band_top")); - n++; - } - } - - if (faad_get1bit(ld - DEBUGVAR(1,98,"dynamic_range_info(): has prog_ref_level")) & 1) - { - drc->prog_ref_level = (uint8_t)faad_getbits(ld, 7 - DEBUGVAR(1,99,"dynamic_range_info(): prog_ref_level")); - /* drc->prog_ref_level_reserved_bits = */ faad_get1bit(ld - DEBUGVAR(1,100,"dynamic_range_info(): prog_ref_level_reserved_bits")); - n++; - } - - for (i = 0; i < drc->num_bands; i++) - { - drc->dyn_rng_sgn[i] = faad_get1bit(ld - DEBUGVAR(1,101,"dynamic_range_info(): dyn_rng_sgn")); - drc->dyn_rng_ctl[i] = (uint8_t)faad_getbits(ld, 7 - DEBUGVAR(1,102,"dynamic_range_info(): dyn_rng_ctl")); - n++; - } - - return n; -} - -/* Table 4.4.32 */ -static uint8_t excluded_channels(bitfile *ld, drc_info *drc) -{ - uint8_t i, n = 0; - uint8_t num_excl_chan = 7; - - for (i = 0; i < 7; i++) - { - drc->exclude_mask[i] = faad_get1bit(ld - DEBUGVAR(1,103,"excluded_channels(): exclude_mask")); - } - n++; - - while ((drc->additional_excluded_chns[n-1] = faad_get1bit(ld - DEBUGVAR(1,104,"excluded_channels(): additional_excluded_chns"))) == 1) - { - for (i = num_excl_chan; i < num_excl_chan+7; i++) - { - drc->exclude_mask[i] = faad_get1bit(ld - DEBUGVAR(1,105,"excluded_channels(): exclude_mask")); - } - n++; - num_excl_chan += 7; - } - - return n; -} - -/* Annex A: Audio Interchange Formats */ - -/* Table 1.A.2 */ -void get_adif_header(adif_header *adif, bitfile *ld) -{ - uint8_t i; - - /* adif_id[0] = */ faad_getbits(ld, 8 - DEBUGVAR(1,106,"get_adif_header(): adif_id[0]")); - /* adif_id[1] = */ faad_getbits(ld, 8 - DEBUGVAR(1,107,"get_adif_header(): adif_id[1]")); - /* adif_id[2] = */ faad_getbits(ld, 8 - DEBUGVAR(1,108,"get_adif_header(): adif_id[2]")); - /* adif_id[3] = */ faad_getbits(ld, 8 - DEBUGVAR(1,109,"get_adif_header(): adif_id[3]")); - adif->copyright_id_present = faad_get1bit(ld - DEBUGVAR(1,110,"get_adif_header(): copyright_id_present")); - if(adif->copyright_id_present) - { - for (i = 0; i < 72/8; i++) - { - adif->copyright_id[i] = (int8_t)faad_getbits(ld, 8 - DEBUGVAR(1,111,"get_adif_header(): copyright_id")); - } - adif->copyright_id[i] = 0; - } - adif->original_copy = faad_get1bit(ld - DEBUGVAR(1,112,"get_adif_header(): original_copy")); - adif->home = faad_get1bit(ld - DEBUGVAR(1,113,"get_adif_header(): home")); - adif->bitstream_type = faad_get1bit(ld - DEBUGVAR(1,114,"get_adif_header(): bitstream_type")); - adif->bitrate = faad_getbits(ld, 23 - DEBUGVAR(1,115,"get_adif_header(): bitrate")); - adif->num_program_config_elements = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,116,"get_adif_header(): num_program_config_elements")); - - for (i = 0; i < adif->num_program_config_elements + 1; i++) - { - if(adif->bitstream_type == 0) - { - adif->adif_buffer_fullness = faad_getbits(ld, 20 - DEBUGVAR(1,117,"get_adif_header(): adif_buffer_fullness")); - } else { - adif->adif_buffer_fullness = 0; - } - - program_config_element(&adif->pce[i], ld); - } -} - -/* Table 1.A.5 */ -uint8_t adts_frame(adts_header *adts, bitfile *ld) -{ - /* faad_byte_align(ld); */ - if (adts_fixed_header(adts, ld)) - return 5; - adts_variable_header(adts, ld); - adts_error_check(adts, ld); - - return 0; -} - -/* Table 1.A.6 */ -static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld) -{ - uint16_t i; - uint8_t sync_err = 1; - - /* try to recover from sync errors */ - for (i = 0; i < 768; i++) - { - adts->syncword = (uint16_t)faad_showbits(ld, 12); - if (adts->syncword != 0xFFF) - { - faad_getbits(ld, 8 - DEBUGVAR(0,0,"")); - } else { - sync_err = 0; - faad_getbits(ld, 12 - DEBUGVAR(1,118,"adts_fixed_header(): syncword")); - break; - } - } - if (sync_err) - return 5; - - adts->id = faad_get1bit(ld - DEBUGVAR(1,119,"adts_fixed_header(): id")); - adts->layer = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,120,"adts_fixed_header(): layer")); - adts->protection_absent = faad_get1bit(ld - DEBUGVAR(1,121,"adts_fixed_header(): protection_absent")); - adts->profile = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,122,"adts_fixed_header(): profile")); - adts->sf_index = (uint8_t)faad_getbits(ld, 4 - DEBUGVAR(1,123,"adts_fixed_header(): sf_index")); - adts->private_bit = faad_get1bit(ld - DEBUGVAR(1,124,"adts_fixed_header(): private_bit")); - adts->channel_configuration = (uint8_t)faad_getbits(ld, 3 - DEBUGVAR(1,125,"adts_fixed_header(): channel_configuration")); - adts->original = faad_get1bit(ld - DEBUGVAR(1,126,"adts_fixed_header(): original")); - adts->home = faad_get1bit(ld - DEBUGVAR(1,127,"adts_fixed_header(): home")); - - if (adts->old_format == 1) - { - /* Removed in corrigendum 14496-3:2002 */ - if (adts->id == 0) - { - adts->emphasis = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,128,"adts_fixed_header(): emphasis")); - } - } - - return 0; -} - -/* Table 1.A.7 */ -static void adts_variable_header(adts_header *adts, bitfile *ld) -{ - adts->copyright_identification_bit = faad_get1bit(ld - DEBUGVAR(1,129,"adts_variable_header(): copyright_identification_bit")); - adts->copyright_identification_start = faad_get1bit(ld - DEBUGVAR(1,130,"adts_variable_header(): copyright_identification_start")); - adts->aac_frame_length = (uint16_t)faad_getbits(ld, 13 - DEBUGVAR(1,131,"adts_variable_header(): aac_frame_length")); - adts->adts_buffer_fullness = (uint16_t)faad_getbits(ld, 11 - DEBUGVAR(1,132,"adts_variable_header(): adts_buffer_fullness")); - adts->no_raw_data_blocks_in_frame = (uint8_t)faad_getbits(ld, 2 - DEBUGVAR(1,133,"adts_variable_header(): no_raw_data_blocks_in_frame")); -} - -/* Table 1.A.8 */ -static void adts_error_check(adts_header *adts, bitfile *ld) -{ - if (adts->protection_absent == 0) - { - adts->crc_check = (uint16_t)faad_getbits(ld, 16 - DEBUGVAR(1,134,"adts_error_check(): crc_check")); - } -} - -/* LATM parsing functions */ - -static uint32_t latm_get_value(bitfile *ld) -{ - uint32_t l, value; - uint8_t bytesForValue; - - bytesForValue = (uint8_t)faad_getbits(ld, 2); - value = 0; - for(l=0; lframelen_type==0) - { - do - { - tmp = (uint8_t)faad_getbits(ld, 8); - framelen += tmp; - } while(tmp==0xff); - } - else if(latm->framelen_type==1) - framelen=latm->frameLength; - - return framelen; -} - - -static uint32_t latmAudioMuxElement(latm_header *latm, bitfile *ld) -{ - uint32_t ascLen, asc_bits=0; - uint32_t x1, y1, m, n, i; - program_config pce; - mp4AudioSpecificConfig mp4ASC; - - latm->useSameStreamMux = (uint8_t)faad_getbits(ld, 1); - if(!latm->useSameStreamMux) - { - //parseSameStreamMuxConfig - latm->version = (uint8_t) faad_getbits(ld, 1); - if(latm->version) - latm->versionA = (uint8_t) faad_getbits(ld, 1); - if(latm->versionA) - { - //dunno the payload format for versionA - fprintf(stderr, "versionA not supported\n"); - return 0; - } - if(latm->version) //read taraBufferFullness - latm_get_value(ld); - latm->allStreamsSameTimeFraming = (uint8_t)faad_getbits(ld, 1); - latm->numSubFrames = (uint8_t)faad_getbits(ld, 6) + 1; - latm->numPrograms = (uint8_t)faad_getbits(ld, 4) + 1; - latm->numLayers = faad_getbits(ld, 3) + 1; - if(latm->numPrograms>1 || !latm->allStreamsSameTimeFraming || latm->numSubFrames>1 || latm->numLayers>1) - { - fprintf(stderr, "\r\nUnsupported LATM configuration: %d programs/ %d subframes, %d layers, allstreams: %d\n", - latm->numPrograms, latm->numSubFrames, latm->numLayers, latm->allStreamsSameTimeFraming); - return 0; - } - ascLen = 0; - if(latm->version) - ascLen = latm_get_value(ld); - - x1 = faad_get_processed_bits(ld); - if(AudioSpecificConfigFromBitfile(ld, &mp4ASC, &pce, 0, 1) < 0) - return 0; - - //horrid hack to unread the ASC bits and store them in latm->ASC - //the correct code would rely on an ideal faad_ungetbits() - y1 = faad_get_processed_bits(ld); - if((y1-x1) <= MAX_ASC_BYTES*8) - { - faad_rewindbits(ld); - m = x1; - while(m>0) - { - n = min(m, 32); - faad_getbits(ld, n); - m -= n; - } - - i = 0; - m = latm->ASCbits = y1 - x1; - while(m > 0) - { - n = min(m, 8); - latm->ASC[i++] = (uint8_t) faad_getbits(ld, n); - m -= n; - } - } - - asc_bits = y1-x1; - - if(ascLen>asc_bits) - faad_getbits(ld, ascLen-asc_bits); - - latm->framelen_type = (uint8_t) faad_getbits(ld, 3); - if(latm->framelen_type == 0) - { - latm->frameLength = 0; - faad_getbits(ld, 8); //buffer fullness for frame_len_type==0, useless - } - else if(latm->framelen_type == 1) - { - latm->frameLength = faad_getbits(ld, 9); - if(latm->frameLength==0) - { - fprintf(stderr, "Invalid frameLength: 0\r\n"); - return 0; - } - latm->frameLength = (latm->frameLength+20)*8; - } - else - { //hellish CELP or HCVX stuff, discard - fprintf(stderr, "Unsupported CELP/HCVX framelentype: %d\n", latm->framelen_type); - return 0; - } - - latm->otherDataLenBits = 0; - if(faad_getbits(ld, 1)) - { //other data present - int esc, tmp; - if(latm->version) - latm->otherDataLenBits = latm_get_value(ld); - else do - { - esc = faad_getbits(ld, 1); - tmp = faad_getbits(ld, 8); - latm->otherDataLenBits = (latm->otherDataLenBits << 8) + tmp; - } while(esc); - } - if(faad_getbits(ld, 1)) //crc - faad_getbits(ld, 8); - latm->inited = 1; - } - - //read payload - if(latm->inited) - return latmParsePayload(latm, ld); - else - return 0; -} - - -uint32_t faad_latm_frame(latm_header *latm, bitfile *ld) -{ - uint16_t len; - uint32_t initpos, endpos, firstpos, ret; - - firstpos = faad_get_processed_bits(ld); - while(!ld->error && !ld->no_more_reading) - { - faad_byte_align(ld); - if(faad_showbits(ld, 11) != 0x2B7) - { - faad_getbits(ld, 8); - continue; - } - faad_getbits(ld, 11); - len = faad_getbits(ld, 13); - if(!len) - continue; - initpos = faad_get_processed_bits(ld); - ret = latmAudioMuxElement(latm, ld); - endpos = faad_get_processed_bits(ld); - if(ret>0) - return (len*8)-(endpos-initpos); - //faad_getbits(ld, initpos-endpos); //go back to initpos, but is valid a getbits(-N) ? - } - return -1U; -} diff --git a/mplayer/libfaad2/syntax.h b/mplayer/libfaad2/syntax.h deleted file mode 100644 index c566e941..00000000 --- a/mplayer/libfaad2/syntax.h +++ /dev/null @@ -1,126 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: syntax.h,v 1.54 2004/09/04 14:56:29 menno Exp $ -**/ - -#ifndef __SYNTAX_H__ -#define __SYNTAX_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "decoder.h" -#include "bits.h" - -#define MAIN 1 -#define LC 2 -#define SSR 3 -#define LTP 4 -#define HE_AAC 5 -#define LD 23 -#define ER_LC 17 -#define ER_LTP 19 -#define DRM_ER_LC 27 /* special object type for DRM */ - -/* header types */ -#define RAW 0 -#define ADIF 1 -#define ADTS 2 -#define LATM 3 - -/* SBR signalling */ -#define NO_SBR 0 -#define SBR_UPSAMPLED 1 -#define SBR_DOWNSAMPLED 2 -#define NO_SBR_UPSAMPLED 3 - -/* DRM channel definitions */ -#define DRMCH_MONO 1 -#define DRMCH_STEREO 2 -#define DRMCH_SBR_MONO 3 -#define DRMCH_SBR_STEREO 4 -#define DRMCH_SBR_PS_STEREO 5 - - -/* First object type that has ER */ -#define ER_OBJECT_START 17 - - -/* Bitstream */ -#define LEN_SE_ID 3 -#define LEN_TAG 4 -#define LEN_BYTE 8 - -#define EXT_FIL 0 -#define EXT_FILL_DATA 1 -#define EXT_DATA_ELEMENT 2 -#define EXT_DYNAMIC_RANGE 11 -#define ANC_DATA 0 - -/* Syntax elements */ -#define ID_SCE 0x0 -#define ID_CPE 0x1 -#define ID_CCE 0x2 -#define ID_LFE 0x3 -#define ID_DSE 0x4 -#define ID_PCE 0x5 -#define ID_FIL 0x6 -#define ID_END 0x7 - -#define ONLY_LONG_SEQUENCE 0x0 -#define LONG_START_SEQUENCE 0x1 -#define EIGHT_SHORT_SEQUENCE 0x2 -#define LONG_STOP_SEQUENCE 0x3 - -#define ZERO_HCB 0 -#define FIRST_PAIR_HCB 5 -#define ESC_HCB 11 -#define QUAD_LEN 4 -#define PAIR_LEN 2 -#define NOISE_HCB 13 -#define INTENSITY_HCB2 14 -#define INTENSITY_HCB 15 - -#define INVALID_SBR_ELEMENT 255 - -int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC, - program_config *pce); - -uint8_t adts_frame(adts_header *adts, bitfile *ld); -void get_adif_header(adif_header *adif, bitfile *ld); -void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, - bitfile *ld, program_config *pce, drc_info *drc); -uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, - int16_t *spectral_data); -void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, - bitfile *ld, program_config *pce, drc_info *drc); -uint32_t faad_latm_frame(latm_header *latm, bitfile *ld); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/mplayer/libfaad2/tns.c b/mplayer/libfaad2/tns.c deleted file mode 100644 index 9db69043..00000000 --- a/mplayer/libfaad2/tns.c +++ /dev/null @@ -1,306 +0,0 @@ -/* -** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** -** 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. -** -** 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: tns.c,v 1.35 2004/09/04 14:56:29 menno Exp $ -**/ - -#include "common.h" -#include "structs.h" - -#include "syntax.h" -#include "tns.h" - - -/* static function declarations */ -static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress, - uint8_t *coef, real_t *a); -static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, - uint8_t order); -static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, - uint8_t order); - - -#ifdef _MSC_VER -#pragma warning(disable:4305) -#pragma warning(disable:4244) -#endif -static real_t tns_coef_0_3[] = -{ - COEF_CONST(0.0), COEF_CONST(0.4338837391), COEF_CONST(0.7818314825), COEF_CONST(0.9749279122), - COEF_CONST(-0.9848077530), COEF_CONST(-0.8660254038), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), - COEF_CONST(-0.4338837391), COEF_CONST(-0.7818314825), COEF_CONST(-0.9749279122), COEF_CONST(-0.9749279122), - COEF_CONST(-0.9848077530), COEF_CONST(-0.8660254038), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433) -}; -static real_t tns_coef_0_4[] = -{ - COEF_CONST(0.0), COEF_CONST(0.2079116908), COEF_CONST(0.4067366431), COEF_CONST(0.5877852523), - COEF_CONST(0.7431448255), COEF_CONST(0.8660254038), COEF_CONST(0.9510565163), COEF_CONST(0.9945218954), - COEF_CONST(-0.9957341763), COEF_CONST(-0.9618256432), COEF_CONST(-0.8951632914), COEF_CONST(-0.7980172273), - COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178) -}; -static real_t tns_coef_1_3[] = -{ - COEF_CONST(0.0), COEF_CONST(0.4338837391), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), - COEF_CONST(0.9749279122), COEF_CONST(0.7818314825), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), - COEF_CONST(-0.4338837391), COEF_CONST(-0.7818314825), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), - COEF_CONST(-0.7818314825), COEF_CONST(-0.4338837391), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433) -}; -static real_t tns_coef_1_4[] = -{ - COEF_CONST(0.0), COEF_CONST(0.2079116908), COEF_CONST(0.4067366431), COEF_CONST(0.5877852523), - COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178), - COEF_CONST(0.9945218954), COEF_CONST(0.9510565163), COEF_CONST(0.8660254038), COEF_CONST(0.7431448255), - COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178) -}; - - -/* TNS decoding for one channel and frame */ -void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index, - uint8_t object_type, real_t *spec, uint16_t frame_len) -{ - uint8_t w, f, tns_order; - int8_t inc; - int16_t size; - uint16_t bottom, top, start, end; - uint16_t nshort = frame_len/8; - real_t lpc[TNS_MAX_ORDER+1]; - - if (!ics->tns_data_present) - return; - - for (w = 0; w < ics->num_windows; w++) - { - bottom = ics->num_swb; - - for (f = 0; f < tns->n_filt[w]; f++) - { - top = bottom; - bottom = max(top - tns->length[w][f], 0); - tns_order = min(tns->order[w][f], TNS_MAX_ORDER); - if (!tns_order) - continue; - - tns_decode_coef(tns_order, tns->coef_res[w]+3, - tns->coef_compress[w][f], tns->coef[w][f], lpc); - - start = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); - start = min(start, ics->max_sfb); - start = ics->swb_offset[start]; - - end = min(top, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); - end = min(end, ics->max_sfb); - end = ics->swb_offset[end]; - - size = end - start; - if (size <= 0) - continue; - - if (tns->direction[w][f]) - { - inc = -1; - start = end - 1; - } else { - inc = 1; - } - - tns_ar_filter(&spec[(w*nshort)+start], size, inc, lpc, tns_order); - } - } -} - -/* TNS encoding for one channel and frame */ -void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index, - uint8_t object_type, real_t *spec, uint16_t frame_len) -{ - uint8_t w, f, tns_order; - int8_t inc; - int16_t size; - uint16_t bottom, top, start, end; - uint16_t nshort = frame_len/8; - real_t lpc[TNS_MAX_ORDER+1]; - - if (!ics->tns_data_present) - return; - - for (w = 0; w < ics->num_windows; w++) - { - bottom = ics->num_swb; - - for (f = 0; f < tns->n_filt[w]; f++) - { - top = bottom; - bottom = max(top - tns->length[w][f], 0); - tns_order = min(tns->order[w][f], TNS_MAX_ORDER); - if (!tns_order) - continue; - - tns_decode_coef(tns_order, tns->coef_res[w]+3, - tns->coef_compress[w][f], tns->coef[w][f], lpc); - - start = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); - start = min(start, ics->max_sfb); - start = ics->swb_offset[start]; - - end = min(top, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); - end = min(end, ics->max_sfb); - end = ics->swb_offset[end]; - - size = end - start; - if (size <= 0) - continue; - - if (tns->direction[w][f]) - { - inc = -1; - start = end - 1; - } else { - inc = 1; - } - - tns_ma_filter(&spec[(w*nshort)+start], size, inc, lpc, tns_order); - } - } -} - -/* Decoder transmitted coefficients for one TNS filter */ -static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress, - uint8_t *coef, real_t *a) -{ - uint8_t i, m; - real_t tmp2[TNS_MAX_ORDER+1], b[TNS_MAX_ORDER+1]; - - /* Conversion to signed integer */ - for (i = 0; i < order; i++) - { - if (coef_compress == 0) - { - if (coef_res_bits == 3) - { - tmp2[i] = tns_coef_0_3[coef[i]]; - } else { - tmp2[i] = tns_coef_0_4[coef[i]]; - } - } else { - if (coef_res_bits == 3) - { - tmp2[i] = tns_coef_1_3[coef[i]]; - } else { - tmp2[i] = tns_coef_1_4[coef[i]]; - } - } - } - - /* Conversion to LPC coefficients */ - a[0] = COEF_CONST(1.0); - for (m = 1; m <= order; m++) - { - for (i = 1; i < m; i++) /* loop only while i #include #include +#include #include "config.h" #include "ad_internal.h" @@ -40,12 +41,6 @@ static const ad_info_t info = LIBAD_EXTERN(faad) -#ifndef CONFIG_FAAD_INTERNAL -#include -#else -#include "libfaad2/faad.h" -#endif - /* configure maximum supported channels, * * this is theoretically max. 64 chans */ #define FAAD_MAX_CHANNELS 8 @@ -132,30 +127,9 @@ static int init(sh_audio_t *sh) mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Could not get audio data!\n"); return 0; } -#if CONFIG_FAAD_INTERNAL - /* init the codec, look for LATM */ - faac_init = faacDecInit(faac_hdec, sh->a_in_buffer, - sh->a_in_buffer_len, &faac_samplerate, &faac_channels,1); - if (faac_init < 0 && sh->a_in_buffer_len >= 3 && sh->format == mmioFOURCC('M', 'P', '4', 'L')) { - // working LATM not found at first try, look further on in stream - int i; - - for (i = 0; i < 5; i++) { - pos = sh->a_in_buffer_len-3; - memmove(sh->a_in_buffer, &(sh->a_in_buffer[pos]), 3); - sh->a_in_buffer_len = 3; - sh->a_in_buffer_len += demux_read_data(sh->ds,&sh->a_in_buffer[sh->a_in_buffer_len], - sh->a_in_buffer_size - sh->a_in_buffer_len); - faac_init = faacDecInit(faac_hdec, sh->a_in_buffer, - sh->a_in_buffer_len, &faac_samplerate, &faac_channels,1); - if (faac_init >= 0) break; - } - } -#else /* external faad does not have latm lookup support */ faac_init = faacDecInit(faac_hdec, sh->a_in_buffer, sh->a_in_buffer_len, &faac_samplerate, &faac_channels); -#endif if (faac_init < 0) { pos = aac_probe(sh->a_in_buffer, sh->a_in_buffer_len); @@ -169,13 +143,8 @@ static int init(sh_audio_t *sh) } /* init the codec */ -#if CONFIG_FAAD_INTERNAL - faac_init = faacDecInit(faac_hdec, sh->a_in_buffer, - sh->a_in_buffer_len, &faac_samplerate, &faac_channels,0); -#else faac_init = faacDecInit(faac_hdec, sh->a_in_buffer, sh->a_in_buffer_len, &faac_samplerate, &faac_channels); -#endif } sh->a_in_buffer_len -= (faac_init > 0)?faac_init:0; // how many bytes init consumed diff --git a/mplayer/libmpcodecs/ad_ffmpeg.c b/mplayer/libmpcodecs/ad_ffmpeg.c index 8a9bdcc9..3623c6d3 100644 --- a/mplayer/libmpcodecs/ad_ffmpeg.c +++ b/mplayer/libmpcodecs/ad_ffmpeg.c @@ -28,6 +28,7 @@ #include "dec_audio.h" #include "vd_ffmpeg.h" #include "libaf/reorder_ch.h" +#include "fmt-conversion.h" #include "mpbswap.h" @@ -57,15 +58,9 @@ static int setup_format(sh_audio_t *sh_audio, const AVCodecContext *lavc_context { int broken_srate = 0; int samplerate = lavc_context->sample_rate; - int sample_format = sh_audio->sample_format; - switch (lavc_context->sample_fmt) { - case SAMPLE_FMT_U8: sample_format = AF_FORMAT_U8; break; - case SAMPLE_FMT_S16: sample_format = AF_FORMAT_S16_NE; break; - case SAMPLE_FMT_S32: sample_format = AF_FORMAT_S32_NE; break; - case SAMPLE_FMT_FLT: sample_format = AF_FORMAT_FLOAT_NE; break; - default: - mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Unsupported sample format\n"); - } + int sample_format = samplefmt2affmt(lavc_context->sample_fmt); + if (!sample_format) + sample_format = sh_audio->sample_format; if(sh_audio->wf){ // If the decoder uses the wrong number of channels all is lost anyway. // sh_audio->channels=sh_audio->wf->nChannels; @@ -122,7 +117,7 @@ static int init(sh_audio_t *sh_audio) } lavc_context->request_channels = audio_output_channels; lavc_context->codec_tag = sh_audio->format; //FOURCC - lavc_context->codec_type = CODEC_TYPE_AUDIO; + lavc_context->codec_type = AVMEDIA_TYPE_AUDIO; lavc_context->codec_id = lavc_codec->id; // not sure if required, imho not --A'rpi /* alloc extra data */ @@ -172,10 +167,10 @@ static int init(sh_audio_t *sh_audio) sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; switch (lavc_context->sample_fmt) { - case SAMPLE_FMT_U8: - case SAMPLE_FMT_S16: - case SAMPLE_FMT_S32: - case SAMPLE_FMT_FLT: + case AV_SAMPLE_FMT_U8: + case AV_SAMPLE_FMT_S16: + case AV_SAMPLE_FMT_S32: + case AV_SAMPLE_FMT_FLT: break; default: return 0; @@ -242,7 +237,7 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m sh_audio->ds->buffer_pos+=y-x; // put back data (HACK!) if(len2>0){ if (((AVCodecContext *)sh_audio->context)->channels >= 5) { - int samplesize = av_get_bits_per_sample_format(((AVCodecContext *) + int samplesize = av_get_bits_per_sample_fmt(((AVCodecContext *) sh_audio->context)->sample_fmt) / 8; reorder_channel_nch(buf, AF_CHANNEL_LAYOUT_LAVC_DEFAULT, AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, diff --git a/mplayer/libmpcodecs/ad_qtaudio.c b/mplayer/libmpcodecs/ad_qtaudio.c index 2be9d392..30a5c69e 100644 --- a/mplayer/libmpcodecs/ad_qtaudio.c +++ b/mplayer/libmpcodecs/ad_qtaudio.c @@ -186,7 +186,11 @@ static int preinit(sh_audio_t *sh){ unsigned long InputBufferSize=0; //size of the input buffer unsigned long OutputBufferSize=0; //size of the output buffer unsigned long WantedBufferSize=0; //the size you want your buffers to be + void* codecdata = sh->codecdata; + if (!sh->codecdata_len && sh->wf && sh->wf->cbSize){ + codecdata = sh->wf + 1; + } #ifdef CONFIG_QUICKTIME EnterMovies(); @@ -217,8 +221,8 @@ static int preinit(sh_audio_t *sh){ mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterOpen:%i\n",error); if(error) return 0; - if(sh->codecdata){ - error = SoundConverterSetInfo(myConverter,siDecompressionParams,sh->codecdata); + if(codecdata){ + error = SoundConverterSetInfo(myConverter,siDecompressionParams,codecdata); mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterSetInfo:%i\n",error); // if(error) return 0; } diff --git a/mplayer/libmpcodecs/ae_lavc.c b/mplayer/libmpcodecs/ae_lavc.c index b2078f6b..6a022db3 100644 --- a/mplayer/libmpcodecs/ae_lavc.c +++ b/mplayer/libmpcodecs/ae_lavc.c @@ -40,6 +40,7 @@ #include "libavutil/intreadwrite.h" #include "libavformat/avformat.h" #include "libmpdemux/mp_taglists.h" +#include "fmt-conversion.h" static AVCodec *lavc_acodec; static AVCodecContext *lavc_actx; @@ -108,7 +109,6 @@ static int bind_lavc(audio_encoder_t *encoder, muxer_stream_t *mux_a) // Fix allocation mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize); - encoder->input_format = AF_FORMAT_S16_NE; encoder->min_buffer_size = mux_a->h.dwSuggestedBufferSize; encoder->max_buffer_size = mux_a->h.dwSuggestedBufferSize*2; @@ -184,9 +184,11 @@ int mpae_init_lavc(audio_encoder_t *encoder) return 0; } - lavc_actx->codec_type = CODEC_TYPE_AUDIO; + lavc_actx->codec_type = AVMEDIA_TYPE_AUDIO; lavc_actx->codec_id = lavc_acodec->id; // put sample parameters + lavc_actx->sample_fmt = lavc_acodec->sample_fmts ? lavc_acodec->sample_fmts[0] : AV_SAMPLE_FMT_S16; + encoder->input_format = samplefmt2affmt(lavc_actx->sample_fmt); lavc_actx->channels = encoder->params.channels; lavc_actx->sample_rate = encoder->params.sample_rate; lavc_actx->time_base.num = 1; diff --git a/mplayer/libmpcodecs/cmmx.h b/mplayer/libmpcodecs/cmmx.h index f52c09ae..f9c29dcb 100644 --- a/mplayer/libmpcodecs/cmmx.h +++ b/mplayer/libmpcodecs/cmmx.h @@ -141,7 +141,7 @@ p31avgb(cmmx_t a, cmmx_t b) cmmx_t ao = a & (3*ONE_BYTES); cmmx_t bo = b & (3*ONE_BYTES); return 3*((a^ao)>>2) + ((b^bo)>>2) + - (((3*ao+bo+2*ONE_BYTES)>>2) & (3*ONE_BYTES)); + (((3*ao+bo+2*ONE_BYTES)>>2) & (3*ONE_BYTES)); } static inline cmmx_t @@ -156,9 +156,9 @@ psumbw(cmmx_t a) { cmmx_t t = (a & LOWBW_MASK) + ((a>>8) & LOWBW_MASK); unsigned long ret = - (unsigned long)t + (unsigned long)(t >> (4*sizeof(cmmx_t))); + (unsigned long)t + (unsigned long)(t >> (4*sizeof(cmmx_t))); if (sizeof(cmmx_t) > 4) - ret += ret >> 16; + ret += ret >> 16; return ret & 0xffff; } @@ -166,9 +166,9 @@ static inline unsigned long psumbw_s(cmmx_t a) { unsigned long ret = - (unsigned long)a + (unsigned long)(a >> (4*sizeof(cmmx_t))); + (unsigned long)a + (unsigned long)(a >> (4*sizeof(cmmx_t))); if (sizeof(cmmx_t) <= 4) - return (ret & 0xff) + ((ret>>8) & 0xff); + return (ret & 0xff) + ((ret>>8) & 0xff); ret = (ret & 0xff00ff) + ((ret>>8) & 0xff00ff); ret += ret >> 16; return ret & 0xffff; diff --git a/mplayer/libmpcodecs/dec_audio.c b/mplayer/libmpcodecs/dec_audio.c index bf00c1ef..4150bcaa 100644 --- a/mplayer/libmpcodecs/dec_audio.c +++ b/mplayer/libmpcodecs/dec_audio.c @@ -361,7 +361,9 @@ int init_audio_filters(sh_audio_t *sh_audio, int in_samplerate, *out_channels = afs->output.nch; *out_format = afs->output.format; - sh_audio->a_out_buffer_len = 0; + // Do not reset a_out_buffer_len. This may cause some + // glitches/slow adaption of changes but it is better than + // losing audio even for minor adjustments and avoids sync issues. // ok! sh_audio->afilter = (void *) afs; diff --git a/mplayer/libmpcodecs/dec_teletext.c b/mplayer/libmpcodecs/dec_teletext.c index 73c0d2ee..f3a448eb 100644 --- a/mplayer/libmpcodecs/dec_teletext.c +++ b/mplayer/libmpcodecs/dec_teletext.c @@ -88,7 +88,7 @@ #include #include -#ifdef HAVE_PTHREADS +#if HAVE_PTHREADS // pthreads are needed for async updates from v4l(2) // FIXME: try to avoid using pthread calls when running only a single // thread as e.g. with DVB teletext @@ -97,11 +97,11 @@ #ifdef GEKKO #define HAVE_PTHREADS 1 #include -#define pthread_mutex_init(a, b) LWP_MutexInit(a,false) +typedef mutex_t pthread_mutex_t; +#define pthread_mutex_init(a, b) LWP_MutexInit(a, false) #define pthread_mutex_lock(a) LWP_MutexLock(*a) #define pthread_mutex_unlock(a) LWP_MutexUnlock(*a) #define pthread_mutex_destroy(a) LWP_MutexDestroy(*a) -#define pthread_mutex_t mutex_t #else #define pthread_mutex_init(m, p) #define pthread_mutex_destroy(m) @@ -158,7 +158,7 @@ typedef struct { int pll_fixed; /// vbi stream properties (buffer size,bytes per line, etc) tt_stream_props* ptsp; -#ifdef HAVE_PTHREADS +#if HAVE_PTHREADS pthread_mutex_t buffer_mutex; #endif diff --git a/mplayer/libmpcodecs/img_format.c b/mplayer/libmpcodecs/img_format.c index 78ec741c..194ef0a9 100644 --- a/mplayer/libmpcodecs/img_format.c +++ b/mplayer/libmpcodecs/img_format.c @@ -25,83 +25,83 @@ const char *vo_format_name(int format) static char unknown_format[20]; switch(format) { - case IMGFMT_RGB1: return "RGB 1-bit"; - case IMGFMT_RGB4: return "RGB 4-bit"; - case IMGFMT_RG4B: return "RGB 4-bit per byte"; - case IMGFMT_RGB8: return "RGB 8-bit"; - case IMGFMT_RGB12: return "RGB 12-bit"; - case IMGFMT_RGB15: return "RGB 15-bit"; - case IMGFMT_RGB16: return "RGB 16-bit"; - case IMGFMT_RGB24: return "RGB 24-bit"; -// case IMGFMT_RGB32: return "RGB 32-bit"; - case IMGFMT_RGB48LE: return "RGB 48-bit LE"; - case IMGFMT_RGB48BE: return "RGB 48-bit BE"; - case IMGFMT_BGR1: return "BGR 1-bit"; - case IMGFMT_BGR4: return "BGR 4-bit"; - case IMGFMT_BG4B: return "BGR 4-bit per byte"; - case IMGFMT_BGR8: return "BGR 8-bit"; - case IMGFMT_BGR12: return "BGR 12-bit"; - case IMGFMT_BGR15: return "BGR 15-bit"; - case IMGFMT_BGR16: return "BGR 16-bit"; - case IMGFMT_BGR24: return "BGR 24-bit"; -// case IMGFMT_BGR32: return "BGR 32-bit"; - case IMGFMT_ABGR: return "ABGR"; - case IMGFMT_BGRA: return "BGRA"; - case IMGFMT_ARGB: return "ARGB"; - case IMGFMT_RGBA: return "RGBA"; - case IMGFMT_YVU9: return "Planar YVU9"; - case IMGFMT_IF09: return "Planar IF09"; - case IMGFMT_YV12: return "Planar YV12"; - case IMGFMT_I420: return "Planar I420"; - case IMGFMT_IYUV: return "Planar IYUV"; - case IMGFMT_CLPL: return "Planar CLPL"; - case IMGFMT_Y800: return "Planar Y800"; - case IMGFMT_Y8: return "Planar Y8"; - case IMGFMT_420P16_LE: return "Planar 420P 16-bit little-endian"; - case IMGFMT_420P16_BE: return "Planar 420P 16-bit big-endian"; - case IMGFMT_422P16_LE: return "Planar 422P 16-bit little-endian"; - case IMGFMT_422P16_BE: return "Planar 422P 16-bit big-endian"; - case IMGFMT_444P16_LE: return "Planar 444P 16-bit little-endian"; - case IMGFMT_444P16_BE: return "Planar 444P 16-bit big-endian"; - case IMGFMT_420A: return "Planar 420P with alpha"; - case IMGFMT_444P: return "Planar 444P"; - case IMGFMT_422P: return "Planar 422P"; - case IMGFMT_411P: return "Planar 411P"; - case IMGFMT_NV12: return "Planar NV12"; - case IMGFMT_NV21: return "Planar NV21"; - case IMGFMT_HM12: return "Planar NV12 Macroblock"; - case IMGFMT_IUYV: return "Packed IUYV"; - case IMGFMT_IY41: return "Packed IY41"; - case IMGFMT_IYU1: return "Packed IYU1"; - case IMGFMT_IYU2: return "Packed IYU2"; - case IMGFMT_UYVY: return "Packed UYVY"; - case IMGFMT_UYNV: return "Packed UYNV"; - case IMGFMT_cyuv: return "Packed CYUV"; - case IMGFMT_Y422: return "Packed Y422"; - case IMGFMT_YUY2: return "Packed YUY2"; - case IMGFMT_YUNV: return "Packed YUNV"; - case IMGFMT_YVYU: return "Packed YVYU"; - case IMGFMT_Y41P: return "Packed Y41P"; - case IMGFMT_Y211: return "Packed Y211"; - case IMGFMT_Y41T: return "Packed Y41T"; - case IMGFMT_Y42T: return "Packed Y42T"; - case IMGFMT_V422: return "Packed V422"; - case IMGFMT_V655: return "Packed V655"; - case IMGFMT_CLJR: return "Packed CLJR"; - case IMGFMT_YUVP: return "Packed YUVP"; - case IMGFMT_UYVP: return "Packed UYVP"; - case IMGFMT_MPEGPES: return "Mpeg PES"; - case IMGFMT_ZRMJPEGNI: return "Zoran MJPEG non-interlaced"; - case IMGFMT_ZRMJPEGIT: return "Zoran MJPEG top field first"; - case IMGFMT_ZRMJPEGIB: return "Zoran MJPEG bottom field first"; - case IMGFMT_XVMC_MOCO_MPEG2: return "MPEG1/2 Motion Compensation"; - case IMGFMT_XVMC_IDCT_MPEG2: return "MPEG1/2 Motion Compensation and IDCT"; - case IMGFMT_VDPAU_MPEG1: return "MPEG1 VDPAU acceleration"; - case IMGFMT_VDPAU_MPEG2: return "MPEG2 VDPAU acceleration"; - case IMGFMT_VDPAU_H264: return "H.264 VDPAU acceleration"; - case IMGFMT_VDPAU_MPEG4: return "MPEG-4 Part 2 VDPAU acceleration"; - case IMGFMT_VDPAU_WMV3: return "WMV3 VDPAU acceleration"; - case IMGFMT_VDPAU_VC1: return "VC1 VDPAU acceleration"; + case IMGFMT_RGB1: return "RGB 1-bit"; + case IMGFMT_RGB4: return "RGB 4-bit"; + case IMGFMT_RG4B: return "RGB 4-bit per byte"; + case IMGFMT_RGB8: return "RGB 8-bit"; + case IMGFMT_RGB12: return "RGB 12-bit"; + case IMGFMT_RGB15: return "RGB 15-bit"; + case IMGFMT_RGB16: return "RGB 16-bit"; + case IMGFMT_RGB24: return "RGB 24-bit"; +// case IMGFMT_RGB32: return "RGB 32-bit"; + case IMGFMT_RGB48LE: return "RGB 48-bit LE"; + case IMGFMT_RGB48BE: return "RGB 48-bit BE"; + case IMGFMT_BGR1: return "BGR 1-bit"; + case IMGFMT_BGR4: return "BGR 4-bit"; + case IMGFMT_BG4B: return "BGR 4-bit per byte"; + case IMGFMT_BGR8: return "BGR 8-bit"; + case IMGFMT_BGR12: return "BGR 12-bit"; + case IMGFMT_BGR15: return "BGR 15-bit"; + case IMGFMT_BGR16: return "BGR 16-bit"; + case IMGFMT_BGR24: return "BGR 24-bit"; +// case IMGFMT_BGR32: return "BGR 32-bit"; + case IMGFMT_ABGR: return "ABGR"; + case IMGFMT_BGRA: return "BGRA"; + case IMGFMT_ARGB: return "ARGB"; + case IMGFMT_RGBA: return "RGBA"; + case IMGFMT_YVU9: return "Planar YVU9"; + case IMGFMT_IF09: return "Planar IF09"; + case IMGFMT_YV12: return "Planar YV12"; + case IMGFMT_I420: return "Planar I420"; + case IMGFMT_IYUV: return "Planar IYUV"; + case IMGFMT_CLPL: return "Planar CLPL"; + case IMGFMT_Y800: return "Planar Y800"; + case IMGFMT_Y8: return "Planar Y8"; + case IMGFMT_420P16_LE: return "Planar 420P 16-bit little-endian"; + case IMGFMT_420P16_BE: return "Planar 420P 16-bit big-endian"; + case IMGFMT_422P16_LE: return "Planar 422P 16-bit little-endian"; + case IMGFMT_422P16_BE: return "Planar 422P 16-bit big-endian"; + case IMGFMT_444P16_LE: return "Planar 444P 16-bit little-endian"; + case IMGFMT_444P16_BE: return "Planar 444P 16-bit big-endian"; + case IMGFMT_420A: return "Planar 420P with alpha"; + case IMGFMT_444P: return "Planar 444P"; + case IMGFMT_422P: return "Planar 422P"; + case IMGFMT_411P: return "Planar 411P"; + case IMGFMT_NV12: return "Planar NV12"; + case IMGFMT_NV21: return "Planar NV21"; + case IMGFMT_HM12: return "Planar NV12 Macroblock"; + case IMGFMT_IUYV: return "Packed IUYV"; + case IMGFMT_IY41: return "Packed IY41"; + case IMGFMT_IYU1: return "Packed IYU1"; + case IMGFMT_IYU2: return "Packed IYU2"; + case IMGFMT_UYVY: return "Packed UYVY"; + case IMGFMT_UYNV: return "Packed UYNV"; + case IMGFMT_cyuv: return "Packed CYUV"; + case IMGFMT_Y422: return "Packed Y422"; + case IMGFMT_YUY2: return "Packed YUY2"; + case IMGFMT_YUNV: return "Packed YUNV"; + case IMGFMT_YVYU: return "Packed YVYU"; + case IMGFMT_Y41P: return "Packed Y41P"; + case IMGFMT_Y211: return "Packed Y211"; + case IMGFMT_Y41T: return "Packed Y41T"; + case IMGFMT_Y42T: return "Packed Y42T"; + case IMGFMT_V422: return "Packed V422"; + case IMGFMT_V655: return "Packed V655"; + case IMGFMT_CLJR: return "Packed CLJR"; + case IMGFMT_YUVP: return "Packed YUVP"; + case IMGFMT_UYVP: return "Packed UYVP"; + case IMGFMT_MPEGPES: return "Mpeg PES"; + case IMGFMT_ZRMJPEGNI: return "Zoran MJPEG non-interlaced"; + case IMGFMT_ZRMJPEGIT: return "Zoran MJPEG top field first"; + case IMGFMT_ZRMJPEGIB: return "Zoran MJPEG bottom field first"; + case IMGFMT_XVMC_MOCO_MPEG2: return "MPEG1/2 Motion Compensation"; + case IMGFMT_XVMC_IDCT_MPEG2: return "MPEG1/2 Motion Compensation and IDCT"; + case IMGFMT_VDPAU_MPEG1: return "MPEG1 VDPAU acceleration"; + case IMGFMT_VDPAU_MPEG2: return "MPEG2 VDPAU acceleration"; + case IMGFMT_VDPAU_H264: return "H.264 VDPAU acceleration"; + case IMGFMT_VDPAU_MPEG4: return "MPEG-4 Part 2 VDPAU acceleration"; + case IMGFMT_VDPAU_WMV3: return "WMV3 VDPAU acceleration"; + case IMGFMT_VDPAU_VC1: return "VC1 VDPAU acceleration"; } snprintf(unknown_format,20,"Unknown 0x%04x",format); return unknown_format; diff --git a/mplayer/libmpcodecs/mp_image.c b/mplayer/libmpcodecs/mp_image.c index e93c733e..a9588902 100644 --- a/mplayer/libmpcodecs/mp_image.c +++ b/mplayer/libmpcodecs/mp_image.c @@ -83,15 +83,15 @@ mp_image_t* alloc_mpi(int w, int h, unsigned long int fmt) { void copy_mpi(mp_image_t *dmpi, mp_image_t *mpi) { if(mpi->flags&MP_IMGFLAG_PLANAR){ memcpy_pic(dmpi->planes[0],mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0],mpi->stride[0]); + dmpi->stride[0],mpi->stride[0]); memcpy_pic(dmpi->planes[1],mpi->planes[1], mpi->chroma_width, mpi->chroma_height, - dmpi->stride[1],mpi->stride[1]); + dmpi->stride[1],mpi->stride[1]); memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->chroma_width, mpi->chroma_height, - dmpi->stride[2],mpi->stride[2]); + dmpi->stride[2],mpi->stride[2]); } else { memcpy_pic(dmpi->planes[0],mpi->planes[0], - mpi->w*(dmpi->bpp/8), mpi->h, - dmpi->stride[0],mpi->stride[0]); + mpi->w*(dmpi->bpp/8), mpi->h, + dmpi->stride[0],mpi->stride[0]); } } @@ -127,24 +127,24 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ if(out_fmt == IMGFMT_MPEGPES || out_fmt == IMGFMT_ZRMJPEGNI || out_fmt == IMGFMT_ZRMJPEGIT || out_fmt == IMGFMT_ZRMJPEGIB || IMGFMT_IS_HWACCEL(out_fmt)){ - mpi->bpp=0; - return; + mpi->bpp=0; + return; } mpi->num_planes=1; if (IMGFMT_IS_RGB(out_fmt)) { - if (IMGFMT_RGB_DEPTH(out_fmt) < 8 && !(out_fmt&128)) - mpi->bpp = IMGFMT_RGB_DEPTH(out_fmt); - else - mpi->bpp=(IMGFMT_RGB_DEPTH(out_fmt)+7)&(~7); - return; + if (IMGFMT_RGB_DEPTH(out_fmt) < 8 && !(out_fmt&128)) + mpi->bpp = IMGFMT_RGB_DEPTH(out_fmt); + else + mpi->bpp=(IMGFMT_RGB_DEPTH(out_fmt)+7)&(~7); + return; } if (IMGFMT_IS_BGR(out_fmt)) { - if (IMGFMT_BGR_DEPTH(out_fmt) < 8 && !(out_fmt&128)) - mpi->bpp = IMGFMT_BGR_DEPTH(out_fmt); - else - mpi->bpp=(IMGFMT_BGR_DEPTH(out_fmt)+7)&(~7); - mpi->flags|=MP_IMGFLAG_SWAPPED; - return; + if (IMGFMT_BGR_DEPTH(out_fmt) < 8 && !(out_fmt&128)) + mpi->bpp = IMGFMT_BGR_DEPTH(out_fmt); + else + mpi->bpp=(IMGFMT_BGR_DEPTH(out_fmt)+7)&(~7); + mpi->flags|=MP_IMGFLAG_SWAPPED; + return; } mpi->flags|=MP_IMGFLAG_YUV; mpi->num_planes=3; @@ -157,12 +157,12 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ switch(out_fmt){ case IMGFMT_I420: case IMGFMT_IYUV: - mpi->flags|=MP_IMGFLAG_SWAPPED; + mpi->flags|=MP_IMGFLAG_SWAPPED; case IMGFMT_YV12: - return; + return; case IMGFMT_420A: case IMGFMT_IF09: - mpi->num_planes=4; + mpi->num_planes=4; case IMGFMT_YVU9: case IMGFMT_444P: case IMGFMT_422P: @@ -174,30 +174,30 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ case IMGFMT_422P16_BE: case IMGFMT_420P16_LE: case IMGFMT_420P16_BE: - return; + return; case IMGFMT_Y800: case IMGFMT_Y8: - /* they're planar ones, but for easier handling use them as packed */ - mpi->flags&=~MP_IMGFLAG_PLANAR; - mpi->num_planes=1; - return; + /* they're planar ones, but for easier handling use them as packed */ + mpi->flags&=~MP_IMGFLAG_PLANAR; + mpi->num_planes=1; + return; case IMGFMT_UYVY: - mpi->flags|=MP_IMGFLAG_SWAPPED; + mpi->flags|=MP_IMGFLAG_SWAPPED; case IMGFMT_YUY2: - mpi->bpp=16; - mpi->num_planes=1; - return; + mpi->bpp=16; + mpi->num_planes=1; + return; case IMGFMT_NV12: - mpi->flags|=MP_IMGFLAG_SWAPPED; + mpi->flags|=MP_IMGFLAG_SWAPPED; case IMGFMT_NV21: - mpi->flags|=MP_IMGFLAG_PLANAR; - mpi->bpp=12; - mpi->num_planes=2; - mpi->chroma_width=(mpi->width>>0); - mpi->chroma_height=(mpi->height>>1); - mpi->chroma_x_shift=0; - mpi->chroma_y_shift=1; - return; + mpi->flags|=MP_IMGFLAG_PLANAR; + mpi->bpp=12; + mpi->num_planes=2; + mpi->chroma_width=(mpi->width>>0); + mpi->chroma_height=(mpi->height>>1); + mpi->chroma_x_shift=0; + mpi->chroma_y_shift=1; + return; } mp_msg(MSGT_DECVIDEO,MSGL_WARN,"mp_image: unknown out_fmt: 0x%X\n",out_fmt); mpi->bpp=0; @@ -215,10 +215,10 @@ mp_image_t* new_mp_image(int w,int h){ void free_mp_image(mp_image_t* mpi){ if(!mpi) return; if(mpi->flags&MP_IMGFLAG_ALLOCATED){ - /* becouse we allocate the whole image in once */ - av_free(mpi->planes[0]); - if (mpi->flags & MP_IMGFLAG_RGB_PALETTE) - av_free(mpi->planes[1]); + /* becouse we allocate the whole image in once */ + av_free(mpi->planes[0]); + if (mpi->flags & MP_IMGFLAG_RGB_PALETTE) + av_free(mpi->planes[1]); } free(mpi); } diff --git a/mplayer/libmpcodecs/mp_image.h b/mplayer/libmpcodecs/mp_image.h index 368e7c3d..a9dc38be 100644 --- a/mplayer/libmpcodecs/mp_image.h +++ b/mplayer/libmpcodecs/mp_image.h @@ -91,7 +91,7 @@ // all other cases #define MP_IMGTYPE_INCOMPLETE 6 -#define MP_MAX_PLANES 4 +#define MP_MAX_PLANES 4 #define MP_IMGFIELD_ORDERED 0x01 #define MP_IMGFIELD_TOP_FIRST 0x02 diff --git a/mplayer/libmpcodecs/pullup.c b/mplayer/libmpcodecs/pullup.c index d4e850ed..6d829ea0 100644 --- a/mplayer/libmpcodecs/pullup.c +++ b/mplayer/libmpcodecs/pullup.c @@ -29,184 +29,184 @@ #if HAVE_MMX static int diff_y_mmx(unsigned char *a, unsigned char *b, int s) { - int ret; - __asm__ volatile ( - "movl $4, %%ecx \n\t" - "pxor %%mm4, %%mm4 \n\t" - "pxor %%mm7, %%mm7 \n\t" - - "1: \n\t" - - "movq (%%"REG_S"), %%mm0 \n\t" - "movq (%%"REG_S"), %%mm2 \n\t" - "add %%"REG_a", %%"REG_S" \n\t" - "movq (%%"REG_D"), %%mm1 \n\t" - "add %%"REG_a", %%"REG_D" \n\t" - "psubusb %%mm1, %%mm2 \n\t" - "psubusb %%mm0, %%mm1 \n\t" - "movq %%mm2, %%mm0 \n\t" - "movq %%mm1, %%mm3 \n\t" - "punpcklbw %%mm7, %%mm0 \n\t" - "punpcklbw %%mm7, %%mm1 \n\t" - "punpckhbw %%mm7, %%mm2 \n\t" - "punpckhbw %%mm7, %%mm3 \n\t" - "paddw %%mm0, %%mm4 \n\t" - "paddw %%mm1, %%mm4 \n\t" - "paddw %%mm2, %%mm4 \n\t" - "paddw %%mm3, %%mm4 \n\t" - - "decl %%ecx \n\t" - "jnz 1b \n\t" - - "movq %%mm4, %%mm3 \n\t" - "punpcklwd %%mm7, %%mm4 \n\t" - "punpckhwd %%mm7, %%mm3 \n\t" - "paddd %%mm4, %%mm3 \n\t" - "movd %%mm3, %%eax \n\t" - "psrlq $32, %%mm3 \n\t" - "movd %%mm3, %%edx \n\t" - "addl %%edx, %%eax \n\t" - "emms \n\t" - : "=a" (ret) - : "S" (a), "D" (b), "a" (s) - : "%ecx", "%edx" - ); - return ret; + int ret; + __asm__ volatile ( + "movl $4, %%ecx \n\t" + "pxor %%mm4, %%mm4 \n\t" + "pxor %%mm7, %%mm7 \n\t" + + "1: \n\t" + + "movq (%%"REG_S"), %%mm0 \n\t" + "movq (%%"REG_S"), %%mm2 \n\t" + "add %%"REG_a", %%"REG_S" \n\t" + "movq (%%"REG_D"), %%mm1 \n\t" + "add %%"REG_a", %%"REG_D" \n\t" + "psubusb %%mm1, %%mm2 \n\t" + "psubusb %%mm0, %%mm1 \n\t" + "movq %%mm2, %%mm0 \n\t" + "movq %%mm1, %%mm3 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "punpckhbw %%mm7, %%mm3 \n\t" + "paddw %%mm0, %%mm4 \n\t" + "paddw %%mm1, %%mm4 \n\t" + "paddw %%mm2, %%mm4 \n\t" + "paddw %%mm3, %%mm4 \n\t" + + "decl %%ecx \n\t" + "jnz 1b \n\t" + + "movq %%mm4, %%mm3 \n\t" + "punpcklwd %%mm7, %%mm4 \n\t" + "punpckhwd %%mm7, %%mm3 \n\t" + "paddd %%mm4, %%mm3 \n\t" + "movd %%mm3, %%eax \n\t" + "psrlq $32, %%mm3 \n\t" + "movd %%mm3, %%edx \n\t" + "addl %%edx, %%eax \n\t" + "emms \n\t" + : "=a" (ret) + : "S" (a), "D" (b), "a" (s) + : "%ecx", "%edx" + ); + return ret; } static int licomb_y_mmx(unsigned char *a, unsigned char *b, int s) { - int ret; - __asm__ volatile ( - "movl $4, %%ecx \n\t" - "pxor %%mm6, %%mm6 \n\t" - "pxor %%mm7, %%mm7 \n\t" - "sub %%"REG_a", %%"REG_D" \n\t" - - "2: \n\t" - - "movq (%%"REG_D"), %%mm0 \n\t" - "movq (%%"REG_D"), %%mm1 \n\t" - "punpcklbw %%mm7, %%mm0 \n\t" - "movq (%%"REG_D",%%"REG_a"), %%mm2 \n\t" - "punpcklbw %%mm7, %%mm1 \n\t" - "punpcklbw %%mm7, %%mm2 \n\t" - "paddw %%mm0, %%mm0 \n\t" - "paddw %%mm2, %%mm1 \n\t" - "movq %%mm0, %%mm2 \n\t" - "psubusw %%mm1, %%mm0 \n\t" - "psubusw %%mm2, %%mm1 \n\t" - "paddw %%mm0, %%mm6 \n\t" - "paddw %%mm1, %%mm6 \n\t" - - "movq (%%"REG_S"), %%mm0 \n\t" - "movq (%%"REG_D"), %%mm1 \n\t" - "punpckhbw %%mm7, %%mm0 \n\t" - "movq (%%"REG_D",%%"REG_a"), %%mm2 \n\t" - "punpckhbw %%mm7, %%mm1 \n\t" - "punpckhbw %%mm7, %%mm2 \n\t" - "paddw %%mm0, %%mm0 \n\t" - "paddw %%mm2, %%mm1 \n\t" - "movq %%mm0, %%mm2 \n\t" - "psubusw %%mm1, %%mm0 \n\t" - "psubusw %%mm2, %%mm1 \n\t" - "paddw %%mm0, %%mm6 \n\t" - "paddw %%mm1, %%mm6 \n\t" - - "movq (%%"REG_D",%%"REG_a"), %%mm0 \n\t" - "movq (%%"REG_S"), %%mm1 \n\t" - "punpcklbw %%mm7, %%mm0 \n\t" - "movq (%%"REG_S",%%"REG_a"), %%mm2 \n\t" - "punpcklbw %%mm7, %%mm1 \n\t" - "punpcklbw %%mm7, %%mm2 \n\t" - "paddw %%mm0, %%mm0 \n\t" - "paddw %%mm2, %%mm1 \n\t" - "movq %%mm0, %%mm2 \n\t" - "psubusw %%mm1, %%mm0 \n\t" - "psubusw %%mm2, %%mm1 \n\t" - "paddw %%mm0, %%mm6 \n\t" - "paddw %%mm1, %%mm6 \n\t" - - "movq (%%"REG_D",%%"REG_a"), %%mm0 \n\t" - "movq (%%"REG_S"), %%mm1 \n\t" - "punpckhbw %%mm7, %%mm0 \n\t" - "movq (%%"REG_S",%%"REG_a"), %%mm2 \n\t" - "punpckhbw %%mm7, %%mm1 \n\t" - "punpckhbw %%mm7, %%mm2 \n\t" - "paddw %%mm0, %%mm0 \n\t" - "paddw %%mm2, %%mm1 \n\t" - "movq %%mm0, %%mm2 \n\t" - "psubusw %%mm1, %%mm0 \n\t" - "psubusw %%mm2, %%mm1 \n\t" - "paddw %%mm0, %%mm6 \n\t" - "paddw %%mm1, %%mm6 \n\t" - - "add %%"REG_a", %%"REG_S" \n\t" - "add %%"REG_a", %%"REG_D" \n\t" - "decl %%ecx \n\t" - "jnz 2b \n\t" - - "movq %%mm6, %%mm5 \n\t" - "punpcklwd %%mm7, %%mm6 \n\t" - "punpckhwd %%mm7, %%mm5 \n\t" - "paddd %%mm6, %%mm5 \n\t" - "movd %%mm5, %%eax \n\t" - "psrlq $32, %%mm5 \n\t" - "movd %%mm5, %%edx \n\t" - "addl %%edx, %%eax \n\t" - - "emms \n\t" - : "=a" (ret) - : "S" (a), "D" (b), "a" (s) - : "%ecx", "%edx" - ); - return ret; + int ret; + __asm__ volatile ( + "movl $4, %%ecx \n\t" + "pxor %%mm6, %%mm6 \n\t" + "pxor %%mm7, %%mm7 \n\t" + "sub %%"REG_a", %%"REG_D" \n\t" + + "2: \n\t" + + "movq (%%"REG_D"), %%mm0 \n\t" + "movq (%%"REG_D"), %%mm1 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "movq (%%"REG_D",%%"REG_a"), %%mm2 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpcklbw %%mm7, %%mm2 \n\t" + "paddw %%mm0, %%mm0 \n\t" + "paddw %%mm2, %%mm1 \n\t" + "movq %%mm0, %%mm2 \n\t" + "psubusw %%mm1, %%mm0 \n\t" + "psubusw %%mm2, %%mm1 \n\t" + "paddw %%mm0, %%mm6 \n\t" + "paddw %%mm1, %%mm6 \n\t" + + "movq (%%"REG_S"), %%mm0 \n\t" + "movq (%%"REG_D"), %%mm1 \n\t" + "punpckhbw %%mm7, %%mm0 \n\t" + "movq (%%"REG_D",%%"REG_a"), %%mm2 \n\t" + "punpckhbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "paddw %%mm0, %%mm0 \n\t" + "paddw %%mm2, %%mm1 \n\t" + "movq %%mm0, %%mm2 \n\t" + "psubusw %%mm1, %%mm0 \n\t" + "psubusw %%mm2, %%mm1 \n\t" + "paddw %%mm0, %%mm6 \n\t" + "paddw %%mm1, %%mm6 \n\t" + + "movq (%%"REG_D",%%"REG_a"), %%mm0 \n\t" + "movq (%%"REG_S"), %%mm1 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "movq (%%"REG_S",%%"REG_a"), %%mm2 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpcklbw %%mm7, %%mm2 \n\t" + "paddw %%mm0, %%mm0 \n\t" + "paddw %%mm2, %%mm1 \n\t" + "movq %%mm0, %%mm2 \n\t" + "psubusw %%mm1, %%mm0 \n\t" + "psubusw %%mm2, %%mm1 \n\t" + "paddw %%mm0, %%mm6 \n\t" + "paddw %%mm1, %%mm6 \n\t" + + "movq (%%"REG_D",%%"REG_a"), %%mm0 \n\t" + "movq (%%"REG_S"), %%mm1 \n\t" + "punpckhbw %%mm7, %%mm0 \n\t" + "movq (%%"REG_S",%%"REG_a"), %%mm2 \n\t" + "punpckhbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "paddw %%mm0, %%mm0 \n\t" + "paddw %%mm2, %%mm1 \n\t" + "movq %%mm0, %%mm2 \n\t" + "psubusw %%mm1, %%mm0 \n\t" + "psubusw %%mm2, %%mm1 \n\t" + "paddw %%mm0, %%mm6 \n\t" + "paddw %%mm1, %%mm6 \n\t" + + "add %%"REG_a", %%"REG_S" \n\t" + "add %%"REG_a", %%"REG_D" \n\t" + "decl %%ecx \n\t" + "jnz 2b \n\t" + + "movq %%mm6, %%mm5 \n\t" + "punpcklwd %%mm7, %%mm6 \n\t" + "punpckhwd %%mm7, %%mm5 \n\t" + "paddd %%mm6, %%mm5 \n\t" + "movd %%mm5, %%eax \n\t" + "psrlq $32, %%mm5 \n\t" + "movd %%mm5, %%edx \n\t" + "addl %%edx, %%eax \n\t" + + "emms \n\t" + : "=a" (ret) + : "S" (a), "D" (b), "a" (s) + : "%ecx", "%edx" + ); + return ret; } static int var_y_mmx(unsigned char *a, unsigned char *b, int s) { - int ret; - __asm__ volatile ( - "movl $3, %%ecx \n\t" - "pxor %%mm4, %%mm4 \n\t" - "pxor %%mm7, %%mm7 \n\t" - - "1: \n\t" - - "movq (%%"REG_S"), %%mm0 \n\t" - "movq (%%"REG_S"), %%mm2 \n\t" - "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t" - "add %%"REG_a", %%"REG_S" \n\t" - "psubusb %%mm1, %%mm2 \n\t" - "psubusb %%mm0, %%mm1 \n\t" - "movq %%mm2, %%mm0 \n\t" - "movq %%mm1, %%mm3 \n\t" - "punpcklbw %%mm7, %%mm0 \n\t" - "punpcklbw %%mm7, %%mm1 \n\t" - "punpckhbw %%mm7, %%mm2 \n\t" - "punpckhbw %%mm7, %%mm3 \n\t" - "paddw %%mm0, %%mm4 \n\t" - "paddw %%mm1, %%mm4 \n\t" - "paddw %%mm2, %%mm4 \n\t" - "paddw %%mm3, %%mm4 \n\t" - - "decl %%ecx \n\t" - "jnz 1b \n\t" - - "movq %%mm4, %%mm3 \n\t" - "punpcklwd %%mm7, %%mm4 \n\t" - "punpckhwd %%mm7, %%mm3 \n\t" - "paddd %%mm4, %%mm3 \n\t" - "movd %%mm3, %%eax \n\t" - "psrlq $32, %%mm3 \n\t" - "movd %%mm3, %%edx \n\t" - "addl %%edx, %%eax \n\t" - "emms \n\t" - : "=a" (ret) - : "S" (a), "a" (s) - : "%ecx", "%edx" - ); - return 4*ret; + int ret; + __asm__ volatile ( + "movl $3, %%ecx \n\t" + "pxor %%mm4, %%mm4 \n\t" + "pxor %%mm7, %%mm7 \n\t" + + "1: \n\t" + + "movq (%%"REG_S"), %%mm0 \n\t" + "movq (%%"REG_S"), %%mm2 \n\t" + "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t" + "add %%"REG_a", %%"REG_S" \n\t" + "psubusb %%mm1, %%mm2 \n\t" + "psubusb %%mm0, %%mm1 \n\t" + "movq %%mm2, %%mm0 \n\t" + "movq %%mm1, %%mm3 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "punpckhbw %%mm7, %%mm3 \n\t" + "paddw %%mm0, %%mm4 \n\t" + "paddw %%mm1, %%mm4 \n\t" + "paddw %%mm2, %%mm4 \n\t" + "paddw %%mm3, %%mm4 \n\t" + + "decl %%ecx \n\t" + "jnz 1b \n\t" + + "movq %%mm4, %%mm3 \n\t" + "punpcklwd %%mm7, %%mm4 \n\t" + "punpckhwd %%mm7, %%mm3 \n\t" + "paddd %%mm4, %%mm3 \n\t" + "movd %%mm3, %%eax \n\t" + "psrlq $32, %%mm3 \n\t" + "movd %%mm3, %%edx \n\t" + "addl %%edx, %%eax \n\t" + "emms \n\t" + : "=a" (ret) + : "S" (a), "a" (s) + : "%ecx", "%edx" + ); + return 4*ret; } #endif #endif @@ -215,57 +215,57 @@ static int var_y_mmx(unsigned char *a, unsigned char *b, int s) static int diff_y(unsigned char *a, unsigned char *b, int s) { - int i, j, diff=0; - for (i=4; i; i--) { - for (j=0; j<8; j++) diff += ABS(a[j]-b[j]); - a+=s; b+=s; - } - return diff; + int i, j, diff=0; + for (i=4; i; i--) { + for (j=0; j<8; j++) diff += ABS(a[j]-b[j]); + a+=s; b+=s; + } + return diff; } static int licomb_y(unsigned char *a, unsigned char *b, int s) { - int i, j, diff=0; - for (i=4; i; i--) { - for (j=0; j<8; j++) - diff += ABS((a[j]<<1) - b[j-s] - b[j]) - + ABS((b[j]<<1) - a[j] - a[j+s]); - a+=s; b+=s; - } - return diff; + int i, j, diff=0; + for (i=4; i; i--) { + for (j=0; j<8; j++) + diff += ABS((a[j]<<1) - b[j-s] - b[j]) + + ABS((b[j]<<1) - a[j] - a[j+s]); + a+=s; b+=s; + } + return diff; } #if 0 static int qpcomb_y(unsigned char *a, unsigned char *b, int s) { - int i, j, diff=0; - for (i=4; i; i--) { - for (j=0; j<8; j++) - diff += ABS(a[j] - 3*b[j-s] + 3*a[j+s] - b[j]); - a+=s; b+=s; - } - return diff; + int i, j, diff=0; + for (i=4; i; i--) { + for (j=0; j<8; j++) + diff += ABS(a[j] - 3*b[j-s] + 3*a[j+s] - b[j]); + a+=s; b+=s; + } + return diff; } static int licomb_y_test(unsigned char *a, unsigned char *b, int s) { - int c = licomb_y(a,b,s); - int m = licomb_y_mmx(a,b,s); - if (c != m) printf("%d != %d\n", c, m); - return m; + int c = licomb_y(a,b,s); + int m = licomb_y_mmx(a,b,s); + if (c != m) printf("%d != %d\n", c, m); + return m; } #endif static int var_y(unsigned char *a, unsigned char *b, int s) { - int i, j, var=0; - for (i=3; i; i--) { - for (j=0; j<8; j++) { - var += ABS(a[j]-a[j+s]); - } - a+=s; b+=s; - } - return 4*var; /* match comb scaling */ + int i, j, var=0; + for (i=3; i; i--) { + for (j=0; j<8; j++) { + var += ABS(a[j]-a[j+s]); + } + a+=s; b+=s; + } + return 4*var; /* match comb scaling */ } @@ -278,61 +278,61 @@ static int var_y(unsigned char *a, unsigned char *b, int s) static void alloc_buffer(struct pullup_context *c, struct pullup_buffer *b) { - int i; - if (b->planes) return; - b->planes = calloc(c->nplanes, sizeof(unsigned char *)); - for (i = 0; i < c->nplanes; i++) { - b->planes[i] = malloc(c->h[i]*c->stride[i]); - /* Deal with idiotic 128=0 for chroma: */ - memset(b->planes[i], c->background[i], c->h[i]*c->stride[i]); - } + int i; + if (b->planes) return; + b->planes = calloc(c->nplanes, sizeof(unsigned char *)); + for (i = 0; i < c->nplanes; i++) { + b->planes[i] = malloc(c->h[i]*c->stride[i]); + /* Deal with idiotic 128=0 for chroma: */ + memset(b->planes[i], c->background[i], c->h[i]*c->stride[i]); + } } struct pullup_buffer *pullup_lock_buffer(struct pullup_buffer *b, int parity) { - if (!b) return 0; - if ((parity+1) & 1) b->lock[0]++; - if ((parity+1) & 2) b->lock[1]++; - return b; + if (!b) return 0; + if ((parity+1) & 1) b->lock[0]++; + if ((parity+1) & 2) b->lock[1]++; + return b; } void pullup_release_buffer(struct pullup_buffer *b, int parity) { - if (!b) return; - if ((parity+1) & 1) b->lock[0]--; - if ((parity+1) & 2) b->lock[1]--; + if (!b) return; + if ((parity+1) & 1) b->lock[0]--; + if ((parity+1) & 2) b->lock[1]--; } struct pullup_buffer *pullup_get_buffer(struct pullup_context *c, int parity) { - int i; + int i; - /* Try first to get the sister buffer for the previous field */ - if (parity < 2 && c->last && parity != c->last->parity - && !c->last->buffer->lock[parity]) { - alloc_buffer(c, c->last->buffer); - return pullup_lock_buffer(c->last->buffer, parity); - } + /* Try first to get the sister buffer for the previous field */ + if (parity < 2 && c->last && parity != c->last->parity + && !c->last->buffer->lock[parity]) { + alloc_buffer(c, c->last->buffer); + return pullup_lock_buffer(c->last->buffer, parity); + } - /* Prefer a buffer with both fields open */ - for (i = 0; i < c->nbuffers; i++) { - if (c->buffers[i].lock[0]) continue; - if (c->buffers[i].lock[1]) continue; - alloc_buffer(c, &c->buffers[i]); - return pullup_lock_buffer(&c->buffers[i], parity); - } + /* Prefer a buffer with both fields open */ + for (i = 0; i < c->nbuffers; i++) { + if (c->buffers[i].lock[0]) continue; + if (c->buffers[i].lock[1]) continue; + alloc_buffer(c, &c->buffers[i]); + return pullup_lock_buffer(&c->buffers[i], parity); + } - if (parity == 2) return 0; + if (parity == 2) return 0; - /* Search for any half-free buffer */ - for (i = 0; i < c->nbuffers; i++) { - if (((parity+1) & 1) && c->buffers[i].lock[0]) continue; - if (((parity+1) & 2) && c->buffers[i].lock[1]) continue; - alloc_buffer(c, &c->buffers[i]); - return pullup_lock_buffer(&c->buffers[i], parity); - } + /* Search for any half-free buffer */ + for (i = 0; i < c->nbuffers; i++) { + if (((parity+1) & 1) && c->buffers[i].lock[0]) continue; + if (((parity+1) & 2) && c->buffers[i].lock[1]) continue; + alloc_buffer(c, &c->buffers[i]); + return pullup_lock_buffer(&c->buffers[i], parity); + } - return 0; + return 0; } @@ -341,35 +341,35 @@ struct pullup_buffer *pullup_get_buffer(struct pullup_context *c, int parity) static void compute_metric(struct pullup_context *c, - struct pullup_field *fa, int pa, - struct pullup_field *fb, int pb, - int (*func)(unsigned char *, unsigned char *, int), int *dest) + struct pullup_field *fa, int pa, + struct pullup_field *fb, int pb, + int (*func)(unsigned char *, unsigned char *, int), int *dest) { - unsigned char *a, *b; - int x, y; - int mp = c->metric_plane; - int xstep = c->bpp[mp]; - int ystep = c->stride[mp]<<3; - int s = c->stride[mp]<<1; /* field stride */ - int w = c->metric_w*xstep; + unsigned char *a, *b; + int x, y; + int mp = c->metric_plane; + int xstep = c->bpp[mp]; + int ystep = c->stride[mp]<<3; + int s = c->stride[mp]<<1; /* field stride */ + int w = c->metric_w*xstep; - if (!fa->buffer || !fb->buffer) return; + if (!fa->buffer || !fb->buffer) return; - /* Shortcut for duplicate fields (e.g. from RFF flag) */ - if (fa->buffer == fb->buffer && pa == pb) { - memset(dest, 0, c->metric_len * sizeof(int)); - return; - } + /* Shortcut for duplicate fields (e.g. from RFF flag) */ + if (fa->buffer == fb->buffer && pa == pb) { + memset(dest, 0, c->metric_len * sizeof(int)); + return; + } - a = fa->buffer->planes[mp] + pa * c->stride[mp] + c->metric_offset; - b = fb->buffer->planes[mp] + pb * c->stride[mp] + c->metric_offset; + a = fa->buffer->planes[mp] + pa * c->stride[mp] + c->metric_offset; + b = fb->buffer->planes[mp] + pb * c->stride[mp] + c->metric_offset; - for (y = c->metric_h; y; y--) { - for (x = 0; x < w; x += xstep) { - *dest++ = func(a + x, b + x, s); - } - a += ystep; b += ystep; - } + for (y = c->metric_h; y; y--) { + for (x = 0; x < w; x += xstep) { + *dest++ = func(a + x, b + x, s); + } + a += ystep; b += ystep; + } } @@ -378,76 +378,76 @@ static void compute_metric(struct pullup_context *c, static void alloc_metrics(struct pullup_context *c, struct pullup_field *f) { - f->diffs = calloc(c->metric_len, sizeof(int)); - f->comb = calloc(c->metric_len, sizeof(int)); - f->var = calloc(c->metric_len, sizeof(int)); - /* add more metrics here as needed */ + f->diffs = calloc(c->metric_len, sizeof(int)); + f->comb = calloc(c->metric_len, sizeof(int)); + f->var = calloc(c->metric_len, sizeof(int)); + /* add more metrics here as needed */ } static struct pullup_field *make_field_queue(struct pullup_context *c, int len) { - struct pullup_field *head, *f; - f = head = calloc(1, sizeof(struct pullup_field)); - alloc_metrics(c, f); - for (; len > 0; len--) { - f->next = calloc(1, sizeof(struct pullup_field)); - f->next->prev = f; - f = f->next; - alloc_metrics(c, f); - } - f->next = head; - head->prev = f; - return head; + struct pullup_field *head, *f; + f = head = calloc(1, sizeof(struct pullup_field)); + alloc_metrics(c, f); + for (; len > 0; len--) { + f->next = calloc(1, sizeof(struct pullup_field)); + f->next->prev = f; + f = f->next; + alloc_metrics(c, f); + } + f->next = head; + head->prev = f; + return head; } static void check_field_queue(struct pullup_context *c) { - if (c->head->next == c->first) { - struct pullup_field *f = calloc(1, sizeof(struct pullup_field)); - alloc_metrics(c, f); - f->prev = c->head; - f->next = c->first; - c->head->next = f; - c->first->prev = f; - } + if (c->head->next == c->first) { + struct pullup_field *f = calloc(1, sizeof(struct pullup_field)); + alloc_metrics(c, f); + f->prev = c->head; + f->next = c->first; + c->head->next = f; + c->first->prev = f; + } } void pullup_submit_field(struct pullup_context *c, struct pullup_buffer *b, int parity) { - struct pullup_field *f; + struct pullup_field *f; - /* Grow the circular list if needed */ - check_field_queue(c); + /* Grow the circular list if needed */ + check_field_queue(c); - /* Cannot have two fields of same parity in a row; drop the new one */ - if (c->last && c->last->parity == parity) return; + /* Cannot have two fields of same parity in a row; drop the new one */ + if (c->last && c->last->parity == parity) return; - f = c->head; - f->parity = parity; - f->buffer = pullup_lock_buffer(b, parity); - f->flags = 0; - f->breaks = 0; - f->affinity = 0; + f = c->head; + f->parity = parity; + f->buffer = pullup_lock_buffer(b, parity); + f->flags = 0; + f->breaks = 0; + f->affinity = 0; - compute_metric(c, f, parity, f->prev->prev, parity, c->diff, f->diffs); - compute_metric(c, parity?f->prev:f, 0, parity?f:f->prev, 1, c->comb, f->comb); - compute_metric(c, f, parity, f, -1, c->var, f->var); + compute_metric(c, f, parity, f->prev->prev, parity, c->diff, f->diffs); + compute_metric(c, parity?f->prev:f, 0, parity?f:f->prev, 1, c->comb, f->comb); + compute_metric(c, f, parity, f, -1, c->var, f->var); - /* Advance the circular list */ - if (!c->first) c->first = c->head; - c->last = c->head; - c->head = c->head->next; + /* Advance the circular list */ + if (!c->first) c->first = c->head; + c->last = c->head; + c->head = c->head->next; } void pullup_flush_fields(struct pullup_context *c) { - struct pullup_field *f; + struct pullup_field *f; - for (f = c->first; f && f != c->head; f = f->next) { - pullup_release_buffer(f->buffer, f->parity); - f->buffer = 0; - } - c->first = c->last = 0; + for (f = c->first; f && f != c->head; f = f->next) { + pullup_release_buffer(f->buffer, f->parity); + f->buffer = 0; + } + c->first = c->last = 0; } @@ -469,175 +469,175 @@ void pullup_flush_fields(struct pullup_context *c) static int queue_length(struct pullup_field *begin, struct pullup_field *end) { - int count = 1; - struct pullup_field *f; + int count = 1; + struct pullup_field *f; - if (!begin || !end) return 0; - for (f = begin; f != end; f = f->next) count++; - return count; + if (!begin || !end) return 0; + for (f = begin; f != end; f = f->next) count++; + return count; } static int find_first_break(struct pullup_field *f, int max) { - int i; - for (i = 0; i < max; i++) { - if (f->breaks & BREAK_RIGHT || f->next->breaks & BREAK_LEFT) - return i+1; - f = f->next; - } - return 0; + int i; + for (i = 0; i < max; i++) { + if (f->breaks & BREAK_RIGHT || f->next->breaks & BREAK_LEFT) + return i+1; + f = f->next; + } + return 0; } static void compute_breaks(struct pullup_context *c, struct pullup_field *f0) { - int i; - struct pullup_field *f1 = f0->next; - struct pullup_field *f2 = f1->next; - struct pullup_field *f3 = f2->next; - int l, max_l=0, max_r=0; - //struct pullup_field *ff; - //for (i=0, ff=c->first; ff != f0; i++, ff=ff->next); - - if (f0->flags & F_HAVE_BREAKS) return; - //printf("\n%d: ", i); - f0->flags |= F_HAVE_BREAKS; - - /* Special case when fields are 100% identical */ - if (f0->buffer == f2->buffer && f1->buffer != f3->buffer) { - f2->breaks |= BREAK_RIGHT; - return; - } - if (f0->buffer != f2->buffer && f1->buffer == f3->buffer) { - f1->breaks |= BREAK_LEFT; - return; - } - - for (i = 0; i < c->metric_len; i++) { - l = f2->diffs[i] - f3->diffs[i]; - if (l > max_l) max_l = l; - if (-l > max_r) max_r = -l; - } - /* Don't get tripped up when differences are mostly quant error */ - //printf("%d %d\n", max_l, max_r); - if (max_l + max_r < 128) return; - if (max_l > 4*max_r) f1->breaks |= BREAK_LEFT; - if (max_r > 4*max_l) f2->breaks |= BREAK_RIGHT; + int i; + struct pullup_field *f1 = f0->next; + struct pullup_field *f2 = f1->next; + struct pullup_field *f3 = f2->next; + int l, max_l=0, max_r=0; + //struct pullup_field *ff; + //for (i=0, ff=c->first; ff != f0; i++, ff=ff->next); + + if (f0->flags & F_HAVE_BREAKS) return; + //printf("\n%d: ", i); + f0->flags |= F_HAVE_BREAKS; + + /* Special case when fields are 100% identical */ + if (f0->buffer == f2->buffer && f1->buffer != f3->buffer) { + f2->breaks |= BREAK_RIGHT; + return; + } + if (f0->buffer != f2->buffer && f1->buffer == f3->buffer) { + f1->breaks |= BREAK_LEFT; + return; + } + + for (i = 0; i < c->metric_len; i++) { + l = f2->diffs[i] - f3->diffs[i]; + if (l > max_l) max_l = l; + if (-l > max_r) max_r = -l; + } + /* Don't get tripped up when differences are mostly quant error */ + //printf("%d %d\n", max_l, max_r); + if (max_l + max_r < 128) return; + if (max_l > 4*max_r) f1->breaks |= BREAK_LEFT; + if (max_r > 4*max_l) f2->breaks |= BREAK_RIGHT; } static void compute_affinity(struct pullup_context *c, struct pullup_field *f) { - int i; - int max_l=0, max_r=0, l; - if (f->flags & F_HAVE_AFFINITY) return; - f->flags |= F_HAVE_AFFINITY; - if (f->buffer == f->next->next->buffer) { - f->affinity = 1; - f->next->affinity = 0; - f->next->next->affinity = -1; - f->next->flags |= F_HAVE_AFFINITY; - f->next->next->flags |= F_HAVE_AFFINITY; - return; - } - if (1) { - for (i = 0; i < c->metric_len; i++) { - int lv = f->prev->var[i]; - int rv = f->next->var[i]; - int v = f->var[i]; - int lc = f->comb[i] - (v+lv) + ABS(v-lv); - int rc = f->next->comb[i] - (v+rv) + ABS(v-rv); - lc = lc>0 ? lc : 0; - rc = rc>0 ? rc : 0; - l = lc - rc; - if (l > max_l) max_l = l; - if (-l > max_r) max_r = -l; - } - if (max_l + max_r < 64) return; - if (max_r > 6*max_l) f->affinity = -1; - else if (max_l > 6*max_r) f->affinity = 1; - } else { - for (i = 0; i < c->metric_len; i++) { - l = f->comb[i] - f->next->comb[i]; - if (l > max_l) max_l = l; - if (-l > max_r) max_r = -l; - } - if (max_l + max_r < 64) return; - if (max_r > 2*max_l) f->affinity = -1; - else if (max_l > 2*max_r) f->affinity = 1; - } + int i; + int max_l=0, max_r=0, l; + if (f->flags & F_HAVE_AFFINITY) return; + f->flags |= F_HAVE_AFFINITY; + if (f->buffer == f->next->next->buffer) { + f->affinity = 1; + f->next->affinity = 0; + f->next->next->affinity = -1; + f->next->flags |= F_HAVE_AFFINITY; + f->next->next->flags |= F_HAVE_AFFINITY; + return; + } + if (1) { + for (i = 0; i < c->metric_len; i++) { + int lv = f->prev->var[i]; + int rv = f->next->var[i]; + int v = f->var[i]; + int lc = f->comb[i] - (v+lv) + ABS(v-lv); + int rc = f->next->comb[i] - (v+rv) + ABS(v-rv); + lc = lc>0 ? lc : 0; + rc = rc>0 ? rc : 0; + l = lc - rc; + if (l > max_l) max_l = l; + if (-l > max_r) max_r = -l; + } + if (max_l + max_r < 64) return; + if (max_r > 6*max_l) f->affinity = -1; + else if (max_l > 6*max_r) f->affinity = 1; + } else { + for (i = 0; i < c->metric_len; i++) { + l = f->comb[i] - f->next->comb[i]; + if (l > max_l) max_l = l; + if (-l > max_r) max_r = -l; + } + if (max_l + max_r < 64) return; + if (max_r > 2*max_l) f->affinity = -1; + else if (max_l > 2*max_r) f->affinity = 1; + } } static void foo(struct pullup_context *c) { - struct pullup_field *f = c->first; - int i, n = queue_length(f, c->last); - for (i = 0; i < n-1; i++) { - if (i < n-3) compute_breaks(c, f); - compute_affinity(c, f); - f = f->next; - } + struct pullup_field *f = c->first; + int i, n = queue_length(f, c->last); + for (i = 0; i < n-1; i++) { + if (i < n-3) compute_breaks(c, f); + compute_affinity(c, f); + f = f->next; + } } static int decide_frame_length(struct pullup_context *c) { - struct pullup_field *f0 = c->first; - struct pullup_field *f1 = f0->next; - struct pullup_field *f2 = f1->next; - int l; - - if (queue_length(c->first, c->last) < 4) return 0; - foo(c); - - if (f0->affinity == -1) return 1; - - l = find_first_break(f0, 3); - if (l == 1 && c->strict_breaks < 0) l = 0; - - switch (l) { - case 1: - if (c->strict_breaks < 1 && f0->affinity == 1 && f1->affinity == -1) - return 2; - else return 1; - case 2: - /* FIXME: strictly speaking, f0->prev is no longer valid... :) */ - if (c->strict_pairs - && (f0->prev->breaks & BREAK_RIGHT) && (f2->breaks & BREAK_LEFT) - && (f0->affinity != 1 || f1->affinity != -1) ) - return 1; - if (f1->affinity == 1) return 1; - else return 2; - case 3: - if (f2->affinity == 1) return 2; - else return 3; - default: - /* 9 possibilities covered before switch */ - if (f1->affinity == 1) return 1; /* covers 6 */ - else if (f1->affinity == -1) return 2; /* covers 6 */ - else if (f2->affinity == -1) { /* covers 2 */ - if (f0->affinity == 1) return 3; - else return 1; - } - else return 2; /* the remaining 6 */ - } + struct pullup_field *f0 = c->first; + struct pullup_field *f1 = f0->next; + struct pullup_field *f2 = f1->next; + int l; + + if (queue_length(c->first, c->last) < 4) return 0; + foo(c); + + if (f0->affinity == -1) return 1; + + l = find_first_break(f0, 3); + if (l == 1 && c->strict_breaks < 0) l = 0; + + switch (l) { + case 1: + if (c->strict_breaks < 1 && f0->affinity == 1 && f1->affinity == -1) + return 2; + else return 1; + case 2: + /* FIXME: strictly speaking, f0->prev is no longer valid... :) */ + if (c->strict_pairs + && (f0->prev->breaks & BREAK_RIGHT) && (f2->breaks & BREAK_LEFT) + && (f0->affinity != 1 || f1->affinity != -1) ) + return 1; + if (f1->affinity == 1) return 1; + else return 2; + case 3: + if (f2->affinity == 1) return 2; + else return 3; + default: + /* 9 possibilities covered before switch */ + if (f1->affinity == 1) return 1; /* covers 6 */ + else if (f1->affinity == -1) return 2; /* covers 6 */ + else if (f2->affinity == -1) { /* covers 2 */ + if (f0->affinity == 1) return 3; + else return 1; + } + else return 2; /* the remaining 6 */ + } } static void print_aff_and_breaks(struct pullup_context *c, struct pullup_field *f) { - int i; - struct pullup_field *f0 = f; - const char aff_l[] = "+..", aff_r[] = "..+"; - printf("\naffinity: "); - for (i = 0; i < 4; i++) { - printf("%c%d%c", aff_l[1+f->affinity], i, aff_r[1+f->affinity]); - f = f->next; - } - f = f0; - printf("\nbreaks: "); - for (i=0; i<4; i++) { - printf("%c%d%c", f->breaks & BREAK_LEFT ? '|' : '.', i, f->breaks & BREAK_RIGHT ? '|' : '.'); - f = f->next; - } - printf("\n"); + int i; + struct pullup_field *f0 = f; + const char aff_l[] = "+..", aff_r[] = "..+"; + printf("\naffinity: "); + for (i = 0; i < 4; i++) { + printf("%c%d%c", aff_l[1+f->affinity], i, aff_r[1+f->affinity]); + f = f->next; + } + f = f0; + printf("\nbreaks: "); + for (i=0; i<4; i++) { + printf("%c%d%c", f->breaks & BREAK_LEFT ? '|' : '.', i, f->breaks & BREAK_RIGHT ? '|' : '.'); + f = f->next; + } + printf("\n"); } @@ -646,97 +646,97 @@ static void print_aff_and_breaks(struct pullup_context *c, struct pullup_field * struct pullup_frame *pullup_get_frame(struct pullup_context *c) { - int i; - struct pullup_frame *fr = c->frame; - int n = decide_frame_length(c); - int aff = c->first->next->affinity; - - if (!n) return 0; - if (fr->lock) return 0; - - if (c->verbose) { - print_aff_and_breaks(c, c->first); - printf("duration: %d \n", n); - } - - fr->lock++; - fr->length = n; - fr->parity = c->first->parity; - fr->buffer = 0; - for (i = 0; i < n; i++) { - /* We cheat and steal the buffer without release+relock */ - fr->ifields[i] = c->first->buffer; - c->first->buffer = 0; - c->first = c->first->next; - } - - if (n == 1) { - fr->ofields[fr->parity] = fr->ifields[0]; - fr->ofields[fr->parity^1] = 0; - } else if (n == 2) { - fr->ofields[fr->parity] = fr->ifields[0]; - fr->ofields[fr->parity^1] = fr->ifields[1]; - } else if (n == 3) { - if (aff == 0) - aff = (fr->ifields[0] == fr->ifields[1]) ? -1 : 1; - /* else if (c->verbose) printf("forced aff: %d \n", aff); */ - fr->ofields[fr->parity] = fr->ifields[1+aff]; - fr->ofields[fr->parity^1] = fr->ifields[1]; - } - pullup_lock_buffer(fr->ofields[0], 0); - pullup_lock_buffer(fr->ofields[1], 1); - - if (fr->ofields[0] == fr->ofields[1]) { - fr->buffer = fr->ofields[0]; - pullup_lock_buffer(fr->buffer, 2); - return fr; - } - return fr; + int i; + struct pullup_frame *fr = c->frame; + int n = decide_frame_length(c); + int aff = c->first->next->affinity; + + if (!n) return 0; + if (fr->lock) return 0; + + if (c->verbose) { + print_aff_and_breaks(c, c->first); + printf("duration: %d \n", n); + } + + fr->lock++; + fr->length = n; + fr->parity = c->first->parity; + fr->buffer = 0; + for (i = 0; i < n; i++) { + /* We cheat and steal the buffer without release+relock */ + fr->ifields[i] = c->first->buffer; + c->first->buffer = 0; + c->first = c->first->next; + } + + if (n == 1) { + fr->ofields[fr->parity] = fr->ifields[0]; + fr->ofields[fr->parity^1] = 0; + } else if (n == 2) { + fr->ofields[fr->parity] = fr->ifields[0]; + fr->ofields[fr->parity^1] = fr->ifields[1]; + } else if (n == 3) { + if (aff == 0) + aff = (fr->ifields[0] == fr->ifields[1]) ? -1 : 1; + /* else if (c->verbose) printf("forced aff: %d \n", aff); */ + fr->ofields[fr->parity] = fr->ifields[1+aff]; + fr->ofields[fr->parity^1] = fr->ifields[1]; + } + pullup_lock_buffer(fr->ofields[0], 0); + pullup_lock_buffer(fr->ofields[1], 1); + + if (fr->ofields[0] == fr->ofields[1]) { + fr->buffer = fr->ofields[0]; + pullup_lock_buffer(fr->buffer, 2); + return fr; + } + return fr; } static void copy_field(struct pullup_context *c, struct pullup_buffer *dest, - struct pullup_buffer *src, int parity) + struct pullup_buffer *src, int parity) { - int i, j; - unsigned char *d, *s; - for (i = 0; i < c->nplanes; i++) { - s = src->planes[i] + parity*c->stride[i]; - d = dest->planes[i] + parity*c->stride[i]; - for (j = c->h[i]>>1; j; j--) { - memcpy(d, s, c->stride[i]); - s += c->stride[i]<<1; - d += c->stride[i]<<1; - } - } + int i, j; + unsigned char *d, *s; + for (i = 0; i < c->nplanes; i++) { + s = src->planes[i] + parity*c->stride[i]; + d = dest->planes[i] + parity*c->stride[i]; + for (j = c->h[i]>>1; j; j--) { + memcpy(d, s, c->stride[i]); + s += c->stride[i]<<1; + d += c->stride[i]<<1; + } + } } void pullup_pack_frame(struct pullup_context *c, struct pullup_frame *fr) { - int i; - if (fr->buffer) return; - if (fr->length < 2) return; /* FIXME: deal with this */ - for (i = 0; i < 2; i++) - { - if (fr->ofields[i]->lock[i^1]) continue; - fr->buffer = fr->ofields[i]; - pullup_lock_buffer(fr->buffer, 2); - copy_field(c, fr->buffer, fr->ofields[i^1], i^1); - return; - } - fr->buffer = pullup_get_buffer(c, 2); - copy_field(c, fr->buffer, fr->ofields[0], 0); - copy_field(c, fr->buffer, fr->ofields[1], 1); + int i; + if (fr->buffer) return; + if (fr->length < 2) return; /* FIXME: deal with this */ + for (i = 0; i < 2; i++) + { + if (fr->ofields[i]->lock[i^1]) continue; + fr->buffer = fr->ofields[i]; + pullup_lock_buffer(fr->buffer, 2); + copy_field(c, fr->buffer, fr->ofields[i^1], i^1); + return; + } + fr->buffer = pullup_get_buffer(c, 2); + copy_field(c, fr->buffer, fr->ofields[0], 0); + copy_field(c, fr->buffer, fr->ofields[1], 1); } void pullup_release_frame(struct pullup_frame *fr) { - int i; - for (i = 0; i < fr->length; i++) - pullup_release_buffer(fr->ifields[i], fr->parity ^ (i&1)); - pullup_release_buffer(fr->ofields[0], 0); - pullup_release_buffer(fr->ofields[1], 1); - if (fr->buffer) pullup_release_buffer(fr->buffer, 2); - fr->lock--; + int i; + for (i = 0; i < fr->length; i++) + pullup_release_buffer(fr->ifields[i], fr->parity ^ (i&1)); + pullup_release_buffer(fr->ofields[0], 0); + pullup_release_buffer(fr->ofields[1], 1); + if (fr->buffer) pullup_release_buffer(fr->buffer, 2); + fr->lock--; } @@ -746,77 +746,77 @@ void pullup_release_frame(struct pullup_frame *fr) struct pullup_context *pullup_alloc_context(void) { - struct pullup_context *c; + struct pullup_context *c; - c = calloc(1, sizeof(struct pullup_context)); + c = calloc(1, sizeof(struct pullup_context)); - return c; + return c; } void pullup_preinit_context(struct pullup_context *c) { - c->bpp = calloc(c->nplanes, sizeof(int)); - c->w = calloc(c->nplanes, sizeof(int)); - c->h = calloc(c->nplanes, sizeof(int)); - c->stride = calloc(c->nplanes, sizeof(int)); - c->background = calloc(c->nplanes, sizeof(int)); + c->bpp = calloc(c->nplanes, sizeof(int)); + c->w = calloc(c->nplanes, sizeof(int)); + c->h = calloc(c->nplanes, sizeof(int)); + c->stride = calloc(c->nplanes, sizeof(int)); + c->background = calloc(c->nplanes, sizeof(int)); } void pullup_init_context(struct pullup_context *c) { - int mp = c->metric_plane; - if (c->nbuffers < 10) c->nbuffers = 10; - c->buffers = calloc(c->nbuffers, sizeof (struct pullup_buffer)); + int mp = c->metric_plane; + if (c->nbuffers < 10) c->nbuffers = 10; + c->buffers = calloc(c->nbuffers, sizeof (struct pullup_buffer)); - c->metric_w = (c->w[mp] - ((c->junk_left + c->junk_right) << 3)) >> 3; - c->metric_h = (c->h[mp] - ((c->junk_top + c->junk_bottom) << 1)) >> 3; - c->metric_offset = c->junk_left*c->bpp[mp] + (c->junk_top<<1)*c->stride[mp]; - c->metric_len = c->metric_w * c->metric_h; + c->metric_w = (c->w[mp] - ((c->junk_left + c->junk_right) << 3)) >> 3; + c->metric_h = (c->h[mp] - ((c->junk_top + c->junk_bottom) << 1)) >> 3; + c->metric_offset = c->junk_left*c->bpp[mp] + (c->junk_top<<1)*c->stride[mp]; + c->metric_len = c->metric_w * c->metric_h; - c->head = make_field_queue(c, 8); + c->head = make_field_queue(c, 8); - c->frame = calloc(1, sizeof (struct pullup_frame)); - c->frame->ifields = calloc(3, sizeof (struct pullup_buffer *)); + c->frame = calloc(1, sizeof (struct pullup_frame)); + c->frame->ifields = calloc(3, sizeof (struct pullup_buffer *)); - switch(c->format) { - case PULLUP_FMT_Y: - c->diff = diff_y; - c->comb = licomb_y; - c->var = var_y; + switch(c->format) { + case PULLUP_FMT_Y: + c->diff = diff_y; + c->comb = licomb_y; + c->var = var_y; #if ARCH_X86 #if HAVE_MMX - if (c->cpu & PULLUP_CPU_MMX) { - c->diff = diff_y_mmx; - c->comb = licomb_y_mmx; - c->var = var_y_mmx; - } + if (c->cpu & PULLUP_CPU_MMX) { + c->diff = diff_y_mmx; + c->comb = licomb_y_mmx; + c->var = var_y_mmx; + } #endif #endif - /* c->comb = qpcomb_y; */ - break; + /* c->comb = qpcomb_y; */ + break; #if 0 - case PULLUP_FMT_YUY2: - c->diff = diff_yuy2; - break; - case PULLUP_FMT_RGB32: - c->diff = diff_rgb32; - break; + case PULLUP_FMT_YUY2: + c->diff = diff_yuy2; + break; + case PULLUP_FMT_RGB32: + c->diff = diff_rgb32; + break; #endif - } + } } void pullup_free_context(struct pullup_context *c) { - struct pullup_field *f; - free(c->buffers); - f = c->head; - do { - if (!f) break; - free(f->diffs); - free(f->comb); - f = f->next; - free(f->prev); - } while (f != c->head); - free(c->frame); - free(c); + struct pullup_field *f; + free(c->buffers); + f = c->head; + do { + if (!f) break; + free(f->diffs); + free(f->comb); + f = f->next; + free(f->prev); + } while (f != c->head); + free(c->frame); + free(c); } diff --git a/mplayer/libmpcodecs/pullup.h b/mplayer/libmpcodecs/pullup.h index b5e20b21..d02a7226 100644 --- a/mplayer/libmpcodecs/pullup.h +++ b/mplayer/libmpcodecs/pullup.h @@ -33,53 +33,53 @@ struct pullup_buffer { - int lock[2]; - unsigned char **planes; + int lock[2]; + unsigned char **planes; }; struct pullup_field { - int parity; - struct pullup_buffer *buffer; - unsigned int flags; - int breaks; - int affinity; - int *diffs; - int *comb; - int *var; - struct pullup_field *prev, *next; + int parity; + struct pullup_buffer *buffer; + unsigned int flags; + int breaks; + int affinity; + int *diffs; + int *comb; + int *var; + struct pullup_field *prev, *next; }; struct pullup_frame { - int lock; - int length; - int parity; - struct pullup_buffer **ifields, *ofields[2]; - struct pullup_buffer *buffer; + int lock; + int length; + int parity; + struct pullup_buffer **ifields, *ofields[2]; + struct pullup_buffer *buffer; }; struct pullup_context { - /* Public interface */ - int format; - int nplanes; - int *bpp, *w, *h, *stride, *background; - unsigned int cpu; - int junk_left, junk_right, junk_top, junk_bottom; - int verbose; - int metric_plane; - int strict_breaks; - int strict_pairs; - /* Internal data */ - struct pullup_field *first, *last, *head; - struct pullup_buffer *buffers; - int nbuffers; - int (*diff)(unsigned char *, unsigned char *, int); - int (*comb)(unsigned char *, unsigned char *, int); - int (*var)(unsigned char *, unsigned char *, int); - int metric_w, metric_h, metric_len, metric_offset; - struct pullup_frame *frame; + /* Public interface */ + int format; + int nplanes; + int *bpp, *w, *h, *stride, *background; + unsigned int cpu; + int junk_left, junk_right, junk_top, junk_bottom; + int verbose; + int metric_plane; + int strict_breaks; + int strict_pairs; + /* Internal data */ + struct pullup_field *first, *last, *head; + struct pullup_buffer *buffers; + int nbuffers; + int (*diff)(unsigned char *, unsigned char *, int); + int (*comb)(unsigned char *, unsigned char *, int); + int (*var)(unsigned char *, unsigned char *, int); + int metric_w, metric_h, metric_len, metric_offset; + struct pullup_frame *frame; }; diff --git a/mplayer/libmpcodecs/vd_ffmpeg.c b/mplayer/libmpcodecs/vd_ffmpeg.c index dc548226..adbb0d90 100644 --- a/mplayer/libmpcodecs/vd_ffmpeg.c +++ b/mplayer/libmpcodecs/vd_ffmpeg.c @@ -198,10 +198,10 @@ static void mp_msp_av_log_callback(void *ptr, int level, const char *fmt, if(!strcmp(avc->class_name, "AVCodecContext")){ AVCodecContext *s= ptr; if(s->codec){ - if(s->codec->type == CODEC_TYPE_AUDIO){ + if(s->codec->type == AVMEDIA_TYPE_AUDIO){ if(s->codec->decode) type= MSGT_DECAUDIO; - }else if(s->codec->type == CODEC_TYPE_VIDEO){ + }else if(s->codec->type == AVMEDIA_TYPE_VIDEO){ if(s->codec->decode) type= MSGT_DECVIDEO; } @@ -283,7 +283,7 @@ static int init(sh_video_t *sh){ if(vd_use_slices && (lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) && !do_vis_debug) ctx->do_slices=1; - if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_ROQ && lavc_codec->id != CODEC_ID_VP8) + if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_ROQ && lavc_codec->id != CODEC_ID_VP8 && lavc_codec->id != CODEC_ID_LAGARITH) ctx->do_dr1=1; ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64; ctx->ip_count= ctx->b_count= 0; @@ -292,7 +292,7 @@ static int init(sh_video_t *sh){ ctx->avctx = avcodec_alloc_context(); avctx = ctx->avctx; avctx->opaque = sh; - avctx->codec_type = CODEC_TYPE_VIDEO; + avctx->codec_type = AVMEDIA_TYPE_VIDEO; avctx->codec_id = lavc_codec->id; #if CONFIG_VDPAU @@ -834,7 +834,7 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){ pkt.data = data; pkt.size = len; // HACK: make PNGs decode normally instead of as CorePNG delta frames - pkt.flags = PKT_FLAG_KEY; + pkt.flags = AV_PKT_FLAG_KEY; ret = avcodec_decode_video2(avctx, pic, &got_picture, &pkt); dr1= ctx->do_dr1; diff --git a/mplayer/libmpcodecs/vd_mpng.c b/mplayer/libmpcodecs/vd_mpng.c index 85b20915..930a8115 100644 --- a/mplayer/libmpcodecs/vd_mpng.c +++ b/mplayer/libmpcodecs/vd_mpng.c @@ -74,7 +74,7 @@ static int pngLength; static void pngReadFN( png_structp pngstr,png_bytep buffer,png_size_t size ) { - char * p = pngstr->io_ptr; + char * p = png_get_io_ptr(pngstr); if(size>pngLength-pngPointer && pngLength>=pngPointer) size=pngLength-pngPointer; fast_memcpy( buffer,(char *)&p[pngPointer],size ); pngPointer+=size; @@ -90,6 +90,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ png_uint_32 png_width=0,png_height=0; int depth,color; png_uint_32 i; + png_byte color_type; mp_image_t* mpi; int cols; @@ -111,7 +112,9 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ png_get_IHDR( png,info,&png_width,&png_height,&depth,&color,NULL,NULL,NULL ); png_set_bgr( png ); - switch( info->color_type ) { + color_type=png_get_color_type(png, info); + + switch( color_type ) { case PNG_COLOR_TYPE_GRAY_ALPHA: mp_msg( MSGT_DECVIDEO,MSGL_INFO,"Sorry gray scaled png with alpha channel not supported at moment.\n" ); break; @@ -128,7 +131,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ out_fmt=IMGFMT_BGR24; break; default: - mp_msg( MSGT_DECVIDEO,MSGL_INFO,"Sorry, unsupported PNG colorspace: %d.\n" ,info->color_type); + mp_msg( MSGT_DECVIDEO,MSGL_INFO,"Sorry, unsupported PNG colorspace: %d.\n" ,color_type); } // (re)init libvo if image parameters changed (width/height/colorspace) diff --git a/mplayer/libmpcodecs/ve_lavc.c b/mplayer/libmpcodecs/ve_lavc.c index 7a1ab8bb..62267880 100644 --- a/mplayer/libmpcodecs/ve_lavc.c +++ b/mplayer/libmpcodecs/ve_lavc.c @@ -183,13 +183,15 @@ char *lavc_param_audio_avopt = NULL; #include "m_option.h" +#define MAX_BITRATE 100000000 /* 100Mbit */ + const m_option_t lavcopts_conf[]={ {"acodec", &lavc_param_acodec, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"abitrate", &lavc_param_abitrate, CONF_TYPE_INT, CONF_RANGE, 1, 1000000, NULL}, {"atag", &lavc_param_atag, CONF_TYPE_INT, CONF_RANGE, 0, 0xffff, NULL}, {"vcodec", &lavc_param_vcodec, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"vbitrate", &lavc_param_vbitrate, CONF_TYPE_INT, CONF_RANGE, 4, 24000000, NULL}, - {"vratetol", &lavc_param_vrate_tolerance, CONF_TYPE_INT, CONF_RANGE, 4, 24000000, NULL}, + {"vbitrate", &lavc_param_vbitrate, CONF_TYPE_INT, CONF_RANGE, 4, MAX_BITRATE, NULL}, + {"vratetol", &lavc_param_vrate_tolerance, CONF_TYPE_INT, CONF_RANGE, 4, MAX_BITRATE, NULL}, {"vhq", &lavc_param_mb_decision, CONF_TYPE_FLAG, 0, 0, 1, NULL}, {"mbd", &lavc_param_mb_decision, CONF_TYPE_INT, CONF_RANGE, 0, 9, NULL}, {"v4mv", &lavc_param_v4mv, CONF_TYPE_FLAG, 0, 0, 1, NULL}, @@ -227,9 +229,9 @@ const m_option_t lavcopts_conf[]={ {"vqmod_freq", &lavc_param_rc_qmod_freq, CONF_TYPE_INT, 0, 0, 0, NULL}, {"vrc_eq", &lavc_param_rc_eq, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"vrc_override", &lavc_param_rc_override_string, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"vrc_maxrate", &lavc_param_rc_max_rate, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL}, - {"vrc_minrate", &lavc_param_rc_min_rate, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL}, - {"vrc_buf_size", &lavc_param_rc_buffer_size, CONF_TYPE_INT, CONF_RANGE, 4, 24000000, NULL}, + {"vrc_maxrate", &lavc_param_rc_max_rate, CONF_TYPE_INT, CONF_RANGE, 0, MAX_BITRATE, NULL}, + {"vrc_minrate", &lavc_param_rc_min_rate, CONF_TYPE_INT, CONF_RANGE, 0, MAX_BITRATE, NULL}, + {"vrc_buf_size", &lavc_param_rc_buffer_size, CONF_TYPE_INT, CONF_RANGE, 4, MAX_BITRATE, NULL}, {"vrc_buf_aggressivity", &lavc_param_rc_buffer_aggressivity, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 99.0, NULL}, {"vrc_init_cplx", &lavc_param_rc_initial_cplx, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 9999999.0, NULL}, {"vrc_init_occupancy", &lavc_param_rc_initial_buffer_occupancy, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 1.0, NULL}, @@ -810,6 +812,13 @@ static int encode_frame(struct vf_instance *vf, AVFrame *pic, double pts){ out_size = avcodec_encode_video(lavc_venc_context, mux_v->buffer, mux_v->buffer_size, pic); + /* store stats if there are any */ + if(lavc_venc_context->stats_out && stats_file) { + fprintf(stats_file, "%s", lavc_venc_context->stats_out); + /* make sure we can't accidentally store the same stats twice */ + lavc_venc_context->stats_out[0] = 0; + } + if(pts != MP_NOPTS_VALUE) dts= pts - lavc_venc_context->delay * av_q2d(lavc_venc_context->time_base); else @@ -887,9 +896,6 @@ static int encode_frame(struct vf_instance *vf, AVFrame *pic, double pts){ pict_type_char[lavc_venc_context->coded_frame->pict_type] ); } - /* store stats if there are any */ - if(lavc_venc_context->stats_out && stats_file) - fprintf(stats_file, "%s", lavc_venc_context->stats_out); return out_size; } @@ -1036,7 +1042,7 @@ static int vf_open(vf_instance_t *vf, char* args){ vf->priv->pic = avcodec_alloc_frame(); vf->priv->context = avcodec_alloc_context(); - vf->priv->context->codec_type = CODEC_TYPE_VIDEO; + vf->priv->context->codec_type = AVMEDIA_TYPE_VIDEO; vf->priv->context->codec_id = vf->priv->codec->id; return 1; diff --git a/mplayer/libmpcodecs/ve_raw.c b/mplayer/libmpcodecs/ve_raw.c index 23eeb217..37b6cc62 100644 --- a/mplayer/libmpcodecs/ve_raw.c +++ b/mplayer/libmpcodecs/ve_raw.c @@ -129,6 +129,9 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) { if (IMGFMT_IS_RGB(fmt) || IMGFMT_IS_BGR(fmt)) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; switch (fmt) { + case IMGFMT_NV12: + case IMGFMT_NV21: + case IMGFMT_HM12: case IMGFMT_I420: case IMGFMT_IYUV: case IMGFMT_YV12: diff --git a/mplayer/libmpcodecs/vf.c b/mplayer/libmpcodecs/vf.c index dd0ffc7c..30b0bc90 100644 --- a/mplayer/libmpcodecs/vf.c +++ b/mplayer/libmpcodecs/vf.c @@ -228,28 +228,28 @@ const m_obj_list_t vf_obj_list = { void vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h){ int y; if(mpi->flags&MP_IMGFLAG_PLANAR){ - y0&=~1;h+=h&1; - if(x0==0 && w==mpi->width){ - // full width clear: - memset(mpi->planes[0]+mpi->stride[0]*y0,0,mpi->stride[0]*h); - memset(mpi->planes[1]+mpi->stride[1]*(y0>>mpi->chroma_y_shift),128,mpi->stride[1]*(h>>mpi->chroma_y_shift)); - memset(mpi->planes[2]+mpi->stride[2]*(y0>>mpi->chroma_y_shift),128,mpi->stride[2]*(h>>mpi->chroma_y_shift)); - } else - for(y=y0;yplanes[0]+x0+mpi->stride[0]*y,0,w); - memset(mpi->planes[0]+x0+mpi->stride[0]*(y+1),0,w); - memset(mpi->planes[1]+(x0>>mpi->chroma_x_shift)+mpi->stride[1]*(y>>mpi->chroma_y_shift),128,(w>>mpi->chroma_x_shift)); - memset(mpi->planes[2]+(x0>>mpi->chroma_x_shift)+mpi->stride[2]*(y>>mpi->chroma_y_shift),128,(w>>mpi->chroma_x_shift)); - } - return; + y0&=~1;h+=h&1; + if(x0==0 && w==mpi->width){ + // full width clear: + memset(mpi->planes[0]+mpi->stride[0]*y0,0,mpi->stride[0]*h); + memset(mpi->planes[1]+mpi->stride[1]*(y0>>mpi->chroma_y_shift),128,mpi->stride[1]*(h>>mpi->chroma_y_shift)); + memset(mpi->planes[2]+mpi->stride[2]*(y0>>mpi->chroma_y_shift),128,mpi->stride[2]*(h>>mpi->chroma_y_shift)); + } else + for(y=y0;yplanes[0]+x0+mpi->stride[0]*y,0,w); + memset(mpi->planes[0]+x0+mpi->stride[0]*(y+1),0,w); + memset(mpi->planes[1]+(x0>>mpi->chroma_x_shift)+mpi->stride[1]*(y>>mpi->chroma_y_shift),128,(w>>mpi->chroma_x_shift)); + memset(mpi->planes[2]+(x0>>mpi->chroma_x_shift)+mpi->stride[2]*(y>>mpi->chroma_y_shift),128,(w>>mpi->chroma_x_shift)); + } + return; } // packed: for(y=y0;yplanes[0]+mpi->stride[0]*y+(mpi->bpp>>3)*x0; - if(mpi->flags&MP_IMGFLAG_YUV){ - unsigned int* p=(unsigned int*) dst; - int size=(mpi->bpp>>3)*w/4; - int i; + unsigned char* dst=mpi->planes[0]+mpi->stride[0]*y+(mpi->bpp>>3)*x0; + if(mpi->flags&MP_IMGFLAG_YUV){ + unsigned int* p=(unsigned int*) dst; + int size=(mpi->bpp>>3)*w/4; + int i; #if HAVE_BIGENDIAN #define CLEAR_PACKEDYUV_PATTERN 0x00800080 #define CLEAR_PACKEDYUV_PATTERN_SWAPPED 0x80008000 @@ -257,15 +257,15 @@ void vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h){ #define CLEAR_PACKEDYUV_PATTERN 0x80008000 #define CLEAR_PACKEDYUV_PATTERN_SWAPPED 0x00800080 #endif - if(mpi->flags&MP_IMGFLAG_SWAPPED){ - for(i=0;ibpp>>3)*w); + if(mpi->flags&MP_IMGFLAG_SWAPPED){ + for(i=0;ibpp>>3)*w); } } @@ -337,31 +337,31 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, mpi->type=mp_imgtype; mpi->w=vf->w; mpi->h=vf->h; // keep buffer allocation status & color flags only: -// mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_DIRECT); +// mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_DIRECT); mpi->flags&=MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_TYPE_DISPLAYED|MP_IMGFLAGMASK_COLORS; // accept restrictions, draw_slice and palette flags only: mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_RGB_PALETTE); if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; if(mpi->width!=w2 || mpi->height!=h){ -// printf("vf.c: MPI parameters changed! %dx%d -> %dx%d \n", mpi->width,mpi->height,w2,h); - if(mpi->flags&MP_IMGFLAG_ALLOCATED){ - if(mpi->widthheightplanes[0]); - mpi->flags&=~MP_IMGFLAG_ALLOCATED; - mp_msg(MSGT_VFILTER,MSGL_V,"vf.c: have to REALLOCATE buffer memory :(\n"); - } -// } else { - } { - mpi->width=w2; mpi->chroma_width=(w2 + (1<chroma_x_shift) - 1)>>mpi->chroma_x_shift; - mpi->height=h; mpi->chroma_height=(h + (1<chroma_y_shift) - 1)>>mpi->chroma_y_shift; - } +// printf("vf.c: MPI parameters changed! %dx%d -> %dx%d \n", mpi->width,mpi->height,w2,h); + if(mpi->flags&MP_IMGFLAG_ALLOCATED){ + if(mpi->widthheightplanes[0]); + mpi->flags&=~MP_IMGFLAG_ALLOCATED; + mp_msg(MSGT_VFILTER,MSGL_V,"vf.c: have to REALLOCATE buffer memory :(\n"); + } +// } else { + } { + mpi->width=w2; mpi->chroma_width=(w2 + (1<chroma_x_shift) - 1)>>mpi->chroma_x_shift; + mpi->height=h; mpi->chroma_height=(h + (1<chroma_y_shift) - 1)>>mpi->chroma_y_shift; + } } if(!mpi->bpp) mp_image_setfmt(mpi,outfmt); if(!(mpi->flags&MP_IMGFLAG_ALLOCATED) && mpi->type>MP_IMGTYPE_EXPORT){ - // check libvo first! - if(vf->get_image) vf->get_image(vf,mpi); + // check libvo first! + if(vf->get_image) vf->get_image(vf,mpi); if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ // non-direct and not yet allocated image. allocate it! @@ -371,54 +371,54 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, return NULL; } - // check if codec prefer aligned stride: - if(mp_imgflag&MP_IMGFLAG_PREFER_ALIGNED_STRIDE){ - int align=(mpi->flags&MP_IMGFLAG_PLANAR && - mpi->flags&MP_IMGFLAG_YUV) ? - (8<chroma_x_shift)-1 : 15; // -- maybe FIXME - w2=((w+align)&(~align)); - if(mpi->width!=w2){ - // we have to change width... check if we CAN co it: - int flags=vf->query_format(vf,outfmt); // should not fail - if(!(flags&3)) mp_msg(MSGT_DECVIDEO,MSGL_WARN,"??? vf_get_image{vf->query_format(outfmt)} failed!\n"); -// printf("query -> 0x%X \n",flags); - if(flags&VFCAP_ACCEPT_STRIDE){ - mpi->width=w2; - mpi->chroma_width=(w2 + (1<chroma_x_shift) - 1)>>mpi->chroma_x_shift; - } - } - } - - mp_image_alloc_planes(mpi); -// printf("clearing img!\n"); - vf_mpi_clear(mpi,0,0,mpi->width,mpi->height); + // check if codec prefer aligned stride: + if(mp_imgflag&MP_IMGFLAG_PREFER_ALIGNED_STRIDE){ + int align=(mpi->flags&MP_IMGFLAG_PLANAR && + mpi->flags&MP_IMGFLAG_YUV) ? + (8<chroma_x_shift)-1 : 15; // -- maybe FIXME + w2=((w+align)&(~align)); + if(mpi->width!=w2){ + // we have to change width... check if we CAN co it: + int flags=vf->query_format(vf,outfmt); // should not fail + if(!(flags&3)) mp_msg(MSGT_DECVIDEO,MSGL_WARN,"??? vf_get_image{vf->query_format(outfmt)} failed!\n"); +// printf("query -> 0x%X \n",flags); + if(flags&VFCAP_ACCEPT_STRIDE){ + mpi->width=w2; + mpi->chroma_width=(w2 + (1<chroma_x_shift) - 1)>>mpi->chroma_x_shift; + } + } + } + + mp_image_alloc_planes(mpi); +// printf("clearing img!\n"); + vf_mpi_clear(mpi,0,0,mpi->width,mpi->height); } } if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) - if(vf->start_slice) vf->start_slice(vf,mpi); + if(vf->start_slice) vf->start_slice(vf,mpi); if(!(mpi->flags&MP_IMGFLAG_TYPE_DISPLAYED)){ - mp_msg(MSGT_DECVIDEO,MSGL_V,"*** [%s] %s%s mp_image_t, %dx%dx%dbpp %s %s, %d bytes\n", - vf->info->name, - (mpi->type==MP_IMGTYPE_EXPORT)?"Exporting": - ((mpi->flags&MP_IMGFLAG_DIRECT)?"Direct Rendering":"Allocating"), - (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)?" (slices)":"", - mpi->width,mpi->height,mpi->bpp, - (mpi->flags&MP_IMGFLAG_YUV)?"YUV":((mpi->flags&MP_IMGFLAG_SWAPPED)?"BGR":"RGB"), - (mpi->flags&MP_IMGFLAG_PLANAR)?"planar":"packed", - mpi->bpp*mpi->width*mpi->height/8); - mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"(imgfmt: %x, planes: %p,%p,%p strides: %d,%d,%d, chroma: %dx%d, shift: h:%d,v:%d)\n", - mpi->imgfmt, mpi->planes[0], mpi->planes[1], mpi->planes[2], - mpi->stride[0], mpi->stride[1], mpi->stride[2], - mpi->chroma_width, mpi->chroma_height, mpi->chroma_x_shift, mpi->chroma_y_shift); - mpi->flags|=MP_IMGFLAG_TYPE_DISPLAYED; + mp_msg(MSGT_DECVIDEO,MSGL_V,"*** [%s] %s%s mp_image_t, %dx%dx%dbpp %s %s, %d bytes\n", + vf->info->name, + (mpi->type==MP_IMGTYPE_EXPORT)?"Exporting": + ((mpi->flags&MP_IMGFLAG_DIRECT)?"Direct Rendering":"Allocating"), + (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)?" (slices)":"", + mpi->width,mpi->height,mpi->bpp, + (mpi->flags&MP_IMGFLAG_YUV)?"YUV":((mpi->flags&MP_IMGFLAG_SWAPPED)?"BGR":"RGB"), + (mpi->flags&MP_IMGFLAG_PLANAR)?"planar":"packed", + mpi->bpp*mpi->width*mpi->height/8); + mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"(imgfmt: %x, planes: %p,%p,%p strides: %d,%d,%d, chroma: %dx%d, shift: h:%d,v:%d)\n", + mpi->imgfmt, mpi->planes[0], mpi->planes[1], mpi->planes[2], + mpi->stride[0], mpi->stride[1], mpi->stride[2], + mpi->chroma_width, mpi->chroma_height, mpi->chroma_x_shift, mpi->chroma_y_shift); + mpi->flags|=MP_IMGFLAG_TYPE_DISPLAYED; } mpi->qscale = NULL; } mpi->usage_count++; -// printf("\rVF_MPI: %p %p %p %d %d %d \n", -// mpi->planes[0],mpi->planes[1],mpi->planes[2], -// mpi->stride[0],mpi->stride[1],mpi->stride[2]); +// printf("\rVF_MPI: %p %p %p %d %d %d \n", +// mpi->planes[0],mpi->planes[1],mpi->planes[2], +// mpi->stride[0],mpi->stride[1],mpi->stride[2]); return mpi; } @@ -434,11 +434,11 @@ vf_instance_t* vf_open_plugin(const vf_info_t* const* filter_list, vf_instance_t vf_instance_t* vf; int i; for(i=0;;i++){ - if(!filter_list[i]){ - mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_CouldNotFindVideoFilter,name); - return NULL; // no such filter! - } - if(!strcmp(filter_list[i]->name,name)) break; + if(!filter_list[i]){ + mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_CouldNotFindVideoFilter,name); + return NULL; // no such filter! + } + if(!strcmp(filter_list[i]->name,name)) break; } vf=malloc(sizeof(vf_instance_t)); memset(vf,0,sizeof(vf_instance_t)); @@ -455,14 +455,14 @@ vf_instance_t* vf_open_plugin(const vf_info_t* const* filter_list, vf_instance_t void* vf_priv = m_struct_alloc(st); int n; for(n = 0 ; args && args[2*n] ; n++) - m_struct_set(st,vf_priv,args[2*n],args[2*n+1]); + m_struct_set(st,vf_priv,args[2*n],args[2*n+1]); vf->priv = vf_priv; args = NULL; } else // Otherwise we should have the '_oldargs_' if(args && !strcmp(args[0],"_oldargs_")) - args = (char**)args[1]; + args = (char**)args[1]; else - args = NULL; + args = NULL; if(vf->info->vf_open(vf,(char*)args)>0) return vf; // Success! free(vf); mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_CouldNotOpenVideoFilter,name); @@ -480,16 +480,16 @@ vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args char* p = str; p += sprintf(str,"%s",name); for(i = 0 ; args && args[2*i] ; i++) - p += sprintf(p," %s=%s",args[2*i],args[2*i+1]); + p += sprintf(p," %s=%s",args[2*i],args[2*i+1]); mp_msg(MSGT_VFILTER,MSGL_INFO,MSGTR_OpeningVideoFilter "[%s]\n",str); } } else if(strcmp(name,"vo")) { if(args && strcmp(args[0],"_oldargs_") == 0) mp_msg(MSGT_VFILTER,MSGL_INFO,MSGTR_OpeningVideoFilter - "[%s=%s]\n", name,args[1]); + "[%s=%s]\n", name,args[1]); else mp_msg(MSGT_VFILTER,MSGL_INFO,MSGTR_OpeningVideoFilter - "[%s]\n", name); + "[%s]\n", name); } return vf_open_plugin(filter_list,next,name,args); } @@ -522,11 +522,11 @@ unsigned int vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned unsigned int best=0; int ret; if((p=list)) while(*p){ - ret=vf->query_format(vf,*p); - mp_msg(MSGT_VFILTER,MSGL_V,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3); - if(ret&2){ best=*p; break;} // no conversion -> bingo! - if(ret&1 && !best) best=*p; // best with conversion - ++p; + ret=vf->query_format(vf,*p); + mp_msg(MSGT_VFILTER,MSGL_V,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3); + if(ret&2){ best=*p; break;} // no conversion -> bingo! + if(ret&1 && !best) best=*p; // best with conversion + ++p; } if(best) return best; // bingo, they have common csp! // ok, then try with scale: @@ -537,11 +537,11 @@ unsigned int vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned if(preferred && vf->query_format(vf,preferred)) best=preferred; else // try the list again, now with "scaler" : if((p=list)) while(*p){ - ret=vf->query_format(vf,*p); - mp_msg(MSGT_VFILTER,MSGL_V,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3); - if(ret&2){ best=*p; break;} // no conversion -> bingo! - if(ret&1 && !best) best=*p; // best with conversion - ++p; + ret=vf->query_format(vf,*p); + mp_msg(MSGT_VFILTER,MSGL_V,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3); + if(ret&2){ best=*p; break;} // no conversion -> bingo! + if(ret&1 && !best) best=*p; // best with conversion + ++p; } if(best) *vfp=vf; // else uninit vf !FIXME! return best; @@ -552,8 +552,8 @@ void vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src){ dst->fields = src->fields; dst->qscale_type= src->qscale_type; if(dst->width == src->width && dst->height == src->height){ - dst->qstride= src->qstride; - dst->qscale= src->qscale; + dst->qstride= src->qstride; + dst->qscale= src->qscale; } } @@ -570,26 +570,26 @@ void vf_queue_frame(vf_instance_t *vf, int (*func)(vf_instance_t *)) int vf_output_queued_frame(vf_instance_t *vf) { while (1) { - int ret; - vf_instance_t *current; - vf_instance_t *last=NULL; - int (*tmp)(vf_instance_t *); - for (current = vf; current; current = current->next) - if (current->continue_buffered_image) - last = current; - if (!last) - return 0; - tmp = last->continue_buffered_image; - last->continue_buffered_image = NULL; - ret = tmp(last); - if (ret > 0) { - vf->control(vf, VFCTRL_DRAW_OSD, NULL); + int ret; + vf_instance_t *current; + vf_instance_t *last=NULL; + int (*tmp)(vf_instance_t *); + for (current = vf; current; current = current->next) + if (current->continue_buffered_image) + last = current; + if (!last) + return 0; + tmp = last->continue_buffered_image; + last->continue_buffered_image = NULL; + ret = tmp(last); + if (ret > 0) { + vf->control(vf, VFCTRL_DRAW_OSD, NULL); #ifdef CONFIG_ASS - vf->control(vf, VFCTRL_DRAW_EOSD, NULL); + vf->control(vf, VFCTRL_DRAW_EOSD, NULL); #endif - } - if (ret) - return ret; + } + if (ret) + return ret; } } @@ -607,14 +607,14 @@ int vf_output_queued_frame(vf_instance_t *vf) * */ int vf_config_wrapper(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt) { int r; if ((vf->default_caps&VFCAP_CONSTANT) && vf->fmt.have_configured) { if ((vf->fmt.orig_width != width) - || (vf->fmt.orig_height != height) - || (vf->fmt.orig_fmt != outfmt)) { + || (vf->fmt.orig_height != height) + || (vf->fmt.orig_fmt != outfmt)) { mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_ResolutionDoesntMatch); return 0; } @@ -631,31 +631,31 @@ int vf_config_wrapper(struct vf_instance *vf, int vf_next_config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int voflags, unsigned int outfmt){ + unsigned int voflags, unsigned int outfmt){ int miss; int flags=vf->next->query_format(vf->next,outfmt); if(!flags){ - // hmm. colorspace mismatch!!! - // let's insert the 'scale' filter, it does the job for us: - vf_instance_t* vf2; - if(vf->next->info==&vf_info_scale) return 0; // scale->scale - vf2=vf_open_filter(vf->next,"scale",NULL); - if(!vf2) return 0; // shouldn't happen! - vf->next=vf2; - flags=vf->next->query_format(vf->next,outfmt); - if(!flags){ - mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_CannotFindColorspace); - return 0; // FAIL - } + // hmm. colorspace mismatch!!! + // let's insert the 'scale' filter, it does the job for us: + vf_instance_t* vf2; + if(vf->next->info==&vf_info_scale) return 0; // scale->scale + vf2=vf_open_filter(vf->next,"scale",NULL); + if(!vf2) return 0; // shouldn't happen! + vf->next=vf2; + flags=vf->next->query_format(vf->next,outfmt); + if(!flags){ + mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_CannotFindColorspace); + return 0; // FAIL + } } mp_msg(MSGT_VFILTER,MSGL_V,"REQ: flags=0x%X req=0x%X \n",flags,vf->default_reqs); miss=vf->default_reqs - (flags&vf->default_reqs); if(miss&VFCAP_ACCEPT_STRIDE){ - // vf requires stride support but vf->next doesn't support it! - // let's insert the 'expand' filter, it does the job for us: - vf_instance_t* vf2=vf_open_filter(vf->next,"expand",NULL); - if(!vf2) return 0; // shouldn't happen! - vf->next=vf2; + // vf requires stride support but vf->next doesn't support it! + // let's insert the 'expand' filter, it does the job for us: + vf_instance_t* vf2=vf_open_filter(vf->next,"expand",NULL); + if(!vf2) return 0; // shouldn't happen! + vf->next=vf2; } vf->next->w = width; vf->next->h = height; return vf_config_wrapper(vf->next,width,height,d_width,d_height,voflags,outfmt); @@ -685,24 +685,24 @@ int vf_next_put_image(struct vf_instance *vf,mp_image_t *mpi, double pts){ void vf_next_draw_slice(struct vf_instance *vf,unsigned char** src, int * stride,int w, int h, int x, int y){ if (vf->next->draw_slice) { - vf->next->draw_slice(vf->next,src,stride,w,h,x,y); - return; + vf->next->draw_slice(vf->next,src,stride,w,h,x,y); + return; } if (!vf->dmpi) { - mp_msg(MSGT_VFILTER,MSGL_ERR,"draw_slice: dmpi not stored by vf_%s\n", vf->info->name); - return; + mp_msg(MSGT_VFILTER,MSGL_ERR,"draw_slice: dmpi not stored by vf_%s\n", vf->info->name); + return; } if (!(vf->dmpi->flags & MP_IMGFLAG_PLANAR)) { - memcpy_pic(vf->dmpi->planes[0]+y*vf->dmpi->stride[0]+vf->dmpi->bpp/8*x, - src[0], vf->dmpi->bpp/8*w, h, vf->dmpi->stride[0], stride[0]); - return; + memcpy_pic(vf->dmpi->planes[0]+y*vf->dmpi->stride[0]+vf->dmpi->bpp/8*x, + src[0], vf->dmpi->bpp/8*w, h, vf->dmpi->stride[0], stride[0]); + return; } memcpy_pic(vf->dmpi->planes[0]+y*vf->dmpi->stride[0]+x, src[0], - w, h, vf->dmpi->stride[0], stride[0]); + w, h, vf->dmpi->stride[0], stride[0]); memcpy_pic(vf->dmpi->planes[1]+(y>>vf->dmpi->chroma_y_shift)*vf->dmpi->stride[1]+(x>>vf->dmpi->chroma_x_shift), - src[1], w>>vf->dmpi->chroma_x_shift, h>>vf->dmpi->chroma_y_shift, vf->dmpi->stride[1], stride[1]); + src[1], w>>vf->dmpi->chroma_x_shift, h>>vf->dmpi->chroma_y_shift, vf->dmpi->stride[1], stride[1]); memcpy_pic(vf->dmpi->planes[2]+(y>>vf->dmpi->chroma_y_shift)*vf->dmpi->stride[2]+(x>>vf->dmpi->chroma_x_shift), - src[2], w>>vf->dmpi->chroma_x_shift, h>>vf->dmpi->chroma_y_shift, vf->dmpi->stride[2], stride[2]); + src[2], w>>vf->dmpi->chroma_x_shift, h>>vf->dmpi->chroma_y_shift, vf->dmpi->stride[2], stride[2]); } //============================================================================ @@ -737,8 +737,8 @@ void vf_uninit_filter(vf_instance_t* vf){ void vf_uninit_filter_chain(vf_instance_t* vf){ while(vf){ - vf_instance_t* next=vf->next; - vf_uninit_filter(vf); - vf=next; + vf_instance_t* next=vf->next; + vf_uninit_filter(vf); + vf=next; } } diff --git a/mplayer/libmpcodecs/vf.h b/mplayer/libmpcodecs/vf.h index 661b9ddd..ae43bcf0 100644 --- a/mplayer/libmpcodecs/vf.h +++ b/mplayer/libmpcodecs/vf.h @@ -58,7 +58,7 @@ typedef struct vf_instance { // funcs: int (*config)(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt); + unsigned int flags, unsigned int outfmt); int (*control)(struct vf_instance *vf, int request, void* data); int (*query_format)(struct vf_instance *vf, @@ -135,7 +135,7 @@ int vf_output_queued_frame(vf_instance_t *vf); // default wrappers: int vf_next_config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt); + unsigned int flags, unsigned int outfmt); int vf_next_control(struct vf_instance *vf, int request, void* data); void vf_extra_flip(struct vf_instance *vf); int vf_next_query_format(struct vf_instance *vf, unsigned int fmt); @@ -148,8 +148,8 @@ void vf_uninit_filter(vf_instance_t* vf); void vf_uninit_filter_chain(vf_instance_t* vf); int vf_config_wrapper(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt); + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt); static inline int norm_qscale(int qscale, int type) { diff --git a/mplayer/libmpcodecs/vf_2xsai.c b/mplayer/libmpcodecs/vf_2xsai.c index 32968799..aee9386b 100644 --- a/mplayer/libmpcodecs/vf_2xsai.c +++ b/mplayer/libmpcodecs/vf_2xsai.c @@ -46,44 +46,44 @@ static int PixelsPerMask = 2; static int Init_2xSaI(int d) { - int minr = 0, ming = 0, minb = 0; - int i; - -// if (d != 15 && d != 16 && d != 24 && d != 32) -// return -1; - - /* Get lowest color bit */ - for (i = 0; i < 255; i++) { - if (!minr) - minr = makecol(i, 0, 0); - if (!ming) - ming = makecol(0, i, 0); - if (!minb) - minb = makecol(0, 0, i); - } - - colorMask = (makecol_depth(d, 255, 0, 0) - minr) | (makecol_depth(d, 0, 255, 0) - ming) | (makecol_depth(d, 0, 0, 255) - minb); - lowPixelMask = minr | ming | minb; - qcolorMask = (makecol_depth(d, 255, 0, 0) - 3 * minr) | (makecol_depth(d, 0, 255, 0) - 3 * ming) | (makecol_depth(d, 0, 0, 255) - 3 * minb); - qlowpixelMask = (minr * 3) | (ming * 3) | (minb * 3); - redblueMask = makecol_depth(d, 255, 0, 255); - greenMask = makecol_depth(d, 0, 255, 0); - - PixelsPerMask = (d <= 16) ? 2 : 1; - - if (PixelsPerMask == 2) { - colorMask |= (colorMask << 16); - qcolorMask |= (qcolorMask << 16); - lowPixelMask |= (lowPixelMask << 16); - qlowpixelMask |= (qlowpixelMask << 16); - } - -// TRACE("Color Mask: 0x%lX\n", colorMask); -// TRACE("Low Pixel Mask: 0x%lX\n", lowPixelMask); -// TRACE("QColor Mask: 0x%lX\n", qcolorMask); -// TRACE("QLow Pixel Mask: 0x%lX\n", qlowpixelMask); - - return 0; + int minr = 0, ming = 0, minb = 0; + int i; + +// if (d != 15 && d != 16 && d != 24 && d != 32) +// return -1; + + /* Get lowest color bit */ + for (i = 0; i < 255; i++) { + if (!minr) + minr = makecol(i, 0, 0); + if (!ming) + ming = makecol(0, i, 0); + if (!minb) + minb = makecol(0, 0, i); + } + + colorMask = (makecol_depth(d, 255, 0, 0) - minr) | (makecol_depth(d, 0, 255, 0) - ming) | (makecol_depth(d, 0, 0, 255) - minb); + lowPixelMask = minr | ming | minb; + qcolorMask = (makecol_depth(d, 255, 0, 0) - 3 * minr) | (makecol_depth(d, 0, 255, 0) - 3 * ming) | (makecol_depth(d, 0, 0, 255) - 3 * minb); + qlowpixelMask = (minr * 3) | (ming * 3) | (minb * 3); + redblueMask = makecol_depth(d, 255, 0, 255); + greenMask = makecol_depth(d, 0, 255, 0); + + PixelsPerMask = (d <= 16) ? 2 : 1; + + if (PixelsPerMask == 2) { + colorMask |= (colorMask << 16); + qcolorMask |= (qcolorMask << 16); + lowPixelMask |= (lowPixelMask << 16); + qlowpixelMask |= (qlowpixelMask << 16); + } + +// TRACE("Color Mask: 0x%lX\n", colorMask); +// TRACE("Low Pixel Mask: 0x%lX\n", lowPixelMask); +// TRACE("QColor Mask: 0x%lX\n", qcolorMask); +// TRACE("QLow Pixel Mask: 0x%lX\n", qlowpixelMask); + + return 0; } @@ -92,7 +92,7 @@ static int Init_2xSaI(int d) #define INTERPOLATE(A, B) (((A & colorMask) >> 1) + ((B & colorMask) >> 1) + (A & B & lowPixelMask)) #define Q_INTERPOLATE(A, B, C, D) ((A & qcolorMask) >> 2) + ((B & qcolorMask) >> 2) + ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2) \ - + ((((A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask)) >> 2) & qlowpixelMask) + + ((((A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask)) >> 2) & qlowpixelMask) static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, @@ -100,181 +100,181 @@ static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, uint32_t width, uint32_t height, int sbpp) { - unsigned int x, y; - uint32_t color[16]; - unsigned char *src_line[4]; - - /* Point to the first 3 lines. */ - src_line[0] = src; - src_line[1] = src; - src_line[2] = src + src_pitch; - src_line[3] = src + src_pitch * 2; - - x = 0, y = 0; - - if (PixelsPerMask == 2) { - unsigned short *sbp; - sbp = (unsigned short*)src_line[0]; - color[0] = *sbp; color[1] = color[0]; color[2] = color[0]; color[3] = color[0]; - color[4] = color[0]; color[5] = color[0]; color[6] = *(sbp + 1); color[7] = *(sbp + 2); - sbp = (unsigned short*)src_line[2]; - color[8] = *sbp; color[9] = color[8]; color[10] = *(sbp + 1); color[11] = *(sbp + 2); - sbp = (unsigned short*)src_line[3]; - color[12] = *sbp; color[13] = color[12]; color[14] = *(sbp + 1); color[15] = *(sbp + 2); - } - else { - uint32_t *lbp; - lbp = (uint32_t*)src_line[0]; - color[0] = *lbp; color[1] = color[0]; color[2] = color[0]; color[3] = color[0]; - color[4] = color[0]; color[5] = color[0]; color[6] = *(lbp + 1); color[7] = *(lbp + 2); - lbp = (uint32_t*)src_line[2]; - color[8] = *lbp; color[9] = color[8]; color[10] = *(lbp + 1); color[11] = *(lbp + 2); - lbp = (uint32_t*)src_line[3]; - color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2); - } - - for (y = 0; y < height; y++) { - unsigned char *dst_line[2]; - - dst_line[0] = dst + dst_pitch*2*y; - dst_line[1] = dst + dst_pitch*(2*y+1); - - /* Todo: x = width - 2, x = width - 1 */ - - for (x = 0; x < width; x++) { - uint32_t product1a, product1b, product2a, product2b; + unsigned int x, y; + uint32_t color[16]; + unsigned char *src_line[4]; + + /* Point to the first 3 lines. */ + src_line[0] = src; + src_line[1] = src; + src_line[2] = src + src_pitch; + src_line[3] = src + src_pitch * 2; + + x = 0, y = 0; + + if (PixelsPerMask == 2) { + unsigned short *sbp; + sbp = (unsigned short*)src_line[0]; + color[0] = *sbp; color[1] = color[0]; color[2] = color[0]; color[3] = color[0]; + color[4] = color[0]; color[5] = color[0]; color[6] = *(sbp + 1); color[7] = *(sbp + 2); + sbp = (unsigned short*)src_line[2]; + color[8] = *sbp; color[9] = color[8]; color[10] = *(sbp + 1); color[11] = *(sbp + 2); + sbp = (unsigned short*)src_line[3]; + color[12] = *sbp; color[13] = color[12]; color[14] = *(sbp + 1); color[15] = *(sbp + 2); + } + else { + uint32_t *lbp; + lbp = (uint32_t*)src_line[0]; + color[0] = *lbp; color[1] = color[0]; color[2] = color[0]; color[3] = color[0]; + color[4] = color[0]; color[5] = color[0]; color[6] = *(lbp + 1); color[7] = *(lbp + 2); + lbp = (uint32_t*)src_line[2]; + color[8] = *lbp; color[9] = color[8]; color[10] = *(lbp + 1); color[11] = *(lbp + 2); + lbp = (uint32_t*)src_line[3]; + color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2); + } + + for (y = 0; y < height; y++) { + unsigned char *dst_line[2]; + + dst_line[0] = dst + dst_pitch*2*y; + dst_line[1] = dst + dst_pitch*(2*y+1); + + /* Todo: x = width - 2, x = width - 1 */ + + for (x = 0; x < width; x++) { + uint32_t product1a, product1b, product2a, product2b; //--------------------------------------- B0 B1 B2 B3 0 1 2 3 // 4 5* 6 S2 -> 4 5* 6 7 // 1 2 3 S1 8 9 10 11 // A0 A1 A2 A3 12 13 14 15 //-------------------------------------- - if (color[9] == color[6] && color[5] != color[10]) { - product2b = color[9]; - product1b = product2b; - } - else if (color[5] == color[10] && color[9] != color[6]) { - product2b = color[5]; - product1b = product2b; - } - else if (color[5] == color[10] && color[9] == color[6]) { - int r = 0; - - r += GET_RESULT(color[6], color[5], color[8], color[13]); - r += GET_RESULT(color[6], color[5], color[4], color[1]); - r += GET_RESULT(color[6], color[5], color[14], color[11]); - r += GET_RESULT(color[6], color[5], color[2], color[7]); - - if (r > 0) - product1b = color[6]; - else if (r < 0) - product1b = color[5]; - else - product1b = INTERPOLATE(color[5], color[6]); - - product2b = product1b; - - } - else { - if (color[6] == color[10] && color[10] == color[13] && color[9] != color[14] && color[10] != color[12]) - product2b = Q_INTERPOLATE(color[10], color[10], color[10], color[9]); - else if (color[5] == color[9] && color[9] == color[14] && color[13] != color[10] && color[9] != color[15]) - product2b = Q_INTERPOLATE(color[9], color[9], color[9], color[10]); - else - product2b = INTERPOLATE(color[9], color[10]); - - if (color[6] == color[10] && color[6] == color[1] && color[5] != color[2] && color[6] != color[0]) - product1b = Q_INTERPOLATE(color[6], color[6], color[6], color[5]); - else if (color[5] == color[9] && color[5] == color[2] && color[1] != color[6] && color[5] != color[3]) - product1b = Q_INTERPOLATE(color[6], color[5], color[5], color[5]); - else - product1b = INTERPOLATE(color[5], color[6]); - } - - if (color[5] == color[10] && color[9] != color[6] && color[4] == color[5] && color[5] != color[14]) - product2a = INTERPOLATE(color[9], color[5]); - else if (color[5] == color[8] && color[6] == color[5] && color[4] != color[9] && color[5] != color[12]) - product2a = INTERPOLATE(color[9], color[5]); - else - product2a = color[9]; - - if (color[9] == color[6] && color[5] != color[10] && color[8] == color[9] && color[9] != color[2]) - product1a = INTERPOLATE(color[9], color[5]); - else if (color[4] == color[9] && color[10] == color[9] && color[8] != color[5] && color[9] != color[0]) - product1a = INTERPOLATE(color[9], color[5]); - else - product1a = color[5]; - - if (PixelsPerMask == 2) { - *((uint32_t *) (&dst_line[0][x * 4])) = product1a | (product1b << 16); - *((uint32_t *) (&dst_line[1][x * 4])) = product2a | (product2b << 16); - } - else { - *((uint32_t *) (&dst_line[0][x * 8])) = product1a; - *((uint32_t *) (&dst_line[0][x * 8 + 4])) = product1b; - *((uint32_t *) (&dst_line[1][x * 8])) = product2a; - *((uint32_t *) (&dst_line[1][x * 8 + 4])) = product2b; - } - - /* Move color matrix forward */ - color[0] = color[1]; color[4] = color[5]; color[8] = color[9]; color[12] = color[13]; - color[1] = color[2]; color[5] = color[6]; color[9] = color[10]; color[13] = color[14]; - color[2] = color[3]; color[6] = color[7]; color[10] = color[11]; color[14] = color[15]; - - if (x < width - 3) { - x += 3; - if (PixelsPerMask == 2) { - color[3] = *(((unsigned short*)src_line[0]) + x); - color[7] = *(((unsigned short*)src_line[1]) + x); - color[11] = *(((unsigned short*)src_line[2]) + x); - color[15] = *(((unsigned short*)src_line[3]) + x); - } - else { - color[3] = *(((uint32_t*)src_line[0]) + x); - color[7] = *(((uint32_t*)src_line[1]) + x); - color[11] = *(((uint32_t*)src_line[2]) + x); - color[15] = *(((uint32_t*)src_line[3]) + x); - } - x -= 3; - } - } - - /* We're done with one line, so we shift the source lines up */ - src_line[0] = src_line[1]; - src_line[1] = src_line[2]; - src_line[2] = src_line[3]; - - /* Read next line */ - if (y + 3 >= height) - src_line[3] = src_line[2]; - else - src_line[3] = src_line[2] + src_pitch; - - /* Then shift the color matrix up */ - if (PixelsPerMask == 2) { - unsigned short *sbp; - sbp = (unsigned short*)src_line[0]; - color[0] = *sbp; color[1] = color[0]; color[2] = *(sbp + 1); color[3] = *(sbp + 2); - sbp = (unsigned short*)src_line[1]; - color[4] = *sbp; color[5] = color[4]; color[6] = *(sbp + 1); color[7] = *(sbp + 2); - sbp = (unsigned short*)src_line[2]; - color[8] = *sbp; color[9] = color[9]; color[10] = *(sbp + 1); color[11] = *(sbp + 2); - sbp = (unsigned short*)src_line[3]; - color[12] = *sbp; color[13] = color[12]; color[14] = *(sbp + 1); color[15] = *(sbp + 2); - } - else { - uint32_t *lbp; - lbp = (uint32_t*)src_line[0]; - color[0] = *lbp; color[1] = color[0]; color[2] = *(lbp + 1); color[3] = *(lbp + 2); - lbp = (uint32_t*)src_line[1]; - color[4] = *lbp; color[5] = color[4]; color[6] = *(lbp + 1); color[7] = *(lbp + 2); - lbp = (uint32_t*)src_line[2]; - color[8] = *lbp; color[9] = color[9]; color[10] = *(lbp + 1); color[11] = *(lbp + 2); - lbp = (uint32_t*)src_line[3]; - color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2); - } - - } // y loop + if (color[9] == color[6] && color[5] != color[10]) { + product2b = color[9]; + product1b = product2b; + } + else if (color[5] == color[10] && color[9] != color[6]) { + product2b = color[5]; + product1b = product2b; + } + else if (color[5] == color[10] && color[9] == color[6]) { + int r = 0; + + r += GET_RESULT(color[6], color[5], color[8], color[13]); + r += GET_RESULT(color[6], color[5], color[4], color[1]); + r += GET_RESULT(color[6], color[5], color[14], color[11]); + r += GET_RESULT(color[6], color[5], color[2], color[7]); + + if (r > 0) + product1b = color[6]; + else if (r < 0) + product1b = color[5]; + else + product1b = INTERPOLATE(color[5], color[6]); + + product2b = product1b; + + } + else { + if (color[6] == color[10] && color[10] == color[13] && color[9] != color[14] && color[10] != color[12]) + product2b = Q_INTERPOLATE(color[10], color[10], color[10], color[9]); + else if (color[5] == color[9] && color[9] == color[14] && color[13] != color[10] && color[9] != color[15]) + product2b = Q_INTERPOLATE(color[9], color[9], color[9], color[10]); + else + product2b = INTERPOLATE(color[9], color[10]); + + if (color[6] == color[10] && color[6] == color[1] && color[5] != color[2] && color[6] != color[0]) + product1b = Q_INTERPOLATE(color[6], color[6], color[6], color[5]); + else if (color[5] == color[9] && color[5] == color[2] && color[1] != color[6] && color[5] != color[3]) + product1b = Q_INTERPOLATE(color[6], color[5], color[5], color[5]); + else + product1b = INTERPOLATE(color[5], color[6]); + } + + if (color[5] == color[10] && color[9] != color[6] && color[4] == color[5] && color[5] != color[14]) + product2a = INTERPOLATE(color[9], color[5]); + else if (color[5] == color[8] && color[6] == color[5] && color[4] != color[9] && color[5] != color[12]) + product2a = INTERPOLATE(color[9], color[5]); + else + product2a = color[9]; + + if (color[9] == color[6] && color[5] != color[10] && color[8] == color[9] && color[9] != color[2]) + product1a = INTERPOLATE(color[9], color[5]); + else if (color[4] == color[9] && color[10] == color[9] && color[8] != color[5] && color[9] != color[0]) + product1a = INTERPOLATE(color[9], color[5]); + else + product1a = color[5]; + + if (PixelsPerMask == 2) { + *((uint32_t *) (&dst_line[0][x * 4])) = product1a | (product1b << 16); + *((uint32_t *) (&dst_line[1][x * 4])) = product2a | (product2b << 16); + } + else { + *((uint32_t *) (&dst_line[0][x * 8])) = product1a; + *((uint32_t *) (&dst_line[0][x * 8 + 4])) = product1b; + *((uint32_t *) (&dst_line[1][x * 8])) = product2a; + *((uint32_t *) (&dst_line[1][x * 8 + 4])) = product2b; + } + + /* Move color matrix forward */ + color[0] = color[1]; color[4] = color[5]; color[8] = color[9]; color[12] = color[13]; + color[1] = color[2]; color[5] = color[6]; color[9] = color[10]; color[13] = color[14]; + color[2] = color[3]; color[6] = color[7]; color[10] = color[11]; color[14] = color[15]; + + if (x < width - 3) { + x += 3; + if (PixelsPerMask == 2) { + color[3] = *(((unsigned short*)src_line[0]) + x); + color[7] = *(((unsigned short*)src_line[1]) + x); + color[11] = *(((unsigned short*)src_line[2]) + x); + color[15] = *(((unsigned short*)src_line[3]) + x); + } + else { + color[3] = *(((uint32_t*)src_line[0]) + x); + color[7] = *(((uint32_t*)src_line[1]) + x); + color[11] = *(((uint32_t*)src_line[2]) + x); + color[15] = *(((uint32_t*)src_line[3]) + x); + } + x -= 3; + } + } + + /* We're done with one line, so we shift the source lines up */ + src_line[0] = src_line[1]; + src_line[1] = src_line[2]; + src_line[2] = src_line[3]; + + /* Read next line */ + if (y + 3 >= height) + src_line[3] = src_line[2]; + else + src_line[3] = src_line[2] + src_pitch; + + /* Then shift the color matrix up */ + if (PixelsPerMask == 2) { + unsigned short *sbp; + sbp = (unsigned short*)src_line[0]; + color[0] = *sbp; color[1] = color[0]; color[2] = *(sbp + 1); color[3] = *(sbp + 2); + sbp = (unsigned short*)src_line[1]; + color[4] = *sbp; color[5] = color[4]; color[6] = *(sbp + 1); color[7] = *(sbp + 2); + sbp = (unsigned short*)src_line[2]; + color[8] = *sbp; color[9] = color[9]; color[10] = *(sbp + 1); color[11] = *(sbp + 2); + sbp = (unsigned short*)src_line[3]; + color[12] = *sbp; color[13] = color[12]; color[14] = *(sbp + 1); color[15] = *(sbp + 2); + } + else { + uint32_t *lbp; + lbp = (uint32_t*)src_line[0]; + color[0] = *lbp; color[1] = color[0]; color[2] = *(lbp + 1); color[3] = *(lbp + 2); + lbp = (uint32_t*)src_line[1]; + color[4] = *lbp; color[5] = color[4]; color[6] = *(lbp + 1); color[7] = *(lbp + 2); + lbp = (uint32_t*)src_line[2]; + color[8] = *lbp; color[9] = color[9]; color[10] = *(lbp + 1); color[11] = *(lbp + 2); + lbp = (uint32_t*)src_line[3]; + color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2); + } + + } // y loop } @@ -283,7 +283,7 @@ static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch, static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ Init_2xSaI(outfmt&255); @@ -295,12 +295,12 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ // hope we'll get DR buffer: dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - 2*mpi->w, 2*mpi->h); + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + 2*mpi->w, 2*mpi->h); Super2xSaI_ex(mpi->planes[0], mpi->stride[0], - dmpi->planes[0], dmpi->stride[0], - mpi->w, mpi->h, mpi->bpp/8); + dmpi->planes[0], dmpi->stride[0], + mpi->w, mpi->h, mpi->bpp/8); return vf_next_put_image(vf,dmpi, pts); } @@ -312,7 +312,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){ // case IMGFMT_BGR15: // case IMGFMT_BGR16: case IMGFMT_BGR32: - return vf_next_query_format(vf,fmt); + return vf_next_query_format(vf,fmt); } return 0; } diff --git a/mplayer/libmpcodecs/vf_blackframe.c b/mplayer/libmpcodecs/vf_blackframe.c index 244da01b..c72552c9 100644 --- a/mplayer/libmpcodecs/vf_blackframe.c +++ b/mplayer/libmpcodecs/vf_blackframe.c @@ -79,10 +79,10 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ static const char *const picttypes[4] = { "unknown", "I", "P", "B" }; for (y=1; y<=h; y++) { - for (x=0; xpriv->lastkeyframe = vf->priv->frame; if (pblack >= bamount) - mp_msg(MSGT_VFILTER, MSGL_INFO,"vf_blackframe: %u, %i%%, %s (I:%u)\n", + mp_msg(MSGT_VFILTER, MSGL_INFO,"vf_blackframe: %u, %i%%, %s (I:%u)\n", vf->priv->frame, pblack, picttypes[pict_type], vf->priv->lastkeyframe); @@ -134,7 +134,7 @@ static int vf_open(vf_instance_t *vf, char *args){ vf->priv->lastkeyframe = 0; if (args) - sscanf(args, "%u:%u", &vf->priv->bamount, &vf->priv->bthresh); + sscanf(args, "%u:%u", &vf->priv->bamount, &vf->priv->bthresh); return 1; } diff --git a/mplayer/libmpcodecs/vf_boxblur.c b/mplayer/libmpcodecs/vf_boxblur.c index f10f77e0..050b8941 100644 --- a/mplayer/libmpcodecs/vf_boxblur.c +++ b/mplayer/libmpcodecs/vf_boxblur.c @@ -33,13 +33,13 @@ //===========================================================================// typedef struct FilterParam{ - int radius; - int power; + int radius; + int power; }FilterParam; struct vf_priv_s { - FilterParam lumaParam; - FilterParam chromaParam; + FilterParam lumaParam; + FilterParam chromaParam; }; @@ -48,158 +48,158 @@ struct vf_priv_s { static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static inline void blur(uint8_t *dst, uint8_t *src, int w, int radius, int dstStep, int srcStep){ - int x; - const int length= radius*2 + 1; - const int inv= ((1<<16) + length/2)/length; - - int sum= 0; - - for(x=0; x>16; - } - - for(; x>16; - } - - for(; x>16; - } + int x; + const int length= radius*2 + 1; + const int inv= ((1<<16) + length/2)/length; + + int sum= 0; + + for(x=0; x>16; + } + + for(; x>16; + } + + for(; x>16; + } } static inline void blur2(uint8_t *dst, uint8_t *src, int w, int radius, int power, int dstStep, int srcStep){ - uint8_t temp[2][4096]; - uint8_t *a= temp[0], *b=temp[1]; - - if(radius){ - blur(a, src, w, radius, 1, srcStep); - for(; power>2; power--){ - uint8_t *c; - blur(b, a, w, radius, 1, 1); - c=a; a=b; b=c; - } - if(power>1) - blur(dst, a, w, radius, dstStep, 1); - else{ - int i; - for(i=0; i2; power--){ + uint8_t *c; + blur(b, a, w, radius, 1, 1); + c=a; a=b; b=c; + } + if(power>1) + blur(dst, a, w, radius, dstStep, 1); + else{ + int i; + for(i=0; iw >> mpi->chroma_x_shift; - int ch= mpi->h >> mpi->chroma_y_shift; - - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_READABLE, - mpi->w,mpi->h); - - assert(mpi->flags&MP_IMGFLAG_PLANAR); - - hBlur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, - dmpi->stride[0], mpi->stride[0], vf->priv->lumaParam.radius, vf->priv->lumaParam.power); - hBlur(dmpi->planes[1], mpi->planes[1], cw,ch, - dmpi->stride[1], mpi->stride[1], vf->priv->chromaParam.radius, vf->priv->chromaParam.power); - hBlur(dmpi->planes[2], mpi->planes[2], cw,ch, - dmpi->stride[2], mpi->stride[2], vf->priv->chromaParam.radius, vf->priv->chromaParam.power); - - vBlur(dmpi->planes[0], dmpi->planes[0], mpi->w,mpi->h, - dmpi->stride[0], dmpi->stride[0], vf->priv->lumaParam.radius, vf->priv->lumaParam.power); - vBlur(dmpi->planes[1], dmpi->planes[1], cw,ch, - dmpi->stride[1], dmpi->stride[1], vf->priv->chromaParam.radius, vf->priv->chromaParam.power); - vBlur(dmpi->planes[2], dmpi->planes[2], cw,ch, - dmpi->stride[2], dmpi->stride[2], vf->priv->chromaParam.radius, vf->priv->chromaParam.power); - - return vf_next_put_image(vf,dmpi, pts); + int cw= mpi->w >> mpi->chroma_x_shift; + int ch= mpi->h >> mpi->chroma_y_shift; + + mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_READABLE, + mpi->w,mpi->h); + + assert(mpi->flags&MP_IMGFLAG_PLANAR); + + hBlur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, + dmpi->stride[0], mpi->stride[0], vf->priv->lumaParam.radius, vf->priv->lumaParam.power); + hBlur(dmpi->planes[1], mpi->planes[1], cw,ch, + dmpi->stride[1], mpi->stride[1], vf->priv->chromaParam.radius, vf->priv->chromaParam.power); + hBlur(dmpi->planes[2], mpi->planes[2], cw,ch, + dmpi->stride[2], mpi->stride[2], vf->priv->chromaParam.radius, vf->priv->chromaParam.power); + + vBlur(dmpi->planes[0], dmpi->planes[0], mpi->w,mpi->h, + dmpi->stride[0], dmpi->stride[0], vf->priv->lumaParam.radius, vf->priv->lumaParam.power); + vBlur(dmpi->planes[1], dmpi->planes[1], cw,ch, + dmpi->stride[1], dmpi->stride[1], vf->priv->chromaParam.radius, vf->priv->chromaParam.power); + vBlur(dmpi->planes[2], dmpi->planes[2], cw,ch, + dmpi->stride[2], dmpi->stride[2], vf->priv->chromaParam.radius, vf->priv->chromaParam.power); + + return vf_next_put_image(vf,dmpi, pts); } //===========================================================================// static int query_format(struct vf_instance *vf, unsigned int fmt){ - switch(fmt) - { - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_YVU9: - case IMGFMT_444P: - case IMGFMT_422P: - case IMGFMT_411P: - return vf_next_query_format(vf, fmt); - } - return 0; + switch(fmt) + { + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YVU9: + case IMGFMT_444P: + case IMGFMT_422P: + case IMGFMT_411P: + return vf_next_query_format(vf, fmt); + } + return 0; } static int vf_open(vf_instance_t *vf, char *args){ - int e; - - vf->config=config; - vf->put_image=put_image; -// vf->get_image=get_image; - vf->query_format=query_format; - vf->priv=malloc(sizeof(struct vf_priv_s)); - memset(vf->priv, 0, sizeof(struct vf_priv_s)); - - if(args==NULL) return 0; - - e=sscanf(args, "%d:%d:%d:%d", - &vf->priv->lumaParam.radius, - &vf->priv->lumaParam.power, - &vf->priv->chromaParam.radius, - &vf->priv->chromaParam.power - ); - - if(e==2){ - vf->priv->chromaParam.radius= vf->priv->lumaParam.radius; - vf->priv->chromaParam.power = vf->priv->lumaParam.power; - }else if(e!=4) - return 0; - - if(vf->priv->lumaParam.radius < 0) return 0; - if(vf->priv->chromaParam.radius < 0) return 0; - - return 1; + int e; + + vf->config=config; + vf->put_image=put_image; +// vf->get_image=get_image; + vf->query_format=query_format; + vf->priv=malloc(sizeof(struct vf_priv_s)); + memset(vf->priv, 0, sizeof(struct vf_priv_s)); + + if(args==NULL) return 0; + + e=sscanf(args, "%d:%d:%d:%d", + &vf->priv->lumaParam.radius, + &vf->priv->lumaParam.power, + &vf->priv->chromaParam.radius, + &vf->priv->chromaParam.power + ); + + if(e==2){ + vf->priv->chromaParam.radius= vf->priv->lumaParam.radius; + vf->priv->chromaParam.power = vf->priv->lumaParam.power; + }else if(e!=4) + return 0; + + if(vf->priv->lumaParam.radius < 0) return 0; + if(vf->priv->chromaParam.radius < 0) return 0; + + return 1; } const vf_info_t vf_info_boxblur = { diff --git a/mplayer/libmpcodecs/vf_cropdetect.c b/mplayer/libmpcodecs/vf_cropdetect.c index 59ec7d1e..6e7eb9be 100644 --- a/mplayer/libmpcodecs/vf_cropdetect.c +++ b/mplayer/libmpcodecs/vf_cropdetect.c @@ -42,17 +42,17 @@ static int checkline(unsigned char* src,int stride,int len,int bpp){ int div=len; switch(bpp){ case 1: - while(--len>=0){ - total+=src[0]; src+=stride; - } - break; + while(--len>=0){ + total+=src[0]; src+=stride; + } + break; case 3: case 4: - while(--len>=0){ - total+=src[0]+src[1]+src[2]; src+=stride; - } - div*=3; - break; + while(--len>=0){ + total+=src[0]+src[1]+src[2]; src+=stride; + } + div*=3; + break; } total/=div; // printf("total=%d\n",total); @@ -63,7 +63,7 @@ static int checkline(unsigned char* src,int stride,int len,int bpp){ static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ vf->priv->x1=width - 1; vf->priv->y1=height - 1; vf->priv->x2=0; @@ -79,8 +79,8 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ // hope we'll get DR buffer: dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_EXPORT, 0, - mpi->w, mpi->h); + MP_IMGTYPE_EXPORT, 0, + mpi->w, mpi->h); dmpi->planes[0]=mpi->planes[0]; dmpi->planes[1]=mpi->planes[1]; @@ -91,43 +91,43 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ dmpi->width=mpi->width; dmpi->height=mpi->height; -if(++vf->priv->fno>0){ // ignore first 2 frames - they may be empty +if(++vf->priv->fno>0){ // ignore first 2 frames - they may be empty // Reset the crop area every reset_count frames, if reset_count is > 0 if(vf->priv->reset_count > 0 && vf->priv->fno > vf->priv->reset_count){ - vf->priv->x1=mpi->w-1; - vf->priv->y1=mpi->h-1; - vf->priv->x2=0; - vf->priv->y2=0; - vf->priv->fno=1; + vf->priv->x1=mpi->w-1; + vf->priv->y1=mpi->h-1; + vf->priv->x2=0; + vf->priv->y2=0; + vf->priv->fno=1; } for(y=0;ypriv->y1;y++){ - if(checkline(mpi->planes[0]+mpi->stride[0]*y,bpp,mpi->w,bpp)>vf->priv->limit){ - vf->priv->y1=y; - break; - } + if(checkline(mpi->planes[0]+mpi->stride[0]*y,bpp,mpi->w,bpp)>vf->priv->limit){ + vf->priv->y1=y; + break; + } } for(y=mpi->h-1;y>vf->priv->y2;y--){ - if(checkline(mpi->planes[0]+mpi->stride[0]*y,bpp,mpi->w,bpp)>vf->priv->limit){ - vf->priv->y2=y; - break; - } + if(checkline(mpi->planes[0]+mpi->stride[0]*y,bpp,mpi->w,bpp)>vf->priv->limit){ + vf->priv->y2=y; + break; + } } for(y=0;ypriv->x1;y++){ - if(checkline(mpi->planes[0]+bpp*y,mpi->stride[0],mpi->h,bpp)>vf->priv->limit){ - vf->priv->x1=y; - break; - } + if(checkline(mpi->planes[0]+bpp*y,mpi->stride[0],mpi->h,bpp)>vf->priv->limit){ + vf->priv->x1=y; + break; + } } for(y=mpi->w-1;y>vf->priv->x2;y--){ - if(checkline(mpi->planes[0]+bpp*y,mpi->stride[0],mpi->h,bpp)>vf->priv->limit){ - vf->priv->x2=y; - break; - } + if(checkline(mpi->planes[0]+bpp*y,mpi->stride[0],mpi->h,bpp)>vf->priv->limit){ + vf->priv->x2=y; + break; + } } // round x and y (up), important for yuv colorspaces @@ -154,9 +154,9 @@ if(++vf->priv->fno>0){ // ignore first 2 frames - they may be empty y += (shrink_by / 2 + 1) & ~1; mp_msg(MSGT_VFILTER, MSGL_INFO, MSGTR_MPCODECS_CropArea, - vf->priv->x1,vf->priv->x2, - vf->priv->y1,vf->priv->y2, - w,h,x,y); + vf->priv->x1,vf->priv->x2, + vf->priv->y1,vf->priv->y2, + w,h,x,y); } diff --git a/mplayer/libmpcodecs/vf_decimate.c b/mplayer/libmpcodecs/vf_decimate.c index 2775ed8e..bc40e270 100644 --- a/mplayer/libmpcodecs/vf_decimate.c +++ b/mplayer/libmpcodecs/vf_decimate.c @@ -32,160 +32,160 @@ struct vf_priv_s { - int hi, lo; - float frac; - int max, last, cnt; + int hi, lo; + float frac; + int max, last, cnt; }; #if HAVE_MMX && HAVE_EBX_AVAILABLE static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns) { - volatile short out[4]; - __asm__ ( - "movl $8, %%ecx \n\t" - "pxor %%mm4, %%mm4 \n\t" - "pxor %%mm7, %%mm7 \n\t" - - ASMALIGN(4) - "1: \n\t" - - "movq (%%"REG_S"), %%mm0 \n\t" - "movq (%%"REG_S"), %%mm2 \n\t" - "add %%"REG_a", %%"REG_S" \n\t" - "movq (%%"REG_D"), %%mm1 \n\t" - "add %%"REG_b", %%"REG_D" \n\t" - "psubusb %%mm1, %%mm2 \n\t" - "psubusb %%mm0, %%mm1 \n\t" - "movq %%mm2, %%mm0 \n\t" - "movq %%mm1, %%mm3 \n\t" - "punpcklbw %%mm7, %%mm0 \n\t" - "punpcklbw %%mm7, %%mm1 \n\t" - "punpckhbw %%mm7, %%mm2 \n\t" - "punpckhbw %%mm7, %%mm3 \n\t" - "paddw %%mm0, %%mm4 \n\t" - "paddw %%mm1, %%mm4 \n\t" - "paddw %%mm2, %%mm4 \n\t" - "paddw %%mm3, %%mm4 \n\t" - - "decl %%ecx \n\t" - "jnz 1b \n\t" - "movq %%mm4, (%%"REG_d") \n\t" - "emms \n\t" - : - : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out) - : "%ecx", "memory" - ); - return out[0]+out[1]+out[2]+out[3]; + volatile short out[4]; + __asm__ ( + "movl $8, %%ecx \n\t" + "pxor %%mm4, %%mm4 \n\t" + "pxor %%mm7, %%mm7 \n\t" + + ASMALIGN(4) + "1: \n\t" + + "movq (%%"REG_S"), %%mm0 \n\t" + "movq (%%"REG_S"), %%mm2 \n\t" + "add %%"REG_a", %%"REG_S" \n\t" + "movq (%%"REG_D"), %%mm1 \n\t" + "add %%"REG_b", %%"REG_D" \n\t" + "psubusb %%mm1, %%mm2 \n\t" + "psubusb %%mm0, %%mm1 \n\t" + "movq %%mm2, %%mm0 \n\t" + "movq %%mm1, %%mm3 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "punpckhbw %%mm7, %%mm3 \n\t" + "paddw %%mm0, %%mm4 \n\t" + "paddw %%mm1, %%mm4 \n\t" + "paddw %%mm2, %%mm4 \n\t" + "paddw %%mm3, %%mm4 \n\t" + + "decl %%ecx \n\t" + "jnz 1b \n\t" + "movq %%mm4, (%%"REG_d") \n\t" + "emms \n\t" + : + : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out) + : "%ecx", "memory" + ); + return out[0]+out[1]+out[2]+out[3]; } #endif static int diff_C(unsigned char *old, unsigned char *new, int os, int ns) { - int x, y, d=0; - for (y = 8; y; y--) { - for (x = 8; x; x--) { - d += abs(new[x] - old[x]); - } - new += ns; - old += os; - } - return d; + int x, y, d=0; + for (y = 8; y; y--) { + for (x = 8; x; x--) { + d += abs(new[x] - old[x]); + } + new += ns; + old += os; + } + return d; } static int (*diff)(unsigned char *, unsigned char *, int, int); static int diff_to_drop_plane(int hi, int lo, float frac, unsigned char *old, unsigned char *new, int w, int h, int os, int ns) { - int x, y; - int d, c=0; - int t = (w/16)*(h/16)*frac; - for (y = 0; y < h-7; y += 4) { - for (x = 8; x < w-7; x += 4) { - d = diff(old+x+y*os, new+x+y*ns, os, ns); - if (d > hi) return 0; - if (d > lo) { - c++; - if (c > t) return 0; - } - } - } - return 1; + int x, y; + int d, c=0; + int t = (w/16)*(h/16)*frac; + for (y = 0; y < h-7; y += 4) { + for (x = 8; x < w-7; x += 4) { + d = diff(old+x+y*os, new+x+y*ns, os, ns); + if (d > hi) return 0; + if (d > lo) { + c++; + if (c > t) return 0; + } + } + } + return 1; } static int diff_to_drop(int hi, int lo, float frac, mp_image_t *old, mp_image_t *new) { - if (new->flags & MP_IMGFLAG_PLANAR) { - return diff_to_drop_plane(hi,lo,frac, old->planes[0], new->planes[0], - new->w, new->h, old->stride[0], new->stride[0]) - && diff_to_drop_plane(hi,lo,frac, old->planes[1], new->planes[1], - new->chroma_width, new->chroma_height, - old->stride[1], new->stride[1]) - && diff_to_drop_plane(hi,lo,frac, old->planes[2], new->planes[2], - new->chroma_width, new->chroma_height, - old->stride[2], new->stride[2]); - } - return diff_to_drop_plane(hi,lo,frac, old->planes[0], new->planes[0], - new->w*(new->bpp/8), new->h, old->stride[0], new->stride[0]); + if (new->flags & MP_IMGFLAG_PLANAR) { + return diff_to_drop_plane(hi,lo,frac, old->planes[0], new->planes[0], + new->w, new->h, old->stride[0], new->stride[0]) + && diff_to_drop_plane(hi,lo,frac, old->planes[1], new->planes[1], + new->chroma_width, new->chroma_height, + old->stride[1], new->stride[1]) + && diff_to_drop_plane(hi,lo,frac, old->planes[2], new->planes[2], + new->chroma_width, new->chroma_height, + old->stride[2], new->stride[2]); + } + return diff_to_drop_plane(hi,lo,frac, old->planes[0], new->planes[0], + new->w*(new->bpp/8), new->h, old->stride[0], new->stride[0]); } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { - mp_image_t *dmpi; - - dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | - MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, - mpi->width, mpi->height); - dmpi->qscale = mpi->qscale; - dmpi->qstride = mpi->qstride; - dmpi->qscale_type = mpi->qscale_type; - - if (diff_to_drop(vf->priv->hi, vf->priv->lo, vf->priv->frac, dmpi, mpi)) { - if (vf->priv->max == 0) - return 0; - else if ((vf->priv->max > 0) && (vf->priv->cnt++ < vf->priv->max)) - return 0; - else if ((vf->priv->max < 0) && (vf->priv->last+1 >= -vf->priv->max)) - return vf->priv->last=0; - } - vf->priv->last++; - vf->priv->cnt=0; - - memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0], mpi->stride[0]); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - memcpy_pic(dmpi->planes[1], mpi->planes[1], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[1], mpi->stride[1]); - memcpy_pic(dmpi->planes[2], mpi->planes[2], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[2], mpi->stride[2]); - } - return vf_next_put_image(vf, dmpi, pts); + mp_image_t *dmpi; + + dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | + MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, + mpi->width, mpi->height); + dmpi->qscale = mpi->qscale; + dmpi->qstride = mpi->qstride; + dmpi->qscale_type = mpi->qscale_type; + + if (diff_to_drop(vf->priv->hi, vf->priv->lo, vf->priv->frac, dmpi, mpi)) { + if (vf->priv->max == 0) + return 0; + else if ((vf->priv->max > 0) && (vf->priv->cnt++ < vf->priv->max)) + return 0; + else if ((vf->priv->max < 0) && (vf->priv->last+1 >= -vf->priv->max)) + return vf->priv->last=0; + } + vf->priv->last++; + vf->priv->cnt=0; + + memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, + dmpi->stride[0], mpi->stride[0]); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + memcpy_pic(dmpi->planes[1], mpi->planes[1], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[1], mpi->stride[1]); + memcpy_pic(dmpi->planes[2], mpi->planes[2], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[2], mpi->stride[2]); + } + return vf_next_put_image(vf, dmpi, pts); } static void uninit(struct vf_instance *vf) { - free(vf->priv); + free(vf->priv); } static int vf_open(vf_instance_t *vf, char *args) { - struct vf_priv_s *p; - vf->put_image = put_image; - vf->uninit = uninit; - vf->default_reqs = VFCAP_ACCEPT_STRIDE; - vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); - p->max = 0; - p->hi = 64*12; - p->lo = 64*5; - p->frac = 0.33; - if (args) sscanf(args, "%d:%d:%d:%f", &p->max, &p->hi, &p->lo, &p->frac); - diff = diff_C; + struct vf_priv_s *p; + vf->put_image = put_image; + vf->uninit = uninit; + vf->default_reqs = VFCAP_ACCEPT_STRIDE; + vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); + p->max = 0; + p->hi = 64*12; + p->lo = 64*5; + p->frac = 0.33; + if (args) sscanf(args, "%d:%d:%d:%f", &p->max, &p->hi, &p->lo, &p->frac); + diff = diff_C; #if HAVE_MMX && HAVE_EBX_AVAILABLE - if(gCpuCaps.hasMMX) diff = diff_MMX; + if(gCpuCaps.hasMMX) diff = diff_MMX; #endif - return 1; + return 1; } const vf_info_t vf_info_decimate = { diff --git a/mplayer/libmpcodecs/vf_delogo.c b/mplayer/libmpcodecs/vf_delogo.c index 9ba9c439..a6ede90d 100644 --- a/mplayer/libmpcodecs/vf_delogo.c +++ b/mplayer/libmpcodecs/vf_delogo.c @@ -50,7 +50,7 @@ static struct vf_priv_s { #define MAX(a,b) (((a) > (b)) ? (a) : (b)) static void delogo(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int width, int height, - int logo_x, int logo_y, int logo_w, int logo_h, int band, int show, int direct) { + int logo_x, int logo_y, int logo_w, int logo_h, int band, int show, int direct) { int y, x; int interp, dist; uint8_t *xdst, *xsrc; @@ -80,46 +80,46 @@ static void delogo(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int for(y = logo_y1+1; y < logo_y2-1; y++) { - for (x = logo_x1+1, xdst = dst+logo_x1+1, xsrc = src+logo_x1+1; x < logo_x2-1; x++, xdst++, xsrc++) { - interp = ((topleft[srcStride*(y-logo_y-yclipt)] - + topleft[srcStride*(y-logo_y-1-yclipt)] - + topleft[srcStride*(y-logo_y+1-yclipt)])*(logo_w-(x-logo_x))/logo_w - + (topright[srcStride*(y-logo_y-yclipt)] - + topright[srcStride*(y-logo_y-1-yclipt)] - + topright[srcStride*(y-logo_y+1-yclipt)])*(x-logo_x)/logo_w - + (topleft[x-logo_x-xclipl] - + topleft[x-logo_x-1-xclipl] - + topleft[x-logo_x+1-xclipl])*(logo_h-(y-logo_y))/logo_h - + (botleft[x-logo_x-xclipl] - + botleft[x-logo_x-1-xclipl] - + botleft[x-logo_x+1-xclipl])*(y-logo_y)/logo_h - )/6; -/* interp = (topleft[srcStride*(y-logo_y)]*(logo_w-(x-logo_x))/logo_w - + topright[srcStride*(y-logo_y)]*(x-logo_x)/logo_w - + topleft[x-logo_x]*(logo_h-(y-logo_y))/logo_h - + botleft[x-logo_x]*(y-logo_y)/logo_h - )/2;*/ - if (y >= logo_y+band && y < logo_y+logo_h-band && x >= logo_x+band && x < logo_x+logo_w-band) { - *xdst = interp; - } else { - dist = 0; - if (x < logo_x+band) dist = MAX(dist, logo_x-x+band); - else if (x >= logo_x+logo_w-band) dist = MAX(dist, x-(logo_x+logo_w-1-band)); - if (y < logo_y+band) dist = MAX(dist, logo_y-y+band); - else if (y >= logo_y+logo_h-band) dist = MAX(dist, y-(logo_y+logo_h-1-band)); - *xdst = (*xsrc*dist + interp*(band-dist))/band; - if (show && (dist == band-1)) *xdst = 0; - } - } - - dst+= dstStride; - src+= srcStride; + for (x = logo_x1+1, xdst = dst+logo_x1+1, xsrc = src+logo_x1+1; x < logo_x2-1; x++, xdst++, xsrc++) { + interp = ((topleft[srcStride*(y-logo_y-yclipt)] + + topleft[srcStride*(y-logo_y-1-yclipt)] + + topleft[srcStride*(y-logo_y+1-yclipt)])*(logo_w-(x-logo_x))/logo_w + + (topright[srcStride*(y-logo_y-yclipt)] + + topright[srcStride*(y-logo_y-1-yclipt)] + + topright[srcStride*(y-logo_y+1-yclipt)])*(x-logo_x)/logo_w + + (topleft[x-logo_x-xclipl] + + topleft[x-logo_x-1-xclipl] + + topleft[x-logo_x+1-xclipl])*(logo_h-(y-logo_y))/logo_h + + (botleft[x-logo_x-xclipl] + + botleft[x-logo_x-1-xclipl] + + botleft[x-logo_x+1-xclipl])*(y-logo_y)/logo_h + )/6; +/* interp = (topleft[srcStride*(y-logo_y)]*(logo_w-(x-logo_x))/logo_w + + topright[srcStride*(y-logo_y)]*(x-logo_x)/logo_w + + topleft[x-logo_x]*(logo_h-(y-logo_y))/logo_h + + botleft[x-logo_x]*(y-logo_y)/logo_h + )/2;*/ + if (y >= logo_y+band && y < logo_y+logo_h-band && x >= logo_x+band && x < logo_x+logo_w-band) { + *xdst = interp; + } else { + dist = 0; + if (x < logo_x+band) dist = MAX(dist, logo_x-x+band); + else if (x >= logo_x+logo_w-band) dist = MAX(dist, x-(logo_x+logo_w-1-band)); + if (y < logo_y+band) dist = MAX(dist, logo_y-y+band); + else if (y >= logo_y+logo_h-band) dist = MAX(dist, y-(logo_y+logo_h-1-band)); + *xdst = (*xsrc*dist + interp*(band-dist))/band; + if (show && (dist == band-1)) *xdst = 0; + } + } + + dst+= dstStride; + src+= srcStride; } } static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt){ return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } @@ -130,15 +130,15 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi){ if(mpi->imgfmt!=vf->priv->outfmt) return; // colorspace differ // ok, we can do pp in-place (or pp disabled): vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, - mpi->type, mpi->flags, mpi->w, mpi->h); + mpi->type, mpi->flags, mpi->w, mpi->h); mpi->planes[0]=vf->dmpi->planes[0]; mpi->stride[0]=vf->dmpi->stride[0]; mpi->width=vf->dmpi->width; if(mpi->flags&MP_IMGFLAG_PLANAR){ mpi->planes[1]=vf->dmpi->planes[1]; mpi->planes[2]=vf->dmpi->planes[2]; - mpi->stride[1]=vf->dmpi->stride[1]; - mpi->stride[2]=vf->dmpi->stride[2]; + mpi->stride[1]=vf->dmpi->stride[1]; + mpi->stride[2]=vf->dmpi->stride[2]; } mpi->flags|=MP_IMGFLAG_DIRECT; } @@ -147,22 +147,22 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ mp_image_t *dmpi; if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ - // no DR, so get a new image! hope we'll get DR buffer: - vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->w,mpi->h); + // no DR, so get a new image! hope we'll get DR buffer: + vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->w,mpi->h); } dmpi= vf->dmpi; delogo(dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, - vf->priv->xoff, vf->priv->yoff, vf->priv->lw, vf->priv->lh, vf->priv->band, vf->priv->show, - mpi->flags&MP_IMGFLAG_DIRECT); + vf->priv->xoff, vf->priv->yoff, vf->priv->lw, vf->priv->lh, vf->priv->band, vf->priv->show, + mpi->flags&MP_IMGFLAG_DIRECT); delogo(dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w/2, mpi->h/2, - vf->priv->xoff/2, vf->priv->yoff/2, vf->priv->lw/2, vf->priv->lh/2, vf->priv->band/2, vf->priv->show, - mpi->flags&MP_IMGFLAG_DIRECT); + vf->priv->xoff/2, vf->priv->yoff/2, vf->priv->lw/2, vf->priv->lh/2, vf->priv->band/2, vf->priv->show, + mpi->flags&MP_IMGFLAG_DIRECT); delogo(dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w/2, mpi->h/2, - vf->priv->xoff/2, vf->priv->yoff/2, vf->priv->lw/2, vf->priv->lh/2, vf->priv->band/2, vf->priv->show, - mpi->flags&MP_IMGFLAG_DIRECT); + vf->priv->xoff/2, vf->priv->yoff/2, vf->priv->lw/2, vf->priv->lh/2, vf->priv->band/2, vf->priv->show, + mpi->flags&MP_IMGFLAG_DIRECT); vf_clone_mpi_attributes(dmpi, mpi); @@ -184,7 +184,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){ case IMGFMT_YV12: case IMGFMT_I420: case IMGFMT_IYUV: - return vf_next_query_format(vf,vf->priv->outfmt); + return vf_next_query_format(vf,vf->priv->outfmt); } return 0; } @@ -204,15 +204,15 @@ static int vf_open(vf_instance_t *vf, char *args){ vf->uninit=uninit; mp_msg(MSGT_VFILTER, MSGL_V, "delogo: %d x %d, %d x %d, band = %d\n", - vf->priv->xoff, vf->priv->yoff, - vf->priv->lw, vf->priv->lh, - vf->priv->band); + vf->priv->xoff, vf->priv->yoff, + vf->priv->lw, vf->priv->lh, + vf->priv->band); vf->priv->show = 0; if (vf->priv->band < 0) { - vf->priv->band = 4; - vf->priv->show = 1; + vf->priv->band = 4; + vf->priv->show = 1; } @@ -225,7 +225,7 @@ static int vf_open(vf_instance_t *vf, char *args){ vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12); if(!vf->priv->outfmt) { - uninit(vf); + uninit(vf); return 0; // no csp match :( } diff --git a/mplayer/libmpcodecs/vf_denoise3d.c b/mplayer/libmpcodecs/vf_denoise3d.c index 6936d86c..ab8dcfbd 100644 --- a/mplayer/libmpcodecs/vf_denoise3d.c +++ b/mplayer/libmpcodecs/vf_denoise3d.c @@ -38,7 +38,7 @@ struct vf_priv_s { int Coefs[4][512]; unsigned char *Line; - mp_image_t *pmpi; + mp_image_t *pmpi; }; @@ -47,14 +47,14 @@ struct vf_priv_s { static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ - free(vf->priv->Line); + free(vf->priv->Line); vf->priv->Line = malloc(width); - vf->priv->pmpi=NULL; + vf->priv->pmpi=NULL; // vf->default_caps &= !VFCAP_ACCEPT_STRIDE; - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } @@ -91,7 +91,7 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x] for (Y = 1; Y < H; Y++) { - sLineOffs += sStride, pLineOffs += pStride, dLineOffs += dStride; + sLineOffs += sStride, pLineOffs += pStride, dLineOffs += dStride; /* First pixel on each line doesn't have previous pixel */ PixelAnt = Frame[sLineOffs]; LineAnt[0] = LowPass(LineAnt[0], PixelAnt, Vertical); @@ -110,56 +110,56 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x] static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ - int cw= mpi->w >> mpi->chroma_x_shift; - int ch= mpi->h >> mpi->chroma_y_shift; + int cw= mpi->w >> mpi->chroma_x_shift; + int ch= mpi->h >> mpi->chroma_y_shift; int W = mpi->w, H = mpi->h; - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_IP, MP_IMGFLAG_ACCEPT_STRIDE | - MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, + mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + MP_IMGTYPE_IP, MP_IMGFLAG_ACCEPT_STRIDE | + MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, mpi->w,mpi->h); - if(!dmpi) return 0; + if(!dmpi) return 0; if (!vf->priv->pmpi) vf->priv->pmpi=mpi; deNoise(mpi->planes[0], vf->priv->pmpi->planes[0], dmpi->planes[0], - vf->priv->Line, W, H, + vf->priv->Line, W, H, mpi->stride[0], vf->priv->pmpi->stride[0], dmpi->stride[0], vf->priv->Coefs[0] + 256, vf->priv->Coefs[0] + 256, vf->priv->Coefs[1] + 256); deNoise(mpi->planes[1], vf->priv->pmpi->planes[1], dmpi->planes[1], - vf->priv->Line, cw, ch, + vf->priv->Line, cw, ch, mpi->stride[1], vf->priv->pmpi->stride[1], dmpi->stride[1], vf->priv->Coefs[2] + 256, vf->priv->Coefs[2] + 256, vf->priv->Coefs[3] + 256); deNoise(mpi->planes[2], vf->priv->pmpi->planes[2], dmpi->planes[2], - vf->priv->Line, cw, ch, + vf->priv->Line, cw, ch, mpi->stride[2], vf->priv->pmpi->stride[2], dmpi->stride[2], vf->priv->Coefs[2] + 256, vf->priv->Coefs[2] + 256, vf->priv->Coefs[3] + 256); - vf->priv->pmpi=dmpi; // save reference image - return vf_next_put_image(vf,dmpi, pts); + vf->priv->pmpi=dmpi; // save reference image + return vf_next_put_image(vf,dmpi, pts); } //===========================================================================// static int query_format(struct vf_instance *vf, unsigned int fmt){ switch(fmt) - { - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_YVU9: - case IMGFMT_444P: - case IMGFMT_422P: - case IMGFMT_411P: - return vf_next_query_format(vf, fmt); - } - return 0; + { + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YVU9: + case IMGFMT_444P: + case IMGFMT_422P: + case IMGFMT_411P: + return vf_next_query_format(vf, fmt); + } + return 0; } @@ -186,11 +186,11 @@ static int vf_open(vf_instance_t *vf, char *args){ double LumSpac, LumTmp, ChromSpac, ChromTmp; double Param1, Param2, Param3; - vf->config=config; - vf->put_image=put_image; + vf->config=config; + vf->put_image=put_image; vf->query_format=query_format; vf->uninit=uninit; - vf->priv=malloc(sizeof(struct vf_priv_s)); + vf->priv=malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); if (args) @@ -253,7 +253,7 @@ static int vf_open(vf_instance_t *vf, char *args){ PrecalcCoefs(vf->priv->Coefs[2], ChromSpac); PrecalcCoefs(vf->priv->Coefs[3], ChromTmp); - return 1; + return 1; } const vf_info_t vf_info_denoise3d = { diff --git a/mplayer/libmpcodecs/vf_detc.c b/mplayer/libmpcodecs/vf_detc.c index 479d51a5..d9ddc796 100644 --- a/mplayer/libmpcodecs/vf_detc.c +++ b/mplayer/libmpcodecs/vf_detc.c @@ -30,21 +30,21 @@ #include "libvo/fastmemcpy.h" struct metrics { - int even; - int odd; - int noise; - int temp; + int even; + int odd; + int noise; + int temp; }; struct vf_priv_s { - int frame; - int drop, lastdrop; - struct metrics pm; - int thres[5]; - int inframes, outframes; - int mode; - int (*analyze)(struct vf_priv_s *, mp_image_t *, mp_image_t *); - int needread; + int frame; + int drop, lastdrop; + struct metrics pm; + int thres[5]; + int inframes, outframes; + int mode; + int (*analyze)(struct vf_priv_s *, mp_image_t *, mp_image_t *); + int needread; }; #define COMPE(a,b,e) (abs((a)-(b)) < (((a)+(b))>>(e))) @@ -65,330 +65,330 @@ struct vf_priv_s { COMPARABLE((s)[1].m.noise,(h)) ) ) enum { - TC_DROP, - TC_PROG, - TC_IL1, - TC_IL2 + TC_DROP, + TC_PROG, + TC_IL1, + TC_IL2 }; static void block_diffs(struct metrics *m, unsigned char *old, unsigned char *new, int os, int ns) { - int x, y, even=0, odd=0, noise, temp; - unsigned char *oldp, *newp; - m->noise = m->temp = 0; - for (x = 8; x; x--) { - oldp = old++; - newp = new++; - noise = temp = 0; - for (y = 4; y; y--) { - even += abs(newp[0]-oldp[0]); - odd += abs(newp[ns]-oldp[os]); - noise += newp[ns]-newp[0]; - temp += oldp[os]-newp[0]; - oldp += os<<1; - newp += ns<<1; - } - m->noise += abs(noise); - m->temp += abs(temp); - } - m->even = even; - m->odd = odd; + int x, y, even=0, odd=0, noise, temp; + unsigned char *oldp, *newp; + m->noise = m->temp = 0; + for (x = 8; x; x--) { + oldp = old++; + newp = new++; + noise = temp = 0; + for (y = 4; y; y--) { + even += abs(newp[0]-oldp[0]); + odd += abs(newp[ns]-oldp[os]); + noise += newp[ns]-newp[0]; + temp += oldp[os]-newp[0]; + oldp += os<<1; + newp += ns<<1; + } + m->noise += abs(noise); + m->temp += abs(temp); + } + m->even = even; + m->odd = odd; } static void diff_planes(struct metrics *m, unsigned char *old, unsigned char *new, int w, int h, int os, int ns) { - int x, y, me=0, mo=0, mn=0, mt=0; - struct metrics l; - for (y = 0; y < h-7; y += 8) { - for (x = 0; x < w-7; x += 8) { - block_diffs(&l, old+x+y*os, new+x+y*ns, os, ns); - if (l.even > me) me = l.even; - if (l.odd > mo) mo = l.odd; - if (l.noise > mn) mn = l.noise; - if (l.temp > mt) mt = l.temp; - } - } - m->even = me; - m->odd = mo; - m->noise = mn; - m->temp = mt; + int x, y, me=0, mo=0, mn=0, mt=0; + struct metrics l; + for (y = 0; y < h-7; y += 8) { + for (x = 0; x < w-7; x += 8) { + block_diffs(&l, old+x+y*os, new+x+y*ns, os, ns); + if (l.even > me) me = l.even; + if (l.odd > mo) mo = l.odd; + if (l.noise > mn) mn = l.noise; + if (l.temp > mt) mt = l.temp; + } + } + m->even = me; + m->odd = mo; + m->noise = mn; + m->temp = mt; } static void diff_fields(struct metrics *metr, mp_image_t *old, mp_image_t *new) { - struct metrics m, mu, mv; - diff_planes(&m, old->planes[0], new->planes[0], - new->w, new->h, old->stride[0], new->stride[0]); - if (new->flags & MP_IMGFLAG_PLANAR) { - diff_planes(&mu, old->planes[1], new->planes[1], - new->chroma_width, new->chroma_height, - old->stride[1], new->stride[1]); - diff_planes(&mv, old->planes[2], new->planes[2], - new->chroma_width, new->chroma_height, - old->stride[2], new->stride[2]); - if (mu.even > m.even) m.even = mu.even; - if (mu.odd > m.odd) m.odd = mu.odd; - if (mu.noise > m.noise) m.noise = mu.noise; - if (mu.temp > m.temp) m.temp = mu.temp; - if (mv.even > m.even) m.even = mv.even; - if (mv.odd > m.odd) m.odd = mv.odd; - if (mv.noise > m.noise) m.noise = mv.noise; - if (mv.temp > m.temp) m.temp = mv.temp; - } - *metr = m; + struct metrics m, mu, mv; + diff_planes(&m, old->planes[0], new->planes[0], + new->w, new->h, old->stride[0], new->stride[0]); + if (new->flags & MP_IMGFLAG_PLANAR) { + diff_planes(&mu, old->planes[1], new->planes[1], + new->chroma_width, new->chroma_height, + old->stride[1], new->stride[1]); + diff_planes(&mv, old->planes[2], new->planes[2], + new->chroma_width, new->chroma_height, + old->stride[2], new->stride[2]); + if (mu.even > m.even) m.even = mu.even; + if (mu.odd > m.odd) m.odd = mu.odd; + if (mu.noise > m.noise) m.noise = mu.noise; + if (mu.temp > m.temp) m.temp = mu.temp; + if (mv.even > m.even) m.even = mv.even; + if (mv.odd > m.odd) m.odd = mv.odd; + if (mv.noise > m.noise) m.noise = mv.noise; + if (mv.temp > m.temp) m.temp = mv.temp; + } + *metr = m; } static void status(int f, struct metrics *m) { - mp_msg(MSGT_VFILTER, MSGL_V, "frame %d: e=%d o=%d n=%d t=%d\n", - f, m->even, m->odd, m->noise, m->temp); + mp_msg(MSGT_VFILTER, MSGL_V, "frame %d: e=%d o=%d n=%d t=%d\n", + f, m->even, m->odd, m->noise, m->temp); } static int analyze_fixed_pattern(struct vf_priv_s *p, mp_image_t *new, mp_image_t *old) { - if (p->frame >= 0) p->frame = (p->frame+1)%5; - mp_msg(MSGT_VFILTER, MSGL_V, "frame %d\n", p->frame); - switch (p->frame) { - case -1: case 0: case 1: case 2: - return TC_PROG; - case 3: - return TC_IL1; - case 4: - return TC_IL2; - } - return 0; + if (p->frame >= 0) p->frame = (p->frame+1)%5; + mp_msg(MSGT_VFILTER, MSGL_V, "frame %d\n", p->frame); + switch (p->frame) { + case -1: case 0: case 1: case 2: + return TC_PROG; + case 3: + return TC_IL1; + case 4: + return TC_IL2; + } + return 0; } static int analyze_aggressive(struct vf_priv_s *p, mp_image_t *new, mp_image_t *old) { - struct metrics m, pm; - - if (p->frame >= 0) p->frame = (p->frame+1)%5; - - diff_fields(&m, old, new); - - status(p->frame, &m); - - pm = p->pm; - p->pm = m; - - if (p->frame == 4) { - /* We need to break at scene changes, but is this a valid test? */ - if ((m.even > p->thres[2]) && (m.odd > p->thres[2]) && (m.temp > p->thres[3]) - && (m.temp > 5*pm.temp) && (m.temp*2 > m.noise)) { - mp_msg(MSGT_VFILTER, MSGL_V, "scene change breaking telecine!\n"); - p->frame = -1; - return TC_DROP; - } - /* Thres. is to compensate for quantization errors when noise is low */ - if (m.noise - m.temp > -p->thres[4]) { - if (COMPARABLE(m.even, pm.odd)) { - //mp_msg(MSGT_VFILTER, MSGL_V, "confirmed field match!\n"); - return TC_IL2; - } else if ((m.even < p->thres[0]) && (m.odd < p->thres[0]) && VERYCLOSE(m.even, m.odd) - && VERYCLOSE(m.noise,m.temp) && VERYCLOSE(m.noise,pm.noise)) { - mp_msg(MSGT_VFILTER, MSGL_V, "interlaced frame appears in duplicate!!!\n"); - p->pm = pm; /* hack :) */ - p->frame = 3; - return TC_IL1; - } - } else { - mp_msg(MSGT_VFILTER, MSGL_V, "mismatched telecine fields!\n"); - p->frame = -1; - } - } - - if (2*m.even*m.temp < m.odd*m.noise) { - mp_msg(MSGT_VFILTER, MSGL_V, "caught telecine sync!\n"); - p->frame = 3; - return TC_IL1; - } - - if (p->frame < 3) { - if (m.noise > p->thres[3]) { - if (m.noise > 2*m.temp) { - mp_msg(MSGT_VFILTER, MSGL_V, "merging fields out of sequence!\n"); - return TC_IL2; - } - if ((m.noise > 2*pm.noise) && (m.even > p->thres[2]) && (m.odd > p->thres[2])) { - mp_msg(MSGT_VFILTER, MSGL_V, "dropping horrible interlaced frame!\n"); - return TC_DROP; - } - } - } - - switch (p->frame) { - case -1: - if (4*m.noise > 5*m.temp) { - mp_msg(MSGT_VFILTER, MSGL_V, "merging fields out of sequence!\n"); - return TC_IL2; - } - case 0: - case 1: - case 2: - return TC_PROG; - case 3: - if ((m.even > p->thres[1]) && (m.even > m.odd) && (m.temp > m.noise)) { - mp_msg(MSGT_VFILTER, MSGL_V, "lost telecine tracking!\n"); - p->frame = -1; - return TC_PROG; - } - return TC_IL1; - case 4: - return TC_IL2; - } - return 0; + struct metrics m, pm; + + if (p->frame >= 0) p->frame = (p->frame+1)%5; + + diff_fields(&m, old, new); + + status(p->frame, &m); + + pm = p->pm; + p->pm = m; + + if (p->frame == 4) { + /* We need to break at scene changes, but is this a valid test? */ + if ((m.even > p->thres[2]) && (m.odd > p->thres[2]) && (m.temp > p->thres[3]) + && (m.temp > 5*pm.temp) && (m.temp*2 > m.noise)) { + mp_msg(MSGT_VFILTER, MSGL_V, "scene change breaking telecine!\n"); + p->frame = -1; + return TC_DROP; + } + /* Thres. is to compensate for quantization errors when noise is low */ + if (m.noise - m.temp > -p->thres[4]) { + if (COMPARABLE(m.even, pm.odd)) { + //mp_msg(MSGT_VFILTER, MSGL_V, "confirmed field match!\n"); + return TC_IL2; + } else if ((m.even < p->thres[0]) && (m.odd < p->thres[0]) && VERYCLOSE(m.even, m.odd) + && VERYCLOSE(m.noise,m.temp) && VERYCLOSE(m.noise,pm.noise)) { + mp_msg(MSGT_VFILTER, MSGL_V, "interlaced frame appears in duplicate!!!\n"); + p->pm = pm; /* hack :) */ + p->frame = 3; + return TC_IL1; + } + } else { + mp_msg(MSGT_VFILTER, MSGL_V, "mismatched telecine fields!\n"); + p->frame = -1; + } + } + + if (2*m.even*m.temp < m.odd*m.noise) { + mp_msg(MSGT_VFILTER, MSGL_V, "caught telecine sync!\n"); + p->frame = 3; + return TC_IL1; + } + + if (p->frame < 3) { + if (m.noise > p->thres[3]) { + if (m.noise > 2*m.temp) { + mp_msg(MSGT_VFILTER, MSGL_V, "merging fields out of sequence!\n"); + return TC_IL2; + } + if ((m.noise > 2*pm.noise) && (m.even > p->thres[2]) && (m.odd > p->thres[2])) { + mp_msg(MSGT_VFILTER, MSGL_V, "dropping horrible interlaced frame!\n"); + return TC_DROP; + } + } + } + + switch (p->frame) { + case -1: + if (4*m.noise > 5*m.temp) { + mp_msg(MSGT_VFILTER, MSGL_V, "merging fields out of sequence!\n"); + return TC_IL2; + } + case 0: + case 1: + case 2: + return TC_PROG; + case 3: + if ((m.even > p->thres[1]) && (m.even > m.odd) && (m.temp > m.noise)) { + mp_msg(MSGT_VFILTER, MSGL_V, "lost telecine tracking!\n"); + p->frame = -1; + return TC_PROG; + } + return TC_IL1; + case 4: + return TC_IL2; + } + return 0; } static void copy_image(mp_image_t *dmpi, mp_image_t *mpi, int field) { - switch (field) { - case 0: - my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1], mpi->planes[1], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[1]*2, mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2], mpi->planes[2], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[2]*2, mpi->stride[2]*2); - } - break; - case 1: - my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], - mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], - mpi->planes[1]+mpi->stride[1], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[1]*2, mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], - mpi->planes[2]+mpi->stride[2], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[2]*2, mpi->stride[2]*2); - } - break; - case 2: - memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0], mpi->stride[0]); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - memcpy_pic(dmpi->planes[1], mpi->planes[1], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[1], mpi->stride[1]); - memcpy_pic(dmpi->planes[2], mpi->planes[2], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[2], mpi->stride[2]); - } - break; - } + switch (field) { + case 0: + my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2, + dmpi->stride[0]*2, mpi->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(dmpi->planes[1], mpi->planes[1], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[1]*2, mpi->stride[1]*2); + my_memcpy_pic(dmpi->planes[2], mpi->planes[2], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[2]*2, mpi->stride[2]*2); + } + break; + case 1: + my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], + mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2, + dmpi->stride[0]*2, mpi->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], + mpi->planes[1]+mpi->stride[1], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[1]*2, mpi->stride[1]*2); + my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], + mpi->planes[2]+mpi->stride[2], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[2]*2, mpi->stride[2]*2); + } + break; + case 2: + memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, + dmpi->stride[0], mpi->stride[0]); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + memcpy_pic(dmpi->planes[1], mpi->planes[1], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[1], mpi->stride[1]); + memcpy_pic(dmpi->planes[2], mpi->planes[2], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[2], mpi->stride[2]); + } + break; + } } static int do_put_image(struct vf_instance *vf, mp_image_t *dmpi) { - struct vf_priv_s *p = vf->priv; - int dropflag; - - switch (p->drop) { - default: - dropflag = 0; - break; - case 1: - dropflag = (++p->lastdrop >= 5); - break; - case 2: - dropflag = (++p->lastdrop >= 5) && (4*p->inframes <= 5*p->outframes); - break; - } - - if (dropflag) { - mp_msg(MSGT_VFILTER, MSGL_V, "drop! [%d/%d=%g]\n", - p->outframes, p->inframes, (float)p->outframes/p->inframes); - p->lastdrop = 0; - return 0; - } - - p->outframes++; - return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); + struct vf_priv_s *p = vf->priv; + int dropflag; + + switch (p->drop) { + default: + dropflag = 0; + break; + case 1: + dropflag = (++p->lastdrop >= 5); + break; + case 2: + dropflag = (++p->lastdrop >= 5) && (4*p->inframes <= 5*p->outframes); + break; + } + + if (dropflag) { + mp_msg(MSGT_VFILTER, MSGL_V, "drop! [%d/%d=%g]\n", + p->outframes, p->inframes, (float)p->outframes/p->inframes); + p->lastdrop = 0; + return 0; + } + + p->outframes++; + return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { - int ret=0; - mp_image_t *dmpi; - struct vf_priv_s *p = vf->priv; - - p->inframes++; - - if (p->needread) dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | - MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, - mpi->width, mpi->height); - /* FIXME: is there a good way to get rid of static type? */ - else dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | - MP_IMGFLAG_PRESERVE, mpi->width, mpi->height); - - switch (p->analyze(p, mpi, dmpi)) { - case TC_DROP: - /* Don't copy anything unless we'll need to read it. */ - if (p->needread) copy_image(dmpi, mpi, 2); - p->lastdrop = 0; - break; - case TC_PROG: - /* Copy and display the whole frame. */ - copy_image(dmpi, mpi, 2); - ret = do_put_image(vf, dmpi); - break; - case TC_IL1: - /* Only copy bottom field unless we need to read. */ - if (p->needread) copy_image(dmpi, mpi, 2); - else copy_image(dmpi, mpi, 1); - p->lastdrop = 0; - break; - case TC_IL2: - /* Copy top field and show frame, then copy bottom if needed. */ - copy_image(dmpi, mpi, 0); - ret = do_put_image(vf, dmpi); - if (p->needread) copy_image(dmpi, mpi, 1); - break; - } - return ret; + int ret=0; + mp_image_t *dmpi; + struct vf_priv_s *p = vf->priv; + + p->inframes++; + + if (p->needread) dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | + MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, + mpi->width, mpi->height); + /* FIXME: is there a good way to get rid of static type? */ + else dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | + MP_IMGFLAG_PRESERVE, mpi->width, mpi->height); + + switch (p->analyze(p, mpi, dmpi)) { + case TC_DROP: + /* Don't copy anything unless we'll need to read it. */ + if (p->needread) copy_image(dmpi, mpi, 2); + p->lastdrop = 0; + break; + case TC_PROG: + /* Copy and display the whole frame. */ + copy_image(dmpi, mpi, 2); + ret = do_put_image(vf, dmpi); + break; + case TC_IL1: + /* Only copy bottom field unless we need to read. */ + if (p->needread) copy_image(dmpi, mpi, 2); + else copy_image(dmpi, mpi, 1); + p->lastdrop = 0; + break; + case TC_IL2: + /* Copy top field and show frame, then copy bottom if needed. */ + copy_image(dmpi, mpi, 0); + ret = do_put_image(vf, dmpi); + if (p->needread) copy_image(dmpi, mpi, 1); + break; + } + return ret; } static int query_format(struct vf_instance *vf, unsigned int fmt) { - /* FIXME - figure out which other formats work */ - switch (fmt) { - case IMGFMT_YV12: - case IMGFMT_IYUV: - case IMGFMT_I420: - return vf_next_query_format(vf, fmt); - } - return 0; + /* FIXME - figure out which other formats work */ + switch (fmt) { + case IMGFMT_YV12: + case IMGFMT_IYUV: + case IMGFMT_I420: + return vf_next_query_format(vf, fmt); + } + return 0; } static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) + unsigned int flags, unsigned int outfmt) { - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static void uninit(struct vf_instance *vf) { - free(vf->priv); + free(vf->priv); } static struct { - char *name; - int (*func)(struct vf_priv_s *p, mp_image_t *new, mp_image_t *old); - int needread; + char *name; + int (*func)(struct vf_priv_s *p, mp_image_t *new, mp_image_t *old); + int needread; } anal_funcs[] = { - { "fixed", analyze_fixed_pattern, 0 }, - { "aggressive", analyze_aggressive, 1 }, - { NULL, NULL, 0 } + { "fixed", analyze_fixed_pattern, 0 }, + { "aggressive", analyze_aggressive, 1 }, + { NULL, NULL, 0 } }; #define STARTVARS if (0) @@ -398,49 +398,49 @@ static struct { static void parse_var(struct vf_priv_s *p, char *var) { - STARTVARS; - GETVAR(var, "dr", p->drop, atoi); - GETVAR(var, "t0", p->thres[0], atoi); - GETVAR(var, "t1", p->thres[1], atoi); - GETVAR(var, "t2", p->thres[2], atoi); - GETVAR(var, "t3", p->thres[3], atoi); - GETVAR(var, "t4", p->thres[4], atoi); - GETVAR(var, "fr", p->frame, atoi); - GETVAR(var, "am", p->mode, atoi); + STARTVARS; + GETVAR(var, "dr", p->drop, atoi); + GETVAR(var, "t0", p->thres[0], atoi); + GETVAR(var, "t1", p->thres[1], atoi); + GETVAR(var, "t2", p->thres[2], atoi); + GETVAR(var, "t3", p->thres[3], atoi); + GETVAR(var, "t4", p->thres[4], atoi); + GETVAR(var, "fr", p->frame, atoi); + GETVAR(var, "am", p->mode, atoi); } static void parse_args(struct vf_priv_s *p, char *args) { - char *next, *orig; - for (args=orig=strdup(args); args; args=next) { - next = strchr(args, ':'); - if (next) *next++ = 0; - parse_var(p, args); - } - free(orig); + char *next, *orig; + for (args=orig=strdup(args); args; args=next) { + next = strchr(args, ':'); + if (next) *next++ = 0; + parse_var(p, args); + } + free(orig); } static int vf_open(vf_instance_t *vf, char *args) { - struct vf_priv_s *p; - vf->config = config; - vf->put_image = put_image; - vf->query_format = query_format; - vf->uninit = uninit; - vf->default_reqs = VFCAP_ACCEPT_STRIDE; - vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); - p->frame = -1; - p->thres[0] = 440; - p->thres[1] = 720; - p->thres[2] = 2500; - p->thres[3] = 2500; - p->thres[4] = 800; - p->drop = 0; - p->mode = 1; - if (args) parse_args(p, args); - p->analyze = anal_funcs[p->mode].func; - p->needread = anal_funcs[p->mode].needread; - return 1; + struct vf_priv_s *p; + vf->config = config; + vf->put_image = put_image; + vf->query_format = query_format; + vf->uninit = uninit; + vf->default_reqs = VFCAP_ACCEPT_STRIDE; + vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); + p->frame = -1; + p->thres[0] = 440; + p->thres[1] = 720; + p->thres[2] = 2500; + p->thres[3] = 2500; + p->thres[4] = 800; + p->drop = 0; + p->mode = 1; + if (args) parse_args(p, args); + p->analyze = anal_funcs[p->mode].func; + p->needread = anal_funcs[p->mode].needread; + return 1; } const vf_info_t vf_info_detc = { diff --git a/mplayer/libmpcodecs/vf_dint.c b/mplayer/libmpcodecs/vf_dint.c index 6145eb5a..04aafb61 100644 --- a/mplayer/libmpcodecs/vf_dint.c +++ b/mplayer/libmpcodecs/vf_dint.c @@ -44,16 +44,16 @@ struct vf_priv_s { static int config (struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) + unsigned int flags, unsigned int outfmt) { int rowsize; vf->priv->pmpi = vf_get_image (vf->next, outfmt, MP_IMGTYPE_TEMP, - 0, width, height); + 0, width, height); if (!(vf->priv->pmpi->flags & MP_IMGFLAG_PLANAR) && - outfmt != IMGFMT_RGB32 && outfmt != IMGFMT_BGR32 && - outfmt != IMGFMT_RGB24 && outfmt != IMGFMT_BGR24 && - outfmt != IMGFMT_RGB16 && outfmt != IMGFMT_BGR16) + outfmt != IMGFMT_RGB32 && outfmt != IMGFMT_BGR32 && + outfmt != IMGFMT_RGB24 && outfmt != IMGFMT_BGR24 && + outfmt != IMGFMT_RGB16 && outfmt != IMGFMT_BGR16) { mp_msg (MSGT_VFILTER, MSGL_WARN, "Drop-interlaced filter doesn't support this outfmt :(\n"); return 0; @@ -69,11 +69,11 @@ static int config (struct vf_instance *vf, vf->priv->diff = vf->priv->sense * (1 << (vf->priv->pmpi->bpp/3)); if (vf->priv->diff < 0) vf->priv->diff = 0; if (!(vf->priv->pmpi->flags & MP_IMGFLAG_PLANAR) && - vf->priv->pmpi->bpp < 24 && vf->priv->diff > 31) + vf->priv->pmpi->bpp < 24 && vf->priv->diff > 31) vf->priv->diff = 31; mp_msg (MSGT_VFILTER, MSGL_INFO, "Drop-interlaced: %dx%d diff %d / level %u\n", - vf->priv->pmpi->width, vf->priv->pmpi->height, - (int)vf->priv->diff, (unsigned int)vf->priv->max); + vf->priv->pmpi->width, vf->priv->pmpi->height, + (int)vf->priv->diff, (unsigned int)vf->priv->max); // vf->priv->rdfr = vf->priv->dfr = 0; vf->priv->was_dint = 0; return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); @@ -101,89 +101,89 @@ static int put_image (struct vf_instance *vf, mp_image_t *mpi, double pts) prv0 = mpi->planes[0]; for (j = 1; j < mpi->height && nok <= max; j++) { - cur = cur0; - prv = prv0; - // analyse row (row0) - if (mpi->flags & MP_IMGFLAG_PLANAR) // planar YUV - check luminance - for (i = 0; i < rowsize; i++) - { - if (cur[0] - prv[0] > diff) - row0[i] = 1; - else if (cur[0] - prv[0] < -diff) - row0[i] = -1; - else - row0[i] = 0; - cur++; - prv++; - // check if row0 is 1 but row1 is 0, and row2 is 1 or row2 is 0 - // but row3 is 1 so it's interlaced ptr (nok++) - if (j > 2 && row0[i] > 0 && (row1[i] < 0 || (!row1[i] && row2[i] < 0)) && - (++nok) > max) - break; - } - else if (mpi->bpp < 24) // RGB/BGR 16 - check all colors - for (i = 0; i < rowsize; i++) - { - n1 = cur[0] + (cur[1]<<8); - n2 = prv[0] + (prv[1]<<8); - if ((n1&0x1f) - (n2&0x1f) > diff || - ((n1>>5)&0x3f) - ((n2>>5)&0x3f) > diff || - ((n1>>11)&0x1f) - ((n2>>11)&0x1f) > diff) - row0[i] = 1; - else if ((n1&0x1f) - (n2&0x1f) < -diff || - ((n1>>5)&0x3f) - ((n2>>5)&0x3f) < -diff || - ((n1>>11)&0x1f) - ((n2>>11)&0x1f) < -diff) - row0[i] = -1; - else - row0[i] = 0; - cur += 2; - prv += 2; - // check if row0 is 1 but row1 is 0, and row2 is 1 or row2 is 0 - // but row3 is 1 so it's interlaced ptr (nok++) - if (j > 2 && row0[i] > 0 && (row1[i] < 0 || (!row1[i] && row2[i] < 0)) && - (++nok) > max) - break; - } - else // RGB/BGR 24/32 - for (i = 0; i < rowsize; i++) - { - if (cur[0] - prv[0] > diff || - cur[1] - prv[1] > diff || - cur[2] - prv[2] > diff) - row0[i] = 1; - else if (prv[0] - cur[0] > diff || - prv[1] - cur[1] > diff || - prv[2] - cur[2] > diff) - row0[i] = -1; - else - row0[i] = 0; - cur += mpi->bpp/8; - prv += mpi->bpp/8; - // check if row0 is 1 but row1 is 0, and row2 is 1 or row2 is 0 - // but row3 is 1 so it's interlaced ptr (nok++) - if (j > 2 && row0[i] > 0 && (row1[i] < 0 || (!row1[i] && row2[i] < 0)) && - (++nok) > max) - break; - } - cur0 += mpi->stride[0]; - prv0 += mpi->stride[0]; - // rotate rows - cur = row2; - row2 = row1; - row1 = row0; - row0 = cur; + cur = cur0; + prv = prv0; + // analyse row (row0) + if (mpi->flags & MP_IMGFLAG_PLANAR) // planar YUV - check luminance + for (i = 0; i < rowsize; i++) + { + if (cur[0] - prv[0] > diff) + row0[i] = 1; + else if (cur[0] - prv[0] < -diff) + row0[i] = -1; + else + row0[i] = 0; + cur++; + prv++; + // check if row0 is 1 but row1 is 0, and row2 is 1 or row2 is 0 + // but row3 is 1 so it's interlaced ptr (nok++) + if (j > 2 && row0[i] > 0 && (row1[i] < 0 || (!row1[i] && row2[i] < 0)) && + (++nok) > max) + break; + } + else if (mpi->bpp < 24) // RGB/BGR 16 - check all colors + for (i = 0; i < rowsize; i++) + { + n1 = cur[0] + (cur[1]<<8); + n2 = prv[0] + (prv[1]<<8); + if ((n1&0x1f) - (n2&0x1f) > diff || + ((n1>>5)&0x3f) - ((n2>>5)&0x3f) > diff || + ((n1>>11)&0x1f) - ((n2>>11)&0x1f) > diff) + row0[i] = 1; + else if ((n1&0x1f) - (n2&0x1f) < -diff || + ((n1>>5)&0x3f) - ((n2>>5)&0x3f) < -diff || + ((n1>>11)&0x1f) - ((n2>>11)&0x1f) < -diff) + row0[i] = -1; + else + row0[i] = 0; + cur += 2; + prv += 2; + // check if row0 is 1 but row1 is 0, and row2 is 1 or row2 is 0 + // but row3 is 1 so it's interlaced ptr (nok++) + if (j > 2 && row0[i] > 0 && (row1[i] < 0 || (!row1[i] && row2[i] < 0)) && + (++nok) > max) + break; + } + else // RGB/BGR 24/32 + for (i = 0; i < rowsize; i++) + { + if (cur[0] - prv[0] > diff || + cur[1] - prv[1] > diff || + cur[2] - prv[2] > diff) + row0[i] = 1; + else if (prv[0] - cur[0] > diff || + prv[1] - cur[1] > diff || + prv[2] - cur[2] > diff) + row0[i] = -1; + else + row0[i] = 0; + cur += mpi->bpp/8; + prv += mpi->bpp/8; + // check if row0 is 1 but row1 is 0, and row2 is 1 or row2 is 0 + // but row3 is 1 so it's interlaced ptr (nok++) + if (j > 2 && row0[i] > 0 && (row1[i] < 0 || (!row1[i] && row2[i] < 0)) && + (++nok) > max) + break; + } + cur0 += mpi->stride[0]; + prv0 += mpi->stride[0]; + // rotate rows + cur = row2; + row2 = row1; + row1 = row0; + row0 = cur; } } // check if number of interlaced is above of max if (nok > max) { -// vf->priv->dfr++; +// vf->priv->dfr++; if (vf->priv->was_dint < 1) // can skip at most one frame! { - vf->priv->was_dint++; -// vf->priv->rdfr++; -// mp_msg (MSGT_VFILTER, MSGL_INFO, "DI:%d/%d ", vf->priv->rdfr, vf->priv->dfr); - return 0; + vf->priv->was_dint++; +// vf->priv->rdfr++; +// mp_msg (MSGT_VFILTER, MSGL_INFO, "DI:%d/%d ", vf->priv->rdfr, vf->priv->dfr); + return 0; } } vf->priv->was_dint = 0; @@ -194,7 +194,7 @@ static int put_image (struct vf_instance *vf, mp_image_t *mpi, double pts) static int vf_open(vf_instance_t *vf, char *args){ vf->config = config; vf->put_image = put_image; -// vf->default_reqs=VFCAP_ACCEPT_STRIDE; +// vf->default_reqs=VFCAP_ACCEPT_STRIDE; vf->priv = malloc (sizeof(struct vf_priv_s)); vf->priv->sense = 0.1; vf->priv->level = 0.15; diff --git a/mplayer/libmpcodecs/vf_divtc.c b/mplayer/libmpcodecs/vf_divtc.c index 32c4d447..57106605 100644 --- a/mplayer/libmpcodecs/vf_divtc.c +++ b/mplayer/libmpcodecs/vf_divtc.c @@ -56,39 +56,39 @@ static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns) { volatile short out[4]; __asm__ ( - "movl $8, %%ecx \n\t" - "pxor %%mm4, %%mm4 \n\t" - "pxor %%mm7, %%mm7 \n\t" - - ASMALIGN(4) - "1: \n\t" - - "movq (%%"REG_S"), %%mm0 \n\t" - "movq (%%"REG_S"), %%mm2 \n\t" - "add %%"REG_a", %%"REG_S" \n\t" - "movq (%%"REG_D"), %%mm1 \n\t" - "add %%"REG_b", %%"REG_D" \n\t" - "psubusb %%mm1, %%mm2 \n\t" - "psubusb %%mm0, %%mm1 \n\t" - "movq %%mm2, %%mm0 \n\t" - "movq %%mm1, %%mm3 \n\t" - "punpcklbw %%mm7, %%mm0 \n\t" - "punpcklbw %%mm7, %%mm1 \n\t" - "punpckhbw %%mm7, %%mm2 \n\t" - "punpckhbw %%mm7, %%mm3 \n\t" - "paddw %%mm0, %%mm4 \n\t" - "paddw %%mm1, %%mm4 \n\t" - "paddw %%mm2, %%mm4 \n\t" - "paddw %%mm3, %%mm4 \n\t" - - "decl %%ecx \n\t" - "jnz 1b \n\t" - "movq %%mm4, (%%"REG_d") \n\t" - "emms \n\t" - : - : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out) - : "%ecx", "memory" - ); + "movl $8, %%ecx \n\t" + "pxor %%mm4, %%mm4 \n\t" + "pxor %%mm7, %%mm7 \n\t" + + ASMALIGN(4) + "1: \n\t" + + "movq (%%"REG_S"), %%mm0 \n\t" + "movq (%%"REG_S"), %%mm2 \n\t" + "add %%"REG_a", %%"REG_S" \n\t" + "movq (%%"REG_D"), %%mm1 \n\t" + "add %%"REG_b", %%"REG_D" \n\t" + "psubusb %%mm1, %%mm2 \n\t" + "psubusb %%mm0, %%mm1 \n\t" + "movq %%mm2, %%mm0 \n\t" + "movq %%mm1, %%mm3 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "punpckhbw %%mm7, %%mm3 \n\t" + "paddw %%mm0, %%mm4 \n\t" + "paddw %%mm1, %%mm4 \n\t" + "paddw %%mm2, %%mm4 \n\t" + "paddw %%mm3, %%mm4 \n\t" + + "decl %%ecx \n\t" + "jnz 1b \n\t" + "movq %%mm4, (%%"REG_d") \n\t" + "emms \n\t" + : + : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out) + : "%ecx", "memory" + ); return out[0]+out[1]+out[2]+out[3]; } #endif @@ -99,7 +99,7 @@ static int diff_C(unsigned char *old, unsigned char *new, int os, int ns) for(y=8; y; y--, new+=ns, old+=os) for(x=8; x; x--) - d+=abs(new[x]-old[x]); + d+=abs(new[x]-old[x]); return d; } @@ -107,19 +107,19 @@ static int diff_C(unsigned char *old, unsigned char *new, int os, int ns) static int (*diff)(unsigned char *, unsigned char *, int, int); static int diff_plane(unsigned char *old, unsigned char *new, - int w, int h, int os, int ns, int arg) + int w, int h, int os, int ns, int arg) { int x, y, d, max=0, sum=0, n=0; for(y=0; ymax) max=d; - sum+=d; - n++; - } + { + d=diff(old+x+y*os, new+x+y*ns, os, ns); + if(d>max) max=d; + sum+=d; + n++; + } } return (sum+n*max)/2; @@ -127,21 +127,21 @@ static int diff_plane(unsigned char *old, unsigned char *new, /* static unsigned int checksum_plane(unsigned char *p, unsigned char *z, - int w, int h, int s, int zs, int arg) + int w, int h, int s, int zs, int arg) { unsigned int shift, sum; unsigned char *e; for(sum=0; h; h--, p+=s-w) for(e=p+w, shift=32; p>32^wsum)); @@ -168,22 +168,22 @@ static unsigned int checksum_plane(unsigned char *p, unsigned char *z, #endif for(sum^=(t<>(32-shift)); p=threshold) - *d=(t=(*d<<1)-*s)<0?0:t>255?255:t; + if(abs(*d-*s)>=threshold) + *d=(t=(*d<<1)-*s)<0?0:t>255?255:t; return 0; } @@ -194,23 +194,23 @@ static int copyop(unsigned char *d, unsigned char *s, int bpl, int h, int dstrid } static int imgop(int(*planeop)(unsigned char *, unsigned char *, - int, int, int, int, int), - mp_image_t *dst, mp_image_t *src, int arg) + int, int, int, int, int), + mp_image_t *dst, mp_image_t *src, int arg) { if(dst->flags&MP_IMGFLAG_PLANAR) return planeop(dst->planes[0], src?src->planes[0]:0, - dst->w, dst->h, - dst->stride[0], src?src->stride[0]:0, arg)+ - planeop(dst->planes[1], src?src->planes[1]:0, - dst->chroma_width, dst->chroma_height, - dst->stride[1], src?src->stride[1]:0, arg)+ - planeop(dst->planes[2], src?src->planes[2]:0, - dst->chroma_width, dst->chroma_height, - dst->stride[2], src?src->stride[2]:0, arg); + dst->w, dst->h, + dst->stride[0], src?src->stride[0]:0, arg)+ + planeop(dst->planes[1], src?src->planes[1]:0, + dst->chroma_width, dst->chroma_height, + dst->stride[1], src?src->stride[1]:0, arg)+ + planeop(dst->planes[2], src?src->planes[2]:0, + dst->chroma_width, dst->chroma_height, + dst->stride[2], src?src->stride[2]:0, arg); return planeop(dst->planes[0], src?src->planes[0]:0, - dst->w*(dst->bpp/8), dst->h, - dst->stride[0], src?src->stride[0]:0, arg); + dst->w*(dst->bpp/8), dst->h, + dst->stride[0], src?src->stride[0]:0, arg); } /* @@ -222,7 +222,7 @@ static int imgop(int(*planeop)(unsigned char *, unsigned char *, */ static int match(struct vf_priv_s *p, int *diffs, - int phase1, int phase2, double *strength) + int phase1, int phase2, double *strength) { static const int pattern1[]={ -4, 1, 1, 1, 1 }, pattern2[]={ -2, -3, 4, 4, -3 }, *pattern; @@ -233,12 +233,12 @@ static int match(struct vf_priv_s *p, int *diffs, for(f=0; f<5; f++) { if(phase1<0 || phase2<0 || f==phase1 || f==phase2) - { - for(n=t[f]=0; n<5; n++) - t[f]+=diffs[n]*pattern[(n-f+5)%5]; - } + { + for(n=t[f]=0; n<5; n++) + t[f]+=diffs[n]*pattern[(n-f+5)%5]; + } else - t[f]=INT_MIN; + t[f]=INT_MIN; } /* find the best match */ @@ -249,7 +249,7 @@ static int match(struct vf_priv_s *p, int *diffs, { /* the second best match */ for(f=m?0:1, n=f+1; n<5; n++) - if(n!=m && t[n]>t[f]) f=n; + if(n!=m && t[n]>t[f]) f=n; *strength=(t[m]>0?(double)(t[m]-t[f])/t[m]:0.0); } @@ -266,9 +266,9 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) double d; dmpi=vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | - MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, - mpi->width, mpi->height); + MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | + MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, + mpi->width, mpi->height); vf_clone_mpi_attributes(dmpi, mpi); newphase=p->phase; @@ -276,73 +276,73 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) switch(p->pass) { case 1: - fprintf(p->file, "%08x %d\n", - (unsigned int)imgop((void *)checksum_plane, mpi, 0, 0), - p->frameno?imgop(diff_plane, dmpi, mpi, 0):0); - break; + fprintf(p->file, "%08x %d\n", + (unsigned int)imgop((void *)checksum_plane, mpi, 0, 0), + p->frameno?imgop(diff_plane, dmpi, mpi, 0):0); + break; case 2: - if(p->frameno/5>p->bcount) - { - mp_msg(MSGT_VFILTER, MSGL_ERR, - "\n%s: Log file ends prematurely! " - "Switching to one pass mode.\n", vf->info->name); - p->pass=0; - break; - } - - checksum=(unsigned int)imgop((void *)checksum_plane, mpi, 0, 0); - - if(checksum!=p->csdata[p->frameno]) - { - for(f=0; f<100; f++) - if(p->frameno+ffcount && p->csdata[p->frameno+f]==checksum) - break; - else if(p->frameno-f>=0 && p->csdata[p->frameno-f]==checksum) - { - f=-f; - break; - } - - if(f<100) - { - mp_msg(MSGT_VFILTER, MSGL_INFO, - "\n%s: Mismatch with pass-1: %+d frame(s).\n", - vf->info->name, f); - - p->frameno+=f; - p->misscount=0; - } - else if(p->misscount++>=30) - { - mp_msg(MSGT_VFILTER, MSGL_ERR, - "\n%s: Sync with pass-1 lost! " - "Switching to one pass mode.\n", vf->info->name); - p->pass=0; - break; - } - } - - n=(p->frameno)/5; - if(n>=p->bcount) n=p->bcount-1; - - newphase=p->bdata[n]; - break; + if(p->frameno/5>p->bcount) + { + mp_msg(MSGT_VFILTER, MSGL_ERR, + "\n%s: Log file ends prematurely! " + "Switching to one pass mode.\n", vf->info->name); + p->pass=0; + break; + } + + checksum=(unsigned int)imgop((void *)checksum_plane, mpi, 0, 0); + + if(checksum!=p->csdata[p->frameno]) + { + for(f=0; f<100; f++) + if(p->frameno+ffcount && p->csdata[p->frameno+f]==checksum) + break; + else if(p->frameno-f>=0 && p->csdata[p->frameno-f]==checksum) + { + f=-f; + break; + } + + if(f<100) + { + mp_msg(MSGT_VFILTER, MSGL_INFO, + "\n%s: Mismatch with pass-1: %+d frame(s).\n", + vf->info->name, f); + + p->frameno+=f; + p->misscount=0; + } + else if(p->misscount++>=30) + { + mp_msg(MSGT_VFILTER, MSGL_ERR, + "\n%s: Sync with pass-1 lost! " + "Switching to one pass mode.\n", vf->info->name); + p->pass=0; + break; + } + } + + n=(p->frameno)/5; + if(n>=p->bcount) n=p->bcount-1; + + newphase=p->bdata[n]; + break; default: - if(p->frameno) - { - int *sump=p->sum+p->frameno%5, - *histp=p->history+p->frameno%p->window; + if(p->frameno) + { + int *sump=p->sum+p->frameno%5, + *histp=p->history+p->frameno%p->window; - *sump-=*histp; - *sump+=(*histp=imgop(diff_plane, dmpi, mpi, 0)); - } + *sump-=*histp; + *sump+=(*histp=imgop(diff_plane, dmpi, mpi, 0)); + } - m=match(p, p->sum, -1, -1, &d); + m=match(p, p->sum, -1, -1, &d); - if(d>=p->threshold) - newphase=m; + if(d>=p->threshold) + newphase=m; } n=p->ocount++%5; @@ -351,29 +351,29 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { p->phase=newphase; mp_msg(MSGT_VFILTER, MSGL_STATUS, - "\n%s: Telecine phase %d.\n", vf->info->name, p->phase); + "\n%s: Telecine phase %d.\n", vf->info->name, p->phase); } switch((p->frameno++-p->phase+10)%5) { case 0: - imgop(copyop, dmpi, mpi, 0); - return 0; + imgop(copyop, dmpi, mpi, 0); + return 0; case 4: - if(p->deghost>0) - { - tmpi=vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | - MP_IMGFLAG_READABLE, - mpi->width, mpi->height); - vf_clone_mpi_attributes(tmpi, mpi); - - imgop(copyop, tmpi, mpi, 0); - imgop(deghost_plane, tmpi, dmpi, p->deghost); - imgop(copyop, dmpi, mpi, 0); - return vf_next_put_image(vf, tmpi, MP_NOPTS_VALUE); - } + if(p->deghost>0) + { + tmpi=vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | + MP_IMGFLAG_READABLE, + mpi->width, mpi->height); + vf_clone_mpi_attributes(tmpi, mpi); + + imgop(copyop, tmpi, mpi, 0); + imgop(deghost_plane, tmpi, dmpi, p->deghost); + imgop(copyop, dmpi, mpi, 0); + return vf_next_put_image(vf, tmpi, MP_NOPTS_VALUE); + } } imgop(copyop, dmpi, mpi, 0); @@ -395,20 +395,20 @@ static int analyze(struct vf_priv_s *p) while(fgets(lbuf, 256, p->file)) { if(n>=bufsize-19) - { - bufsize=bufsize?bufsize*2:30000; - if((bp=realloc(buf, bufsize*sizeof *buf))) buf=bp; - if((cp=realloc(cbuf, bufsize*sizeof *cbuf))) cbuf=cp; - - if(!bp || !cp) - { - mp_msg(MSGT_VFILTER, MSGL_FATAL, "%s: Not enough memory.\n", - vf_info_divtc.name); - free(buf); - free(cbuf); - return 0; - } - } + { + bufsize=bufsize?bufsize*2:30000; + if((bp=realloc(buf, bufsize*sizeof *buf))) buf=bp; + if((cp=realloc(cbuf, bufsize*sizeof *cbuf))) cbuf=cp; + + if(!bp || !cp) + { + mp_msg(MSGT_VFILTER, MSGL_FATAL, "%s: Not enough memory.\n", + vf_info_divtc.name); + free(buf); + free(cbuf); + return 0; + } + } sscanf(lbuf, "%x %d", cbuf+n, buf+n); n++; } @@ -416,7 +416,7 @@ static int analyze(struct vf_priv_s *p) if(!n) { mp_msg(MSGT_VFILTER, MSGL_FATAL, "%s: Empty 2-pass log file.\n", - vf_info_divtc.name); + vf_info_divtc.name); free(buf); free(cbuf); return 0; @@ -452,36 +452,36 @@ static int analyze(struct vf_priv_s *p) double s0=0.0, s1=0.0; for(f=0; fdeghost=0; match(p, buf+f, -1, -1, &d); s0+=d; - p->deghost=1; match(p, buf+f, -1, -1, &d); s1+=d; - } + { + p->deghost=0; match(p, buf+f, -1, -1, &d); s0+=d; + p->deghost=1; match(p, buf+f, -1, -1, &d); s1+=d; + } p->deghost=s1>s0?deghost:0; mp_msg(MSGT_VFILTER, MSGL_INFO, - "%s: Deghosting %-3s (relative pattern strength %+.2fdB).\n", - vf_info_divtc.name, - p->deghost?"ON":"OFF", - 10.0*log10(s1/s0)); + "%s: Deghosting %-3s (relative pattern strength %+.2fdB).\n", + vf_info_divtc.name, + p->deghost?"ON":"OFF", + 10.0*log10(s1/s0)); } /* analyze the data */ for(f=0; f<5; f++) for(sum[f]=0, n=-15; n<20; n+=5) - sum[f]+=buf[n+f]; + sum[f]+=buf[n+f]; for(f=0; f=p->threshold) - pbuf[f]=m; + pbuf[f]=m; if(ff && mf; j--) - if(pbuf[j-1]==pbuf[f-1] && pbuf[j]==pbuf[n]) break; - for(s=m; sf && mf; j--) + if(pbuf[j-1]==pbuf[f-1] && pbuf[j]==pbuf[n]) break; + for(s=m; sinfo->name); + "%s: Not enough memory.\n", vf->info->name); fail: uninit(vf); free(args); @@ -624,76 +624,76 @@ static int vf_open(vf_instance_t *vf, char *args) if((ap=args)) while(*ap) - { - q=ap; - if((ap=strchr(q, ':'))) *ap++=0; else ap=q+strlen(q); - if((a=strchr(q, '='))) *a++=0; else a=q+strlen(q); - - switch(*q) - { - case 0: break; - case 'f': filename=a; break; - case 't': p->threshold=atof(a); break; - case 'w': p->window=5*(atoi(a)+4)/5; break; - case 'd': p->deghost=atoi(a); break; - case 'p': - if(q[1]=='h') p->phase=atoi(a); - else p->pass=atoi(a); - break; - - case 'h': - mp_msg(MSGT_VFILTER, MSGL_INFO, - "\n%s options:\n\n" - "pass=1|2 - Use 2-pass mode.\n" - "file=filename - Set the 2-pass log file name " - "(default %s).\n" - "threshold=value - Set the pattern recognition " - "sensitivity (default %g).\n" - "deghost=value - Select deghosting threshold " - "(default %d).\n" - "window=numframes - Set the statistics window " - "for 1-pass mode (default %d).\n" - "phase=0|1|2|3|4 - Set the initial phase " - "for 1-pass mode (default %d).\n\n" - "The option names can be abbreviated to the shortest " - "unique prefix.\n\n", - vf->info->name, filename, p->threshold, p->deghost, - p->window, p->phase%5); - break; - - default: - mp_msg(MSGT_VFILTER, MSGL_FATAL, - "%s: Unknown argument %s.\n", vf->info->name, q); - goto fail; - } - } + { + q=ap; + if((ap=strchr(q, ':'))) *ap++=0; else ap=q+strlen(q); + if((a=strchr(q, '='))) *a++=0; else a=q+strlen(q); + + switch(*q) + { + case 0: break; + case 'f': filename=a; break; + case 't': p->threshold=atof(a); break; + case 'w': p->window=5*(atoi(a)+4)/5; break; + case 'd': p->deghost=atoi(a); break; + case 'p': + if(q[1]=='h') p->phase=atoi(a); + else p->pass=atoi(a); + break; + + case 'h': + mp_msg(MSGT_VFILTER, MSGL_INFO, + "\n%s options:\n\n" + "pass=1|2 - Use 2-pass mode.\n" + "file=filename - Set the 2-pass log file name " + "(default %s).\n" + "threshold=value - Set the pattern recognition " + "sensitivity (default %g).\n" + "deghost=value - Select deghosting threshold " + "(default %d).\n" + "window=numframes - Set the statistics window " + "for 1-pass mode (default %d).\n" + "phase=0|1|2|3|4 - Set the initial phase " + "for 1-pass mode (default %d).\n\n" + "The option names can be abbreviated to the shortest " + "unique prefix.\n\n", + vf->info->name, filename, p->threshold, p->deghost, + p->window, p->phase%5); + break; + + default: + mp_msg(MSGT_VFILTER, MSGL_FATAL, + "%s: Unknown argument %s.\n", vf->info->name, q); + goto fail; + } + } switch(p->pass) { case 1: - if(!(p->file=fopen(filename, "w"))) - { - mp_msg(MSGT_VFILTER, MSGL_FATAL, - "%s: Can't create file %s.\n", vf->info->name, filename); - goto fail; - } + if(!(p->file=fopen(filename, "w"))) + { + mp_msg(MSGT_VFILTER, MSGL_FATAL, + "%s: Can't create file %s.\n", vf->info->name, filename); + goto fail; + } - break; + break; case 2: - if(!(p->file=fopen(filename, "r"))) - { - mp_msg(MSGT_VFILTER, MSGL_FATAL, - "%s: Can't open file %s.\n", vf->info->name, filename); - goto fail; - } - - if(!analyze(p)) - goto fail; - - fclose(p->file); - p->file=0; - break; + if(!(p->file=fopen(filename, "r"))) + { + mp_msg(MSGT_VFILTER, MSGL_FATAL, + "%s: Can't open file %s.\n", vf->info->name, filename); + goto fail; + } + + if(!analyze(p)) + goto fail; + + fclose(p->file); + p->file=0; + break; } if(p->window<5) p->window=5; diff --git a/mplayer/libmpcodecs/vf_down3dright.c b/mplayer/libmpcodecs/vf_down3dright.c index edc643e8..c755cdaa 100644 --- a/mplayer/libmpcodecs/vf_down3dright.c +++ b/mplayer/libmpcodecs/vf_down3dright.c @@ -32,135 +32,135 @@ #include "libvo/fastmemcpy.h" struct vf_priv_s { - int skipline; - int scalew; - int scaleh; + int skipline; + int scalew; + int scaleh; }; static void toright(unsigned char *dst[3], unsigned char *src[3], - int dststride[3], int srcstride[3], - int w, int h, struct vf_priv_s* p) + int dststride[3], int srcstride[3], + int w, int h, struct vf_priv_s* p) { - int k; + int k; - for (k = 0; k < 3; k++) { - unsigned char* fromL = src[k]; - unsigned char* fromR = src[k]; - unsigned char* to = dst[k]; - int src = srcstride[k]; + for (k = 0; k < 3; k++) { + unsigned char* fromL = src[k]; + unsigned char* fromR = src[k]; + unsigned char* to = dst[k]; + int src = srcstride[k]; int dst = dststride[k]; - int ss; - unsigned int dd; - int i; - - if (k > 0) { - i = h / 4 - p->skipline / 2; - ss = src * (h / 4 + p->skipline / 2); - dd = w / 4; - } else { - i = h / 2 - p->skipline; + int ss; + unsigned int dd; + int i; + + if (k > 0) { + i = h / 4 - p->skipline / 2; + ss = src * (h / 4 + p->skipline / 2); + dd = w / 4; + } else { + i = h / 2 - p->skipline; ss = src * (h / 2 + p->skipline); - dd = w / 2; - } - fromR += ss; - for ( ; i > 0; i--) { + dd = w / 2; + } + fromR += ss; + for ( ; i > 0; i--) { int j; - unsigned char* t = to; - unsigned char* sL = fromL; - unsigned char* sR = fromR; - - if (p->scalew == 1) { - for (j = dd; j > 0; j--) { - *t++ = (sL[0] + sL[1]) / 2; - sL+=2; - } - for (j = dd ; j > 0; j--) { - *t++ = (sR[0] + sR[1]) / 2; - sR+=2; - } - } else { - for (j = dd * 2 ; j > 0; j--) - *t++ = *sL++; - for (j = dd * 2 ; j > 0; j--) - *t++ = *sR++; - } - if (p->scaleh == 1) { - fast_memcpy(to + dst, to, dst); + unsigned char* t = to; + unsigned char* sL = fromL; + unsigned char* sR = fromR; + + if (p->scalew == 1) { + for (j = dd; j > 0; j--) { + *t++ = (sL[0] + sL[1]) / 2; + sL+=2; + } + for (j = dd ; j > 0; j--) { + *t++ = (sR[0] + sR[1]) / 2; + sR+=2; + } + } else { + for (j = dd * 2 ; j > 0; j--) + *t++ = *sL++; + for (j = dd * 2 ; j > 0; j--) + *t++ = *sR++; + } + if (p->scaleh == 1) { + fast_memcpy(to + dst, to, dst); to += dst; - } - to += dst; - fromL += src; - fromR += src; - } - //printf("K %d %d %d %d %d \n", k, w, h, src, dst); - } + } + to += dst; + fromL += src; + fromR += src; + } + //printf("K %d %d %d %d %d \n", k, w, h, src, dst); + } } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { - mp_image_t *dmpi; + mp_image_t *dmpi; - // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next, IMGFMT_YV12, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | - (vf->priv->scaleh == 1) ? MP_IMGFLAG_READABLE : 0, - mpi->w * vf->priv->scalew, - mpi->h / vf->priv->scaleh - vf->priv->skipline); + // hope we'll get DR buffer: + dmpi=vf_get_image(vf->next, IMGFMT_YV12, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | + (vf->priv->scaleh == 1) ? MP_IMGFLAG_READABLE : 0, + mpi->w * vf->priv->scalew, + mpi->h / vf->priv->scaleh - vf->priv->skipline); - toright(dmpi->planes, mpi->planes, dmpi->stride, - mpi->stride, mpi->w, mpi->h, vf->priv); + toright(dmpi->planes, mpi->planes, dmpi->stride, + mpi->stride, mpi->w, mpi->h, vf->priv); - return vf_next_put_image(vf,dmpi, pts); + return vf_next_put_image(vf,dmpi, pts); } static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt) { - /* FIXME - also support UYVY output? */ - return vf_next_config(vf, width * vf->priv->scalew, - height / vf->priv->scaleh - vf->priv->skipline, d_width, d_height, flags, IMGFMT_YV12); + /* FIXME - also support UYVY output? */ + return vf_next_config(vf, width * vf->priv->scalew, + height / vf->priv->scaleh - vf->priv->skipline, d_width, d_height, flags, IMGFMT_YV12); } static int query_format(struct vf_instance *vf, unsigned int fmt) { - /* FIXME - really any YUV 4:2:0 input format should work */ - switch (fmt) { - case IMGFMT_YV12: - case IMGFMT_IYUV: - case IMGFMT_I420: - return vf_next_query_format(vf, IMGFMT_YV12); - } - return 0; + /* FIXME - really any YUV 4:2:0 input format should work */ + switch (fmt) { + case IMGFMT_YV12: + case IMGFMT_IYUV: + case IMGFMT_I420: + return vf_next_query_format(vf, IMGFMT_YV12); + } + return 0; } static void uninit(struct vf_instance *vf) { - free(vf->priv); + free(vf->priv); } static int vf_open(vf_instance_t *vf, char *args) { - vf->config=config; - vf->query_format=query_format; - vf->put_image=put_image; - vf->uninit=uninit; - - vf->priv = calloc(1, sizeof (struct vf_priv_s)); - vf->priv->skipline = 0; - vf->priv->scalew = 1; - vf->priv->scaleh = 2; - if (args) sscanf(args, "%d:%d:%d", &vf->priv->skipline, &vf->priv->scalew, &vf->priv->scaleh); - - return 1; + vf->config=config; + vf->query_format=query_format; + vf->put_image=put_image; + vf->uninit=uninit; + + vf->priv = calloc(1, sizeof (struct vf_priv_s)); + vf->priv->skipline = 0; + vf->priv->scalew = 1; + vf->priv->scaleh = 2; + if (args) sscanf(args, "%d:%d:%d", &vf->priv->skipline, &vf->priv->scalew, &vf->priv->scaleh); + + return 1; } const vf_info_t vf_info_down3dright = { - "convert stereo movie from top-bottom to left-right field", - "down3dright", - "Zdenek Kabelac", - "", - vf_open, - NULL + "convert stereo movie from top-bottom to left-right field", + "down3dright", + "Zdenek Kabelac", + "", + vf_open, + NULL }; diff --git a/mplayer/libmpcodecs/vf_dsize.c b/mplayer/libmpcodecs/vf_dsize.c index 3f5bc08a..983b3dc5 100644 --- a/mplayer/libmpcodecs/vf_dsize.c +++ b/mplayer/libmpcodecs/vf_dsize.c @@ -29,88 +29,88 @@ #include "vf.h" struct vf_priv_s { - int w, h; - int method; // aspect method, 0 -> downscale, 1-> upscale. +2 -> original aspect. - int round; - float aspect; + int w, h; + int method; // aspect method, 0 -> downscale, 1-> upscale. +2 -> original aspect. + int round; + float aspect; }; static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt) { - if (vf->priv->aspect < 0.001) { // did the user input aspect or w,h params - if (vf->priv->w == 0) vf->priv->w = d_width; - if (vf->priv->h == 0) vf->priv->h = d_height; - if (vf->priv->w == -1) vf->priv->w = width; - if (vf->priv->h == -1) vf->priv->h = height; - if (vf->priv->w == -2) vf->priv->w = vf->priv->h * (double)d_width / d_height; - if (vf->priv->w == -3) vf->priv->w = vf->priv->h * (double)width / height; - if (vf->priv->h == -2) vf->priv->h = vf->priv->w * (double)d_height / d_width; - if (vf->priv->h == -3) vf->priv->h = vf->priv->w * (double)height / width; - if (vf->priv->method > -1) { - double aspect = (vf->priv->method & 2) ? ((double)height / width) : ((double)d_height / d_width); - if ((vf->priv->h > vf->priv->w * aspect) ^ (vf->priv->method & 1)) { - vf->priv->h = vf->priv->w * aspect; - } else { - vf->priv->w = vf->priv->h / aspect; - } - } - if (vf->priv->round > 1) { // round up - vf->priv->w += (vf->priv->round - 1 - (vf->priv->w - 1) % vf->priv->round); - vf->priv->h += (vf->priv->round - 1 - (vf->priv->h - 1) % vf->priv->round); - } - d_width = vf->priv->w; - d_height = vf->priv->h; - } else { - if (vf->priv->aspect * height > width) { - d_width = height * vf->priv->aspect + .5; - d_height = height; - } else { - d_height = width / vf->priv->aspect + .5; - d_width = width; - } - } - return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt); + if (vf->priv->aspect < 0.001) { // did the user input aspect or w,h params + if (vf->priv->w == 0) vf->priv->w = d_width; + if (vf->priv->h == 0) vf->priv->h = d_height; + if (vf->priv->w == -1) vf->priv->w = width; + if (vf->priv->h == -1) vf->priv->h = height; + if (vf->priv->w == -2) vf->priv->w = vf->priv->h * (double)d_width / d_height; + if (vf->priv->w == -3) vf->priv->w = vf->priv->h * (double)width / height; + if (vf->priv->h == -2) vf->priv->h = vf->priv->w * (double)d_height / d_width; + if (vf->priv->h == -3) vf->priv->h = vf->priv->w * (double)height / width; + if (vf->priv->method > -1) { + double aspect = (vf->priv->method & 2) ? ((double)height / width) : ((double)d_height / d_width); + if ((vf->priv->h > vf->priv->w * aspect) ^ (vf->priv->method & 1)) { + vf->priv->h = vf->priv->w * aspect; + } else { + vf->priv->w = vf->priv->h / aspect; + } + } + if (vf->priv->round > 1) { // round up + vf->priv->w += (vf->priv->round - 1 - (vf->priv->w - 1) % vf->priv->round); + vf->priv->h += (vf->priv->round - 1 - (vf->priv->h - 1) % vf->priv->round); + } + d_width = vf->priv->w; + d_height = vf->priv->h; + } else { + if (vf->priv->aspect * height > width) { + d_width = height * vf->priv->aspect + .5; + d_height = height; + } else { + d_height = width / vf->priv->aspect + .5; + d_width = width; + } + } + return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt); } static void uninit(vf_instance_t *vf) { - free(vf->priv); - vf->priv = NULL; + free(vf->priv); + vf->priv = NULL; } static int vf_open(vf_instance_t *vf, char *args) { - vf->config = config; - vf->draw_slice = vf_next_draw_slice; - vf->uninit = uninit; - //vf->default_caps = 0; - vf->priv = calloc(sizeof(struct vf_priv_s), 1); - vf->priv->aspect = 0.; - vf->priv->w = -1; - vf->priv->h = -1; - vf->priv->method = -1; - vf->priv->round = 1; - if (args) { - if (strchr(args, '/')) { - int w, h; - sscanf(args, "%d/%d", &w, &h); - vf->priv->aspect = (float)w/h; - } else if (strchr(args, '.')) { - sscanf(args, "%f", &vf->priv->aspect); - } else { - sscanf(args, "%d:%d:%d:%d", &vf->priv->w, &vf->priv->h, &vf->priv->method, &vf->priv->round); - } - } - if ((vf->priv->aspect < 0.) || (vf->priv->w < -3) || (vf->priv->h < -3) || - ((vf->priv->w < -1) && (vf->priv->h < -1)) || - (vf->priv->method < -1) || (vf->priv->method > 3) || - (vf->priv->round < 0)) { - mp_msg(MSGT_VFILTER, MSGL_ERR, "[dsize] Illegal value(s): aspect: %f w: %d h: %d aspect_method: %d round: %d\n", vf->priv->aspect, vf->priv->w, vf->priv->h, vf->priv->method, vf->priv->round); - free(vf->priv); vf->priv = NULL; - return -1; - } - return 1; + vf->config = config; + vf->draw_slice = vf_next_draw_slice; + vf->uninit = uninit; + //vf->default_caps = 0; + vf->priv = calloc(sizeof(struct vf_priv_s), 1); + vf->priv->aspect = 0.; + vf->priv->w = -1; + vf->priv->h = -1; + vf->priv->method = -1; + vf->priv->round = 1; + if (args) { + if (strchr(args, '/')) { + int w, h; + sscanf(args, "%d/%d", &w, &h); + vf->priv->aspect = (float)w/h; + } else if (strchr(args, '.')) { + sscanf(args, "%f", &vf->priv->aspect); + } else { + sscanf(args, "%d:%d:%d:%d", &vf->priv->w, &vf->priv->h, &vf->priv->method, &vf->priv->round); + } + } + if ((vf->priv->aspect < 0.) || (vf->priv->w < -3) || (vf->priv->h < -3) || + ((vf->priv->w < -1) && (vf->priv->h < -1)) || + (vf->priv->method < -1) || (vf->priv->method > 3) || + (vf->priv->round < 0)) { + mp_msg(MSGT_VFILTER, MSGL_ERR, "[dsize] Illegal value(s): aspect: %f w: %d h: %d aspect_method: %d round: %d\n", vf->priv->aspect, vf->priv->w, vf->priv->h, vf->priv->method, vf->priv->round); + free(vf->priv); vf->priv = NULL; + return -1; + } + return 1; } const vf_info_t vf_info_dsize = { diff --git a/mplayer/libmpcodecs/vf_eq.c b/mplayer/libmpcodecs/vf_eq.c index 7e5f6057..c622d29b 100644 --- a/mplayer/libmpcodecs/vf_eq.c +++ b/mplayer/libmpcodecs/vf_eq.c @@ -35,9 +35,9 @@ #include "m_struct.h" static struct vf_priv_s { - unsigned char *buf; - int brightness; - int contrast; + unsigned char *buf; + int brightness; + int contrast; } const vf_priv_dflt = { NULL, 0, @@ -46,192 +46,192 @@ static struct vf_priv_s { #if HAVE_MMX static void process_MMX(unsigned char *dest, int dstride, unsigned char *src, int sstride, - int w, int h, int brightness, int contrast) + int w, int h, int brightness, int contrast) { - int i; - int pel; - int dstep = dstride-w; - int sstep = sstride-w; - short brvec[4]; - short contvec[4]; - - contrast = ((contrast+100)*256*16)/100; - brightness = ((brightness+100)*511)/200-128 - contrast/32; - - brvec[0] = brvec[1] = brvec[2] = brvec[3] = brightness; - contvec[0] = contvec[1] = contvec[2] = contvec[3] = contrast; - - while (h--) { - __asm__ volatile ( - "movq (%5), %%mm3 \n\t" - "movq (%6), %%mm4 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "movl %4, %%eax\n\t" - ASMALIGN(4) - "1: \n\t" - "movq (%0), %%mm1 \n\t" - "movq (%0), %%mm2 \n\t" - "punpcklbw %%mm0, %%mm1 \n\t" - "punpckhbw %%mm0, %%mm2 \n\t" - "psllw $4, %%mm1 \n\t" - "psllw $4, %%mm2 \n\t" - "pmulhw %%mm4, %%mm1 \n\t" - "pmulhw %%mm4, %%mm2 \n\t" - "paddw %%mm3, %%mm1 \n\t" - "paddw %%mm3, %%mm2 \n\t" - "packuswb %%mm2, %%mm1 \n\t" - "add $8, %0 \n\t" - "movq %%mm1, (%1) \n\t" - "add $8, %1 \n\t" - "decl %%eax \n\t" - "jnz 1b \n\t" - : "=r" (src), "=r" (dest) - : "0" (src), "1" (dest), "r" (w>>3), "r" (brvec), "r" (contvec) - : "%eax" - ); - - for (i = w&7; i; i--) - { - pel = ((*src++* contrast)>>12) + brightness; - if(pel&768) pel = (-pel)>>31; - *dest++ = pel; - } - - src += sstep; - dest += dstep; - } - __asm__ volatile ( "emms \n\t" ::: "memory" ); + int i; + int pel; + int dstep = dstride-w; + int sstep = sstride-w; + short brvec[4]; + short contvec[4]; + + contrast = ((contrast+100)*256*16)/100; + brightness = ((brightness+100)*511)/200-128 - contrast/32; + + brvec[0] = brvec[1] = brvec[2] = brvec[3] = brightness; + contvec[0] = contvec[1] = contvec[2] = contvec[3] = contrast; + + while (h--) { + __asm__ volatile ( + "movq (%5), %%mm3 \n\t" + "movq (%6), %%mm4 \n\t" + "pxor %%mm0, %%mm0 \n\t" + "movl %4, %%eax\n\t" + ASMALIGN(4) + "1: \n\t" + "movq (%0), %%mm1 \n\t" + "movq (%0), %%mm2 \n\t" + "punpcklbw %%mm0, %%mm1 \n\t" + "punpckhbw %%mm0, %%mm2 \n\t" + "psllw $4, %%mm1 \n\t" + "psllw $4, %%mm2 \n\t" + "pmulhw %%mm4, %%mm1 \n\t" + "pmulhw %%mm4, %%mm2 \n\t" + "paddw %%mm3, %%mm1 \n\t" + "paddw %%mm3, %%mm2 \n\t" + "packuswb %%mm2, %%mm1 \n\t" + "add $8, %0 \n\t" + "movq %%mm1, (%1) \n\t" + "add $8, %1 \n\t" + "decl %%eax \n\t" + "jnz 1b \n\t" + : "=r" (src), "=r" (dest) + : "0" (src), "1" (dest), "r" (w>>3), "r" (brvec), "r" (contvec) + : "%eax" + ); + + for (i = w&7; i; i--) + { + pel = ((*src++* contrast)>>12) + brightness; + if(pel&768) pel = (-pel)>>31; + *dest++ = pel; + } + + src += sstep; + dest += dstep; + } + __asm__ volatile ( "emms \n\t" ::: "memory" ); } #endif static void process_C(unsigned char *dest, int dstride, unsigned char *src, int sstride, - int w, int h, int brightness, int contrast) + int w, int h, int brightness, int contrast) { - int i; - int pel; - int dstep = dstride-w; - int sstep = sstride-w; - - contrast = ((contrast+100)*256*256)/100; - brightness = ((brightness+100)*511)/200-128 - contrast/512; - - while (h--) { - for (i = w; i; i--) - { - pel = ((*src++* contrast)>>16) + brightness; - if(pel&768) pel = (-pel)>>31; - *dest++ = pel; - } - src += sstep; - dest += dstep; - } + int i; + int pel; + int dstep = dstride-w; + int sstep = sstride-w; + + contrast = ((contrast+100)*256*256)/100; + brightness = ((brightness+100)*511)/200-128 - contrast/512; + + while (h--) { + for (i = w; i; i--) + { + pel = ((*src++* contrast)>>16) + brightness; + if(pel&768) pel = (-pel)>>31; + *dest++ = pel; + } + src += sstep; + dest += dstep; + } } static void (*process)(unsigned char *dest, int dstride, unsigned char *src, int sstride, - int w, int h, int brightness, int contrast); + int w, int h, int brightness, int contrast); /* FIXME: add packed yuv version of process */ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { - mp_image_t *dmpi; - - dmpi=vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_EXPORT, 0, - mpi->w, mpi->h); - - dmpi->stride[0] = mpi->stride[0]; - dmpi->planes[1] = mpi->planes[1]; - dmpi->planes[2] = mpi->planes[2]; - dmpi->stride[1] = mpi->stride[1]; - dmpi->stride[2] = mpi->stride[2]; - - if (!vf->priv->buf) vf->priv->buf = malloc(mpi->stride[0]*mpi->h); - - if ((vf->priv->brightness == 0) && (vf->priv->contrast == 0)) - dmpi->planes[0] = mpi->planes[0]; - else { - dmpi->planes[0] = vf->priv->buf; - process(dmpi->planes[0], dmpi->stride[0], - mpi->planes[0], mpi->stride[0], - mpi->w, mpi->h, vf->priv->brightness, - vf->priv->contrast); - } - - return vf_next_put_image(vf,dmpi, pts); + mp_image_t *dmpi; + + dmpi=vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_EXPORT, 0, + mpi->w, mpi->h); + + dmpi->stride[0] = mpi->stride[0]; + dmpi->planes[1] = mpi->planes[1]; + dmpi->planes[2] = mpi->planes[2]; + dmpi->stride[1] = mpi->stride[1]; + dmpi->stride[2] = mpi->stride[2]; + + if (!vf->priv->buf) vf->priv->buf = malloc(mpi->stride[0]*mpi->h); + + if ((vf->priv->brightness == 0) && (vf->priv->contrast == 0)) + dmpi->planes[0] = mpi->planes[0]; + else { + dmpi->planes[0] = vf->priv->buf; + process(dmpi->planes[0], dmpi->stride[0], + mpi->planes[0], mpi->stride[0], + mpi->w, mpi->h, vf->priv->brightness, + vf->priv->contrast); + } + + return vf_next_put_image(vf,dmpi, pts); } static int control(struct vf_instance *vf, int request, void* data) { - vf_equalizer_t *eq; - - switch (request) { - case VFCTRL_SET_EQUALIZER: - eq = data; - if (!strcmp(eq->item,"brightness")) { - vf->priv->brightness = eq->value; - return CONTROL_TRUE; - } - else if (!strcmp(eq->item,"contrast")) { - vf->priv->contrast = eq->value; - return CONTROL_TRUE; - } - break; - case VFCTRL_GET_EQUALIZER: - eq = data; - if (!strcmp(eq->item,"brightness")) { - eq->value = vf->priv->brightness; - return CONTROL_TRUE; - } - else if (!strcmp(eq->item,"contrast")) { - eq->value = vf->priv->contrast; - return CONTROL_TRUE; - } - break; - } - return vf_next_control(vf, request, data); + vf_equalizer_t *eq; + + switch (request) { + case VFCTRL_SET_EQUALIZER: + eq = data; + if (!strcmp(eq->item,"brightness")) { + vf->priv->brightness = eq->value; + return CONTROL_TRUE; + } + else if (!strcmp(eq->item,"contrast")) { + vf->priv->contrast = eq->value; + return CONTROL_TRUE; + } + break; + case VFCTRL_GET_EQUALIZER: + eq = data; + if (!strcmp(eq->item,"brightness")) { + eq->value = vf->priv->brightness; + return CONTROL_TRUE; + } + else if (!strcmp(eq->item,"contrast")) { + eq->value = vf->priv->contrast; + return CONTROL_TRUE; + } + break; + } + return vf_next_control(vf, request, data); } static int query_format(struct vf_instance *vf, unsigned int fmt) { - switch (fmt) { - case IMGFMT_YVU9: - case IMGFMT_IF09: - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_CLPL: - case IMGFMT_Y800: - case IMGFMT_Y8: - case IMGFMT_NV12: - case IMGFMT_NV21: - case IMGFMT_444P: - case IMGFMT_422P: - case IMGFMT_411P: - return vf_next_query_format(vf, fmt); - } - return 0; + switch (fmt) { + case IMGFMT_YVU9: + case IMGFMT_IF09: + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_CLPL: + case IMGFMT_Y800: + case IMGFMT_Y8: + case IMGFMT_NV12: + case IMGFMT_NV21: + case IMGFMT_444P: + case IMGFMT_422P: + case IMGFMT_411P: + return vf_next_query_format(vf, fmt); + } + return 0; } static void uninit(struct vf_instance *vf) { - free(vf->priv->buf); - free(vf->priv); + free(vf->priv->buf); + free(vf->priv); } static int vf_open(vf_instance_t *vf, char *args) { - vf->control=control; - vf->query_format=query_format; - vf->put_image=put_image; - vf->uninit=uninit; + vf->control=control; + vf->query_format=query_format; + vf->put_image=put_image; + vf->uninit=uninit; - process = process_C; + process = process_C; #if HAVE_MMX - if(gCpuCaps.hasMMX) process = process_MMX; + if(gCpuCaps.hasMMX) process = process_MMX; #endif - return 1; + return 1; } #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f) @@ -249,10 +249,10 @@ static const m_struct_t vf_opts = { }; const vf_info_t vf_info_eq = { - "soft video equalizer", - "eq", - "Richard Felker", - "", - vf_open, - &vf_opts + "soft video equalizer", + "eq", + "Richard Felker", + "", + vf_open, + &vf_opts }; diff --git a/mplayer/libmpcodecs/vf_field.c b/mplayer/libmpcodecs/vf_field.c index 80e7d2f7..e2cbfe47 100644 --- a/mplayer/libmpcodecs/vf_field.c +++ b/mplayer/libmpcodecs/vf_field.c @@ -34,27 +34,27 @@ struct vf_priv_s { static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ return vf_next_config(vf,width,height/2,d_width,d_height,flags,outfmt); } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->width, mpi->height/2); + MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->width, mpi->height/2); // set up mpi as a double-stride image of dmpi: vf->dmpi->planes[0]=mpi->planes[0]+mpi->stride[0]*vf->priv->field; vf->dmpi->stride[0]=2*mpi->stride[0]; if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){ vf->dmpi->planes[1]=mpi->planes[1]+ - mpi->stride[1]*vf->priv->field; - vf->dmpi->stride[1]=2*mpi->stride[1]; + mpi->stride[1]*vf->priv->field; + vf->dmpi->stride[1]=2*mpi->stride[1]; vf->dmpi->planes[2]=mpi->planes[2]+ - mpi->stride[2]*vf->priv->field; - vf->dmpi->stride[2]=2*mpi->stride[2]; + mpi->stride[2]*vf->priv->field; + vf->dmpi->stride[2]=2*mpi->stride[2]; } else - vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!! + vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!! return vf_next_put_image(vf,vf->dmpi, pts); } @@ -63,7 +63,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ static void uninit(struct vf_instance *vf) { - free(vf->priv); + free(vf->priv); } static int vf_open(vf_instance_t *vf, char *args){ diff --git a/mplayer/libmpcodecs/vf_fil.c b/mplayer/libmpcodecs/vf_fil.c index f1b3fec0..3adddd36 100644 --- a/mplayer/libmpcodecs/vf_fil.c +++ b/mplayer/libmpcodecs/vf_fil.c @@ -37,7 +37,7 @@ struct vf_priv_s { static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ int pixel_stride= (width+15)&~15; //FIXME this is ust a guess ... especially for non planar its somewhat bad one #if 0 @@ -65,24 +65,24 @@ static int config(struct vf_instance *vf, static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ if(mpi->flags&MP_IMGFLAG_DIRECT){ - // we've used DR, so we're ready... - return vf_next_put_image(vf,(mp_image_t*)mpi->priv, pts); + // we've used DR, so we're ready... + return vf_next_put_image(vf,(mp_image_t*)mpi->priv, pts); } vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, - vf->priv->width, vf->priv->height); + MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, + vf->priv->width, vf->priv->height); // set up mpi as a double-stride image of dmpi: vf->dmpi->planes[0]=mpi->planes[0]; vf->dmpi->stride[0]=(mpi->stride[0]*vf->priv->stridefactor)>>1; if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){ vf->dmpi->planes[1]=mpi->planes[1]; - vf->dmpi->stride[1]=(mpi->stride[1]*vf->priv->stridefactor)>>1; + vf->dmpi->stride[1]=(mpi->stride[1]*vf->priv->stridefactor)>>1; vf->dmpi->planes[2]=mpi->planes[2]; - vf->dmpi->stride[2]=(mpi->stride[2]*vf->priv->stridefactor)>>1; + vf->dmpi->stride[2]=(mpi->stride[2]*vf->priv->stridefactor)>>1; } else - vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!! + vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!! return vf_next_put_image(vf,vf->dmpi, pts); } @@ -91,7 +91,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ static void uninit(struct vf_instance *vf) { - free(vf->priv); + free(vf->priv); } static int vf_open(vf_instance_t *vf, char *args){ diff --git a/mplayer/libmpcodecs/vf_filmdint.c b/mplayer/libmpcodecs/vf_filmdint.c index d1b8d9d5..a0f165c1 100644 --- a/mplayer/libmpcodecs/vf_filmdint.c +++ b/mplayer/libmpcodecs/vf_filmdint.c @@ -33,10 +33,6 @@ #include "libvo/fastmemcpy.h" -#ifdef GEKKO -#include -#endif - #define NUM_STORED 4 enum pu_field_type_t { @@ -94,11 +90,7 @@ struct vf_priv_s { struct frame_stats stats[2]; struct metrics thres; char chflag; -#ifdef GEKKO - u64 diff_time, merge_time, decode_time, vo_time, filter_time; -#else double diff_time, merge_time, decode_time, vo_time, filter_time; -#endif }; #define PPZ { 2000, 2000, 0, 2000 } @@ -114,160 +106,160 @@ static const struct frame_stats pprs = {PPR,PPR,PPR,PPR,PPR,PPR,PPR,0,0,9999}; #endif #define PDIFFUB(X,Y,T) "movq " #X "," #T "\n\t" \ - "psubusb " #Y "," #T "\n\t" \ - "psubusb " #X "," #Y "\n\t" \ - "paddusb " #Y "," #T "\n\t" + "psubusb " #Y "," #T "\n\t" \ + "psubusb " #X "," #Y "\n\t" \ + "paddusb " #Y "," #T "\n\t" #define PDIFFUBT(X,Y,T) "movq " #X "," #T "\n\t" \ - "psubusb " #Y "," #T "\n\t" \ - "psubusb " #X "," #Y "\n\t" \ - "paddusb " #T "," #Y "\n\t" - -#define PSUMBW(X,T,Z) "movq " #X "," #T "\n\t" \ - "punpcklbw " #Z "," #X "\n\t" \ - "punpckhbw " #Z "," #T "\n\t" \ - "paddw " #T "," #X "\n\t" \ - "movq " #X "," #T "\n\t" \ - "psllq $32, " #T "\n\t" \ - "paddw " #T "," #X "\n\t" \ - "movq " #X "," #T "\n\t" \ - "psllq $16, " #T "\n\t" \ - "paddw " #T "," #X "\n\t" \ - "psrlq $48, " #X "\n\t" - -#define PSADBW(X,Y,T,Z) PDIFFUBT(X,Y,T) PSUMBW(Y,T,Z) + "psubusb " #Y "," #T "\n\t" \ + "psubusb " #X "," #Y "\n\t" \ + "paddusb " #T "," #Y "\n\t" + +#define PSUMBW(X,T,Z) "movq " #X "," #T "\n\t" \ + "punpcklbw " #Z "," #X "\n\t" \ + "punpckhbw " #Z "," #T "\n\t" \ + "paddw " #T "," #X "\n\t" \ + "movq " #X "," #T "\n\t" \ + "psllq $32, " #T "\n\t" \ + "paddw " #T "," #X "\n\t" \ + "movq " #X "," #T "\n\t" \ + "psllq $16, " #T "\n\t" \ + "paddw " #T "," #X "\n\t" \ + "psrlq $48, " #X "\n\t" + +#define PSADBW(X,Y,T,Z) PDIFFUBT(X,Y,T) PSUMBW(Y,T,Z) #define PMAXUB(X,Y) "psubusb " #X "," #Y "\n\tpaddusb " #X "," #Y "\n\t" #define PMAXUW(X,Y) "psubusw " #X "," #Y "\n\tpaddusw " #X "," #Y "\n\t" -#define PMINUBT(X,Y,T) "movq " #Y "," #T "\n\t" \ - "psubusb " #X "," #T "\n\t" \ - "psubusb " #T "," #Y "\n\t" -#define PAVGB(X,Y) "pavgusb " #X "," #Y "\n\t" +#define PMINUBT(X,Y,T) "movq " #Y "," #T "\n\t" \ + "psubusb " #X "," #T "\n\t" \ + "psubusb " #T "," #Y "\n\t" +#define PAVGB(X,Y) "pavgusb " #X "," #Y "\n\t" static inline void get_metrics_c(unsigned char *a, unsigned char *b, int as, int bs, int lines, - struct metrics *m) + struct metrics *m) { a -= as; b -= bs; do { - cmmx_t old_po = *(cmmx_t*)(a ); - cmmx_t po = *(cmmx_t*)(b ); - cmmx_t e = *(cmmx_t*)(b + bs); - cmmx_t old_o = *(cmmx_t*)(a + 2*as); - cmmx_t o = *(cmmx_t*)(b + 2*bs); - cmmx_t ne = *(cmmx_t*)(b + 3*bs); - cmmx_t old_no = *(cmmx_t*)(a + 4*as); - cmmx_t no = *(cmmx_t*)(b + 4*bs); - - cmmx_t qup_old_odd = p31avgb(old_o, old_po); - cmmx_t qup_odd = p31avgb( o, po); - cmmx_t qdown_old_odd = p31avgb(old_o, old_no); - cmmx_t qdown_odd = p31avgb( o, no); - - cmmx_t qup_even = p31avgb(ne, e); - cmmx_t qdown_even = p31avgb(e, ne); - - cmmx_t temp_up_diff = pdiffub(qdown_even, qup_old_odd); - cmmx_t noise_up_diff = pdiffub(qdown_even, qup_odd); - cmmx_t temp_down_diff = pdiffub(qup_even, qdown_old_odd); - cmmx_t noise_down_diff = pdiffub(qup_even, qdown_odd); - - cmmx_t odd_diff = pdiffub(o, old_o); - m->odd += psumbw(odd_diff); - m->even += psadbw(e, *(cmmx_t*)(a+as)); - - temp_up_diff = pminub(temp_up_diff, temp_down_diff); - temp_up_diff = pminub(temp_up_diff, odd_diff); - m->temp += psumbw(temp_up_diff); - noise_up_diff = pminub(noise_up_diff, odd_diff); - noise_up_diff = pminub(noise_up_diff, noise_down_diff); - - m->noise += psumbw(noise_up_diff); - a += 2*as; - b += 2*bs; + cmmx_t old_po = *(cmmx_t*)(a ); + cmmx_t po = *(cmmx_t*)(b ); + cmmx_t e = *(cmmx_t*)(b + bs); + cmmx_t old_o = *(cmmx_t*)(a + 2*as); + cmmx_t o = *(cmmx_t*)(b + 2*bs); + cmmx_t ne = *(cmmx_t*)(b + 3*bs); + cmmx_t old_no = *(cmmx_t*)(a + 4*as); + cmmx_t no = *(cmmx_t*)(b + 4*bs); + + cmmx_t qup_old_odd = p31avgb(old_o, old_po); + cmmx_t qup_odd = p31avgb( o, po); + cmmx_t qdown_old_odd = p31avgb(old_o, old_no); + cmmx_t qdown_odd = p31avgb( o, no); + + cmmx_t qup_even = p31avgb(ne, e); + cmmx_t qdown_even = p31avgb(e, ne); + + cmmx_t temp_up_diff = pdiffub(qdown_even, qup_old_odd); + cmmx_t noise_up_diff = pdiffub(qdown_even, qup_odd); + cmmx_t temp_down_diff = pdiffub(qup_even, qdown_old_odd); + cmmx_t noise_down_diff = pdiffub(qup_even, qdown_odd); + + cmmx_t odd_diff = pdiffub(o, old_o); + m->odd += psumbw(odd_diff); + m->even += psadbw(e, *(cmmx_t*)(a+as)); + + temp_up_diff = pminub(temp_up_diff, temp_down_diff); + temp_up_diff = pminub(temp_up_diff, odd_diff); + m->temp += psumbw(temp_up_diff); + noise_up_diff = pminub(noise_up_diff, odd_diff); + noise_up_diff = pminub(noise_up_diff, noise_down_diff); + + m->noise += psumbw(noise_up_diff); + a += 2*as; + b += 2*bs; } while (--lines); } static inline void get_metrics_fast_c(unsigned char *a, unsigned char *b, int as, int bs, - int lines, struct metrics *m) + int lines, struct metrics *m) { a -= as; b -= bs; do { - cmmx_t old_po = (*(cmmx_t*)(a ) >> 1) & ~SIGN_BITS; - cmmx_t po = (*(cmmx_t*)(b ) >> 1) & ~SIGN_BITS; - cmmx_t old_e = (*(cmmx_t*)(a + as) >> 1) & ~SIGN_BITS; - cmmx_t e = (*(cmmx_t*)(b + bs) >> 1) & ~SIGN_BITS; - cmmx_t old_o = (*(cmmx_t*)(a + 2*as) >> 1) & ~SIGN_BITS; - cmmx_t o = (*(cmmx_t*)(b + 2*bs) >> 1) & ~SIGN_BITS; - cmmx_t ne = (*(cmmx_t*)(b + 3*bs) >> 1) & ~SIGN_BITS; - cmmx_t old_no = (*(cmmx_t*)(a + 4*as) >> 1) & ~SIGN_BITS; - cmmx_t no = (*(cmmx_t*)(b + 4*bs) >> 1) & ~SIGN_BITS; - - cmmx_t qup_old_odd = p31avgb_s(old_o, old_po); - cmmx_t qup_odd = p31avgb_s( o, po); - cmmx_t qdown_old_odd = p31avgb_s(old_o, old_no); - cmmx_t qdown_odd = p31avgb_s( o, no); - - cmmx_t qup_even = p31avgb_s(ne, e); - cmmx_t qdown_even = p31avgb_s(e, ne); - - cmmx_t temp_up_diff = pdiffub_s(qdown_even, qup_old_odd); - cmmx_t noise_up_diff = pdiffub_s(qdown_even, qup_odd); - cmmx_t temp_down_diff = pdiffub_s(qup_even, qdown_old_odd); - cmmx_t noise_down_diff = pdiffub_s(qup_even, qdown_odd); - - cmmx_t odd_diff = pdiffub_s(o, old_o); - m->odd += psumbw_s(odd_diff) << 1; - m->even += psadbw_s(e, old_e) << 1; - - temp_up_diff = pminub_s(temp_up_diff, temp_down_diff); - temp_up_diff = pminub_s(temp_up_diff, odd_diff); - m->temp += psumbw_s(temp_up_diff) << 1; - noise_up_diff = pminub_s(noise_up_diff, odd_diff); - noise_up_diff = pminub_s(noise_up_diff, noise_down_diff); - - m->noise += psumbw_s(noise_up_diff) << 1; - a += 2*as; - b += 2*bs; + cmmx_t old_po = (*(cmmx_t*)(a ) >> 1) & ~SIGN_BITS; + cmmx_t po = (*(cmmx_t*)(b ) >> 1) & ~SIGN_BITS; + cmmx_t old_e = (*(cmmx_t*)(a + as) >> 1) & ~SIGN_BITS; + cmmx_t e = (*(cmmx_t*)(b + bs) >> 1) & ~SIGN_BITS; + cmmx_t old_o = (*(cmmx_t*)(a + 2*as) >> 1) & ~SIGN_BITS; + cmmx_t o = (*(cmmx_t*)(b + 2*bs) >> 1) & ~SIGN_BITS; + cmmx_t ne = (*(cmmx_t*)(b + 3*bs) >> 1) & ~SIGN_BITS; + cmmx_t old_no = (*(cmmx_t*)(a + 4*as) >> 1) & ~SIGN_BITS; + cmmx_t no = (*(cmmx_t*)(b + 4*bs) >> 1) & ~SIGN_BITS; + + cmmx_t qup_old_odd = p31avgb_s(old_o, old_po); + cmmx_t qup_odd = p31avgb_s( o, po); + cmmx_t qdown_old_odd = p31avgb_s(old_o, old_no); + cmmx_t qdown_odd = p31avgb_s( o, no); + + cmmx_t qup_even = p31avgb_s(ne, e); + cmmx_t qdown_even = p31avgb_s(e, ne); + + cmmx_t temp_up_diff = pdiffub_s(qdown_even, qup_old_odd); + cmmx_t noise_up_diff = pdiffub_s(qdown_even, qup_odd); + cmmx_t temp_down_diff = pdiffub_s(qup_even, qdown_old_odd); + cmmx_t noise_down_diff = pdiffub_s(qup_even, qdown_odd); + + cmmx_t odd_diff = pdiffub_s(o, old_o); + m->odd += psumbw_s(odd_diff) << 1; + m->even += psadbw_s(e, old_e) << 1; + + temp_up_diff = pminub_s(temp_up_diff, temp_down_diff); + temp_up_diff = pminub_s(temp_up_diff, odd_diff); + m->temp += psumbw_s(temp_up_diff) << 1; + noise_up_diff = pminub_s(noise_up_diff, odd_diff); + noise_up_diff = pminub_s(noise_up_diff, noise_down_diff); + + m->noise += psumbw_s(noise_up_diff) << 1; + a += 2*as; + b += 2*bs; } while (--lines); } static inline void get_metrics_faster_c(unsigned char *a, unsigned char *b, int as, int bs, - int lines, struct metrics *m) + int lines, struct metrics *m) { a -= as; b -= bs; do { - cmmx_t old_po = (*(cmmx_t*)(a )>>1) & ~SIGN_BITS; - cmmx_t po = (*(cmmx_t*)(b )>>1) & ~SIGN_BITS; - cmmx_t old_e = (*(cmmx_t*)(a + as)>>1) & ~SIGN_BITS; - cmmx_t e = (*(cmmx_t*)(b + bs)>>1) & ~SIGN_BITS; - cmmx_t old_o = (*(cmmx_t*)(a + 2*as)>>1) & ~SIGN_BITS; - cmmx_t o = (*(cmmx_t*)(b + 2*bs)>>1) & ~SIGN_BITS; - cmmx_t ne = (*(cmmx_t*)(b + 3*bs)>>1) & ~SIGN_BITS; - - cmmx_t down_even = p31avgb_s(e, ne); - cmmx_t up_odd = p31avgb_s(o, po); - cmmx_t up_old_odd = p31avgb_s(old_o, old_po); - - cmmx_t odd_diff = pdiffub_s(o, old_o); - cmmx_t temp_diff = pdiffub_s(down_even, up_old_odd); - cmmx_t noise_diff = pdiffub_s(down_even, up_odd); - - m->even += psadbw_s(e, old_e) << 1; - m->odd += psumbw_s(odd_diff) << 1; - - temp_diff = pminub_s(temp_diff, odd_diff); - noise_diff = pminub_s(noise_diff, odd_diff); - - m->noise += psumbw_s(noise_diff) << 1; - m->temp += psumbw_s(temp_diff) << 1; - a += 2*as; - b += 2*bs; + cmmx_t old_po = (*(cmmx_t*)(a )>>1) & ~SIGN_BITS; + cmmx_t po = (*(cmmx_t*)(b )>>1) & ~SIGN_BITS; + cmmx_t old_e = (*(cmmx_t*)(a + as)>>1) & ~SIGN_BITS; + cmmx_t e = (*(cmmx_t*)(b + bs)>>1) & ~SIGN_BITS; + cmmx_t old_o = (*(cmmx_t*)(a + 2*as)>>1) & ~SIGN_BITS; + cmmx_t o = (*(cmmx_t*)(b + 2*bs)>>1) & ~SIGN_BITS; + cmmx_t ne = (*(cmmx_t*)(b + 3*bs)>>1) & ~SIGN_BITS; + + cmmx_t down_even = p31avgb_s(e, ne); + cmmx_t up_odd = p31avgb_s(o, po); + cmmx_t up_old_odd = p31avgb_s(old_o, old_po); + + cmmx_t odd_diff = pdiffub_s(o, old_o); + cmmx_t temp_diff = pdiffub_s(down_even, up_old_odd); + cmmx_t noise_diff = pdiffub_s(down_even, up_odd); + + m->even += psadbw_s(e, old_e) << 1; + m->odd += psumbw_s(odd_diff) << 1; + + temp_diff = pminub_s(temp_diff, odd_diff); + noise_diff = pminub_s(noise_diff, odd_diff); + + m->noise += psumbw_s(noise_diff) << 1; + m->temp += psumbw_s(temp_diff) << 1; + a += 2*as; + b += 2*bs; } while (--lines); } @@ -309,28 +301,28 @@ get_block_stats(struct metrics *m, struct vf_priv_s *p, struct frame_stats *s) unsigned high_il = !n_big && !t_big && nlow_n && nlow_t; if (low_il | high_il) { - s->interlaced_low += low_il; - s->interlaced_high += high_il; + s->interlaced_low += low_il; + s->interlaced_high += high_il; } else { - s->tiny.even += ntiny_e; - s->tiny.odd += ntiny_o; - s->tiny.noise += ntiny_n; - s->tiny.temp += ntiny_t; - - s->low .even += nlow_e ; - s->low .odd += nlow_o ; - s->low .noise += nlow_n ; - s->low .temp += nlow_t ; - - s->high.even += high_e ; - s->high.odd += high_o ; - s->high.noise += high_n ; - s->high.temp += high_t ; - - if (m->even >= p->sad_thres) s->sad.even += m->even ; - if (m->odd >= p->sad_thres) s->sad.odd += m->odd ; - if (m->noise >= p->sad_thres) s->sad.noise += m->noise; - if (m->temp >= p->sad_thres) s->sad.temp += m->temp ; + s->tiny.even += ntiny_e; + s->tiny.odd += ntiny_o; + s->tiny.noise += ntiny_n; + s->tiny.temp += ntiny_t; + + s->low .even += nlow_e ; + s->low .odd += nlow_o ; + s->low .noise += nlow_n ; + s->low .temp += nlow_t ; + + s->high.even += high_e ; + s->high.odd += high_o ; + s->high.noise += high_n ; + s->high.temp += high_t ; + + if (m->even >= p->sad_thres) s->sad.even += m->even ; + if (m->odd >= p->sad_thres) s->sad.odd += m->odd ; + if (m->noise >= p->sad_thres) s->sad.noise += m->noise; + if (m->temp >= p->sad_thres) s->sad.temp += m->temp ; } s->num_blocks++; s->max.even = MAX(s->max.even , m->even ); @@ -352,39 +344,39 @@ get_block_stats(struct metrics *m, struct vf_priv_s *p, struct frame_stats *s) static inline struct metrics block_metrics_c(unsigned char *a, unsigned char *b, int as, int bs, - int lines, struct vf_priv_s *p, struct frame_stats *s) + int lines, struct vf_priv_s *p, struct frame_stats *s) { struct metrics tm; tm.even = tm.odd = tm.noise = tm.temp = 0; get_metrics_c(a, b, as, bs, lines, &tm); if (sizeof(cmmx_t) < 8) - get_metrics_c(a+4, b+4, as, bs, lines, &tm); + get_metrics_c(a+4, b+4, as, bs, lines, &tm); get_block_stats(&tm, p, s); return tm; } static inline struct metrics block_metrics_fast_c(unsigned char *a, unsigned char *b, int as, int bs, - int lines, struct vf_priv_s *p, struct frame_stats *s) + int lines, struct vf_priv_s *p, struct frame_stats *s) { struct metrics tm; tm.even = tm.odd = tm.noise = tm.temp = 0; get_metrics_fast_c(a, b, as, bs, lines, &tm); if (sizeof(cmmx_t) < 8) - get_metrics_fast_c(a+4, b+4, as, bs, lines, &tm); + get_metrics_fast_c(a+4, b+4, as, bs, lines, &tm); get_block_stats(&tm, p, s); return tm; } static inline struct metrics block_metrics_faster_c(unsigned char *a, unsigned char *b, int as, int bs, - int lines, struct vf_priv_s *p, struct frame_stats *s) + int lines, struct vf_priv_s *p, struct frame_stats *s) { struct metrics tm; tm.even = tm.odd = tm.noise = tm.temp = 0; get_metrics_faster_c(a, b, as, bs, lines, &tm); if (sizeof(cmmx_t) < 8) - get_metrics_faster_c(a+4, b+4, as, bs, lines, &tm); + get_metrics_faster_c(a+4, b+4, as, bs, lines, &tm); get_block_stats(&tm, p, s); return tm; } @@ -393,68 +385,68 @@ block_metrics_faster_c(unsigned char *a, unsigned char *b, int as, int bs, #define BLOCK_METRICS_TEMPLATE() \ __asm__ volatile("pxor %mm7, %mm7\n\t" /* The result is colleted in mm7 */ \ - "pxor %mm6, %mm6\n\t" /* Temp to stay at 0 */ \ - ); \ - a -= as; \ - b -= bs; \ - do { \ - __asm__ volatile( \ - "movq (%0,%2), %%mm0\n\t" \ - "movq (%1,%3), %%mm1\n\t" /* mm1 = even */ \ - PSADBW(%%mm1, %%mm0, %%mm4, %%mm6) \ - "paddusw %%mm0, %%mm7\n\t" /* even diff */ \ - "movq (%0,%2,2), %%mm0\n\t" /* mm0 = old odd */ \ - "movq (%1,%3,2), %%mm2\n\t" /* mm2 = odd */ \ - "movq (%0), %%mm3\n\t" \ - "psubusb %4, %%mm3\n\t" \ - PAVGB(%%mm0, %%mm3) \ - PAVGB(%%mm0, %%mm3) /* mm3 = qup old odd */ \ - "movq %%mm0, %%mm5\n\t" \ - PSADBW(%%mm2, %%mm0, %%mm4, %%mm6) \ - "psllq $16, %%mm0\n\t" \ - "paddusw %%mm0, %%mm7\n\t" \ - "movq (%1), %%mm4\n\t" \ - "lea (%0,%2,2), %0\n\t" \ - "lea (%1,%3,2), %1\n\t" \ - "psubusb %4, %%mm4\n\t" \ - PAVGB(%%mm2, %%mm4) \ - PAVGB(%%mm2, %%mm4) /* mm4 = qup odd */ \ - PDIFFUBT(%%mm5, %%mm2, %%mm0) /* mm2 =abs(oldodd-odd) */ \ - "movq (%1,%3), %%mm5\n\t" \ - "psubusb %4, %%mm5\n\t" \ - PAVGB(%%mm1, %%mm5) \ - PAVGB(%%mm5, %%mm1) /* mm1 = qdown even */ \ - PAVGB((%1,%3), %%mm5) /* mm5 = qup next even */ \ - PDIFFUBT(%%mm1, %%mm3, %%mm0) /* mm3 = abs(qupoldo-qde) */ \ - PDIFFUBT(%%mm1, %%mm4, %%mm0) /* mm4 = abs(qupodd-qde) */ \ - PMINUBT(%%mm2, %%mm3, %%mm0) /* limit temp to odd diff */ \ - PMINUBT(%%mm2, %%mm4, %%mm0) /* limit noise to odd diff */ \ - "movq (%1,%3,2), %%mm2\n\t" \ - "psubusb %4, %%mm2\n\t" \ - PAVGB((%1), %%mm2) \ - PAVGB((%1), %%mm2) /* mm2 = qdown odd */ \ - "movq (%0,%2,2), %%mm1\n\t" \ - "psubusb %4, %%mm1\n\t" \ - PAVGB((%0), %%mm1) \ - PAVGB((%0), %%mm1) /* mm1 = qdown old odd */ \ - PDIFFUBT(%%mm5, %%mm2, %%mm0) /* mm2 = abs(qdo-qune) */ \ - PDIFFUBT(%%mm5, %%mm1, %%mm0) /* mm1 = abs(qdoo-qune) */ \ - PMINUBT(%%mm4, %%mm2, %%mm0) /* current */ \ - PMINUBT(%%mm3, %%mm1, %%mm0) /* old */ \ - PSUMBW(%%mm2, %%mm0, %%mm6) \ - PSUMBW(%%mm1, %%mm0, %%mm6) \ - "psllq $32, %%mm2\n\t" \ - "psllq $48, %%mm1\n\t" \ - "paddusw %%mm2, %%mm7\n\t" \ - "paddusw %%mm1, %%mm7\n\t" \ - : "=r" (a), "=r" (b) \ - : "r"((x86_reg)as), "r"((x86_reg)bs), "m" (ones), "0"(a), "1"(b), "X"(*a), "X"(*b) \ - ); \ + "pxor %mm6, %mm6\n\t" /* Temp to stay at 0 */ \ + ); \ + a -= as; \ + b -= bs; \ + do { \ + __asm__ volatile( \ + "movq (%0,%2), %%mm0\n\t" \ + "movq (%1,%3), %%mm1\n\t" /* mm1 = even */ \ + PSADBW(%%mm1, %%mm0, %%mm4, %%mm6) \ + "paddusw %%mm0, %%mm7\n\t" /* even diff */ \ + "movq (%0,%2,2), %%mm0\n\t" /* mm0 = old odd */ \ + "movq (%1,%3,2), %%mm2\n\t" /* mm2 = odd */ \ + "movq (%0), %%mm3\n\t" \ + "psubusb %4, %%mm3\n\t" \ + PAVGB(%%mm0, %%mm3) \ + PAVGB(%%mm0, %%mm3) /* mm3 = qup old odd */ \ + "movq %%mm0, %%mm5\n\t" \ + PSADBW(%%mm2, %%mm0, %%mm4, %%mm6) \ + "psllq $16, %%mm0\n\t" \ + "paddusw %%mm0, %%mm7\n\t" \ + "movq (%1), %%mm4\n\t" \ + "lea (%0,%2,2), %0\n\t" \ + "lea (%1,%3,2), %1\n\t" \ + "psubusb %4, %%mm4\n\t" \ + PAVGB(%%mm2, %%mm4) \ + PAVGB(%%mm2, %%mm4) /* mm4 = qup odd */ \ + PDIFFUBT(%%mm5, %%mm2, %%mm0) /* mm2 =abs(oldodd-odd) */ \ + "movq (%1,%3), %%mm5\n\t" \ + "psubusb %4, %%mm5\n\t" \ + PAVGB(%%mm1, %%mm5) \ + PAVGB(%%mm5, %%mm1) /* mm1 = qdown even */ \ + PAVGB((%1,%3), %%mm5) /* mm5 = qup next even */ \ + PDIFFUBT(%%mm1, %%mm3, %%mm0) /* mm3 = abs(qupoldo-qde) */ \ + PDIFFUBT(%%mm1, %%mm4, %%mm0) /* mm4 = abs(qupodd-qde) */ \ + PMINUBT(%%mm2, %%mm3, %%mm0) /* limit temp to odd diff */ \ + PMINUBT(%%mm2, %%mm4, %%mm0) /* limit noise to odd diff */ \ + "movq (%1,%3,2), %%mm2\n\t" \ + "psubusb %4, %%mm2\n\t" \ + PAVGB((%1), %%mm2) \ + PAVGB((%1), %%mm2) /* mm2 = qdown odd */ \ + "movq (%0,%2,2), %%mm1\n\t" \ + "psubusb %4, %%mm1\n\t" \ + PAVGB((%0), %%mm1) \ + PAVGB((%0), %%mm1) /* mm1 = qdown old odd */ \ + PDIFFUBT(%%mm5, %%mm2, %%mm0) /* mm2 = abs(qdo-qune) */ \ + PDIFFUBT(%%mm5, %%mm1, %%mm0) /* mm1 = abs(qdoo-qune) */ \ + PMINUBT(%%mm4, %%mm2, %%mm0) /* current */ \ + PMINUBT(%%mm3, %%mm1, %%mm0) /* old */ \ + PSUMBW(%%mm2, %%mm0, %%mm6) \ + PSUMBW(%%mm1, %%mm0, %%mm6) \ + "psllq $32, %%mm2\n\t" \ + "psllq $48, %%mm1\n\t" \ + "paddusw %%mm2, %%mm7\n\t" \ + "paddusw %%mm1, %%mm7\n\t" \ + : "=r" (a), "=r" (b) \ + : "r"((x86_reg)as), "r"((x86_reg)bs), "m" (ones), "0"(a), "1"(b), "X"(*a), "X"(*b) \ + ); \ } while (--lines); static inline struct metrics block_metrics_3dnow(unsigned char *a, unsigned char *b, int as, int bs, - int lines, struct vf_priv_s *p, struct frame_stats *s) + int lines, struct vf_priv_s *p, struct frame_stats *s) { struct metrics tm; #if !HAVE_AMD3DNOW @@ -475,15 +467,15 @@ block_metrics_3dnow(unsigned char *a, unsigned char *b, int as, int bs, #undef PMINUBT #undef PAVGB -#define PSUMBW(X,T,Z) "psadbw " #Z "," #X "\n\t" +#define PSUMBW(X,T,Z) "psadbw " #Z "," #X "\n\t" #define PSADBW(X,Y,T,Z) "psadbw " #X "," #Y "\n\t" -#define PMAXUB(X,Y) "pmaxub " #X "," #Y "\n\t" -#define PMINUBT(X,Y,T) "pminub " #X "," #Y "\n\t" -#define PAVGB(X,Y) "pavgb " #X "," #Y "\n\t" +#define PMAXUB(X,Y) "pmaxub " #X "," #Y "\n\t" +#define PMINUBT(X,Y,T) "pminub " #X "," #Y "\n\t" +#define PAVGB(X,Y) "pavgb " #X "," #Y "\n\t" static inline struct metrics block_metrics_mmx2(unsigned char *a, unsigned char *b, int as, int bs, - int lines, struct vf_priv_s *p, struct frame_stats *s) + int lines, struct vf_priv_s *p, struct frame_stats *s) { struct metrics tm; #if !HAVE_MMX @@ -496,115 +488,115 @@ block_metrics_mmx2(unsigned char *a, unsigned char *b, int as, int bs, struct frame_stats ts = *s; #endif __asm__ volatile("prefetcht0 (%0,%2)\n\t" - "prefetcht0 (%1,%3)\n\t" : - : "r" (a), "r" (b), - "r" (prefetch_line * as), "r" (prefetch_line * bs)); + "prefetcht0 (%1,%3)\n\t" : + : "r" (a), "r" (b), + "r" (prefetch_line * as), "r" (prefetch_line * bs)); BLOCK_METRICS_TEMPLATE(); s->num_blocks++; __asm__ volatile( - "movq %3, %%mm0\n\t" - "movq %%mm7, %%mm1\n\t" - "psubusw %%mm0, %%mm1\n\t" - "movq %%mm1, %%mm2\n\t" - "paddusw %%mm0, %%mm2\n\t" - "paddusw %%mm7, %%mm2\n\t" - "pshufw $0xb1, %%mm2, %%mm3\n\t" - "pavgw %%mm7, %%mm2\n\t" - "pshufw $0xb1, %%mm2, %%mm2\n\t" - "psubusw %%mm7, %%mm2\n\t" - "pcmpeqw %%mm6, %%mm2\n\t" /* 1 if >= 1.5x */ - "psubusw %%mm7, %%mm3\n\t" - "pcmpeqw %%mm6, %%mm3\n\t" /* 1 if >= 2x */ - "movq %1, %%mm4\n\t" - "movq %2, %%mm5\n\t" - "psubw %%mm2, %%mm4\n\t" - "psubw %%mm3, %%mm5\n\t" - "movq %%mm4, %1\n\t" - "movq %%mm5, %2\n\t" - "pxor %%mm4, %%mm4\n\t" - "pcmpeqw %%mm1, %%mm4\n\t" /* 1 if <= t */ - "psubusw %%mm0, %%mm1\n\t" - "pxor %%mm5, %%mm5\n\t" - "pcmpeqw %%mm1, %%mm5\n\t" /* 1 if <= 2t */ - "psubusw %%mm0, %%mm1\n\t" - "psubusw %%mm0, %%mm1\n\t" - "pcmpeqw %%mm6, %%mm1\n\t" /* 1 if <= 4t */ - "pshufw $0xb1, %%mm2, %%mm0\n\t" - "por %%mm2, %%mm0\n\t" /* 1 if not close */ - "punpckhdq %%mm0, %%mm0\n\t" - "movq %%mm4, %%mm2\n\t" /* tttt */ - "punpckhdq %%mm5, %%mm2\n\t" /* ttll */ - "por %%mm2, %%mm0\n\t" - "pcmpeqd %%mm6, %%mm0\n\t" /* close && big */ - "psrlq $16, %%mm0\n\t" - "psrlw $15, %%mm0\n\t" - "movd %%mm0, %0\n\t" - : "=r" (interlaced), "=m" (s->bigger), "=m" (s->twox) - : "m" (p->thres) - ); + "movq %3, %%mm0\n\t" + "movq %%mm7, %%mm1\n\t" + "psubusw %%mm0, %%mm1\n\t" + "movq %%mm1, %%mm2\n\t" + "paddusw %%mm0, %%mm2\n\t" + "paddusw %%mm7, %%mm2\n\t" + "pshufw $0xb1, %%mm2, %%mm3\n\t" + "pavgw %%mm7, %%mm2\n\t" + "pshufw $0xb1, %%mm2, %%mm2\n\t" + "psubusw %%mm7, %%mm2\n\t" + "pcmpeqw %%mm6, %%mm2\n\t" /* 1 if >= 1.5x */ + "psubusw %%mm7, %%mm3\n\t" + "pcmpeqw %%mm6, %%mm3\n\t" /* 1 if >= 2x */ + "movq %1, %%mm4\n\t" + "movq %2, %%mm5\n\t" + "psubw %%mm2, %%mm4\n\t" + "psubw %%mm3, %%mm5\n\t" + "movq %%mm4, %1\n\t" + "movq %%mm5, %2\n\t" + "pxor %%mm4, %%mm4\n\t" + "pcmpeqw %%mm1, %%mm4\n\t" /* 1 if <= t */ + "psubusw %%mm0, %%mm1\n\t" + "pxor %%mm5, %%mm5\n\t" + "pcmpeqw %%mm1, %%mm5\n\t" /* 1 if <= 2t */ + "psubusw %%mm0, %%mm1\n\t" + "psubusw %%mm0, %%mm1\n\t" + "pcmpeqw %%mm6, %%mm1\n\t" /* 1 if <= 4t */ + "pshufw $0xb1, %%mm2, %%mm0\n\t" + "por %%mm2, %%mm0\n\t" /* 1 if not close */ + "punpckhdq %%mm0, %%mm0\n\t" + "movq %%mm4, %%mm2\n\t" /* tttt */ + "punpckhdq %%mm5, %%mm2\n\t" /* ttll */ + "por %%mm2, %%mm0\n\t" + "pcmpeqd %%mm6, %%mm0\n\t" /* close && big */ + "psrlq $16, %%mm0\n\t" + "psrlw $15, %%mm0\n\t" + "movd %%mm0, %0\n\t" + : "=r" (interlaced), "=m" (s->bigger), "=m" (s->twox) + : "m" (p->thres) + ); if (interlaced) { - s->interlaced_high += interlaced >> 16; - s->interlaced_low += interlaced; + s->interlaced_high += interlaced >> 16; + s->interlaced_low += interlaced; } else { - __asm__ volatile( - "pcmpeqw %%mm0, %%mm0\n\t" /* -1 */ - "psubw %%mm0, %%mm4\n\t" - "psubw %%mm0, %%mm5\n\t" - "psubw %%mm0, %%mm1\n\t" - "paddw %0, %%mm4\n\t" - "paddw %1, %%mm5\n\t" - "paddw %2, %%mm1\n\t" - "movq %%mm4, %0\n\t" - "movq %%mm5, %1\n\t" - "movq %%mm1, %2\n\t" - : "=m" (s->tiny), "=m" (s->low), "=m" (s->high) - ); - - __asm__ volatile( - "pshufw $0, %2, %%mm0\n\t" - "psubusw %%mm7, %%mm0\n\t" - "pcmpeqw %%mm6, %%mm0\n\t" /* 0 if below sad_thres */ - "pand %%mm7, %%mm0\n\t" - "movq %%mm0, %%mm1\n\t" - "punpcklwd %%mm6, %%mm0\n\t" /* sad even, odd */ - "punpckhwd %%mm6, %%mm1\n\t" /* sad noise, temp */ - "paddd %0, %%mm0\n\t" - "paddd %1, %%mm1\n\t" - "movq %%mm0, %0\n\t" - "movq %%mm1, %1\n\t" - : "=m" (s->sad.even), "=m" (s->sad.noise) - : "m" (p->sad_thres) - ); + __asm__ volatile( + "pcmpeqw %%mm0, %%mm0\n\t" /* -1 */ + "psubw %%mm0, %%mm4\n\t" + "psubw %%mm0, %%mm5\n\t" + "psubw %%mm0, %%mm1\n\t" + "paddw %0, %%mm4\n\t" + "paddw %1, %%mm5\n\t" + "paddw %2, %%mm1\n\t" + "movq %%mm4, %0\n\t" + "movq %%mm5, %1\n\t" + "movq %%mm1, %2\n\t" + : "=m" (s->tiny), "=m" (s->low), "=m" (s->high) + ); + + __asm__ volatile( + "pshufw $0, %2, %%mm0\n\t" + "psubusw %%mm7, %%mm0\n\t" + "pcmpeqw %%mm6, %%mm0\n\t" /* 0 if below sad_thres */ + "pand %%mm7, %%mm0\n\t" + "movq %%mm0, %%mm1\n\t" + "punpcklwd %%mm6, %%mm0\n\t" /* sad even, odd */ + "punpckhwd %%mm6, %%mm1\n\t" /* sad noise, temp */ + "paddd %0, %%mm0\n\t" + "paddd %1, %%mm1\n\t" + "movq %%mm0, %0\n\t" + "movq %%mm1, %1\n\t" + : "=m" (s->sad.even), "=m" (s->sad.noise) + : "m" (p->sad_thres) + ); } __asm__ volatile( - "movq %%mm7, (%1)\n\t" - PMAXUW((%0), %%mm7) - "movq %%mm7, (%0)\n\t" - "emms" - : : "r" (&s->max), "r" (&tm), "X" (s->max) - : "memory" - ); + "movq %%mm7, (%1)\n\t" + PMAXUW((%0), %%mm7) + "movq %%mm7, (%0)\n\t" + "emms" + : : "r" (&s->max), "r" (&tm), "X" (s->max) + : "memory" + ); #ifdef DEBUG if (1) { - struct metrics cm; - a -= 7*as; - b -= 7*bs; - cm = block_metrics_c(a, b, as, bs, 4, p, &ts); - if (!MEQ(tm, cm)) - mp_msg(MSGT_VFILTER, MSGL_WARN, "Bad metrics\n"); - if (s) { + struct metrics cm; + a -= 7*as; + b -= 7*bs; + cm = block_metrics_c(a, b, as, bs, 4, p, &ts); + if (!MEQ(tm, cm)) + mp_msg(MSGT_VFILTER, MSGL_WARN, "Bad metrics\n"); + if (s) { # define CHECK(X) if (!MEQ(s->X, ts.X)) \ - mp_msg(MSGT_VFILTER, MSGL_WARN, "Bad " #X "\n"); - CHECK(tiny); - CHECK(low); - CHECK(high); - CHECK(sad); - CHECK(max); - } + mp_msg(MSGT_VFILTER, MSGL_WARN, "Bad " #X "\n"); + CHECK(tiny); + CHECK(low); + CHECK(high); + CHECK(sad); + CHECK(max); + } } #endif #endif @@ -613,7 +605,7 @@ block_metrics_mmx2(unsigned char *a, unsigned char *b, int as, int bs, static inline int dint_copy_line_mmx2(unsigned char *dst, unsigned char *a, long bos, - long cos, int ds, int ss, int w, int t) + long cos, int ds, int ss, int w, int t) { #if !HAVE_MMX mp_msg(MSGT_VFILTER, MSGL_FATAL, "dint_copy_line_mmx2: internal error\n"); @@ -622,60 +614,60 @@ dint_copy_line_mmx2(unsigned char *dst, unsigned char *a, long bos, unsigned long len = (w+7) >> 3; int ret; __asm__ volatile ( - "pxor %%mm6, %%mm6 \n\t" /* deinterlaced pixel counter */ - "movd %0, %%mm7 \n\t" - "punpcklbw %%mm7, %%mm7 \n\t" - "punpcklwd %%mm7, %%mm7 \n\t" - "punpckldq %%mm7, %%mm7 \n\t" /* mm7 = threshold */ - : /* no output */ - : "rm" (t) - ); + "pxor %%mm6, %%mm6 \n\t" /* deinterlaced pixel counter */ + "movd %0, %%mm7 \n\t" + "punpcklbw %%mm7, %%mm7 \n\t" + "punpcklwd %%mm7, %%mm7 \n\t" + "punpckldq %%mm7, %%mm7 \n\t" /* mm7 = threshold */ + : /* no output */ + : "rm" (t) + ); do { - __asm__ volatile ( - "movq (%0), %%mm0\n\t" - "movq (%0,%3,2), %%mm1\n\t" - "movq %%mm0, (%2)\n\t" - "pmaxub %%mm1, %%mm0\n\t" - "pavgb (%0), %%mm1\n\t" - "psubusb %%mm1, %%mm0\n\t" - "paddusb %%mm7, %%mm0\n\t" /* mm0 = max-avg+thr */ - "movq (%0,%1), %%mm2\n\t" - "movq (%0,%5), %%mm3\n\t" - "movq %%mm2, %%mm4\n\t" - PDIFFUBT(%%mm1, %%mm2, %%mm5) - PDIFFUBT(%%mm1, %%mm3, %%mm5) - "pminub %%mm2, %%mm3\n\t" - "pcmpeqb %%mm3, %%mm2\n\t" /* b = min */ - "pand %%mm2, %%mm4\n\t" - "pandn (%0,%5), %%mm2\n\t" - "por %%mm4, %%mm2\n\t" - "pminub %%mm0, %%mm3\n\t" - "pcmpeqb %%mm0, %%mm3\n\t" /* set to 1s if >= threshold */ - "psubb %%mm3, %%mm6\n\t" /* count pixels above thr. */ - "pand %%mm3, %%mm1 \n\t" - "pandn %%mm2, %%mm3 \n\t" - "por %%mm3, %%mm1 \n\t" /* avg if >= threshold */ - "movq %%mm1, (%2,%4) \n\t" - : /* no output */ - : "r" (a), "r" ((x86_reg)bos), "r" ((x86_reg)dst), "r" ((x86_reg)ss), "r" ((x86_reg)ds), "r" ((x86_reg)cos) - ); - a += 8; - dst += 8; + __asm__ volatile ( + "movq (%0), %%mm0\n\t" + "movq (%0,%3,2), %%mm1\n\t" + "movq %%mm0, (%2)\n\t" + "pmaxub %%mm1, %%mm0\n\t" + "pavgb (%0), %%mm1\n\t" + "psubusb %%mm1, %%mm0\n\t" + "paddusb %%mm7, %%mm0\n\t" /* mm0 = max-avg+thr */ + "movq (%0,%1), %%mm2\n\t" + "movq (%0,%5), %%mm3\n\t" + "movq %%mm2, %%mm4\n\t" + PDIFFUBT(%%mm1, %%mm2, %%mm5) + PDIFFUBT(%%mm1, %%mm3, %%mm5) + "pminub %%mm2, %%mm3\n\t" + "pcmpeqb %%mm3, %%mm2\n\t" /* b = min */ + "pand %%mm2, %%mm4\n\t" + "pandn (%0,%5), %%mm2\n\t" + "por %%mm4, %%mm2\n\t" + "pminub %%mm0, %%mm3\n\t" + "pcmpeqb %%mm0, %%mm3\n\t" /* set to 1s if >= threshold */ + "psubb %%mm3, %%mm6\n\t" /* count pixels above thr. */ + "pand %%mm3, %%mm1 \n\t" + "pandn %%mm2, %%mm3 \n\t" + "por %%mm3, %%mm1 \n\t" /* avg if >= threshold */ + "movq %%mm1, (%2,%4) \n\t" + : /* no output */ + : "r" (a), "r" ((x86_reg)bos), "r" ((x86_reg)dst), "r" ((x86_reg)ss), "r" ((x86_reg)ds), "r" ((x86_reg)cos) + ); + a += 8; + dst += 8; } while (--len); __asm__ volatile ("pxor %%mm7, %%mm7 \n\t" - "psadbw %%mm6, %%mm7 \n\t" - "movd %%mm7, %0 \n\t" - "emms \n\t" - : "=r" (ret) - ); + "psadbw %%mm6, %%mm7 \n\t" + "movd %%mm7, %0 \n\t" + "emms \n\t" + : "=r" (ret) + ); return ret; #endif } static inline int dint_copy_line(unsigned char *dst, unsigned char *a, long bos, - long cos, int ds, int ss, int w, int t) + long cos, int ds, int ss, int w, int t) { unsigned long len = ((unsigned long)w+sizeof(cmmx_t)-1) / sizeof(cmmx_t); cmmx_t dint_count = 0; @@ -683,107 +675,107 @@ dint_copy_line(unsigned char *dst, unsigned char *a, long bos, t |= t << 8; thr = t | (t << 16); if (sizeof(cmmx_t) > 4) - thr |= thr << (sizeof(cmmx_t)*4); + thr |= thr << (sizeof(cmmx_t)*4); do { - cmmx_t e = *(cmmx_t*)a; - cmmx_t ne = *(cmmx_t*)(a+2*ss); - cmmx_t o = *(cmmx_t*)(a+bos); - cmmx_t oo = *(cmmx_t*)(a+cos); - cmmx_t maxe = pmaxub(e, ne); - cmmx_t avge = pavgb(e, ne); - cmmx_t max_diff = maxe - avge + thr; /* 0<=max-avg<128, thr<128 */ - cmmx_t diffo = pdiffub(avge, o); - cmmx_t diffoo = pdiffub(avge, oo); - cmmx_t diffcmp = pcmpgtub(diffo, diffoo); - cmmx_t bo = ((oo ^ o) & diffcmp) ^ o; - cmmx_t diffbo = ((diffoo ^ diffo) & diffcmp) ^ diffo; - cmmx_t above_thr = ~pcmpgtub(max_diff, diffbo); - cmmx_t bo_or_avg = ((avge ^ bo) & above_thr) ^ bo; - dint_count += above_thr & ONE_BYTES; - *(cmmx_t*)(dst) = e; - *(cmmx_t*)(dst+ds) = bo_or_avg; - a += sizeof(cmmx_t); - dst += sizeof(cmmx_t); + cmmx_t e = *(cmmx_t*)a; + cmmx_t ne = *(cmmx_t*)(a+2*ss); + cmmx_t o = *(cmmx_t*)(a+bos); + cmmx_t oo = *(cmmx_t*)(a+cos); + cmmx_t maxe = pmaxub(e, ne); + cmmx_t avge = pavgb(e, ne); + cmmx_t max_diff = maxe - avge + thr; /* 0<=max-avg<128, thr<128 */ + cmmx_t diffo = pdiffub(avge, o); + cmmx_t diffoo = pdiffub(avge, oo); + cmmx_t diffcmp = pcmpgtub(diffo, diffoo); + cmmx_t bo = ((oo ^ o) & diffcmp) ^ o; + cmmx_t diffbo = ((diffoo ^ diffo) & diffcmp) ^ diffo; + cmmx_t above_thr = ~pcmpgtub(max_diff, diffbo); + cmmx_t bo_or_avg = ((avge ^ bo) & above_thr) ^ bo; + dint_count += above_thr & ONE_BYTES; + *(cmmx_t*)(dst) = e; + *(cmmx_t*)(dst+ds) = bo_or_avg; + a += sizeof(cmmx_t); + dst += sizeof(cmmx_t); } while (--len); return psumbw(dint_count); } static int dint_copy_plane(unsigned char *d, unsigned char *a, unsigned char *b, - unsigned char *c, unsigned long w, unsigned long h, - unsigned long ds, unsigned long ss, unsigned long threshold, - long field, long mmx2) + unsigned char *c, unsigned long w, unsigned long h, + unsigned long ds, unsigned long ss, unsigned long threshold, + long field, long mmx2) { unsigned long ret = 0; long bos = b - a; long cos = c - a; if (field) { - fast_memcpy(d, b, w); - h--; - d += ds; - a += ss; + fast_memcpy(d, b, w); + h--; + d += ds; + a += ss; } bos += ss; cos += ss; while (h > 2) { - if (threshold >= 128) { - fast_memcpy(d, a, w); - fast_memcpy(d+ds, a+bos, w); - } else if (mmx2 == 1) { - ret += dint_copy_line_mmx2(d, a, bos, cos, ds, ss, w, threshold); - } else - ret += dint_copy_line(d, a, bos, cos, ds, ss, w, threshold); - h -= 2; - d += 2*ds; - a += 2*ss; + if (threshold >= 128) { + fast_memcpy(d, a, w); + fast_memcpy(d+ds, a+bos, w); + } else if (mmx2 == 1) { + ret += dint_copy_line_mmx2(d, a, bos, cos, ds, ss, w, threshold); + } else + ret += dint_copy_line(d, a, bos, cos, ds, ss, w, threshold); + h -= 2; + d += 2*ds; + a += 2*ss; } fast_memcpy(d, a, w); if (h == 2) - fast_memcpy(d+ds, a+bos, w); + fast_memcpy(d+ds, a+bos, w); return ret; } static void copy_merge_fields(struct vf_priv_s *p, mp_image_t *dmpi, - unsigned char **old, unsigned char **new, unsigned long show) + unsigned char **old, unsigned char **new, unsigned long show) { unsigned long threshold = 256; unsigned long field = p->swapped; unsigned long dint_pixels = 0; unsigned char **other = old; if (show >= 12 || !(show & 3)) - show >>= 2, other = new, new = old; + show >>= 2, other = new, new = old; if (show <= 2) { /* Single field: de-interlace */ - threshold = p->dint_thres; - field ^= show & 1; - old = new; + threshold = p->dint_thres; + field ^= show & 1; + old = new; } else if (show == 3) - old = new; + old = new; else - field ^= 1; + field ^= 1; dint_pixels +=dint_copy_plane(dmpi->planes[0], old[0], new[0], - other[0], p->w, p->h, dmpi->stride[0], - p->stride, threshold, field, p->mmx2); + other[0], p->w, p->h, dmpi->stride[0], + p->stride, threshold, field, p->mmx2); if (dmpi->flags & MP_IMGFLAG_PLANAR) { - if (p->luma_only) - old = new, other = new; - else - threshold = threshold/2 + 1; - field ^= p->chroma_swapped; - dint_copy_plane(dmpi->planes[1], old[1], new[1], - other[1], p->cw, p->ch, dmpi->stride[1], - p->chroma_stride, threshold, field, p->mmx2); - dint_copy_plane(dmpi->planes[2], old[2], new[2], - other[2], p->cw, p->ch, dmpi->stride[2], - p->chroma_stride, threshold, field, p->mmx2); + if (p->luma_only) + old = new, other = new; + else + threshold = threshold/2 + 1; + field ^= p->chroma_swapped; + dint_copy_plane(dmpi->planes[1], old[1], new[1], + other[1], p->cw, p->ch, dmpi->stride[1], + p->chroma_stride, threshold, field, p->mmx2); + dint_copy_plane(dmpi->planes[2], old[2], new[2], + other[2], p->cw, p->ch, dmpi->stride[2], + p->chroma_stride, threshold, field, p->mmx2); } if (dint_pixels > 0 && p->verbose) - mp_msg(MSGT_VFILTER,MSGL_INFO,"Deinterlaced %lu pixels\n",dint_pixels); + mp_msg(MSGT_VFILTER,MSGL_INFO,"Deinterlaced %lu pixels\n",dint_pixels); } static void diff_planes(struct vf_priv_s *p, struct frame_stats *s, - unsigned char *of, unsigned char *nf, - int w, int h, int os, int ns, int swapped) + unsigned char *of, unsigned char *nf, + int w, int h, int os, int ns, int swapped) { int i, y; int align = -(long)nf & 7; @@ -791,7 +783,7 @@ static void diff_planes(struct vf_priv_s *p, struct frame_stats *s, nf += align; w -= align; if (swapped) - of -= os, nf -= ns; + of -= os, nf -= ns; i = (h*3 >> 7) & ~1; of += i*os + 8; nf += i*ns + 8; @@ -801,65 +793,65 @@ static void diff_planes(struct vf_priv_s *p, struct frame_stats *s, memset(s, 0, sizeof(*s)); for (y = (h-8) >> 3; y; y--) { - if (p->mmx2 == 1) { - for (i = 0; i < w; i += 8) - block_metrics_mmx2(of+i, nf+i, os, ns, 4, p, s); - } else if (p->mmx2 == 2) { - for (i = 0; i < w; i += 8) - block_metrics_3dnow(of+i, nf+i, os, ns, 4, p, s); - } else if (p->fast > 3) { - for (i = 0; i < w; i += 8) - block_metrics_faster_c(of+i, nf+i, os, ns, 4, p, s); - } else if (p->fast > 1) { - for (i = 0; i < w; i += 8) - block_metrics_fast_c(of+i, nf+i, os, ns, 4, p, s); - } else { - for (i = 0; i < w; i += 8) - block_metrics_c(of+i, nf+i, os, ns, 4, p, s); - } - of += 8*os; - nf += 8*ns; + if (p->mmx2 == 1) { + for (i = 0; i < w; i += 8) + block_metrics_mmx2(of+i, nf+i, os, ns, 4, p, s); + } else if (p->mmx2 == 2) { + for (i = 0; i < w; i += 8) + block_metrics_3dnow(of+i, nf+i, os, ns, 4, p, s); + } else if (p->fast > 3) { + for (i = 0; i < w; i += 8) + block_metrics_faster_c(of+i, nf+i, os, ns, 4, p, s); + } else if (p->fast > 1) { + for (i = 0; i < w; i += 8) + block_metrics_fast_c(of+i, nf+i, os, ns, 4, p, s); + } else { + for (i = 0; i < w; i += 8) + block_metrics_c(of+i, nf+i, os, ns, 4, p, s); + } + of += 8*os; + nf += 8*ns; } } #define METRICS(X) (X).even, (X).odd, (X).noise, (X).temp static void diff_fields(struct vf_priv_s *p, struct frame_stats *s, - unsigned char **old, unsigned char **new) + unsigned char **old, unsigned char **new) { diff_planes(p, s, old[0], new[0], p->w, p->h, - p->stride, p->stride, p->swapped); + p->stride, p->stride, p->swapped); s->sad.even = (s->sad.even * 16ul) / s->num_blocks; s->sad.odd = (s->sad.odd * 16ul) / s->num_blocks; s->sad.noise = (s->sad.noise * 16ul) / s->num_blocks; s->sad.temp = (s->sad.temp * 16ul) / s->num_blocks; if (p->verbose) - mp_msg(MSGT_VFILTER, MSGL_INFO, "%lu%c M:%d/%d/%d/%d - %d, " - "t:%d/%d/%d/%d, l:%d/%d/%d/%d, h:%d/%d/%d/%d, bg:%d/%d/%d/%d, " - "2x:%d/%d/%d/%d, sad:%d/%d/%d/%d, lil:%d, hil:%d, ios:%.1f\n", - p->inframes, p->chflag, METRICS(s->max), s->num_blocks, - METRICS(s->tiny), METRICS(s->low), METRICS(s->high), - METRICS(s->bigger), METRICS(s->twox), METRICS(s->sad), - s->interlaced_low, s->interlaced_high, - p->iosync / (double) p->in_inc); + mp_msg(MSGT_VFILTER, MSGL_INFO, "%lu%c M:%d/%d/%d/%d - %d, " + "t:%d/%d/%d/%d, l:%d/%d/%d/%d, h:%d/%d/%d/%d, bg:%d/%d/%d/%d, " + "2x:%d/%d/%d/%d, sad:%d/%d/%d/%d, lil:%d, hil:%d, ios:%.1f\n", + p->inframes, p->chflag, METRICS(s->max), s->num_blocks, + METRICS(s->tiny), METRICS(s->low), METRICS(s->high), + METRICS(s->bigger), METRICS(s->twox), METRICS(s->sad), + s->interlaced_low, s->interlaced_high, + p->iosync / (double) p->in_inc); } static const char *parse_args(struct vf_priv_s *p, const char *args) { args--; while (args && *++args && - (sscanf(args, "io=%lu:%lu", &p->out_dec, &p->in_inc) == 2 || - sscanf(args, "diff_thres=%hu", &p->thres.even ) == 1 || - sscanf(args, "comb_thres=%hu", &p->thres.noise) == 1 || - sscanf(args, "sad_thres=%lu", &p->sad_thres ) == 1 || - sscanf(args, "dint_thres=%lu", &p->dint_thres ) == 1 || - sscanf(args, "fast=%u", &p->fast ) == 1 || - sscanf(args, "mmx2=%lu", &p->mmx2 ) == 1 || - sscanf(args, "luma_only=%u", &p->luma_only ) == 1 || - sscanf(args, "verbose=%u", &p->verbose ) == 1 || - sscanf(args, "crop=%lu:%lu:%lu:%lu", &p->w, - &p->h, &p->crop_x, &p->crop_y) == 4)) - args = strchr(args, '/'); + (sscanf(args, "io=%lu:%lu", &p->out_dec, &p->in_inc) == 2 || + sscanf(args, "diff_thres=%hu", &p->thres.even ) == 1 || + sscanf(args, "comb_thres=%hu", &p->thres.noise) == 1 || + sscanf(args, "sad_thres=%lu", &p->sad_thres ) == 1 || + sscanf(args, "dint_thres=%lu", &p->dint_thres ) == 1 || + sscanf(args, "fast=%u", &p->fast ) == 1 || + sscanf(args, "mmx2=%lu", &p->mmx2 ) == 1 || + sscanf(args, "luma_only=%u", &p->luma_only ) == 1 || + sscanf(args, "verbose=%u", &p->verbose ) == 1 || + sscanf(args, "crop=%lu:%lu:%lu:%lu", &p->w, + &p->h, &p->crop_x, &p->crop_y) == 4)) + args = strchr(args, '/'); return args; } @@ -867,12 +859,12 @@ static unsigned long gcd(unsigned long x, unsigned long y) { unsigned long t; if (x > y) - t = x, x = y, y = t; + t = x, x = y, y = t; while (x) { - t = y % x; - y = x; - x = t; + t = y % x; + y = x; + x = t; } return y; } @@ -886,11 +878,11 @@ static void init(struct vf_priv_s *p, mp_image_t *mpi) p->crop_cx = p->crop_x >> mpi->chroma_x_shift; p->crop_cy = p->crop_y >> mpi->chroma_y_shift; if (mpi->flags & MP_IMGFLAG_ACCEPT_STRIDE) { - p->stride = (mpi->w + 15) & ~15; - p->chroma_stride = p->stride >> mpi->chroma_x_shift; + p->stride = (mpi->w + 15) & ~15; + p->chroma_stride = p->stride >> mpi->chroma_x_shift; } else { - p->stride = mpi->width; - p->chroma_stride = mpi->chroma_width; + p->stride = mpi->width; + p->chroma_stride = mpi->chroma_width; } p->cw = p->w >> mpi->chroma_x_shift; p->ch = p->h >> mpi->chroma_y_shift; @@ -900,30 +892,30 @@ static void init(struct vf_priv_s *p, mp_image_t *mpi) p->old_planes = p->planes[0]; plane_size = mpi->h * p->stride; chroma_plane_size = mpi->flags & MP_IMGFLAG_PLANAR ? - mpi->chroma_height * p->chroma_stride : 0; + mpi->chroma_height * p->chroma_stride : 0; p->memory_allocated = - malloc(NUM_STORED * (plane_size+2*chroma_plane_size) + - 8*p->chroma_stride + 4096); + malloc(NUM_STORED * (plane_size+2*chroma_plane_size) + + 8*p->chroma_stride + 4096); /* align to page boundary */ plane = p->memory_allocated + (-(long)p->memory_allocated & 4095); memset(plane, 0, NUM_STORED * plane_size); los = p->crop_x + p->crop_y * p->stride; cos = p->crop_cx + p->crop_cy * p->chroma_stride; for (i = 0; i != NUM_STORED; i++, plane += plane_size) { - p->planes[i][0] = plane; - p->planes[NUM_STORED + i][0] = plane + los; + p->planes[i][0] = plane; + p->planes[NUM_STORED + i][0] = plane + los; } if (mpi->flags & MP_IMGFLAG_PLANAR) { - p->nplanes = 3; - memset(plane, 0x80, NUM_STORED * 2 * chroma_plane_size); - for (i = 0; i != NUM_STORED; i++) { - p->planes[i][1] = plane; - p->planes[NUM_STORED + i][1] = plane + cos; - plane += chroma_plane_size; - p->planes[i][2] = plane; - p->planes[NUM_STORED + i][2] = plane + cos; - plane += chroma_plane_size; - } + p->nplanes = 3; + memset(plane, 0x80, NUM_STORED * 2 * chroma_plane_size); + for (i = 0; i != NUM_STORED; i++) { + p->planes[i][1] = plane; + p->planes[NUM_STORED + i][1] = plane + cos; + plane += chroma_plane_size; + p->planes[i][2] = plane; + p->planes[NUM_STORED + i][2] = plane + cos; + plane += chroma_plane_size; + } } p->out_dec <<= 2; i = gcd(p->in_inc, p->out_dec); @@ -933,20 +925,12 @@ static void init(struct vf_priv_s *p, mp_image_t *mpi) p->num_fields = 3; } -#ifdef GEKKO -#include -static inline u64 get_time(void) -{ - return tick_microsecs(gettime()); -} -#else static inline double get_time(void) { struct timeval tv; gettimeofday(&tv, 0); return tv.tv_sec + tv.tv_usec * 1e-6; } -#endif static void get_image(struct vf_instance *vf, mp_image_t *mpi) { @@ -958,32 +942,32 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi) if (!p->planes[0][0]) init(p, mpi); if (mpi->type == MP_IMGTYPE_TEMP || - (mpi->type == MP_IMGTYPE_IPB && !(mpi->flags & MP_IMGFLAG_READABLE))) - planes_idx = NUM_STORED/2 + (++p->temp_idx % (NUM_STORED/2)); + (mpi->type == MP_IMGTYPE_IPB && !(mpi->flags & MP_IMGFLAG_READABLE))) + planes_idx = NUM_STORED/2 + (++p->temp_idx % (NUM_STORED/2)); else - planes_idx = ++p->static_idx % (NUM_STORED/2); + planes_idx = ++p->static_idx % (NUM_STORED/2); planes = p->planes[planes_idx]; mpi->priv = p->planes[NUM_STORED + planes_idx]; if (mpi->priv == p->old_planes) { - unsigned char **old_planes = - p->planes[NUM_STORED + 2 + (++p->temp_idx & 1)]; - my_memcpy_pic(old_planes[0], p->old_planes[0], - p->w, p->h, p->stride, p->stride); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(old_planes[1], p->old_planes[1], - p->cw, p->ch, p->chroma_stride, p->chroma_stride); - my_memcpy_pic(old_planes[2], p->old_planes[2], - p->cw, p->ch, p->chroma_stride, p->chroma_stride); - } - p->old_planes = old_planes; - p->num_copies++; + unsigned char **old_planes = + p->planes[NUM_STORED + 2 + (++p->temp_idx & 1)]; + my_memcpy_pic(old_planes[0], p->old_planes[0], + p->w, p->h, p->stride, p->stride); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(old_planes[1], p->old_planes[1], + p->cw, p->ch, p->chroma_stride, p->chroma_stride); + my_memcpy_pic(old_planes[2], p->old_planes[2], + p->cw, p->ch, p->chroma_stride, p->chroma_stride); + } + p->old_planes = old_planes; + p->num_copies++; } mpi->planes[0] = planes[0]; mpi->stride[0] = p->stride; if (mpi->flags & MP_IMGFLAG_PLANAR) { - mpi->planes[1] = planes[1]; - mpi->planes[2] = planes[2]; - mpi->stride[1] = mpi->stride[2] = p->chroma_stride; + mpi->planes[1] = planes[1]; + mpi->planes[2] = planes[2]; + mpi->stride[1] = mpi->stride[2] = p->chroma_stride; } mpi->width = p->stride; @@ -1011,142 +995,142 @@ find_breaks(struct vf_priv_s *p, struct frame_stats *s) unsigned long ret = 8; if (cmpe(s->sad.temp, s->sad.even, 512, 1) > 0) - mp_msg(MSGT_VFILTER, MSGL_WARN, - "@@@@@@@@ Bottom-first field??? @@@@@@@@\n"); + mp_msg(MSGT_VFILTER, MSGL_WARN, + "@@@@@@@@ Bottom-first field??? @@@@@@@@\n"); if (s->sad.temp > 1000 && s->sad.noise > 1000) - return 3; + return 3; if (s->interlaced_high >= 2*n && s->sad.temp > 256 && s->sad.noise > 256) - return 3; + return 3; if (s->high.noise > s->num_blocks/4 && s->sad.noise > 10000 && - s->sad.noise > 2*s->sad.even && s->sad.noise > 2*ps->sad.odd) { - // Mid-frame scene change - if (s->tiny.temp + s->interlaced_low < n || - s->low.temp + s->interlaced_high < n/4 || - s->high.temp + s->interlaced_high < n/8 || - s->sad.temp < 160) - return 1; - return 3; + s->sad.noise > 2*s->sad.even && s->sad.noise > 2*ps->sad.odd) { + // Mid-frame scene change + if (s->tiny.temp + s->interlaced_low < n || + s->low.temp + s->interlaced_high < n/4 || + s->high.temp + s->interlaced_high < n/8 || + s->sad.temp < 160) + return 1; + return 3; } if (s->high.temp > s->num_blocks/4 && s->sad.temp > 10000 && - s->sad.temp > 2*ps->sad.odd && s->sad.temp > 2*ps->sad.even) { - // Start frame scene change - if (s->tiny.noise + s->interlaced_low < n || - s->low.noise + s->interlaced_high < n/4 || - s->high.noise + s->interlaced_high < n/8 || - s->sad.noise < 160) - return 2; - return 3; + s->sad.temp > 2*ps->sad.odd && s->sad.temp > 2*ps->sad.even) { + // Start frame scene change + if (s->tiny.noise + s->interlaced_low < n || + s->low.noise + s->interlaced_high < n/4 || + s->high.noise + s->interlaced_high < n/8 || + s->sad.noise < 160) + return 2; + return 3; } if (sad_comb_cmp == 2) - return 2; + return 2; if (sad_comb_cmp == -2) - return 1; + return 1; if (s->tiny.odd > 3*MAX(n,s->tiny.even) + s->interlaced_low) - return 1; + return 1; if (s->tiny.even > 3*MAX(n,s->tiny.odd)+s->interlaced_low && - (!sad_comb_cmp || (s->low.noise <= n/4 && s->low.temp <= n/4))) - return 4; + (!sad_comb_cmp || (s->low.noise <= n/4 && s->low.temp <= n/4))) + return 4; if (s->sad.noise < 64 && s->sad.temp < 64 && - s->low.noise <= n/2 && s->high.noise <= n/4 && - s->low.temp <= n/2 && s->high.temp <= n/4) - goto still; + s->low.noise <= n/2 && s->high.noise <= n/4 && + s->low.temp <= n/2 && s->high.temp <= n/4) + goto still; if (s->tiny.temp > 3*MAX(n,s->tiny.noise) + s->interlaced_low) - return 2; + return 2; if (s->tiny.noise > 3*MAX(n,s->tiny.temp) + s->interlaced_low) - return 1; + return 1; if (s->low.odd > 3*MAX(n/4,s->low.even) + s->interlaced_high) - return 1; + return 1; if (s->low.even > 3*MAX(n/4,s->low.odd)+s->interlaced_high && - s->sad.even > 2*s->sad.odd && - (!sad_comb_cmp || (s->low.noise <= n/4 && s->low.temp <= n/4))) - return 4; + s->sad.even > 2*s->sad.odd && + (!sad_comb_cmp || (s->low.noise <= n/4 && s->low.temp <= n/4))) + return 4; if (s->low.temp > 3*MAX(n/4,s->low.noise) + s->interlaced_high) - return 2; + return 2; if (s->low.noise > 3*MAX(n/4,s->low.temp) + s->interlaced_high) - return 1; + return 1; if (sad_comb_cmp == 1 && s->sad.noise < 64) - return 2; + return 2; if (sad_comb_cmp == -1 && s->sad.temp < 64) - return 1; + return 1; if (s->tiny.odd <= n || (s->tiny.noise <= n/2 && s->tiny.temp <= n/2)) { - if (s->interlaced_low <= n) { - if (p->num_fields == 1) - goto still; - if (s->tiny.even <= n || ps->tiny.noise <= n/2) - /* Still frame */ - goto still; - if (s->bigger.even >= 2*MAX(n,s->bigger.odd) + s->interlaced_low) - return 4; - if (s->low.even >= 2*n + s->interlaced_low) - return 4; - goto still; - } + if (s->interlaced_low <= n) { + if (p->num_fields == 1) + goto still; + if (s->tiny.even <= n || ps->tiny.noise <= n/2) + /* Still frame */ + goto still; + if (s->bigger.even >= 2*MAX(n,s->bigger.odd) + s->interlaced_low) + return 4; + if (s->low.even >= 2*n + s->interlaced_low) + return 4; + goto still; + } } if (s->low.odd <= n/4) { - if (s->interlaced_high <= n/4) { - if (p->num_fields == 1) - goto still; - if (s->low.even <= n/4) - /* Still frame */ - goto still; - if (s->bigger.even >= 2*MAX(n/4,s->bigger.odd)+s->interlaced_high) - return 4; - if (s->low.even >= n/2 + s->interlaced_high) - return 4; - goto still; - } + if (s->interlaced_high <= n/4) { + if (p->num_fields == 1) + goto still; + if (s->low.even <= n/4) + /* Still frame */ + goto still; + if (s->bigger.even >= 2*MAX(n/4,s->bigger.odd)+s->interlaced_high) + return 4; + if (s->low.even >= n/2 + s->interlaced_high) + return 4; + goto still; + } } if (s->bigger.temp > 2*MAX(n,s->bigger.noise) + s->interlaced_low) - return 2; + return 2; if (s->bigger.noise > 2*MAX(n,s->bigger.temp) + s->interlaced_low) - return 1; + return 1; if (s->bigger.temp > 2*MAX(n,s->bigger.noise) + s->interlaced_high) - return 2; + return 2; if (s->bigger.noise > 2*MAX(n,s->bigger.temp) + s->interlaced_high) - return 1; + return 1; if (s->twox.temp > 2*MAX(n,s->twox.noise) + s->interlaced_high) - return 2; + return 2; if (s->twox.noise > 2*MAX(n,s->twox.temp) + s->interlaced_high) - return 1; + return 1; if (s->bigger.even > 2*MAX(n,s->bigger.odd) + s->interlaced_low && - s->bigger.temp < n && s->bigger.noise < n) - return 4; + s->bigger.temp < n && s->bigger.noise < n) + return 4; if (s->interlaced_low > MIN(2*n, s->tiny.odd)) - return 3; + return 3; ret = 8 + (1 << (s->sad.temp > s->sad.noise)); still: if (p->num_fields == 1 && p->prev_fields == 3 && notfilm >= 0 && - (s->tiny.temp <= s->tiny.noise || s->sad.temp < s->sad.noise+16)) - return 1; + (s->tiny.temp <= s->tiny.noise || s->sad.temp < s->sad.noise+16)) + return 1; if (p->notout < p->num_fields && p->iosync > 2*p->in_inc && notfilm < 0) - notfilm = 0; + notfilm = 0; if (p->num_fields < 2 || - (p->num_fields == 2 && p->prev_fields == 2 && notfilm < 0)) - return ret; + (p->num_fields == 2 && p->prev_fields == 2 && notfilm < 0)) + return ret; if (!notfilm && (p->prev_fields&~1) == 2) { - if (p->prev_fields + p->num_fields == 5) { - if (s->tiny.noise <= s->tiny.temp || - s->low.noise == 0 || s->low.noise < s->low.temp || - s->sad.noise < s->sad.temp+16) - return 2; - } - if (p->prev_fields + p->num_fields == 4) { - if (s->tiny.temp <= s->tiny.noise || - s->low.temp == 0 || s->low.temp < s->low.noise || - s->sad.temp < s->sad.noise+16) - return 1; - } + if (p->prev_fields + p->num_fields == 5) { + if (s->tiny.noise <= s->tiny.temp || + s->low.noise == 0 || s->low.noise < s->low.temp || + s->sad.noise < s->sad.temp+16) + return 2; + } + if (p->prev_fields + p->num_fields == 4) { + if (s->tiny.temp <= s->tiny.noise || + s->low.temp == 0 || s->low.temp < s->low.noise || + s->sad.temp < s->sad.noise+16) + return 1; + } } if (p->num_fields > 2 && - ps->sad.noise > s->sad.noise && ps->sad.noise > s->sad.temp) - return 4; + ps->sad.noise > s->sad.noise && ps->sad.noise > s->sad.temp) + return 4; return 2 >> (s->sad.noise > s->sad.temp); } @@ -1164,11 +1148,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) int breaks, prev; int show_fields = 0; int dropped_fields = 0; -#ifdef GEKKO - u64 start_time, diff_time; -#else double start_time, diff_time; -#endif char prev_chflag = p->chflag; int keep_rate; @@ -1177,41 +1157,41 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) old_planes = p->old_planes; if ((mpi->flags & MP_IMGFLAG_DIRECT) && mpi->priv) { - planes = mpi->priv; - mpi->priv = 0; + planes = mpi->priv; + mpi->priv = 0; } else { - planes = p->planes[2 + (++p->temp_idx & 1)]; - my_memcpy_pic(planes[0], - mpi->planes[0] + p->crop_x + p->crop_y * mpi->stride[0], - p->w, p->h, p->stride, mpi->stride[0]); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(planes[1], - mpi->planes[1] + p->crop_cx + p->crop_cy * mpi->stride[1], - p->cw, p->ch, p->chroma_stride, mpi->stride[1]); - my_memcpy_pic(planes[2], - mpi->planes[2] + p->crop_cx + p->crop_cy * mpi->stride[2], - p->cw, p->ch, p->chroma_stride, mpi->stride[2]); - p->num_copies++; - } + planes = p->planes[2 + (++p->temp_idx & 1)]; + my_memcpy_pic(planes[0], + mpi->planes[0] + p->crop_x + p->crop_y * mpi->stride[0], + p->w, p->h, p->stride, mpi->stride[0]); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(planes[1], + mpi->planes[1] + p->crop_cx + p->crop_cy * mpi->stride[1], + p->cw, p->ch, p->chroma_stride, mpi->stride[1]); + my_memcpy_pic(planes[2], + mpi->planes[2] + p->crop_cx + p->crop_cy * mpi->stride[2], + p->cw, p->ch, p->chroma_stride, mpi->stride[2]); + p->num_copies++; + } } p->old_planes = planes; p->chflag = ';'; if (flags & MP_IMGFIELD_ORDERED) { - swapped = !(flags & MP_IMGFIELD_TOP_FIRST); - p->chflag = (flags & MP_IMGFIELD_REPEAT_FIRST ? '|' : - flags & MP_IMGFIELD_TOP_FIRST ? ':' : '.'); + swapped = !(flags & MP_IMGFIELD_TOP_FIRST); + p->chflag = (flags & MP_IMGFIELD_REPEAT_FIRST ? '|' : + flags & MP_IMGFIELD_TOP_FIRST ? ':' : '.'); } p->swapped = swapped; start_time = get_time(); if (p->chflag == '|') { - *s = ppzs; - p->iosync += p->in_inc; + *s = ppzs; + p->iosync += p->in_inc; } else if ((p->fast & 1) && prev_chflag == '|') - *s = pprs; + *s = pprs; else - diff_fields(p, s, old_planes, planes); + diff_fields(p, s, old_planes, planes); diff_time = get_time(); p->diff_time += diff_time - start_time; breaks = p->inframes ? find_breaks(p, s) : 2; @@ -1223,132 +1203,132 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) case 8: case 9: case 10: - if (!keep_rate && p->notout < p->num_fields && p->iosync < 2*p->in_inc) - break; - if (p->notout < p->num_fields) - dropped_fields = -2; + if (!keep_rate && p->notout < p->num_fields && p->iosync < 2*p->in_inc) + break; + if (p->notout < p->num_fields) + dropped_fields = -2; case 4: - if (keep_rate || p->iosync >= -2*p->in_inc) - show_fields = (4<num_fields)-1; - break; + if (keep_rate || p->iosync >= -2*p->in_inc) + show_fields = (4<num_fields)-1; + break; case 3: - if (keep_rate) - show_fields = 2; - else if (p->iosync > 0) { - if (p->notout >= p->num_fields && p->iosync > 2*p->in_inc) { - show_fields = 4; /* prev odd only */ - if (p->num_fields > 1) - show_fields |= 8; /* + prev even */ - } else { - show_fields = 2; /* even only */ - if (p->notout >= p->num_fields) - dropped_fields += p->num_fields; - } - } - break; + if (keep_rate) + show_fields = 2; + else if (p->iosync > 0) { + if (p->notout >= p->num_fields && p->iosync > 2*p->in_inc) { + show_fields = 4; /* prev odd only */ + if (p->num_fields > 1) + show_fields |= 8; /* + prev even */ + } else { + show_fields = 2; /* even only */ + if (p->notout >= p->num_fields) + dropped_fields += p->num_fields; + } + } + break; case 2: - if (p->iosync <= -3*p->in_inc) { - if (p->notout >= p->num_fields) - dropped_fields = p->num_fields; - break; - } - if (p->num_fields == 1) { - int prevbreak = ps->sad.noise >= 128; - if (p->iosync < 4*p->in_inc) { - show_fields = 3; - dropped_fields = prevbreak; - } else { - show_fields = 4 | (!prevbreak << 3); - if (p->notout < 1 + p->prev_fields) - dropped_fields = -!prevbreak; - } - break; - } + if (p->iosync <= -3*p->in_inc) { + if (p->notout >= p->num_fields) + dropped_fields = p->num_fields; + break; + } + if (p->num_fields == 1) { + int prevbreak = ps->sad.noise >= 128; + if (p->iosync < 4*p->in_inc) { + show_fields = 3; + dropped_fields = prevbreak; + } else { + show_fields = 4 | (!prevbreak << 3); + if (p->notout < 1 + p->prev_fields) + dropped_fields = -!prevbreak; + } + break; + } default: - if (keep_rate) - show_fields = 3 << (breaks & 1); - else if (p->notout >= p->num_fields && - p->iosync >= (breaks == 1 ? -p->in_inc : - p->in_inc << (p->num_fields == 1))) { - show_fields = (1 << (2 + p->num_fields)) - (1<notout >= p->num_fields) - dropped_fields += p->num_fields + 2 - breaks; - if (breaks == 1) { - if (p->iosync >= 4*p->in_inc) - show_fields = 6; - } else if (p->iosync > -3*p->in_inc) - show_fields = 3; /* odd+even */ - } - break; + if (keep_rate) + show_fields = 3 << (breaks & 1); + else if (p->notout >= p->num_fields && + p->iosync >= (breaks == 1 ? -p->in_inc : + p->in_inc << (p->num_fields == 1))) { + show_fields = (1 << (2 + p->num_fields)) - (1<notout >= p->num_fields) + dropped_fields += p->num_fields + 2 - breaks; + if (breaks == 1) { + if (p->iosync >= 4*p->in_inc) + show_fields = 6; + } else if (p->iosync > -3*p->in_inc) + show_fields = 3; /* odd+even */ + } + break; } show_fields &= 15; prev = p->prev_fields; if (breaks < 8) { - if (p->num_fields == 1) - breaks &= ~4; - if (breaks) - p->num_breaks++; - if (breaks == 3) - p->prev_fields = p->num_fields = 1; - else if (breaks) { - p->prev_fields = p->num_fields + (breaks==1) - (breaks==4); - p->num_fields = breaks - (breaks == 4) + (p->chflag == '|'); - } else - p->num_fields += 2; + if (p->num_fields == 1) + breaks &= ~4; + if (breaks) + p->num_breaks++; + if (breaks == 3) + p->prev_fields = p->num_fields = 1; + else if (breaks) { + p->prev_fields = p->num_fields + (breaks==1) - (breaks==4); + p->num_fields = breaks - (breaks == 4) + (p->chflag == '|'); + } else + p->num_fields += 2; } else - p->num_fields += 2; + p->num_fields += 2; p->iosync += 4 * p->in_inc; if (p->chflag == '|') - p->iosync += p->in_inc; + p->iosync += p->in_inc; if (show_fields) { - p->iosync -= p->out_dec; - p->notout = !(show_fields & 1) + !(show_fields & 3); - if (((show_fields & 3) == 3 && - (s->low.noise + s->interlaced_low < (s->num_blocks>>8) || - s->sad.noise < 160)) || - ((show_fields & 12) == 12 && - (ps->low.noise + ps->interlaced_low < (s->num_blocks>>8) || - ps->sad.noise < 160))) { - p->export_count++; - dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, - MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE, - p->w, p->h); - if ((show_fields & 3) != 3) planes = old_planes; - dmpi->planes[0] = planes[0]; - dmpi->stride[0] = p->stride; - dmpi->width = mpi->width; - if (mpi->flags & MP_IMGFLAG_PLANAR) { - dmpi->planes[1] = planes[1]; - dmpi->planes[2] = planes[2]; - dmpi->stride[1] = p->chroma_stride; - dmpi->stride[2] = p->chroma_stride; - } - } else { - p->merge_count++; - dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - p->w, p->h); - copy_merge_fields(p, dmpi, old_planes, planes, show_fields); - } - p->outframes++; + p->iosync -= p->out_dec; + p->notout = !(show_fields & 1) + !(show_fields & 3); + if (((show_fields & 3) == 3 && + (s->low.noise + s->interlaced_low < (s->num_blocks>>8) || + s->sad.noise < 160)) || + ((show_fields & 12) == 12 && + (ps->low.noise + ps->interlaced_low < (s->num_blocks>>8) || + ps->sad.noise < 160))) { + p->export_count++; + dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, + MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE, + p->w, p->h); + if ((show_fields & 3) != 3) planes = old_planes; + dmpi->planes[0] = planes[0]; + dmpi->stride[0] = p->stride; + dmpi->width = mpi->width; + if (mpi->flags & MP_IMGFLAG_PLANAR) { + dmpi->planes[1] = planes[1]; + dmpi->planes[2] = planes[2]; + dmpi->stride[1] = p->chroma_stride; + dmpi->stride[2] = p->chroma_stride; + } + } else { + p->merge_count++; + dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + p->w, p->h); + copy_merge_fields(p, dmpi, old_planes, planes, show_fields); + } + p->outframes++; } else - p->notout += 2; + p->notout += 2; if (p->verbose) - mp_msg(MSGT_VFILTER, MSGL_INFO, "%lu %lu: %x %c %c %lu%s%s%c%s\n", - p->inframes, p->outframes, - breaks, breaks<8 && breaks>0 ? (int) p->prev_fields+'0' : ' ', - ITOC(show_fields), - p->num_breaks, 5*p->in_inc == p->out_dec && breaks<8 && - breaks>0 && ((prev&~1)!=2 || prev+p->prev_fields!=5) ? - " ######## bad telecine ########" : "", - dropped_fields ? " ======== dropped ":"", ITOC(dropped_fields), - !show_fields || (show_fields & (show_fields-1)) ? - "" : " @@@@@@@@@@@@@@@@@"); + mp_msg(MSGT_VFILTER, MSGL_INFO, "%lu %lu: %x %c %c %lu%s%s%c%s\n", + p->inframes, p->outframes, + breaks, breaks<8 && breaks>0 ? (int) p->prev_fields+'0' : ' ', + ITOC(show_fields), + p->num_breaks, 5*p->in_inc == p->out_dec && breaks<8 && + breaks>0 && ((prev&~1)!=2 || prev+p->prev_fields!=5) ? + " ######## bad telecine ########" : "", + dropped_fields ? " ======== dropped ":"", ITOC(dropped_fields), + !show_fields || (show_fields & (show_fields-1)) ? + "" : " @@@@@@@@@@@@@@@@@"); p->merge_time += get_time() - diff_time; return show_fields ? vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE) : 0; @@ -1364,38 +1344,38 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) case IMGFMT_411P: case IMGFMT_422P: case IMGFMT_444P: - return vf_next_query_format(vf, fmt); + return vf_next_query_format(vf, fmt); } return 0; } static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt) { unsigned long cxm = 0; unsigned long cym = 0; struct vf_priv_s *p = vf->priv; // rounding: if(!IMGFMT_IS_RGB(outfmt) && !IMGFMT_IS_BGR(outfmt)){ - switch(outfmt){ - case IMGFMT_444P: - case IMGFMT_Y800: - case IMGFMT_Y8: - break; - case IMGFMT_YVU9: - case IMGFMT_IF09: - cym = 3; - case IMGFMT_411P: - cxm = 3; - break; - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - cym = 1; - default: - cxm = 1; - } + switch(outfmt){ + case IMGFMT_444P: + case IMGFMT_Y800: + case IMGFMT_Y8: + break; + case IMGFMT_YVU9: + case IMGFMT_IF09: + cym = 3; + case IMGFMT_411P: + cxm = 3; + break; + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + cym = 1; + default: + cxm = 1; + } } p->chroma_swapped = !!(p->crop_y & (cym+1)); if (p->w) p->w += p->crop_x & cxm; @@ -1408,8 +1388,8 @@ static int config(struct vf_instance *vf, if (p->crop_y + p->h > height) p->crop_y = 0; if(!opt_screen_size_x && !opt_screen_size_y){ - d_width = d_width * p->w/width; - d_height = d_height * p->h/height; + d_width = d_width * p->w/width; + d_height = d_height * p->h/height; } return vf_next_config(vf, p->w, p->h, d_width, d_height, flags, outfmt); } @@ -1418,8 +1398,8 @@ static void uninit(struct vf_instance *vf) { struct vf_priv_s *p = vf->priv; mp_msg(MSGT_VFILTER, MSGL_INFO, "diff_time: %.3f, merge_time: %.3f, " - "export: %lu, merge: %lu, copy: %lu\n", (double)p->diff_time, (double)p->merge_time, - p->export_count, p->merge_count, p->num_copies); + "export: %lu, merge: %lu, copy: %lu\n", p->diff_time, p->merge_time, + p->export_count, p->merge_count, p->num_copies); free(p->memory_allocated); free(p); } @@ -1444,20 +1424,20 @@ static int vf_open(vf_instance_t *vf, char *args) p->fast = 3; p->mmx2 = gCpuCaps.hasMMX2 ? 1 : gCpuCaps.has3DNow ? 2 : 0; if (args) { - const char *args_remain = parse_args(p, args); - if (args_remain) { - mp_msg(MSGT_VFILTER, MSGL_FATAL, - "filmdint: unknown suboption: %s\n", args_remain); - return 0; - } - if (p->out_dec < p->in_inc) { - mp_msg(MSGT_VFILTER, MSGL_FATAL, - "filmdint: increasing the frame rate is not supported\n"); - return 0; - } + const char *args_remain = parse_args(p, args); + if (args_remain) { + mp_msg(MSGT_VFILTER, MSGL_FATAL, + "filmdint: unknown suboption: %s\n", args_remain); + return 0; + } + if (p->out_dec < p->in_inc) { + mp_msg(MSGT_VFILTER, MSGL_FATAL, + "filmdint: increasing the frame rate is not supported\n"); + return 0; + } } if (p->mmx2 > 2) - p->mmx2 = 0; + p->mmx2 = 0; #if !HAVE_MMX p->mmx2 = 0; #endif diff --git a/mplayer/libmpcodecs/vf_framestep.c b/mplayer/libmpcodecs/vf_framestep.c index 4d04c2e6..72451d66 100644 --- a/mplayer/libmpcodecs/vf_framestep.c +++ b/mplayer/libmpcodecs/vf_framestep.c @@ -122,10 +122,10 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) ++priv->frame_cur; if (skip == 0) { - /* Get image, export type (we don't modify tghe image) */ - dmpi=vf_get_image(vf->next, mpi->imgfmt, + /* Get image, export type (we don't modify tghe image) */ + dmpi=vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, - mpi->w, mpi->h); + mpi->w, mpi->h); /* Copy only the pointer ( MP_IMGTYPE_EXPORT ! ) */ dmpi->planes[0] = mpi->planes[0]; dmpi->planes[1] = mpi->planes[1]; @@ -155,12 +155,12 @@ static void uninit(struct vf_instance *vf) /* Main entry funct for the filter */ static int vf_open(vf_instance_t *vf, char *args) { - struct vf_priv_s *p; + struct vf_priv_s *p; vf->put_image = put_image; - vf->uninit = uninit; - vf->default_reqs = VFCAP_ACCEPT_STRIDE; - vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); + vf->uninit = uninit; + vf->default_reqs = VFCAP_ACCEPT_STRIDE; + vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); if (p == NULL) { return 0; } @@ -192,7 +192,7 @@ static int vf_open(vf_instance_t *vf, char *args) } } } - return 1; + return 1; } const vf_info_t vf_info_framestep = { diff --git a/mplayer/libmpcodecs/vf_fspp.c b/mplayer/libmpcodecs/vf_fspp.c index 97a3859b..a2cc9c6b 100644 --- a/mplayer/libmpcodecs/vf_fspp.c +++ b/mplayer/libmpcodecs/vf_fspp.c @@ -106,54 +106,54 @@ struct vf_priv_s { //align 16 ! //This func reads from 1 slice, 1 and clears 0 & 1 static void store_slice_c(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale) {int y, x; -#define STORE(pos) \ - temp= (src[x + pos] + (d[pos]>>log2_scale))>>(6-log2_scale); \ - src[x + pos]=src[x + pos - 8*src_stride]=0; \ - if(temp & 0x100) temp= ~(temp>>31); \ +#define STORE(pos) \ + temp= (src[x + pos] + (d[pos]>>log2_scale))>>(6-log2_scale); \ + src[x + pos]=src[x + pos - 8*src_stride]=0; \ + if(temp & 0x100) temp= ~(temp>>31); \ dst[x + pos]= temp; for(y=0; y>log2_scale))>>(6-log2_scale); \ - src[x + pos + 16*src_stride]=0; \ - if(temp & 0x100) temp= ~(temp>>31); \ +#define STORE2(pos) \ + temp= (src[x + pos] + src[x + pos + 16*src_stride] + (d[pos]>>log2_scale))>>(6-log2_scale); \ + src[x + pos + 16*src_stride]=0; \ + if(temp & 0x100) temp= ~(temp>>31); \ dst[x + pos]= temp; for(y=0; ythreshold_mtx)[a]=q * ((short*)p->threshold_mtx_noq)[a];//ints faster in C + ((short*)p->threshold_mtx)[a]=q * ((short*)p->threshold_mtx_noq)[a];//ints faster in C } static void column_fidct_c(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt); static void row_idct_c(DCTELEM* workspace, - int16_t* output_adr, int output_stride, int cnt); + int16_t* output_adr, int output_stride, int cnt); static void row_fdct_c(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt); //this is rather ugly, but there is no need for function pointers @@ -188,63 +188,63 @@ static void store_slice_mmx(uint8_t *dst, int16_t *src, long dst_stride, long sr dst_stride-=width; //src_stride=(src_stride-width)*2; __asm__ volatile( - "mov %5, %%"REG_d" \n\t" - "mov %6, %%"REG_S" \n\t" - "mov %7, %%"REG_D" \n\t" - "mov %1, %%"REG_a" \n\t" - "movd %%"REG_d", %%mm5 \n\t" - "xor $-1, %%"REG_d" \n\t" - "mov %%"REG_a", %%"REG_c" \n\t" - "add $7, %%"REG_d" \n\t" - "neg %%"REG_a" \n\t" - "sub %0, %%"REG_c" \n\t" - "add %%"REG_c", %%"REG_c" \n\t" - "movd %%"REG_d", %%mm2 \n\t" - "mov %%"REG_c", %1 \n\t" - "mov %2, %%"REG_d" \n\t" - "shl $4, %%"REG_a" \n\t" - - "2: \n\t" - "movq (%%"REG_d"), %%mm3 \n\t" - "movq %%mm3, %%mm4 \n\t" - "pxor %%mm7, %%mm7 \n\t" - "punpcklbw %%mm7, %%mm3 \n\t" - "punpckhbw %%mm7, %%mm4 \n\t" - "mov %0, %%"REG_c" \n\t" - "psraw %%mm5, %%mm3 \n\t" - "psraw %%mm5, %%mm4 \n\t" - "1: \n\t" - "movq %%mm7, (%%"REG_S",%%"REG_a",) \n\t" - "movq (%%"REG_S"), %%mm0 \n\t" - "movq 8(%%"REG_S"), %%mm1 \n\t" - - "movq %%mm7, 8(%%"REG_S",%%"REG_a",) \n\t" - "paddw %%mm3, %%mm0 \n\t" - "paddw %%mm4, %%mm1 \n\t" - - "movq %%mm7, (%%"REG_S") \n\t" - "psraw %%mm2, %%mm0 \n\t" - "psraw %%mm2, %%mm1 \n\t" - - "movq %%mm7, 8(%%"REG_S") \n\t" - "packuswb %%mm1, %%mm0 \n\t" - "add $16, %%"REG_S" \n\t" - - "movq %%mm0, (%%"REG_D") \n\t" - "add $8, %%"REG_D" \n\t" - "sub $8, %%"REG_c" \n\t" - "jg 1b \n\t" - "add %1, %%"REG_S" \n\t" - "add $8, %%"REG_d" \n\t" - "add %3, %%"REG_D" \n\t" - "cmp %4, %%"REG_d" \n\t" - "jl 2b \n\t" - - : - : "m" (width), "m" (src_stride), "erm" (od), "m" (dst_stride), "erm" (end), - "m" (log2_scale), "m" (src), "m" (dst) //input - : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D - ); + "mov %5, %%"REG_d" \n\t" + "mov %6, %%"REG_S" \n\t" + "mov %7, %%"REG_D" \n\t" + "mov %1, %%"REG_a" \n\t" + "movd %%"REG_d", %%mm5 \n\t" + "xor $-1, %%"REG_d" \n\t" + "mov %%"REG_a", %%"REG_c" \n\t" + "add $7, %%"REG_d" \n\t" + "neg %%"REG_a" \n\t" + "sub %0, %%"REG_c" \n\t" + "add %%"REG_c", %%"REG_c" \n\t" + "movd %%"REG_d", %%mm2 \n\t" + "mov %%"REG_c", %1 \n\t" + "mov %2, %%"REG_d" \n\t" + "shl $4, %%"REG_a" \n\t" + + "2: \n\t" + "movq (%%"REG_d"), %%mm3 \n\t" + "movq %%mm3, %%mm4 \n\t" + "pxor %%mm7, %%mm7 \n\t" + "punpcklbw %%mm7, %%mm3 \n\t" + "punpckhbw %%mm7, %%mm4 \n\t" + "mov %0, %%"REG_c" \n\t" + "psraw %%mm5, %%mm3 \n\t" + "psraw %%mm5, %%mm4 \n\t" + "1: \n\t" + "movq %%mm7, (%%"REG_S",%%"REG_a",) \n\t" + "movq (%%"REG_S"), %%mm0 \n\t" + "movq 8(%%"REG_S"), %%mm1 \n\t" + + "movq %%mm7, 8(%%"REG_S",%%"REG_a",) \n\t" + "paddw %%mm3, %%mm0 \n\t" + "paddw %%mm4, %%mm1 \n\t" + + "movq %%mm7, (%%"REG_S") \n\t" + "psraw %%mm2, %%mm0 \n\t" + "psraw %%mm2, %%mm1 \n\t" + + "movq %%mm7, 8(%%"REG_S") \n\t" + "packuswb %%mm1, %%mm0 \n\t" + "add $16, %%"REG_S" \n\t" + + "movq %%mm0, (%%"REG_D") \n\t" + "add $8, %%"REG_D" \n\t" + "sub $8, %%"REG_c" \n\t" + "jg 1b \n\t" + "add %1, %%"REG_S" \n\t" + "add $8, %%"REG_d" \n\t" + "add %3, %%"REG_D" \n\t" + "cmp %4, %%"REG_d" \n\t" + "jl 2b \n\t" + + : + : "m" (width), "m" (src_stride), "erm" (od), "m" (dst_stride), "erm" (end), + "m" (log2_scale), "m" (src), "m" (dst) //input + : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D + ); } //This func reads from 2 slices, 0 & 2 and clears 2-nd @@ -256,146 +256,146 @@ static void store_slice2_mmx(uint8_t *dst, int16_t *src, long dst_stride, long s dst_stride-=width; //src_stride=(src_stride-width)*2; __asm__ volatile( - "mov %5, %%"REG_d" \n\t" - "mov %6, %%"REG_S" \n\t" - "mov %7, %%"REG_D" \n\t" - "mov %1, %%"REG_a" \n\t" - "movd %%"REG_d", %%mm5 \n\t" - "xor $-1, %%"REG_d" \n\t" - "mov %%"REG_a", %%"REG_c" \n\t" - "add $7, %%"REG_d" \n\t" - "sub %0, %%"REG_c" \n\t" - "add %%"REG_c", %%"REG_c" \n\t" - "movd %%"REG_d", %%mm2 \n\t" - "mov %%"REG_c", %1 \n\t" - "mov %2, %%"REG_d" \n\t" - "shl $5, %%"REG_a" \n\t" - - "2: \n\t" - "movq (%%"REG_d"), %%mm3 \n\t" - "movq %%mm3, %%mm4 \n\t" - "pxor %%mm7, %%mm7 \n\t" - "punpcklbw %%mm7, %%mm3 \n\t" - "punpckhbw %%mm7, %%mm4 \n\t" - "mov %0, %%"REG_c" \n\t" - "psraw %%mm5, %%mm3 \n\t" - "psraw %%mm5, %%mm4 \n\t" - "1: \n\t" - "movq (%%"REG_S"), %%mm0 \n\t" - "movq 8(%%"REG_S"), %%mm1 \n\t" - "paddw %%mm3, %%mm0 \n\t" - - "paddw (%%"REG_S",%%"REG_a",), %%mm0 \n\t" - "paddw %%mm4, %%mm1 \n\t" - "movq 8(%%"REG_S",%%"REG_a",), %%mm6 \n\t" - - "movq %%mm7, (%%"REG_S",%%"REG_a",) \n\t" - "psraw %%mm2, %%mm0 \n\t" - "paddw %%mm6, %%mm1 \n\t" - - "movq %%mm7, 8(%%"REG_S",%%"REG_a",) \n\t" - "psraw %%mm2, %%mm1 \n\t" - "packuswb %%mm1, %%mm0 \n\t" - - "movq %%mm0, (%%"REG_D") \n\t" - "add $16, %%"REG_S" \n\t" - "add $8, %%"REG_D" \n\t" - "sub $8, %%"REG_c" \n\t" - "jg 1b \n\t" - "add %1, %%"REG_S" \n\t" - "add $8, %%"REG_d" \n\t" - "add %3, %%"REG_D" \n\t" - "cmp %4, %%"REG_d" \n\t" - "jl 2b \n\t" - - : - : "m" (width), "m" (src_stride), "erm" (od), "m" (dst_stride), "erm" (end), - "m" (log2_scale), "m" (src), "m" (dst) //input - : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_D, "%"REG_S - ); + "mov %5, %%"REG_d" \n\t" + "mov %6, %%"REG_S" \n\t" + "mov %7, %%"REG_D" \n\t" + "mov %1, %%"REG_a" \n\t" + "movd %%"REG_d", %%mm5 \n\t" + "xor $-1, %%"REG_d" \n\t" + "mov %%"REG_a", %%"REG_c" \n\t" + "add $7, %%"REG_d" \n\t" + "sub %0, %%"REG_c" \n\t" + "add %%"REG_c", %%"REG_c" \n\t" + "movd %%"REG_d", %%mm2 \n\t" + "mov %%"REG_c", %1 \n\t" + "mov %2, %%"REG_d" \n\t" + "shl $5, %%"REG_a" \n\t" + + "2: \n\t" + "movq (%%"REG_d"), %%mm3 \n\t" + "movq %%mm3, %%mm4 \n\t" + "pxor %%mm7, %%mm7 \n\t" + "punpcklbw %%mm7, %%mm3 \n\t" + "punpckhbw %%mm7, %%mm4 \n\t" + "mov %0, %%"REG_c" \n\t" + "psraw %%mm5, %%mm3 \n\t" + "psraw %%mm5, %%mm4 \n\t" + "1: \n\t" + "movq (%%"REG_S"), %%mm0 \n\t" + "movq 8(%%"REG_S"), %%mm1 \n\t" + "paddw %%mm3, %%mm0 \n\t" + + "paddw (%%"REG_S",%%"REG_a",), %%mm0 \n\t" + "paddw %%mm4, %%mm1 \n\t" + "movq 8(%%"REG_S",%%"REG_a",), %%mm6 \n\t" + + "movq %%mm7, (%%"REG_S",%%"REG_a",) \n\t" + "psraw %%mm2, %%mm0 \n\t" + "paddw %%mm6, %%mm1 \n\t" + + "movq %%mm7, 8(%%"REG_S",%%"REG_a",) \n\t" + "psraw %%mm2, %%mm1 \n\t" + "packuswb %%mm1, %%mm0 \n\t" + + "movq %%mm0, (%%"REG_D") \n\t" + "add $16, %%"REG_S" \n\t" + "add $8, %%"REG_D" \n\t" + "sub $8, %%"REG_c" \n\t" + "jg 1b \n\t" + "add %1, %%"REG_S" \n\t" + "add $8, %%"REG_d" \n\t" + "add %3, %%"REG_D" \n\t" + "cmp %4, %%"REG_d" \n\t" + "jl 2b \n\t" + + : + : "m" (width), "m" (src_stride), "erm" (od), "m" (dst_stride), "erm" (end), + "m" (log2_scale), "m" (src), "m" (dst) //input + : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_D, "%"REG_S + ); } static void mul_thrmat_mmx(struct vf_priv_s *p, int q) { uint64_t *adr=&p->threshold_mtx_noq[0]; __asm__ volatile( - "movd %0, %%mm7 \n\t" - "add $8*8*2, %%"REG_D" \n\t" - "movq 0*8(%%"REG_S"), %%mm0 \n\t" - "punpcklwd %%mm7, %%mm7 \n\t" - "movq 1*8(%%"REG_S"), %%mm1 \n\t" - "punpckldq %%mm7, %%mm7 \n\t" - "pmullw %%mm7, %%mm0 \n\t" - - "movq 2*8(%%"REG_S"), %%mm2 \n\t" - "pmullw %%mm7, %%mm1 \n\t" - - "movq 3*8(%%"REG_S"), %%mm3 \n\t" - "pmullw %%mm7, %%mm2 \n\t" - - "movq %%mm0, 0*8(%%"REG_D") \n\t" - "movq 4*8(%%"REG_S"), %%mm4 \n\t" - "pmullw %%mm7, %%mm3 \n\t" - - "movq %%mm1, 1*8(%%"REG_D") \n\t" - "movq 5*8(%%"REG_S"), %%mm5 \n\t" - "pmullw %%mm7, %%mm4 \n\t" - - "movq %%mm2, 2*8(%%"REG_D") \n\t" - "movq 6*8(%%"REG_S"), %%mm6 \n\t" - "pmullw %%mm7, %%mm5 \n\t" - - "movq %%mm3, 3*8(%%"REG_D") \n\t" - "movq 7*8+0*8(%%"REG_S"), %%mm0 \n\t" - "pmullw %%mm7, %%mm6 \n\t" - - "movq %%mm4, 4*8(%%"REG_D") \n\t" - "movq 7*8+1*8(%%"REG_S"), %%mm1 \n\t" - "pmullw %%mm7, %%mm0 \n\t" - - "movq %%mm5, 5*8(%%"REG_D") \n\t" - "movq 7*8+2*8(%%"REG_S"), %%mm2 \n\t" - "pmullw %%mm7, %%mm1 \n\t" - - "movq %%mm6, 6*8(%%"REG_D") \n\t" - "movq 7*8+3*8(%%"REG_S"), %%mm3 \n\t" - "pmullw %%mm7, %%mm2 \n\t" - - "movq %%mm0, 7*8+0*8(%%"REG_D") \n\t" - "movq 7*8+4*8(%%"REG_S"), %%mm4 \n\t" - "pmullw %%mm7, %%mm3 \n\t" - - "movq %%mm1, 7*8+1*8(%%"REG_D") \n\t" - "movq 7*8+5*8(%%"REG_S"), %%mm5 \n\t" - "pmullw %%mm7, %%mm4 \n\t" - - "movq %%mm2, 7*8+2*8(%%"REG_D") \n\t" - "movq 7*8+6*8(%%"REG_S"), %%mm6 \n\t" - "pmullw %%mm7, %%mm5 \n\t" - - "movq %%mm3, 7*8+3*8(%%"REG_D") \n\t" - "movq 14*8+0*8(%%"REG_S"), %%mm0 \n\t" - "pmullw %%mm7, %%mm6 \n\t" - - "movq %%mm4, 7*8+4*8(%%"REG_D") \n\t" - "movq 14*8+1*8(%%"REG_S"), %%mm1 \n\t" - "pmullw %%mm7, %%mm0 \n\t" - - "movq %%mm5, 7*8+5*8(%%"REG_D") \n\t" - "pmullw %%mm7, %%mm1 \n\t" - - "movq %%mm6, 7*8+6*8(%%"REG_D") \n\t" - "movq %%mm0, 14*8+0*8(%%"REG_D") \n\t" - "movq %%mm1, 14*8+1*8(%%"REG_D") \n\t" - - : "+g" (q), "+S" (adr), "+D" (adr) - : - ); + "movd %0, %%mm7 \n\t" + "add $8*8*2, %%"REG_D" \n\t" + "movq 0*8(%%"REG_S"), %%mm0 \n\t" + "punpcklwd %%mm7, %%mm7 \n\t" + "movq 1*8(%%"REG_S"), %%mm1 \n\t" + "punpckldq %%mm7, %%mm7 \n\t" + "pmullw %%mm7, %%mm0 \n\t" + + "movq 2*8(%%"REG_S"), %%mm2 \n\t" + "pmullw %%mm7, %%mm1 \n\t" + + "movq 3*8(%%"REG_S"), %%mm3 \n\t" + "pmullw %%mm7, %%mm2 \n\t" + + "movq %%mm0, 0*8(%%"REG_D") \n\t" + "movq 4*8(%%"REG_S"), %%mm4 \n\t" + "pmullw %%mm7, %%mm3 \n\t" + + "movq %%mm1, 1*8(%%"REG_D") \n\t" + "movq 5*8(%%"REG_S"), %%mm5 \n\t" + "pmullw %%mm7, %%mm4 \n\t" + + "movq %%mm2, 2*8(%%"REG_D") \n\t" + "movq 6*8(%%"REG_S"), %%mm6 \n\t" + "pmullw %%mm7, %%mm5 \n\t" + + "movq %%mm3, 3*8(%%"REG_D") \n\t" + "movq 7*8+0*8(%%"REG_S"), %%mm0 \n\t" + "pmullw %%mm7, %%mm6 \n\t" + + "movq %%mm4, 4*8(%%"REG_D") \n\t" + "movq 7*8+1*8(%%"REG_S"), %%mm1 \n\t" + "pmullw %%mm7, %%mm0 \n\t" + + "movq %%mm5, 5*8(%%"REG_D") \n\t" + "movq 7*8+2*8(%%"REG_S"), %%mm2 \n\t" + "pmullw %%mm7, %%mm1 \n\t" + + "movq %%mm6, 6*8(%%"REG_D") \n\t" + "movq 7*8+3*8(%%"REG_S"), %%mm3 \n\t" + "pmullw %%mm7, %%mm2 \n\t" + + "movq %%mm0, 7*8+0*8(%%"REG_D") \n\t" + "movq 7*8+4*8(%%"REG_S"), %%mm4 \n\t" + "pmullw %%mm7, %%mm3 \n\t" + + "movq %%mm1, 7*8+1*8(%%"REG_D") \n\t" + "movq 7*8+5*8(%%"REG_S"), %%mm5 \n\t" + "pmullw %%mm7, %%mm4 \n\t" + + "movq %%mm2, 7*8+2*8(%%"REG_D") \n\t" + "movq 7*8+6*8(%%"REG_S"), %%mm6 \n\t" + "pmullw %%mm7, %%mm5 \n\t" + + "movq %%mm3, 7*8+3*8(%%"REG_D") \n\t" + "movq 14*8+0*8(%%"REG_S"), %%mm0 \n\t" + "pmullw %%mm7, %%mm6 \n\t" + + "movq %%mm4, 7*8+4*8(%%"REG_D") \n\t" + "movq 14*8+1*8(%%"REG_S"), %%mm1 \n\t" + "pmullw %%mm7, %%mm0 \n\t" + + "movq %%mm5, 7*8+5*8(%%"REG_D") \n\t" + "pmullw %%mm7, %%mm1 \n\t" + + "movq %%mm6, 7*8+6*8(%%"REG_D") \n\t" + "movq %%mm0, 14*8+0*8(%%"REG_D") \n\t" + "movq %%mm1, 14*8+1*8(%%"REG_D") \n\t" + + : "+g" (q), "+S" (adr), "+D" (adr) + : + ); } static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt); static void row_idct_mmx(DCTELEM* workspace, - int16_t* output_adr, int output_stride, int cnt); + int16_t* output_adr, int output_stride, int cnt); static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt); #define store_slice_s store_slice_mmx @@ -407,9 +407,9 @@ static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, #endif // HAVE_MMX static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, - int dst_stride, int src_stride, - int width, int height, - uint8_t *qp_store, int qp_stride, int is_luma) + int dst_stride, int src_stride, + int width, int height, + uint8_t *qp_store, int qp_stride, int is_luma) { int x, x0, y, es, qy, t; const int stride= is_luma ? p->temp_stride : (width+16);//((width+16+15)&(~15)) @@ -438,57 +438,57 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, //FIXME (try edge emu) for(y=8; y<24; y++) - memset(p->temp+ 8 +y*stride, 0,width*sizeof(int16_t)); + memset(p->temp+ 8 +y*stride, 0,width*sizeof(int16_t)); for(y=step; yheight-1) qy=height-1; - if (qy<0) qy=0; - qy=(qy>>qps)*qp_stride; - row_fdct_s(block, p->src + y*stride +2-(y&1), stride, 2); - for(x0=0; x0src + y*stride+8+x0 +2-(y&1), stride, 2*(BLOCKSZ-1)); - if(p->qp) - column_fidct_s((int16_t*)(&p->threshold_mtx[0]), block+0*8, block3+0*8, 8*(BLOCKSZ-1)); //yes, this is a HOTSPOT - else - for (x=0; x<8*(BLOCKSZ-1); x+=8) { - t=x+x0-2; //correct t=x+x0-2-(y&1), but its the same - if (t<0) t=0;//t always < width-2 - t=qp_store[qy+(t>>qps)]; - t=norm_qscale(t, p->mpeg2); - if (t!=p->prev_q) p->prev_q=t, mul_thrmat_s(p, t); - column_fidct_s((int16_t*)(&p->threshold_mtx[0]), block+x*8, block3+x*8, 8); //yes, this is a HOTSPOT - } - row_idct_s(block3+0*8, p->temp + (y&15)*stride+x0+2-(y&1), stride, 2*(BLOCKSZ-1)); - memmove(block, block+(BLOCKSZ-1)*64, 8*8*sizeof(DCTELEM)); //cycling - memmove(block3, block3+(BLOCKSZ-1)*64, 6*8*sizeof(DCTELEM)); - } - // - es=width+8-x0; // 8, ... - if (es>8) - row_fdct_s(block+8*8, p->src + y*stride+8+x0 +2-(y&1), stride, (es-4)>>2); - column_fidct_s((int16_t*)(&p->threshold_mtx[0]), block, block3, es&(~1)); - row_idct_s(block3+0*8, p->temp + (y&15)*stride+x0+2-(y&1), stride, es>>2); - {const int y1=y-8+step;//l5-7 l4-6 - if (!(y1&7) && y1) { - if (y1&8) store_slice_s(dst + (y1-8)*dst_stride, p->temp+ 8 +8*stride, - dst_stride, stride, width, 8, 5-p->log2_count); - else store_slice2_s(dst + (y1-8)*dst_stride, p->temp+ 8 +0*stride, - dst_stride, stride, width, 8, 5-p->log2_count); - } } + qy=y-4; + if (qy>height-1) qy=height-1; + if (qy<0) qy=0; + qy=(qy>>qps)*qp_stride; + row_fdct_s(block, p->src + y*stride +2-(y&1), stride, 2); + for(x0=0; x0src + y*stride+8+x0 +2-(y&1), stride, 2*(BLOCKSZ-1)); + if(p->qp) + column_fidct_s((int16_t*)(&p->threshold_mtx[0]), block+0*8, block3+0*8, 8*(BLOCKSZ-1)); //yes, this is a HOTSPOT + else + for (x=0; x<8*(BLOCKSZ-1); x+=8) { + t=x+x0-2; //correct t=x+x0-2-(y&1), but its the same + if (t<0) t=0;//t always < width-2 + t=qp_store[qy+(t>>qps)]; + t=norm_qscale(t, p->mpeg2); + if (t!=p->prev_q) p->prev_q=t, mul_thrmat_s(p, t); + column_fidct_s((int16_t*)(&p->threshold_mtx[0]), block+x*8, block3+x*8, 8); //yes, this is a HOTSPOT + } + row_idct_s(block3+0*8, p->temp + (y&15)*stride+x0+2-(y&1), stride, 2*(BLOCKSZ-1)); + memmove(block, block+(BLOCKSZ-1)*64, 8*8*sizeof(DCTELEM)); //cycling + memmove(block3, block3+(BLOCKSZ-1)*64, 6*8*sizeof(DCTELEM)); + } + // + es=width+8-x0; // 8, ... + if (es>8) + row_fdct_s(block+8*8, p->src + y*stride+8+x0 +2-(y&1), stride, (es-4)>>2); + column_fidct_s((int16_t*)(&p->threshold_mtx[0]), block, block3, es&(~1)); + row_idct_s(block3+0*8, p->temp + (y&15)*stride+x0+2-(y&1), stride, es>>2); + {const int y1=y-8+step;//l5-7 l4-6 + if (!(y1&7) && y1) { + if (y1&8) store_slice_s(dst + (y1-8)*dst_stride, p->temp+ 8 +8*stride, + dst_stride, stride, width, 8, 5-p->log2_count); + else store_slice2_s(dst + (y1-8)*dst_stride, p->temp+ 8 +0*stride, + dst_stride, stride, width, 8, 5-p->log2_count); + } } } if (y&7) { // == height & 7 - if (y&8) store_slice_s(dst + ((y-8)&~7)*dst_stride, p->temp+ 8 +8*stride, - dst_stride, stride, width, y&7, 5-p->log2_count); - else store_slice2_s(dst + ((y-8)&~7)*dst_stride, p->temp+ 8 +0*stride, - dst_stride, stride, width, y&7, 5-p->log2_count); + if (y&8) store_slice_s(dst + ((y-8)&~7)*dst_stride, p->temp+ 8 +8*stride, + dst_stride, stride, width, y&7, 5-p->log2_count); + else store_slice2_s(dst + ((y-8)&~7)*dst_stride, p->temp+ 8 +0*stride, + dst_stride, stride, width, y&7, 5-p->log2_count); } } static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt) { int h= (height+16+15)&(~15); @@ -505,7 +505,7 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi) if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change // ok, we can do pp in-place (or pp disabled): vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, - mpi->type, mpi->flags, mpi->width, mpi->height); + mpi->type, mpi->flags, mpi->width, mpi->height); mpi->planes[0]=vf->dmpi->planes[0]; mpi->stride[0]=vf->dmpi->stride[0]; mpi->width=vf->dmpi->width; @@ -522,14 +522,14 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { mp_image_t *dmpi; if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ - // no DR, so get a new image! hope we'll get DR buffer: - dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_TEMP, - MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE, - mpi->width,mpi->height); - vf_clone_mpi_attributes(dmpi, mpi); + // no DR, so get a new image! hope we'll get DR buffer: + dmpi=vf_get_image(vf->next,mpi->imgfmt, + MP_IMGTYPE_TEMP, + MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE, + mpi->width,mpi->height); + vf_clone_mpi_attributes(dmpi, mpi); }else{ - dmpi=vf->dmpi; + dmpi=vf->dmpi; } vf->priv->mpeg2= mpi->qscale_type; @@ -545,22 +545,22 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) fast_memcpy(vf->priv->non_b_qp, mpi->qscale, w*h); } if(vf->priv->log2_count || !(mpi->flags&MP_IMGFLAG_DIRECT)){ - char *qp_tab= vf->priv->non_b_qp; - if(vf->priv->bframes || !qp_tab) - qp_tab= mpi->qscale; - - if(qp_tab || vf->priv->qp){ - filter(vf->priv, dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], - mpi->w, mpi->h, qp_tab, mpi->qstride, 1); - filter(vf->priv, dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], - mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, qp_tab, mpi->qstride, 0); - filter(vf->priv, dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], - mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, qp_tab, mpi->qstride, 0); - }else{ - memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]); - memcpy_pic(dmpi->planes[1], mpi->planes[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[1], mpi->stride[1]); - memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[2], mpi->stride[2]); - } + char *qp_tab= vf->priv->non_b_qp; + if(vf->priv->bframes || !qp_tab) + qp_tab= mpi->qscale; + + if(qp_tab || vf->priv->qp){ + filter(vf->priv, dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], + mpi->w, mpi->h, qp_tab, mpi->qstride, 1); + filter(vf->priv, dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], + mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, qp_tab, mpi->qstride, 0); + filter(vf->priv, dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], + mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, qp_tab, mpi->qstride, 0); + }else{ + memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]); + memcpy_pic(dmpi->planes[1], mpi->planes[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[1], mpi->stride[1]); + memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[2], mpi->stride[2]); + } } #if HAVE_MMX @@ -605,7 +605,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) case IMGFMT_444P: case IMGFMT_422P: case IMGFMT_411P: - return vf_next_query_format(vf,fmt); + return vf_next_query_format(vf,fmt); } return 0; } @@ -650,7 +650,7 @@ static int vf_open(vf_instance_t *vf, char *args) if( log2c >=4 && log2c <=5 ) vf->priv->log2_count = log2c; else if( log2c >= 6 ) - vf->priv->log2_count = 5; + vf->priv->log2_count = 5; if(vf->priv->qp < 0) vf->priv->qp = 0; @@ -662,16 +662,16 @@ static int vf_open(vf_instance_t *vf, char *args) vf->priv->prev_q=0; // for(i=0;i<64;i++) //FIXME: tune custom_threshold[] and remove this ! - custom_threshold_m[i]=(int)(custom_threshold[i]*(bias/71.)+ 0.5); + custom_threshold_m[i]=(int)(custom_threshold[i]*(bias/71.)+ 0.5); for(i=0;i<8;i++){ - vf->priv->threshold_mtx_noq[2*i]=(uint64_t)custom_threshold_m[i*8+2] - |(((uint64_t)custom_threshold_m[i*8+6])<<16) - |(((uint64_t)custom_threshold_m[i*8+0])<<32) - |(((uint64_t)custom_threshold_m[i*8+4])<<48); - vf->priv->threshold_mtx_noq[2*i+1]=(uint64_t)custom_threshold_m[i*8+5] - |(((uint64_t)custom_threshold_m[i*8+3])<<16) - |(((uint64_t)custom_threshold_m[i*8+1])<<32) - |(((uint64_t)custom_threshold_m[i*8+7])<<48); + vf->priv->threshold_mtx_noq[2*i]=(uint64_t)custom_threshold_m[i*8+2] + |(((uint64_t)custom_threshold_m[i*8+6])<<16) + |(((uint64_t)custom_threshold_m[i*8+0])<<32) + |(((uint64_t)custom_threshold_m[i*8+4])<<48); + vf->priv->threshold_mtx_noq[2*i+1]=(uint64_t)custom_threshold_m[i*8+5] + |(((uint64_t)custom_threshold_m[i*8+3])<<16) + |(((uint64_t)custom_threshold_m[i*8+1])<<32) + |(((uint64_t)custom_threshold_m[i*8+7])<<48); } if (vf->priv->qp) vf->priv->prev_q=vf->priv->qp, mul_thrmat_s(vf->priv, vf->priv->qp); @@ -761,110 +761,110 @@ static void column_fidct_c(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int wsptr = output; for (; cnt > 0; cnt-=2) { //start positions - threshold=(int16_t*)thr_adr;//threshold_mtx - for (ctr = DCTSIZE; ctr > 0; ctr--) { - // Process columns from input, add to output. - tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; - tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; - - tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; - tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; - - tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; - tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; - - tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; - tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; - - // Even part of FDCT - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - - d0 = tmp10 + tmp11; - d4 = tmp10 - tmp11; - - z1 = MULTIPLY16H((tmp12 + tmp13) <<2, FIX_0_707106781); - d2 = tmp13 + z1; - d6 = tmp13 - z1; - - // Even part of IDCT - - THRESHOLD(tmp0, d0, threshold[0*8]); - THRESHOLD(tmp1, d2, threshold[2*8]); - THRESHOLD(tmp2, d4, threshold[4*8]); - THRESHOLD(tmp3, d6, threshold[6*8]); - tmp0+=2; - tmp10 = (tmp0 + tmp2)>>2; - tmp11 = (tmp0 - tmp2)>>2; - - tmp13 = (tmp1 + tmp3)>>2; //+2 ! (psnr decides) - tmp12 = MULTIPLY16H((tmp1 - tmp3), FIX_1_414213562_A) - tmp13; //<<2 - - tmp0 = tmp10 + tmp13; //->temps - tmp3 = tmp10 - tmp13; //->temps - tmp1 = tmp11 + tmp12; //->temps - tmp2 = tmp11 - tmp12; //->temps - - // Odd part of FDCT - - tmp10 = tmp4 + tmp5; - tmp11 = tmp5 + tmp6; - tmp12 = tmp6 + tmp7; - - z5 = MULTIPLY16H((tmp10 - tmp12)<<2, FIX_0_382683433); - z2 = MULTIPLY16H(tmp10 <<2, FIX_0_541196100) + z5; - z4 = MULTIPLY16H(tmp12 <<2, FIX_1_306562965) + z5; - z3 = MULTIPLY16H(tmp11 <<2, FIX_0_707106781); - - z11 = tmp7 + z3; - z13 = tmp7 - z3; - - d5 = z13 + z2; - d3 = z13 - z2; - d1 = z11 + z4; - d7 = z11 - z4; - - // Odd part of IDCT - - THRESHOLD(tmp4, d1, threshold[1*8]); - THRESHOLD(tmp5, d3, threshold[3*8]); - THRESHOLD(tmp6, d5, threshold[5*8]); - THRESHOLD(tmp7, d7, threshold[7*8]); - - //Simd version uses here a shortcut for the tmp5,tmp6,tmp7 == 0 - z13 = tmp6 + tmp5; - z10 = (tmp6 - tmp5)<<1; - z11 = tmp4 + tmp7; - z12 = (tmp4 - tmp7)<<1; - - tmp7 = (z11 + z13)>>2; //+2 ! - tmp11 = MULTIPLY16H((z11 - z13)<<1, FIX_1_414213562); - z5 = MULTIPLY16H(z10 + z12, FIX_1_847759065); - tmp10 = MULTIPLY16H(z12, FIX_1_082392200) - z5; - tmp12 = MULTIPLY16H(z10, FIX_2_613125930) + z5; // - !! - - tmp6 = tmp12 - tmp7; - tmp5 = tmp11 - tmp6; - tmp4 = tmp10 + tmp5; - - wsptr[DCTSIZE*0]+= (tmp0 + tmp7); - wsptr[DCTSIZE*1]+= (tmp1 + tmp6); - wsptr[DCTSIZE*2]+= (tmp2 + tmp5); - wsptr[DCTSIZE*3]+= (tmp3 - tmp4); - wsptr[DCTSIZE*4]+= (tmp3 + tmp4); - wsptr[DCTSIZE*5]+= (tmp2 - tmp5); - wsptr[DCTSIZE*6]= (tmp1 - tmp6); - wsptr[DCTSIZE*7]= (tmp0 - tmp7); - // - dataptr++; //next column - wsptr++; - threshold++; - } - dataptr+=8; //skip each second start pos - wsptr +=8; + threshold=(int16_t*)thr_adr;//threshold_mtx + for (ctr = DCTSIZE; ctr > 0; ctr--) { + // Process columns from input, add to output. + tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7]; + tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7]; + + tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6]; + tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6]; + + tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5]; + tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5]; + + tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4]; + tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4]; + + // Even part of FDCT + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + + d0 = tmp10 + tmp11; + d4 = tmp10 - tmp11; + + z1 = MULTIPLY16H((tmp12 + tmp13) <<2, FIX_0_707106781); + d2 = tmp13 + z1; + d6 = tmp13 - z1; + + // Even part of IDCT + + THRESHOLD(tmp0, d0, threshold[0*8]); + THRESHOLD(tmp1, d2, threshold[2*8]); + THRESHOLD(tmp2, d4, threshold[4*8]); + THRESHOLD(tmp3, d6, threshold[6*8]); + tmp0+=2; + tmp10 = (tmp0 + tmp2)>>2; + tmp11 = (tmp0 - tmp2)>>2; + + tmp13 = (tmp1 + tmp3)>>2; //+2 ! (psnr decides) + tmp12 = MULTIPLY16H((tmp1 - tmp3), FIX_1_414213562_A) - tmp13; //<<2 + + tmp0 = tmp10 + tmp13; //->temps + tmp3 = tmp10 - tmp13; //->temps + tmp1 = tmp11 + tmp12; //->temps + tmp2 = tmp11 - tmp12; //->temps + + // Odd part of FDCT + + tmp10 = tmp4 + tmp5; + tmp11 = tmp5 + tmp6; + tmp12 = tmp6 + tmp7; + + z5 = MULTIPLY16H((tmp10 - tmp12)<<2, FIX_0_382683433); + z2 = MULTIPLY16H(tmp10 <<2, FIX_0_541196100) + z5; + z4 = MULTIPLY16H(tmp12 <<2, FIX_1_306562965) + z5; + z3 = MULTIPLY16H(tmp11 <<2, FIX_0_707106781); + + z11 = tmp7 + z3; + z13 = tmp7 - z3; + + d5 = z13 + z2; + d3 = z13 - z2; + d1 = z11 + z4; + d7 = z11 - z4; + + // Odd part of IDCT + + THRESHOLD(tmp4, d1, threshold[1*8]); + THRESHOLD(tmp5, d3, threshold[3*8]); + THRESHOLD(tmp6, d5, threshold[5*8]); + THRESHOLD(tmp7, d7, threshold[7*8]); + + //Simd version uses here a shortcut for the tmp5,tmp6,tmp7 == 0 + z13 = tmp6 + tmp5; + z10 = (tmp6 - tmp5)<<1; + z11 = tmp4 + tmp7; + z12 = (tmp4 - tmp7)<<1; + + tmp7 = (z11 + z13)>>2; //+2 ! + tmp11 = MULTIPLY16H((z11 - z13)<<1, FIX_1_414213562); + z5 = MULTIPLY16H(z10 + z12, FIX_1_847759065); + tmp10 = MULTIPLY16H(z12, FIX_1_082392200) - z5; + tmp12 = MULTIPLY16H(z10, FIX_2_613125930) + z5; // - !! + + tmp6 = tmp12 - tmp7; + tmp5 = tmp11 - tmp6; + tmp4 = tmp10 + tmp5; + + wsptr[DCTSIZE*0]+= (tmp0 + tmp7); + wsptr[DCTSIZE*1]+= (tmp1 + tmp6); + wsptr[DCTSIZE*2]+= (tmp2 + tmp5); + wsptr[DCTSIZE*3]+= (tmp3 - tmp4); + wsptr[DCTSIZE*4]+= (tmp3 + tmp4); + wsptr[DCTSIZE*5]+= (tmp2 - tmp5); + wsptr[DCTSIZE*6]= (tmp1 - tmp6); + wsptr[DCTSIZE*7]= (tmp0 - tmp7); + // + dataptr++; //next column + wsptr++; + threshold++; + } + dataptr+=8; //skip each second start pos + wsptr +=8; } } @@ -874,731 +874,731 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, { uint64_t __attribute__((aligned(8))) temps[4]; __asm__ volatile( - ASMALIGN(4) - "1: \n\t" - "movq "DCTSIZE_S"*0*2(%%"REG_S"), %%mm1 \n\t" - // - "movq "DCTSIZE_S"*3*2(%%"REG_S"), %%mm7 \n\t" - "movq %%mm1, %%mm0 \n\t" + ASMALIGN(4) + "1: \n\t" + "movq "DCTSIZE_S"*0*2(%%"REG_S"), %%mm1 \n\t" + // + "movq "DCTSIZE_S"*3*2(%%"REG_S"), %%mm7 \n\t" + "movq %%mm1, %%mm0 \n\t" - "paddw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm1 \n\t" //t0 - "movq %%mm7, %%mm3 \n\t" + "paddw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm1 \n\t" //t0 + "movq %%mm7, %%mm3 \n\t" - "paddw "DCTSIZE_S"*4*2(%%"REG_S"), %%mm7 \n\t" //t3 - "movq %%mm1, %%mm5 \n\t" + "paddw "DCTSIZE_S"*4*2(%%"REG_S"), %%mm7 \n\t" //t3 + "movq %%mm1, %%mm5 \n\t" - "movq "DCTSIZE_S"*1*2(%%"REG_S"), %%mm6 \n\t" - "psubw %%mm7, %%mm1 \n\t" //t13 + "movq "DCTSIZE_S"*1*2(%%"REG_S"), %%mm6 \n\t" + "psubw %%mm7, %%mm1 \n\t" //t13 - "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t" - "movq %%mm6, %%mm4 \n\t" + "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t" + "movq %%mm6, %%mm4 \n\t" - "paddw "DCTSIZE_S"*6*2(%%"REG_S"), %%mm6 \n\t" //t1 - "paddw %%mm7, %%mm5 \n\t" //t10 + "paddw "DCTSIZE_S"*6*2(%%"REG_S"), %%mm6 \n\t" //t1 + "paddw %%mm7, %%mm5 \n\t" //t10 - "paddw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t2 - "movq %%mm6, %%mm7 \n\t" + "paddw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t2 + "movq %%mm6, %%mm7 \n\t" - "paddw %%mm2, %%mm6 \n\t" //t11 - "psubw %%mm2, %%mm7 \n\t" //t12 + "paddw %%mm2, %%mm6 \n\t" //t11 + "psubw %%mm2, %%mm7 \n\t" //t12 - "movq %%mm5, %%mm2 \n\t" - "paddw %%mm6, %%mm5 \n\t" //d0 - // i0 t13 t12 i3 i1 d0 - d4 - "psubw %%mm6, %%mm2 \n\t" //d4 - "paddw %%mm1, %%mm7 \n\t" + "movq %%mm5, %%mm2 \n\t" + "paddw %%mm6, %%mm5 \n\t" //d0 + // i0 t13 t12 i3 i1 d0 - d4 + "psubw %%mm6, %%mm2 \n\t" //d4 + "paddw %%mm1, %%mm7 \n\t" - "movq 4*16(%%"REG_d"), %%mm6 \n\t" - "psllw $2, %%mm7 \n\t" + "movq 4*16(%%"REG_d"), %%mm6 \n\t" + "psllw $2, %%mm7 \n\t" - "psubw 0*16(%%"REG_d"), %%mm5 \n\t" - "psubw %%mm6, %%mm2 \n\t" + "psubw 0*16(%%"REG_d"), %%mm5 \n\t" + "psubw %%mm6, %%mm2 \n\t" - "paddusw 0*16(%%"REG_d"), %%mm5 \n\t" - "paddusw %%mm6, %%mm2 \n\t" + "paddusw 0*16(%%"REG_d"), %%mm5 \n\t" + "paddusw %%mm6, %%mm2 \n\t" - "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm7 \n\t" - // - "paddw 0*16(%%"REG_d"), %%mm5 \n\t" - "paddw %%mm6, %%mm2 \n\t" + "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm7 \n\t" + // + "paddw 0*16(%%"REG_d"), %%mm5 \n\t" + "paddw %%mm6, %%mm2 \n\t" - "psubusw 0*16(%%"REG_d"), %%mm5 \n\t" - "psubusw %%mm6, %%mm2 \n\t" + "psubusw 0*16(%%"REG_d"), %%mm5 \n\t" + "psubusw %%mm6, %%mm2 \n\t" //This func is totally compute-bound, operates at huge speed. So, DC shortcut // at this place isn't worthwhile due to BTB miss penalty (checked on Pent. 3). //However, typical numbers: nondc - 29%%, dc - 46%%, zero - 25%%. All <> 0 case is very rare. - "paddw "MANGLE(MM_2)", %%mm5 \n\t" - "movq %%mm2, %%mm6 \n\t" + "paddw "MANGLE(MM_2)", %%mm5 \n\t" + "movq %%mm2, %%mm6 \n\t" - "paddw %%mm5, %%mm2 \n\t" - "psubw %%mm6, %%mm5 \n\t" + "paddw %%mm5, %%mm2 \n\t" + "psubw %%mm6, %%mm5 \n\t" - "movq %%mm1, %%mm6 \n\t" - "paddw %%mm7, %%mm1 \n\t" //d2 + "movq %%mm1, %%mm6 \n\t" + "paddw %%mm7, %%mm1 \n\t" //d2 - "psubw 2*16(%%"REG_d"), %%mm1 \n\t" - "psubw %%mm7, %%mm6 \n\t" //d6 + "psubw 2*16(%%"REG_d"), %%mm1 \n\t" + "psubw %%mm7, %%mm6 \n\t" //d6 - "movq 6*16(%%"REG_d"), %%mm7 \n\t" - "psraw $2, %%mm5 \n\t" + "movq 6*16(%%"REG_d"), %%mm7 \n\t" + "psraw $2, %%mm5 \n\t" - "paddusw 2*16(%%"REG_d"), %%mm1 \n\t" - "psubw %%mm7, %%mm6 \n\t" - // t7 d2 /t11 t4 t6 - d6 /t10 + "paddusw 2*16(%%"REG_d"), %%mm1 \n\t" + "psubw %%mm7, %%mm6 \n\t" + // t7 d2 /t11 t4 t6 - d6 /t10 - "paddw 2*16(%%"REG_d"), %%mm1 \n\t" - "paddusw %%mm7, %%mm6 \n\t" + "paddw 2*16(%%"REG_d"), %%mm1 \n\t" + "paddusw %%mm7, %%mm6 \n\t" - "psubusw 2*16(%%"REG_d"), %%mm1 \n\t" - "paddw %%mm7, %%mm6 \n\t" + "psubusw 2*16(%%"REG_d"), %%mm1 \n\t" + "paddw %%mm7, %%mm6 \n\t" - "psubw "DCTSIZE_S"*4*2(%%"REG_S"), %%mm3 \n\t" - "psubusw %%mm7, %%mm6 \n\t" + "psubw "DCTSIZE_S"*4*2(%%"REG_S"), %%mm3 \n\t" + "psubusw %%mm7, %%mm6 \n\t" - //movq [edi+"DCTSIZE_S"*2*2], mm1 - //movq [edi+"DCTSIZE_S"*6*2], mm6 - "movq %%mm1, %%mm7 \n\t" - "psraw $2, %%mm2 \n\t" + //movq [edi+"DCTSIZE_S"*2*2], mm1 + //movq [edi+"DCTSIZE_S"*6*2], mm6 + "movq %%mm1, %%mm7 \n\t" + "psraw $2, %%mm2 \n\t" - "psubw "DCTSIZE_S"*6*2(%%"REG_S"), %%mm4 \n\t" - "psubw %%mm6, %%mm1 \n\t" + "psubw "DCTSIZE_S"*6*2(%%"REG_S"), %%mm4 \n\t" + "psubw %%mm6, %%mm1 \n\t" - "psubw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm0 \n\t" - "paddw %%mm7, %%mm6 \n\t" //'t13 + "psubw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm0 \n\t" + "paddw %%mm7, %%mm6 \n\t" //'t13 - "psraw $2, %%mm6 \n\t" //paddw mm6, MM_2 !! --- - "movq %%mm2, %%mm7 \n\t" + "psraw $2, %%mm6 \n\t" //paddw mm6, MM_2 !! --- + "movq %%mm2, %%mm7 \n\t" - "pmulhw "MANGLE(MM_FIX_1_414213562_A)", %%mm1 \n\t" - "paddw %%mm6, %%mm2 \n\t" //'t0 + "pmulhw "MANGLE(MM_FIX_1_414213562_A)", %%mm1 \n\t" + "paddw %%mm6, %%mm2 \n\t" //'t0 - "movq %%mm2, 0*8+%3 \n\t" //! - "psubw %%mm6, %%mm7 \n\t" //'t3 + "movq %%mm2, 0*8+%3 \n\t" //! + "psubw %%mm6, %%mm7 \n\t" //'t3 - "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t" - "psubw %%mm6, %%mm1 \n\t" //'t12 + "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t" + "psubw %%mm6, %%mm1 \n\t" //'t12 - "psubw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t5 - "movq %%mm5, %%mm6 \n\t" + "psubw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t5 + "movq %%mm5, %%mm6 \n\t" - "movq %%mm7, 3*8+%3 \n\t" - "paddw %%mm2, %%mm3 \n\t" //t10 + "movq %%mm7, 3*8+%3 \n\t" + "paddw %%mm2, %%mm3 \n\t" //t10 - "paddw %%mm4, %%mm2 \n\t" //t11 - "paddw %%mm0, %%mm4 \n\t" //t12 + "paddw %%mm4, %%mm2 \n\t" //t11 + "paddw %%mm0, %%mm4 \n\t" //t12 - "movq %%mm3, %%mm7 \n\t" - "psubw %%mm4, %%mm3 \n\t" + "movq %%mm3, %%mm7 \n\t" + "psubw %%mm4, %%mm3 \n\t" - "psllw $2, %%mm3 \n\t" - "psllw $2, %%mm7 \n\t" //opt for P6 + "psllw $2, %%mm3 \n\t" + "psllw $2, %%mm7 \n\t" //opt for P6 - "pmulhw "MANGLE(MM_FIX_0_382683433)", %%mm3 \n\t" - "psllw $2, %%mm4 \n\t" + "pmulhw "MANGLE(MM_FIX_0_382683433)", %%mm3 \n\t" + "psllw $2, %%mm4 \n\t" - "pmulhw "MANGLE(MM_FIX_0_541196100)", %%mm7 \n\t" - "psllw $2, %%mm2 \n\t" + "pmulhw "MANGLE(MM_FIX_0_541196100)", %%mm7 \n\t" + "psllw $2, %%mm2 \n\t" - "pmulhw "MANGLE(MM_FIX_1_306562965)", %%mm4 \n\t" - "paddw %%mm1, %%mm5 \n\t" //'t1 + "pmulhw "MANGLE(MM_FIX_1_306562965)", %%mm4 \n\t" + "paddw %%mm1, %%mm5 \n\t" //'t1 - "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm2 \n\t" - "psubw %%mm1, %%mm6 \n\t" //'t2 - // t7 't12 't11 t4 t6 - 't13 't10 --- + "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm2 \n\t" + "psubw %%mm1, %%mm6 \n\t" //'t2 + // t7 't12 't11 t4 t6 - 't13 't10 --- - "paddw %%mm3, %%mm7 \n\t" //z2 + "paddw %%mm3, %%mm7 \n\t" //z2 - "movq %%mm5, 1*8+%3 \n\t" - "paddw %%mm3, %%mm4 \n\t" //z4 + "movq %%mm5, 1*8+%3 \n\t" + "paddw %%mm3, %%mm4 \n\t" //z4 - "movq 3*16(%%"REG_d"), %%mm3 \n\t" - "movq %%mm0, %%mm1 \n\t" + "movq 3*16(%%"REG_d"), %%mm3 \n\t" + "movq %%mm0, %%mm1 \n\t" - "movq %%mm6, 2*8+%3 \n\t" - "psubw %%mm2, %%mm1 \n\t" //z13 + "movq %%mm6, 2*8+%3 \n\t" + "psubw %%mm2, %%mm1 \n\t" //z13 //=== - "paddw %%mm2, %%mm0 \n\t" //z11 - "movq %%mm1, %%mm5 \n\t" + "paddw %%mm2, %%mm0 \n\t" //z11 + "movq %%mm1, %%mm5 \n\t" - "movq 5*16(%%"REG_d"), %%mm2 \n\t" - "psubw %%mm7, %%mm1 \n\t" //d3 + "movq 5*16(%%"REG_d"), %%mm2 \n\t" + "psubw %%mm7, %%mm1 \n\t" //d3 - "paddw %%mm7, %%mm5 \n\t" //d5 - "psubw %%mm3, %%mm1 \n\t" + "paddw %%mm7, %%mm5 \n\t" //d5 + "psubw %%mm3, %%mm1 \n\t" - "movq 1*16(%%"REG_d"), %%mm7 \n\t" - "psubw %%mm2, %%mm5 \n\t" + "movq 1*16(%%"REG_d"), %%mm7 \n\t" + "psubw %%mm2, %%mm5 \n\t" - "movq %%mm0, %%mm6 \n\t" - "paddw %%mm4, %%mm0 \n\t" //d1 + "movq %%mm0, %%mm6 \n\t" + "paddw %%mm4, %%mm0 \n\t" //d1 - "paddusw %%mm3, %%mm1 \n\t" - "psubw %%mm4, %%mm6 \n\t" //d7 + "paddusw %%mm3, %%mm1 \n\t" + "psubw %%mm4, %%mm6 \n\t" //d7 - // d1 d3 - - - d5 d7 - - "movq 7*16(%%"REG_d"), %%mm4 \n\t" - "psubw %%mm7, %%mm0 \n\t" + // d1 d3 - - - d5 d7 - + "movq 7*16(%%"REG_d"), %%mm4 \n\t" + "psubw %%mm7, %%mm0 \n\t" - "psubw %%mm4, %%mm6 \n\t" - "paddusw %%mm2, %%mm5 \n\t" + "psubw %%mm4, %%mm6 \n\t" + "paddusw %%mm2, %%mm5 \n\t" - "paddusw %%mm4, %%mm6 \n\t" - "paddw %%mm3, %%mm1 \n\t" + "paddusw %%mm4, %%mm6 \n\t" + "paddw %%mm3, %%mm1 \n\t" - "paddw %%mm2, %%mm5 \n\t" - "paddw %%mm4, %%mm6 \n\t" + "paddw %%mm2, %%mm5 \n\t" + "paddw %%mm4, %%mm6 \n\t" - "psubusw %%mm3, %%mm1 \n\t" - "psubusw %%mm2, %%mm5 \n\t" + "psubusw %%mm3, %%mm1 \n\t" + "psubusw %%mm2, %%mm5 \n\t" - "psubusw %%mm4, %%mm6 \n\t" - "movq %%mm1, %%mm4 \n\t" + "psubusw %%mm4, %%mm6 \n\t" + "movq %%mm1, %%mm4 \n\t" - "por %%mm5, %%mm4 \n\t" - "paddusw %%mm7, %%mm0 \n\t" + "por %%mm5, %%mm4 \n\t" + "paddusw %%mm7, %%mm0 \n\t" - "por %%mm6, %%mm4 \n\t" - "paddw %%mm7, %%mm0 \n\t" + "por %%mm6, %%mm4 \n\t" + "paddw %%mm7, %%mm0 \n\t" - "packssdw %%mm4, %%mm4 \n\t" - "psubusw %%mm7, %%mm0 \n\t" + "packssdw %%mm4, %%mm4 \n\t" + "psubusw %%mm7, %%mm0 \n\t" - "movd %%mm4, %%"REG_a" \n\t" - "or %%"REG_a", %%"REG_a" \n\t" - "jnz 2f \n\t" - //movq [edi+"DCTSIZE_S"*3*2], mm1 - //movq [edi+"DCTSIZE_S"*5*2], mm5 - //movq [edi+"DCTSIZE_S"*1*2], mm0 - //movq [edi+"DCTSIZE_S"*7*2], mm6 - // t4 t5 - - - t6 t7 - - //--- t4 (mm0) may be <>0; mm1, mm5, mm6 == 0 + "movd %%mm4, %%"REG_a" \n\t" + "or %%"REG_a", %%"REG_a" \n\t" + "jnz 2f \n\t" + //movq [edi+"DCTSIZE_S"*3*2], mm1 + //movq [edi+"DCTSIZE_S"*5*2], mm5 + //movq [edi+"DCTSIZE_S"*1*2], mm0 + //movq [edi+"DCTSIZE_S"*7*2], mm6 + // t4 t5 - - - t6 t7 - + //--- t4 (mm0) may be <>0; mm1, mm5, mm6 == 0 //Typical numbers: nondc - 19%%, dc - 26%%, zero - 55%%. zero case alone isn't worthwhile - "movq 0*8+%3, %%mm4 \n\t" - "movq %%mm0, %%mm1 \n\t" + "movq 0*8+%3, %%mm4 \n\t" + "movq %%mm0, %%mm1 \n\t" - "pmulhw "MANGLE(MM_FIX_0_847759065)", %%mm0 \n\t" //tmp6 - "movq %%mm1, %%mm2 \n\t" + "pmulhw "MANGLE(MM_FIX_0_847759065)", %%mm0 \n\t" //tmp6 + "movq %%mm1, %%mm2 \n\t" - "movq "DCTSIZE_S"*0*2(%%"REG_D"), %%mm5 \n\t" - "movq %%mm2, %%mm3 \n\t" + "movq "DCTSIZE_S"*0*2(%%"REG_D"), %%mm5 \n\t" + "movq %%mm2, %%mm3 \n\t" - "pmulhw "MANGLE(MM_FIX_0_566454497)", %%mm1 \n\t" //tmp5 - "paddw %%mm4, %%mm5 \n\t" + "pmulhw "MANGLE(MM_FIX_0_566454497)", %%mm1 \n\t" //tmp5 + "paddw %%mm4, %%mm5 \n\t" - "movq 1*8+%3, %%mm6 \n\t" - //paddw mm3, MM_2 - "psraw $2, %%mm3 \n\t" //tmp7 + "movq 1*8+%3, %%mm6 \n\t" + //paddw mm3, MM_2 + "psraw $2, %%mm3 \n\t" //tmp7 - "pmulhw "MANGLE(MM_FIX_0_198912367)", %%mm2 \n\t" //-tmp4 - "psubw %%mm3, %%mm4 \n\t" + "pmulhw "MANGLE(MM_FIX_0_198912367)", %%mm2 \n\t" //-tmp4 + "psubw %%mm3, %%mm4 \n\t" - "movq "DCTSIZE_S"*1*2(%%"REG_D"), %%mm7 \n\t" - "paddw %%mm3, %%mm5 \n\t" + "movq "DCTSIZE_S"*1*2(%%"REG_D"), %%mm7 \n\t" + "paddw %%mm3, %%mm5 \n\t" - "movq %%mm4, "DCTSIZE_S"*7*2(%%"REG_D") \n\t" - "paddw %%mm6, %%mm7 \n\t" + "movq %%mm4, "DCTSIZE_S"*7*2(%%"REG_D") \n\t" + "paddw %%mm6, %%mm7 \n\t" - "movq 2*8+%3, %%mm3 \n\t" - "psubw %%mm0, %%mm6 \n\t" + "movq 2*8+%3, %%mm3 \n\t" + "psubw %%mm0, %%mm6 \n\t" - "movq "DCTSIZE_S"*2*2(%%"REG_D"), %%mm4 \n\t" - "paddw %%mm0, %%mm7 \n\t" + "movq "DCTSIZE_S"*2*2(%%"REG_D"), %%mm4 \n\t" + "paddw %%mm0, %%mm7 \n\t" - "movq %%mm5, "DCTSIZE_S"*0*2(%%"REG_D") \n\t" - "paddw %%mm3, %%mm4 \n\t" + "movq %%mm5, "DCTSIZE_S"*0*2(%%"REG_D") \n\t" + "paddw %%mm3, %%mm4 \n\t" - "movq %%mm6, "DCTSIZE_S"*6*2(%%"REG_D") \n\t" - "psubw %%mm1, %%mm3 \n\t" + "movq %%mm6, "DCTSIZE_S"*6*2(%%"REG_D") \n\t" + "psubw %%mm1, %%mm3 \n\t" - "movq "DCTSIZE_S"*5*2(%%"REG_D"), %%mm5 \n\t" - "paddw %%mm1, %%mm4 \n\t" + "movq "DCTSIZE_S"*5*2(%%"REG_D"), %%mm5 \n\t" + "paddw %%mm1, %%mm4 \n\t" - "movq "DCTSIZE_S"*3*2(%%"REG_D"), %%mm6 \n\t" - "paddw %%mm3, %%mm5 \n\t" + "movq "DCTSIZE_S"*3*2(%%"REG_D"), %%mm6 \n\t" + "paddw %%mm3, %%mm5 \n\t" - "movq 3*8+%3, %%mm0 \n\t" - "add $8, %%"REG_S" \n\t" + "movq 3*8+%3, %%mm0 \n\t" + "add $8, %%"REG_S" \n\t" - "movq %%mm7, "DCTSIZE_S"*1*2(%%"REG_D") \n\t" - "paddw %%mm0, %%mm6 \n\t" + "movq %%mm7, "DCTSIZE_S"*1*2(%%"REG_D") \n\t" + "paddw %%mm0, %%mm6 \n\t" - "movq %%mm4, "DCTSIZE_S"*2*2(%%"REG_D") \n\t" - "psubw %%mm2, %%mm0 \n\t" + "movq %%mm4, "DCTSIZE_S"*2*2(%%"REG_D") \n\t" + "psubw %%mm2, %%mm0 \n\t" - "movq "DCTSIZE_S"*4*2(%%"REG_D"), %%mm7 \n\t" - "paddw %%mm2, %%mm6 \n\t" + "movq "DCTSIZE_S"*4*2(%%"REG_D"), %%mm7 \n\t" + "paddw %%mm2, %%mm6 \n\t" - "movq %%mm5, "DCTSIZE_S"*5*2(%%"REG_D") \n\t" - "paddw %%mm0, %%mm7 \n\t" + "movq %%mm5, "DCTSIZE_S"*5*2(%%"REG_D") \n\t" + "paddw %%mm0, %%mm7 \n\t" - "movq %%mm6, "DCTSIZE_S"*3*2(%%"REG_D") \n\t" + "movq %%mm6, "DCTSIZE_S"*3*2(%%"REG_D") \n\t" - "movq %%mm7, "DCTSIZE_S"*4*2(%%"REG_D") \n\t" - "add $8, %%"REG_D" \n\t" - "jmp 4f \n\t" + "movq %%mm7, "DCTSIZE_S"*4*2(%%"REG_D") \n\t" + "add $8, %%"REG_D" \n\t" + "jmp 4f \n\t" - "2: \n\t" - //--- non DC2 - //psraw mm1, 2 w/o it -> offset. thr1, thr1, thr1 (actually thr1, thr1, thr1-1) - //psraw mm5, 2 - //psraw mm0, 2 - //psraw mm6, 2 - "movq %%mm5, %%mm3 \n\t" - "psubw %%mm1, %%mm5 \n\t" + "2: \n\t" + //--- non DC2 + //psraw mm1, 2 w/o it -> offset. thr1, thr1, thr1 (actually thr1, thr1, thr1-1) + //psraw mm5, 2 + //psraw mm0, 2 + //psraw mm6, 2 + "movq %%mm5, %%mm3 \n\t" + "psubw %%mm1, %%mm5 \n\t" - "psllw $1, %%mm5 \n\t" //'z10 - "paddw %%mm1, %%mm3 \n\t" //'z13 + "psllw $1, %%mm5 \n\t" //'z10 + "paddw %%mm1, %%mm3 \n\t" //'z13 - "movq %%mm0, %%mm2 \n\t" - "psubw %%mm6, %%mm0 \n\t" + "movq %%mm0, %%mm2 \n\t" + "psubw %%mm6, %%mm0 \n\t" - "movq %%mm5, %%mm1 \n\t" - "psllw $1, %%mm0 \n\t" //'z12 + "movq %%mm5, %%mm1 \n\t" + "psllw $1, %%mm0 \n\t" //'z12 - "pmulhw "MANGLE(MM_FIX_2_613125930)", %%mm1 \n\t" //- - "paddw %%mm0, %%mm5 \n\t" + "pmulhw "MANGLE(MM_FIX_2_613125930)", %%mm1 \n\t" //- + "paddw %%mm0, %%mm5 \n\t" - "pmulhw "MANGLE(MM_FIX_1_847759065)", %%mm5 \n\t" //'z5 - "paddw %%mm6, %%mm2 \n\t" //'z11 + "pmulhw "MANGLE(MM_FIX_1_847759065)", %%mm5 \n\t" //'z5 + "paddw %%mm6, %%mm2 \n\t" //'z11 - "pmulhw "MANGLE(MM_FIX_1_082392200)", %%mm0 \n\t" - "movq %%mm2, %%mm7 \n\t" + "pmulhw "MANGLE(MM_FIX_1_082392200)", %%mm0 \n\t" + "movq %%mm2, %%mm7 \n\t" - //--- - "movq 0*8+%3, %%mm4 \n\t" - "psubw %%mm3, %%mm2 \n\t" + //--- + "movq 0*8+%3, %%mm4 \n\t" + "psubw %%mm3, %%mm2 \n\t" - "psllw $1, %%mm2 \n\t" - "paddw %%mm3, %%mm7 \n\t" //'t7 + "psllw $1, %%mm2 \n\t" + "paddw %%mm3, %%mm7 \n\t" //'t7 - "pmulhw "MANGLE(MM_FIX_1_414213562)", %%mm2 \n\t" //'t11 - "movq %%mm4, %%mm6 \n\t" - //paddw mm7, MM_2 - "psraw $2, %%mm7 \n\t" + "pmulhw "MANGLE(MM_FIX_1_414213562)", %%mm2 \n\t" //'t11 + "movq %%mm4, %%mm6 \n\t" + //paddw mm7, MM_2 + "psraw $2, %%mm7 \n\t" - "paddw "DCTSIZE_S"*0*2(%%"REG_D"), %%mm4 \n\t" - "psubw %%mm7, %%mm6 \n\t" + "paddw "DCTSIZE_S"*0*2(%%"REG_D"), %%mm4 \n\t" + "psubw %%mm7, %%mm6 \n\t" - "movq 1*8+%3, %%mm3 \n\t" - "paddw %%mm7, %%mm4 \n\t" + "movq 1*8+%3, %%mm3 \n\t" + "paddw %%mm7, %%mm4 \n\t" - "movq %%mm6, "DCTSIZE_S"*7*2(%%"REG_D") \n\t" - "paddw %%mm5, %%mm1 \n\t" //'t12 + "movq %%mm6, "DCTSIZE_S"*7*2(%%"REG_D") \n\t" + "paddw %%mm5, %%mm1 \n\t" //'t12 - "movq %%mm4, "DCTSIZE_S"*0*2(%%"REG_D") \n\t" - "psubw %%mm7, %%mm1 \n\t" //'t6 + "movq %%mm4, "DCTSIZE_S"*0*2(%%"REG_D") \n\t" + "psubw %%mm7, %%mm1 \n\t" //'t6 - "movq 2*8+%3, %%mm7 \n\t" - "psubw %%mm5, %%mm0 \n\t" //'t10 + "movq 2*8+%3, %%mm7 \n\t" + "psubw %%mm5, %%mm0 \n\t" //'t10 - "movq 3*8+%3, %%mm6 \n\t" - "movq %%mm3, %%mm5 \n\t" + "movq 3*8+%3, %%mm6 \n\t" + "movq %%mm3, %%mm5 \n\t" - "paddw "DCTSIZE_S"*1*2(%%"REG_D"), %%mm3 \n\t" - "psubw %%mm1, %%mm5 \n\t" + "paddw "DCTSIZE_S"*1*2(%%"REG_D"), %%mm3 \n\t" + "psubw %%mm1, %%mm5 \n\t" - "psubw %%mm1, %%mm2 \n\t" //'t5 - "paddw %%mm1, %%mm3 \n\t" + "psubw %%mm1, %%mm2 \n\t" //'t5 + "paddw %%mm1, %%mm3 \n\t" - "movq %%mm5, "DCTSIZE_S"*6*2(%%"REG_D") \n\t" - "movq %%mm7, %%mm4 \n\t" + "movq %%mm5, "DCTSIZE_S"*6*2(%%"REG_D") \n\t" + "movq %%mm7, %%mm4 \n\t" - "paddw "DCTSIZE_S"*2*2(%%"REG_D"), %%mm7 \n\t" - "psubw %%mm2, %%mm4 \n\t" + "paddw "DCTSIZE_S"*2*2(%%"REG_D"), %%mm7 \n\t" + "psubw %%mm2, %%mm4 \n\t" - "paddw "DCTSIZE_S"*5*2(%%"REG_D"), %%mm4 \n\t" - "paddw %%mm2, %%mm7 \n\t" + "paddw "DCTSIZE_S"*5*2(%%"REG_D"), %%mm4 \n\t" + "paddw %%mm2, %%mm7 \n\t" - "movq %%mm3, "DCTSIZE_S"*1*2(%%"REG_D") \n\t" - "paddw %%mm2, %%mm0 \n\t" //'t4 + "movq %%mm3, "DCTSIZE_S"*1*2(%%"REG_D") \n\t" + "paddw %%mm2, %%mm0 \n\t" //'t4 - // 't4 't6 't5 - - - - 't7 - "movq %%mm7, "DCTSIZE_S"*2*2(%%"REG_D") \n\t" - "movq %%mm6, %%mm1 \n\t" + // 't4 't6 't5 - - - - 't7 + "movq %%mm7, "DCTSIZE_S"*2*2(%%"REG_D") \n\t" + "movq %%mm6, %%mm1 \n\t" - "paddw "DCTSIZE_S"*4*2(%%"REG_D"), %%mm6 \n\t" - "psubw %%mm0, %%mm1 \n\t" + "paddw "DCTSIZE_S"*4*2(%%"REG_D"), %%mm6 \n\t" + "psubw %%mm0, %%mm1 \n\t" - "paddw "DCTSIZE_S"*3*2(%%"REG_D"), %%mm1 \n\t" - "paddw %%mm0, %%mm6 \n\t" + "paddw "DCTSIZE_S"*3*2(%%"REG_D"), %%mm1 \n\t" + "paddw %%mm0, %%mm6 \n\t" - "movq %%mm4, "DCTSIZE_S"*5*2(%%"REG_D") \n\t" - "add $8, %%"REG_S" \n\t" + "movq %%mm4, "DCTSIZE_S"*5*2(%%"REG_D") \n\t" + "add $8, %%"REG_S" \n\t" - "movq %%mm6, "DCTSIZE_S"*4*2(%%"REG_D") \n\t" + "movq %%mm6, "DCTSIZE_S"*4*2(%%"REG_D") \n\t" - "movq %%mm1, "DCTSIZE_S"*3*2(%%"REG_D") \n\t" - "add $8, %%"REG_D" \n\t" + "movq %%mm1, "DCTSIZE_S"*3*2(%%"REG_D") \n\t" + "add $8, %%"REG_D" \n\t" - "4: \n\t" + "4: \n\t" //=part 2 (the same)=========================================================== - "movq "DCTSIZE_S"*0*2(%%"REG_S"), %%mm1 \n\t" - // - "movq "DCTSIZE_S"*3*2(%%"REG_S"), %%mm7 \n\t" - "movq %%mm1, %%mm0 \n\t" + "movq "DCTSIZE_S"*0*2(%%"REG_S"), %%mm1 \n\t" + // + "movq "DCTSIZE_S"*3*2(%%"REG_S"), %%mm7 \n\t" + "movq %%mm1, %%mm0 \n\t" - "paddw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm1 \n\t" //t0 - "movq %%mm7, %%mm3 \n\t" + "paddw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm1 \n\t" //t0 + "movq %%mm7, %%mm3 \n\t" - "paddw "DCTSIZE_S"*4*2(%%"REG_S"), %%mm7 \n\t" //t3 - "movq %%mm1, %%mm5 \n\t" + "paddw "DCTSIZE_S"*4*2(%%"REG_S"), %%mm7 \n\t" //t3 + "movq %%mm1, %%mm5 \n\t" - "movq "DCTSIZE_S"*1*2(%%"REG_S"), %%mm6 \n\t" - "psubw %%mm7, %%mm1 \n\t" //t13 + "movq "DCTSIZE_S"*1*2(%%"REG_S"), %%mm6 \n\t" + "psubw %%mm7, %%mm1 \n\t" //t13 - "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t" - "movq %%mm6, %%mm4 \n\t" + "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t" + "movq %%mm6, %%mm4 \n\t" - "paddw "DCTSIZE_S"*6*2(%%"REG_S"), %%mm6 \n\t" //t1 - "paddw %%mm7, %%mm5 \n\t" //t10 + "paddw "DCTSIZE_S"*6*2(%%"REG_S"), %%mm6 \n\t" //t1 + "paddw %%mm7, %%mm5 \n\t" //t10 - "paddw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t2 - "movq %%mm6, %%mm7 \n\t" + "paddw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t2 + "movq %%mm6, %%mm7 \n\t" - "paddw %%mm2, %%mm6 \n\t" //t11 - "psubw %%mm2, %%mm7 \n\t" //t12 + "paddw %%mm2, %%mm6 \n\t" //t11 + "psubw %%mm2, %%mm7 \n\t" //t12 - "movq %%mm5, %%mm2 \n\t" - "paddw %%mm6, %%mm5 \n\t" //d0 - // i0 t13 t12 i3 i1 d0 - d4 - "psubw %%mm6, %%mm2 \n\t" //d4 - "paddw %%mm1, %%mm7 \n\t" + "movq %%mm5, %%mm2 \n\t" + "paddw %%mm6, %%mm5 \n\t" //d0 + // i0 t13 t12 i3 i1 d0 - d4 + "psubw %%mm6, %%mm2 \n\t" //d4 + "paddw %%mm1, %%mm7 \n\t" - "movq 1*8+4*16(%%"REG_d"), %%mm6 \n\t" - "psllw $2, %%mm7 \n\t" + "movq 1*8+4*16(%%"REG_d"), %%mm6 \n\t" + "psllw $2, %%mm7 \n\t" - "psubw 1*8+0*16(%%"REG_d"), %%mm5 \n\t" - "psubw %%mm6, %%mm2 \n\t" + "psubw 1*8+0*16(%%"REG_d"), %%mm5 \n\t" + "psubw %%mm6, %%mm2 \n\t" - "paddusw 1*8+0*16(%%"REG_d"), %%mm5 \n\t" - "paddusw %%mm6, %%mm2 \n\t" + "paddusw 1*8+0*16(%%"REG_d"), %%mm5 \n\t" + "paddusw %%mm6, %%mm2 \n\t" - "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm7 \n\t" - // - "paddw 1*8+0*16(%%"REG_d"), %%mm5 \n\t" - "paddw %%mm6, %%mm2 \n\t" + "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm7 \n\t" + // + "paddw 1*8+0*16(%%"REG_d"), %%mm5 \n\t" + "paddw %%mm6, %%mm2 \n\t" - "psubusw 1*8+0*16(%%"REG_d"), %%mm5 \n\t" - "psubusw %%mm6, %%mm2 \n\t" + "psubusw 1*8+0*16(%%"REG_d"), %%mm5 \n\t" + "psubusw %%mm6, %%mm2 \n\t" //This func is totally compute-bound, operates at huge speed. So, DC shortcut // at this place isn't worthwhile due to BTB miss penalty (checked on Pent. 3). //However, typical numbers: nondc - 29%%, dc - 46%%, zero - 25%%. All <> 0 case is very rare. - "paddw "MANGLE(MM_2)", %%mm5 \n\t" - "movq %%mm2, %%mm6 \n\t" + "paddw "MANGLE(MM_2)", %%mm5 \n\t" + "movq %%mm2, %%mm6 \n\t" - "paddw %%mm5, %%mm2 \n\t" - "psubw %%mm6, %%mm5 \n\t" + "paddw %%mm5, %%mm2 \n\t" + "psubw %%mm6, %%mm5 \n\t" - "movq %%mm1, %%mm6 \n\t" - "paddw %%mm7, %%mm1 \n\t" //d2 + "movq %%mm1, %%mm6 \n\t" + "paddw %%mm7, %%mm1 \n\t" //d2 - "psubw 1*8+2*16(%%"REG_d"), %%mm1 \n\t" - "psubw %%mm7, %%mm6 \n\t" //d6 + "psubw 1*8+2*16(%%"REG_d"), %%mm1 \n\t" + "psubw %%mm7, %%mm6 \n\t" //d6 - "movq 1*8+6*16(%%"REG_d"), %%mm7 \n\t" - "psraw $2, %%mm5 \n\t" + "movq 1*8+6*16(%%"REG_d"), %%mm7 \n\t" + "psraw $2, %%mm5 \n\t" - "paddusw 1*8+2*16(%%"REG_d"), %%mm1 \n\t" - "psubw %%mm7, %%mm6 \n\t" - // t7 d2 /t11 t4 t6 - d6 /t10 + "paddusw 1*8+2*16(%%"REG_d"), %%mm1 \n\t" + "psubw %%mm7, %%mm6 \n\t" + // t7 d2 /t11 t4 t6 - d6 /t10 - "paddw 1*8+2*16(%%"REG_d"), %%mm1 \n\t" - "paddusw %%mm7, %%mm6 \n\t" + "paddw 1*8+2*16(%%"REG_d"), %%mm1 \n\t" + "paddusw %%mm7, %%mm6 \n\t" - "psubusw 1*8+2*16(%%"REG_d"), %%mm1 \n\t" - "paddw %%mm7, %%mm6 \n\t" + "psubusw 1*8+2*16(%%"REG_d"), %%mm1 \n\t" + "paddw %%mm7, %%mm6 \n\t" - "psubw "DCTSIZE_S"*4*2(%%"REG_S"), %%mm3 \n\t" - "psubusw %%mm7, %%mm6 \n\t" + "psubw "DCTSIZE_S"*4*2(%%"REG_S"), %%mm3 \n\t" + "psubusw %%mm7, %%mm6 \n\t" - //movq [edi+"DCTSIZE_S"*2*2], mm1 - //movq [edi+"DCTSIZE_S"*6*2], mm6 - "movq %%mm1, %%mm7 \n\t" - "psraw $2, %%mm2 \n\t" + //movq [edi+"DCTSIZE_S"*2*2], mm1 + //movq [edi+"DCTSIZE_S"*6*2], mm6 + "movq %%mm1, %%mm7 \n\t" + "psraw $2, %%mm2 \n\t" - "psubw "DCTSIZE_S"*6*2(%%"REG_S"), %%mm4 \n\t" - "psubw %%mm6, %%mm1 \n\t" + "psubw "DCTSIZE_S"*6*2(%%"REG_S"), %%mm4 \n\t" + "psubw %%mm6, %%mm1 \n\t" - "psubw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm0 \n\t" - "paddw %%mm7, %%mm6 \n\t" //'t13 + "psubw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm0 \n\t" + "paddw %%mm7, %%mm6 \n\t" //'t13 - "psraw $2, %%mm6 \n\t" //paddw mm6, MM_2 !! --- - "movq %%mm2, %%mm7 \n\t" + "psraw $2, %%mm6 \n\t" //paddw mm6, MM_2 !! --- + "movq %%mm2, %%mm7 \n\t" - "pmulhw "MANGLE(MM_FIX_1_414213562_A)", %%mm1 \n\t" - "paddw %%mm6, %%mm2 \n\t" //'t0 + "pmulhw "MANGLE(MM_FIX_1_414213562_A)", %%mm1 \n\t" + "paddw %%mm6, %%mm2 \n\t" //'t0 - "movq %%mm2, 0*8+%3 \n\t" //! - "psubw %%mm6, %%mm7 \n\t" //'t3 + "movq %%mm2, 0*8+%3 \n\t" //! + "psubw %%mm6, %%mm7 \n\t" //'t3 - "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t" - "psubw %%mm6, %%mm1 \n\t" //'t12 + "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t" + "psubw %%mm6, %%mm1 \n\t" //'t12 - "psubw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t5 - "movq %%mm5, %%mm6 \n\t" + "psubw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t5 + "movq %%mm5, %%mm6 \n\t" - "movq %%mm7, 3*8+%3 \n\t" - "paddw %%mm2, %%mm3 \n\t" //t10 + "movq %%mm7, 3*8+%3 \n\t" + "paddw %%mm2, %%mm3 \n\t" //t10 - "paddw %%mm4, %%mm2 \n\t" //t11 - "paddw %%mm0, %%mm4 \n\t" //t12 + "paddw %%mm4, %%mm2 \n\t" //t11 + "paddw %%mm0, %%mm4 \n\t" //t12 - "movq %%mm3, %%mm7 \n\t" - "psubw %%mm4, %%mm3 \n\t" + "movq %%mm3, %%mm7 \n\t" + "psubw %%mm4, %%mm3 \n\t" - "psllw $2, %%mm3 \n\t" - "psllw $2, %%mm7 \n\t" //opt for P6 + "psllw $2, %%mm3 \n\t" + "psllw $2, %%mm7 \n\t" //opt for P6 - "pmulhw "MANGLE(MM_FIX_0_382683433)", %%mm3 \n\t" - "psllw $2, %%mm4 \n\t" + "pmulhw "MANGLE(MM_FIX_0_382683433)", %%mm3 \n\t" + "psllw $2, %%mm4 \n\t" - "pmulhw "MANGLE(MM_FIX_0_541196100)", %%mm7 \n\t" - "psllw $2, %%mm2 \n\t" + "pmulhw "MANGLE(MM_FIX_0_541196100)", %%mm7 \n\t" + "psllw $2, %%mm2 \n\t" - "pmulhw "MANGLE(MM_FIX_1_306562965)", %%mm4 \n\t" - "paddw %%mm1, %%mm5 \n\t" //'t1 + "pmulhw "MANGLE(MM_FIX_1_306562965)", %%mm4 \n\t" + "paddw %%mm1, %%mm5 \n\t" //'t1 - "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm2 \n\t" - "psubw %%mm1, %%mm6 \n\t" //'t2 - // t7 't12 't11 t4 t6 - 't13 't10 --- + "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm2 \n\t" + "psubw %%mm1, %%mm6 \n\t" //'t2 + // t7 't12 't11 t4 t6 - 't13 't10 --- - "paddw %%mm3, %%mm7 \n\t" //z2 + "paddw %%mm3, %%mm7 \n\t" //z2 - "movq %%mm5, 1*8+%3 \n\t" - "paddw %%mm3, %%mm4 \n\t" //z4 + "movq %%mm5, 1*8+%3 \n\t" + "paddw %%mm3, %%mm4 \n\t" //z4 - "movq 1*8+3*16(%%"REG_d"), %%mm3 \n\t" - "movq %%mm0, %%mm1 \n\t" + "movq 1*8+3*16(%%"REG_d"), %%mm3 \n\t" + "movq %%mm0, %%mm1 \n\t" - "movq %%mm6, 2*8+%3 \n\t" - "psubw %%mm2, %%mm1 \n\t" //z13 + "movq %%mm6, 2*8+%3 \n\t" + "psubw %%mm2, %%mm1 \n\t" //z13 //=== - "paddw %%mm2, %%mm0 \n\t" //z11 - "movq %%mm1, %%mm5 \n\t" + "paddw %%mm2, %%mm0 \n\t" //z11 + "movq %%mm1, %%mm5 \n\t" - "movq 1*8+5*16(%%"REG_d"), %%mm2 \n\t" - "psubw %%mm7, %%mm1 \n\t" //d3 + "movq 1*8+5*16(%%"REG_d"), %%mm2 \n\t" + "psubw %%mm7, %%mm1 \n\t" //d3 - "paddw %%mm7, %%mm5 \n\t" //d5 - "psubw %%mm3, %%mm1 \n\t" + "paddw %%mm7, %%mm5 \n\t" //d5 + "psubw %%mm3, %%mm1 \n\t" - "movq 1*8+1*16(%%"REG_d"), %%mm7 \n\t" - "psubw %%mm2, %%mm5 \n\t" + "movq 1*8+1*16(%%"REG_d"), %%mm7 \n\t" + "psubw %%mm2, %%mm5 \n\t" - "movq %%mm0, %%mm6 \n\t" - "paddw %%mm4, %%mm0 \n\t" //d1 + "movq %%mm0, %%mm6 \n\t" + "paddw %%mm4, %%mm0 \n\t" //d1 - "paddusw %%mm3, %%mm1 \n\t" - "psubw %%mm4, %%mm6 \n\t" //d7 + "paddusw %%mm3, %%mm1 \n\t" + "psubw %%mm4, %%mm6 \n\t" //d7 - // d1 d3 - - - d5 d7 - - "movq 1*8+7*16(%%"REG_d"), %%mm4 \n\t" - "psubw %%mm7, %%mm0 \n\t" + // d1 d3 - - - d5 d7 - + "movq 1*8+7*16(%%"REG_d"), %%mm4 \n\t" + "psubw %%mm7, %%mm0 \n\t" - "psubw %%mm4, %%mm6 \n\t" - "paddusw %%mm2, %%mm5 \n\t" + "psubw %%mm4, %%mm6 \n\t" + "paddusw %%mm2, %%mm5 \n\t" - "paddusw %%mm4, %%mm6 \n\t" - "paddw %%mm3, %%mm1 \n\t" + "paddusw %%mm4, %%mm6 \n\t" + "paddw %%mm3, %%mm1 \n\t" - "paddw %%mm2, %%mm5 \n\t" - "paddw %%mm4, %%mm6 \n\t" + "paddw %%mm2, %%mm5 \n\t" + "paddw %%mm4, %%mm6 \n\t" - "psubusw %%mm3, %%mm1 \n\t" - "psubusw %%mm2, %%mm5 \n\t" + "psubusw %%mm3, %%mm1 \n\t" + "psubusw %%mm2, %%mm5 \n\t" - "psubusw %%mm4, %%mm6 \n\t" - "movq %%mm1, %%mm4 \n\t" + "psubusw %%mm4, %%mm6 \n\t" + "movq %%mm1, %%mm4 \n\t" - "por %%mm5, %%mm4 \n\t" - "paddusw %%mm7, %%mm0 \n\t" + "por %%mm5, %%mm4 \n\t" + "paddusw %%mm7, %%mm0 \n\t" - "por %%mm6, %%mm4 \n\t" - "paddw %%mm7, %%mm0 \n\t" + "por %%mm6, %%mm4 \n\t" + "paddw %%mm7, %%mm0 \n\t" - "packssdw %%mm4, %%mm4 \n\t" - "psubusw %%mm7, %%mm0 \n\t" + "packssdw %%mm4, %%mm4 \n\t" + "psubusw %%mm7, %%mm0 \n\t" - "movd %%mm4, %%"REG_a" \n\t" - "or %%"REG_a", %%"REG_a" \n\t" - "jnz 3f \n\t" - //movq [edi+"DCTSIZE_S"*3*2], mm1 - //movq [edi+"DCTSIZE_S"*5*2], mm5 - //movq [edi+"DCTSIZE_S"*1*2], mm0 - //movq [edi+"DCTSIZE_S"*7*2], mm6 - // t4 t5 - - - t6 t7 - - //--- t4 (mm0) may be <>0; mm1, mm5, mm6 == 0 + "movd %%mm4, %%"REG_a" \n\t" + "or %%"REG_a", %%"REG_a" \n\t" + "jnz 3f \n\t" + //movq [edi+"DCTSIZE_S"*3*2], mm1 + //movq [edi+"DCTSIZE_S"*5*2], mm5 + //movq [edi+"DCTSIZE_S"*1*2], mm0 + //movq [edi+"DCTSIZE_S"*7*2], mm6 + // t4 t5 - - - t6 t7 - + //--- t4 (mm0) may be <>0; mm1, mm5, mm6 == 0 //Typical numbers: nondc - 19%%, dc - 26%%, zero - 55%%. zero case alone isn't worthwhile - "movq 0*8+%3, %%mm4 \n\t" - "movq %%mm0, %%mm1 \n\t" + "movq 0*8+%3, %%mm4 \n\t" + "movq %%mm0, %%mm1 \n\t" - "pmulhw "MANGLE(MM_FIX_0_847759065)", %%mm0 \n\t" //tmp6 - "movq %%mm1, %%mm2 \n\t" + "pmulhw "MANGLE(MM_FIX_0_847759065)", %%mm0 \n\t" //tmp6 + "movq %%mm1, %%mm2 \n\t" - "movq "DCTSIZE_S"*0*2(%%"REG_D"), %%mm5 \n\t" - "movq %%mm2, %%mm3 \n\t" + "movq "DCTSIZE_S"*0*2(%%"REG_D"), %%mm5 \n\t" + "movq %%mm2, %%mm3 \n\t" - "pmulhw "MANGLE(MM_FIX_0_566454497)", %%mm1 \n\t" //tmp5 - "paddw %%mm4, %%mm5 \n\t" + "pmulhw "MANGLE(MM_FIX_0_566454497)", %%mm1 \n\t" //tmp5 + "paddw %%mm4, %%mm5 \n\t" - "movq 1*8+%3, %%mm6 \n\t" - //paddw mm3, MM_2 - "psraw $2, %%mm3 \n\t" //tmp7 + "movq 1*8+%3, %%mm6 \n\t" + //paddw mm3, MM_2 + "psraw $2, %%mm3 \n\t" //tmp7 - "pmulhw "MANGLE(MM_FIX_0_198912367)", %%mm2 \n\t" //-tmp4 - "psubw %%mm3, %%mm4 \n\t" + "pmulhw "MANGLE(MM_FIX_0_198912367)", %%mm2 \n\t" //-tmp4 + "psubw %%mm3, %%mm4 \n\t" - "movq "DCTSIZE_S"*1*2(%%"REG_D"), %%mm7 \n\t" - "paddw %%mm3, %%mm5 \n\t" + "movq "DCTSIZE_S"*1*2(%%"REG_D"), %%mm7 \n\t" + "paddw %%mm3, %%mm5 \n\t" - "movq %%mm4, "DCTSIZE_S"*7*2(%%"REG_D") \n\t" - "paddw %%mm6, %%mm7 \n\t" + "movq %%mm4, "DCTSIZE_S"*7*2(%%"REG_D") \n\t" + "paddw %%mm6, %%mm7 \n\t" - "movq 2*8+%3, %%mm3 \n\t" - "psubw %%mm0, %%mm6 \n\t" + "movq 2*8+%3, %%mm3 \n\t" + "psubw %%mm0, %%mm6 \n\t" - "movq "DCTSIZE_S"*2*2(%%"REG_D"), %%mm4 \n\t" - "paddw %%mm0, %%mm7 \n\t" + "movq "DCTSIZE_S"*2*2(%%"REG_D"), %%mm4 \n\t" + "paddw %%mm0, %%mm7 \n\t" - "movq %%mm5, "DCTSIZE_S"*0*2(%%"REG_D") \n\t" - "paddw %%mm3, %%mm4 \n\t" + "movq %%mm5, "DCTSIZE_S"*0*2(%%"REG_D") \n\t" + "paddw %%mm3, %%mm4 \n\t" - "movq %%mm6, "DCTSIZE_S"*6*2(%%"REG_D") \n\t" - "psubw %%mm1, %%mm3 \n\t" + "movq %%mm6, "DCTSIZE_S"*6*2(%%"REG_D") \n\t" + "psubw %%mm1, %%mm3 \n\t" - "movq "DCTSIZE_S"*5*2(%%"REG_D"), %%mm5 \n\t" - "paddw %%mm1, %%mm4 \n\t" + "movq "DCTSIZE_S"*5*2(%%"REG_D"), %%mm5 \n\t" + "paddw %%mm1, %%mm4 \n\t" - "movq "DCTSIZE_S"*3*2(%%"REG_D"), %%mm6 \n\t" - "paddw %%mm3, %%mm5 \n\t" + "movq "DCTSIZE_S"*3*2(%%"REG_D"), %%mm6 \n\t" + "paddw %%mm3, %%mm5 \n\t" - "movq 3*8+%3, %%mm0 \n\t" - "add $24, %%"REG_S" \n\t" + "movq 3*8+%3, %%mm0 \n\t" + "add $24, %%"REG_S" \n\t" - "movq %%mm7, "DCTSIZE_S"*1*2(%%"REG_D") \n\t" - "paddw %%mm0, %%mm6 \n\t" + "movq %%mm7, "DCTSIZE_S"*1*2(%%"REG_D") \n\t" + "paddw %%mm0, %%mm6 \n\t" - "movq %%mm4, "DCTSIZE_S"*2*2(%%"REG_D") \n\t" - "psubw %%mm2, %%mm0 \n\t" + "movq %%mm4, "DCTSIZE_S"*2*2(%%"REG_D") \n\t" + "psubw %%mm2, %%mm0 \n\t" - "movq "DCTSIZE_S"*4*2(%%"REG_D"), %%mm7 \n\t" - "paddw %%mm2, %%mm6 \n\t" + "movq "DCTSIZE_S"*4*2(%%"REG_D"), %%mm7 \n\t" + "paddw %%mm2, %%mm6 \n\t" - "movq %%mm5, "DCTSIZE_S"*5*2(%%"REG_D") \n\t" - "paddw %%mm0, %%mm7 \n\t" + "movq %%mm5, "DCTSIZE_S"*5*2(%%"REG_D") \n\t" + "paddw %%mm0, %%mm7 \n\t" - "movq %%mm6, "DCTSIZE_S"*3*2(%%"REG_D") \n\t" + "movq %%mm6, "DCTSIZE_S"*3*2(%%"REG_D") \n\t" - "movq %%mm7, "DCTSIZE_S"*4*2(%%"REG_D") \n\t" - "add $24, %%"REG_D" \n\t" - "sub $2, %%"REG_c" \n\t" - "jnz 1b \n\t" - "jmp 5f \n\t" + "movq %%mm7, "DCTSIZE_S"*4*2(%%"REG_D") \n\t" + "add $24, %%"REG_D" \n\t" + "sub $2, %%"REG_c" \n\t" + "jnz 1b \n\t" + "jmp 5f \n\t" - "3: \n\t" - //--- non DC2 - //psraw mm1, 2 w/o it -> offset. thr1, thr1, thr1 (actually thr1, thr1, thr1-1) - //psraw mm5, 2 - //psraw mm0, 2 - //psraw mm6, 2 - "movq %%mm5, %%mm3 \n\t" - "psubw %%mm1, %%mm5 \n\t" + "3: \n\t" + //--- non DC2 + //psraw mm1, 2 w/o it -> offset. thr1, thr1, thr1 (actually thr1, thr1, thr1-1) + //psraw mm5, 2 + //psraw mm0, 2 + //psraw mm6, 2 + "movq %%mm5, %%mm3 \n\t" + "psubw %%mm1, %%mm5 \n\t" - "psllw $1, %%mm5 \n\t" //'z10 - "paddw %%mm1, %%mm3 \n\t" //'z13 + "psllw $1, %%mm5 \n\t" //'z10 + "paddw %%mm1, %%mm3 \n\t" //'z13 - "movq %%mm0, %%mm2 \n\t" - "psubw %%mm6, %%mm0 \n\t" + "movq %%mm0, %%mm2 \n\t" + "psubw %%mm6, %%mm0 \n\t" - "movq %%mm5, %%mm1 \n\t" - "psllw $1, %%mm0 \n\t" //'z12 + "movq %%mm5, %%mm1 \n\t" + "psllw $1, %%mm0 \n\t" //'z12 - "pmulhw "MANGLE(MM_FIX_2_613125930)", %%mm1 \n\t" //- - "paddw %%mm0, %%mm5 \n\t" + "pmulhw "MANGLE(MM_FIX_2_613125930)", %%mm1 \n\t" //- + "paddw %%mm0, %%mm5 \n\t" - "pmulhw "MANGLE(MM_FIX_1_847759065)", %%mm5 \n\t" //'z5 - "paddw %%mm6, %%mm2 \n\t" //'z11 + "pmulhw "MANGLE(MM_FIX_1_847759065)", %%mm5 \n\t" //'z5 + "paddw %%mm6, %%mm2 \n\t" //'z11 - "pmulhw "MANGLE(MM_FIX_1_082392200)", %%mm0 \n\t" - "movq %%mm2, %%mm7 \n\t" + "pmulhw "MANGLE(MM_FIX_1_082392200)", %%mm0 \n\t" + "movq %%mm2, %%mm7 \n\t" - //--- - "movq 0*8+%3, %%mm4 \n\t" - "psubw %%mm3, %%mm2 \n\t" + //--- + "movq 0*8+%3, %%mm4 \n\t" + "psubw %%mm3, %%mm2 \n\t" - "psllw $1, %%mm2 \n\t" - "paddw %%mm3, %%mm7 \n\t" //'t7 + "psllw $1, %%mm2 \n\t" + "paddw %%mm3, %%mm7 \n\t" //'t7 - "pmulhw "MANGLE(MM_FIX_1_414213562)", %%mm2 \n\t" //'t11 - "movq %%mm4, %%mm6 \n\t" - //paddw mm7, MM_2 - "psraw $2, %%mm7 \n\t" + "pmulhw "MANGLE(MM_FIX_1_414213562)", %%mm2 \n\t" //'t11 + "movq %%mm4, %%mm6 \n\t" + //paddw mm7, MM_2 + "psraw $2, %%mm7 \n\t" - "paddw "DCTSIZE_S"*0*2(%%"REG_D"), %%mm4 \n\t" - "psubw %%mm7, %%mm6 \n\t" + "paddw "DCTSIZE_S"*0*2(%%"REG_D"), %%mm4 \n\t" + "psubw %%mm7, %%mm6 \n\t" - "movq 1*8+%3, %%mm3 \n\t" - "paddw %%mm7, %%mm4 \n\t" + "movq 1*8+%3, %%mm3 \n\t" + "paddw %%mm7, %%mm4 \n\t" - "movq %%mm6, "DCTSIZE_S"*7*2(%%"REG_D") \n\t" - "paddw %%mm5, %%mm1 \n\t" //'t12 + "movq %%mm6, "DCTSIZE_S"*7*2(%%"REG_D") \n\t" + "paddw %%mm5, %%mm1 \n\t" //'t12 - "movq %%mm4, "DCTSIZE_S"*0*2(%%"REG_D") \n\t" - "psubw %%mm7, %%mm1 \n\t" //'t6 + "movq %%mm4, "DCTSIZE_S"*0*2(%%"REG_D") \n\t" + "psubw %%mm7, %%mm1 \n\t" //'t6 - "movq 2*8+%3, %%mm7 \n\t" - "psubw %%mm5, %%mm0 \n\t" //'t10 + "movq 2*8+%3, %%mm7 \n\t" + "psubw %%mm5, %%mm0 \n\t" //'t10 - "movq 3*8+%3, %%mm6 \n\t" - "movq %%mm3, %%mm5 \n\t" + "movq 3*8+%3, %%mm6 \n\t" + "movq %%mm3, %%mm5 \n\t" - "paddw "DCTSIZE_S"*1*2(%%"REG_D"), %%mm3 \n\t" - "psubw %%mm1, %%mm5 \n\t" + "paddw "DCTSIZE_S"*1*2(%%"REG_D"), %%mm3 \n\t" + "psubw %%mm1, %%mm5 \n\t" - "psubw %%mm1, %%mm2 \n\t" //'t5 - "paddw %%mm1, %%mm3 \n\t" + "psubw %%mm1, %%mm2 \n\t" //'t5 + "paddw %%mm1, %%mm3 \n\t" - "movq %%mm5, "DCTSIZE_S"*6*2(%%"REG_D") \n\t" - "movq %%mm7, %%mm4 \n\t" + "movq %%mm5, "DCTSIZE_S"*6*2(%%"REG_D") \n\t" + "movq %%mm7, %%mm4 \n\t" - "paddw "DCTSIZE_S"*2*2(%%"REG_D"), %%mm7 \n\t" - "psubw %%mm2, %%mm4 \n\t" + "paddw "DCTSIZE_S"*2*2(%%"REG_D"), %%mm7 \n\t" + "psubw %%mm2, %%mm4 \n\t" - "paddw "DCTSIZE_S"*5*2(%%"REG_D"), %%mm4 \n\t" - "paddw %%mm2, %%mm7 \n\t" + "paddw "DCTSIZE_S"*5*2(%%"REG_D"), %%mm4 \n\t" + "paddw %%mm2, %%mm7 \n\t" - "movq %%mm3, "DCTSIZE_S"*1*2(%%"REG_D") \n\t" - "paddw %%mm2, %%mm0 \n\t" //'t4 + "movq %%mm3, "DCTSIZE_S"*1*2(%%"REG_D") \n\t" + "paddw %%mm2, %%mm0 \n\t" //'t4 - // 't4 't6 't5 - - - - 't7 - "movq %%mm7, "DCTSIZE_S"*2*2(%%"REG_D") \n\t" - "movq %%mm6, %%mm1 \n\t" + // 't4 't6 't5 - - - - 't7 + "movq %%mm7, "DCTSIZE_S"*2*2(%%"REG_D") \n\t" + "movq %%mm6, %%mm1 \n\t" - "paddw "DCTSIZE_S"*4*2(%%"REG_D"), %%mm6 \n\t" - "psubw %%mm0, %%mm1 \n\t" + "paddw "DCTSIZE_S"*4*2(%%"REG_D"), %%mm6 \n\t" + "psubw %%mm0, %%mm1 \n\t" - "paddw "DCTSIZE_S"*3*2(%%"REG_D"), %%mm1 \n\t" - "paddw %%mm0, %%mm6 \n\t" + "paddw "DCTSIZE_S"*3*2(%%"REG_D"), %%mm1 \n\t" + "paddw %%mm0, %%mm6 \n\t" - "movq %%mm4, "DCTSIZE_S"*5*2(%%"REG_D") \n\t" - "add $24, %%"REG_S" \n\t" + "movq %%mm4, "DCTSIZE_S"*5*2(%%"REG_D") \n\t" + "add $24, %%"REG_S" \n\t" - "movq %%mm6, "DCTSIZE_S"*4*2(%%"REG_D") \n\t" + "movq %%mm6, "DCTSIZE_S"*4*2(%%"REG_D") \n\t" - "movq %%mm1, "DCTSIZE_S"*3*2(%%"REG_D") \n\t" - "add $24, %%"REG_D" \n\t" - "sub $2, %%"REG_c" \n\t" - "jnz 1b \n\t" - "5: \n\t" + "movq %%mm1, "DCTSIZE_S"*3*2(%%"REG_D") \n\t" + "add $24, %%"REG_D" \n\t" + "sub $2, %%"REG_c" \n\t" + "jnz 1b \n\t" + "5: \n\t" - : "+S"(data), "+D"(output), "+c"(cnt), "=o"(temps) - : "d"(thr_adr) - : "%"REG_a - ); + : "+S"(data), "+D"(output), "+c"(cnt), "=o"(temps) + : "d"(thr_adr) + : "%"REG_a + ); } #endif // HAVE_MMX @@ -1606,7 +1606,7 @@ static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, #if !HAVE_MMX static void row_idct_c(DCTELEM* workspace, - int16_t* output_adr, int output_stride, int cnt) + int16_t* output_adr, int output_stride, int cnt) { int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int_simd16_t tmp10, tmp11, tmp12, tmp13; @@ -1618,256 +1618,256 @@ static void row_idct_c(DCTELEM* workspace, wsptr = workspace; outptr = output_adr; for (; cnt > 0; cnt--) { - // Even part - //Simd version reads 4x4 block and transposes it - tmp10 = ( wsptr[2] + wsptr[3]); - tmp11 = ( wsptr[2] - wsptr[3]); - - tmp13 = ( wsptr[0] + wsptr[1]); - tmp12 = (MULTIPLY16H( wsptr[0] - wsptr[1], FIX_1_414213562_A)<<2) - tmp13;//this shift order to avoid overflow - - tmp0 = tmp10 + tmp13; //->temps - tmp3 = tmp10 - tmp13; //->temps - tmp1 = tmp11 + tmp12; - tmp2 = tmp11 - tmp12; - - // Odd part - //Also transpose, with previous: - // ---- ---- |||| - // ---- ---- idct |||| - // ---- ---- ---> |||| - // ---- ---- |||| - z13 = wsptr[4] + wsptr[5]; - z10 = wsptr[4] - wsptr[5]; - z11 = wsptr[6] + wsptr[7]; - z12 = wsptr[6] - wsptr[7]; - - tmp7 = z11 + z13; - tmp11 = MULTIPLY16H(z11 - z13, FIX_1_414213562); - - z5 = MULTIPLY16H(z10 + z12, FIX_1_847759065); - tmp10 = MULTIPLY16H(z12, FIX_1_082392200) - z5; - tmp12 = MULTIPLY16H(z10, FIX_2_613125930) + z5; // - FIX_ - - tmp6 = (tmp12<<3) - tmp7; - tmp5 = (tmp11<<3) - tmp6; - tmp4 = (tmp10<<3) + tmp5; - - // Final output stage: descale and write column - outptr[0*output_stride]+= DESCALE(tmp0 + tmp7, 3); - outptr[1*output_stride]+= DESCALE(tmp1 + tmp6, 3); - outptr[2*output_stride]+= DESCALE(tmp2 + tmp5, 3); - outptr[3*output_stride]+= DESCALE(tmp3 - tmp4, 3); - outptr[4*output_stride]+= DESCALE(tmp3 + tmp4, 3); - outptr[5*output_stride]+= DESCALE(tmp2 - tmp5, 3); - outptr[6*output_stride]+= DESCALE(tmp1 - tmp6, 3); //no += ? - outptr[7*output_stride]+= DESCALE(tmp0 - tmp7, 3); //no += ? - outptr++; - - wsptr += DCTSIZE; // advance pointer to next row + // Even part + //Simd version reads 4x4 block and transposes it + tmp10 = ( wsptr[2] + wsptr[3]); + tmp11 = ( wsptr[2] - wsptr[3]); + + tmp13 = ( wsptr[0] + wsptr[1]); + tmp12 = (MULTIPLY16H( wsptr[0] - wsptr[1], FIX_1_414213562_A)<<2) - tmp13;//this shift order to avoid overflow + + tmp0 = tmp10 + tmp13; //->temps + tmp3 = tmp10 - tmp13; //->temps + tmp1 = tmp11 + tmp12; + tmp2 = tmp11 - tmp12; + + // Odd part + //Also transpose, with previous: + // ---- ---- |||| + // ---- ---- idct |||| + // ---- ---- ---> |||| + // ---- ---- |||| + z13 = wsptr[4] + wsptr[5]; + z10 = wsptr[4] - wsptr[5]; + z11 = wsptr[6] + wsptr[7]; + z12 = wsptr[6] - wsptr[7]; + + tmp7 = z11 + z13; + tmp11 = MULTIPLY16H(z11 - z13, FIX_1_414213562); + + z5 = MULTIPLY16H(z10 + z12, FIX_1_847759065); + tmp10 = MULTIPLY16H(z12, FIX_1_082392200) - z5; + tmp12 = MULTIPLY16H(z10, FIX_2_613125930) + z5; // - FIX_ + + tmp6 = (tmp12<<3) - tmp7; + tmp5 = (tmp11<<3) - tmp6; + tmp4 = (tmp10<<3) + tmp5; + + // Final output stage: descale and write column + outptr[0*output_stride]+= DESCALE(tmp0 + tmp7, 3); + outptr[1*output_stride]+= DESCALE(tmp1 + tmp6, 3); + outptr[2*output_stride]+= DESCALE(tmp2 + tmp5, 3); + outptr[3*output_stride]+= DESCALE(tmp3 - tmp4, 3); + outptr[4*output_stride]+= DESCALE(tmp3 + tmp4, 3); + outptr[5*output_stride]+= DESCALE(tmp2 - tmp5, 3); + outptr[6*output_stride]+= DESCALE(tmp1 - tmp6, 3); //no += ? + outptr[7*output_stride]+= DESCALE(tmp0 - tmp7, 3); //no += ? + outptr++; + + wsptr += DCTSIZE; // advance pointer to next row } } #else /* HAVE_MMX */ static void row_idct_mmx (DCTELEM* workspace, - int16_t* output_adr, int output_stride, int cnt) + int16_t* output_adr, int output_stride, int cnt) { uint64_t __attribute__((aligned(8))) temps[4]; __asm__ volatile( - "lea (%%"REG_a",%%"REG_a",2), %%"REG_d" \n\t" - "1: \n\t" - "movq "DCTSIZE_S"*0*2(%%"REG_S"), %%mm0 \n\t" - // + "lea (%%"REG_a",%%"REG_a",2), %%"REG_d" \n\t" + "1: \n\t" + "movq "DCTSIZE_S"*0*2(%%"REG_S"), %%mm0 \n\t" + // - "movq "DCTSIZE_S"*1*2(%%"REG_S"), %%mm1 \n\t" - "movq %%mm0, %%mm4 \n\t" + "movq "DCTSIZE_S"*1*2(%%"REG_S"), %%mm1 \n\t" + "movq %%mm0, %%mm4 \n\t" - "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t" - "punpcklwd %%mm1, %%mm0 \n\t" + "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t" + "punpcklwd %%mm1, %%mm0 \n\t" - "movq "DCTSIZE_S"*3*2(%%"REG_S"), %%mm3 \n\t" - "punpckhwd %%mm1, %%mm4 \n\t" + "movq "DCTSIZE_S"*3*2(%%"REG_S"), %%mm3 \n\t" + "punpckhwd %%mm1, %%mm4 \n\t" - //transpose 4x4 - "movq %%mm2, %%mm7 \n\t" - "punpcklwd %%mm3, %%mm2 \n\t" + //transpose 4x4 + "movq %%mm2, %%mm7 \n\t" + "punpcklwd %%mm3, %%mm2 \n\t" - "movq %%mm0, %%mm6 \n\t" - "punpckldq %%mm2, %%mm0 \n\t" //0 + "movq %%mm0, %%mm6 \n\t" + "punpckldq %%mm2, %%mm0 \n\t" //0 - "punpckhdq %%mm2, %%mm6 \n\t" //1 - "movq %%mm0, %%mm5 \n\t" + "punpckhdq %%mm2, %%mm6 \n\t" //1 + "movq %%mm0, %%mm5 \n\t" - "punpckhwd %%mm3, %%mm7 \n\t" - "psubw %%mm6, %%mm0 \n\t" + "punpckhwd %%mm3, %%mm7 \n\t" + "psubw %%mm6, %%mm0 \n\t" - "pmulhw "MANGLE(MM_FIX_1_414213562_A)", %%mm0 \n\t" - "movq %%mm4, %%mm2 \n\t" + "pmulhw "MANGLE(MM_FIX_1_414213562_A)", %%mm0 \n\t" + "movq %%mm4, %%mm2 \n\t" - "punpckldq %%mm7, %%mm4 \n\t" //2 - "paddw %%mm6, %%mm5 \n\t" + "punpckldq %%mm7, %%mm4 \n\t" //2 + "paddw %%mm6, %%mm5 \n\t" - "punpckhdq %%mm7, %%mm2 \n\t" //3 - "movq %%mm4, %%mm1 \n\t" + "punpckhdq %%mm7, %%mm2 \n\t" //3 + "movq %%mm4, %%mm1 \n\t" - "psllw $2, %%mm0 \n\t" - "paddw %%mm2, %%mm4 \n\t" //t10 + "psllw $2, %%mm0 \n\t" + "paddw %%mm2, %%mm4 \n\t" //t10 - "movq "DCTSIZE_S"*0*2+"DCTSIZE_S"(%%"REG_S"), %%mm3 \n\t" - "psubw %%mm2, %%mm1 \n\t" //t11 + "movq "DCTSIZE_S"*0*2+"DCTSIZE_S"(%%"REG_S"), %%mm3 \n\t" + "psubw %%mm2, %%mm1 \n\t" //t11 - "movq "DCTSIZE_S"*1*2+"DCTSIZE_S"(%%"REG_S"), %%mm2 \n\t" - "psubw %%mm5, %%mm0 \n\t" + "movq "DCTSIZE_S"*1*2+"DCTSIZE_S"(%%"REG_S"), %%mm2 \n\t" + "psubw %%mm5, %%mm0 \n\t" - "movq %%mm4, %%mm6 \n\t" - "paddw %%mm5, %%mm4 \n\t" //t0 + "movq %%mm4, %%mm6 \n\t" + "paddw %%mm5, %%mm4 \n\t" //t0 - "psubw %%mm5, %%mm6 \n\t" //t3 - "movq %%mm1, %%mm7 \n\t" + "psubw %%mm5, %%mm6 \n\t" //t3 + "movq %%mm1, %%mm7 \n\t" - "movq "DCTSIZE_S"*2*2+"DCTSIZE_S"(%%"REG_S"), %%mm5 \n\t" - "paddw %%mm0, %%mm1 \n\t" //t1 + "movq "DCTSIZE_S"*2*2+"DCTSIZE_S"(%%"REG_S"), %%mm5 \n\t" + "paddw %%mm0, %%mm1 \n\t" //t1 - "movq %%mm4, 0*8+%3 \n\t" //t0 - "movq %%mm3, %%mm4 \n\t" + "movq %%mm4, 0*8+%3 \n\t" //t0 + "movq %%mm3, %%mm4 \n\t" - "movq %%mm6, 1*8+%3 \n\t" //t3 - "punpcklwd %%mm2, %%mm3 \n\t" + "movq %%mm6, 1*8+%3 \n\t" //t3 + "punpcklwd %%mm2, %%mm3 \n\t" - //transpose 4x4 - "movq "DCTSIZE_S"*3*2+"DCTSIZE_S"(%%"REG_S"), %%mm6 \n\t" - "punpckhwd %%mm2, %%mm4 \n\t" + //transpose 4x4 + "movq "DCTSIZE_S"*3*2+"DCTSIZE_S"(%%"REG_S"), %%mm6 \n\t" + "punpckhwd %%mm2, %%mm4 \n\t" - "movq %%mm5, %%mm2 \n\t" - "punpcklwd %%mm6, %%mm5 \n\t" + "movq %%mm5, %%mm2 \n\t" + "punpcklwd %%mm6, %%mm5 \n\t" - "psubw %%mm0, %%mm7 \n\t" //t2 - "punpckhwd %%mm6, %%mm2 \n\t" + "psubw %%mm0, %%mm7 \n\t" //t2 + "punpckhwd %%mm6, %%mm2 \n\t" - "movq %%mm3, %%mm0 \n\t" - "punpckldq %%mm5, %%mm3 \n\t" //4 + "movq %%mm3, %%mm0 \n\t" + "punpckldq %%mm5, %%mm3 \n\t" //4 - "punpckhdq %%mm5, %%mm0 \n\t" //5 - "movq %%mm4, %%mm5 \n\t" + "punpckhdq %%mm5, %%mm0 \n\t" //5 + "movq %%mm4, %%mm5 \n\t" - // - "movq %%mm3, %%mm6 \n\t" - "punpckldq %%mm2, %%mm4 \n\t" //6 + // + "movq %%mm3, %%mm6 \n\t" + "punpckldq %%mm2, %%mm4 \n\t" //6 - "psubw %%mm0, %%mm3 \n\t" //z10 - "punpckhdq %%mm2, %%mm5 \n\t" //7 + "psubw %%mm0, %%mm3 \n\t" //z10 + "punpckhdq %%mm2, %%mm5 \n\t" //7 - "paddw %%mm0, %%mm6 \n\t" //z13 - "movq %%mm4, %%mm2 \n\t" + "paddw %%mm0, %%mm6 \n\t" //z13 + "movq %%mm4, %%mm2 \n\t" - "movq %%mm3, %%mm0 \n\t" - "psubw %%mm5, %%mm4 \n\t" //z12 + "movq %%mm3, %%mm0 \n\t" + "psubw %%mm5, %%mm4 \n\t" //z12 - "pmulhw "MANGLE(MM_FIX_2_613125930)", %%mm0 \n\t" //- - "paddw %%mm4, %%mm3 \n\t" + "pmulhw "MANGLE(MM_FIX_2_613125930)", %%mm0 \n\t" //- + "paddw %%mm4, %%mm3 \n\t" - "pmulhw "MANGLE(MM_FIX_1_847759065)", %%mm3 \n\t" //z5 - "paddw %%mm5, %%mm2 \n\t" //z11 > + "pmulhw "MANGLE(MM_FIX_1_847759065)", %%mm3 \n\t" //z5 + "paddw %%mm5, %%mm2 \n\t" //z11 > - "pmulhw "MANGLE(MM_FIX_1_082392200)", %%mm4 \n\t" - "movq %%mm2, %%mm5 \n\t" + "pmulhw "MANGLE(MM_FIX_1_082392200)", %%mm4 \n\t" + "movq %%mm2, %%mm5 \n\t" - "psubw %%mm6, %%mm2 \n\t" - "paddw %%mm6, %%mm5 \n\t" //t7 + "psubw %%mm6, %%mm2 \n\t" + "paddw %%mm6, %%mm5 \n\t" //t7 - "pmulhw "MANGLE(MM_FIX_1_414213562)", %%mm2 \n\t" //t11 - "paddw %%mm3, %%mm0 \n\t" //t12 + "pmulhw "MANGLE(MM_FIX_1_414213562)", %%mm2 \n\t" //t11 + "paddw %%mm3, %%mm0 \n\t" //t12 - "psllw $3, %%mm0 \n\t" - "psubw %%mm3, %%mm4 \n\t" //t10 + "psllw $3, %%mm0 \n\t" + "psubw %%mm3, %%mm4 \n\t" //t10 - "movq 0*8+%3, %%mm6 \n\t" - "movq %%mm1, %%mm3 \n\t" + "movq 0*8+%3, %%mm6 \n\t" + "movq %%mm1, %%mm3 \n\t" - "psllw $3, %%mm4 \n\t" - "psubw %%mm5, %%mm0 \n\t" //t6 + "psllw $3, %%mm4 \n\t" + "psubw %%mm5, %%mm0 \n\t" //t6 - "psllw $3, %%mm2 \n\t" - "paddw %%mm0, %%mm1 \n\t" //d1 + "psllw $3, %%mm2 \n\t" + "paddw %%mm0, %%mm1 \n\t" //d1 - "psubw %%mm0, %%mm2 \n\t" //t5 - "psubw %%mm0, %%mm3 \n\t" //d6 + "psubw %%mm0, %%mm2 \n\t" //t5 + "psubw %%mm0, %%mm3 \n\t" //d6 - "paddw %%mm2, %%mm4 \n\t" //t4 - "movq %%mm7, %%mm0 \n\t" + "paddw %%mm2, %%mm4 \n\t" //t4 + "movq %%mm7, %%mm0 \n\t" - "paddw %%mm2, %%mm7 \n\t" //d2 - "psubw %%mm2, %%mm0 \n\t" //d5 + "paddw %%mm2, %%mm7 \n\t" //d2 + "psubw %%mm2, %%mm0 \n\t" //d5 - "movq "MANGLE(MM_DESCALE_RND)", %%mm2 \n\t" //4 - "psubw %%mm5, %%mm6 \n\t" //d7 + "movq "MANGLE(MM_DESCALE_RND)", %%mm2 \n\t" //4 + "psubw %%mm5, %%mm6 \n\t" //d7 - "paddw 0*8+%3, %%mm5 \n\t" //d0 - "paddw %%mm2, %%mm1 \n\t" + "paddw 0*8+%3, %%mm5 \n\t" //d0 + "paddw %%mm2, %%mm1 \n\t" - "paddw %%mm2, %%mm5 \n\t" - "psraw $3, %%mm1 \n\t" + "paddw %%mm2, %%mm5 \n\t" + "psraw $3, %%mm1 \n\t" - "paddw %%mm2, %%mm7 \n\t" - "psraw $3, %%mm5 \n\t" + "paddw %%mm2, %%mm7 \n\t" + "psraw $3, %%mm5 \n\t" - "paddw (%%"REG_D"), %%mm5 \n\t" - "psraw $3, %%mm7 \n\t" + "paddw (%%"REG_D"), %%mm5 \n\t" + "psraw $3, %%mm7 \n\t" - "paddw (%%"REG_D",%%"REG_a",), %%mm1 \n\t" - "paddw %%mm2, %%mm0 \n\t" + "paddw (%%"REG_D",%%"REG_a",), %%mm1 \n\t" + "paddw %%mm2, %%mm0 \n\t" - "paddw (%%"REG_D",%%"REG_a",2), %%mm7 \n\t" - "paddw %%mm2, %%mm3 \n\t" + "paddw (%%"REG_D",%%"REG_a",2), %%mm7 \n\t" + "paddw %%mm2, %%mm3 \n\t" - "movq %%mm5, (%%"REG_D") \n\t" - "paddw %%mm2, %%mm6 \n\t" + "movq %%mm5, (%%"REG_D") \n\t" + "paddw %%mm2, %%mm6 \n\t" - "movq %%mm1, (%%"REG_D",%%"REG_a",) \n\t" - "psraw $3, %%mm0 \n\t" + "movq %%mm1, (%%"REG_D",%%"REG_a",) \n\t" + "psraw $3, %%mm0 \n\t" - "movq %%mm7, (%%"REG_D",%%"REG_a",2) \n\t" - "add %%"REG_d", %%"REG_D" \n\t" //3*ls + "movq %%mm7, (%%"REG_D",%%"REG_a",2) \n\t" + "add %%"REG_d", %%"REG_D" \n\t" //3*ls - "movq 1*8+%3, %%mm5 \n\t" //t3 - "psraw $3, %%mm3 \n\t" + "movq 1*8+%3, %%mm5 \n\t" //t3 + "psraw $3, %%mm3 \n\t" - "paddw (%%"REG_D",%%"REG_a",2), %%mm0 \n\t" - "psubw %%mm4, %%mm5 \n\t" //d3 + "paddw (%%"REG_D",%%"REG_a",2), %%mm0 \n\t" + "psubw %%mm4, %%mm5 \n\t" //d3 - "paddw (%%"REG_D",%%"REG_d",), %%mm3 \n\t" - "psraw $3, %%mm6 \n\t" + "paddw (%%"REG_D",%%"REG_d",), %%mm3 \n\t" + "psraw $3, %%mm6 \n\t" - "paddw 1*8+%3, %%mm4 \n\t" //d4 - "paddw %%mm2, %%mm5 \n\t" + "paddw 1*8+%3, %%mm4 \n\t" //d4 + "paddw %%mm2, %%mm5 \n\t" - "paddw (%%"REG_D",%%"REG_a",4), %%mm6 \n\t" - "paddw %%mm2, %%mm4 \n\t" + "paddw (%%"REG_D",%%"REG_a",4), %%mm6 \n\t" + "paddw %%mm2, %%mm4 \n\t" - "movq %%mm0, (%%"REG_D",%%"REG_a",2) \n\t" - "psraw $3, %%mm5 \n\t" + "movq %%mm0, (%%"REG_D",%%"REG_a",2) \n\t" + "psraw $3, %%mm5 \n\t" - "paddw (%%"REG_D"), %%mm5 \n\t" - "psraw $3, %%mm4 \n\t" + "paddw (%%"REG_D"), %%mm5 \n\t" + "psraw $3, %%mm4 \n\t" - "paddw (%%"REG_D",%%"REG_a",), %%mm4 \n\t" - "add $"DCTSIZE_S"*2*4, %%"REG_S" \n\t" //4 rows + "paddw (%%"REG_D",%%"REG_a",), %%mm4 \n\t" + "add $"DCTSIZE_S"*2*4, %%"REG_S" \n\t" //4 rows - "movq %%mm3, (%%"REG_D",%%"REG_d",) \n\t" - "movq %%mm6, (%%"REG_D",%%"REG_a",4) \n\t" - "movq %%mm5, (%%"REG_D") \n\t" - "movq %%mm4, (%%"REG_D",%%"REG_a",) \n\t" + "movq %%mm3, (%%"REG_D",%%"REG_d",) \n\t" + "movq %%mm6, (%%"REG_D",%%"REG_a",4) \n\t" + "movq %%mm5, (%%"REG_D") \n\t" + "movq %%mm4, (%%"REG_D",%%"REG_a",) \n\t" - "sub %%"REG_d", %%"REG_D" \n\t" - "add $8, %%"REG_D" \n\t" - "dec %%"REG_c" \n\t" - "jnz 1b \n\t" + "sub %%"REG_d", %%"REG_D" \n\t" + "add $8, %%"REG_D" \n\t" + "dec %%"REG_c" \n\t" + "jnz 1b \n\t" - : "+S"(workspace), "+D"(output_adr), "+c"(cnt), "=o"(temps) - : "a"(output_stride*sizeof(short)) - : "%"REG_d - ); + : "+S"(workspace), "+D"(output_adr), "+c"(cnt), "=o"(temps) + : "a"(output_stride*sizeof(short)) + : "%"REG_d + ); } #endif // HAVE_MMX @@ -1886,52 +1886,52 @@ static void row_fdct_c(DCTELEM *data, const uint8_t *pixels, int line_size, int dataptr = data; for (; cnt > 0; cnt--) { - tmp0 = pixels[line_size*0] + pixels[line_size*7]; - tmp7 = pixels[line_size*0] - pixels[line_size*7]; - tmp1 = pixels[line_size*1] + pixels[line_size*6]; - tmp6 = pixels[line_size*1] - pixels[line_size*6]; - tmp2 = pixels[line_size*2] + pixels[line_size*5]; - tmp5 = pixels[line_size*2] - pixels[line_size*5]; - tmp3 = pixels[line_size*3] + pixels[line_size*4]; - tmp4 = pixels[line_size*3] - pixels[line_size*4]; - - // Even part - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - //Even columns are written first, this leads to different order of columns - //in column_fidct(), but they are processed independently, so all ok. - //Later in the row_idct() columns readed at the same order. - dataptr[2] = tmp10 + tmp11; - dataptr[3] = tmp10 - tmp11; - - z1 = MULTIPLY16H((tmp12 + tmp13)<<2, FIX_0_707106781); - dataptr[0] = tmp13 + z1; - dataptr[1] = tmp13 - z1; - - // Odd part - - tmp10 = (tmp4 + tmp5) <<2; - tmp11 = (tmp5 + tmp6) <<2; - tmp12 = (tmp6 + tmp7) <<2; - - z5 = MULTIPLY16H(tmp10 - tmp12, FIX_0_382683433); - z2 = MULTIPLY16H(tmp10, FIX_0_541196100) + z5; - z4 = MULTIPLY16H(tmp12, FIX_1_306562965) + z5; - z3 = MULTIPLY16H(tmp11, FIX_0_707106781); - - z11 = tmp7 + z3; - z13 = tmp7 - z3; - - dataptr[4] = z13 + z2; - dataptr[5] = z13 - z2; - dataptr[6] = z11 + z4; - dataptr[7] = z11 - z4; - - pixels++; // advance pointer to next column - dataptr += DCTSIZE; + tmp0 = pixels[line_size*0] + pixels[line_size*7]; + tmp7 = pixels[line_size*0] - pixels[line_size*7]; + tmp1 = pixels[line_size*1] + pixels[line_size*6]; + tmp6 = pixels[line_size*1] - pixels[line_size*6]; + tmp2 = pixels[line_size*2] + pixels[line_size*5]; + tmp5 = pixels[line_size*2] - pixels[line_size*5]; + tmp3 = pixels[line_size*3] + pixels[line_size*4]; + tmp4 = pixels[line_size*3] - pixels[line_size*4]; + + // Even part + + tmp10 = tmp0 + tmp3; + tmp13 = tmp0 - tmp3; + tmp11 = tmp1 + tmp2; + tmp12 = tmp1 - tmp2; + //Even columns are written first, this leads to different order of columns + //in column_fidct(), but they are processed independently, so all ok. + //Later in the row_idct() columns readed at the same order. + dataptr[2] = tmp10 + tmp11; + dataptr[3] = tmp10 - tmp11; + + z1 = MULTIPLY16H((tmp12 + tmp13)<<2, FIX_0_707106781); + dataptr[0] = tmp13 + z1; + dataptr[1] = tmp13 - z1; + + // Odd part + + tmp10 = (tmp4 + tmp5) <<2; + tmp11 = (tmp5 + tmp6) <<2; + tmp12 = (tmp6 + tmp7) <<2; + + z5 = MULTIPLY16H(tmp10 - tmp12, FIX_0_382683433); + z2 = MULTIPLY16H(tmp10, FIX_0_541196100) + z5; + z4 = MULTIPLY16H(tmp12, FIX_1_306562965) + z5; + z3 = MULTIPLY16H(tmp11, FIX_0_707106781); + + z11 = tmp7 + z3; + z13 = tmp7 - z3; + + dataptr[4] = z13 + z2; + dataptr[5] = z13 - z2; + dataptr[6] = z11 + z4; + dataptr[7] = z11 - z4; + + pixels++; // advance pointer to next column + dataptr += DCTSIZE; } } @@ -1941,177 +1941,177 @@ static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, { uint64_t __attribute__((aligned(8))) temps[4]; __asm__ volatile( - "lea (%%"REG_a",%%"REG_a",2), %%"REG_d" \n\t" - "6: \n\t" - "movd (%%"REG_S"), %%mm0 \n\t" - "pxor %%mm7, %%mm7 \n\t" + "lea (%%"REG_a",%%"REG_a",2), %%"REG_d" \n\t" + "6: \n\t" + "movd (%%"REG_S"), %%mm0 \n\t" + "pxor %%mm7, %%mm7 \n\t" - "movd (%%"REG_S",%%"REG_a",), %%mm1 \n\t" - "punpcklbw %%mm7, %%mm0 \n\t" + "movd (%%"REG_S",%%"REG_a",), %%mm1 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" - "movd (%%"REG_S",%%"REG_a",2), %%mm2 \n\t" - "punpcklbw %%mm7, %%mm1 \n\t" + "movd (%%"REG_S",%%"REG_a",2), %%mm2 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" - "punpcklbw %%mm7, %%mm2 \n\t" - "add %%"REG_d", %%"REG_S" \n\t" + "punpcklbw %%mm7, %%mm2 \n\t" + "add %%"REG_d", %%"REG_S" \n\t" - "movq %%mm0, %%mm5 \n\t" - // + "movq %%mm0, %%mm5 \n\t" + // - "movd (%%"REG_S",%%"REG_a",4), %%mm3 \n\t" //7 ;prefetch! - "movq %%mm1, %%mm6 \n\t" + "movd (%%"REG_S",%%"REG_a",4), %%mm3 \n\t" //7 ;prefetch! + "movq %%mm1, %%mm6 \n\t" - "movd (%%"REG_S",%%"REG_d",), %%mm4 \n\t" //6 - "punpcklbw %%mm7, %%mm3 \n\t" + "movd (%%"REG_S",%%"REG_d",), %%mm4 \n\t" //6 + "punpcklbw %%mm7, %%mm3 \n\t" - "psubw %%mm3, %%mm5 \n\t" - "punpcklbw %%mm7, %%mm4 \n\t" + "psubw %%mm3, %%mm5 \n\t" + "punpcklbw %%mm7, %%mm4 \n\t" - "paddw %%mm3, %%mm0 \n\t" - "psubw %%mm4, %%mm6 \n\t" + "paddw %%mm3, %%mm0 \n\t" + "psubw %%mm4, %%mm6 \n\t" - "movd (%%"REG_S",%%"REG_a",2), %%mm3 \n\t" //5 - "paddw %%mm4, %%mm1 \n\t" + "movd (%%"REG_S",%%"REG_a",2), %%mm3 \n\t" //5 + "paddw %%mm4, %%mm1 \n\t" - "movq %%mm5, 0*8+%3 \n\t" //t7 - "punpcklbw %%mm7, %%mm3 \n\t" + "movq %%mm5, 0*8+%3 \n\t" //t7 + "punpcklbw %%mm7, %%mm3 \n\t" - "movq %%mm6, 1*8+%3 \n\t" //t6 - "movq %%mm2, %%mm4 \n\t" + "movq %%mm6, 1*8+%3 \n\t" //t6 + "movq %%mm2, %%mm4 \n\t" - "movd (%%"REG_S"), %%mm5 \n\t" //3 - "paddw %%mm3, %%mm2 \n\t" + "movd (%%"REG_S"), %%mm5 \n\t" //3 + "paddw %%mm3, %%mm2 \n\t" - "movd (%%"REG_S",%%"REG_a",), %%mm6 \n\t" //4 - "punpcklbw %%mm7, %%mm5 \n\t" + "movd (%%"REG_S",%%"REG_a",), %%mm6 \n\t" //4 + "punpcklbw %%mm7, %%mm5 \n\t" - "psubw %%mm3, %%mm4 \n\t" - "punpcklbw %%mm7, %%mm6 \n\t" + "psubw %%mm3, %%mm4 \n\t" + "punpcklbw %%mm7, %%mm6 \n\t" - "movq %%mm5, %%mm3 \n\t" - "paddw %%mm6, %%mm5 \n\t" //t3 + "movq %%mm5, %%mm3 \n\t" + "paddw %%mm6, %%mm5 \n\t" //t3 - "psubw %%mm6, %%mm3 \n\t" //t4 ; t0 t1 t2 t4 t5 t3 - - - "movq %%mm0, %%mm6 \n\t" + "psubw %%mm6, %%mm3 \n\t" //t4 ; t0 t1 t2 t4 t5 t3 - - + "movq %%mm0, %%mm6 \n\t" - "movq %%mm1, %%mm7 \n\t" - "psubw %%mm5, %%mm0 \n\t" //t13 + "movq %%mm1, %%mm7 \n\t" + "psubw %%mm5, %%mm0 \n\t" //t13 - "psubw %%mm2, %%mm1 \n\t" - "paddw %%mm2, %%mm7 \n\t" //t11 + "psubw %%mm2, %%mm1 \n\t" + "paddw %%mm2, %%mm7 \n\t" //t11 - "paddw %%mm0, %%mm1 \n\t" - "movq %%mm7, %%mm2 \n\t" + "paddw %%mm0, %%mm1 \n\t" + "movq %%mm7, %%mm2 \n\t" - "psllw $2, %%mm1 \n\t" - "paddw %%mm5, %%mm6 \n\t" //t10 + "psllw $2, %%mm1 \n\t" + "paddw %%mm5, %%mm6 \n\t" //t10 - "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm1 \n\t" - "paddw %%mm6, %%mm7 \n\t" //d2 + "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm1 \n\t" + "paddw %%mm6, %%mm7 \n\t" //d2 - "psubw %%mm2, %%mm6 \n\t" //d3 - "movq %%mm0, %%mm5 \n\t" + "psubw %%mm2, %%mm6 \n\t" //d3 + "movq %%mm0, %%mm5 \n\t" - //transpose 4x4 - "movq %%mm7, %%mm2 \n\t" - "punpcklwd %%mm6, %%mm7 \n\t" + //transpose 4x4 + "movq %%mm7, %%mm2 \n\t" + "punpcklwd %%mm6, %%mm7 \n\t" - "paddw %%mm1, %%mm0 \n\t" //d0 - "punpckhwd %%mm6, %%mm2 \n\t" + "paddw %%mm1, %%mm0 \n\t" //d0 + "punpckhwd %%mm6, %%mm2 \n\t" - "psubw %%mm1, %%mm5 \n\t" //d1 - "movq %%mm0, %%mm6 \n\t" + "psubw %%mm1, %%mm5 \n\t" //d1 + "movq %%mm0, %%mm6 \n\t" - "movq 1*8+%3, %%mm1 \n\t" - "punpcklwd %%mm5, %%mm0 \n\t" + "movq 1*8+%3, %%mm1 \n\t" + "punpcklwd %%mm5, %%mm0 \n\t" - "punpckhwd %%mm5, %%mm6 \n\t" - "movq %%mm0, %%mm5 \n\t" + "punpckhwd %%mm5, %%mm6 \n\t" + "movq %%mm0, %%mm5 \n\t" - "punpckldq %%mm7, %%mm0 \n\t" //0 - "paddw %%mm4, %%mm3 \n\t" + "punpckldq %%mm7, %%mm0 \n\t" //0 + "paddw %%mm4, %%mm3 \n\t" - "punpckhdq %%mm7, %%mm5 \n\t" //1 - "movq %%mm6, %%mm7 \n\t" + "punpckhdq %%mm7, %%mm5 \n\t" //1 + "movq %%mm6, %%mm7 \n\t" - "movq %%mm0, "DCTSIZE_S"*0*2(%%"REG_D") \n\t" - "punpckldq %%mm2, %%mm6 \n\t" //2 + "movq %%mm0, "DCTSIZE_S"*0*2(%%"REG_D") \n\t" + "punpckldq %%mm2, %%mm6 \n\t" //2 - "movq %%mm5, "DCTSIZE_S"*1*2(%%"REG_D") \n\t" - "punpckhdq %%mm2, %%mm7 \n\t" //3 + "movq %%mm5, "DCTSIZE_S"*1*2(%%"REG_D") \n\t" + "punpckhdq %%mm2, %%mm7 \n\t" //3 - "movq %%mm6, "DCTSIZE_S"*2*2(%%"REG_D") \n\t" - "paddw %%mm1, %%mm4 \n\t" + "movq %%mm6, "DCTSIZE_S"*2*2(%%"REG_D") \n\t" + "paddw %%mm1, %%mm4 \n\t" - "movq %%mm7, "DCTSIZE_S"*3*2(%%"REG_D") \n\t" - "psllw $2, %%mm3 \n\t" //t10 + "movq %%mm7, "DCTSIZE_S"*3*2(%%"REG_D") \n\t" + "psllw $2, %%mm3 \n\t" //t10 - "movq 0*8+%3, %%mm2 \n\t" - "psllw $2, %%mm4 \n\t" //t11 + "movq 0*8+%3, %%mm2 \n\t" + "psllw $2, %%mm4 \n\t" //t11 - "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm4 \n\t" //z3 - "paddw %%mm2, %%mm1 \n\t" + "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm4 \n\t" //z3 + "paddw %%mm2, %%mm1 \n\t" - "psllw $2, %%mm1 \n\t" //t12 - "movq %%mm3, %%mm0 \n\t" + "psllw $2, %%mm1 \n\t" //t12 + "movq %%mm3, %%mm0 \n\t" - "pmulhw "MANGLE(MM_FIX_0_541196100)", %%mm0 \n\t" - "psubw %%mm1, %%mm3 \n\t" + "pmulhw "MANGLE(MM_FIX_0_541196100)", %%mm0 \n\t" + "psubw %%mm1, %%mm3 \n\t" - "pmulhw "MANGLE(MM_FIX_0_382683433)", %%mm3 \n\t" //z5 - "movq %%mm2, %%mm5 \n\t" + "pmulhw "MANGLE(MM_FIX_0_382683433)", %%mm3 \n\t" //z5 + "movq %%mm2, %%mm5 \n\t" - "pmulhw "MANGLE(MM_FIX_1_306562965)", %%mm1 \n\t" - "psubw %%mm4, %%mm2 \n\t" //z13 + "pmulhw "MANGLE(MM_FIX_1_306562965)", %%mm1 \n\t" + "psubw %%mm4, %%mm2 \n\t" //z13 - "paddw %%mm4, %%mm5 \n\t" //z11 - "movq %%mm2, %%mm6 \n\t" + "paddw %%mm4, %%mm5 \n\t" //z11 + "movq %%mm2, %%mm6 \n\t" - "paddw %%mm3, %%mm0 \n\t" //z2 - "movq %%mm5, %%mm7 \n\t" + "paddw %%mm3, %%mm0 \n\t" //z2 + "movq %%mm5, %%mm7 \n\t" - "paddw %%mm0, %%mm2 \n\t" //d4 - "psubw %%mm0, %%mm6 \n\t" //d5 + "paddw %%mm0, %%mm2 \n\t" //d4 + "psubw %%mm0, %%mm6 \n\t" //d5 - "movq %%mm2, %%mm4 \n\t" - "paddw %%mm3, %%mm1 \n\t" //z4 + "movq %%mm2, %%mm4 \n\t" + "paddw %%mm3, %%mm1 \n\t" //z4 - //transpose 4x4 - "punpcklwd %%mm6, %%mm2 \n\t" - "paddw %%mm1, %%mm5 \n\t" //d6 + //transpose 4x4 + "punpcklwd %%mm6, %%mm2 \n\t" + "paddw %%mm1, %%mm5 \n\t" //d6 - "punpckhwd %%mm6, %%mm4 \n\t" - "psubw %%mm1, %%mm7 \n\t" //d7 + "punpckhwd %%mm6, %%mm4 \n\t" + "psubw %%mm1, %%mm7 \n\t" //d7 - "movq %%mm5, %%mm6 \n\t" - "punpcklwd %%mm7, %%mm5 \n\t" + "movq %%mm5, %%mm6 \n\t" + "punpcklwd %%mm7, %%mm5 \n\t" - "punpckhwd %%mm7, %%mm6 \n\t" - "movq %%mm2, %%mm7 \n\t" + "punpckhwd %%mm7, %%mm6 \n\t" + "movq %%mm2, %%mm7 \n\t" - "punpckldq %%mm5, %%mm2 \n\t" //4 - "sub %%"REG_d", %%"REG_S" \n\t" + "punpckldq %%mm5, %%mm2 \n\t" //4 + "sub %%"REG_d", %%"REG_S" \n\t" - "punpckhdq %%mm5, %%mm7 \n\t" //5 - "movq %%mm4, %%mm5 \n\t" + "punpckhdq %%mm5, %%mm7 \n\t" //5 + "movq %%mm4, %%mm5 \n\t" - "movq %%mm2, "DCTSIZE_S"*0*2+"DCTSIZE_S"(%%"REG_D") \n\t" - "punpckldq %%mm6, %%mm4 \n\t" //6 + "movq %%mm2, "DCTSIZE_S"*0*2+"DCTSIZE_S"(%%"REG_D") \n\t" + "punpckldq %%mm6, %%mm4 \n\t" //6 - "movq %%mm7, "DCTSIZE_S"*1*2+"DCTSIZE_S"(%%"REG_D") \n\t" - "punpckhdq %%mm6, %%mm5 \n\t" //7 + "movq %%mm7, "DCTSIZE_S"*1*2+"DCTSIZE_S"(%%"REG_D") \n\t" + "punpckhdq %%mm6, %%mm5 \n\t" //7 - "movq %%mm4, "DCTSIZE_S"*2*2+"DCTSIZE_S"(%%"REG_D") \n\t" - "add $4, %%"REG_S" \n\t" + "movq %%mm4, "DCTSIZE_S"*2*2+"DCTSIZE_S"(%%"REG_D") \n\t" + "add $4, %%"REG_S" \n\t" - "movq %%mm5, "DCTSIZE_S"*3*2+"DCTSIZE_S"(%%"REG_D") \n\t" - "add $"DCTSIZE_S"*2*4, %%"REG_D" \n\t" //4 rows - "dec %%"REG_c" \n\t" - "jnz 6b \n\t" + "movq %%mm5, "DCTSIZE_S"*3*2+"DCTSIZE_S"(%%"REG_D") \n\t" + "add $"DCTSIZE_S"*2*4, %%"REG_D" \n\t" //4 rows + "dec %%"REG_c" \n\t" + "jnz 6b \n\t" - : "+S"(pixels), "+D"(data), "+c"(cnt), "=o"(temps) - : "a"(line_size) - : "%"REG_d); + : "+S"(pixels), "+D"(data), "+c"(cnt), "=o"(temps) + : "a"(line_size) + : "%"REG_d); } #endif // HAVE_MMX diff --git a/mplayer/libmpcodecs/vf_harddup.c b/mplayer/libmpcodecs/vf_harddup.c index e66a028d..d2df5da9 100644 --- a/mplayer/libmpcodecs/vf_harddup.c +++ b/mplayer/libmpcodecs/vf_harddup.c @@ -28,58 +28,58 @@ #include "vf.h" struct vf_priv_s { - mp_image_t *last_mpi; + mp_image_t *last_mpi; }; static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { - mp_image_t *dmpi; + mp_image_t *dmpi; - vf->priv->last_mpi = mpi; + vf->priv->last_mpi = mpi; - dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height); + dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height); - dmpi->planes[0] = mpi->planes[0]; - dmpi->stride[0] = mpi->stride[0]; - if (dmpi->flags&MP_IMGFLAG_PLANAR) { - dmpi->planes[1] = mpi->planes[1]; - dmpi->stride[1] = mpi->stride[1]; - dmpi->planes[2] = mpi->planes[2]; - dmpi->stride[2] = mpi->stride[2]; - } + dmpi->planes[0] = mpi->planes[0]; + dmpi->stride[0] = mpi->stride[0]; + if (dmpi->flags&MP_IMGFLAG_PLANAR) { + dmpi->planes[1] = mpi->planes[1]; + dmpi->stride[1] = mpi->stride[1]; + dmpi->planes[2] = mpi->planes[2]; + dmpi->stride[2] = mpi->stride[2]; + } - return vf_next_put_image(vf, dmpi, pts); + return vf_next_put_image(vf, dmpi, pts); } static int control(struct vf_instance *vf, int request, void* data) { - switch (request) { - case VFCTRL_DUPLICATE_FRAME: - if (!vf->priv->last_mpi) break; - // This is a huge hack. We assume nothing - // has been called earlier in the filter chain - // since the last put_image. This is reasonable - // because we're handling a duplicate frame! - if (put_image(vf, vf->priv->last_mpi, MP_NOPTS_VALUE)) - return CONTROL_TRUE; - break; - } - return vf_next_control(vf, request, data); + switch (request) { + case VFCTRL_DUPLICATE_FRAME: + if (!vf->priv->last_mpi) break; + // This is a huge hack. We assume nothing + // has been called earlier in the filter chain + // since the last put_image. This is reasonable + // because we're handling a duplicate frame! + if (put_image(vf, vf->priv->last_mpi, MP_NOPTS_VALUE)) + return CONTROL_TRUE; + break; + } + return vf_next_control(vf, request, data); } static void uninit(struct vf_instance *vf) { - free(vf->priv); + free(vf->priv); } static int vf_open(vf_instance_t *vf, char *args) { - vf->put_image = put_image; - vf->control = control; - vf->uninit = uninit; - vf->priv = calloc(1, sizeof(struct vf_priv_s)); - return 1; + vf->put_image = put_image; + vf->control = control; + vf->uninit = uninit; + vf->priv = calloc(1, sizeof(struct vf_priv_s)); + return 1; } const vf_info_t vf_info_harddup = { diff --git a/mplayer/libmpcodecs/vf_hqdn3d.c b/mplayer/libmpcodecs/vf_hqdn3d.c index 35f42e99..cb53b2e0 100644 --- a/mplayer/libmpcodecs/vf_hqdn3d.c +++ b/mplayer/libmpcodecs/vf_hqdn3d.c @@ -38,7 +38,7 @@ struct vf_priv_s { int Coefs[4][512*16]; unsigned int *Line; - unsigned short *Frame[3]; + unsigned short *Frame[3]; }; @@ -46,25 +46,25 @@ struct vf_priv_s { static void uninit(struct vf_instance *vf) { - free(vf->priv->Line); - free(vf->priv->Frame[0]); - free(vf->priv->Frame[1]); - free(vf->priv->Frame[2]); - - vf->priv->Line = NULL; - vf->priv->Frame[0] = NULL; - vf->priv->Frame[1] = NULL; - vf->priv->Frame[2] = NULL; + free(vf->priv->Line); + free(vf->priv->Frame[0]); + free(vf->priv->Frame[1]); + free(vf->priv->Frame[2]); + + vf->priv->Line = NULL; + vf->priv->Frame[0] = NULL; + vf->priv->Frame[1] = NULL; + vf->priv->Frame[2] = NULL; } static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ - uninit(vf); + uninit(vf); vf->priv->Line = malloc(width*sizeof(int)); - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static inline unsigned int LowPassMul(unsigned int PrevMul, unsigned int CurrMul, int* Coef){ @@ -119,8 +119,8 @@ static void deNoiseSpacial( } for (Y = 1; Y < H; Y++){ - unsigned int PixelAnt; - sLineOffs += sStride, dLineOffs += dStride; + unsigned int PixelAnt; + sLineOffs += sStride, dLineOffs += dStride; /* First pixel on each line doesn't have previous pixel */ PixelAnt = Frame[sLineOffs]<<16; PixelDst = LineAnt[0] = LowPassMul(LineAnt[0], PixelAnt, Vertical); @@ -139,7 +139,7 @@ static void deNoiseSpacial( static void deNoise(unsigned char *Frame, // mpi->planes[x] unsigned char *FrameDest, // dmpi->planes[x] unsigned int *LineAnt, // vf->priv->Line (width bytes) - unsigned short **FrameAntPtr, + unsigned short **FrameAntPtr, int W, int H, int sStride, int dStride, int *Horizontal, int *Vertical, int *Temporal) { @@ -150,12 +150,12 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x] unsigned short* FrameAnt=(*FrameAntPtr); if(!FrameAnt){ - (*FrameAntPtr)=FrameAnt=malloc(W*H*sizeof(unsigned short)); - for (Y = 0; Y < H; Y++){ - unsigned short* dst=&FrameAnt[Y*W]; - unsigned char* src=Frame+Y*sStride; - for (X = 0; X < W; X++) dst[X]=src[X]<<8; - } + (*FrameAntPtr)=FrameAnt=malloc(W*H*sizeof(unsigned short)); + for (Y = 0; Y < H; Y++){ + unsigned short* dst=&FrameAnt[Y*W]; + unsigned char* src=Frame+Y*sStride; + for (X = 0; X < W; X++) dst[X]=src[X]<<8; + } } if(!Horizontal[0] && !Vertical[0]){ @@ -185,13 +185,13 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x] } for (Y = 1; Y < H; Y++){ - unsigned int PixelAnt; - unsigned short* LinePrev=&FrameAnt[Y*W]; - sLineOffs += sStride, dLineOffs += dStride; + unsigned int PixelAnt; + unsigned short* LinePrev=&FrameAnt[Y*W]; + sLineOffs += sStride, dLineOffs += dStride; /* First pixel on each line doesn't have previous pixel */ PixelAnt = Frame[sLineOffs]<<16; LineAnt[0] = LowPassMul(LineAnt[0], PixelAnt, Vertical); - PixelDst = LowPassMul(LinePrev[0]<<8, LineAnt[0], Temporal); + PixelDst = LowPassMul(LinePrev[0]<<8, LineAnt[0], Temporal); LinePrev[0] = ((PixelDst+0x1000007F)>>8); FrameDest[dLineOffs]= ((PixelDst+0x10007FFF)>>16); @@ -200,7 +200,7 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x] /* The rest are normal */ PixelAnt = LowPassMul(PixelAnt, Frame[sLineOffs+X]<<16, Horizontal); LineAnt[X] = LowPassMul(LineAnt[X], PixelAnt, Vertical); - PixelDst = LowPassMul(LinePrev[X]<<8, LineAnt[X], Temporal); + PixelDst = LowPassMul(LinePrev[X]<<8, LineAnt[X], Temporal); LinePrev[X] = ((PixelDst+0x1000007F)>>8); FrameDest[dLineOffs+X]= ((PixelDst+0x10007FFF)>>16); } @@ -209,53 +209,53 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x] static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ - int cw= mpi->w >> mpi->chroma_x_shift; - int ch= mpi->h >> mpi->chroma_y_shift; + int cw= mpi->w >> mpi->chroma_x_shift; + int ch= mpi->h >> mpi->chroma_y_shift; int W = mpi->w, H = mpi->h; - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w,mpi->h); - if(!dmpi) return 0; + if(!dmpi) return 0; deNoise(mpi->planes[0], dmpi->planes[0], - vf->priv->Line, &vf->priv->Frame[0], W, H, + vf->priv->Line, &vf->priv->Frame[0], W, H, mpi->stride[0], dmpi->stride[0], vf->priv->Coefs[0], vf->priv->Coefs[0], vf->priv->Coefs[1]); deNoise(mpi->planes[1], dmpi->planes[1], - vf->priv->Line, &vf->priv->Frame[1], cw, ch, + vf->priv->Line, &vf->priv->Frame[1], cw, ch, mpi->stride[1], dmpi->stride[1], vf->priv->Coefs[2], vf->priv->Coefs[2], vf->priv->Coefs[3]); deNoise(mpi->planes[2], dmpi->planes[2], - vf->priv->Line, &vf->priv->Frame[2], cw, ch, + vf->priv->Line, &vf->priv->Frame[2], cw, ch, mpi->stride[2], dmpi->stride[2], vf->priv->Coefs[2], vf->priv->Coefs[2], vf->priv->Coefs[3]); - return vf_next_put_image(vf,dmpi, pts); + return vf_next_put_image(vf,dmpi, pts); } //===========================================================================// static int query_format(struct vf_instance *vf, unsigned int fmt){ switch(fmt) - { - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_YVU9: - case IMGFMT_444P: - case IMGFMT_422P: - case IMGFMT_411P: - return vf_next_query_format(vf, fmt); - } - return 0; + { + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YVU9: + case IMGFMT_444P: + case IMGFMT_422P: + case IMGFMT_411P: + return vf_next_query_format(vf, fmt); + } + return 0; } @@ -283,11 +283,11 @@ static int vf_open(vf_instance_t *vf, char *args){ double LumSpac, LumTmp, ChromSpac, ChromTmp; double Param1, Param2, Param3, Param4; - vf->config=config; - vf->put_image=put_image; + vf->config=config; + vf->put_image=put_image; vf->query_format=query_format; vf->uninit=uninit; - vf->priv=malloc(sizeof(struct vf_priv_s)); + vf->priv=malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); if (args) @@ -358,7 +358,7 @@ static int vf_open(vf_instance_t *vf, char *args){ PrecalcCoefs(vf->priv->Coefs[2], ChromSpac); PrecalcCoefs(vf->priv->Coefs[3], ChromTmp); - return 1; + return 1; } const vf_info_t vf_info_hqdn3d = { diff --git a/mplayer/libmpcodecs/vf_hue.c b/mplayer/libmpcodecs/vf_hue.c index a7671de9..1a266885 100644 --- a/mplayer/libmpcodecs/vf_hue.c +++ b/mplayer/libmpcodecs/vf_hue.c @@ -36,9 +36,9 @@ #include "m_struct.h" static struct vf_priv_s { - uint8_t *buf[2]; - float hue; - float saturation; + uint8_t *buf[2]; + float hue; + float saturation; } const vf_priv_dflt = { {NULL, NULL}, 0.0, @@ -46,134 +46,134 @@ static struct vf_priv_s { }; static void process_C(uint8_t *udst, uint8_t *vdst, uint8_t *usrc, uint8_t *vsrc, int dststride, int srcstride, - int w, int h, float hue, float sat) + int w, int h, float hue, float sat) { - int i; - const int s= rint(sin(hue) * (1<<16) * sat); - const int c= rint(cos(hue) * (1<<16) * sat); - - while (h--) { - for (i = 0; i>16; - int new_v= (s*u + c*v + (1<<15) + (128<<16))>>16; - if(new_u & 768) new_u= (-new_u)>>31; - if(new_v & 768) new_v= (-new_v)>>31; - udst[i]= new_u; - vdst[i]= new_v; - } - usrc += srcstride; - vsrc += srcstride; - udst += dststride; - vdst += dststride; - } + int i; + const int s= rint(sin(hue) * (1<<16) * sat); + const int c= rint(cos(hue) * (1<<16) * sat); + + while (h--) { + for (i = 0; i>16; + int new_v= (s*u + c*v + (1<<15) + (128<<16))>>16; + if(new_u & 768) new_u= (-new_u)>>31; + if(new_v & 768) new_v= (-new_v)>>31; + udst[i]= new_u; + vdst[i]= new_v; + } + usrc += srcstride; + vsrc += srcstride; + udst += dststride; + vdst += dststride; + } } static void (*process)(uint8_t *udst, uint8_t *vdst, uint8_t *usrc, uint8_t *vsrc, int dststride, int srcstride, - int w, int h, float hue, float sat); + int w, int h, float hue, float sat); /* FIXME: add packed yuv version of process */ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { - mp_image_t *dmpi; - - dmpi=vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_EXPORT, 0, - mpi->w, mpi->h); - - dmpi->planes[0] = mpi->planes[0]; - dmpi->stride[0] = mpi->stride[0]; - dmpi->stride[1] = mpi->stride[1]; - dmpi->stride[2] = mpi->stride[2]; - - if (!vf->priv->buf[0]){ - vf->priv->buf[0] = malloc(mpi->stride[1]*mpi->h >> mpi->chroma_y_shift); - vf->priv->buf[1] = malloc(mpi->stride[2]*mpi->h >> mpi->chroma_y_shift); - } - - if (vf->priv->hue == 0 && vf->priv->saturation == 1){ - dmpi->planes[1] = mpi->planes[1]; - dmpi->planes[2] = mpi->planes[2]; - }else { - dmpi->planes[1] = vf->priv->buf[0]; - dmpi->planes[2] = vf->priv->buf[1]; - process(dmpi->planes[1], dmpi->planes[2], - mpi->planes[1], mpi->planes[2], - dmpi->stride[1],mpi->stride[1], - mpi->w>> mpi->chroma_x_shift, mpi->h>> mpi->chroma_y_shift, - vf->priv->hue, vf->priv->saturation); - } - - return vf_next_put_image(vf,dmpi, pts); + mp_image_t *dmpi; + + dmpi=vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_EXPORT, 0, + mpi->w, mpi->h); + + dmpi->planes[0] = mpi->planes[0]; + dmpi->stride[0] = mpi->stride[0]; + dmpi->stride[1] = mpi->stride[1]; + dmpi->stride[2] = mpi->stride[2]; + + if (!vf->priv->buf[0]){ + vf->priv->buf[0] = malloc(mpi->stride[1]*mpi->h >> mpi->chroma_y_shift); + vf->priv->buf[1] = malloc(mpi->stride[2]*mpi->h >> mpi->chroma_y_shift); + } + + if (vf->priv->hue == 0 && vf->priv->saturation == 1){ + dmpi->planes[1] = mpi->planes[1]; + dmpi->planes[2] = mpi->planes[2]; + }else { + dmpi->planes[1] = vf->priv->buf[0]; + dmpi->planes[2] = vf->priv->buf[1]; + process(dmpi->planes[1], dmpi->planes[2], + mpi->planes[1], mpi->planes[2], + dmpi->stride[1],mpi->stride[1], + mpi->w>> mpi->chroma_x_shift, mpi->h>> mpi->chroma_y_shift, + vf->priv->hue, vf->priv->saturation); + } + + return vf_next_put_image(vf,dmpi, pts); } static int control(struct vf_instance *vf, int request, void* data) { - vf_equalizer_t *eq; - - switch (request) { - case VFCTRL_SET_EQUALIZER: - eq = data; - if (!strcmp(eq->item,"hue")) { - vf->priv->hue = eq->value * M_PI / 100; - return CONTROL_TRUE; - } else if (!strcmp(eq->item,"saturation")) { - vf->priv->saturation = (eq->value + 100)/100.0; - return CONTROL_TRUE; - } - break; - case VFCTRL_GET_EQUALIZER: - eq = data; - if (!strcmp(eq->item,"hue")) { - eq->value = rint(vf->priv->hue *100 / M_PI); - return CONTROL_TRUE; - }else if (!strcmp(eq->item,"saturation")) { - eq->value = rint(vf->priv->saturation*100 - 100); - return CONTROL_TRUE; - } - break; - } - return vf_next_control(vf, request, data); + vf_equalizer_t *eq; + + switch (request) { + case VFCTRL_SET_EQUALIZER: + eq = data; + if (!strcmp(eq->item,"hue")) { + vf->priv->hue = eq->value * M_PI / 100; + return CONTROL_TRUE; + } else if (!strcmp(eq->item,"saturation")) { + vf->priv->saturation = (eq->value + 100)/100.0; + return CONTROL_TRUE; + } + break; + case VFCTRL_GET_EQUALIZER: + eq = data; + if (!strcmp(eq->item,"hue")) { + eq->value = rint(vf->priv->hue *100 / M_PI); + return CONTROL_TRUE; + }else if (!strcmp(eq->item,"saturation")) { + eq->value = rint(vf->priv->saturation*100 - 100); + return CONTROL_TRUE; + } + break; + } + return vf_next_control(vf, request, data); } static int query_format(struct vf_instance *vf, unsigned int fmt) { - switch (fmt) { - case IMGFMT_YVU9: - case IMGFMT_IF09: - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_CLPL: - case IMGFMT_444P: - case IMGFMT_422P: - case IMGFMT_411P: - return vf_next_query_format(vf, fmt); - } - return 0; + switch (fmt) { + case IMGFMT_YVU9: + case IMGFMT_IF09: + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_CLPL: + case IMGFMT_444P: + case IMGFMT_422P: + case IMGFMT_411P: + return vf_next_query_format(vf, fmt); + } + return 0; } static void uninit(struct vf_instance *vf) { - free(vf->priv->buf[0]); - free(vf->priv->buf[1]); - free(vf->priv); + free(vf->priv->buf[0]); + free(vf->priv->buf[1]); + free(vf->priv); } static int vf_open(vf_instance_t *vf, char *args) { - vf->control=control; - vf->query_format=query_format; - vf->put_image=put_image; - vf->uninit=uninit; + vf->control=control; + vf->query_format=query_format; + vf->put_image=put_image; + vf->uninit=uninit; vf->priv->hue *= M_PI / 180.0; - process = process_C; - return 1; + process = process_C; + return 1; } #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f) @@ -191,10 +191,10 @@ static const m_struct_t vf_opts = { }; const vf_info_t vf_info_hue = { - "hue changer", - "hue", - "Michael Niedermayer", - "", - vf_open, - &vf_opts + "hue changer", + "hue", + "Michael Niedermayer", + "", + vf_open, + &vf_opts }; diff --git a/mplayer/libmpcodecs/vf_il.c b/mplayer/libmpcodecs/vf_il.c index a9ffe0ee..3ad455d5 100644 --- a/mplayer/libmpcodecs/vf_il.c +++ b/mplayer/libmpcodecs/vf_il.c @@ -34,106 +34,106 @@ //===========================================================================// typedef struct FilterParam{ - int interleave; - int swap; + int interleave; + int swap; }FilterParam; struct vf_priv_s { - FilterParam lumaParam; - FilterParam chromaParam; + FilterParam lumaParam; + FilterParam chromaParam; }; /***************************************************************************/ static void interleave(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, int interleave, int swap){ - const int a= swap; - const int b= 1-a; - const int m= h>>1; - int y; - - switch(interleave){ - case -1: - for(y=0; y < m; y++){ - fast_memcpy(dst + dstStride* y , src + srcStride*(y*2 + a), w); - fast_memcpy(dst + dstStride*(y + m), src + srcStride*(y*2 + b), w); - } - break; - case 0: - for(y=0; y < m; y++){ - fast_memcpy(dst + dstStride* y*2 , src + srcStride*(y*2 + a), w); - fast_memcpy(dst + dstStride*(y*2+1), src + srcStride*(y*2 + b), w); - } - break; - case 1: - for(y=0; y < m; y++){ - fast_memcpy(dst + dstStride*(y*2+a), src + srcStride* y , w); - fast_memcpy(dst + dstStride*(y*2+b), src + srcStride*(y + m), w); - } - break; - } + const int a= swap; + const int b= 1-a; + const int m= h>>1; + int y; + + switch(interleave){ + case -1: + for(y=0; y < m; y++){ + fast_memcpy(dst + dstStride* y , src + srcStride*(y*2 + a), w); + fast_memcpy(dst + dstStride*(y + m), src + srcStride*(y*2 + b), w); + } + break; + case 0: + for(y=0; y < m; y++){ + fast_memcpy(dst + dstStride* y*2 , src + srcStride*(y*2 + a), w); + fast_memcpy(dst + dstStride*(y*2+1), src + srcStride*(y*2 + b), w); + } + break; + case 1: + for(y=0; y < m; y++){ + fast_memcpy(dst + dstStride*(y*2+a), src + srcStride* y , w); + fast_memcpy(dst + dstStride*(y*2+b), src + srcStride*(y + m), w); + } + break; + } } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ - int w; - FilterParam *luma = &vf->priv->lumaParam; - FilterParam *chroma= &vf->priv->chromaParam; + int w; + FilterParam *luma = &vf->priv->lumaParam; + FilterParam *chroma= &vf->priv->chromaParam; - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->w,mpi->h); + mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->w,mpi->h); - if(mpi->flags&MP_IMGFLAG_PLANAR) - w= mpi->w; - else - w= mpi->w * mpi->bpp/8; + if(mpi->flags&MP_IMGFLAG_PLANAR) + w= mpi->w; + else + w= mpi->w * mpi->bpp/8; - interleave(dmpi->planes[0], mpi->planes[0], - w, mpi->h, dmpi->stride[0], mpi->stride[0], luma->interleave, luma->swap); + interleave(dmpi->planes[0], mpi->planes[0], + w, mpi->h, dmpi->stride[0], mpi->stride[0], luma->interleave, luma->swap); - if(mpi->flags&MP_IMGFLAG_PLANAR){ - int cw= mpi->w >> mpi->chroma_x_shift; - int ch= mpi->h >> mpi->chroma_y_shift; + if(mpi->flags&MP_IMGFLAG_PLANAR){ + int cw= mpi->w >> mpi->chroma_x_shift; + int ch= mpi->h >> mpi->chroma_y_shift; - interleave(dmpi->planes[1], mpi->planes[1], cw,ch, - dmpi->stride[1], mpi->stride[1], chroma->interleave, luma->swap); - interleave(dmpi->planes[2], mpi->planes[2], cw,ch, - dmpi->stride[2], mpi->stride[2], chroma->interleave, luma->swap); - } + interleave(dmpi->planes[1], mpi->planes[1], cw,ch, + dmpi->stride[1], mpi->stride[1], chroma->interleave, luma->swap); + interleave(dmpi->planes[2], mpi->planes[2], cw,ch, + dmpi->stride[2], mpi->stride[2], chroma->interleave, luma->swap); + } - return vf_next_put_image(vf,dmpi, pts); + return vf_next_put_image(vf,dmpi, pts); } //===========================================================================// static void parse(FilterParam *fp, char* args){ - char *pos; - char *max= strchr(args, ':'); + char *pos; + char *max= strchr(args, ':'); - if(!max) max= args + strlen(args); + if(!max) max= args + strlen(args); - pos= strchr(args, 's'); - if(pos && posswap=1; - pos= strchr(args, 'i'); - if(pos && posinterleave=1; - pos= strchr(args, 'd'); - if(pos && posinterleave=-1; + pos= strchr(args, 's'); + if(pos && posswap=1; + pos= strchr(args, 'i'); + if(pos && posinterleave=1; + pos= strchr(args, 'd'); + if(pos && posinterleave=-1; } static int vf_open(vf_instance_t *vf, char *args){ - vf->put_image=put_image; -// vf->get_image=get_image; - vf->priv=malloc(sizeof(struct vf_priv_s)); - memset(vf->priv, 0, sizeof(struct vf_priv_s)); + vf->put_image=put_image; +// vf->get_image=get_image; + vf->priv=malloc(sizeof(struct vf_priv_s)); + memset(vf->priv, 0, sizeof(struct vf_priv_s)); - if(args) - { - char *arg2= strchr(args,':'); - if(arg2) parse(&vf->priv->chromaParam, arg2+1); - parse(&vf->priv->lumaParam, args); - } + if(args) + { + char *arg2= strchr(args,':'); + if(arg2) parse(&vf->priv->chromaParam, arg2+1); + parse(&vf->priv->lumaParam, args); + } - return 1; + return 1; } const vf_info_t vf_info_il = { diff --git a/mplayer/libmpcodecs/vf_ilpack.c b/mplayer/libmpcodecs/vf_ilpack.c index 4f2c2141..125cafc5 100644 --- a/mplayer/libmpcodecs/vf_ilpack.c +++ b/mplayer/libmpcodecs/vf_ilpack.c @@ -30,301 +30,301 @@ #include "vf.h" typedef void (pack_func_t)(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w, int us, int vs); + unsigned char *u, unsigned char *v, int w, int us, int vs); struct vf_priv_s { - int mode; - pack_func_t *pack[2]; + int mode; + pack_func_t *pack[2]; }; static void pack_nn_C(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w) + unsigned char *u, unsigned char *v, int w) { - int j; - for (j = w/2; j; j--) { - *dst++ = *y++; - *dst++ = *u++; - *dst++ = *y++; - *dst++ = *v++; - } + int j; + for (j = w/2; j; j--) { + *dst++ = *y++; + *dst++ = *u++; + *dst++ = *y++; + *dst++ = *v++; + } } static void pack_li_0_C(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w, int us, int vs) + unsigned char *u, unsigned char *v, int w, int us, int vs) { - int j; - for (j = w/2; j; j--) { - *dst++ = *y++; - *dst++ = (u[us+us] + 7*u[0])>>3; - *dst++ = *y++; - *dst++ = (v[vs+vs] + 7*v[0])>>3; - u++; v++; - } + int j; + for (j = w/2; j; j--) { + *dst++ = *y++; + *dst++ = (u[us+us] + 7*u[0])>>3; + *dst++ = *y++; + *dst++ = (v[vs+vs] + 7*v[0])>>3; + u++; v++; + } } static void pack_li_1_C(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w, int us, int vs) + unsigned char *u, unsigned char *v, int w, int us, int vs) { - int j; - for (j = w/2; j; j--) { - *dst++ = *y++; - *dst++ = (3*u[us+us] + 5*u[0])>>3; - *dst++ = *y++; - *dst++ = (3*v[vs+vs] + 5*v[0])>>3; - u++; v++; - } + int j; + for (j = w/2; j; j--) { + *dst++ = *y++; + *dst++ = (3*u[us+us] + 5*u[0])>>3; + *dst++ = *y++; + *dst++ = (3*v[vs+vs] + 5*v[0])>>3; + u++; v++; + } } #if HAVE_MMX static void pack_nn_MMX(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w) + unsigned char *u, unsigned char *v, int w) { - __asm__ volatile ("" - ASMALIGN(4) - "1: \n\t" - "movq (%0), %%mm1 \n\t" - "movq (%0), %%mm2 \n\t" - "movq (%1), %%mm4 \n\t" - "movq (%2), %%mm6 \n\t" - "punpcklbw %%mm6, %%mm4 \n\t" - "punpcklbw %%mm4, %%mm1 \n\t" - "punpckhbw %%mm4, %%mm2 \n\t" - - "add $8, %0 \n\t" - "add $4, %1 \n\t" - "add $4, %2 \n\t" - "movq %%mm1, (%3) \n\t" - "movq %%mm2, 8(%3) \n\t" - "add $16, %3 \n\t" - "decl %4 \n\t" - "jnz 1b \n\t" - "emms \n\t" - : - : "r" (y), "r" (u), "r" (v), "r" (dst), "r" (w/8) - : "memory" - ); - pack_nn_C(dst, y, u, v, (w&7)); + __asm__ volatile ("" + ASMALIGN(4) + "1: \n\t" + "movq (%0), %%mm1 \n\t" + "movq (%0), %%mm2 \n\t" + "movq (%1), %%mm4 \n\t" + "movq (%2), %%mm6 \n\t" + "punpcklbw %%mm6, %%mm4 \n\t" + "punpcklbw %%mm4, %%mm1 \n\t" + "punpckhbw %%mm4, %%mm2 \n\t" + + "add $8, %0 \n\t" + "add $4, %1 \n\t" + "add $4, %2 \n\t" + "movq %%mm1, (%3) \n\t" + "movq %%mm2, 8(%3) \n\t" + "add $16, %3 \n\t" + "decl %4 \n\t" + "jnz 1b \n\t" + "emms \n\t" + : + : "r" (y), "r" (u), "r" (v), "r" (dst), "r" (w/8) + : "memory" + ); + pack_nn_C(dst, y, u, v, (w&7)); } #if HAVE_EBX_AVAILABLE static void pack_li_0_MMX(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w, int us, int vs) + unsigned char *u, unsigned char *v, int w, int us, int vs) { - __asm__ volatile ("" - "push %%"REG_BP" \n\t" + __asm__ volatile ("" + "push %%"REG_BP" \n\t" #if ARCH_X86_64 - "mov %6, %%"REG_BP" \n\t" + "mov %6, %%"REG_BP" \n\t" #else - "movl 4(%%"REG_d"), %%"REG_BP" \n\t" - "movl (%%"REG_d"), %%"REG_d" \n\t" + "movl 4(%%"REG_d"), %%"REG_BP" \n\t" + "movl (%%"REG_d"), %%"REG_d" \n\t" #endif - "pxor %%mm0, %%mm0 \n\t" - - ASMALIGN(4) - ".Lli0: \n\t" - "movq (%%"REG_S"), %%mm1 \n\t" - "movq (%%"REG_S"), %%mm2 \n\t" - - "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" - "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" - "punpcklbw %%mm0, %%mm4 \n\t" - "punpcklbw %%mm0, %%mm6 \n\t" - "movq (%%"REG_a"), %%mm3 \n\t" - "movq (%%"REG_b"), %%mm5 \n\t" - "punpcklbw %%mm0, %%mm3 \n\t" - "punpcklbw %%mm0, %%mm5 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "psrlw $3, %%mm4 \n\t" - "psrlw $3, %%mm6 \n\t" - "packuswb %%mm4, %%mm4 \n\t" - "packuswb %%mm6, %%mm6 \n\t" - "punpcklbw %%mm6, %%mm4 \n\t" - "punpcklbw %%mm4, %%mm1 \n\t" - "punpckhbw %%mm4, %%mm2 \n\t" - - "movq %%mm1, (%%"REG_D") \n\t" - "movq %%mm2, 8(%%"REG_D") \n\t" - - "movq 8(%%"REG_S"), %%mm1 \n\t" - "movq 8(%%"REG_S"), %%mm2 \n\t" - - "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" - "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" - "punpckhbw %%mm0, %%mm4 \n\t" - "punpckhbw %%mm0, %%mm6 \n\t" - "movq (%%"REG_a"), %%mm3 \n\t" - "movq (%%"REG_b"), %%mm5 \n\t" - "punpckhbw %%mm0, %%mm3 \n\t" - "punpckhbw %%mm0, %%mm5 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "psrlw $3, %%mm4 \n\t" - "psrlw $3, %%mm6 \n\t" - "packuswb %%mm4, %%mm4 \n\t" - "packuswb %%mm6, %%mm6 \n\t" - "punpcklbw %%mm6, %%mm4 \n\t" - "punpcklbw %%mm4, %%mm1 \n\t" - "punpckhbw %%mm4, %%mm2 \n\t" - - "add $16, %%"REG_S" \n\t" - "add $8, %%"REG_a" \n\t" - "add $8, %%"REG_b" \n\t" - - "movq %%mm1, 16(%%"REG_D") \n\t" - "movq %%mm2, 24(%%"REG_D") \n\t" - "add $32, %%"REG_D" \n\t" - - "decl %%ecx \n\t" - "jnz .Lli0 \n\t" - "emms \n\t" - "pop %%"REG_BP" \n\t" - : - : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16), + "pxor %%mm0, %%mm0 \n\t" + + ASMALIGN(4) + ".Lli0: \n\t" + "movq (%%"REG_S"), %%mm1 \n\t" + "movq (%%"REG_S"), %%mm2 \n\t" + + "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" + "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" + "punpcklbw %%mm0, %%mm4 \n\t" + "punpcklbw %%mm0, %%mm6 \n\t" + "movq (%%"REG_a"), %%mm3 \n\t" + "movq (%%"REG_b"), %%mm5 \n\t" + "punpcklbw %%mm0, %%mm3 \n\t" + "punpcklbw %%mm0, %%mm5 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "psrlw $3, %%mm4 \n\t" + "psrlw $3, %%mm6 \n\t" + "packuswb %%mm4, %%mm4 \n\t" + "packuswb %%mm6, %%mm6 \n\t" + "punpcklbw %%mm6, %%mm4 \n\t" + "punpcklbw %%mm4, %%mm1 \n\t" + "punpckhbw %%mm4, %%mm2 \n\t" + + "movq %%mm1, (%%"REG_D") \n\t" + "movq %%mm2, 8(%%"REG_D") \n\t" + + "movq 8(%%"REG_S"), %%mm1 \n\t" + "movq 8(%%"REG_S"), %%mm2 \n\t" + + "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" + "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" + "punpckhbw %%mm0, %%mm4 \n\t" + "punpckhbw %%mm0, %%mm6 \n\t" + "movq (%%"REG_a"), %%mm3 \n\t" + "movq (%%"REG_b"), %%mm5 \n\t" + "punpckhbw %%mm0, %%mm3 \n\t" + "punpckhbw %%mm0, %%mm5 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "psrlw $3, %%mm4 \n\t" + "psrlw $3, %%mm6 \n\t" + "packuswb %%mm4, %%mm4 \n\t" + "packuswb %%mm6, %%mm6 \n\t" + "punpcklbw %%mm6, %%mm4 \n\t" + "punpcklbw %%mm4, %%mm1 \n\t" + "punpckhbw %%mm4, %%mm2 \n\t" + + "add $16, %%"REG_S" \n\t" + "add $8, %%"REG_a" \n\t" + "add $8, %%"REG_b" \n\t" + + "movq %%mm1, 16(%%"REG_D") \n\t" + "movq %%mm2, 24(%%"REG_D") \n\t" + "add $32, %%"REG_D" \n\t" + + "decl %%ecx \n\t" + "jnz .Lli0 \n\t" + "emms \n\t" + "pop %%"REG_BP" \n\t" + : + : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16), #if ARCH_X86_64 - "d" ((x86_reg)us), "r" ((x86_reg)vs) + "d" ((x86_reg)us), "r" ((x86_reg)vs) #else - "d" (&us) + "d" (&us) #endif - : "memory" - ); - pack_li_0_C(dst, y, u, v, (w&15), us, vs); + : "memory" + ); + pack_li_0_C(dst, y, u, v, (w&15), us, vs); } static void pack_li_1_MMX(unsigned char *dst, unsigned char *y, - unsigned char *u, unsigned char *v, int w, int us, int vs) + unsigned char *u, unsigned char *v, int w, int us, int vs) { - __asm__ volatile ("" - "push %%"REG_BP" \n\t" + __asm__ volatile ("" + "push %%"REG_BP" \n\t" #if ARCH_X86_64 - "mov %6, %%"REG_BP" \n\t" + "mov %6, %%"REG_BP" \n\t" #else - "movl 4(%%"REG_d"), %%"REG_BP" \n\t" - "movl (%%"REG_d"), %%"REG_d" \n\t" + "movl 4(%%"REG_d"), %%"REG_BP" \n\t" + "movl (%%"REG_d"), %%"REG_d" \n\t" #endif - "pxor %%mm0, %%mm0 \n\t" - - ASMALIGN(4) - ".Lli1: \n\t" - "movq (%%"REG_S"), %%mm1 \n\t" - "movq (%%"REG_S"), %%mm2 \n\t" - - "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" - "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" - "punpcklbw %%mm0, %%mm4 \n\t" - "punpcklbw %%mm0, %%mm6 \n\t" - "movq (%%"REG_a"), %%mm3 \n\t" - "movq (%%"REG_b"), %%mm5 \n\t" - "punpcklbw %%mm0, %%mm3 \n\t" - "punpcklbw %%mm0, %%mm5 \n\t" - "movq %%mm4, %%mm7 \n\t" - "paddw %%mm4, %%mm4 \n\t" - "paddw %%mm7, %%mm4 \n\t" - "movq %%mm6, %%mm7 \n\t" - "paddw %%mm6, %%mm6 \n\t" - "paddw %%mm7, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "psrlw $3, %%mm4 \n\t" - "psrlw $3, %%mm6 \n\t" - "packuswb %%mm4, %%mm4 \n\t" - "packuswb %%mm6, %%mm6 \n\t" - "punpcklbw %%mm6, %%mm4 \n\t" - "punpcklbw %%mm4, %%mm1 \n\t" - "punpckhbw %%mm4, %%mm2 \n\t" - - "movq %%mm1, (%%"REG_D") \n\t" - "movq %%mm2, 8(%%"REG_D") \n\t" - - "movq 8(%%"REG_S"), %%mm1 \n\t" - "movq 8(%%"REG_S"), %%mm2 \n\t" - - "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" - "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" - "punpckhbw %%mm0, %%mm4 \n\t" - "punpckhbw %%mm0, %%mm6 \n\t" - "movq (%%"REG_a"), %%mm3 \n\t" - "movq (%%"REG_b"), %%mm5 \n\t" - "punpckhbw %%mm0, %%mm3 \n\t" - "punpckhbw %%mm0, %%mm5 \n\t" - "movq %%mm4, %%mm7 \n\t" - "paddw %%mm4, %%mm4 \n\t" - "paddw %%mm7, %%mm4 \n\t" - "movq %%mm6, %%mm7 \n\t" - "paddw %%mm6, %%mm6 \n\t" - "paddw %%mm7, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "paddw %%mm3, %%mm4 \n\t" - "paddw %%mm5, %%mm6 \n\t" - "psrlw $3, %%mm4 \n\t" - "psrlw $3, %%mm6 \n\t" - "packuswb %%mm4, %%mm4 \n\t" - "packuswb %%mm6, %%mm6 \n\t" - "punpcklbw %%mm6, %%mm4 \n\t" - "punpcklbw %%mm4, %%mm1 \n\t" - "punpckhbw %%mm4, %%mm2 \n\t" - - "add $16, %%"REG_S" \n\t" - "add $8, %%"REG_a" \n\t" - "add $8, %%"REG_b" \n\t" - - "movq %%mm1, 16(%%"REG_D") \n\t" - "movq %%mm2, 24(%%"REG_D") \n\t" - "add $32, %%"REG_D" \n\t" - - "decl %%ecx \n\t" - "jnz .Lli1 \n\t" - "emms \n\t" - "pop %%"REG_BP" \n\t" - : - : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16), + "pxor %%mm0, %%mm0 \n\t" + + ASMALIGN(4) + ".Lli1: \n\t" + "movq (%%"REG_S"), %%mm1 \n\t" + "movq (%%"REG_S"), %%mm2 \n\t" + + "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" + "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" + "punpcklbw %%mm0, %%mm4 \n\t" + "punpcklbw %%mm0, %%mm6 \n\t" + "movq (%%"REG_a"), %%mm3 \n\t" + "movq (%%"REG_b"), %%mm5 \n\t" + "punpcklbw %%mm0, %%mm3 \n\t" + "punpcklbw %%mm0, %%mm5 \n\t" + "movq %%mm4, %%mm7 \n\t" + "paddw %%mm4, %%mm4 \n\t" + "paddw %%mm7, %%mm4 \n\t" + "movq %%mm6, %%mm7 \n\t" + "paddw %%mm6, %%mm6 \n\t" + "paddw %%mm7, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "psrlw $3, %%mm4 \n\t" + "psrlw $3, %%mm6 \n\t" + "packuswb %%mm4, %%mm4 \n\t" + "packuswb %%mm6, %%mm6 \n\t" + "punpcklbw %%mm6, %%mm4 \n\t" + "punpcklbw %%mm4, %%mm1 \n\t" + "punpckhbw %%mm4, %%mm2 \n\t" + + "movq %%mm1, (%%"REG_D") \n\t" + "movq %%mm2, 8(%%"REG_D") \n\t" + + "movq 8(%%"REG_S"), %%mm1 \n\t" + "movq 8(%%"REG_S"), %%mm2 \n\t" + + "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" + "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" + "punpckhbw %%mm0, %%mm4 \n\t" + "punpckhbw %%mm0, %%mm6 \n\t" + "movq (%%"REG_a"), %%mm3 \n\t" + "movq (%%"REG_b"), %%mm5 \n\t" + "punpckhbw %%mm0, %%mm3 \n\t" + "punpckhbw %%mm0, %%mm5 \n\t" + "movq %%mm4, %%mm7 \n\t" + "paddw %%mm4, %%mm4 \n\t" + "paddw %%mm7, %%mm4 \n\t" + "movq %%mm6, %%mm7 \n\t" + "paddw %%mm6, %%mm6 \n\t" + "paddw %%mm7, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "paddw %%mm3, %%mm4 \n\t" + "paddw %%mm5, %%mm6 \n\t" + "psrlw $3, %%mm4 \n\t" + "psrlw $3, %%mm6 \n\t" + "packuswb %%mm4, %%mm4 \n\t" + "packuswb %%mm6, %%mm6 \n\t" + "punpcklbw %%mm6, %%mm4 \n\t" + "punpcklbw %%mm4, %%mm1 \n\t" + "punpckhbw %%mm4, %%mm2 \n\t" + + "add $16, %%"REG_S" \n\t" + "add $8, %%"REG_a" \n\t" + "add $8, %%"REG_b" \n\t" + + "movq %%mm1, 16(%%"REG_D") \n\t" + "movq %%mm2, 24(%%"REG_D") \n\t" + "add $32, %%"REG_D" \n\t" + + "decl %%ecx \n\t" + "jnz .Lli1 \n\t" + "emms \n\t" + "pop %%"REG_BP" \n\t" + : + : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16), #if ARCH_X86_64 - "d" ((x86_reg)us), "r" ((x86_reg)vs) + "d" ((x86_reg)us), "r" ((x86_reg)vs) #else - "d" (&us) + "d" (&us) #endif - : "memory" - ); - pack_li_1_C(dst, y, u, v, (w&15), us, vs); + : "memory" + ); + pack_li_1_C(dst, y, u, v, (w&15), us, vs); } #endif /* HAVE_EBX_AVAILABLE */ #endif @@ -334,120 +334,120 @@ static pack_func_t *pack_li_0; static pack_func_t *pack_li_1; static void ilpack(unsigned char *dst, unsigned char *src[3], - int dststride, int srcstride[3], int w, int h, pack_func_t *pack[2]) + int dststride, int srcstride[3], int w, int h, pack_func_t *pack[2]) { - int i; - unsigned char *y, *u, *v; - int ys = srcstride[0], us = srcstride[1], vs = srcstride[2]; - int a, b; - - y = src[0]; - u = src[1]; - v = src[2]; - - pack_nn(dst, y, u, v, w, 0, 0); - y += ys; dst += dststride; - pack_nn(dst, y, u+us, v+vs, w, 0, 0); - y += ys; dst += dststride; - for (i=2; i>1); - pack[b](dst, y, u, v, w, us*a, vs*a); - y += ys; - if ((i&3) == 1) { - u -= us; - v -= vs; - } else { - u += us; - v += vs; - } - dst += dststride; - } - pack_nn(dst, y, u, v, w, 0, 0); - y += ys; dst += dststride; u += us; v += vs; - pack_nn(dst, y, u, v, w, 0, 0); + int i; + unsigned char *y, *u, *v; + int ys = srcstride[0], us = srcstride[1], vs = srcstride[2]; + int a, b; + + y = src[0]; + u = src[1]; + v = src[2]; + + pack_nn(dst, y, u, v, w, 0, 0); + y += ys; dst += dststride; + pack_nn(dst, y, u+us, v+vs, w, 0, 0); + y += ys; dst += dststride; + for (i=2; i>1); + pack[b](dst, y, u, v, w, us*a, vs*a); + y += ys; + if ((i&3) == 1) { + u -= us; + v -= vs; + } else { + u += us; + v += vs; + } + dst += dststride; + } + pack_nn(dst, y, u, v, w, 0, 0); + y += ys; dst += dststride; u += us; v += vs; + pack_nn(dst, y, u, v, w, 0, 0); } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { - mp_image_t *dmpi; + mp_image_t *dmpi; - // hope we'll get DR buffer: - dmpi=vf_get_image(vf->next, IMGFMT_YUY2, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->w, mpi->h); + // hope we'll get DR buffer: + dmpi=vf_get_image(vf->next, IMGFMT_YUY2, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->w, mpi->h); - ilpack(dmpi->planes[0], mpi->planes, dmpi->stride[0], mpi->stride, mpi->w, mpi->h, vf->priv->pack); + ilpack(dmpi->planes[0], mpi->planes, dmpi->stride[0], mpi->stride, mpi->w, mpi->h, vf->priv->pack); - return vf_next_put_image(vf,dmpi, pts); + return vf_next_put_image(vf,dmpi, pts); } static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt) { - /* FIXME - also support UYVY output? */ - return vf_next_config(vf, width, height, d_width, d_height, flags, IMGFMT_YUY2); + /* FIXME - also support UYVY output? */ + return vf_next_config(vf, width, height, d_width, d_height, flags, IMGFMT_YUY2); } static int query_format(struct vf_instance *vf, unsigned int fmt) { - /* FIXME - really any YUV 4:2:0 input format should work */ - switch (fmt) { - case IMGFMT_YV12: - case IMGFMT_IYUV: - case IMGFMT_I420: - return vf_next_query_format(vf,IMGFMT_YUY2); - } - return 0; + /* FIXME - really any YUV 4:2:0 input format should work */ + switch (fmt) { + case IMGFMT_YV12: + case IMGFMT_IYUV: + case IMGFMT_I420: + return vf_next_query_format(vf,IMGFMT_YUY2); + } + return 0; } static int vf_open(vf_instance_t *vf, char *args) { - vf->config=config; - vf->query_format=query_format; - vf->put_image=put_image; - vf->priv = calloc(1, sizeof(struct vf_priv_s)); - vf->priv->mode = 1; - if (args) sscanf(args, "%d", &vf->priv->mode); - - pack_nn = (pack_func_t *)pack_nn_C; - pack_li_0 = pack_li_0_C; - pack_li_1 = pack_li_1_C; + vf->config=config; + vf->query_format=query_format; + vf->put_image=put_image; + vf->priv = calloc(1, sizeof(struct vf_priv_s)); + vf->priv->mode = 1; + if (args) sscanf(args, "%d", &vf->priv->mode); + + pack_nn = (pack_func_t *)pack_nn_C; + pack_li_0 = pack_li_0_C; + pack_li_1 = pack_li_1_C; #if HAVE_MMX - if(gCpuCaps.hasMMX) { - pack_nn = (pack_func_t *)pack_nn_MMX; + if(gCpuCaps.hasMMX) { + pack_nn = (pack_func_t *)pack_nn_MMX; #if HAVE_EBX_AVAILABLE - pack_li_0 = pack_li_0_MMX; - pack_li_1 = pack_li_1_MMX; + pack_li_0 = pack_li_0_MMX; + pack_li_1 = pack_li_1_MMX; #endif - } + } #endif - switch(vf->priv->mode) { - case 0: - vf->priv->pack[0] = vf->priv->pack[1] = pack_nn; - break; - default: - mp_msg(MSGT_VFILTER, MSGL_WARN, - "ilpack: unknown mode %d (fallback to linear)\n", - vf->priv->mode); - case 1: - vf->priv->pack[0] = pack_li_0; - vf->priv->pack[1] = pack_li_1; - break; - } - - return 1; + switch(vf->priv->mode) { + case 0: + vf->priv->pack[0] = vf->priv->pack[1] = pack_nn; + break; + default: + mp_msg(MSGT_VFILTER, MSGL_WARN, + "ilpack: unknown mode %d (fallback to linear)\n", + vf->priv->mode); + case 1: + vf->priv->pack[0] = pack_li_0; + vf->priv->pack[1] = pack_li_1; + break; + } + + return 1; } const vf_info_t vf_info_ilpack = { - "4:2:0 planar -> 4:2:2 packed reinterlacer", - "ilpack", - "Richard Felker", - "", - vf_open, - NULL + "4:2:0 planar -> 4:2:2 packed reinterlacer", + "ilpack", + "Richard Felker", + "", + vf_open, + NULL }; diff --git a/mplayer/libmpcodecs/vf_ivtc.c b/mplayer/libmpcodecs/vf_ivtc.c index 05429640..b4678f76 100644 --- a/mplayer/libmpcodecs/vf_ivtc.c +++ b/mplayer/libmpcodecs/vf_ivtc.c @@ -32,211 +32,211 @@ struct metrics { - /* difference: total, even lines, odd lines */ - int d, e, o; - /* noise: temporal, spacial (current), spacial (past) */ - int t, s, p; + /* difference: total, even lines, odd lines */ + int d, e, o; + /* noise: temporal, spacial (current), spacial (past) */ + int t, s, p; }; struct frameinfo { - /* peak, relative, mean */ - struct metrics p, r, m; + /* peak, relative, mean */ + struct metrics p, r, m; }; struct vf_priv_s { - struct frameinfo fi[2]; - mp_image_t *dmpi; - int first; - int drop, lastdrop, dropnext; - int inframes, outframes; + struct frameinfo fi[2]; + mp_image_t *dmpi; + int first; + int drop, lastdrop, dropnext; + int inframes, outframes; }; enum { - F_DROP, - F_MERGE, - F_NEXT, - F_SHOW + F_DROP, + F_MERGE, + F_NEXT, + F_SHOW }; #if HAVE_MMX && HAVE_EBX_AVAILABLE static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char *new, int os, int ns) { - int i; - short out[24]; // output buffer for the partial metrics from the mmx code - - __asm__ ( - "movl $4, %%ecx \n\t" - "pxor %%mm4, %%mm4 \n\t" // 4 even difference sums - "pxor %%mm5, %%mm5 \n\t" // 4 odd difference sums - "pxor %%mm7, %%mm7 \n\t" // all zeros - - ASMALIGN(4) - "1: \n\t" - - // Even difference - "movq (%%"REG_S"), %%mm0 \n\t" - "movq (%%"REG_S"), %%mm2 \n\t" - "add %%"REG_a", %%"REG_S" \n\t" - "movq (%%"REG_D"), %%mm1 \n\t" - "add %%"REG_b", %%"REG_D" \n\t" - "psubusb %%mm1, %%mm2 \n\t" - "psubusb %%mm0, %%mm1 \n\t" - "movq %%mm2, %%mm0 \n\t" - "movq %%mm1, %%mm3 \n\t" - "punpcklbw %%mm7, %%mm0 \n\t" - "punpcklbw %%mm7, %%mm1 \n\t" - "punpckhbw %%mm7, %%mm2 \n\t" - "punpckhbw %%mm7, %%mm3 \n\t" - "paddw %%mm0, %%mm4 \n\t" - "paddw %%mm1, %%mm4 \n\t" - "paddw %%mm2, %%mm4 \n\t" - "paddw %%mm3, %%mm4 \n\t" - - // Odd difference - "movq (%%"REG_S"), %%mm0 \n\t" - "movq (%%"REG_S"), %%mm2 \n\t" - "add %%"REG_a", %%"REG_S" \n\t" - "movq (%%"REG_D"), %%mm1 \n\t" - "add %%"REG_b", %%"REG_D" \n\t" - "psubusb %%mm1, %%mm2 \n\t" - "psubusb %%mm0, %%mm1 \n\t" - "movq %%mm2, %%mm0 \n\t" - "movq %%mm1, %%mm3 \n\t" - "punpcklbw %%mm7, %%mm0 \n\t" - "punpcklbw %%mm7, %%mm1 \n\t" - "punpckhbw %%mm7, %%mm2 \n\t" - "punpckhbw %%mm7, %%mm3 \n\t" - "paddw %%mm0, %%mm5 \n\t" - "paddw %%mm1, %%mm5 \n\t" - "paddw %%mm2, %%mm5 \n\t" - "paddw %%mm3, %%mm5 \n\t" - - "decl %%ecx \n\t" - "jnz 1b \n\t" - "movq %%mm4, (%%"REG_d") \n\t" - "movq %%mm5, 8(%%"REG_d") \n\t" - : - : "S" (old), "D" (new), "a" (os), "b" (ns), "d" (out) - : "memory" - ); - m->e = out[0]+out[1]+out[2]+out[3]; - m->o = out[4]+out[5]+out[6]+out[7]; - m->d = m->e + m->o; - - __asm__ ( - // First loop to measure first four columns - "movl $4, %%ecx \n\t" - "pxor %%mm4, %%mm4 \n\t" // Past spacial noise - "pxor %%mm5, %%mm5 \n\t" // Temporal noise - "pxor %%mm6, %%mm6 \n\t" // Current spacial noise - - ASMALIGN(4) - "2: \n\t" - - "movq (%%"REG_S"), %%mm0 \n\t" - "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t" - "add %%"REG_a", %%"REG_S" \n\t" - "add %%"REG_a", %%"REG_S" \n\t" - "movq (%%"REG_D"), %%mm2 \n\t" - "movq (%%"REG_D",%%"REG_b"), %%mm3 \n\t" - "add %%"REG_b", %%"REG_D" \n\t" - "add %%"REG_b", %%"REG_D" \n\t" - "punpcklbw %%mm7, %%mm0 \n\t" - "punpcklbw %%mm7, %%mm1 \n\t" - "punpcklbw %%mm7, %%mm2 \n\t" - "punpcklbw %%mm7, %%mm3 \n\t" - "paddw %%mm1, %%mm4 \n\t" - "paddw %%mm1, %%mm5 \n\t" - "paddw %%mm3, %%mm6 \n\t" - "psubw %%mm0, %%mm4 \n\t" - "psubw %%mm2, %%mm5 \n\t" - "psubw %%mm2, %%mm6 \n\t" - - "decl %%ecx \n\t" - "jnz 2b \n\t" - - "movq %%mm0, %%mm1 \n\t" - "movq %%mm0, %%mm2 \n\t" - "movq %%mm0, %%mm3 \n\t" - "pcmpgtw %%mm4, %%mm1 \n\t" - "pcmpgtw %%mm5, %%mm2 \n\t" - "pcmpgtw %%mm6, %%mm3 \n\t" - "pxor %%mm1, %%mm4 \n\t" - "pxor %%mm2, %%mm5 \n\t" - "pxor %%mm3, %%mm6 \n\t" - "psubw %%mm1, %%mm4 \n\t" - "psubw %%mm2, %%mm5 \n\t" - "psubw %%mm3, %%mm6 \n\t" - "movq %%mm4, (%%"REG_d") \n\t" - "movq %%mm5, 16(%%"REG_d") \n\t" - "movq %%mm6, 32(%%"REG_d") \n\t" - - "mov %%"REG_a", %%"REG_c" \n\t" - "shl $3, %%"REG_c" \n\t" - "sub %%"REG_c", %%"REG_S" \n\t" - "mov %%"REG_b", %%"REG_c" \n\t" - "shl $3, %%"REG_c" \n\t" - "sub %%"REG_c", %%"REG_D" \n\t" - - // Second loop for the last four columns - "movl $4, %%ecx \n\t" - "pxor %%mm4, %%mm4 \n\t" - "pxor %%mm5, %%mm5 \n\t" - "pxor %%mm6, %%mm6 \n\t" - - ASMALIGN(4) - "3: \n\t" - - "movq (%%"REG_S"), %%mm0 \n\t" - "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t" - "add %%"REG_a", %%"REG_S" \n\t" - "add %%"REG_a", %%"REG_S" \n\t" - "movq (%%"REG_D"), %%mm2 \n\t" - "movq (%%"REG_D",%%"REG_b"), %%mm3 \n\t" - "add %%"REG_b", %%"REG_D" \n\t" - "add %%"REG_b", %%"REG_D" \n\t" - "punpckhbw %%mm7, %%mm0 \n\t" - "punpckhbw %%mm7, %%mm1 \n\t" - "punpckhbw %%mm7, %%mm2 \n\t" - "punpckhbw %%mm7, %%mm3 \n\t" - "paddw %%mm1, %%mm4 \n\t" - "paddw %%mm1, %%mm5 \n\t" - "paddw %%mm3, %%mm6 \n\t" - "psubw %%mm0, %%mm4 \n\t" - "psubw %%mm2, %%mm5 \n\t" - "psubw %%mm2, %%mm6 \n\t" - - "decl %%ecx \n\t" - "jnz 3b \n\t" - - "movq %%mm0, %%mm1 \n\t" - "movq %%mm0, %%mm2 \n\t" - "movq %%mm0, %%mm3 \n\t" - "pcmpgtw %%mm4, %%mm1 \n\t" - "pcmpgtw %%mm5, %%mm2 \n\t" - "pcmpgtw %%mm6, %%mm3 \n\t" - "pxor %%mm1, %%mm4 \n\t" - "pxor %%mm2, %%mm5 \n\t" - "pxor %%mm3, %%mm6 \n\t" - "psubw %%mm1, %%mm4 \n\t" - "psubw %%mm2, %%mm5 \n\t" - "psubw %%mm3, %%mm6 \n\t" - "movq %%mm4, 8(%%"REG_d") \n\t" - "movq %%mm5, 24(%%"REG_d") \n\t" - "movq %%mm6, 40(%%"REG_d") \n\t" - - "emms \n\t" - : - : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out) - : "memory" - ); - m->p = m->t = m->s = 0; - for (i=0; i<8; i++) { - m->p += out[i]; - m->t += out[8+i]; - m->s += out[16+i]; - } - //printf("e=%d o=%d d=%d p=%d t=%d s=%d\n", m->e, m->o, m->d, m->p, m->t, m->s); + int i; + short out[24]; // output buffer for the partial metrics from the mmx code + + __asm__ ( + "movl $4, %%ecx \n\t" + "pxor %%mm4, %%mm4 \n\t" // 4 even difference sums + "pxor %%mm5, %%mm5 \n\t" // 4 odd difference sums + "pxor %%mm7, %%mm7 \n\t" // all zeros + + ASMALIGN(4) + "1: \n\t" + + // Even difference + "movq (%%"REG_S"), %%mm0 \n\t" + "movq (%%"REG_S"), %%mm2 \n\t" + "add %%"REG_a", %%"REG_S" \n\t" + "movq (%%"REG_D"), %%mm1 \n\t" + "add %%"REG_b", %%"REG_D" \n\t" + "psubusb %%mm1, %%mm2 \n\t" + "psubusb %%mm0, %%mm1 \n\t" + "movq %%mm2, %%mm0 \n\t" + "movq %%mm1, %%mm3 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "punpckhbw %%mm7, %%mm3 \n\t" + "paddw %%mm0, %%mm4 \n\t" + "paddw %%mm1, %%mm4 \n\t" + "paddw %%mm2, %%mm4 \n\t" + "paddw %%mm3, %%mm4 \n\t" + + // Odd difference + "movq (%%"REG_S"), %%mm0 \n\t" + "movq (%%"REG_S"), %%mm2 \n\t" + "add %%"REG_a", %%"REG_S" \n\t" + "movq (%%"REG_D"), %%mm1 \n\t" + "add %%"REG_b", %%"REG_D" \n\t" + "psubusb %%mm1, %%mm2 \n\t" + "psubusb %%mm0, %%mm1 \n\t" + "movq %%mm2, %%mm0 \n\t" + "movq %%mm1, %%mm3 \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "punpckhbw %%mm7, %%mm3 \n\t" + "paddw %%mm0, %%mm5 \n\t" + "paddw %%mm1, %%mm5 \n\t" + "paddw %%mm2, %%mm5 \n\t" + "paddw %%mm3, %%mm5 \n\t" + + "decl %%ecx \n\t" + "jnz 1b \n\t" + "movq %%mm4, (%%"REG_d") \n\t" + "movq %%mm5, 8(%%"REG_d") \n\t" + : + : "S" (old), "D" (new), "a" (os), "b" (ns), "d" (out) + : "memory" + ); + m->e = out[0]+out[1]+out[2]+out[3]; + m->o = out[4]+out[5]+out[6]+out[7]; + m->d = m->e + m->o; + + __asm__ ( + // First loop to measure first four columns + "movl $4, %%ecx \n\t" + "pxor %%mm4, %%mm4 \n\t" // Past spacial noise + "pxor %%mm5, %%mm5 \n\t" // Temporal noise + "pxor %%mm6, %%mm6 \n\t" // Current spacial noise + + ASMALIGN(4) + "2: \n\t" + + "movq (%%"REG_S"), %%mm0 \n\t" + "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t" + "add %%"REG_a", %%"REG_S" \n\t" + "add %%"REG_a", %%"REG_S" \n\t" + "movq (%%"REG_D"), %%mm2 \n\t" + "movq (%%"REG_D",%%"REG_b"), %%mm3 \n\t" + "add %%"REG_b", %%"REG_D" \n\t" + "add %%"REG_b", %%"REG_D" \n\t" + "punpcklbw %%mm7, %%mm0 \n\t" + "punpcklbw %%mm7, %%mm1 \n\t" + "punpcklbw %%mm7, %%mm2 \n\t" + "punpcklbw %%mm7, %%mm3 \n\t" + "paddw %%mm1, %%mm4 \n\t" + "paddw %%mm1, %%mm5 \n\t" + "paddw %%mm3, %%mm6 \n\t" + "psubw %%mm0, %%mm4 \n\t" + "psubw %%mm2, %%mm5 \n\t" + "psubw %%mm2, %%mm6 \n\t" + + "decl %%ecx \n\t" + "jnz 2b \n\t" + + "movq %%mm0, %%mm1 \n\t" + "movq %%mm0, %%mm2 \n\t" + "movq %%mm0, %%mm3 \n\t" + "pcmpgtw %%mm4, %%mm1 \n\t" + "pcmpgtw %%mm5, %%mm2 \n\t" + "pcmpgtw %%mm6, %%mm3 \n\t" + "pxor %%mm1, %%mm4 \n\t" + "pxor %%mm2, %%mm5 \n\t" + "pxor %%mm3, %%mm6 \n\t" + "psubw %%mm1, %%mm4 \n\t" + "psubw %%mm2, %%mm5 \n\t" + "psubw %%mm3, %%mm6 \n\t" + "movq %%mm4, (%%"REG_d") \n\t" + "movq %%mm5, 16(%%"REG_d") \n\t" + "movq %%mm6, 32(%%"REG_d") \n\t" + + "mov %%"REG_a", %%"REG_c" \n\t" + "shl $3, %%"REG_c" \n\t" + "sub %%"REG_c", %%"REG_S" \n\t" + "mov %%"REG_b", %%"REG_c" \n\t" + "shl $3, %%"REG_c" \n\t" + "sub %%"REG_c", %%"REG_D" \n\t" + + // Second loop for the last four columns + "movl $4, %%ecx \n\t" + "pxor %%mm4, %%mm4 \n\t" + "pxor %%mm5, %%mm5 \n\t" + "pxor %%mm6, %%mm6 \n\t" + + ASMALIGN(4) + "3: \n\t" + + "movq (%%"REG_S"), %%mm0 \n\t" + "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t" + "add %%"REG_a", %%"REG_S" \n\t" + "add %%"REG_a", %%"REG_S" \n\t" + "movq (%%"REG_D"), %%mm2 \n\t" + "movq (%%"REG_D",%%"REG_b"), %%mm3 \n\t" + "add %%"REG_b", %%"REG_D" \n\t" + "add %%"REG_b", %%"REG_D" \n\t" + "punpckhbw %%mm7, %%mm0 \n\t" + "punpckhbw %%mm7, %%mm1 \n\t" + "punpckhbw %%mm7, %%mm2 \n\t" + "punpckhbw %%mm7, %%mm3 \n\t" + "paddw %%mm1, %%mm4 \n\t" + "paddw %%mm1, %%mm5 \n\t" + "paddw %%mm3, %%mm6 \n\t" + "psubw %%mm0, %%mm4 \n\t" + "psubw %%mm2, %%mm5 \n\t" + "psubw %%mm2, %%mm6 \n\t" + + "decl %%ecx \n\t" + "jnz 3b \n\t" + + "movq %%mm0, %%mm1 \n\t" + "movq %%mm0, %%mm2 \n\t" + "movq %%mm0, %%mm3 \n\t" + "pcmpgtw %%mm4, %%mm1 \n\t" + "pcmpgtw %%mm5, %%mm2 \n\t" + "pcmpgtw %%mm6, %%mm3 \n\t" + "pxor %%mm1, %%mm4 \n\t" + "pxor %%mm2, %%mm5 \n\t" + "pxor %%mm3, %%mm6 \n\t" + "psubw %%mm1, %%mm4 \n\t" + "psubw %%mm2, %%mm5 \n\t" + "psubw %%mm3, %%mm6 \n\t" + "movq %%mm4, 8(%%"REG_d") \n\t" + "movq %%mm5, 24(%%"REG_d") \n\t" + "movq %%mm6, 40(%%"REG_d") \n\t" + + "emms \n\t" + : + : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out) + : "memory" + ); + m->p = m->t = m->s = 0; + for (i=0; i<8; i++) { + m->p += out[i]; + m->t += out[8+i]; + m->s += out[16+i]; + } + //printf("e=%d o=%d d=%d p=%d t=%d s=%d\n", m->e, m->o, m->d, m->p, m->t, m->s); } #endif @@ -251,29 +251,29 @@ static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char static void block_diffs_C(struct metrics *m, unsigned char *old, unsigned char *new, int os, int ns) { - int x, y, e=0, o=0, s=0, p=0, t=0; - unsigned char *oldp, *newp; - m->s = m->p = m->t = 0; - for (x = 8; x; x--) { - oldp = old++; - newp = new++; - s = p = t = 0; - for (y = 4; y; y--) { - e += MAG(newp[0]-oldp[0]); - o += MAG(newp[ns]-oldp[os]); - s += newp[ns]-newp[0]; - p += oldp[os]-oldp[0]; - t += oldp[os]-newp[0]; - oldp += os<<1; - newp += ns<<1; - } - m->s += MAG(s); - m->p += MAG(p); - m->t += MAG(t); - } - m->e = e; - m->o = o; - m->d = e+o; + int x, y, e=0, o=0, s=0, p=0, t=0; + unsigned char *oldp, *newp; + m->s = m->p = m->t = 0; + for (x = 8; x; x--) { + oldp = old++; + newp = new++; + s = p = t = 0; + for (y = 4; y; y--) { + e += MAG(newp[0]-oldp[0]); + o += MAG(newp[ns]-oldp[os]); + s += newp[ns]-newp[0]; + p += oldp[os]-oldp[0]; + t += oldp[os]-newp[0]; + oldp += os<<1; + newp += ns<<1; + } + m->s += MAG(s); + m->p += MAG(p); + m->t += MAG(t); + } + m->e = e; + m->o = o; + m->d = e+o; } static void (*block_diffs)(struct metrics *, unsigned char *, unsigned char *, int, int); @@ -281,263 +281,263 @@ static void (*block_diffs)(struct metrics *, unsigned char *, unsigned char *, i #define MAXUP(a,b) ((a) = ((a)>(b)) ? (a) : (b)) static void diff_planes(struct frameinfo *fi, - unsigned char *old, unsigned char *new, int w, int h, int os, int ns) + unsigned char *old, unsigned char *new, int w, int h, int os, int ns) { - int x, y; - struct metrics l; - struct metrics *peak=&fi->p, *rel=&fi->r, *mean=&fi->m; - memset(peak, 0, sizeof(struct metrics)); - memset(rel, 0, sizeof(struct metrics)); - memset(mean, 0, sizeof(struct metrics)); - for (y = 0; y < h-7; y += 8) { - for (x = 8; x < w-8-7; x += 8) { - block_diffs(&l, old+x+y*os, new+x+y*ns, os, ns); - mean->d += l.d; - mean->e += l.e; - mean->o += l.o; - mean->s += l.s; - mean->p += l.p; - mean->t += l.t; - MAXUP(peak->d, l.d); - MAXUP(peak->e, l.e); - MAXUP(peak->o, l.o); - MAXUP(peak->s, l.s); - MAXUP(peak->p, l.p); - MAXUP(peak->t, l.t); - MAXUP(rel->e, l.e-l.o); - MAXUP(rel->o, l.o-l.e); - MAXUP(rel->s, l.s-l.t); - MAXUP(rel->p, l.p-l.t); - MAXUP(rel->t, l.t-l.p); - MAXUP(rel->d, l.t-l.s); /* hack */ - } - } - x = (w/8-2)*(h/8); - mean->d /= x; - mean->e /= x; - mean->o /= x; - mean->s /= x; - mean->p /= x; - mean->t /= x; + int x, y; + struct metrics l; + struct metrics *peak=&fi->p, *rel=&fi->r, *mean=&fi->m; + memset(peak, 0, sizeof(struct metrics)); + memset(rel, 0, sizeof(struct metrics)); + memset(mean, 0, sizeof(struct metrics)); + for (y = 0; y < h-7; y += 8) { + for (x = 8; x < w-8-7; x += 8) { + block_diffs(&l, old+x+y*os, new+x+y*ns, os, ns); + mean->d += l.d; + mean->e += l.e; + mean->o += l.o; + mean->s += l.s; + mean->p += l.p; + mean->t += l.t; + MAXUP(peak->d, l.d); + MAXUP(peak->e, l.e); + MAXUP(peak->o, l.o); + MAXUP(peak->s, l.s); + MAXUP(peak->p, l.p); + MAXUP(peak->t, l.t); + MAXUP(rel->e, l.e-l.o); + MAXUP(rel->o, l.o-l.e); + MAXUP(rel->s, l.s-l.t); + MAXUP(rel->p, l.p-l.t); + MAXUP(rel->t, l.t-l.p); + MAXUP(rel->d, l.t-l.s); /* hack */ + } + } + x = (w/8-2)*(h/8); + mean->d /= x; + mean->e /= x; + mean->o /= x; + mean->s /= x; + mean->p /= x; + mean->t /= x; } static void diff_fields(struct frameinfo *fi, mp_image_t *old, mp_image_t *new) { - diff_planes(fi, old->planes[0], new->planes[0], - new->w, new->h, old->stride[0], new->stride[0]); + diff_planes(fi, old->planes[0], new->planes[0], + new->w, new->h, old->stride[0], new->stride[0]); } static void stats(struct frameinfo *f) { - mp_msg(MSGT_VFILTER, MSGL_V, " pd=%d re=%d ro=%d rp=%d rt=%d rs=%d rd=%d pp=%d pt=%d ps=%d\r", - f->p.d, f->r.e, f->r.o, f->r.p, f->r.t, f->r.s, f->r.d, f->p.p, f->p.t, f->p.s); + mp_msg(MSGT_VFILTER, MSGL_V, " pd=%d re=%d ro=%d rp=%d rt=%d rs=%d rd=%d pp=%d pt=%d ps=%d\r", + f->p.d, f->r.e, f->r.o, f->r.p, f->r.t, f->r.s, f->r.d, f->p.p, f->p.t, f->p.s); } static int foo(struct vf_priv_s *p, mp_image_t *new, mp_image_t *cur) { - struct frameinfo *f = p->fi; - - f[0] = f[1]; - diff_fields(&f[1], cur, new); - stats(&f[1]); - - // Immediately drop this frame if it's already been used. - if (p->dropnext) { - p->dropnext = 0; - return F_DROP; - } - - // Sometimes a pulldown frame comes all by itself, so both - // its top and bottom field are duplicates from the adjacent - // two frames. We can just drop such a frame, but we - // immediately show the next frame instead to keep the frame - // drops evenly spaced during normal 3:2 pulldown sequences. - if ((3*f[1].r.o < f[1].r.e) && (f[1].r.s < f[1].r.d)) { - p->dropnext = 1; - return F_NEXT; - } - - // If none of these conditions hold, we will consider the frame - // progressive and just show it as-is. - if (!( (3*f[0].r.e < f[0].r.o) || - ((2*f[0].r.d < f[0].r.s) && (f[0].r.s > 1200)) || - ((2*f[1].r.t < f[1].r.p) && (f[1].r.p > 1200)) )) - return F_SHOW; - - // Otherwise, we have to decide whether to merge or drop. - // If the noise metric only increases minimally, we're off - // to a good start... - if (((2*f[1].r.t < 3*f[1].r.p) && (f[1].r.t < 3600)) || - (f[1].r.t < 900) || (f[1].r.d < 900)) { - // ...and if noise decreases or the duplicate even field - // is detected, we go ahead with the merge. - if ((3*f[0].r.e < f[0].r.o) || (2*f[1].r.t < f[1].r.p)) { - p->dropnext = 1; - return F_MERGE; - } - } - return F_DROP; + struct frameinfo *f = p->fi; + + f[0] = f[1]; + diff_fields(&f[1], cur, new); + stats(&f[1]); + + // Immediately drop this frame if it's already been used. + if (p->dropnext) { + p->dropnext = 0; + return F_DROP; + } + + // Sometimes a pulldown frame comes all by itself, so both + // its top and bottom field are duplicates from the adjacent + // two frames. We can just drop such a frame, but we + // immediately show the next frame instead to keep the frame + // drops evenly spaced during normal 3:2 pulldown sequences. + if ((3*f[1].r.o < f[1].r.e) && (f[1].r.s < f[1].r.d)) { + p->dropnext = 1; + return F_NEXT; + } + + // If none of these conditions hold, we will consider the frame + // progressive and just show it as-is. + if (!( (3*f[0].r.e < f[0].r.o) || + ((2*f[0].r.d < f[0].r.s) && (f[0].r.s > 1200)) || + ((2*f[1].r.t < f[1].r.p) && (f[1].r.p > 1200)) )) + return F_SHOW; + + // Otherwise, we have to decide whether to merge or drop. + // If the noise metric only increases minimally, we're off + // to a good start... + if (((2*f[1].r.t < 3*f[1].r.p) && (f[1].r.t < 3600)) || + (f[1].r.t < 900) || (f[1].r.d < 900)) { + // ...and if noise decreases or the duplicate even field + // is detected, we go ahead with the merge. + if ((3*f[0].r.e < f[0].r.o) || (2*f[1].r.t < f[1].r.p)) { + p->dropnext = 1; + return F_MERGE; + } + } + return F_DROP; } static void copy_image(mp_image_t *dmpi, mp_image_t *mpi, int field) { - switch (field) { - case 0: - my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1], mpi->planes[1], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[1]*2, mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2], mpi->planes[2], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[2]*2, mpi->stride[2]*2); - } - break; - case 1: - my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], - mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], - mpi->planes[1]+mpi->stride[1], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[1]*2, mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], - mpi->planes[2]+mpi->stride[2], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[2]*2, mpi->stride[2]*2); - } - break; - case 2: - memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0], mpi->stride[0]); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - memcpy_pic(dmpi->planes[1], mpi->planes[1], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[1], mpi->stride[1]); - memcpy_pic(dmpi->planes[2], mpi->planes[2], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[2], mpi->stride[2]); - } - break; - } + switch (field) { + case 0: + my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2, + dmpi->stride[0]*2, mpi->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(dmpi->planes[1], mpi->planes[1], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[1]*2, mpi->stride[1]*2); + my_memcpy_pic(dmpi->planes[2], mpi->planes[2], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[2]*2, mpi->stride[2]*2); + } + break; + case 1: + my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], + mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2, + dmpi->stride[0]*2, mpi->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], + mpi->planes[1]+mpi->stride[1], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[1]*2, mpi->stride[1]*2); + my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], + mpi->planes[2]+mpi->stride[2], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[2]*2, mpi->stride[2]*2); + } + break; + case 2: + memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, + dmpi->stride[0], mpi->stride[0]); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + memcpy_pic(dmpi->planes[1], mpi->planes[1], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[1], mpi->stride[1]); + memcpy_pic(dmpi->planes[2], mpi->planes[2], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[2], mpi->stride[2]); + } + break; + } } static int do_put_image(struct vf_instance *vf, mp_image_t *dmpi) { - struct vf_priv_s *p = vf->priv; - int dropflag=0; - - if (!p->dropnext) switch (p->drop) { - case 0: - dropflag = 0; - break; - case 1: - dropflag = (++p->lastdrop >= 5); - break; - case 2: - dropflag = (++p->lastdrop >= 5) && (4*p->inframes <= 5*p->outframes); - break; - } - - if (dropflag) { - //mp_msg(MSGT_VFILTER, MSGL_V, "drop! [%d/%d=%g]\n", - // p->outframes, p->inframes, (float)p->outframes/p->inframes); - mp_msg(MSGT_VFILTER, MSGL_V, "!"); - p->lastdrop = 0; - return 0; - } - - p->outframes++; - return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); + struct vf_priv_s *p = vf->priv; + int dropflag=0; + + if (!p->dropnext) switch (p->drop) { + case 0: + dropflag = 0; + break; + case 1: + dropflag = (++p->lastdrop >= 5); + break; + case 2: + dropflag = (++p->lastdrop >= 5) && (4*p->inframes <= 5*p->outframes); + break; + } + + if (dropflag) { + //mp_msg(MSGT_VFILTER, MSGL_V, "drop! [%d/%d=%g]\n", + // p->outframes, p->inframes, (float)p->outframes/p->inframes); + mp_msg(MSGT_VFILTER, MSGL_V, "!"); + p->lastdrop = 0; + return 0; + } + + p->outframes++; + return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { - int ret=0; - struct vf_priv_s *p = vf->priv; - - p->inframes++; - - if (p->first) { /* hack */ - p->first = 0; - return 1; - } - - if (!p->dmpi) p->dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | - MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, - mpi->width, mpi->height); - /* FIXME -- not correct, off by one frame! */ - p->dmpi->qscale = mpi->qscale; - p->dmpi->qstride = mpi->qstride; - p->dmpi->qscale_type = mpi->qscale_type; - - switch (foo(p, mpi, p->dmpi)) { - case F_DROP: - copy_image(p->dmpi, mpi, 2); - ret = 0; - p->lastdrop = 0; - mp_msg(MSGT_VFILTER, MSGL_V, "DROP\n"); - break; - case F_MERGE: - copy_image(p->dmpi, mpi, 0); - ret = do_put_image(vf, p->dmpi); - copy_image(p->dmpi, mpi, 1); - mp_msg(MSGT_VFILTER, MSGL_V, "MERGE\n"); - p->dmpi = NULL; - break; - case F_NEXT: - copy_image(p->dmpi, mpi, 2); - ret = do_put_image(vf, p->dmpi); - mp_msg(MSGT_VFILTER, MSGL_V, "NEXT\n"); - p->dmpi = NULL; - break; - case F_SHOW: - ret = do_put_image(vf, p->dmpi); - copy_image(p->dmpi, mpi, 2); - mp_msg(MSGT_VFILTER, MSGL_V, "OK\n"); - p->dmpi = NULL; - break; - } - return ret; + int ret=0; + struct vf_priv_s *p = vf->priv; + + p->inframes++; + + if (p->first) { /* hack */ + p->first = 0; + return 1; + } + + if (!p->dmpi) p->dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | + MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, + mpi->width, mpi->height); + /* FIXME -- not correct, off by one frame! */ + p->dmpi->qscale = mpi->qscale; + p->dmpi->qstride = mpi->qstride; + p->dmpi->qscale_type = mpi->qscale_type; + + switch (foo(p, mpi, p->dmpi)) { + case F_DROP: + copy_image(p->dmpi, mpi, 2); + ret = 0; + p->lastdrop = 0; + mp_msg(MSGT_VFILTER, MSGL_V, "DROP\n"); + break; + case F_MERGE: + copy_image(p->dmpi, mpi, 0); + ret = do_put_image(vf, p->dmpi); + copy_image(p->dmpi, mpi, 1); + mp_msg(MSGT_VFILTER, MSGL_V, "MERGE\n"); + p->dmpi = NULL; + break; + case F_NEXT: + copy_image(p->dmpi, mpi, 2); + ret = do_put_image(vf, p->dmpi); + mp_msg(MSGT_VFILTER, MSGL_V, "NEXT\n"); + p->dmpi = NULL; + break; + case F_SHOW: + ret = do_put_image(vf, p->dmpi); + copy_image(p->dmpi, mpi, 2); + mp_msg(MSGT_VFILTER, MSGL_V, "OK\n"); + p->dmpi = NULL; + break; + } + return ret; } static int query_format(struct vf_instance *vf, unsigned int fmt) { - switch (fmt) { - case IMGFMT_YV12: - case IMGFMT_IYUV: - case IMGFMT_I420: - return vf_next_query_format(vf, fmt); - } - return 0; + switch (fmt) { + case IMGFMT_YV12: + case IMGFMT_IYUV: + case IMGFMT_I420: + return vf_next_query_format(vf, fmt); + } + return 0; } static void uninit(struct vf_instance *vf) { - free(vf->priv); + free(vf->priv); } static int vf_open(vf_instance_t *vf, char *args) { - struct vf_priv_s *p; - vf->put_image = put_image; - vf->query_format = query_format; - vf->uninit = uninit; - vf->default_reqs = VFCAP_ACCEPT_STRIDE; - vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); - p->drop = 0; - p->first = 1; - if (args) sscanf(args, "%d", &p->drop); - block_diffs = block_diffs_C; + struct vf_priv_s *p; + vf->put_image = put_image; + vf->query_format = query_format; + vf->uninit = uninit; + vf->default_reqs = VFCAP_ACCEPT_STRIDE; + vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); + p->drop = 0; + p->first = 1; + if (args) sscanf(args, "%d", &p->drop); + block_diffs = block_diffs_C; #if HAVE_MMX && HAVE_EBX_AVAILABLE - if(gCpuCaps.hasMMX) block_diffs = block_diffs_MMX; + if(gCpuCaps.hasMMX) block_diffs = block_diffs_MMX; #endif - return 1; + return 1; } const vf_info_t vf_info_ivtc = { diff --git a/mplayer/libmpcodecs/vf_kerndeint.c b/mplayer/libmpcodecs/vf_kerndeint.c index 4ea56919..ab2bea11 100644 --- a/mplayer/libmpcodecs/vf_kerndeint.c +++ b/mplayer/libmpcodecs/vf_kerndeint.c @@ -34,13 +34,13 @@ //===========================================================================// struct vf_priv_s { - int frame; - int map; - int order; - int thresh; - int sharp; - int twoway; - int do_deinterlace; + int frame; + int map; + int order; + int thresh; + int sharp; + int twoway; + int do_deinterlace; }; @@ -48,26 +48,26 @@ struct vf_priv_s { static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt){ - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static void uninit(struct vf_instance *vf) { - free(vf->priv); + free(vf->priv); } static inline int IsRGB(mp_image_t *mpi) { - return mpi->imgfmt == IMGFMT_RGB; + return mpi->imgfmt == IMGFMT_RGB; } static inline int IsYUY2(mp_image_t *mpi) { - return mpi->imgfmt == IMGFMT_YUY2; + return mpi->imgfmt == IMGFMT_YUY2; } #define PLANAR_Y 0 @@ -75,262 +75,262 @@ static inline int IsYUY2(mp_image_t *mpi) #define PLANAR_V 2 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ - int cw= mpi->w >> mpi->chroma_x_shift; - int ch= mpi->h >> mpi->chroma_y_shift; - int W = mpi->w, H = mpi->h; - const unsigned char *prvp, *prvpp, *prvpn, *prvpnn, *prvppp, *prvp4p, *prvp4n; - const unsigned char *srcp_saved; - const unsigned char *srcp, *srcpp, *srcpn, *srcpnn, *srcppp, *srcp3p, *srcp3n, *srcp4p, *srcp4n; - unsigned char *dstp, *dstp_saved; - int src_pitch; - int psrc_pitch; - int dst_pitch; - int x, y, z; - int n = vf->priv->frame++; - int val, hi, lo, w, h; - double valf; - int plane; - int threshold = vf->priv->thresh; - int order = vf->priv->order; - int map = vf->priv->map; - int sharp = vf->priv->sharp; - int twoway = vf->priv->twoway; - mp_image_t *dmpi, *pmpi; - - if(!vf->priv->do_deinterlace) - return vf_next_put_image(vf, mpi, pts); - - dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_IP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->w,mpi->h); - pmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->w,mpi->h); - if(!dmpi) return 0; - - for (z=0; znum_planes; z++) { - if (z == 0) plane = PLANAR_Y; - else if (z == 1) plane = PLANAR_U; - else plane = PLANAR_V; - - h = plane == PLANAR_Y ? H : ch; - w = plane == PLANAR_Y ? W : cw; - - srcp = srcp_saved = mpi->planes[z]; - src_pitch = mpi->stride[z]; - psrc_pitch = pmpi->stride[z]; - dstp = dstp_saved = dmpi->planes[z]; - dst_pitch = dmpi->stride[z]; - srcp = srcp_saved + (1-order) * src_pitch; - dstp = dstp_saved + (1-order) * dst_pitch; - - for (y=0; yplanes[z] + 5*psrc_pitch - (1-order)*psrc_pitch; - prvpp = prvp - psrc_pitch; - prvppp = prvp - 2*psrc_pitch; - prvp4p = prvp - 4*psrc_pitch; - prvpn = prvp + psrc_pitch; - prvpnn = prvp + 2*psrc_pitch; - prvp4n = prvp + 4*psrc_pitch; - srcp = srcp_saved + 5*src_pitch - (1-order)*src_pitch; - srcpp = srcp - src_pitch; - srcppp = srcp - 2*src_pitch; - srcp3p = srcp - 3*src_pitch; - srcp4p = srcp - 4*src_pitch; - srcpn = srcp + src_pitch; - srcpnn = srcp + 2*src_pitch; - srcp3n = srcp + 3*src_pitch; - srcp4n = srcp + 4*src_pitch; - dstp = dstp_saved + 5*dst_pitch - (1-order)*dst_pitch; - for (y = 5 - (1-order); y <= h - 5 - (1-order); y+=2) - { - for (x = 0; x < w; x++) - { - if ((threshold == 0) || (n == 0) || - (abs((int)prvp[x] - (int)srcp[x]) > threshold) || - (abs((int)prvpp[x] - (int)srcpp[x]) > threshold) || - (abs((int)prvpn[x] - (int)srcpn[x]) > threshold)) - { - if (map == 1) - { - int g = x & ~3; - if (IsRGB(mpi) == 1) - { - dstp[g++] = 255; - dstp[g++] = 255; - dstp[g++] = 255; - dstp[g] = 255; - x = g; - } - else if (IsYUY2(mpi) == 1) - { - dstp[g++] = 235; - dstp[g++] = 128; - dstp[g++] = 235; - dstp[g] = 128; - x = g; - } - else - { - if (plane == PLANAR_Y) dstp[x] = 235; - else dstp[x] = 128; - } - } - else - { - if (IsRGB(mpi)) - { - hi = 255; - lo = 0; - } - else if (IsYUY2(mpi)) - { - hi = (x & 1) ? 240 : 235; - lo = 16; - } - else - { - hi = (plane == PLANAR_Y) ? 235 : 240; - lo = 16; - } - - if (sharp == 1) - { - if (twoway == 1) - valf = + 0.526*((int)srcpp[x] + (int)srcpn[x]) - + 0.170*((int)srcp[x] + (int)prvp[x]) - - 0.116*((int)srcppp[x] + (int)srcpnn[x] + (int)prvppp[x] + (int)prvpnn[x]) - - 0.026*((int)srcp3p[x] + (int)srcp3n[x]) - + 0.031*((int)srcp4p[x] + (int)srcp4n[x] + (int)prvp4p[x] + (int)prvp4n[x]); - else - valf = + 0.526*((int)srcpp[x] + (int)srcpn[x]) - + 0.170*((int)prvp[x]) - - 0.116*((int)prvppp[x] + (int)prvpnn[x]) - - 0.026*((int)srcp3p[x] + (int)srcp3n[x]) - + 0.031*((int)prvp4p[x] + (int)prvp4p[x]); - if (valf > hi) valf = hi; - else if (valf < lo) valf = lo; - dstp[x] = (int) valf; - } - else - { - if (twoway == 1) - val = (8*((int)srcpp[x] + (int)srcpn[x]) + 2*((int)srcp[x] + (int)prvp[x]) - - (int)(srcppp[x]) - (int)(srcpnn[x]) - - (int)(prvppp[x]) - (int)(prvpnn[x])) >> 4; - else - val = (8*((int)srcpp[x] + (int)srcpn[x]) + 2*((int)prvp[x]) - - (int)(prvppp[x]) - (int)(prvpnn[x])) >> 4; - if (val > hi) val = hi; - else if (val < lo) val = lo; - dstp[x] = (int) val; - } - } - } - else - { - dstp[x] = srcp[x]; - } - } - prvp += 2*psrc_pitch; - prvpp += 2*psrc_pitch; - prvppp += 2*psrc_pitch; - prvpn += 2*psrc_pitch; - prvpnn += 2*psrc_pitch; - prvp4p += 2*psrc_pitch; - prvp4n += 2*psrc_pitch; - srcp += 2*src_pitch; - srcpp += 2*src_pitch; - srcppp += 2*src_pitch; - srcp3p += 2*src_pitch; - srcp4p += 2*src_pitch; - srcpn += 2*src_pitch; - srcpnn += 2*src_pitch; - srcp3n += 2*src_pitch; - srcp4n += 2*src_pitch; - dstp += 2*dst_pitch; - } - - srcp = mpi->planes[z]; - dstp = pmpi->planes[z]; - for (y=0; yw >> mpi->chroma_x_shift; + int ch= mpi->h >> mpi->chroma_y_shift; + int W = mpi->w, H = mpi->h; + const unsigned char *prvp, *prvpp, *prvpn, *prvpnn, *prvppp, *prvp4p, *prvp4n; + const unsigned char *srcp_saved; + const unsigned char *srcp, *srcpp, *srcpn, *srcpnn, *srcppp, *srcp3p, *srcp3n, *srcp4p, *srcp4n; + unsigned char *dstp, *dstp_saved; + int src_pitch; + int psrc_pitch; + int dst_pitch; + int x, y, z; + int n = vf->priv->frame++; + int val, hi, lo, w, h; + double valf; + int plane; + int threshold = vf->priv->thresh; + int order = vf->priv->order; + int map = vf->priv->map; + int sharp = vf->priv->sharp; + int twoway = vf->priv->twoway; + mp_image_t *dmpi, *pmpi; + + if(!vf->priv->do_deinterlace) + return vf_next_put_image(vf, mpi, pts); + + dmpi=vf_get_image(vf->next,mpi->imgfmt, + MP_IMGTYPE_IP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->w,mpi->h); + pmpi=vf_get_image(vf->next,mpi->imgfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->w,mpi->h); + if(!dmpi) return 0; + + for (z=0; znum_planes; z++) { + if (z == 0) plane = PLANAR_Y; + else if (z == 1) plane = PLANAR_U; + else plane = PLANAR_V; + + h = plane == PLANAR_Y ? H : ch; + w = plane == PLANAR_Y ? W : cw; + + srcp = srcp_saved = mpi->planes[z]; + src_pitch = mpi->stride[z]; + psrc_pitch = pmpi->stride[z]; + dstp = dstp_saved = dmpi->planes[z]; + dst_pitch = dmpi->stride[z]; + srcp = srcp_saved + (1-order) * src_pitch; + dstp = dstp_saved + (1-order) * dst_pitch; + + for (y=0; yplanes[z] + 5*psrc_pitch - (1-order)*psrc_pitch; + prvpp = prvp - psrc_pitch; + prvppp = prvp - 2*psrc_pitch; + prvp4p = prvp - 4*psrc_pitch; + prvpn = prvp + psrc_pitch; + prvpnn = prvp + 2*psrc_pitch; + prvp4n = prvp + 4*psrc_pitch; + srcp = srcp_saved + 5*src_pitch - (1-order)*src_pitch; + srcpp = srcp - src_pitch; + srcppp = srcp - 2*src_pitch; + srcp3p = srcp - 3*src_pitch; + srcp4p = srcp - 4*src_pitch; + srcpn = srcp + src_pitch; + srcpnn = srcp + 2*src_pitch; + srcp3n = srcp + 3*src_pitch; + srcp4n = srcp + 4*src_pitch; + dstp = dstp_saved + 5*dst_pitch - (1-order)*dst_pitch; + for (y = 5 - (1-order); y <= h - 5 - (1-order); y+=2) + { + for (x = 0; x < w; x++) + { + if ((threshold == 0) || (n == 0) || + (abs((int)prvp[x] - (int)srcp[x]) > threshold) || + (abs((int)prvpp[x] - (int)srcpp[x]) > threshold) || + (abs((int)prvpn[x] - (int)srcpn[x]) > threshold)) + { + if (map == 1) + { + int g = x & ~3; + if (IsRGB(mpi) == 1) + { + dstp[g++] = 255; + dstp[g++] = 255; + dstp[g++] = 255; + dstp[g] = 255; + x = g; + } + else if (IsYUY2(mpi) == 1) + { + dstp[g++] = 235; + dstp[g++] = 128; + dstp[g++] = 235; + dstp[g] = 128; + x = g; + } + else + { + if (plane == PLANAR_Y) dstp[x] = 235; + else dstp[x] = 128; + } + } + else + { + if (IsRGB(mpi)) + { + hi = 255; + lo = 0; + } + else if (IsYUY2(mpi)) + { + hi = (x & 1) ? 240 : 235; + lo = 16; + } + else + { + hi = (plane == PLANAR_Y) ? 235 : 240; + lo = 16; + } + + if (sharp == 1) + { + if (twoway == 1) + valf = + 0.526*((int)srcpp[x] + (int)srcpn[x]) + + 0.170*((int)srcp[x] + (int)prvp[x]) + - 0.116*((int)srcppp[x] + (int)srcpnn[x] + (int)prvppp[x] + (int)prvpnn[x]) + - 0.026*((int)srcp3p[x] + (int)srcp3n[x]) + + 0.031*((int)srcp4p[x] + (int)srcp4n[x] + (int)prvp4p[x] + (int)prvp4n[x]); + else + valf = + 0.526*((int)srcpp[x] + (int)srcpn[x]) + + 0.170*((int)prvp[x]) + - 0.116*((int)prvppp[x] + (int)prvpnn[x]) + - 0.026*((int)srcp3p[x] + (int)srcp3n[x]) + + 0.031*((int)prvp4p[x] + (int)prvp4p[x]); + if (valf > hi) valf = hi; + else if (valf < lo) valf = lo; + dstp[x] = (int) valf; + } + else + { + if (twoway == 1) + val = (8*((int)srcpp[x] + (int)srcpn[x]) + 2*((int)srcp[x] + (int)prvp[x]) - + (int)(srcppp[x]) - (int)(srcpnn[x]) - + (int)(prvppp[x]) - (int)(prvpnn[x])) >> 4; + else + val = (8*((int)srcpp[x] + (int)srcpn[x]) + 2*((int)prvp[x]) - + (int)(prvppp[x]) - (int)(prvpnn[x])) >> 4; + if (val > hi) val = hi; + else if (val < lo) val = lo; + dstp[x] = (int) val; + } + } + } + else + { + dstp[x] = srcp[x]; + } + } + prvp += 2*psrc_pitch; + prvpp += 2*psrc_pitch; + prvppp += 2*psrc_pitch; + prvpn += 2*psrc_pitch; + prvpnn += 2*psrc_pitch; + prvp4p += 2*psrc_pitch; + prvp4n += 2*psrc_pitch; + srcp += 2*src_pitch; + srcpp += 2*src_pitch; + srcppp += 2*src_pitch; + srcp3p += 2*src_pitch; + srcp4p += 2*src_pitch; + srcpn += 2*src_pitch; + srcpnn += 2*src_pitch; + srcp3n += 2*src_pitch; + srcp4n += 2*src_pitch; + dstp += 2*dst_pitch; + } + + srcp = mpi->planes[z]; + dstp = pmpi->planes[z]; + for (y=0; ypriv->do_deinterlace; - return CONTROL_OK; - case VFCTRL_SET_DEINTERLACE: - vf->priv->do_deinterlace = *(int*)data; - return CONTROL_OK; - } - return vf_next_control (vf, request, data); + switch (request) + { + case VFCTRL_GET_DEINTERLACE: + *(int*)data = vf->priv->do_deinterlace; + return CONTROL_OK; + case VFCTRL_SET_DEINTERLACE: + vf->priv->do_deinterlace = *(int*)data; + return CONTROL_OK; + } + return vf_next_control (vf, request, data); } static int vf_open(vf_instance_t *vf, char *args){ - vf->control=control; - vf->config=config; - vf->put_image=put_image; + vf->control=control; + vf->config=config; + vf->put_image=put_image; vf->query_format=query_format; vf->uninit=uninit; - vf->priv=malloc(sizeof(struct vf_priv_s)); + vf->priv=malloc(sizeof(struct vf_priv_s)); memset(vf->priv, 0, sizeof(struct vf_priv_s)); - vf->priv->frame = 0; + vf->priv->frame = 0; - vf->priv->map = 0; - vf->priv->order = 0; - vf->priv->thresh = 10; - vf->priv->sharp = 0; - vf->priv->twoway = 0; - vf->priv->do_deinterlace=1; + vf->priv->map = 0; + vf->priv->order = 0; + vf->priv->thresh = 10; + vf->priv->sharp = 0; + vf->priv->twoway = 0; + vf->priv->do_deinterlace=1; if (args) { sscanf(args, "%d:%d:%d:%d:%d", - &vf->priv->thresh, &vf->priv->map, - &vf->priv->order, &vf->priv->sharp, - &vf->priv->twoway); + &vf->priv->thresh, &vf->priv->map, + &vf->priv->order, &vf->priv->sharp, + &vf->priv->twoway); } - if (vf->priv->order > 1) vf->priv->order = 1; + if (vf->priv->order > 1) vf->priv->order = 1; - return 1; + return 1; } const vf_info_t vf_info_kerndeint = { diff --git a/mplayer/libmpcodecs/vf_mcdeint.c b/mplayer/libmpcodecs/vf_mcdeint.c index 3e6745fc..aad2afdf 100644 --- a/mplayer/libmpcodecs/vf_mcdeint.c +++ b/mplayer/libmpcodecs/vf_mcdeint.c @@ -181,7 +181,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst[3], uint8_t *src[3], int ds static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ int i; AVCodec *enc= avcodec_find_encoder(CODEC_ID_SNOW); @@ -233,7 +233,7 @@ static int config(struct vf_instance *vf, vf->priv->outbuf_size= width*height*10; vf->priv->outbuf= malloc(vf->priv->outbuf_size); - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static void get_image(struct vf_instance *vf, mp_image_t *mpi){ @@ -248,8 +248,8 @@ return; //caused problems, dunno why if(mpi->flags&MP_IMGFLAG_PLANAR){ mpi->planes[1]=vf->dmpi->planes[1]; mpi->planes[2]=vf->dmpi->planes[2]; - mpi->stride[1]=vf->dmpi->stride[1]; - mpi->stride[2]=vf->dmpi->stride[2]; + mpi->stride[1]=vf->dmpi->stride[1]; + mpi->stride[2]=vf->dmpi->stride[2]; } mpi->flags|=MP_IMGFLAG_DIRECT; } @@ -297,12 +297,12 @@ static void uninit(struct vf_instance *vf){ //===========================================================================// static int query_format(struct vf_instance *vf, unsigned int fmt){ switch(fmt){ - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_Y800: - case IMGFMT_Y8: - return vf_next_query_format(vf,fmt); + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_Y800: + case IMGFMT_Y8: + return vf_next_query_format(vf,fmt); } return 0; } diff --git a/mplayer/libmpcodecs/vf_mirror.c b/mplayer/libmpcodecs/vf_mirror.c index 63a52db0..396aee3f 100644 --- a/mplayer/libmpcodecs/vf_mirror.c +++ b/mplayer/libmpcodecs/vf_mirror.c @@ -32,52 +32,52 @@ static void mirror(unsigned char* dst,unsigned char* src,int dststride,int srcstride,int w,int h,int bpp,unsigned int fmt){ int y; for(y=0;y>1; - for(x=0;x>1; - for(x=0;x>1; + for(x=0;x>1; + for(x=0;xnext,mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->w, mpi->h); + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->w, mpi->h); if(mpi->flags&MP_IMGFLAG_PLANAR){ - mirror(dmpi->planes[0],mpi->planes[0], - dmpi->stride[0],mpi->stride[0], - dmpi->w,dmpi->h,1,mpi->imgfmt); - mirror(dmpi->planes[1],mpi->planes[1], - dmpi->stride[1],mpi->stride[1], - dmpi->w>>mpi->chroma_x_shift,dmpi->h>>mpi->chroma_y_shift,1,mpi->imgfmt); - mirror(dmpi->planes[2],mpi->planes[2], - dmpi->stride[2],mpi->stride[2], - dmpi->w>>mpi->chroma_x_shift,dmpi->h>>mpi->chroma_y_shift,1,mpi->imgfmt); + mirror(dmpi->planes[0],mpi->planes[0], + dmpi->stride[0],mpi->stride[0], + dmpi->w,dmpi->h,1,mpi->imgfmt); + mirror(dmpi->planes[1],mpi->planes[1], + dmpi->stride[1],mpi->stride[1], + dmpi->w>>mpi->chroma_x_shift,dmpi->h>>mpi->chroma_y_shift,1,mpi->imgfmt); + mirror(dmpi->planes[2],mpi->planes[2], + dmpi->stride[2],mpi->stride[2], + dmpi->w>>mpi->chroma_x_shift,dmpi->h>>mpi->chroma_y_shift,1,mpi->imgfmt); } else { - mirror(dmpi->planes[0],mpi->planes[0], - dmpi->stride[0],mpi->stride[0], - dmpi->w,dmpi->h,dmpi->bpp>>3,mpi->imgfmt); - dmpi->planes[1]=mpi->planes[1]; // passthrough rgb8 palette + mirror(dmpi->planes[0],mpi->planes[0], + dmpi->stride[0],mpi->stride[0], + dmpi->w,dmpi->h,dmpi->bpp>>3,mpi->imgfmt); + dmpi->planes[1]=mpi->planes[1]; // passthrough rgb8 palette } return vf_next_put_image(vf,dmpi, pts); diff --git a/mplayer/libmpcodecs/vf_noise.c b/mplayer/libmpcodecs/vf_noise.c index 2fad874a..0238bb71 100644 --- a/mplayer/libmpcodecs/vf_noise.c +++ b/mplayer/libmpcodecs/vf_noise.c @@ -51,21 +51,21 @@ static void (*lineNoise)(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int static void (*lineNoiseAvg)(uint8_t *dst, uint8_t *src, int len, int8_t **shift)= lineNoiseAvg_C; typedef struct FilterParam{ - int strength; - int uniform; - int temporal; - int quality; + int strength; + int uniform; + int temporal; + int quality; int averaged; int pattern; int shiftptr; - int8_t *noise; - int8_t *prev_shift[MAX_RES][3]; + int8_t *noise; + int8_t *prev_shift[MAX_RES][3]; }FilterParam; struct vf_priv_s { - FilterParam lumaParam; - FilterParam chromaParam; - unsigned int outfmt; + FilterParam lumaParam; + FilterParam chromaParam; + unsigned int outfmt; }; static int nonTempRandShift_init; @@ -77,247 +77,247 @@ static int patt[4] = { #define RAND_N(range) ((int) ((double)range*rand()/(RAND_MAX+1.0))) static int8_t *initNoise(FilterParam *fp){ - int strength= fp->strength; - int uniform= fp->uniform; - int averaged= fp->averaged; - int pattern= fp->pattern; - int8_t *noise= av_malloc(MAX_NOISE*sizeof(int8_t)); - int i, j; - - srand(123457); - - for(i=0,j=0; i= 1.0 ); - - w = sqrt( (-2.0 * log( w ) ) / w ); - y1= x1 * w; - y1*= strength / sqrt(3.0); - if (pattern) { - y1 /= 2; - y1 += patt[j%4]*strength*0.35; - } - if (y1<-128) y1=-128; - else if(y1> 127) y1= 127; - if (averaged) y1 /= 3.0; - noise[i]= (int)y1; - } - if (RAND_N(6) == 0) j--; - } - - - for (i = 0; i < MAX_RES; i++) - for (j = 0; j < 3; j++) - fp->prev_shift[i][j] = noise + (rand()&(MAX_SHIFT-1)); - - if(!nonTempRandShift_init){ - for(i=0; inoise= noise; - fp->shiftptr= 0; - return noise; + int strength= fp->strength; + int uniform= fp->uniform; + int averaged= fp->averaged; + int pattern= fp->pattern; + int8_t *noise= av_malloc(MAX_NOISE*sizeof(int8_t)); + int i, j; + + srand(123457); + + for(i=0,j=0; i= 1.0 ); + + w = sqrt( (-2.0 * log( w ) ) / w ); + y1= x1 * w; + y1*= strength / sqrt(3.0); + if (pattern) { + y1 /= 2; + y1 += patt[j%4]*strength*0.35; + } + if (y1<-128) y1=-128; + else if(y1> 127) y1= 127; + if (averaged) y1 /= 3.0; + noise[i]= (int)y1; + } + if (RAND_N(6) == 0) j--; + } + + + for (i = 0; i < MAX_RES; i++) + for (j = 0; j < 3; j++) + fp->prev_shift[i][j] = noise + (rand()&(MAX_SHIFT-1)); + + if(!nonTempRandShift_init){ + for(i=0; inoise= noise; + fp->shiftptr= 0; + return noise; } /***************************************************************************/ #if HAVE_MMX static inline void lineNoise_MMX(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int shift){ - x86_reg mmx_len= len&(~7); - noise+=shift; - - __asm__ volatile( - "mov %3, %%"REG_a" \n\t" - "pcmpeqb %%mm7, %%mm7 \n\t" - "psllw $15, %%mm7 \n\t" - "packsswb %%mm7, %%mm7 \n\t" - ASMALIGN(4) - "1: \n\t" - "movq (%0, %%"REG_a"), %%mm0 \n\t" - "movq (%1, %%"REG_a"), %%mm1 \n\t" - "pxor %%mm7, %%mm0 \n\t" - "paddsb %%mm1, %%mm0 \n\t" - "pxor %%mm7, %%mm0 \n\t" - "movq %%mm0, (%2, %%"REG_a") \n\t" - "add $8, %%"REG_a" \n\t" - " js 1b \n\t" - :: "r" (src+mmx_len), "r" (noise+mmx_len), "r" (dst+mmx_len), "g" (-mmx_len) - : "%"REG_a - ); - if(mmx_len!=len) - lineNoise_C(dst+mmx_len, src+mmx_len, noise+mmx_len, len-mmx_len, 0); + x86_reg mmx_len= len&(~7); + noise+=shift; + + __asm__ volatile( + "mov %3, %%"REG_a" \n\t" + "pcmpeqb %%mm7, %%mm7 \n\t" + "psllw $15, %%mm7 \n\t" + "packsswb %%mm7, %%mm7 \n\t" + ASMALIGN(4) + "1: \n\t" + "movq (%0, %%"REG_a"), %%mm0 \n\t" + "movq (%1, %%"REG_a"), %%mm1 \n\t" + "pxor %%mm7, %%mm0 \n\t" + "paddsb %%mm1, %%mm0 \n\t" + "pxor %%mm7, %%mm0 \n\t" + "movq %%mm0, (%2, %%"REG_a") \n\t" + "add $8, %%"REG_a" \n\t" + " js 1b \n\t" + :: "r" (src+mmx_len), "r" (noise+mmx_len), "r" (dst+mmx_len), "g" (-mmx_len) + : "%"REG_a + ); + if(mmx_len!=len) + lineNoise_C(dst+mmx_len, src+mmx_len, noise+mmx_len, len-mmx_len, 0); } #endif //duplicate of previous except movntq #if HAVE_MMX2 static inline void lineNoise_MMX2(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int shift){ - x86_reg mmx_len= len&(~7); - noise+=shift; - - __asm__ volatile( - "mov %3, %%"REG_a" \n\t" - "pcmpeqb %%mm7, %%mm7 \n\t" - "psllw $15, %%mm7 \n\t" - "packsswb %%mm7, %%mm7 \n\t" - ASMALIGN(4) - "1: \n\t" - "movq (%0, %%"REG_a"), %%mm0 \n\t" - "movq (%1, %%"REG_a"), %%mm1 \n\t" - "pxor %%mm7, %%mm0 \n\t" - "paddsb %%mm1, %%mm0 \n\t" - "pxor %%mm7, %%mm0 \n\t" - "movntq %%mm0, (%2, %%"REG_a") \n\t" - "add $8, %%"REG_a" \n\t" - " js 1b \n\t" - :: "r" (src+mmx_len), "r" (noise+mmx_len), "r" (dst+mmx_len), "g" (-mmx_len) - : "%"REG_a - ); - if(mmx_len!=len) - lineNoise_C(dst+mmx_len, src+mmx_len, noise+mmx_len, len-mmx_len, 0); + x86_reg mmx_len= len&(~7); + noise+=shift; + + __asm__ volatile( + "mov %3, %%"REG_a" \n\t" + "pcmpeqb %%mm7, %%mm7 \n\t" + "psllw $15, %%mm7 \n\t" + "packsswb %%mm7, %%mm7 \n\t" + ASMALIGN(4) + "1: \n\t" + "movq (%0, %%"REG_a"), %%mm0 \n\t" + "movq (%1, %%"REG_a"), %%mm1 \n\t" + "pxor %%mm7, %%mm0 \n\t" + "paddsb %%mm1, %%mm0 \n\t" + "pxor %%mm7, %%mm0 \n\t" + "movntq %%mm0, (%2, %%"REG_a") \n\t" + "add $8, %%"REG_a" \n\t" + " js 1b \n\t" + :: "r" (src+mmx_len), "r" (noise+mmx_len), "r" (dst+mmx_len), "g" (-mmx_len) + : "%"REG_a + ); + if(mmx_len!=len) + lineNoise_C(dst+mmx_len, src+mmx_len, noise+mmx_len, len-mmx_len, 0); } #endif static inline void lineNoise_C(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int shift){ - int i; - noise+= shift; - for(i=0; i255) dst[i]=255; //FIXME optimize - else if(v<0) dst[i]=0; - else dst[i]=v; - } + int i; + noise+= shift; + for(i=0; i255) dst[i]=255; //FIXME optimize + else if(v<0) dst[i]=0; + else dst[i]=v; + } } /***************************************************************************/ #if HAVE_MMX static inline void lineNoiseAvg_MMX(uint8_t *dst, uint8_t *src, int len, int8_t **shift){ - x86_reg mmx_len= len&(~7); - - __asm__ volatile( - "mov %5, %%"REG_a" \n\t" - ASMALIGN(4) - "1: \n\t" - "movq (%1, %%"REG_a"), %%mm1 \n\t" - "movq (%0, %%"REG_a"), %%mm0 \n\t" - "paddb (%2, %%"REG_a"), %%mm1 \n\t" - "paddb (%3, %%"REG_a"), %%mm1 \n\t" - "movq %%mm0, %%mm2 \n\t" - "movq %%mm1, %%mm3 \n\t" - "punpcklbw %%mm0, %%mm0 \n\t" - "punpckhbw %%mm2, %%mm2 \n\t" - "punpcklbw %%mm1, %%mm1 \n\t" - "punpckhbw %%mm3, %%mm3 \n\t" - "pmulhw %%mm0, %%mm1 \n\t" - "pmulhw %%mm2, %%mm3 \n\t" - "paddw %%mm1, %%mm1 \n\t" - "paddw %%mm3, %%mm3 \n\t" - "paddw %%mm0, %%mm1 \n\t" - "paddw %%mm2, %%mm3 \n\t" - "psrlw $8, %%mm1 \n\t" - "psrlw $8, %%mm3 \n\t" - "packuswb %%mm3, %%mm1 \n\t" - "movq %%mm1, (%4, %%"REG_a") \n\t" - "add $8, %%"REG_a" \n\t" - " js 1b \n\t" - :: "r" (src+mmx_len), "r" (shift[0]+mmx_len), "r" (shift[1]+mmx_len), "r" (shift[2]+mmx_len), + x86_reg mmx_len= len&(~7); + + __asm__ volatile( + "mov %5, %%"REG_a" \n\t" + ASMALIGN(4) + "1: \n\t" + "movq (%1, %%"REG_a"), %%mm1 \n\t" + "movq (%0, %%"REG_a"), %%mm0 \n\t" + "paddb (%2, %%"REG_a"), %%mm1 \n\t" + "paddb (%3, %%"REG_a"), %%mm1 \n\t" + "movq %%mm0, %%mm2 \n\t" + "movq %%mm1, %%mm3 \n\t" + "punpcklbw %%mm0, %%mm0 \n\t" + "punpckhbw %%mm2, %%mm2 \n\t" + "punpcklbw %%mm1, %%mm1 \n\t" + "punpckhbw %%mm3, %%mm3 \n\t" + "pmulhw %%mm0, %%mm1 \n\t" + "pmulhw %%mm2, %%mm3 \n\t" + "paddw %%mm1, %%mm1 \n\t" + "paddw %%mm3, %%mm3 \n\t" + "paddw %%mm0, %%mm1 \n\t" + "paddw %%mm2, %%mm3 \n\t" + "psrlw $8, %%mm1 \n\t" + "psrlw $8, %%mm3 \n\t" + "packuswb %%mm3, %%mm1 \n\t" + "movq %%mm1, (%4, %%"REG_a") \n\t" + "add $8, %%"REG_a" \n\t" + " js 1b \n\t" + :: "r" (src+mmx_len), "r" (shift[0]+mmx_len), "r" (shift[1]+mmx_len), "r" (shift[2]+mmx_len), "r" (dst+mmx_len), "g" (-mmx_len) - : "%"REG_a - ); + : "%"REG_a + ); - if(mmx_len!=len){ - int8_t *shift2[3]={shift[0]+mmx_len, shift[1]+mmx_len, shift[2]+mmx_len}; - lineNoiseAvg_C(dst+mmx_len, src+mmx_len, len-mmx_len, shift2); - } + if(mmx_len!=len){ + int8_t *shift2[3]={shift[0]+mmx_len, shift[1]+mmx_len, shift[2]+mmx_len}; + lineNoiseAvg_C(dst+mmx_len, src+mmx_len, len-mmx_len, shift2); + } } #endif static inline void lineNoiseAvg_C(uint8_t *dst, uint8_t *src, int len, int8_t **shift){ - int i; + int i; int8_t *src2= (int8_t*)src; - for(i=0; i>7); - } + for(i=0; i>7); + } } /***************************************************************************/ static void noise(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int width, int height, FilterParam *fp){ - int8_t *noise= fp->noise; - int y; - int shift=0; - - if(!noise) - { - if(src==dst) return; - - if(dstStride==srcStride) fast_memcpy(dst, src, srcStride*height); - else - { - for(y=0; ytemporal) shift= rand()&(MAX_SHIFT -1); - else shift= nonTempRandShift[y]; - - if(fp->quality==0) shift&= ~7; - if (fp->averaged) { - lineNoiseAvg(dst, src, width, fp->prev_shift[y]); - fp->prev_shift[y][fp->shiftptr] = noise + shift; - } else { - lineNoise(dst, src, noise, width, shift); - } - dst+= dstStride; - src+= srcStride; - } - fp->shiftptr++; - if (fp->shiftptr == 3) fp->shiftptr = 0; + int8_t *noise= fp->noise; + int y; + int shift=0; + + if(!noise) + { + if(src==dst) return; + + if(dstStride==srcStride) fast_memcpy(dst, src, srcStride*height); + else + { + for(y=0; ytemporal) shift= rand()&(MAX_SHIFT -1); + else shift= nonTempRandShift[y]; + + if(fp->quality==0) shift&= ~7; + if (fp->averaged) { + lineNoiseAvg(dst, src, width, fp->prev_shift[y]); + fp->prev_shift[y][fp->shiftptr] = noise + shift; + } else { + lineNoise(dst, src, noise, width, shift); + } + dst+= dstStride; + src+= srcStride; + } + fp->shiftptr++; + if (fp->shiftptr == 3) fp->shiftptr = 0; } static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static void get_image(struct vf_instance *vf, mp_image_t *mpi){ @@ -332,89 +332,89 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi){ if(mpi->flags&MP_IMGFLAG_PLANAR){ mpi->planes[1]=vf->dmpi->planes[1]; mpi->planes[2]=vf->dmpi->planes[2]; - mpi->stride[1]=vf->dmpi->stride[1]; - mpi->stride[2]=vf->dmpi->stride[2]; + mpi->stride[1]=vf->dmpi->stride[1]; + mpi->stride[2]=vf->dmpi->stride[2]; } mpi->flags|=MP_IMGFLAG_DIRECT; } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ - mp_image_t *dmpi; + mp_image_t *dmpi; - if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ - // no DR, so get a new image! hope we'll get DR buffer: - vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->w,mpi->h); + if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ + // no DR, so get a new image! hope we'll get DR buffer: + vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->w,mpi->h); //printf("nodr\n"); - } + } //else printf("dr\n"); - dmpi= vf->dmpi; + dmpi= vf->dmpi; - noise(dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, &vf->priv->lumaParam); - noise(dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w/2, mpi->h/2, &vf->priv->chromaParam); - noise(dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w/2, mpi->h/2, &vf->priv->chromaParam); + noise(dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, &vf->priv->lumaParam); + noise(dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w/2, mpi->h/2, &vf->priv->chromaParam); + noise(dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w/2, mpi->h/2, &vf->priv->chromaParam); vf_clone_mpi_attributes(dmpi, mpi); #if HAVE_MMX - if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t"); + if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t"); #endif #if HAVE_MMX2 - if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t"); + if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t"); #endif - return vf_next_put_image(vf,dmpi, pts); + return vf_next_put_image(vf,dmpi, pts); } static void uninit(struct vf_instance *vf){ - if(!vf->priv) return; + if(!vf->priv) return; - av_free(vf->priv->chromaParam.noise); - vf->priv->chromaParam.noise= NULL; + av_free(vf->priv->chromaParam.noise); + vf->priv->chromaParam.noise= NULL; - av_free(vf->priv->lumaParam.noise); - vf->priv->lumaParam.noise= NULL; + av_free(vf->priv->lumaParam.noise); + vf->priv->lumaParam.noise= NULL; - free(vf->priv); - vf->priv=NULL; + free(vf->priv); + vf->priv=NULL; } //===========================================================================// static int query_format(struct vf_instance *vf, unsigned int fmt){ - switch(fmt) - { - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - return vf_next_query_format(vf,vf->priv->outfmt); - } - return 0; + switch(fmt) + { + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + return vf_next_query_format(vf,vf->priv->outfmt); + } + return 0; } static void parse(FilterParam *fp, char* args){ - char *pos; - char *max= strchr(args, ':'); - - if(!max) max= args + strlen(args); - - fp->strength= atoi(args); - pos= strchr(args, 'u'); - if(pos && posuniform=1; - pos= strchr(args, 't'); - if(pos && postemporal=1; - pos= strchr(args, 'h'); - if(pos && posquality=1; - pos= strchr(args, 'p'); - if(pos && pospattern=1; - pos= strchr(args, 'a'); - if(pos && postemporal=1; - fp->averaged=1; - } - - if(fp->strength) initNoise(fp); + char *pos; + char *max= strchr(args, ':'); + + if(!max) max= args + strlen(args); + + fp->strength= atoi(args); + pos= strchr(args, 'u'); + if(pos && posuniform=1; + pos= strchr(args, 't'); + if(pos && postemporal=1; + pos= strchr(args, 'h'); + if(pos && posquality=1; + pos= strchr(args, 'p'); + if(pos && pospattern=1; + pos= strchr(args, 'a'); + if(pos && postemporal=1; + fp->averaged=1; + } + + if(fp->strength) initNoise(fp); } static const unsigned int fmt_list[]={ @@ -434,16 +434,16 @@ static int vf_open(vf_instance_t *vf, char *args){ memset(vf->priv, 0, sizeof(struct vf_priv_s)); if(args) { - char *arg2= strchr(args,':'); - if(arg2) parse(&vf->priv->chromaParam, arg2+1); - parse(&vf->priv->lumaParam, args); + char *arg2= strchr(args,':'); + if(arg2) parse(&vf->priv->chromaParam, arg2+1); + parse(&vf->priv->lumaParam, args); } // check csp: vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12); if(!vf->priv->outfmt) { - uninit(vf); + uninit(vf); return 0; // no csp match :( } diff --git a/mplayer/libmpcodecs/vf_palette.c b/mplayer/libmpcodecs/vf_palette.c index a60f86b7..8eb6a061 100644 --- a/mplayer/libmpcodecs/vf_palette.c +++ b/mplayer/libmpcodecs/vf_palette.c @@ -80,11 +80,11 @@ static unsigned int find_best(struct vf_instance *vf, unsigned int fmt){ else if(fmt==IMGFMT_RGB8) p=rgb_list; else return 0; while(*p){ - ret=vf->next->query_format(vf->next,*p); - mp_msg(MSGT_VFILTER,MSGL_DBG2,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3); - if(ret&VFCAP_CSP_SUPPORTED_BY_HW){ best=*p; break;} // no conversion -> bingo! - if(ret&VFCAP_CSP_SUPPORTED && !best) best=*p; // best with conversion - ++p; + ret=vf->next->query_format(vf->next,*p); + mp_msg(MSGT_VFILTER,MSGL_DBG2,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3); + if(ret&VFCAP_CSP_SUPPORTED_BY_HW){ best=*p; break;} // no conversion -> bingo! + if(ret&VFCAP_CSP_SUPPORTED && !best) best=*p; // best with conversion + ++p; } return best; } @@ -98,14 +98,14 @@ struct vf_priv_s { static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ if (!vf->priv->fmt) - vf->priv->fmt=find_best(vf,outfmt); + vf->priv->fmt=find_best(vf,outfmt); if(!vf->priv->fmt){ - // no matching fmt, so force one... - if(outfmt==IMGFMT_RGB8) vf->priv->fmt=IMGFMT_RGB32; - else if(outfmt==IMGFMT_BGR8) vf->priv->fmt=IMGFMT_BGR32; - else return 0; + // no matching fmt, so force one... + if(outfmt==IMGFMT_RGB8) vf->priv->fmt=IMGFMT_RGB32; + else if(outfmt==IMGFMT_BGR8) vf->priv->fmt=IMGFMT_BGR32; + else return 0; } return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt); } @@ -116,68 +116,68 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ // hope we'll get DR buffer: dmpi=vf_get_image(vf->next,vf->priv->fmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->w, mpi->h); + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->w, mpi->h); if (!mpi->planes[1]) { - if(!vf->priv->pal_msg){ - mp_msg(MSGT_VFILTER,MSGL_V,"[%s] no palette given, assuming builtin grayscale one\n",vf->info->name); - vf->priv->pal_msg=1; - } - mpi->planes[1] = (unsigned char*)gray_pal; + if(!vf->priv->pal_msg){ + mp_msg(MSGT_VFILTER,MSGL_V,"[%s] no palette given, assuming builtin grayscale one\n",vf->info->name); + vf->priv->pal_msg=1; + } + mpi->planes[1] = (unsigned char*)gray_pal; } if(mpi->w==mpi->stride[0] && dmpi->w*(dmpi->bpp>>3)==dmpi->stride[0]){ - // no stride conversion needed - switch(IMGFMT_RGB_DEPTH(dmpi->imgfmt)){ - case 15: - case 16: - if (IMGFMT_IS_BGR(dmpi->imgfmt)) - palette8tobgr16(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); - else - palette8torgb16(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); - break; - case 24: - if (IMGFMT_IS_BGR(dmpi->imgfmt)) - sws_convertPalette8ToPacked24(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); - else - sws_convertPalette8ToPacked24(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); - break; - case 32: - if (IMGFMT_IS_BGR(dmpi->imgfmt)) - sws_convertPalette8ToPacked32(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); - else - sws_convertPalette8ToPacked32(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); - break; - } + // no stride conversion needed + switch(IMGFMT_RGB_DEPTH(dmpi->imgfmt)){ + case 15: + case 16: + if (IMGFMT_IS_BGR(dmpi->imgfmt)) + palette8tobgr16(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); + else + palette8torgb16(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); + break; + case 24: + if (IMGFMT_IS_BGR(dmpi->imgfmt)) + sws_convertPalette8ToPacked24(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); + else + sws_convertPalette8ToPacked24(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); + break; + case 32: + if (IMGFMT_IS_BGR(dmpi->imgfmt)) + sws_convertPalette8ToPacked32(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); + else + sws_convertPalette8ToPacked32(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); + break; + } } else { - int y; - for(y=0;yh;y++){ - unsigned char* src=mpi->planes[0]+y*mpi->stride[0]; - unsigned char* dst=dmpi->planes[0]+y*dmpi->stride[0]; - switch(IMGFMT_RGB_DEPTH(dmpi->imgfmt)){ - case 15: - case 16: - if (IMGFMT_IS_BGR(dmpi->imgfmt)) - palette8tobgr16(src,dst,mpi->w,mpi->planes[1]); - else - palette8torgb16(src,dst,mpi->w,mpi->planes[1]); - break; - case 24: - if (IMGFMT_IS_BGR(dmpi->imgfmt)) - sws_convertPalette8ToPacked24(src,dst,mpi->w,mpi->planes[1]); - else - sws_convertPalette8ToPacked24(src,dst,mpi->w,mpi->planes[1]); - break; - case 32: - if (IMGFMT_IS_BGR(dmpi->imgfmt)) - sws_convertPalette8ToPacked32(src,dst,mpi->w,mpi->planes[1]); - else - sws_convertPalette8ToPacked32(src,dst,mpi->w,mpi->planes[1]); - break; - } - } + int y; + for(y=0;yh;y++){ + unsigned char* src=mpi->planes[0]+y*mpi->stride[0]; + unsigned char* dst=dmpi->planes[0]+y*dmpi->stride[0]; + switch(IMGFMT_RGB_DEPTH(dmpi->imgfmt)){ + case 15: + case 16: + if (IMGFMT_IS_BGR(dmpi->imgfmt)) + palette8tobgr16(src,dst,mpi->w,mpi->planes[1]); + else + palette8torgb16(src,dst,mpi->w,mpi->planes[1]); + break; + case 24: + if (IMGFMT_IS_BGR(dmpi->imgfmt)) + sws_convertPalette8ToPacked24(src,dst,mpi->w,mpi->planes[1]); + else + sws_convertPalette8ToPacked24(src,dst,mpi->w,mpi->planes[1]); + break; + case 32: + if (IMGFMT_IS_BGR(dmpi->imgfmt)) + sws_convertPalette8ToPacked32(src,dst,mpi->w,mpi->planes[1]); + else + sws_convertPalette8ToPacked32(src,dst,mpi->w,mpi->planes[1]); + break; + } + } } mpi->planes[1] = old_palette; @@ -207,18 +207,18 @@ static int vf_open(vf_instance_t *vf, char *args){ for(i=0;i<256;i++) gray_pal[i]=0x01010101*i; if (args) { - if (!strcasecmp(args,"rgb15")) vf->priv->fmt=IMGFMT_RGB15; else - if (!strcasecmp(args,"rgb16")) vf->priv->fmt=IMGFMT_RGB16; else - if (!strcasecmp(args,"rgb24")) vf->priv->fmt=IMGFMT_RGB24; else - if (!strcasecmp(args,"rgb32")) vf->priv->fmt=IMGFMT_RGB32; else - if (!strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else - if (!strcasecmp(args,"bgr16")) vf->priv->fmt=IMGFMT_BGR16; else - if (!strcasecmp(args,"bgr24")) vf->priv->fmt=IMGFMT_BGR24; else - if (!strcasecmp(args,"bgr32")) vf->priv->fmt=IMGFMT_BGR32; else - { - mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_UnknownFormatName, args); - return 0; - } + if (!strcasecmp(args,"rgb15")) vf->priv->fmt=IMGFMT_RGB15; else + if (!strcasecmp(args,"rgb16")) vf->priv->fmt=IMGFMT_RGB16; else + if (!strcasecmp(args,"rgb24")) vf->priv->fmt=IMGFMT_RGB24; else + if (!strcasecmp(args,"rgb32")) vf->priv->fmt=IMGFMT_RGB32; else + if (!strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else + if (!strcasecmp(args,"bgr16")) vf->priv->fmt=IMGFMT_BGR16; else + if (!strcasecmp(args,"bgr24")) vf->priv->fmt=IMGFMT_BGR24; else + if (!strcasecmp(args,"bgr32")) vf->priv->fmt=IMGFMT_BGR32; else + { + mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_UnknownFormatName, args); + return 0; + } } return 1; } diff --git a/mplayer/libmpcodecs/vf_perspective.c b/mplayer/libmpcodecs/vf_perspective.c index d7e37aab..0e49ce1b 100644 --- a/mplayer/libmpcodecs/vf_perspective.c +++ b/mplayer/libmpcodecs/vf_perspective.c @@ -32,6 +32,8 @@ #include #endif +#include "libavutil/mem.h" + #include "img_format.h" #include "mp_image.h" #include "vf.h" @@ -43,292 +45,292 @@ //===========================================================================// struct vf_priv_s { - double ref[4][2]; - int32_t coeff[1<ref; - int x,y; - - g= ( (ref[0][0] - ref[1][0] - ref[2][0] + ref[3][0])*(ref[2][1] - ref[3][1]) - - (ref[0][1] - ref[1][1] - ref[2][1] + ref[3][1])*(ref[2][0] - ref[3][0]))*H; - h= ( (ref[0][1] - ref[1][1] - ref[2][1] + ref[3][1])*(ref[1][0] - ref[3][0]) - - (ref[0][0] - ref[1][0] - ref[2][0] + ref[3][0])*(ref[1][1] - ref[3][1]))*W; - D= (ref[1][0] - ref[3][0])*(ref[2][1] - ref[3][1]) - - (ref[2][0] - ref[3][0])*(ref[1][1] - ref[3][1]); - - a= D*(ref[1][0] - ref[0][0])*H + g*ref[1][0]; - b= D*(ref[2][0] - ref[0][0])*W + h*ref[2][0]; - c= D*ref[0][0]*W*H; - d= D*(ref[1][1] - ref[0][1])*H + g*ref[1][1]; - e= D*(ref[2][1] - ref[0][1])*W + h*ref[2][1]; - f= D*ref[0][1]*W*H; - - for(y=0; ypv[x + y*W][0]= u; - priv->pv[x + y*W][1]= v; - } - } + double a,b,c,d,e,f,g,h,D; + double (*ref)[2]= priv->ref; + int x,y; + + g= ( (ref[0][0] - ref[1][0] - ref[2][0] + ref[3][0])*(ref[2][1] - ref[3][1]) + - (ref[0][1] - ref[1][1] - ref[2][1] + ref[3][1])*(ref[2][0] - ref[3][0]))*H; + h= ( (ref[0][1] - ref[1][1] - ref[2][1] + ref[3][1])*(ref[1][0] - ref[3][0]) + - (ref[0][0] - ref[1][0] - ref[2][0] + ref[3][0])*(ref[1][1] - ref[3][1]))*W; + D= (ref[1][0] - ref[3][0])*(ref[2][1] - ref[3][1]) + - (ref[2][0] - ref[3][0])*(ref[1][1] - ref[3][1]); + + a= D*(ref[1][0] - ref[0][0])*H + g*ref[1][0]; + b= D*(ref[2][0] - ref[0][0])*W + h*ref[2][0]; + c= D*ref[0][0]*W*H; + d= D*(ref[1][1] - ref[0][1])*H + g*ref[1][1]; + e= D*(ref[2][1] - ref[0][1])*W + h*ref[2][1]; + f= D*ref[0][1]*W*H; + + for(y=0; ypv[x + y*W][0]= u; + priv->pv[x + y*W][1]= v; + } + } } static double getCoeff(double d){ - double A= -0.60; - double coeff; + double A= -0.60; + double coeff; - d= fabs(d); + d= fabs(d); - // Equation is from VirtualDub - if(d<1.0) - coeff = (1.0 - (A+3.0)*d*d + (A+2.0)*d*d*d); - else if(d<2.0) - coeff = (-4.0*A + 8.0*A*d - 5.0*A*d*d + A*d*d*d); - else - coeff=0.0; + // Equation is from VirtualDub + if(d<1.0) + coeff = (1.0 - (A+3.0)*d*d + (A+2.0)*d*d*d); + else if(d<2.0) + coeff = (-4.0*A + 8.0*A*d - 5.0*A*d*d + A*d*d*d); + else + coeff=0.0; - return coeff; + return coeff; } static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ - int i, j; + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt){ + int i, j; - vf->priv->pvStride= width; - vf->priv->pv= (void*)memalign(8, width*height*2*sizeof(int32_t)); - initPv(vf->priv, width, height); + vf->priv->pvStride= width; + vf->priv->pv= av_malloc(width*height*2*sizeof(int32_t)); + initPv(vf->priv, width, height); - for(i=0; ipriv->coeff[i][j]= (int)floor((1<priv->coeff[i][j]= (int)floor((1<priv) return; + if(!vf->priv) return; - free(vf->priv->pv); - vf->priv->pv= NULL; + av_free(vf->priv->pv); + vf->priv->pv= NULL; - free(vf->priv); - vf->priv=NULL; + free(vf->priv); + vf->priv=NULL; } static inline void resampleCubic(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, struct vf_priv_s *privParam, int xShift, int yShift){ - int x, y; - struct vf_priv_s priv= *privParam; - - for(y=0; y>xShift; - v= priv.pv[sx + sy*priv.pvStride][1]>>yShift; - subU= u & (SUB_PIXELS-1); - subV= v & (SUB_PIXELS-1); - u >>= SUB_PIXEL_BITS; - v >>= SUB_PIXEL_BITS; - - if(u>0 && v>0 && u=h) iy=h-1; - for(dx=0; dx<4; dx++){ - int ix= u + dx - 1; - if (ix< 0) ix=0; - else if(ix>=w) ix=w-1; - - sum+= priv.coeff[subU][dx]*priv.coeff[subV][dy] - *src[ ix + iy*srcStride]; - } - } - } - sum= (sum + (1<<(COEFF_BITS*2-1)) ) >> (COEFF_BITS*2); - if(sum&~255){ - if(sum<0) sum=0; - else sum=255; - } - dst[ x + y*dstStride]= sum; - } - } + int x, y; + struct vf_priv_s priv= *privParam; + + for(y=0; y>xShift; + v= priv.pv[sx + sy*priv.pvStride][1]>>yShift; + subU= u & (SUB_PIXELS-1); + subV= v & (SUB_PIXELS-1); + u >>= SUB_PIXEL_BITS; + v >>= SUB_PIXEL_BITS; + + if(u>0 && v>0 && u=h) iy=h-1; + for(dx=0; dx<4; dx++){ + int ix= u + dx - 1; + if (ix< 0) ix=0; + else if(ix>=w) ix=w-1; + + sum+= priv.coeff[subU][dx]*priv.coeff[subV][dy] + *src[ ix + iy*srcStride]; + } + } + } + sum= (sum + (1<<(COEFF_BITS*2-1)) ) >> (COEFF_BITS*2); + if(sum&~255){ + if(sum<0) sum=0; + else sum=255; + } + dst[ x + y*dstStride]= sum; + } + } } static inline void resampleLinear(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, - struct vf_priv_s *privParam, int xShift, int yShift){ - int x, y; - struct vf_priv_s priv= *privParam; - - for(y=0; y>xShift; - v= priv.pv[sx + sy*priv.pvStride][1]>>yShift; - subU= u & (SUB_PIXELS-1); - subV= v & (SUB_PIXELS-1); - u >>= SUB_PIXEL_BITS; - v >>= SUB_PIXEL_BITS; - index= u + v*srcStride; - subUI= SUB_PIXELS - subU; - subVI= SUB_PIXELS - subV; - - if((unsigned)u < (unsigned)(w - 1)){ - if((unsigned)v < (unsigned)(h - 1)){ - sum= subVI*(subUI*src[index ] + subU*src[index +1]) - +subV *(subUI*src[index+srcStride] + subU*src[index+srcStride+1]); - sum= (sum + (1<<(SUB_PIXEL_BITS*2-1)) ) >> (SUB_PIXEL_BITS*2); - }else{ - if(v<0) v= 0; - else v= h-1; - index= u + v*srcStride; - sum= subUI*src[index] + subU*src[index+1]; - sum= (sum + (1<<(SUB_PIXEL_BITS-1)) ) >> SUB_PIXEL_BITS; - } - }else{ - if((unsigned)v < (unsigned)(h - 1)){ - if(u<0) u= 0; - else u= w-1; - index= u + v*srcStride; - sum= subVI*src[index] + subV*src[index+srcStride]; - sum= (sum + (1<<(SUB_PIXEL_BITS-1)) ) >> SUB_PIXEL_BITS; - }else{ - if(u<0) u= 0; - else u= w-1; - if(v<0) v= 0; - else v= h-1; - index= u + v*srcStride; - sum= src[index]; - } - } - if(sum&~255){ - if(sum<0) sum=0; - else sum=255; - } - dst[ x + y*dstStride]= sum; - } - } + struct vf_priv_s *privParam, int xShift, int yShift){ + int x, y; + struct vf_priv_s priv= *privParam; + + for(y=0; y>xShift; + v= priv.pv[sx + sy*priv.pvStride][1]>>yShift; + subU= u & (SUB_PIXELS-1); + subV= v & (SUB_PIXELS-1); + u >>= SUB_PIXEL_BITS; + v >>= SUB_PIXEL_BITS; + index= u + v*srcStride; + subUI= SUB_PIXELS - subU; + subVI= SUB_PIXELS - subV; + + if((unsigned)u < (unsigned)(w - 1)){ + if((unsigned)v < (unsigned)(h - 1)){ + sum= subVI*(subUI*src[index ] + subU*src[index +1]) + +subV *(subUI*src[index+srcStride] + subU*src[index+srcStride+1]); + sum= (sum + (1<<(SUB_PIXEL_BITS*2-1)) ) >> (SUB_PIXEL_BITS*2); + }else{ + if(v<0) v= 0; + else v= h-1; + index= u + v*srcStride; + sum= subUI*src[index] + subU*src[index+1]; + sum= (sum + (1<<(SUB_PIXEL_BITS-1)) ) >> SUB_PIXEL_BITS; + } + }else{ + if((unsigned)v < (unsigned)(h - 1)){ + if(u<0) u= 0; + else u= w-1; + index= u + v*srcStride; + sum= subVI*src[index] + subV*src[index+srcStride]; + sum= (sum + (1<<(SUB_PIXEL_BITS-1)) ) >> SUB_PIXEL_BITS; + }else{ + if(u<0) u= 0; + else u= w-1; + if(v<0) v= 0; + else v= h-1; + index= u + v*srcStride; + sum= src[index]; + } + } + if(sum&~255){ + if(sum<0) sum=0; + else sum=255; + } + dst[ x + y*dstStride]= sum; + } + } } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ - int cw= mpi->w >> mpi->chroma_x_shift; - int ch= mpi->h >> mpi->chroma_y_shift; - - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->w,mpi->h); - - assert(mpi->flags&MP_IMGFLAG_PLANAR); - - if(vf->priv->cubic){ - resampleCubic(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], - vf->priv, 0, 0); - resampleCubic(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], - vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); - resampleCubic(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], - vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); - }else{ - resampleLinear(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], - vf->priv, 0, 0); - resampleLinear(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], - vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); - resampleLinear(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], - vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); - } - - return vf_next_put_image(vf,dmpi, pts); + int cw= mpi->w >> mpi->chroma_x_shift; + int ch= mpi->h >> mpi->chroma_y_shift; + + mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->w,mpi->h); + + assert(mpi->flags&MP_IMGFLAG_PLANAR); + + if(vf->priv->cubic){ + resampleCubic(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], + vf->priv, 0, 0); + resampleCubic(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], + vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); + resampleCubic(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], + vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); + }else{ + resampleLinear(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], + vf->priv, 0, 0); + resampleLinear(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], + vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); + resampleLinear(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], + vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift); + } + + return vf_next_put_image(vf,dmpi, pts); } //===========================================================================// static int query_format(struct vf_instance *vf, unsigned int fmt){ - switch(fmt) - { - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_YVU9: - case IMGFMT_444P: - case IMGFMT_422P: - case IMGFMT_411P: - return vf_next_query_format(vf, fmt); - } - return 0; + switch(fmt) + { + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YVU9: + case IMGFMT_444P: + case IMGFMT_422P: + case IMGFMT_411P: + return vf_next_query_format(vf, fmt); + } + return 0; } static int vf_open(vf_instance_t *vf, char *args){ - int e; - - vf->config=config; - vf->put_image=put_image; -// vf->get_image=get_image; - vf->query_format=query_format; - vf->uninit=uninit; - vf->priv=malloc(sizeof(struct vf_priv_s)); - memset(vf->priv, 0, sizeof(struct vf_priv_s)); - - if(args==NULL) return 0; - - e=sscanf(args, "%lf:%lf:%lf:%lf:%lf:%lf:%lf:%lf:%d", - &vf->priv->ref[0][0], &vf->priv->ref[0][1], - &vf->priv->ref[1][0], &vf->priv->ref[1][1], - &vf->priv->ref[2][0], &vf->priv->ref[2][1], - &vf->priv->ref[3][0], &vf->priv->ref[3][1], - &vf->priv->cubic - ); - - if(e!=9) - return 0; - - return 1; + int e; + + vf->config=config; + vf->put_image=put_image; +// vf->get_image=get_image; + vf->query_format=query_format; + vf->uninit=uninit; + vf->priv=malloc(sizeof(struct vf_priv_s)); + memset(vf->priv, 0, sizeof(struct vf_priv_s)); + + if(args==NULL) return 0; + + e=sscanf(args, "%lf:%lf:%lf:%lf:%lf:%lf:%lf:%lf:%d", + &vf->priv->ref[0][0], &vf->priv->ref[0][1], + &vf->priv->ref[1][0], &vf->priv->ref[1][1], + &vf->priv->ref[2][0], &vf->priv->ref[2][1], + &vf->priv->ref[3][0], &vf->priv->ref[3][1], + &vf->priv->cubic + ); + + if(e!=9) + return 0; + + return 1; } const vf_info_t vf_info_perspective = { diff --git a/mplayer/libmpcodecs/vf_phase.c b/mplayer/libmpcodecs/vf_phase.c index 7ae13f85..fcbca093 100644 --- a/mplayer/libmpcodecs/vf_phase.c +++ b/mplayer/libmpcodecs/vf_phase.c @@ -31,8 +31,8 @@ #include "libvo/fastmemcpy.h" enum mode { PROGRESSIVE, TOP_FIRST, BOTTOM_FIRST, - TOP_FIRST_ANALYZE, BOTTOM_FIRST_ANALYZE, - ANALYZE, FULL_ANALYZE, AUTO, AUTO_ANALYZE }; + TOP_FIRST_ANALYZE, BOTTOM_FIRST_ANALYZE, + ANALYZE, FULL_ANALYZE, AUTO, AUTO_ANALYZE }; #define fixed_mode(p) ((p)<=BOTTOM_FIRST) @@ -49,8 +49,8 @@ struct vf_priv_s */ static void do_plane(unsigned char *to, unsigned char *from, - int w, int h, int ts, int fs, - unsigned char **bufp, enum mode mode) + int w, int h, int ts, int fs, + unsigned char **bufp, enum mode mode) { unsigned char *buf, *end; int top; @@ -85,8 +85,8 @@ static void do_plane(unsigned char *to, unsigned char *from, */ static enum mode analyze_plane(unsigned char *old, unsigned char *new, - int w, int h, int os, int ns, enum mode mode, - int verbose, int fields) + int w, int h, int os, int ns, enum mode mode, + int verbose, int fields) { double bdiff, pdiff, tdiff, scale; int bdif, tdif, pdif; @@ -95,10 +95,10 @@ static enum mode analyze_plane(unsigned char *old, unsigned char *new, if(mode==AUTO) mode=fields&MP_IMGFIELD_ORDERED?fields&MP_IMGFIELD_TOP_FIRST? - TOP_FIRST:BOTTOM_FIRST:PROGRESSIVE; + TOP_FIRST:BOTTOM_FIRST:PROGRESSIVE; else if(mode==AUTO_ANALYZE) mode=fields&MP_IMGFIELD_ORDERED?fields&MP_IMGFIELD_TOP_FIRST? - TOP_FIRST_ANALYZE:BOTTOM_FIRST_ANALYZE:FULL_ANALYZE; + TOP_FIRST_ANALYZE:BOTTOM_FIRST_ANALYZE:FULL_ANALYZE; if(fixed_mode(mode)) bdiff=pdiff=tdiff=65536.0; @@ -107,62 +107,62 @@ static enum mode analyze_plane(unsigned char *old, unsigned char *new, bdiff=pdiff=tdiff=0.0; for(end=new+(h-2)*ns, new+=ns, old+=os, top=0; - newnext, mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->w, mpi->h))) + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->w, mpi->h))) return 0; w=dmpi->w; @@ -217,24 +217,24 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) mode=PROGRESSIVE; else mode=analyze_plane(vf->priv->buf[0], mpi->planes[0], - w, dmpi->h, w, mpi->stride[0], mode, - vf->priv->verbose, mpi->fields); + w, dmpi->h, w, mpi->stride[0], mode, + vf->priv->verbose, mpi->fields); do_plane(dmpi->planes[0], mpi->planes[0], - w, dmpi->h, - dmpi->stride[0], mpi->stride[0], - &vf->priv->buf[0], mode); + w, dmpi->h, + dmpi->stride[0], mpi->stride[0], + &vf->priv->buf[0], mode); if(dmpi->flags&MP_IMGFLAG_PLANAR) { do_plane(dmpi->planes[1], mpi->planes[1], - dmpi->chroma_width, dmpi->chroma_height, - dmpi->stride[1], mpi->stride[1], - &vf->priv->buf[1], mode); + dmpi->chroma_width, dmpi->chroma_height, + dmpi->stride[1], mpi->stride[1], + &vf->priv->buf[1], mode); do_plane(dmpi->planes[2], mpi->planes[2], - dmpi->chroma_width, dmpi->chroma_height, - dmpi->stride[2], mpi->stride[2], - &vf->priv->buf[2], mode); + dmpi->chroma_width, dmpi->chroma_height, + dmpi->stride[2], mpi->stride[2], + &vf->priv->buf[2], mode); } return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); @@ -266,23 +266,23 @@ static int vf_open(vf_instance_t *vf, char *args) while(args && *args) { switch(*args) - { - case 't': vf->priv->mode=TOP_FIRST; break; - case 'a': vf->priv->mode=AUTO; break; - case 'b': vf->priv->mode=BOTTOM_FIRST; break; - case 'u': vf->priv->mode=ANALYZE; break; - case 'T': vf->priv->mode=TOP_FIRST_ANALYZE; break; - case 'A': vf->priv->mode=AUTO_ANALYZE; break; - case 'B': vf->priv->mode=BOTTOM_FIRST_ANALYZE; break; - case 'U': vf->priv->mode=FULL_ANALYZE; break; - case 'p': vf->priv->mode=PROGRESSIVE; break; - case 'v': vf->priv->verbose=1; break; - case ':': break; - - default: - uninit(vf); - return 0; /* bad args */ - } + { + case 't': vf->priv->mode=TOP_FIRST; break; + case 'a': vf->priv->mode=AUTO; break; + case 'b': vf->priv->mode=BOTTOM_FIRST; break; + case 'u': vf->priv->mode=ANALYZE; break; + case 'T': vf->priv->mode=TOP_FIRST_ANALYZE; break; + case 'A': vf->priv->mode=AUTO_ANALYZE; break; + case 'B': vf->priv->mode=BOTTOM_FIRST_ANALYZE; break; + case 'U': vf->priv->mode=FULL_ANALYZE; break; + case 'p': vf->priv->mode=PROGRESSIVE; break; + case 'v': vf->priv->verbose=1; break; + case ':': break; + + default: + uninit(vf); + return 0; /* bad args */ + } if( (args=strchr(args, ':')) ) args++; } diff --git a/mplayer/libmpcodecs/vf_pp.c b/mplayer/libmpcodecs/vf_pp.c index 4f090f30..08019d52 100644 --- a/mplayer/libmpcodecs/vf_pp.c +++ b/mplayer/libmpcodecs/vf_pp.c @@ -210,7 +210,7 @@ static int vf_open(vf_instance_t *vf, char *args){ for(i=0; i<=PP_QUALITY_MAX; i++){ PPMode *ppMode; - ppMode= (PPMode*)memalign(8, sizeof(PPMode)); + ppMode = av_malloc(sizeof(PPMode)); ppMode->lumMode= hex_mode; ppMode->chromMode= ((hex_mode&0xFF)>>4) | (hex_mode&0xFFFFFF00); diff --git a/mplayer/libmpcodecs/vf_pp7.c b/mplayer/libmpcodecs/vf_pp7.c index b40247c3..f2d22522 100644 --- a/mplayer/libmpcodecs/vf_pp7.c +++ b/mplayer/libmpcodecs/vf_pp7.c @@ -34,6 +34,8 @@ #include #endif +#include "libavutil/mem.h" + #include "img_format.h" #include "mp_image.h" #include "vf.h" @@ -350,7 +352,7 @@ static int config(struct vf_instance *vf, int h= (height+16+15)&(~15); vf->priv->temp_stride= (width+16+15)&(~15); - vf->priv->src = memalign(8, vf->priv->temp_stride*(h+8)*sizeof(uint8_t)); + vf->priv->src = av_malloc(vf->priv->temp_stride*(h+8)*sizeof(uint8_t)); return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } @@ -410,7 +412,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ static void uninit(struct vf_instance *vf){ if(!vf->priv) return; - free(vf->priv->src); + av_free(vf->priv->src); vf->priv->src= NULL; free(vf->priv); @@ -458,10 +460,10 @@ static int vf_open(vf_instance_t *vf, char *args){ init_thres2(); switch(vf->priv->mode){ - case 0: requantize= hardthresh_c; break; - case 1: requantize= softthresh_c; break; + case 0: requantize= hardthresh_c; break; + case 1: requantize= softthresh_c; break; default: - case 2: requantize= mediumthresh_c; break; + case 2: requantize= mediumthresh_c; break; } #if HAVE_MMX @@ -471,10 +473,10 @@ static int vf_open(vf_instance_t *vf, char *args){ #endif #if 0 if(gCpuCaps.hasMMX){ - switch(vf->priv->mode){ - case 0: requantize= hardthresh_mmx; break; - case 1: requantize= softthresh_mmx; break; - } + switch(vf->priv->mode){ + case 0: requantize= hardthresh_mmx; break; + case 1: requantize= softthresh_mmx; break; + } } #endif diff --git a/mplayer/libmpcodecs/vf_pullup.c b/mplayer/libmpcodecs/vf_pullup.c index c446991c..f5879eb4 100644 --- a/mplayer/libmpcodecs/vf_pullup.c +++ b/mplayer/libmpcodecs/vf_pullup.c @@ -36,272 +36,272 @@ #define MAX(a,b) ((a)>(b)?(a):(b)) struct vf_priv_s { - struct pullup_context *ctx; - int init; - int fakecount; - char *qbuf; + struct pullup_context *ctx; + int init; + int fakecount; + char *qbuf; }; static void init_pullup(struct vf_instance *vf, mp_image_t *mpi) { - struct pullup_context *c = vf->priv->ctx; - - if (mpi->flags & MP_IMGFLAG_PLANAR) { - c->format = PULLUP_FMT_Y; - c->nplanes = 4; - pullup_preinit_context(c); - c->bpp[0] = c->bpp[1] = c->bpp[2] = 8; - c->w[0] = mpi->w; - c->h[0] = mpi->h; - c->w[1] = c->w[2] = mpi->chroma_width; - c->h[1] = c->h[2] = mpi->chroma_height; - c->w[3] = ((mpi->w+15)/16) * ((mpi->h+15)/16); - c->h[3] = 2; - c->stride[0] = mpi->width; - c->stride[1] = c->stride[2] = mpi->chroma_width; - c->stride[3] = c->w[3]; - c->background[1] = c->background[2] = 128; - } - - if (gCpuCaps.hasMMX) c->cpu |= PULLUP_CPU_MMX; - if (gCpuCaps.hasMMX2) c->cpu |= PULLUP_CPU_MMX2; - if (gCpuCaps.has3DNow) c->cpu |= PULLUP_CPU_3DNOW; - if (gCpuCaps.has3DNowExt) c->cpu |= PULLUP_CPU_3DNOWEXT; - if (gCpuCaps.hasSSE) c->cpu |= PULLUP_CPU_SSE; - if (gCpuCaps.hasSSE2) c->cpu |= PULLUP_CPU_SSE2; - - pullup_init_context(c); - - vf->priv->init = 1; - vf->priv->qbuf = malloc(c->w[3]); + struct pullup_context *c = vf->priv->ctx; + + if (mpi->flags & MP_IMGFLAG_PLANAR) { + c->format = PULLUP_FMT_Y; + c->nplanes = 4; + pullup_preinit_context(c); + c->bpp[0] = c->bpp[1] = c->bpp[2] = 8; + c->w[0] = mpi->w; + c->h[0] = mpi->h; + c->w[1] = c->w[2] = mpi->chroma_width; + c->h[1] = c->h[2] = mpi->chroma_height; + c->w[3] = ((mpi->w+15)/16) * ((mpi->h+15)/16); + c->h[3] = 2; + c->stride[0] = mpi->width; + c->stride[1] = c->stride[2] = mpi->chroma_width; + c->stride[3] = c->w[3]; + c->background[1] = c->background[2] = 128; + } + + if (gCpuCaps.hasMMX) c->cpu |= PULLUP_CPU_MMX; + if (gCpuCaps.hasMMX2) c->cpu |= PULLUP_CPU_MMX2; + if (gCpuCaps.has3DNow) c->cpu |= PULLUP_CPU_3DNOW; + if (gCpuCaps.has3DNowExt) c->cpu |= PULLUP_CPU_3DNOWEXT; + if (gCpuCaps.hasSSE) c->cpu |= PULLUP_CPU_SSE; + if (gCpuCaps.hasSSE2) c->cpu |= PULLUP_CPU_SSE2; + + pullup_init_context(c); + + vf->priv->init = 1; + vf->priv->qbuf = malloc(c->w[3]); } #if 0 static void get_image(struct vf_instance *vf, mp_image_t *mpi) { - struct pullup_context *c = vf->priv->ctx; - struct pullup_buffer *b; + struct pullup_context *c = vf->priv->ctx; + struct pullup_buffer *b; - if (mpi->type == MP_IMGTYPE_STATIC) return; + if (mpi->type == MP_IMGTYPE_STATIC) return; - if (!vf->priv->init) init_pullup(vf, mpi); + if (!vf->priv->init) init_pullup(vf, mpi); - b = pullup_get_buffer(c, 2); - if (!b) return; /* shouldn't happen... */ + b = pullup_get_buffer(c, 2); + if (!b) return; /* shouldn't happen... */ - mpi->priv = b; + mpi->priv = b; - mpi->planes[0] = b->planes[0]; - mpi->planes[1] = b->planes[1]; - mpi->planes[2] = b->planes[2]; - mpi->stride[0] = c->stride[0]; - mpi->stride[1] = c->stride[1]; - mpi->stride[2] = c->stride[2]; + mpi->planes[0] = b->planes[0]; + mpi->planes[1] = b->planes[1]; + mpi->planes[2] = b->planes[2]; + mpi->stride[0] = c->stride[0]; + mpi->stride[1] = c->stride[1]; + mpi->stride[2] = c->stride[2]; - mpi->flags |= MP_IMGFLAG_DIRECT; - mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK; + mpi->flags |= MP_IMGFLAG_DIRECT; + mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK; } #endif static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { - struct pullup_context *c = vf->priv->ctx; - struct pullup_buffer *b; - struct pullup_frame *f; - mp_image_t *dmpi; - int ret; - int p; - int i; - - if (!vf->priv->init) init_pullup(vf, mpi); - - if (mpi->flags & MP_IMGFLAG_DIRECT) { - b = mpi->priv; - mpi->priv = 0; - } else { - b = pullup_get_buffer(c, 2); - if (!b) { - mp_msg(MSGT_VFILTER,MSGL_ERR,"Could not get buffer from pullup!\n"); - f = pullup_get_frame(c); - pullup_release_frame(f); - return 0; - } - memcpy_pic(b->planes[0], mpi->planes[0], mpi->w, mpi->h, - c->stride[0], mpi->stride[0]); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - memcpy_pic(b->planes[1], mpi->planes[1], - mpi->chroma_width, mpi->chroma_height, - c->stride[1], mpi->stride[1]); - memcpy_pic(b->planes[2], mpi->planes[2], - mpi->chroma_width, mpi->chroma_height, - c->stride[2], mpi->stride[2]); - } - } - if (mpi->qscale) { - fast_memcpy(b->planes[3], mpi->qscale, c->w[3]); - fast_memcpy(b->planes[3]+c->w[3], mpi->qscale, c->w[3]); - } - - p = mpi->fields & MP_IMGFIELD_TOP_FIRST ? 0 : - (mpi->fields & MP_IMGFIELD_ORDERED ? 1 : 0); - pullup_submit_field(c, b, p); - pullup_submit_field(c, b, p^1); - if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST) - pullup_submit_field(c, b, p); - - pullup_release_buffer(b, 2); - - f = pullup_get_frame(c); - - /* Fake yes for first few frames (buffer depth) to keep from - * breaking A/V sync with G1's bad architecture... */ - if (!f) return vf->priv->fakecount ? (--vf->priv->fakecount,1) : 0; - - if (f->length < 2) { - pullup_release_frame(f); - f = pullup_get_frame(c); - if (!f) return 0; - if (f->length < 2) { - pullup_release_frame(f); - if (!(mpi->fields & MP_IMGFIELD_REPEAT_FIRST)) - return 0; - f = pullup_get_frame(c); - if (!f) return 0; - if (f->length < 2) { - pullup_release_frame(f); - return 0; - } - } - } + struct pullup_context *c = vf->priv->ctx; + struct pullup_buffer *b; + struct pullup_frame *f; + mp_image_t *dmpi; + int ret; + int p; + int i; + + if (!vf->priv->init) init_pullup(vf, mpi); + + if (mpi->flags & MP_IMGFLAG_DIRECT) { + b = mpi->priv; + mpi->priv = 0; + } else { + b = pullup_get_buffer(c, 2); + if (!b) { + mp_msg(MSGT_VFILTER,MSGL_ERR,"Could not get buffer from pullup!\n"); + f = pullup_get_frame(c); + pullup_release_frame(f); + return 0; + } + memcpy_pic(b->planes[0], mpi->planes[0], mpi->w, mpi->h, + c->stride[0], mpi->stride[0]); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + memcpy_pic(b->planes[1], mpi->planes[1], + mpi->chroma_width, mpi->chroma_height, + c->stride[1], mpi->stride[1]); + memcpy_pic(b->planes[2], mpi->planes[2], + mpi->chroma_width, mpi->chroma_height, + c->stride[2], mpi->stride[2]); + } + } + if (mpi->qscale) { + fast_memcpy(b->planes[3], mpi->qscale, c->w[3]); + fast_memcpy(b->planes[3]+c->w[3], mpi->qscale, c->w[3]); + } + + p = mpi->fields & MP_IMGFIELD_TOP_FIRST ? 0 : + (mpi->fields & MP_IMGFIELD_ORDERED ? 1 : 0); + pullup_submit_field(c, b, p); + pullup_submit_field(c, b, p^1); + if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST) + pullup_submit_field(c, b, p); + + pullup_release_buffer(b, 2); + + f = pullup_get_frame(c); + + /* Fake yes for first few frames (buffer depth) to keep from + * breaking A/V sync with G1's bad architecture... */ + if (!f) return vf->priv->fakecount ? (--vf->priv->fakecount,1) : 0; + + if (f->length < 2) { + pullup_release_frame(f); + f = pullup_get_frame(c); + if (!f) return 0; + if (f->length < 2) { + pullup_release_frame(f); + if (!(mpi->fields & MP_IMGFIELD_REPEAT_FIRST)) + return 0; + f = pullup_get_frame(c); + if (!f) return 0; + if (f->length < 2) { + pullup_release_frame(f); + return 0; + } + } + } #if 0 - /* Average qscale tables from both frames. */ - if (mpi->qscale) { - for (i=0; iw[3]; i++) { - vf->priv->qbuf[i] = (f->ofields[0]->planes[3][i] - + f->ofields[1]->planes[3][i+c->w[3]])>>1; - } - } + /* Average qscale tables from both frames. */ + if (mpi->qscale) { + for (i=0; iw[3]; i++) { + vf->priv->qbuf[i] = (f->ofields[0]->planes[3][i] + + f->ofields[1]->planes[3][i+c->w[3]])>>1; + } + } #else - /* Take worst of qscale tables from both frames. */ - if (mpi->qscale) { - for (i=0; iw[3]; i++) { - vf->priv->qbuf[i] = MAX(f->ofields[0]->planes[3][i], f->ofields[1]->planes[3][i+c->w[3]]); - } - } + /* Take worst of qscale tables from both frames. */ + if (mpi->qscale) { + for (i=0; iw[3]; i++) { + vf->priv->qbuf[i] = MAX(f->ofields[0]->planes[3][i], f->ofields[1]->planes[3][i+c->w[3]]); + } + } #endif - /* If the frame isn't already exportable... */ - while (!f->buffer) { - dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->width, mpi->height); - /* FIXME: Is it ok to discard dmpi if it's not direct? */ - if (!(dmpi->flags & MP_IMGFLAG_DIRECT)) { - pullup_pack_frame(c, f); - break; - } - /* Direct render fields into output buffer */ - my_memcpy_pic(dmpi->planes[0], f->ofields[0]->planes[0], - mpi->w, mpi->h/2, dmpi->stride[0]*2, c->stride[0]*2); - my_memcpy_pic(dmpi->planes[0] + dmpi->stride[0], - f->ofields[1]->planes[0] + c->stride[0], - mpi->w, mpi->h/2, dmpi->stride[0]*2, c->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1], f->ofields[0]->planes[1], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[1]*2, c->stride[1]*2); - my_memcpy_pic(dmpi->planes[1] + dmpi->stride[1], - f->ofields[1]->planes[1] + c->stride[1], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[1]*2, c->stride[1]*2); - my_memcpy_pic(dmpi->planes[2], f->ofields[0]->planes[2], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[2]*2, c->stride[2]*2); - my_memcpy_pic(dmpi->planes[2] + dmpi->stride[2], - f->ofields[1]->planes[2] + c->stride[2], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[2]*2, c->stride[2]*2); - } - pullup_release_frame(f); - if (mpi->qscale) { - dmpi->qscale = vf->priv->qbuf; - dmpi->qstride = mpi->qstride; - dmpi->qscale_type = mpi->qscale_type; - } - return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); - } - dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->width, mpi->height); - - dmpi->planes[0] = f->buffer->planes[0]; - dmpi->planes[1] = f->buffer->planes[1]; - dmpi->planes[2] = f->buffer->planes[2]; - - dmpi->stride[0] = c->stride[0]; - dmpi->stride[1] = c->stride[1]; - dmpi->stride[2] = c->stride[2]; - - if (mpi->qscale) { - dmpi->qscale = vf->priv->qbuf; - dmpi->qstride = mpi->qstride; - dmpi->qscale_type = mpi->qscale_type; - } - ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); - pullup_release_frame(f); - return ret; + /* If the frame isn't already exportable... */ + while (!f->buffer) { + dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->width, mpi->height); + /* FIXME: Is it ok to discard dmpi if it's not direct? */ + if (!(dmpi->flags & MP_IMGFLAG_DIRECT)) { + pullup_pack_frame(c, f); + break; + } + /* Direct render fields into output buffer */ + my_memcpy_pic(dmpi->planes[0], f->ofields[0]->planes[0], + mpi->w, mpi->h/2, dmpi->stride[0]*2, c->stride[0]*2); + my_memcpy_pic(dmpi->planes[0] + dmpi->stride[0], + f->ofields[1]->planes[0] + c->stride[0], + mpi->w, mpi->h/2, dmpi->stride[0]*2, c->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(dmpi->planes[1], f->ofields[0]->planes[1], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[1]*2, c->stride[1]*2); + my_memcpy_pic(dmpi->planes[1] + dmpi->stride[1], + f->ofields[1]->planes[1] + c->stride[1], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[1]*2, c->stride[1]*2); + my_memcpy_pic(dmpi->planes[2], f->ofields[0]->planes[2], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[2]*2, c->stride[2]*2); + my_memcpy_pic(dmpi->planes[2] + dmpi->stride[2], + f->ofields[1]->planes[2] + c->stride[2], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[2]*2, c->stride[2]*2); + } + pullup_release_frame(f); + if (mpi->qscale) { + dmpi->qscale = vf->priv->qbuf; + dmpi->qstride = mpi->qstride; + dmpi->qscale_type = mpi->qscale_type; + } + return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); + } + dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->width, mpi->height); + + dmpi->planes[0] = f->buffer->planes[0]; + dmpi->planes[1] = f->buffer->planes[1]; + dmpi->planes[2] = f->buffer->planes[2]; + + dmpi->stride[0] = c->stride[0]; + dmpi->stride[1] = c->stride[1]; + dmpi->stride[2] = c->stride[2]; + + if (mpi->qscale) { + dmpi->qscale = vf->priv->qbuf; + dmpi->qstride = mpi->qstride; + dmpi->qscale_type = mpi->qscale_type; + } + ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); + pullup_release_frame(f); + return ret; } static int query_format(struct vf_instance *vf, unsigned int fmt) { - /* FIXME - support more formats */ - switch (fmt) { - case IMGFMT_YV12: - case IMGFMT_IYUV: - case IMGFMT_I420: - return vf_next_query_format(vf, fmt); - } - return 0; + /* FIXME - support more formats */ + switch (fmt) { + case IMGFMT_YV12: + case IMGFMT_IYUV: + case IMGFMT_I420: + return vf_next_query_format(vf, fmt); + } + return 0; } static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt) { - if (height&3) return 0; - return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt); + if (height&3) return 0; + return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt); } static void uninit(struct vf_instance *vf) { - pullup_free_context(vf->priv->ctx); - free(vf->priv); + pullup_free_context(vf->priv->ctx); + free(vf->priv); } static int vf_open(vf_instance_t *vf, char *args) { - struct vf_priv_s *p; - struct pullup_context *c; - //vf->get_image = get_image; - vf->put_image = put_image; - vf->config = config; - vf->query_format = query_format; - vf->uninit = uninit; - vf->default_reqs = VFCAP_ACCEPT_STRIDE; - vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); - p->ctx = c = pullup_alloc_context(); - p->fakecount = 1; - c->verbose = verbose>0; - c->junk_left = c->junk_right = 1; - c->junk_top = c->junk_bottom = 4; - c->strict_breaks = 0; - c->metric_plane = 0; - if (args) { - sscanf(args, "%d:%d:%d:%d:%d:%d", &c->junk_left, &c->junk_right, &c->junk_top, &c->junk_bottom, &c->strict_breaks, &c->metric_plane); - } - return 1; + struct vf_priv_s *p; + struct pullup_context *c; + //vf->get_image = get_image; + vf->put_image = put_image; + vf->config = config; + vf->query_format = query_format; + vf->uninit = uninit; + vf->default_reqs = VFCAP_ACCEPT_STRIDE; + vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); + p->ctx = c = pullup_alloc_context(); + p->fakecount = 1; + c->verbose = verbose>0; + c->junk_left = c->junk_right = 1; + c->junk_top = c->junk_bottom = 4; + c->strict_breaks = 0; + c->metric_plane = 0; + if (args) { + sscanf(args, "%d:%d:%d:%d:%d:%d", &c->junk_left, &c->junk_right, &c->junk_top, &c->junk_bottom, &c->strict_breaks, &c->metric_plane); + } + return 1; } const vf_info_t vf_info_pullup = { diff --git a/mplayer/libmpcodecs/vf_qp.c b/mplayer/libmpcodecs/vf_qp.c index 79e9b8d6..3f5f7264 100644 --- a/mplayer/libmpcodecs/vf_qp.c +++ b/mplayer/libmpcodecs/vf_qp.c @@ -36,19 +36,19 @@ struct vf_priv_s { - char eq[200]; - int8_t *qp; - int8_t lut[257]; - int qp_stride; + char eq[200]; + int8_t *qp; + int8_t lut[257]; + int qp_stride; }; static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ - int h= (height+15)>>4; + unsigned int flags, unsigned int outfmt){ + int h= (height+15)>>4; int i; - vf->priv->qp_stride= (width+15)>>4; + vf->priv->qp_stride= (width+15)>>4; vf->priv->qp= av_malloc(vf->priv->qp_stride*h*sizeof(int8_t)); for(i=-129; i<128; i++){ @@ -67,7 +67,7 @@ static int config(struct vf_instance *vf, NULL }; double temp_val; - int res; + int res; res= av_parse_and_eval_expr(&temp_val, vf->priv->eq, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, NULL); @@ -78,7 +78,7 @@ static int config(struct vf_instance *vf, vf->priv->lut[i+129]= lrintf(temp_val); } - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static void get_image(struct vf_instance *vf, mp_image_t *mpi){ @@ -92,32 +92,32 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi){ if(mpi->flags&MP_IMGFLAG_PLANAR){ mpi->planes[1]=vf->dmpi->planes[1]; mpi->planes[2]=vf->dmpi->planes[2]; - mpi->stride[1]=vf->dmpi->stride[1]; - mpi->stride[2]=vf->dmpi->stride[2]; + mpi->stride[1]=vf->dmpi->stride[1]; + mpi->stride[2]=vf->dmpi->stride[2]; } mpi->flags|=MP_IMGFLAG_DIRECT; } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ - mp_image_t *dmpi; + mp_image_t *dmpi; int x,y; - if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ - // no DR, so get a new image! hope we'll get DR buffer: - vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE, - mpi->w,mpi->h); - } - - dmpi= vf->dmpi; - - if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ - memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]); - if(mpi->flags&MP_IMGFLAG_PLANAR){ - memcpy_pic(dmpi->planes[1], mpi->planes[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[1], mpi->stride[1]); - memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[2], mpi->stride[2]); - } - } + if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ + // no DR, so get a new image! hope we'll get DR buffer: + vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE, + mpi->w,mpi->h); + } + + dmpi= vf->dmpi; + + if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ + memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]); + if(mpi->flags&MP_IMGFLAG_PLANAR){ + memcpy_pic(dmpi->planes[1], mpi->planes[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[1], mpi->stride[1]); + memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[2], mpi->stride[2]); + } + } vf_clone_mpi_attributes(dmpi, mpi); dmpi->qscale = vf->priv->qp; @@ -138,17 +138,17 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ } } - return vf_next_put_image(vf,dmpi, pts); + return vf_next_put_image(vf,dmpi, pts); } static void uninit(struct vf_instance *vf){ - if(!vf->priv) return; + if(!vf->priv) return; - av_free(vf->priv->qp); - vf->priv->qp= NULL; + av_free(vf->priv->qp); + vf->priv->qp= NULL; - av_free(vf->priv); - vf->priv=NULL; + av_free(vf->priv); + vf->priv=NULL; } //===========================================================================// diff --git a/mplayer/libmpcodecs/vf_rectangle.c b/mplayer/libmpcodecs/vf_rectangle.c index 79e36e69..dac2863b 100644 --- a/mplayer/libmpcodecs/vf_rectangle.c +++ b/mplayer/libmpcodecs/vf_rectangle.c @@ -36,17 +36,17 @@ config(struct vf_instance *vf, unsigned int flags, unsigned int outfmt) { if (vf->priv->w < 0 || width < vf->priv->w) - vf->priv->w = width; + vf->priv->w = width; if (vf->priv->h < 0 || height < vf->priv->h) - vf->priv->h = height; + vf->priv->h = height; if (vf->priv->x < 0) - vf->priv->x = (width - vf->priv->w) / 2; + vf->priv->x = (width - vf->priv->w) / 2; if (vf->priv->y < 0) - vf->priv->y = (height - vf->priv->h) / 2; + vf->priv->y = (height - vf->priv->h) / 2; if (vf->priv->w + vf->priv->x > width - || vf->priv->h + vf->priv->y > height) { - mp_msg(MSGT_VFILTER,MSGL_WARN,"rectangle: bad position/width/height - rectangle area is out of the original!\n"); - return 0; + || vf->priv->h + vf->priv->y > height) { + mp_msg(MSGT_VFILTER,MSGL_WARN,"rectangle: bad position/width/height - rectangle area is out of the original!\n"); + return 0; } return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt); } @@ -57,27 +57,27 @@ control(struct vf_instance *vf, int request, void *data) const int *const tmp = data; switch(request){ case VFCTRL_CHANGE_RECTANGLE: - switch (tmp[0]){ - case 0: - vf->priv->w += tmp[1]; - return 1; - break; - case 1: - vf->priv->h += tmp[1]; - return 1; - break; - case 2: - vf->priv->x += tmp[1]; - return 1; - break; - case 3: - vf->priv->y += tmp[1]; - return 1; - break; - default: - mp_msg(MSGT_VFILTER,MSGL_FATAL,"Unknown param %d \n", tmp[0]); - return 0; - } + switch (tmp[0]){ + case 0: + vf->priv->w += tmp[1]; + return 1; + break; + case 1: + vf->priv->h += tmp[1]; + return 1; + break; + case 2: + vf->priv->x += tmp[1]; + return 1; + break; + case 3: + vf->priv->y += tmp[1]; + return 1; + break; + default: + mp_msg(MSGT_VFILTER,MSGL_FATAL,"Unknown param %d \n", tmp[0]); + return 0; + } } return vf_next_control(vf, request, data); return 0; @@ -88,18 +88,18 @@ put_image(struct vf_instance *vf, mp_image_t* mpi, double pts){ unsigned int bpp = mpi->bpp / 8; int x, y, w, h; dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_TEMP, - MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, - mpi->w, mpi->h); + MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, + mpi->w, mpi->h); memcpy_pic(dmpi->planes[0],mpi->planes[0],mpi->w*bpp, mpi->h, - dmpi->stride[0],mpi->stride[0]); + dmpi->stride[0],mpi->stride[0]); if(mpi->flags&MP_IMGFLAG_PLANAR && mpi->flags&MP_IMGFLAG_YUV){ - memcpy_pic(dmpi->planes[1],mpi->planes[1], - mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, - dmpi->stride[1],mpi->stride[1]); - memcpy_pic(dmpi->planes[2],mpi->planes[2], - mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, - dmpi->stride[2],mpi->stride[2]); + memcpy_pic(dmpi->planes[1],mpi->planes[1], + mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, + dmpi->stride[1],mpi->stride[1]); + memcpy_pic(dmpi->planes[2],mpi->planes[2], + mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, + dmpi->stride[2],mpi->stride[2]); } /* Draw the rectangle */ @@ -121,36 +121,36 @@ put_image(struct vf_instance *vf, mp_image_t* mpi, double pts){ h = FFMAX(h, 0); if (0 <= vf->priv->y && vf->priv->y <= dmpi->height) { - unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + x * bpp; - unsigned int count = w * bpp; - while (count--) - p[count] = 0xff - p[count]; + unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + x * bpp; + unsigned int count = w * bpp; + while (count--) + p[count] = 0xff - p[count]; } if (h != 1 && vf->priv->y + vf->priv->h - 1 <= mpi->height) { - unsigned char *p = dmpi->planes[0] + (vf->priv->y + vf->priv->h - 1) * dmpi->stride[0] + x * bpp; - unsigned int count = w * bpp; - while (count--) - p[count] = 0xff - p[count]; + unsigned char *p = dmpi->planes[0] + (vf->priv->y + vf->priv->h - 1) * dmpi->stride[0] + x * bpp; + unsigned int count = w * bpp; + while (count--) + p[count] = 0xff - p[count]; } if (0 <= vf->priv->x && vf->priv->x <= dmpi->width) { - unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + x * bpp; - unsigned int count = h; - while (count--) { - unsigned int i = bpp; - while (i--) - p[i] = 0xff - p[i]; - p += dmpi->stride[0]; - } + unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + x * bpp; + unsigned int count = h; + while (count--) { + unsigned int i = bpp; + while (i--) + p[i] = 0xff - p[i]; + p += dmpi->stride[0]; + } } if (w != 1 && vf->priv->x + vf->priv->w - 1 <= mpi->width) { - unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + (vf->priv->x + vf->priv->w - 1) * bpp; - unsigned int count = h; - while (count--) { - unsigned int i = bpp; - while (i--) - p[i] = 0xff - p[i]; - p += dmpi->stride[0]; - } + unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + (vf->priv->x + vf->priv->w - 1) * bpp; + unsigned int count = h; + while (count--) { + unsigned int i = bpp; + while (i--) + p[i] = 0xff - p[i]; + p += dmpi->stride[0]; + } } return vf_next_put_image(vf, dmpi, pts); } @@ -166,8 +166,8 @@ vf_open(vf_instance_t *vf, char *args) { vf->priv->w = -1; vf->priv->h = -1; if (args) - sscanf(args, "%d:%d:%d:%d", - &vf->priv->w, &vf->priv->h, &vf->priv->x, &vf->priv->y); + sscanf(args, "%d:%d:%d:%d", + &vf->priv->w, &vf->priv->h, &vf->priv->x, &vf->priv->y); return 1; } diff --git a/mplayer/libmpcodecs/vf_remove_logo.c b/mplayer/libmpcodecs/vf_remove_logo.c index 898a26ef..e7420278 100644 --- a/mplayer/libmpcodecs/vf_remove_logo.c +++ b/mplayer/libmpcodecs/vf_remove_logo.c @@ -768,8 +768,8 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ mp_image_t *dmpi; dmpi=vf_get_image(vf->next,vf->priv->fmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->w, mpi->h); + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->w, mpi->h); /* Check to make sure that the filter image and the video stream are the same size. */ if (vf->priv->filter->width != mpi->w || vf->priv->filter->height != mpi->h) @@ -799,8 +799,8 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ break; default: - mp_msg(MSGT_VFILTER,MSGL_ERR,"Unhandled format: 0x%X\n",dmpi->imgfmt); - return 0; + mp_msg(MSGT_VFILTER,MSGL_ERR,"Unhandled format: 0x%X\n",dmpi->imgfmt); + return 0; } return vf_next_put_image(vf,dmpi, pts); diff --git a/mplayer/libmpcodecs/vf_rgbtest.c b/mplayer/libmpcodecs/vf_rgbtest.c index 64eef09d..dffde31c 100644 --- a/mplayer/libmpcodecs/vf_rgbtest.c +++ b/mplayer/libmpcodecs/vf_rgbtest.c @@ -49,7 +49,7 @@ static unsigned int getfmt(unsigned int outfmt){ case IMGFMT_BGR24: case IMGFMT_BGRA: case IMGFMT_ABGR: - return outfmt; + return outfmt; } return 0; } @@ -105,7 +105,7 @@ static void put_pixel(uint8_t *buf, int x, int y, int stride, int r, int g, int static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ if (vf->priv->w > 0) { d_width = width = vf->priv->w; } if (vf->priv->h > 0) { d_height = height = vf->priv->h; } vf->priv->fmt=getfmt(outfmt); @@ -121,8 +121,8 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ // hope we'll get DR buffer: dmpi=vf_get_image(vf->next,vf->priv->fmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - w, h); + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + w, h); for(y=0; ypriv->direction & 4) { - if (widthpriv->direction&=3; + if (widthpriv->direction&=3; } if (vf->priv->direction & 4){ - vf->put_image=vf_next_put_image; // passthru mode! - if (vf->next->draw_slice) vf->draw_slice=vf_next_draw_slice; + vf->put_image=vf_next_put_image; // passthru mode! + if (vf->next->draw_slice) vf->draw_slice=vf_next_draw_slice; /* FIXME: this should be in an other procedure in vf.c; that should always check whether the filter after the passthrough one still (not)supports slices */ - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } return vf_next_config(vf,height,width,d_height,d_width,flags,outfmt); } @@ -89,24 +89,24 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ // hope we'll get DR buffer: dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->h, mpi->w); + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->h, mpi->w); if(mpi->flags&MP_IMGFLAG_PLANAR){ - rotate(dmpi->planes[0],mpi->planes[0], - dmpi->stride[0],mpi->stride[0], - dmpi->w,dmpi->h,1,vf->priv->direction); - rotate(dmpi->planes[1],mpi->planes[1], - dmpi->stride[1],mpi->stride[1], - dmpi->w>>mpi->chroma_x_shift,dmpi->h>>mpi->chroma_y_shift,1,vf->priv->direction); - rotate(dmpi->planes[2],mpi->planes[2], - dmpi->stride[2],mpi->stride[2], - dmpi->w>>mpi->chroma_x_shift,dmpi->h>>mpi->chroma_y_shift,1,vf->priv->direction); + rotate(dmpi->planes[0],mpi->planes[0], + dmpi->stride[0],mpi->stride[0], + dmpi->w,dmpi->h,1,vf->priv->direction); + rotate(dmpi->planes[1],mpi->planes[1], + dmpi->stride[1],mpi->stride[1], + dmpi->w>>mpi->chroma_x_shift,dmpi->h>>mpi->chroma_y_shift,1,vf->priv->direction); + rotate(dmpi->planes[2],mpi->planes[2], + dmpi->stride[2],mpi->stride[2], + dmpi->w>>mpi->chroma_x_shift,dmpi->h>>mpi->chroma_y_shift,1,vf->priv->direction); } else { - rotate(dmpi->planes[0],mpi->planes[0], - dmpi->stride[0],mpi->stride[0], - dmpi->w,dmpi->h,dmpi->bpp>>3,vf->priv->direction); - dmpi->planes[1] = mpi->planes[1]; // passthrough rgb8 palette + rotate(dmpi->planes[0],mpi->planes[0], + dmpi->stride[0],mpi->stride[0], + dmpi->w,dmpi->h,dmpi->bpp>>3,vf->priv->direction); + dmpi->planes[1] = mpi->planes[1]; // passthrough rgb8 palette } return vf_next_put_image(vf,dmpi, pts); @@ -118,15 +118,15 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){ if(IMGFMT_IS_RGB(fmt) || IMGFMT_IS_BGR(fmt)) return vf_next_query_format(vf, fmt); // we can support only symmetric (chroma_x_shift==chroma_y_shift) YUV formats: switch(fmt) { - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_YVU9: -// case IMGFMT_IF09: - case IMGFMT_Y8: - case IMGFMT_Y800: - case IMGFMT_444P: - return vf_next_query_format(vf, fmt); + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YVU9: +// case IMGFMT_IF09: + case IMGFMT_Y8: + case IMGFMT_Y800: + case IMGFMT_444P: + return vf_next_query_format(vf, fmt); } return 0; } diff --git a/mplayer/libmpcodecs/vf_sab.c b/mplayer/libmpcodecs/vf_sab.c index ad27879d..5948f89e 100644 --- a/mplayer/libmpcodecs/vf_sab.c +++ b/mplayer/libmpcodecs/vf_sab.c @@ -42,22 +42,22 @@ //===========================================================================// typedef struct FilterParam{ - float radius; - float preFilterRadius; - float strength; - float quality; - struct SwsContext *preFilterContext; - uint8_t *preFilterBuf; - int preFilterStride; - int distWidth; - int distStride; - int *distCoeff; - int colorDiffCoeff[512]; + float radius; + float preFilterRadius; + float strength; + float quality; + struct SwsContext *preFilterContext; + uint8_t *preFilterBuf; + int preFilterStride; + int distWidth; + int distStride; + int *distCoeff; + int colorDiffCoeff[512]; }FilterParam; struct vf_priv_s { - FilterParam luma; - FilterParam chroma; + FilterParam luma; + FilterParam chroma; }; @@ -65,248 +65,248 @@ struct vf_priv_s { //FIXME stupid code duplication static void getSubSampleFactors(int *h, int *v, int format){ - switch(format){ - case IMGFMT_YV12: - case IMGFMT_I420: - *h=1; - *v=1; - break; - case IMGFMT_YVU9: - *h=2; - *v=2; - break; - case IMGFMT_444P: - *h=0; - *v=0; - break; - case IMGFMT_422P: - *h=1; - *v=0; - break; - case IMGFMT_411P: - *h=2; - *v=0; - break; - } + switch(format){ + case IMGFMT_YV12: + case IMGFMT_I420: + *h=1; + *v=1; + break; + case IMGFMT_YVU9: + *h=2; + *v=2; + break; + case IMGFMT_444P: + *h=0; + *v=0; + break; + case IMGFMT_422P: + *h=1; + *v=0; + break; + case IMGFMT_411P: + *h=2; + *v=0; + break; + } } static int allocStuff(FilterParam *f, int width, int height){ - int stride= (width+7)&~7; - SwsVector *vec; - SwsFilter swsF; - int i,x,y; - f->preFilterBuf= (uint8_t*)memalign(8, stride*height); - f->preFilterStride= stride; - - vec = sws_getGaussianVec(f->preFilterRadius, f->quality); - swsF.lumH= swsF.lumV= vec; - swsF.chrH= swsF.chrV= NULL; - f->preFilterContext= sws_getContext( - width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, get_sws_cpuflags()|SWS_POINT, &swsF, NULL, NULL); - - sws_freeVec(vec); - vec = sws_getGaussianVec(f->strength, 5.0); - for(i=0; i<512; i++){ - double d; - int index= i-256 + vec->length/2; - - if(index<0 || index>=vec->length) d= 0.0; - else d= vec->coeff[index]; - - f->colorDiffCoeff[i]= (int)(d/vec->coeff[vec->length/2]*(1<<12) + 0.5); - } - sws_freeVec(vec); - vec = sws_getGaussianVec(f->radius, f->quality); - f->distWidth= vec->length; - f->distStride= (vec->length+7)&~7; - f->distCoeff= (int32_t*)memalign(8, f->distWidth*f->distStride*sizeof(int32_t)); - - for(y=0; ylength; y++){ - for(x=0; xlength; x++){ - double d= vec->coeff[x] * vec->coeff[y]; - - f->distCoeff[x + y*f->distStride]= (int)(d*(1<<10) + 0.5); -// if(y==vec->length/2) -// printf("%6d ", f->distCoeff[x + y*f->distStride]); - } - } - sws_freeVec(vec); - - return 0; + int stride= (width+7)&~7; + SwsVector *vec; + SwsFilter swsF; + int i,x,y; + f->preFilterBuf= av_malloc(stride*height); + f->preFilterStride= stride; + + vec = sws_getGaussianVec(f->preFilterRadius, f->quality); + swsF.lumH= swsF.lumV= vec; + swsF.chrH= swsF.chrV= NULL; + f->preFilterContext= sws_getContext( + width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, get_sws_cpuflags()|SWS_POINT, &swsF, NULL, NULL); + + sws_freeVec(vec); + vec = sws_getGaussianVec(f->strength, 5.0); + for(i=0; i<512; i++){ + double d; + int index= i-256 + vec->length/2; + + if(index<0 || index>=vec->length) d= 0.0; + else d= vec->coeff[index]; + + f->colorDiffCoeff[i]= (int)(d/vec->coeff[vec->length/2]*(1<<12) + 0.5); + } + sws_freeVec(vec); + vec = sws_getGaussianVec(f->radius, f->quality); + f->distWidth= vec->length; + f->distStride= (vec->length+7)&~7; + f->distCoeff= av_malloc(f->distWidth*f->distStride*sizeof(int32_t)); + + for(y=0; ylength; y++){ + for(x=0; xlength; x++){ + double d= vec->coeff[x] * vec->coeff[y]; + + f->distCoeff[x + y*f->distStride]= (int)(d*(1<<10) + 0.5); +// if(y==vec->length/2) +// printf("%6d ", f->distCoeff[x + y*f->distStride]); + } + } + sws_freeVec(vec); + + return 0; } static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt){ - int sw, sh; + int sw, sh; //__asm__ volatile("emms\n\t"); - allocStuff(&vf->priv->luma, width, height); + allocStuff(&vf->priv->luma, width, height); - getSubSampleFactors(&sw, &sh, outfmt); - allocStuff(&vf->priv->chroma, width>>sw, height>>sh); + getSubSampleFactors(&sw, &sh, outfmt); + allocStuff(&vf->priv->chroma, width>>sw, height>>sh); - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static void freeBuffers(FilterParam *f){ - if(f->preFilterContext) sws_freeContext(f->preFilterContext); - f->preFilterContext=NULL; + if(f->preFilterContext) sws_freeContext(f->preFilterContext); + f->preFilterContext=NULL; - free(f->preFilterBuf); - f->preFilterBuf=NULL; + av_free(f->preFilterBuf); + f->preFilterBuf=NULL; - free(f->distCoeff); - f->distCoeff=NULL; + av_free(f->distCoeff); + f->distCoeff=NULL; } static void uninit(struct vf_instance *vf){ - if(!vf->priv) return; + if(!vf->priv) return; - freeBuffers(&vf->priv->luma); - freeBuffers(&vf->priv->chroma); + freeBuffers(&vf->priv->luma); + freeBuffers(&vf->priv->chroma); - free(vf->priv); - vf->priv=NULL; + free(vf->priv); + vf->priv=NULL; } static inline void blur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, FilterParam *fp){ - int x, y; - FilterParam f= *fp; - const int radius= f.distWidth/2; - const uint8_t* const srcArray[MP_MAX_PLANES] = {src}; - uint8_t *dstArray[MP_MAX_PLANES]= {f.preFilterBuf}; - int srcStrideArray[MP_MAX_PLANES]= {srcStride}; - int dstStrideArray[MP_MAX_PLANES]= {f.preFilterStride}; - -// f.preFilterContext->swScale(f.preFilterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray); - sws_scale(f.preFilterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray); - - for(y=0; yswScale(f.preFilterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray); + sws_scale(f.preFilterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray); + + for(y=0; y= radius && x < w - radius){ - for(dy=0; dy=h) iy= h+h-iy-1; - - for(dx=0; dx=h) iy= h+h-iy-1; - - for(dx=0; dx=w) ix= w+w-ix-1; - - factor= f.colorDiffCoeff[256+preVal - f.preFilterBuf[ix + iy*f.preFilterStride] ] - *f.distCoeff[dx + dy*f.distStride]; - sum+= src[ix + iy*srcStride] *factor; - div+= factor; - } - } - } - dst[x + y*dstStride]= (sum + div/2)/div; - } - } + if(x >= radius && x < w - radius){ + for(dy=0; dy=h) iy= h+h-iy-1; + + for(dx=0; dx=h) iy= h+h-iy-1; + + for(dx=0; dx=w) ix= w+w-ix-1; + + factor= f.colorDiffCoeff[256+preVal - f.preFilterBuf[ix + iy*f.preFilterStride] ] + *f.distCoeff[dx + dy*f.distStride]; + sum+= src[ix + iy*srcStride] *factor; + div+= factor; + } + } + } + dst[x + y*dstStride]= (sum + div/2)/div; + } + } } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ - int cw= mpi->w >> mpi->chroma_x_shift; - int ch= mpi->h >> mpi->chroma_y_shift; + int cw= mpi->w >> mpi->chroma_x_shift; + int ch= mpi->h >> mpi->chroma_y_shift; - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->w,mpi->h); + mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->w,mpi->h); - assert(mpi->flags&MP_IMGFLAG_PLANAR); + assert(mpi->flags&MP_IMGFLAG_PLANAR); - blur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], &vf->priv->luma); - blur(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], &vf->priv->chroma); - blur(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], &vf->priv->chroma); + blur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], &vf->priv->luma); + blur(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], &vf->priv->chroma); + blur(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], &vf->priv->chroma); - return vf_next_put_image(vf,dmpi, pts); + return vf_next_put_image(vf,dmpi, pts); } //===========================================================================// static int query_format(struct vf_instance *vf, unsigned int fmt){ - switch(fmt) - { - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_YVU9: - case IMGFMT_444P: - case IMGFMT_422P: - case IMGFMT_411P: - return vf_next_query_format(vf, fmt); - } - return 0; + switch(fmt) + { + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YVU9: + case IMGFMT_444P: + case IMGFMT_422P: + case IMGFMT_411P: + return vf_next_query_format(vf, fmt); + } + return 0; } static int vf_open(vf_instance_t *vf, char *args){ - int e; - - vf->config=config; - vf->put_image=put_image; -// vf->get_image=get_image; - vf->query_format=query_format; - vf->uninit=uninit; - vf->priv=malloc(sizeof(struct vf_priv_s)); - memset(vf->priv, 0, sizeof(struct vf_priv_s)); - - if(args==NULL) return 0; - - e=sscanf(args, "%f:%f:%f:%f:%f:%f", - &vf->priv->luma.radius, - &vf->priv->luma.preFilterRadius, - &vf->priv->luma.strength, - &vf->priv->chroma.radius, - &vf->priv->chroma.preFilterRadius, - &vf->priv->chroma.strength - ); - - vf->priv->luma.quality = vf->priv->chroma.quality= 3.0; - - if(e==3){ - vf->priv->chroma.radius= vf->priv->luma.radius; - vf->priv->chroma.preFilterRadius = vf->priv->luma.preFilterRadius; - vf->priv->chroma.strength= vf->priv->luma.strength; - }else if(e!=6) - return 0; - -// if(vf->priv->luma.radius < 0) return 0; -// if(vf->priv->chroma.radius < 0) return 0; - - return 1; + int e; + + vf->config=config; + vf->put_image=put_image; +// vf->get_image=get_image; + vf->query_format=query_format; + vf->uninit=uninit; + vf->priv=malloc(sizeof(struct vf_priv_s)); + memset(vf->priv, 0, sizeof(struct vf_priv_s)); + + if(args==NULL) return 0; + + e=sscanf(args, "%f:%f:%f:%f:%f:%f", + &vf->priv->luma.radius, + &vf->priv->luma.preFilterRadius, + &vf->priv->luma.strength, + &vf->priv->chroma.radius, + &vf->priv->chroma.preFilterRadius, + &vf->priv->chroma.strength + ); + + vf->priv->luma.quality = vf->priv->chroma.quality= 3.0; + + if(e==3){ + vf->priv->chroma.radius= vf->priv->luma.radius; + vf->priv->chroma.preFilterRadius = vf->priv->luma.preFilterRadius; + vf->priv->chroma.strength= vf->priv->luma.strength; + }else if(e!=6) + return 0; + +// if(vf->priv->luma.radius < 0) return 0; +// if(vf->priv->chroma.radius < 0) return 0; + + return 1; } const vf_info_t vf_info_sab = { diff --git a/mplayer/libmpcodecs/vf_scale.c b/mplayer/libmpcodecs/vf_scale.c index 34d59990..4b35cd21 100644 --- a/mplayer/libmpcodecs/vf_scale.c +++ b/mplayer/libmpcodecs/vf_scale.c @@ -154,12 +154,12 @@ static unsigned int find_best_out(vf_instance_t *vf, int in_format){ break; ret = vf_next_query_format(vf, format); - mp_msg(MSGT_VFILTER,MSGL_DBG2,"scale: query(%s) -> %d\n",vo_format_name(format),ret&3); - if(ret&VFCAP_CSP_SUPPORTED_BY_HW){ + mp_msg(MSGT_VFILTER,MSGL_DBG2,"scale: query(%s) -> %d\n",vo_format_name(format),ret&3); + if(ret&VFCAP_CSP_SUPPORTED_BY_HW){ best=format; // no conversion -> bingo! break; } - if(ret&VFCAP_CSP_SUPPORTED && !best) + if(ret&VFCAP_CSP_SUPPORTED && !best) best=format; // best with conversion } return best; @@ -167,7 +167,7 @@ static unsigned int find_best_out(vf_instance_t *vf, int in_format){ static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ unsigned int best=find_best_out(vf, outfmt); int vo_flags; int int_sws_flags=0; @@ -177,8 +177,8 @@ static int config(struct vf_instance *vf, enum PixelFormat dfmt, sfmt; if(!best){ - mp_msg(MSGT_VFILTER,MSGL_WARN,"SwScale: no supported outfmt found :(\n"); - return 0; + mp_msg(MSGT_VFILTER,MSGL_WARN,"SwScale: no supported outfmt found :(\n"); + return 0; } sfmt = imgfmt2pixfmt(outfmt); if (outfmt == IMGFMT_RGB8 || outfmt == IMGFMT_BGR8) sfmt = PIX_FMT_PAL8; @@ -192,20 +192,20 @@ static int config(struct vf_instance *vf, // - we're after postproc // - user didn't set w:h if(!(vo_flags&VFCAP_POSTPROC) && (flags&4) && - vf->priv->w<0 && vf->priv->h<0){ // -zoom - int x=(vo_flags&VFCAP_SWSCALE) ? 0 : 1; - if(d_widthpriv->w=d_width; - vf->priv->h=d_height; - } + vf->priv->w<0 && vf->priv->h<0){ // -zoom + int x=(vo_flags&VFCAP_SWSCALE) ? 0 : 1; + if(d_widthpriv->w=d_width; + vf->priv->h=d_height; + } } if(vf->priv->noup){ @@ -260,20 +260,20 @@ static int config(struct vf_instance *vf, // calculate the missing parameters: switch(best) { - case IMGFMT_YV12: /* YV12 needs w & h rounded to 2 */ + case IMGFMT_YV12: /* YV12 needs w & h rounded to 2 */ case IMGFMT_I420: case IMGFMT_IYUV: case IMGFMT_NV12: case IMGFMT_NV21: vf->priv->h = (vf->priv->h + 1) & ~1; - case IMGFMT_YUY2: /* YUY2 needs w rounded to 2 */ + case IMGFMT_YUY2: /* YUY2 needs w rounded to 2 */ case IMGFMT_UYVY: vf->priv->w = (vf->priv->w + 1) & ~1; } mp_msg(MSGT_VFILTER,MSGL_DBG2,"SwScale: scaling %dx%d %s to %dx%d %s \n", - width,height,vo_format_name(outfmt), - vf->priv->w,vf->priv->h,vo_format_name(best)); + width,height,vo_format_name(outfmt), + vf->priv->w,vf->priv->h,vo_format_name(best)); // free old ctx: if(vf->priv->ctx) sws_freeContext(vf->priv->ctx); @@ -284,21 +284,21 @@ static int config(struct vf_instance *vf, int_sws_flags|= vf->priv->v_chr_drop << SWS_SRC_V_CHR_DROP_SHIFT; int_sws_flags|= vf->priv->accurate_rnd * SWS_ACCURATE_RND; vf->priv->ctx=sws_getContext(width, height >> vf->priv->interlaced, - sfmt, - vf->priv->w, vf->priv->h >> vf->priv->interlaced, - dfmt, - int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param); + sfmt, + vf->priv->w, vf->priv->h >> vf->priv->interlaced, + dfmt, + int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param); if(vf->priv->interlaced){ vf->priv->ctx2=sws_getContext(width, height >> 1, - sfmt, - vf->priv->w, vf->priv->h >> 1, - dfmt, - int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param); + sfmt, + vf->priv->w, vf->priv->h >> 1, + dfmt, + int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param); } if(!vf->priv->ctx){ - // error... - mp_msg(MSGT_VFILTER,MSGL_WARN,"Couldn't init SwScaler for this setup\n"); - return 0; + // error... + mp_msg(MSGT_VFILTER,MSGL_WARN,"Couldn't init SwScaler for this setup\n"); + return 0; } vf->priv->fmt=best; @@ -307,70 +307,70 @@ static int config(struct vf_instance *vf, switch(best){ case IMGFMT_RGB8: { /* set 332 palette for 8 bpp */ - vf->priv->palette=malloc(4*256); - for(i=0; i<256; i++){ - vf->priv->palette[4*i+0]=4*(i>>6)*21; - vf->priv->palette[4*i+1]=4*((i>>3)&7)*9; - vf->priv->palette[4*i+2]=4*((i&7)&7)*9; + vf->priv->palette=malloc(4*256); + for(i=0; i<256; i++){ + vf->priv->palette[4*i+0]=4*(i>>6)*21; + vf->priv->palette[4*i+1]=4*((i>>3)&7)*9; + vf->priv->palette[4*i+2]=4*((i&7)&7)*9; vf->priv->palette[4*i+3]=0; - } - break; } + } + break; } case IMGFMT_BGR8: { /* set 332 palette for 8 bpp */ - vf->priv->palette=malloc(4*256); - for(i=0; i<256; i++){ - vf->priv->palette[4*i+0]=4*(i&3)*21; - vf->priv->palette[4*i+1]=4*((i>>2)&7)*9; - vf->priv->palette[4*i+2]=4*((i>>5)&7)*9; + vf->priv->palette=malloc(4*256); + for(i=0; i<256; i++){ + vf->priv->palette[4*i+0]=4*(i&3)*21; + vf->priv->palette[4*i+1]=4*((i>>2)&7)*9; + vf->priv->palette[4*i+2]=4*((i>>5)&7)*9; vf->priv->palette[4*i+3]=0; - } - break; } + } + break; } case IMGFMT_BGR4: case IMGFMT_BG4B: { - vf->priv->palette=malloc(4*16); - for(i=0; i<16; i++){ - vf->priv->palette[4*i+0]=4*(i&1)*63; - vf->priv->palette[4*i+1]=4*((i>>1)&3)*21; - vf->priv->palette[4*i+2]=4*((i>>3)&1)*63; + vf->priv->palette=malloc(4*16); + for(i=0; i<16; i++){ + vf->priv->palette[4*i+0]=4*(i&1)*63; + vf->priv->palette[4*i+1]=4*((i>>1)&3)*21; + vf->priv->palette[4*i+2]=4*((i>>3)&1)*63; vf->priv->palette[4*i+3]=0; - } - break; } + } + break; } case IMGFMT_RGB4: case IMGFMT_RG4B: { - vf->priv->palette=malloc(4*16); - for(i=0; i<16; i++){ - vf->priv->palette[4*i+0]=4*(i>>3)*63; - vf->priv->palette[4*i+1]=4*((i>>1)&3)*21; - vf->priv->palette[4*i+2]=4*((i&1)&1)*63; + vf->priv->palette=malloc(4*16); + for(i=0; i<16; i++){ + vf->priv->palette[4*i+0]=4*(i>>3)*63; + vf->priv->palette[4*i+1]=4*((i>>1)&3)*21; + vf->priv->palette[4*i+2]=4*((i&1)&1)*63; vf->priv->palette[4*i+3]=0; - } - break; } + } + break; } } if(!opt_screen_size_x && !opt_screen_size_y && !(screen_size_xy >= 0.001)){ - // Compute new d_width and d_height, preserving aspect - // while ensuring that both are >= output size in pixels. - if (vf->priv->h * d_width > vf->priv->w * d_height) { - d_width = vf->priv->h * d_width / d_height; - d_height = vf->priv->h; - } else { - d_height = vf->priv->w * d_height / d_width; - d_width = vf->priv->w; - } - //d_width=d_width*vf->priv->w/width; - //d_height=d_height*vf->priv->h/height; + // Compute new d_width and d_height, preserving aspect + // while ensuring that both are >= output size in pixels. + if (vf->priv->h * d_width > vf->priv->w * d_height) { + d_width = vf->priv->h * d_width / d_height; + d_height = vf->priv->h; + } else { + d_height = vf->priv->w * d_height / d_width; + d_width = vf->priv->w; + } + //d_width=d_width*vf->priv->w/width; + //d_height=d_height*vf->priv->h/height; } return vf_next_config(vf,vf->priv->w,vf->priv->h,d_width,d_height,flags,best); } static void start_slice(struct vf_instance *vf, mp_image_t *mpi){ -// printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK); +// printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK); if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)) return; // shouldn't happen // they want slices!!! allocate the buffer. mpi->priv=vf->dmpi=vf_get_image(vf->next,vf->priv->fmt, -// mpi->type, mpi->flags & (~MP_IMGFLAG_DRAW_CALLBACK), - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, - vf->priv->w, vf->priv->h); +// mpi->type, mpi->flags & (~MP_IMGFLAG_DRAW_CALLBACK), + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, + vf->priv->w, vf->priv->h); } static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src[MP_MAX_PLANES], int src_stride[MP_MAX_PLANES], @@ -407,32 +407,32 @@ static void draw_slice(struct vf_instance *vf, unsigned char** src, int* stride, int w,int h, int x, int y){ mp_image_t *dmpi=vf->dmpi; if(!dmpi){ - mp_msg(MSGT_VFILTER,MSGL_FATAL,"vf_scale: draw_slice() called with dmpi=NULL (no get_image?)\n"); - return; + mp_msg(MSGT_VFILTER,MSGL_FATAL,"vf_scale: draw_slice() called with dmpi=NULL (no get_image?)\n"); + return; } -// printf("vf_scale::draw_slice() y=%d h=%d\n",y,h); +// printf("vf_scale::draw_slice() y=%d h=%d\n",y,h); scale(vf->priv->ctx, vf->priv->ctx2, src, stride, y, h, dmpi->planes, dmpi->stride, vf->priv->interlaced); } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ mp_image_t *dmpi=mpi->priv; -// printf("vf_scale::put_image(): processing whole frame! dmpi=%p flag=%d\n", -// dmpi, (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)); +// printf("vf_scale::put_image(): processing whole frame! dmpi=%p flag=%d\n", +// dmpi, (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)); if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK && dmpi)){ // hope we'll get DR buffer: dmpi=vf_get_image(vf->next,vf->priv->fmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, - vf->priv->w, vf->priv->h); + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, + vf->priv->w, vf->priv->h); scale(vf->priv->ctx, vf->priv->ctx, mpi->planes,mpi->stride,0,mpi->h,dmpi->planes,dmpi->stride, vf->priv->interlaced); } if(vf->priv->w==mpi->w && vf->priv->h==mpi->h){ - // just conversion, no scaling -> keep postprocessing data - // this way we can apply pp filter to non-yv12 source using scaler + // just conversion, no scaling -> keep postprocessing data + // this way we can apply pp filter to non-yv12 source using scaler vf_clone_mpi_attributes(dmpi, mpi); } @@ -451,50 +451,50 @@ static int control(struct vf_instance *vf, int request, void* data){ if(vf->priv->ctx) switch(request){ case VFCTRL_GET_EQUALIZER: - r= sws_getColorspaceDetails(vf->priv->ctx, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation); - if(r<0) break; - - eq = data; - if (!strcmp(eq->item,"brightness")) { - eq->value = ((brightness*100) + (1<<15))>>16; - } - else if (!strcmp(eq->item,"contrast")) { - eq->value = (((contrast *100) + (1<<15))>>16) - 100; - } - else if (!strcmp(eq->item,"saturation")) { - eq->value = (((saturation*100) + (1<<15))>>16) - 100; - } - else - break; - return CONTROL_TRUE; + r= sws_getColorspaceDetails(vf->priv->ctx, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation); + if(r<0) break; + + eq = data; + if (!strcmp(eq->item,"brightness")) { + eq->value = ((brightness*100) + (1<<15))>>16; + } + else if (!strcmp(eq->item,"contrast")) { + eq->value = (((contrast *100) + (1<<15))>>16) - 100; + } + else if (!strcmp(eq->item,"saturation")) { + eq->value = (((saturation*100) + (1<<15))>>16) - 100; + } + else + break; + return CONTROL_TRUE; case VFCTRL_SET_EQUALIZER: - r= sws_getColorspaceDetails(vf->priv->ctx, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation); - if(r<0) break; + r= sws_getColorspaceDetails(vf->priv->ctx, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation); + if(r<0) break; //printf("set %f %f %f\n", brightness/(float)(1<<16), contrast/(float)(1<<16), saturation/(float)(1<<16)); - eq = data; - - if (!strcmp(eq->item,"brightness")) { - brightness = (( eq->value <<16) + 50)/100; - } - else if (!strcmp(eq->item,"contrast")) { - contrast = (((eq->value+100)<<16) + 50)/100; - } - else if (!strcmp(eq->item,"saturation")) { - saturation = (((eq->value+100)<<16) + 50)/100; - } - else - break; - - r= sws_setColorspaceDetails(vf->priv->ctx, inv_table, srcRange, table, dstRange, brightness, contrast, saturation); - if(r<0) break; - if(vf->priv->ctx2){ + eq = data; + + if (!strcmp(eq->item,"brightness")) { + brightness = (( eq->value <<16) + 50)/100; + } + else if (!strcmp(eq->item,"contrast")) { + contrast = (((eq->value+100)<<16) + 50)/100; + } + else if (!strcmp(eq->item,"saturation")) { + saturation = (((eq->value+100)<<16) + 50)/100; + } + else + break; + + r= sws_setColorspaceDetails(vf->priv->ctx, inv_table, srcRange, table, dstRange, brightness, contrast, saturation); + if(r<0) break; + if(vf->priv->ctx2){ r= sws_setColorspaceDetails(vf->priv->ctx2, inv_table, srcRange, table, dstRange, brightness, contrast, saturation); if(r<0) break; } - return CONTROL_TRUE; + return CONTROL_TRUE; default: - break; + break; } return vf_next_control(vf,request,data); @@ -506,17 +506,17 @@ static int control(struct vf_instance *vf, int request, void* data){ static int query_format(struct vf_instance *vf, unsigned int fmt){ if (!IMGFMT_IS_HWACCEL(fmt) && imgfmt2pixfmt(fmt) != PIX_FMT_NONE) { - unsigned int best=find_best_out(vf, fmt); - int flags; - if(!best) return 0; // no matching out-fmt - flags=vf_next_query_format(vf,best); - if(!(flags&(VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW))) return 0; // huh? - if(fmt!=best) flags&=~VFCAP_CSP_SUPPORTED_BY_HW; - // do not allow scaling, if we are before the PP fliter! - if(!(flags&VFCAP_POSTPROC)) flags|=VFCAP_SWSCALE; - return flags; + unsigned int best=find_best_out(vf, fmt); + int flags; + if(!best) return 0; // no matching out-fmt + flags=vf_next_query_format(vf,best); + if(!(flags&(VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW))) return 0; // huh? + if(fmt!=best) flags&=~VFCAP_CSP_SUPPORTED_BY_HW; + // do not allow scaling, if we are before the PP fliter! + if(!(flags&VFCAP_POSTPROC)) flags|=VFCAP_SWSCALE; + return flags; } - return 0; // nomatching in-fmt + return 0; // nomatching in-fmt } static void uninit(struct vf_instance *vf){ @@ -557,67 +557,67 @@ float sws_lum_sharpen= 0.0; int get_sws_cpuflags(void){ return (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0) - | (gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0) - | (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0) + | (gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0) + | (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0) | (gCpuCaps.hasAltiVec ? SWS_CPU_CAPS_ALTIVEC : 0); } void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam) { - static int firstTime=1; - *flags=0; + static int firstTime=1; + *flags=0; #if ARCH_X86 - if(gCpuCaps.hasMMX) - __asm__ volatile("emms\n\t"::: "memory"); //FIXME this should not be required but it IS (even for non-MMX versions) + if(gCpuCaps.hasMMX) + __asm__ volatile("emms\n\t"::: "memory"); //FIXME this should not be required but it IS (even for non-MMX versions) #endif - if(firstTime) - { - firstTime=0; - *flags= SWS_PRINT_INFO; - } - else if( mp_msg_test(MSGT_VFILTER,MSGL_DBG2) ) *flags= SWS_PRINT_INFO; - - if(src_filter) sws_freeFilter(src_filter); - - src_filter= sws_getDefaultFilter( - sws_lum_gblur, sws_chr_gblur, - sws_lum_sharpen, sws_chr_sharpen, - sws_chr_hshift, sws_chr_vshift, verbose>1); - - switch(sws_flags) - { - case 0: *flags|= SWS_FAST_BILINEAR; break; - case 1: *flags|= SWS_BILINEAR; break; - case 2: *flags|= SWS_BICUBIC; break; - case 3: *flags|= SWS_X; break; - case 4: *flags|= SWS_POINT; break; - case 5: *flags|= SWS_AREA; break; - case 6: *flags|= SWS_BICUBLIN; break; - case 7: *flags|= SWS_GAUSS; break; - case 8: *flags|= SWS_SINC; break; - case 9: *flags|= SWS_LANCZOS; break; - case 10:*flags|= SWS_SPLINE; break; - default:*flags|= SWS_BILINEAR; break; - } - - *srcFilterParam= src_filter; - *dstFilterParam= NULL; + if(firstTime) + { + firstTime=0; + *flags= SWS_PRINT_INFO; + } + else if( mp_msg_test(MSGT_VFILTER,MSGL_DBG2) ) *flags= SWS_PRINT_INFO; + + if(src_filter) sws_freeFilter(src_filter); + + src_filter= sws_getDefaultFilter( + sws_lum_gblur, sws_chr_gblur, + sws_lum_sharpen, sws_chr_sharpen, + sws_chr_hshift, sws_chr_vshift, verbose>1); + + switch(sws_flags) + { + case 0: *flags|= SWS_FAST_BILINEAR; break; + case 1: *flags|= SWS_BILINEAR; break; + case 2: *flags|= SWS_BICUBIC; break; + case 3: *flags|= SWS_X; break; + case 4: *flags|= SWS_POINT; break; + case 5: *flags|= SWS_AREA; break; + case 6: *flags|= SWS_BICUBLIN; break; + case 7: *flags|= SWS_GAUSS; break; + case 8: *flags|= SWS_SINC; break; + case 9: *flags|= SWS_LANCZOS; break; + case 10:*flags|= SWS_SPLINE; break; + default:*flags|= SWS_BILINEAR; break; + } + + *srcFilterParam= src_filter; + *dstFilterParam= NULL; } // will use sws_flags & src_filter (from cmd line) struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat) { - int flags; - SwsFilter *dstFilterParam, *srcFilterParam; - enum PixelFormat dfmt, sfmt; + int flags; + SwsFilter *dstFilterParam, *srcFilterParam; + enum PixelFormat dfmt, sfmt; - dfmt = imgfmt2pixfmt(dstFormat); - sfmt = imgfmt2pixfmt(srcFormat); - if (srcFormat == IMGFMT_RGB8 || srcFormat == IMGFMT_BGR8) sfmt = PIX_FMT_PAL8; - sws_getFlagsAndFilterFromCmdLine(&flags, &srcFilterParam, &dstFilterParam); + dfmt = imgfmt2pixfmt(dstFormat); + sfmt = imgfmt2pixfmt(srcFormat); + if (srcFormat == IMGFMT_RGB8 || srcFormat == IMGFMT_BGR8) sfmt = PIX_FMT_PAL8; + sws_getFlagsAndFilterFromCmdLine(&flags, &srcFilterParam, &dstFilterParam); - return sws_getContext(srcW, srcH, sfmt, dstW, dstH, dfmt, flags | get_sws_cpuflags(), srcFilterParam, dstFilterParam, NULL); + return sws_getContext(srcW, srcH, sfmt, dstW, dstH, dfmt, flags | get_sws_cpuflags(), srcFilterParam, dstFilterParam, NULL); } /// An example of presets usage diff --git a/mplayer/libmpcodecs/vf_smartblur.c b/mplayer/libmpcodecs/vf_smartblur.c index 044b5af0..d2442185 100644 --- a/mplayer/libmpcodecs/vf_smartblur.c +++ b/mplayer/libmpcodecs/vf_smartblur.c @@ -35,16 +35,16 @@ //===========================================================================// typedef struct FilterParam{ - float radius; - float strength; - int threshold; - float quality; - struct SwsContext *filterContext; + float radius; + float strength; + int threshold; + float quality; + struct SwsContext *filterContext; }FilterParam; struct vf_priv_s { - FilterParam luma; - FilterParam chroma; + FilterParam luma; + FilterParam chroma; }; @@ -52,202 +52,202 @@ struct vf_priv_s { //FIXME stupid code duplication static void getSubSampleFactors(int *h, int *v, int format){ - switch(format){ - case IMGFMT_YV12: - case IMGFMT_I420: - *h=1; - *v=1; - break; - case IMGFMT_YVU9: - *h=2; - *v=2; - break; - case IMGFMT_444P: - *h=0; - *v=0; - break; - case IMGFMT_422P: - *h=1; - *v=0; - break; - case IMGFMT_411P: - *h=2; - *v=0; - break; - } + switch(format){ + case IMGFMT_YV12: + case IMGFMT_I420: + *h=1; + *v=1; + break; + case IMGFMT_YVU9: + *h=2; + *v=2; + break; + case IMGFMT_444P: + *h=0; + *v=0; + break; + case IMGFMT_422P: + *h=1; + *v=0; + break; + case IMGFMT_411P: + *h=2; + *v=0; + break; + } } static int allocStuff(FilterParam *f, int width, int height){ - SwsVector *vec; - SwsFilter swsF; + SwsVector *vec; + SwsFilter swsF; - vec = sws_getGaussianVec(f->radius, f->quality); - sws_scaleVec(vec, f->strength); - vec->coeff[vec->length/2]+= 1.0 - f->strength; - swsF.lumH= swsF.lumV= vec; - swsF.chrH= swsF.chrV= NULL; - f->filterContext= sws_getContext( - width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, SWS_BICUBIC | get_sws_cpuflags(), &swsF, NULL, NULL); + vec = sws_getGaussianVec(f->radius, f->quality); + sws_scaleVec(vec, f->strength); + vec->coeff[vec->length/2]+= 1.0 - f->strength; + swsF.lumH= swsF.lumV= vec; + swsF.chrH= swsF.chrV= NULL; + f->filterContext= sws_getContext( + width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, SWS_BICUBIC | get_sws_cpuflags(), &swsF, NULL, NULL); - sws_freeVec(vec); + sws_freeVec(vec); - return 0; + return 0; } static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt){ - int sw, sh; + int sw, sh; - allocStuff(&vf->priv->luma, width, height); + allocStuff(&vf->priv->luma, width, height); - getSubSampleFactors(&sw, &sh, outfmt); - allocStuff(&vf->priv->chroma, width>>sw, height>>sh); + getSubSampleFactors(&sw, &sh, outfmt); + allocStuff(&vf->priv->chroma, width>>sw, height>>sh); - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static void freeBuffers(FilterParam *f){ - if(f->filterContext) sws_freeContext(f->filterContext); - f->filterContext=NULL; + if(f->filterContext) sws_freeContext(f->filterContext); + f->filterContext=NULL; } static void uninit(struct vf_instance *vf){ - if(!vf->priv) return; + if(!vf->priv) return; - freeBuffers(&vf->priv->luma); - freeBuffers(&vf->priv->chroma); + freeBuffers(&vf->priv->luma); + freeBuffers(&vf->priv->chroma); - free(vf->priv); - vf->priv=NULL; + free(vf->priv); + vf->priv=NULL; } static inline void blur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, FilterParam *fp){ - int x, y; - FilterParam f= *fp; - const uint8_t* const srcArray[MP_MAX_PLANES] = {src}; - uint8_t *dstArray[MP_MAX_PLANES]= {dst}; - int srcStrideArray[MP_MAX_PLANES]= {srcStride}; - int dstStrideArray[MP_MAX_PLANES]= {dstStride}; - - sws_scale(f.filterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray); - - if(f.threshold > 0){ - for(y=0; y 0){ - if(diff > 2*f.threshold){ - dst[x + y*dstStride]= orig; - }else if(diff > f.threshold){ - dst[x + y*dstStride]= filtered + diff - f.threshold; - } - }else{ - if(-diff > 2*f.threshold){ - dst[x + y*dstStride]= orig; - }else if(-diff > f.threshold){ - dst[x + y*dstStride]= filtered + diff + f.threshold; - } - } - } - } - }else if(f.threshold < 0){ - for(y=0; y 0){ - if(diff > -2*f.threshold){ - }else if(diff > -f.threshold){ - dst[x + y*dstStride]= orig - diff - f.threshold; - }else - dst[x + y*dstStride]= orig; - }else{ - if(diff < 2*f.threshold){ - }else if(diff < f.threshold){ - dst[x + y*dstStride]= orig - diff + f.threshold; - }else - dst[x + y*dstStride]= orig; - } - } - } - } + int x, y; + FilterParam f= *fp; + const uint8_t* const srcArray[MP_MAX_PLANES] = {src}; + uint8_t *dstArray[MP_MAX_PLANES]= {dst}; + int srcStrideArray[MP_MAX_PLANES]= {srcStride}; + int dstStrideArray[MP_MAX_PLANES]= {dstStride}; + + sws_scale(f.filterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray); + + if(f.threshold > 0){ + for(y=0; y 0){ + if(diff > 2*f.threshold){ + dst[x + y*dstStride]= orig; + }else if(diff > f.threshold){ + dst[x + y*dstStride]= filtered + diff - f.threshold; + } + }else{ + if(-diff > 2*f.threshold){ + dst[x + y*dstStride]= orig; + }else if(-diff > f.threshold){ + dst[x + y*dstStride]= filtered + diff + f.threshold; + } + } + } + } + }else if(f.threshold < 0){ + for(y=0; y 0){ + if(diff > -2*f.threshold){ + }else if(diff > -f.threshold){ + dst[x + y*dstStride]= orig - diff - f.threshold; + }else + dst[x + y*dstStride]= orig; + }else{ + if(diff < 2*f.threshold){ + }else if(diff < f.threshold){ + dst[x + y*dstStride]= orig - diff + f.threshold; + }else + dst[x + y*dstStride]= orig; + } + } + } + } } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ - int cw= mpi->w >> mpi->chroma_x_shift; - int ch= mpi->h >> mpi->chroma_y_shift; - FilterParam *f= &vf->priv; + int cw= mpi->w >> mpi->chroma_x_shift; + int ch= mpi->h >> mpi->chroma_y_shift; + FilterParam *f= &vf->priv; - mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE| - (f->threshold) ? MP_IMGFLAG_READABLE : 0, - mpi->w,mpi->h); + mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE| + (f->threshold) ? MP_IMGFLAG_READABLE : 0, + mpi->w,mpi->h); - assert(mpi->flags&MP_IMGFLAG_PLANAR); + assert(mpi->flags&MP_IMGFLAG_PLANAR); - blur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], &vf->priv->luma); - blur(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], &vf->priv->chroma); - blur(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], &vf->priv->chroma); + blur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], &vf->priv->luma); + blur(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], &vf->priv->chroma); + blur(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], &vf->priv->chroma); - return vf_next_put_image(vf,dmpi, pts); + return vf_next_put_image(vf,dmpi, pts); } //===========================================================================// static int query_format(struct vf_instance *vf, unsigned int fmt){ - switch(fmt) - { - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_YVU9: - case IMGFMT_444P: - case IMGFMT_422P: - case IMGFMT_411P: - return vf_next_query_format(vf, fmt); - } - return 0; + switch(fmt) + { + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YVU9: + case IMGFMT_444P: + case IMGFMT_422P: + case IMGFMT_411P: + return vf_next_query_format(vf, fmt); + } + return 0; } static int vf_open(vf_instance_t *vf, char *args){ - int e; - - vf->config=config; - vf->put_image=put_image; -// vf->get_image=get_image; - vf->query_format=query_format; - vf->uninit=uninit; - vf->priv=malloc(sizeof(struct vf_priv_s)); - memset(vf->priv, 0, sizeof(struct vf_priv_s)); - - if(args==NULL) return 0; - - e=sscanf(args, "%f:%f:%d:%f:%f:%d", - &vf->priv->luma.radius, - &vf->priv->luma.strength, - &vf->priv->luma.threshold, - &vf->priv->chroma.radius, - &vf->priv->chroma.strength, - &vf->priv->chroma.threshold - ); - - vf->priv->luma.quality = vf->priv->chroma.quality= 3.0; - - if(e==3){ - vf->priv->chroma.radius= vf->priv->luma.radius; - vf->priv->chroma.strength= vf->priv->luma.strength; - vf->priv->chroma.threshold = vf->priv->luma.threshold; - }else if(e!=6) - return 0; - - return 1; + int e; + + vf->config=config; + vf->put_image=put_image; +// vf->get_image=get_image; + vf->query_format=query_format; + vf->uninit=uninit; + vf->priv=malloc(sizeof(struct vf_priv_s)); + memset(vf->priv, 0, sizeof(struct vf_priv_s)); + + if(args==NULL) return 0; + + e=sscanf(args, "%f:%f:%d:%f:%f:%d", + &vf->priv->luma.radius, + &vf->priv->luma.strength, + &vf->priv->luma.threshold, + &vf->priv->chroma.radius, + &vf->priv->chroma.strength, + &vf->priv->chroma.threshold + ); + + vf->priv->luma.quality = vf->priv->chroma.quality= 3.0; + + if(e==3){ + vf->priv->chroma.radius= vf->priv->luma.radius; + vf->priv->chroma.strength= vf->priv->luma.strength; + vf->priv->chroma.threshold = vf->priv->luma.threshold; + }else if(e!=6) + return 0; + + return 1; } const vf_info_t vf_info_smartblur = { diff --git a/mplayer/libmpcodecs/vf_softpulldown.c b/mplayer/libmpcodecs/vf_softpulldown.c index a76a3d30..41107686 100644 --- a/mplayer/libmpcodecs/vf_softpulldown.c +++ b/mplayer/libmpcodecs/vf_softpulldown.c @@ -30,128 +30,128 @@ #include "libvo/fastmemcpy.h" struct vf_priv_s { - int state; - long long in; - long long out; + int state; + long long in; + long long out; }; static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { - mp_image_t *dmpi; - int ret = 0; - int flags = mpi->fields; - int state = vf->priv->state; - - dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | - MP_IMGFLAG_PRESERVE, mpi->width, mpi->height); - - vf->priv->in++; - - if ((state == 0 && - !(flags & MP_IMGFIELD_TOP_FIRST)) || - (state == 1 && - flags & MP_IMGFIELD_TOP_FIRST)) { - mp_msg(MSGT_VFILTER, MSGL_WARN, - "softpulldown: Unexpected field flags: state=%d top_field_first=%d repeat_first_field=%d\n", - state, - (flags & MP_IMGFIELD_TOP_FIRST) != 0, - (flags & MP_IMGFIELD_REPEAT_FIRST) != 0); - state ^= 1; - } - - if (state == 0) { - ret = vf_next_put_image(vf, mpi, MP_NOPTS_VALUE); - vf->priv->out++; - if (flags & MP_IMGFIELD_REPEAT_FIRST) { - my_memcpy_pic(dmpi->planes[0], - mpi->planes[0], mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1], - mpi->planes[1], - mpi->chroma_width, - mpi->chroma_height/2, - dmpi->stride[1]*2, - mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2], - mpi->planes[2], - mpi->chroma_width, - mpi->chroma_height/2, - dmpi->stride[2]*2, - mpi->stride[2]*2); - } - state=1; - } - } else { - my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], - mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], - mpi->planes[1]+mpi->stride[1], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[1]*2, mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], - mpi->planes[2]+mpi->stride[2], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[2]*2, mpi->stride[2]*2); - } - ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); - vf->priv->out++; - if (flags & MP_IMGFIELD_REPEAT_FIRST) { - ret |= vf_next_put_image(vf, mpi, MP_NOPTS_VALUE); - vf->priv->out++; - state=0; - } else { - my_memcpy_pic(dmpi->planes[0], - mpi->planes[0], mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1], - mpi->planes[1], - mpi->chroma_width, - mpi->chroma_height/2, - dmpi->stride[1]*2, - mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2], - mpi->planes[2], - mpi->chroma_width, - mpi->chroma_height/2, - dmpi->stride[2]*2, - mpi->stride[2]*2); - } - } - } - - vf->priv->state = state; - - return ret; + mp_image_t *dmpi; + int ret = 0; + int flags = mpi->fields; + int state = vf->priv->state; + + dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | + MP_IMGFLAG_PRESERVE, mpi->width, mpi->height); + + vf->priv->in++; + + if ((state == 0 && + !(flags & MP_IMGFIELD_TOP_FIRST)) || + (state == 1 && + flags & MP_IMGFIELD_TOP_FIRST)) { + mp_msg(MSGT_VFILTER, MSGL_WARN, + "softpulldown: Unexpected field flags: state=%d top_field_first=%d repeat_first_field=%d\n", + state, + (flags & MP_IMGFIELD_TOP_FIRST) != 0, + (flags & MP_IMGFIELD_REPEAT_FIRST) != 0); + state ^= 1; + } + + if (state == 0) { + ret = vf_next_put_image(vf, mpi, MP_NOPTS_VALUE); + vf->priv->out++; + if (flags & MP_IMGFIELD_REPEAT_FIRST) { + my_memcpy_pic(dmpi->planes[0], + mpi->planes[0], mpi->w, mpi->h/2, + dmpi->stride[0]*2, mpi->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(dmpi->planes[1], + mpi->planes[1], + mpi->chroma_width, + mpi->chroma_height/2, + dmpi->stride[1]*2, + mpi->stride[1]*2); + my_memcpy_pic(dmpi->planes[2], + mpi->planes[2], + mpi->chroma_width, + mpi->chroma_height/2, + dmpi->stride[2]*2, + mpi->stride[2]*2); + } + state=1; + } + } else { + my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], + mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2, + dmpi->stride[0]*2, mpi->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], + mpi->planes[1]+mpi->stride[1], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[1]*2, mpi->stride[1]*2); + my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], + mpi->planes[2]+mpi->stride[2], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[2]*2, mpi->stride[2]*2); + } + ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); + vf->priv->out++; + if (flags & MP_IMGFIELD_REPEAT_FIRST) { + ret |= vf_next_put_image(vf, mpi, MP_NOPTS_VALUE); + vf->priv->out++; + state=0; + } else { + my_memcpy_pic(dmpi->planes[0], + mpi->planes[0], mpi->w, mpi->h/2, + dmpi->stride[0]*2, mpi->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(dmpi->planes[1], + mpi->planes[1], + mpi->chroma_width, + mpi->chroma_height/2, + dmpi->stride[1]*2, + mpi->stride[1]*2); + my_memcpy_pic(dmpi->planes[2], + mpi->planes[2], + mpi->chroma_width, + mpi->chroma_height/2, + dmpi->stride[2]*2, + mpi->stride[2]*2); + } + } + } + + vf->priv->state = state; + + return ret; } static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt) { - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static void uninit(struct vf_instance *vf) { - mp_msg(MSGT_VFILTER, MSGL_INFO, "softpulldown: %lld frames in, %lld frames out\n", vf->priv->in, vf->priv->out); - free(vf->priv); + mp_msg(MSGT_VFILTER, MSGL_INFO, "softpulldown: %lld frames in, %lld frames out\n", vf->priv->in, vf->priv->out); + free(vf->priv); } static int vf_open(vf_instance_t *vf, char *args) { - struct vf_priv_s *p; - vf->config = config; - vf->put_image = put_image; - vf->uninit = uninit; - vf->default_reqs = VFCAP_ACCEPT_STRIDE; - vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); - vf->priv->state = 0; - return 1; + struct vf_priv_s *p; + vf->config = config; + vf->put_image = put_image; + vf->uninit = uninit; + vf->default_reqs = VFCAP_ACCEPT_STRIDE; + vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); + vf->priv->state = 0; + return 1; } const vf_info_t vf_info_softpulldown = { diff --git a/mplayer/libmpcodecs/vf_softskip.c b/mplayer/libmpcodecs/vf_softskip.c index d852cf23..e0105de5 100644 --- a/mplayer/libmpcodecs/vf_softskip.c +++ b/mplayer/libmpcodecs/vf_softskip.c @@ -28,68 +28,68 @@ #include "vf.h" struct vf_priv_s { - int skipflag; + int skipflag; }; static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { - mp_image_t *dmpi; + mp_image_t *dmpi; - if (vf->priv->skipflag) - return vf->priv->skipflag = 0; + if (vf->priv->skipflag) + return vf->priv->skipflag = 0; - dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height); - vf_clone_mpi_attributes(dmpi, mpi); + dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height); + vf_clone_mpi_attributes(dmpi, mpi); - dmpi->planes[0] = mpi->planes[0]; - dmpi->stride[0] = mpi->stride[0]; - if (dmpi->flags&MP_IMGFLAG_PLANAR) { - dmpi->planes[1] = mpi->planes[1]; - dmpi->stride[1] = mpi->stride[1]; - dmpi->planes[2] = mpi->planes[2]; - dmpi->stride[2] = mpi->stride[2]; - } + dmpi->planes[0] = mpi->planes[0]; + dmpi->stride[0] = mpi->stride[0]; + if (dmpi->flags&MP_IMGFLAG_PLANAR) { + dmpi->planes[1] = mpi->planes[1]; + dmpi->stride[1] = mpi->stride[1]; + dmpi->planes[2] = mpi->planes[2]; + dmpi->stride[2] = mpi->stride[2]; + } - return vf_next_put_image(vf, dmpi, pts); + return vf_next_put_image(vf, dmpi, pts); } static int control(struct vf_instance *vf, int request, void* data) { - switch (request) { - case VFCTRL_SKIP_NEXT_FRAME: - vf->priv->skipflag = 1; - return CONTROL_TRUE; - } - return vf_next_control(vf, request, data); + switch (request) { + case VFCTRL_SKIP_NEXT_FRAME: + vf->priv->skipflag = 1; + return CONTROL_TRUE; + } + return vf_next_control(vf, request, data); } #if 0 static int query_format(struct vf_instance *vf, unsigned int fmt) { - /* FIXME - figure out which other formats work */ - switch (fmt) { - case IMGFMT_YV12: - case IMGFMT_IYUV: - case IMGFMT_I420: - return vf_next_query_format(vf, fmt); - } - return 0; + /* FIXME - figure out which other formats work */ + switch (fmt) { + case IMGFMT_YV12: + case IMGFMT_IYUV: + case IMGFMT_I420: + return vf_next_query_format(vf, fmt); + } + return 0; } #endif static void uninit(struct vf_instance *vf) { - free(vf->priv); + free(vf->priv); } static int vf_open(vf_instance_t *vf, char *args) { - vf->put_image = put_image; - vf->control = control; - vf->uninit = uninit; - vf->priv = calloc(1, sizeof(struct vf_priv_s)); - return 1; + vf->put_image = put_image; + vf->control = control; + vf->uninit = uninit; + vf->priv = calloc(1, sizeof(struct vf_priv_s)); + return 1; } const vf_info_t vf_info_softskip = { diff --git a/mplayer/libmpcodecs/vf_spp.c b/mplayer/libmpcodecs/vf_spp.c index ebd87a82..b1229588 100644 --- a/mplayer/libmpcodecs/vf_spp.c +++ b/mplayer/libmpcodecs/vf_spp.c @@ -91,282 +91,282 @@ static const uint8_t offset[127][2]= { }; struct vf_priv_s { - int log2_count; - int qp; - int mode; - int mpeg2; - int temp_stride; - uint8_t *src; - int16_t *temp; - AVCodecContext *avctx; - DSPContext dsp; + int log2_count; + int qp; + int mode; + int mpeg2; + int temp_stride; + uint8_t *src; + int16_t *temp; + AVCodecContext *avctx; + DSPContext dsp; char *non_b_qp; }; #define SHIFT 22 static void hardthresh_c(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){ - int i; - int bias= 0; //FIXME - unsigned int threshold1, threshold2; + int i; + int bias= 0; //FIXME + unsigned int threshold1, threshold2; - threshold1= qp*((1<<4) - bias) - 1; - threshold2= (threshold1<<1); + threshold1= qp*((1<<4) - bias) - 1; + threshold2= (threshold1<<1); - memset(dst, 0, 64*sizeof(DCTELEM)); - dst[0]= (src[0] + 4)>>3; + memset(dst, 0, 64*sizeof(DCTELEM)); + dst[0]= (src[0] + 4)>>3; for(i=1; i<64; i++){ - int level= src[i]; - if(((unsigned)(level+threshold1))>threshold2){ - const int j= permutation[i]; - dst[j]= (level + 4)>>3; - } - } + int level= src[i]; + if(((unsigned)(level+threshold1))>threshold2){ + const int j= permutation[i]; + dst[j]= (level + 4)>>3; + } + } } static void softthresh_c(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){ - int i; - int bias= 0; //FIXME - unsigned int threshold1, threshold2; + int i; + int bias= 0; //FIXME + unsigned int threshold1, threshold2; - threshold1= qp*((1<<4) - bias) - 1; - threshold2= (threshold1<<1); + threshold1= qp*((1<<4) - bias) - 1; + threshold2= (threshold1<<1); - memset(dst, 0, 64*sizeof(DCTELEM)); - dst[0]= (src[0] + 4)>>3; + memset(dst, 0, 64*sizeof(DCTELEM)); + dst[0]= (src[0] + 4)>>3; for(i=1; i<64; i++){ - int level= src[i]; - if(((unsigned)(level+threshold1))>threshold2){ - const int j= permutation[i]; - if(level>0) - dst[j]= (level - threshold1 + 4)>>3; - else - dst[j]= (level + threshold1 + 4)>>3; - } - } + int level= src[i]; + if(((unsigned)(level+threshold1))>threshold2){ + const int j= permutation[i]; + if(level>0) + dst[j]= (level - threshold1 + 4)>>3; + else + dst[j]= (level + threshold1 + 4)>>3; + } + } } #if HAVE_MMX static void hardthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){ - int bias= 0; //FIXME - unsigned int threshold1; + int bias= 0; //FIXME + unsigned int threshold1; - threshold1= qp*((1<<4) - bias) - 1; + threshold1= qp*((1<<4) - bias) - 1; __asm__ volatile( #define REQUANT_CORE(dst0, dst1, dst2, dst3, src0, src1, src2, src3) \ - "movq " #src0 ", %%mm0 \n\t"\ - "movq " #src1 ", %%mm1 \n\t"\ - "movq " #src2 ", %%mm2 \n\t"\ - "movq " #src3 ", %%mm3 \n\t"\ - "psubw %%mm4, %%mm0 \n\t"\ - "psubw %%mm4, %%mm1 \n\t"\ - "psubw %%mm4, %%mm2 \n\t"\ - "psubw %%mm4, %%mm3 \n\t"\ - "paddusw %%mm5, %%mm0 \n\t"\ - "paddusw %%mm5, %%mm1 \n\t"\ - "paddusw %%mm5, %%mm2 \n\t"\ - "paddusw %%mm5, %%mm3 \n\t"\ - "paddw %%mm6, %%mm0 \n\t"\ - "paddw %%mm6, %%mm1 \n\t"\ - "paddw %%mm6, %%mm2 \n\t"\ - "paddw %%mm6, %%mm3 \n\t"\ - "psubusw %%mm6, %%mm0 \n\t"\ - "psubusw %%mm6, %%mm1 \n\t"\ - "psubusw %%mm6, %%mm2 \n\t"\ - "psubusw %%mm6, %%mm3 \n\t"\ - "psraw $3, %%mm0 \n\t"\ - "psraw $3, %%mm1 \n\t"\ - "psraw $3, %%mm2 \n\t"\ - "psraw $3, %%mm3 \n\t"\ + "movq " #src0 ", %%mm0 \n\t"\ + "movq " #src1 ", %%mm1 \n\t"\ + "movq " #src2 ", %%mm2 \n\t"\ + "movq " #src3 ", %%mm3 \n\t"\ + "psubw %%mm4, %%mm0 \n\t"\ + "psubw %%mm4, %%mm1 \n\t"\ + "psubw %%mm4, %%mm2 \n\t"\ + "psubw %%mm4, %%mm3 \n\t"\ + "paddusw %%mm5, %%mm0 \n\t"\ + "paddusw %%mm5, %%mm1 \n\t"\ + "paddusw %%mm5, %%mm2 \n\t"\ + "paddusw %%mm5, %%mm3 \n\t"\ + "paddw %%mm6, %%mm0 \n\t"\ + "paddw %%mm6, %%mm1 \n\t"\ + "paddw %%mm6, %%mm2 \n\t"\ + "paddw %%mm6, %%mm3 \n\t"\ + "psubusw %%mm6, %%mm0 \n\t"\ + "psubusw %%mm6, %%mm1 \n\t"\ + "psubusw %%mm6, %%mm2 \n\t"\ + "psubusw %%mm6, %%mm3 \n\t"\ + "psraw $3, %%mm0 \n\t"\ + "psraw $3, %%mm1 \n\t"\ + "psraw $3, %%mm2 \n\t"\ + "psraw $3, %%mm3 \n\t"\ \ - "movq %%mm0, %%mm7 \n\t"\ - "punpcklwd %%mm2, %%mm0 \n\t" /*A*/\ - "punpckhwd %%mm2, %%mm7 \n\t" /*C*/\ - "movq %%mm1, %%mm2 \n\t"\ - "punpcklwd %%mm3, %%mm1 \n\t" /*B*/\ - "punpckhwd %%mm3, %%mm2 \n\t" /*D*/\ - "movq %%mm0, %%mm3 \n\t"\ - "punpcklwd %%mm1, %%mm0 \n\t" /*A*/\ - "punpckhwd %%mm7, %%mm3 \n\t" /*C*/\ - "punpcklwd %%mm2, %%mm7 \n\t" /*B*/\ - "punpckhwd %%mm2, %%mm1 \n\t" /*D*/\ + "movq %%mm0, %%mm7 \n\t"\ + "punpcklwd %%mm2, %%mm0 \n\t" /*A*/\ + "punpckhwd %%mm2, %%mm7 \n\t" /*C*/\ + "movq %%mm1, %%mm2 \n\t"\ + "punpcklwd %%mm3, %%mm1 \n\t" /*B*/\ + "punpckhwd %%mm3, %%mm2 \n\t" /*D*/\ + "movq %%mm0, %%mm3 \n\t"\ + "punpcklwd %%mm1, %%mm0 \n\t" /*A*/\ + "punpckhwd %%mm7, %%mm3 \n\t" /*C*/\ + "punpcklwd %%mm2, %%mm7 \n\t" /*B*/\ + "punpckhwd %%mm2, %%mm1 \n\t" /*D*/\ \ - "movq %%mm0, " #dst0 " \n\t"\ - "movq %%mm7, " #dst1 " \n\t"\ - "movq %%mm3, " #dst2 " \n\t"\ - "movq %%mm1, " #dst3 " \n\t" - - "movd %2, %%mm4 \n\t" - "movd %3, %%mm5 \n\t" - "movd %4, %%mm6 \n\t" - "packssdw %%mm4, %%mm4 \n\t" - "packssdw %%mm5, %%mm5 \n\t" - "packssdw %%mm6, %%mm6 \n\t" - "packssdw %%mm4, %%mm4 \n\t" - "packssdw %%mm5, %%mm5 \n\t" - "packssdw %%mm6, %%mm6 \n\t" - REQUANT_CORE( (%1), 8(%1), 16(%1), 24(%1), (%0), 8(%0), 64(%0), 72(%0)) - REQUANT_CORE(32(%1), 40(%1), 48(%1), 56(%1),16(%0),24(%0), 48(%0), 56(%0)) - REQUANT_CORE(64(%1), 72(%1), 80(%1), 88(%1),32(%0),40(%0), 96(%0),104(%0)) - REQUANT_CORE(96(%1),104(%1),112(%1),120(%1),80(%0),88(%0),112(%0),120(%0)) - : : "r" (src), "r" (dst), "g" (threshold1+1), "g" (threshold1+5), "g" (threshold1-4) //FIXME maybe more accurate then needed? - ); - dst[0]= (src[0] + 4)>>3; + "movq %%mm0, " #dst0 " \n\t"\ + "movq %%mm7, " #dst1 " \n\t"\ + "movq %%mm3, " #dst2 " \n\t"\ + "movq %%mm1, " #dst3 " \n\t" + + "movd %2, %%mm4 \n\t" + "movd %3, %%mm5 \n\t" + "movd %4, %%mm6 \n\t" + "packssdw %%mm4, %%mm4 \n\t" + "packssdw %%mm5, %%mm5 \n\t" + "packssdw %%mm6, %%mm6 \n\t" + "packssdw %%mm4, %%mm4 \n\t" + "packssdw %%mm5, %%mm5 \n\t" + "packssdw %%mm6, %%mm6 \n\t" + REQUANT_CORE( (%1), 8(%1), 16(%1), 24(%1), (%0), 8(%0), 64(%0), 72(%0)) + REQUANT_CORE(32(%1), 40(%1), 48(%1), 56(%1),16(%0),24(%0), 48(%0), 56(%0)) + REQUANT_CORE(64(%1), 72(%1), 80(%1), 88(%1),32(%0),40(%0), 96(%0),104(%0)) + REQUANT_CORE(96(%1),104(%1),112(%1),120(%1),80(%0),88(%0),112(%0),120(%0)) + : : "r" (src), "r" (dst), "g" (threshold1+1), "g" (threshold1+5), "g" (threshold1-4) //FIXME maybe more accurate then needed? + ); + dst[0]= (src[0] + 4)>>3; } static void softthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){ - int bias= 0; //FIXME - unsigned int threshold1; + int bias= 0; //FIXME + unsigned int threshold1; - threshold1= qp*((1<<4) - bias) - 1; + threshold1= qp*((1<<4) - bias) - 1; __asm__ volatile( #undef REQUANT_CORE #define REQUANT_CORE(dst0, dst1, dst2, dst3, src0, src1, src2, src3) \ - "movq " #src0 ", %%mm0 \n\t"\ - "movq " #src1 ", %%mm1 \n\t"\ - "pxor %%mm6, %%mm6 \n\t"\ - "pxor %%mm7, %%mm7 \n\t"\ - "pcmpgtw %%mm0, %%mm6 \n\t"\ - "pcmpgtw %%mm1, %%mm7 \n\t"\ - "pxor %%mm6, %%mm0 \n\t"\ - "pxor %%mm7, %%mm1 \n\t"\ - "psubusw %%mm4, %%mm0 \n\t"\ - "psubusw %%mm4, %%mm1 \n\t"\ - "pxor %%mm6, %%mm0 \n\t"\ - "pxor %%mm7, %%mm1 \n\t"\ - "movq " #src2 ", %%mm2 \n\t"\ - "movq " #src3 ", %%mm3 \n\t"\ - "pxor %%mm6, %%mm6 \n\t"\ - "pxor %%mm7, %%mm7 \n\t"\ - "pcmpgtw %%mm2, %%mm6 \n\t"\ - "pcmpgtw %%mm3, %%mm7 \n\t"\ - "pxor %%mm6, %%mm2 \n\t"\ - "pxor %%mm7, %%mm3 \n\t"\ - "psubusw %%mm4, %%mm2 \n\t"\ - "psubusw %%mm4, %%mm3 \n\t"\ - "pxor %%mm6, %%mm2 \n\t"\ - "pxor %%mm7, %%mm3 \n\t"\ + "movq " #src0 ", %%mm0 \n\t"\ + "movq " #src1 ", %%mm1 \n\t"\ + "pxor %%mm6, %%mm6 \n\t"\ + "pxor %%mm7, %%mm7 \n\t"\ + "pcmpgtw %%mm0, %%mm6 \n\t"\ + "pcmpgtw %%mm1, %%mm7 \n\t"\ + "pxor %%mm6, %%mm0 \n\t"\ + "pxor %%mm7, %%mm1 \n\t"\ + "psubusw %%mm4, %%mm0 \n\t"\ + "psubusw %%mm4, %%mm1 \n\t"\ + "pxor %%mm6, %%mm0 \n\t"\ + "pxor %%mm7, %%mm1 \n\t"\ + "movq " #src2 ", %%mm2 \n\t"\ + "movq " #src3 ", %%mm3 \n\t"\ + "pxor %%mm6, %%mm6 \n\t"\ + "pxor %%mm7, %%mm7 \n\t"\ + "pcmpgtw %%mm2, %%mm6 \n\t"\ + "pcmpgtw %%mm3, %%mm7 \n\t"\ + "pxor %%mm6, %%mm2 \n\t"\ + "pxor %%mm7, %%mm3 \n\t"\ + "psubusw %%mm4, %%mm2 \n\t"\ + "psubusw %%mm4, %%mm3 \n\t"\ + "pxor %%mm6, %%mm2 \n\t"\ + "pxor %%mm7, %%mm3 \n\t"\ \ - "paddsw %%mm5, %%mm0 \n\t"\ - "paddsw %%mm5, %%mm1 \n\t"\ - "paddsw %%mm5, %%mm2 \n\t"\ - "paddsw %%mm5, %%mm3 \n\t"\ - "psraw $3, %%mm0 \n\t"\ - "psraw $3, %%mm1 \n\t"\ - "psraw $3, %%mm2 \n\t"\ - "psraw $3, %%mm3 \n\t"\ + "paddsw %%mm5, %%mm0 \n\t"\ + "paddsw %%mm5, %%mm1 \n\t"\ + "paddsw %%mm5, %%mm2 \n\t"\ + "paddsw %%mm5, %%mm3 \n\t"\ + "psraw $3, %%mm0 \n\t"\ + "psraw $3, %%mm1 \n\t"\ + "psraw $3, %%mm2 \n\t"\ + "psraw $3, %%mm3 \n\t"\ \ - "movq %%mm0, %%mm7 \n\t"\ - "punpcklwd %%mm2, %%mm0 \n\t" /*A*/\ - "punpckhwd %%mm2, %%mm7 \n\t" /*C*/\ - "movq %%mm1, %%mm2 \n\t"\ - "punpcklwd %%mm3, %%mm1 \n\t" /*B*/\ - "punpckhwd %%mm3, %%mm2 \n\t" /*D*/\ - "movq %%mm0, %%mm3 \n\t"\ - "punpcklwd %%mm1, %%mm0 \n\t" /*A*/\ - "punpckhwd %%mm7, %%mm3 \n\t" /*C*/\ - "punpcklwd %%mm2, %%mm7 \n\t" /*B*/\ - "punpckhwd %%mm2, %%mm1 \n\t" /*D*/\ + "movq %%mm0, %%mm7 \n\t"\ + "punpcklwd %%mm2, %%mm0 \n\t" /*A*/\ + "punpckhwd %%mm2, %%mm7 \n\t" /*C*/\ + "movq %%mm1, %%mm2 \n\t"\ + "punpcklwd %%mm3, %%mm1 \n\t" /*B*/\ + "punpckhwd %%mm3, %%mm2 \n\t" /*D*/\ + "movq %%mm0, %%mm3 \n\t"\ + "punpcklwd %%mm1, %%mm0 \n\t" /*A*/\ + "punpckhwd %%mm7, %%mm3 \n\t" /*C*/\ + "punpcklwd %%mm2, %%mm7 \n\t" /*B*/\ + "punpckhwd %%mm2, %%mm1 \n\t" /*D*/\ \ - "movq %%mm0, " #dst0 " \n\t"\ - "movq %%mm7, " #dst1 " \n\t"\ - "movq %%mm3, " #dst2 " \n\t"\ - "movq %%mm1, " #dst3 " \n\t" - - "movd %2, %%mm4 \n\t" - "movd %3, %%mm5 \n\t" - "packssdw %%mm4, %%mm4 \n\t" - "packssdw %%mm5, %%mm5 \n\t" - "packssdw %%mm4, %%mm4 \n\t" - "packssdw %%mm5, %%mm5 \n\t" - REQUANT_CORE( (%1), 8(%1), 16(%1), 24(%1), (%0), 8(%0), 64(%0), 72(%0)) - REQUANT_CORE(32(%1), 40(%1), 48(%1), 56(%1),16(%0),24(%0), 48(%0), 56(%0)) - REQUANT_CORE(64(%1), 72(%1), 80(%1), 88(%1),32(%0),40(%0), 96(%0),104(%0)) - REQUANT_CORE(96(%1),104(%1),112(%1),120(%1),80(%0),88(%0),112(%0),120(%0)) - : : "r" (src), "r" (dst), "g" (threshold1), "rm" (4) //FIXME maybe more accurate then needed? - ); - - dst[0]= (src[0] + 4)>>3; + "movq %%mm0, " #dst0 " \n\t"\ + "movq %%mm7, " #dst1 " \n\t"\ + "movq %%mm3, " #dst2 " \n\t"\ + "movq %%mm1, " #dst3 " \n\t" + + "movd %2, %%mm4 \n\t" + "movd %3, %%mm5 \n\t" + "packssdw %%mm4, %%mm4 \n\t" + "packssdw %%mm5, %%mm5 \n\t" + "packssdw %%mm4, %%mm4 \n\t" + "packssdw %%mm5, %%mm5 \n\t" + REQUANT_CORE( (%1), 8(%1), 16(%1), 24(%1), (%0), 8(%0), 64(%0), 72(%0)) + REQUANT_CORE(32(%1), 40(%1), 48(%1), 56(%1),16(%0),24(%0), 48(%0), 56(%0)) + REQUANT_CORE(64(%1), 72(%1), 80(%1), 88(%1),32(%0),40(%0), 96(%0),104(%0)) + REQUANT_CORE(96(%1),104(%1),112(%1),120(%1),80(%0),88(%0),112(%0),120(%0)) + : : "r" (src), "r" (dst), "g" (threshold1), "rm" (4) //FIXME maybe more accurate then needed? + ); + + dst[0]= (src[0] + 4)>>3; } #endif static inline void add_block(int16_t *dst, int stride, DCTELEM block[64]){ - int y; - - for(y=0; y<8; y++){ - *(uint32_t*)&dst[0 + y*stride]+= *(uint32_t*)&block[0 + y*8]; - *(uint32_t*)&dst[2 + y*stride]+= *(uint32_t*)&block[2 + y*8]; - *(uint32_t*)&dst[4 + y*stride]+= *(uint32_t*)&block[4 + y*8]; - *(uint32_t*)&dst[6 + y*stride]+= *(uint32_t*)&block[6 + y*8]; - } + int y; + + for(y=0; y<8; y++){ + *(uint32_t*)&dst[0 + y*stride]+= *(uint32_t*)&block[0 + y*8]; + *(uint32_t*)&dst[2 + y*stride]+= *(uint32_t*)&block[2 + y*8]; + *(uint32_t*)&dst[4 + y*stride]+= *(uint32_t*)&block[4 + y*8]; + *(uint32_t*)&dst[6 + y*stride]+= *(uint32_t*)&block[6 + y*8]; + } } static void store_slice_c(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale){ - int y, x; + int y, x; #define STORE(pos) \ - temp= ((src[x + y*src_stride + pos]<>6;\ - if(temp & 0x100) temp= ~(temp>>31);\ - dst[x + y*dst_stride + pos]= temp; - - for(y=0; y>6;\ + if(temp & 0x100) temp= ~(temp>>31);\ + dst[x + y*dst_stride + pos]= temp; + + for(y=0; ylog2_count; - const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15)); - uint64_t __attribute__((aligned(16))) block_align[32]; - DCTELEM *block = (DCTELEM *)block_align; - DCTELEM *block2= (DCTELEM *)(block_align+16); - - if (!src || !dst) return; // HACK avoid crash for Y8 colourspace - for(y=0; ysrc + index, src + y*src_stride, width); - for(x=0; x<8; x++){ - p->src[index - x - 1]= p->src[index + x ]; - p->src[index + width + x ]= p->src[index + width - x - 1]; - } - } - for(y=0; y<8; y++){ - fast_memcpy(p->src + ( 7-y)*stride, p->src + ( y+8)*stride, stride); - fast_memcpy(p->src + (height+8+y)*stride, p->src + (height-y+7)*stride, stride); - } - //FIXME (try edge emu) - - for(y=0; ytemp + (8+y)*stride, 0, 8*stride*sizeof(int16_t)); - for(x=0; xqp) - qp= p->qp; - else{ - qp= qp_store[ (XMIN(x, width-1)>>qps) + (XMIN(y, height-1)>>qps) * qp_stride]; - qp = FFMAX(1, norm_qscale(qp, p->mpeg2)); - } - for(i=0; idsp.get_pixels(block, p->src + index, stride); - p->dsp.fdct(block); - requantize(block2, block, qp, p->dsp.idct_permutation); - p->dsp.idct(block2); - add_block(p->temp + index, stride, block2); - } - } - if(y) - store_slice(dst + (y-8)*dst_stride, p->temp + 8 + y*stride, dst_stride, stride, width, XMIN(8, height+8-y), 6-p->log2_count); - } + int x, y, i; + const int count= 1<log2_count; + const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15)); + uint64_t __attribute__((aligned(16))) block_align[32]; + DCTELEM *block = (DCTELEM *)block_align; + DCTELEM *block2= (DCTELEM *)(block_align+16); + + if (!src || !dst) return; // HACK avoid crash for Y8 colourspace + for(y=0; ysrc + index, src + y*src_stride, width); + for(x=0; x<8; x++){ + p->src[index - x - 1]= p->src[index + x ]; + p->src[index + width + x ]= p->src[index + width - x - 1]; + } + } + for(y=0; y<8; y++){ + fast_memcpy(p->src + ( 7-y)*stride, p->src + ( y+8)*stride, stride); + fast_memcpy(p->src + (height+8+y)*stride, p->src + (height-y+7)*stride, stride); + } + //FIXME (try edge emu) + + for(y=0; ytemp + (8+y)*stride, 0, 8*stride*sizeof(int16_t)); + for(x=0; xqp) + qp= p->qp; + else{ + qp= qp_store[ (XMIN(x, width-1)>>qps) + (XMIN(y, height-1)>>qps) * qp_stride]; + qp = FFMAX(1, norm_qscale(qp, p->mpeg2)); + } + for(i=0; idsp.get_pixels(block, p->src + index, stride); + p->dsp.fdct(block); + requantize(block2, block, qp, p->dsp.idct_permutation); + p->dsp.idct(block2); + add_block(p->temp + index, stride, block2); + } + } + if(y) + store_slice(dst + (y-8)*dst_stride, p->temp + 8 + y*stride, dst_stride, stride, width, XMIN(8, height+8-y), 6-p->log2_count); + } #if 0 - for(y=0; y>6) ^ (y>>6)) & 1) == 0) - dst[x + y*dst_stride]= p->src[8 + 8*stride + x + y*stride]; - if((x&63) == 0 || (y&63)==0) - dst[x + y*dst_stride] += 128; + for(y=0; y>6) ^ (y>>6)) & 1) == 0) + dst[x + y*dst_stride]= p->src[8 + 8*stride + x + y*stride]; + if((x&63) == 0 || (y&63)==0) + dst[x + y*dst_stride] += 128; } - } + } #endif - //FIXME reorder for better caching + //FIXME reorder for better caching } static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ - int h= (height+16+15)&(~15); + unsigned int flags, unsigned int outfmt){ + int h= (height+16+15)&(~15); - vf->priv->temp_stride= (width+16+15)&(~15); + vf->priv->temp_stride= (width+16+15)&(~15); vf->priv->temp= malloc(vf->priv->temp_stride*h*sizeof(int16_t)); vf->priv->src = malloc(vf->priv->temp_stride*h*sizeof(uint8_t)); - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static void get_image(struct vf_instance *vf, mp_image_t *mpi){ @@ -459,17 +459,17 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi){ if(mpi->flags&MP_IMGFLAG_PLANAR){ mpi->planes[1]=vf->dmpi->planes[1]; mpi->planes[2]=vf->dmpi->planes[2]; - mpi->stride[1]=vf->dmpi->stride[1]; - mpi->stride[2]=vf->dmpi->stride[2]; + mpi->stride[1]=vf->dmpi->stride[1]; + mpi->stride[2]=vf->dmpi->stride[2]; } mpi->flags|=MP_IMGFLAG_DIRECT; } static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ - mp_image_t *dmpi; + mp_image_t *dmpi; - if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ - // no DR, so get a new image! hope we'll get DR buffer: + if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ + // no DR, so get a new image! hope we'll get DR buffer: dmpi=vf_get_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE, @@ -491,63 +491,63 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ vf->priv->non_b_qp= malloc(w*h); fast_memcpy(vf->priv->non_b_qp, mpi->qscale, w*h); } - if(vf->priv->log2_count || !(mpi->flags&MP_IMGFLAG_DIRECT)){ + if(vf->priv->log2_count || !(mpi->flags&MP_IMGFLAG_DIRECT)){ char *qp_tab= vf->priv->non_b_qp; if((vf->priv->mode&4) || !qp_tab) qp_tab= mpi->qscale; - if(qp_tab || vf->priv->qp){ - filter(vf->priv, dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, qp_tab, mpi->qstride, 1); - filter(vf->priv, dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, qp_tab, mpi->qstride, 0); - filter(vf->priv, dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, qp_tab, mpi->qstride, 0); - }else{ - memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]); - memcpy_pic(dmpi->planes[1], mpi->planes[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[1], mpi->stride[1]); - memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[2], mpi->stride[2]); - } - } + if(qp_tab || vf->priv->qp){ + filter(vf->priv, dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, qp_tab, mpi->qstride, 1); + filter(vf->priv, dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, qp_tab, mpi->qstride, 0); + filter(vf->priv, dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, qp_tab, mpi->qstride, 0); + }else{ + memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]); + memcpy_pic(dmpi->planes[1], mpi->planes[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[1], mpi->stride[1]); + memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[2], mpi->stride[2]); + } + } #if HAVE_MMX - if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t"); + if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t"); #endif #if HAVE_MMX2 - if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t"); + if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t"); #endif - return vf_next_put_image(vf,dmpi, pts); + return vf_next_put_image(vf,dmpi, pts); } static void uninit(struct vf_instance *vf){ - if(!vf->priv) return; + if(!vf->priv) return; - free(vf->priv->temp); - vf->priv->temp= NULL; - free(vf->priv->src); - vf->priv->src= NULL; + free(vf->priv->temp); + vf->priv->temp= NULL; + free(vf->priv->src); + vf->priv->src= NULL; free(vf->priv->avctx); vf->priv->avctx= NULL; free(vf->priv->non_b_qp); vf->priv->non_b_qp= NULL; - free(vf->priv); - vf->priv=NULL; + free(vf->priv); + vf->priv=NULL; } //===========================================================================// static int query_format(struct vf_instance *vf, unsigned int fmt){ switch(fmt){ - case IMGFMT_YVU9: - case IMGFMT_IF09: - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_CLPL: - case IMGFMT_Y800: - case IMGFMT_Y8: - case IMGFMT_444P: - case IMGFMT_422P: - case IMGFMT_411P: - return vf_next_query_format(vf,fmt); + case IMGFMT_YVU9: + case IMGFMT_IF09: + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_CLPL: + case IMGFMT_Y800: + case IMGFMT_Y8: + case IMGFMT_444P: + case IMGFMT_422P: + case IMGFMT_411P: + return vf_next_query_format(vf,fmt); } return 0; } @@ -555,10 +555,10 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){ static int control(struct vf_instance *vf, int request, void* data){ switch(request){ case VFCTRL_QUERY_MAX_PP_LEVEL: - return 6; + return 6; case VFCTRL_SET_PP_LEVEL: - vf->priv->log2_count= *((unsigned int*)data); - return CONTROL_TRUE; + vf->priv->log2_count= *((unsigned int*)data); + return CONTROL_TRUE; } return vf_next_control(vf,request,data); } @@ -593,17 +593,17 @@ static int vf_open(vf_instance_t *vf, char *args){ switch(vf->priv->mode&3){ default: - case 0: requantize= hardthresh_c; break; - case 1: requantize= softthresh_c; break; + case 0: requantize= hardthresh_c; break; + case 1: requantize= softthresh_c; break; } #if HAVE_MMX if(gCpuCaps.hasMMX){ - store_slice= store_slice_mmx; - switch(vf->priv->mode&3){ - case 0: requantize= hardthresh_mmx; break; - case 1: requantize= softthresh_mmx; break; - } + store_slice= store_slice_mmx; + switch(vf->priv->mode&3){ + case 0: requantize= hardthresh_mmx; break; + case 1: requantize= softthresh_mmx; break; + } } #endif diff --git a/mplayer/libmpcodecs/vf_swapuv.c b/mplayer/libmpcodecs/vf_swapuv.c index e8a3c4c9..e063f4a8 100644 --- a/mplayer/libmpcodecs/vf_swapuv.c +++ b/mplayer/libmpcodecs/vf_swapuv.c @@ -34,7 +34,7 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi){ mp_image_t *dmpi= vf_get_image(vf->next, mpi->imgfmt, - mpi->type, mpi->flags, mpi->w, mpi->h); + mpi->type, mpi->flags, mpi->w, mpi->h); mpi->planes[0]=dmpi->planes[0]; mpi->planes[1]=dmpi->planes[2]; @@ -52,17 +52,17 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ mp_image_t *dmpi; if(mpi->flags&MP_IMGFLAG_DIRECT){ - dmpi=(mp_image_t*)mpi->priv; + dmpi=(mp_image_t*)mpi->priv; } else { - dmpi=vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h); - assert(mpi->flags&MP_IMGFLAG_PLANAR); - dmpi->planes[0]=mpi->planes[0]; - dmpi->planes[1]=mpi->planes[2]; - dmpi->planes[2]=mpi->planes[1]; - dmpi->stride[0]=mpi->stride[0]; - dmpi->stride[1]=mpi->stride[2]; - dmpi->stride[2]=mpi->stride[1]; - dmpi->width=mpi->width; + dmpi=vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h); + assert(mpi->flags&MP_IMGFLAG_PLANAR); + dmpi->planes[0]=mpi->planes[0]; + dmpi->planes[1]=mpi->planes[2]; + dmpi->planes[2]=mpi->planes[1]; + dmpi->stride[0]=mpi->stride[0]; + dmpi->stride[1]=mpi->stride[2]; + dmpi->stride[2]=mpi->stride[1]; + dmpi->width=mpi->width; } vf_clone_mpi_attributes(dmpi, mpi); @@ -73,18 +73,18 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ //===========================================================================// static int query_format(struct vf_instance *vf, unsigned int fmt){ - switch(fmt) - { - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_YVU9: - case IMGFMT_444P: - case IMGFMT_422P: - case IMGFMT_411P: - return vf_next_query_format(vf, fmt); - } - return 0; + switch(fmt) + { + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YVU9: + case IMGFMT_444P: + case IMGFMT_422P: + case IMGFMT_411P: + return vf_next_query_format(vf, fmt); + } + return 0; } static int vf_open(vf_instance_t *vf, char *args){ diff --git a/mplayer/libmpcodecs/vf_telecine.c b/mplayer/libmpcodecs/vf_telecine.c index c3a40766..d210c3ad 100644 --- a/mplayer/libmpcodecs/vf_telecine.c +++ b/mplayer/libmpcodecs/vf_telecine.c @@ -30,119 +30,119 @@ #include "libvo/fastmemcpy.h" struct vf_priv_s { - int frame; + int frame; }; static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { - mp_image_t *dmpi; - int ret; + mp_image_t *dmpi; + int ret; - vf->priv->frame = (vf->priv->frame+1)%4; + vf->priv->frame = (vf->priv->frame+1)%4; - dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | - MP_IMGFLAG_PRESERVE, mpi->width, mpi->height); + dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | + MP_IMGFLAG_PRESERVE, mpi->width, mpi->height); - ret = 0; - // 0/0 1/1 2/2 2/3 3/0 - switch (vf->priv->frame) { - case 0: - my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], - mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], - mpi->planes[1]+mpi->stride[1], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[1]*2, mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], - mpi->planes[2]+mpi->stride[2], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[2]*2, mpi->stride[2]*2); - } - ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); - case 1: - case 2: - memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0], mpi->stride[0]); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - memcpy_pic(dmpi->planes[1], mpi->planes[1], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[1], mpi->stride[1]); - memcpy_pic(dmpi->planes[2], mpi->planes[2], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[2], mpi->stride[2]); - } - return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE) || ret; - case 3: - my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], - mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], - mpi->planes[1]+mpi->stride[1], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[1]*2, mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], - mpi->planes[2]+mpi->stride[2], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[2]*2, mpi->stride[2]*2); - } - ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); - my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1], mpi->planes[1], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[1]*2, mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2], mpi->planes[2], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[2]*2, mpi->stride[2]*2); - } - return ret; - } - return 0; + ret = 0; + // 0/0 1/1 2/2 2/3 3/0 + switch (vf->priv->frame) { + case 0: + my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], + mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2, + dmpi->stride[0]*2, mpi->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], + mpi->planes[1]+mpi->stride[1], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[1]*2, mpi->stride[1]*2); + my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], + mpi->planes[2]+mpi->stride[2], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[2]*2, mpi->stride[2]*2); + } + ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); + case 1: + case 2: + memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, + dmpi->stride[0], mpi->stride[0]); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + memcpy_pic(dmpi->planes[1], mpi->planes[1], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[1], mpi->stride[1]); + memcpy_pic(dmpi->planes[2], mpi->planes[2], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[2], mpi->stride[2]); + } + return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE) || ret; + case 3: + my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], + mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2, + dmpi->stride[0]*2, mpi->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], + mpi->planes[1]+mpi->stride[1], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[1]*2, mpi->stride[1]*2); + my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], + mpi->planes[2]+mpi->stride[2], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[2]*2, mpi->stride[2]*2); + } + ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); + my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2, + dmpi->stride[0]*2, mpi->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(dmpi->planes[1], mpi->planes[1], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[1]*2, mpi->stride[1]*2); + my_memcpy_pic(dmpi->planes[2], mpi->planes[2], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[2]*2, mpi->stride[2]*2); + } + return ret; + } + return 0; } #if 0 static int query_format(struct vf_instance *vf, unsigned int fmt) { - /* FIXME - figure out which other formats work */ - switch (fmt) { - case IMGFMT_YV12: - case IMGFMT_IYUV: - case IMGFMT_I420: - return vf_next_query_format(vf, fmt); - } - return 0; + /* FIXME - figure out which other formats work */ + switch (fmt) { + case IMGFMT_YV12: + case IMGFMT_IYUV: + case IMGFMT_I420: + return vf_next_query_format(vf, fmt); + } + return 0; } static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) + unsigned int flags, unsigned int outfmt) { - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } #endif static void uninit(struct vf_instance *vf) { - free(vf->priv); + free(vf->priv); } static int vf_open(vf_instance_t *vf, char *args) { - //vf->config = config; - vf->put_image = put_image; - //vf->query_format = query_format; - vf->uninit = uninit; - vf->default_reqs = VFCAP_ACCEPT_STRIDE; - vf->priv = calloc(1, sizeof(struct vf_priv_s)); - vf->priv->frame = 1; - if (args) sscanf(args, "%d", &vf->priv->frame); - vf->priv->frame--; - return 1; + //vf->config = config; + vf->put_image = put_image; + //vf->query_format = query_format; + vf->uninit = uninit; + vf->default_reqs = VFCAP_ACCEPT_STRIDE; + vf->priv = calloc(1, sizeof(struct vf_priv_s)); + vf->priv->frame = 1; + if (args) sscanf(args, "%d", &vf->priv->frame); + vf->priv->frame--; + return 1; } const vf_info_t vf_info_telecine = { diff --git a/mplayer/libmpcodecs/vf_test.c b/mplayer/libmpcodecs/vf_test.c index b3700743..3c69cc4d 100644 --- a/mplayer/libmpcodecs/vf_test.c +++ b/mplayer/libmpcodecs/vf_test.c @@ -49,11 +49,11 @@ struct vf_priv_s { static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ if(vf_next_query_format(vf,IMGFMT_YV12)<=0){ - mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_WarnNextFilterDoesntSupport, "YV12"); - return 0; + mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_WarnNextFilterDoesntSupport, "YV12"); + return 0; } //hmm whats the meaning of these ... ;) @@ -67,206 +67,206 @@ static double c[64]; static void initIdct(void) { - int i; + int i; - for (i=0; i<8; i++) - { - double s= i==0 ? sqrt(0.125) : 0.5; - int j; + for (i=0; i<8; i++) + { + double s= i==0 ? sqrt(0.125) : 0.5; + int j; - for(j=0; j<8; j++) - c[i*8+j]= s*cos((3.141592654/8.0)*i*(j+0.5)); - } + for(j=0; j<8; j++) + c[i*8+j]= s*cos((3.141592654/8.0)*i*(j+0.5)); + } } static void idct(uint8_t *dst, int dstStride, int src[64]) { - int i, j, k; - double tmp[64]; - - for(i=0; i<8; i++) - { - for(j=0; j<8; j++) - { - double sum= 0.0; - - for(k=0; k<8; k++) - sum+= c[k*8+j]*src[8*i+k]; - - tmp[8*i+j]= sum; - } - } - - for(j=0; j<8; j++) - { - for(i=0; i<8; i++) - { - int v; - double sum= 0.0; - - for(k=0; k<8; k++) - sum+= c[k*8+i]*tmp[8*k+j]; - - v= (int)floor(sum+0.5); - if(v<0) v=0; - else if(v>255) v=255; - - dst[dstStride*i + j] = v; - } - } + int i, j, k; + double tmp[64]; + + for(i=0; i<8; i++) + { + for(j=0; j<8; j++) + { + double sum= 0.0; + + for(k=0; k<8; k++) + sum+= c[k*8+j]*src[8*i+k]; + + tmp[8*i+j]= sum; + } + } + + for(j=0; j<8; j++) + { + for(i=0; i<8; i++) + { + int v; + double sum= 0.0; + + for(k=0; k<8; k++) + sum+= c[k*8+i]*tmp[8*k+j]; + + v= (int)floor(sum+0.5); + if(v<0) v=0; + else if(v>255) v=255; + + dst[dstStride*i + j] = v; + } + } } static void drawDc(uint8_t *dst, int stride, int color, int w, int h) { - int y; - for(y=0; ynext,IMGFMT_YV12, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - WIDTH, HEIGHT); + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + WIDTH, HEIGHT); // clean memset(dmpi->planes[0], 0, dmpi->stride[0]*dmpi->h); @@ -286,18 +286,18 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ if(frame%30) { switch(frame/30) - { - case 0: dc1Test(dmpi->planes[0], dmpi->stride[0], 256, 256, frame%30); break; - case 1: dc1Test(dmpi->planes[1], dmpi->stride[1], 256, 256, frame%30); break; - case 2: freq1Test(dmpi->planes[0], dmpi->stride[0], frame%30); break; - case 3: freq1Test(dmpi->planes[1], dmpi->stride[1], frame%30); break; - case 4: amp1Test(dmpi->planes[0], dmpi->stride[0], frame%30); break; - case 5: amp1Test(dmpi->planes[1], dmpi->stride[1], frame%30); break; - case 6: cbp1Test(dmpi->planes , dmpi->stride , frame%30); break; - case 7: mv1Test(dmpi->planes[0], dmpi->stride[0], frame%30); break; - case 8: ring1Test(dmpi->planes[0], dmpi->stride[0], frame%30); break; - case 9: ring2Test(dmpi->planes[0], dmpi->stride[0], frame%30); break; - } + { + case 0: dc1Test(dmpi->planes[0], dmpi->stride[0], 256, 256, frame%30); break; + case 1: dc1Test(dmpi->planes[1], dmpi->stride[1], 256, 256, frame%30); break; + case 2: freq1Test(dmpi->planes[0], dmpi->stride[0], frame%30); break; + case 3: freq1Test(dmpi->planes[1], dmpi->stride[1], frame%30); break; + case 4: amp1Test(dmpi->planes[0], dmpi->stride[0], frame%30); break; + case 5: amp1Test(dmpi->planes[1], dmpi->stride[1], frame%30); break; + case 6: cbp1Test(dmpi->planes , dmpi->stride , frame%30); break; + case 7: mv1Test(dmpi->planes[0], dmpi->stride[0], frame%30); break; + case 8: ring1Test(dmpi->planes[0], dmpi->stride[0], frame%30); break; + case 9: ring2Test(dmpi->planes[0], dmpi->stride[0], frame%30); break; + } } frame++; diff --git a/mplayer/libmpcodecs/vf_tile.c b/mplayer/libmpcodecs/vf_tile.c index 6e3c46eb..f6f0dbc3 100644 --- a/mplayer/libmpcodecs/vf_tile.c +++ b/mplayer/libmpcodecs/vf_tile.c @@ -86,7 +86,7 @@ struct vf_priv_s { static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ struct vf_priv_s *priv; int xw; @@ -201,18 +201,18 @@ static void uninit(struct vf_instance *vf) /* rgb/bgr 12...32 supported & some Yxxx */ static int query_format(struct vf_instance *vf, unsigned int fmt) { - switch (fmt) { + switch (fmt) { /* rgb 12...32 bit */ case IMGFMT_RGB12: case IMGFMT_RGB15: - case IMGFMT_RGB16: - case IMGFMT_RGB24: + case IMGFMT_RGB16: + case IMGFMT_RGB24: case IMGFMT_RGB32: /* bgr 12...32 bit */ case IMGFMT_BGR12: - case IMGFMT_BGR15: - case IMGFMT_BGR16: - case IMGFMT_BGR24: + case IMGFMT_BGR15: + case IMGFMT_BGR16: + case IMGFMT_BGR24: case IMGFMT_BGR32: /* Various Yxxx Formats */ case IMGFMT_444P: @@ -224,9 +224,9 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) case IMGFMT_YVU9: case IMGFMT_IF09: case IMGFMT_IYUV: - return vf_next_query_format(vf, fmt); - } - return 0; + return vf_next_query_format(vf, fmt); + } + return 0; } /* Get an integer from the string pointed by s, adjusting s. diff --git a/mplayer/libmpcodecs/vf_tinterlace.c b/mplayer/libmpcodecs/vf_tinterlace.c index 7f042ebc..b878f580 100644 --- a/mplayer/libmpcodecs/vf_tinterlace.c +++ b/mplayer/libmpcodecs/vf_tinterlace.c @@ -32,204 +32,204 @@ #include "libvo/fastmemcpy.h" struct vf_priv_s { - int mode; - int frame; - mp_image_t *dmpi; + int mode; + int frame; + mp_image_t *dmpi; }; static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) { - int ret = 0; - mp_image_t *dmpi; - - switch (vf->priv->mode) { - case 0: - dmpi = vf->priv->dmpi; - if (dmpi == NULL) { - dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | - MP_IMGFLAG_PRESERVE, - mpi->width, mpi->height*2); - - vf->priv->dmpi = dmpi; - - memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0]*2, mpi->stride[0]); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - memcpy_pic(dmpi->planes[1], mpi->planes[1], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[1]*2, mpi->stride[1]); - memcpy_pic(dmpi->planes[2], mpi->planes[2], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[2]*2, mpi->stride[2]); - } - } else { - vf->priv->dmpi = NULL; - - memcpy_pic(dmpi->planes[0]+dmpi->stride[0], mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0]*2, mpi->stride[0]); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - memcpy_pic(dmpi->planes[1]+dmpi->stride[1], mpi->planes[1], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[1]*2, mpi->stride[1]); - memcpy_pic(dmpi->planes[2]+dmpi->stride[2], mpi->planes[2], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[2]*2, mpi->stride[2]); - } - ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); - } - break; - case 1: - if (vf->priv->frame & 1) - ret = vf_next_put_image(vf, mpi, MP_NOPTS_VALUE); - break; - case 2: - if ((vf->priv->frame & 1) == 0) - ret = vf_next_put_image(vf, mpi, MP_NOPTS_VALUE); - break; - case 3: - dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->width, mpi->height*2); - /* fixme, just clear alternate lines */ - vf_mpi_clear(dmpi, 0, 0, dmpi->w, dmpi->h); - if ((vf->priv->frame & 1) == 0) { - memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0]*2, mpi->stride[0]); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - memcpy_pic(dmpi->planes[1], mpi->planes[1], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[1]*2, mpi->stride[1]); - memcpy_pic(dmpi->planes[2], mpi->planes[2], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[2]*2, mpi->stride[2]); - } - } else { - memcpy_pic(dmpi->planes[0]+dmpi->stride[0], mpi->planes[0], mpi->w, mpi->h, - dmpi->stride[0]*2, mpi->stride[0]); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - memcpy_pic(dmpi->planes[1]+dmpi->stride[1], mpi->planes[1], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[1]*2, mpi->stride[1]); - memcpy_pic(dmpi->planes[2]+dmpi->stride[2], mpi->planes[2], - mpi->chroma_width, mpi->chroma_height, - dmpi->stride[2]*2, mpi->stride[2]); - } - } - ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); - break; - case 4: - // Interleave even lines (only) from Frame 'i' with odd - // lines (only) from Frame 'i+1', halving the Frame - // rate and preserving image height. - - dmpi = vf->priv->dmpi; - - // @@ Need help: Should I set dmpi->fields to indicate - // that the (new) frame will be interlaced!? E.g. ... - // dmpi->fields |= MP_IMGFIELD_INTERLACED; - // dmpi->fields |= MP_IMGFIELD_TOP_FIRST; - // etc. - - if (dmpi == NULL) { - dmpi = vf_get_image(vf->next, mpi->imgfmt, - MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | - MP_IMGFLAG_PRESERVE, - mpi->width, mpi->height); - - vf->priv->dmpi = dmpi; - - my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1], mpi->planes[1], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[1]*2, mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2], mpi->planes[2], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[2]*2, mpi->stride[2]*2); - } - } else { - vf->priv->dmpi = NULL; - - my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], - mpi->planes[0]+mpi->stride[0], - mpi->w, mpi->h/2, - dmpi->stride[0]*2, mpi->stride[0]*2); - if (mpi->flags & MP_IMGFLAG_PLANAR) { - my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], - mpi->planes[1]+mpi->stride[1], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[1]*2, mpi->stride[1]*2); - my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], - mpi->planes[2]+mpi->stride[2], - mpi->chroma_width, mpi->chroma_height/2, - dmpi->stride[2]*2, mpi->stride[2]*2); - } - ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); - } - break; - } - - vf->priv->frame++; - - return ret; + int ret = 0; + mp_image_t *dmpi; + + switch (vf->priv->mode) { + case 0: + dmpi = vf->priv->dmpi; + if (dmpi == NULL) { + dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | + MP_IMGFLAG_PRESERVE, + mpi->width, mpi->height*2); + + vf->priv->dmpi = dmpi; + + memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, + dmpi->stride[0]*2, mpi->stride[0]); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + memcpy_pic(dmpi->planes[1], mpi->planes[1], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[1]*2, mpi->stride[1]); + memcpy_pic(dmpi->planes[2], mpi->planes[2], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[2]*2, mpi->stride[2]); + } + } else { + vf->priv->dmpi = NULL; + + memcpy_pic(dmpi->planes[0]+dmpi->stride[0], mpi->planes[0], mpi->w, mpi->h, + dmpi->stride[0]*2, mpi->stride[0]); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + memcpy_pic(dmpi->planes[1]+dmpi->stride[1], mpi->planes[1], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[1]*2, mpi->stride[1]); + memcpy_pic(dmpi->planes[2]+dmpi->stride[2], mpi->planes[2], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[2]*2, mpi->stride[2]); + } + ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); + } + break; + case 1: + if (vf->priv->frame & 1) + ret = vf_next_put_image(vf, mpi, MP_NOPTS_VALUE); + break; + case 2: + if ((vf->priv->frame & 1) == 0) + ret = vf_next_put_image(vf, mpi, MP_NOPTS_VALUE); + break; + case 3: + dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->width, mpi->height*2); + /* fixme, just clear alternate lines */ + vf_mpi_clear(dmpi, 0, 0, dmpi->w, dmpi->h); + if ((vf->priv->frame & 1) == 0) { + memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, + dmpi->stride[0]*2, mpi->stride[0]); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + memcpy_pic(dmpi->planes[1], mpi->planes[1], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[1]*2, mpi->stride[1]); + memcpy_pic(dmpi->planes[2], mpi->planes[2], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[2]*2, mpi->stride[2]); + } + } else { + memcpy_pic(dmpi->planes[0]+dmpi->stride[0], mpi->planes[0], mpi->w, mpi->h, + dmpi->stride[0]*2, mpi->stride[0]); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + memcpy_pic(dmpi->planes[1]+dmpi->stride[1], mpi->planes[1], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[1]*2, mpi->stride[1]); + memcpy_pic(dmpi->planes[2]+dmpi->stride[2], mpi->planes[2], + mpi->chroma_width, mpi->chroma_height, + dmpi->stride[2]*2, mpi->stride[2]); + } + } + ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); + break; + case 4: + // Interleave even lines (only) from Frame 'i' with odd + // lines (only) from Frame 'i+1', halving the Frame + // rate and preserving image height. + + dmpi = vf->priv->dmpi; + + // @@ Need help: Should I set dmpi->fields to indicate + // that the (new) frame will be interlaced!? E.g. ... + // dmpi->fields |= MP_IMGFIELD_INTERLACED; + // dmpi->fields |= MP_IMGFIELD_TOP_FIRST; + // etc. + + if (dmpi == NULL) { + dmpi = vf_get_image(vf->next, mpi->imgfmt, + MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | + MP_IMGFLAG_PRESERVE, + mpi->width, mpi->height); + + vf->priv->dmpi = dmpi; + + my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2, + dmpi->stride[0]*2, mpi->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(dmpi->planes[1], mpi->planes[1], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[1]*2, mpi->stride[1]*2); + my_memcpy_pic(dmpi->planes[2], mpi->planes[2], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[2]*2, mpi->stride[2]*2); + } + } else { + vf->priv->dmpi = NULL; + + my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], + mpi->planes[0]+mpi->stride[0], + mpi->w, mpi->h/2, + dmpi->stride[0]*2, mpi->stride[0]*2); + if (mpi->flags & MP_IMGFLAG_PLANAR) { + my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], + mpi->planes[1]+mpi->stride[1], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[1]*2, mpi->stride[1]*2); + my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], + mpi->planes[2]+mpi->stride[2], + mpi->chroma_width, mpi->chroma_height/2, + dmpi->stride[2]*2, mpi->stride[2]*2); + } + ret = vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE); + } + break; + } + + vf->priv->frame++; + + return ret; } static int query_format(struct vf_instance *vf, unsigned int fmt) { - /* FIXME - figure out which other formats work */ - switch (fmt) { - case IMGFMT_YV12: - case IMGFMT_IYUV: - case IMGFMT_I420: - return vf_next_query_format(vf, fmt); - } - return 0; + /* FIXME - figure out which other formats work */ + switch (fmt) { + case IMGFMT_YV12: + case IMGFMT_IYUV: + case IMGFMT_I420: + return vf_next_query_format(vf, fmt); + } + return 0; } static int config(struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt) { - switch (vf->priv->mode) { - case 0: - case 3: - return vf_next_config(vf,width,height*2,d_width,d_height*2,flags,outfmt); - case 1: /* odd frames */ - case 2: /* even frames */ - case 4: /* alternate frame (height-preserving) interlacing */ - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); - } - return 0; + switch (vf->priv->mode) { + case 0: + case 3: + return vf_next_config(vf,width,height*2,d_width,d_height*2,flags,outfmt); + case 1: /* odd frames */ + case 2: /* even frames */ + case 4: /* alternate frame (height-preserving) interlacing */ + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + } + return 0; } static void uninit(struct vf_instance *vf) { - free(vf->priv); + free(vf->priv); } static int vf_open(vf_instance_t *vf, char *args) { - struct vf_priv_s *p; - vf->config = config; - vf->put_image = put_image; - vf->query_format = query_format; - vf->uninit = uninit; - vf->default_reqs = VFCAP_ACCEPT_STRIDE; - vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); - vf->priv->mode = 0; - if (args) - sscanf(args, "%d", &vf->priv->mode); - vf->priv->frame = 0; - return 1; + struct vf_priv_s *p; + vf->config = config; + vf->put_image = put_image; + vf->query_format = query_format; + vf->uninit = uninit; + vf->default_reqs = VFCAP_ACCEPT_STRIDE; + vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); + vf->priv->mode = 0; + if (args) + sscanf(args, "%d", &vf->priv->mode); + vf->priv->frame = 0; + return 1; } const vf_info_t vf_info_tinterlace = { - "temporal field interlacing", - "tinterlace", - "Michael Zucchi", - "", - vf_open, - NULL + "temporal field interlacing", + "tinterlace", + "Michael Zucchi", + "", + vf_open, + NULL }; diff --git a/mplayer/libmpcodecs/vf_unsharp.c b/mplayer/libmpcodecs/vf_unsharp.c index 3e0f3d01..d628abbd 100644 --- a/mplayer/libmpcodecs/vf_unsharp.c +++ b/mplayer/libmpcodecs/vf_unsharp.c @@ -83,52 +83,52 @@ static void unsharp( uint8_t *dst, uint8_t *src, int dstStride, int srcStride, i int32_t halfscale = 1 << ((stepsX+stepsY)*2-1); if( !fp->amount ) { - if( src == dst ) - return; - if( dstStride == srcStride ) - fast_memcpy( dst, src, srcStride*height ); - else - for( y=0; y=width ? src2[width-1] : src2[x]; - for( z=0; z=stepsX && y>=stepsY ) { - uint8_t* srx = src - stepsY*srcStride + x - stepsX; - uint8_t* dsx = dst - stepsY*dstStride + x - stepsX; - - res = (int32_t)*srx + ( ( ( (int32_t)*srx - (int32_t)((Tmp1+halfscale) >> scalebits) ) * amount ) >> 16 ); - *dsx = res>255 ? 255 : res<0 ? 0 : (uint8_t)res; - } - } - if( y >= 0 ) { - dst += dstStride; - src += srcStride; - } + if( y < height ) src2 = src; + memset( SR, 0, sizeof(SR[0]) * (2*stepsX-1) ); + for( x=-stepsX; x=width ? src2[width-1] : src2[x]; + for( z=0; z=stepsX && y>=stepsY ) { + uint8_t* srx = src - stepsY*srcStride + x - stepsX; + uint8_t* dsx = dst - stepsY*dstStride + x - stepsX; + + res = (int32_t)*srx + ( ( ( (int32_t)*srx - (int32_t)((Tmp1+halfscale) >> scalebits) ) * amount ) >> 16 ); + *dsx = res>255 ? 255 : res<0 ? 0 : (uint8_t)res; + } + } + if( y >= 0 ) { + dst += dstStride; + src += srcStride; + } } } //===========================================================================// static int config( struct vf_instance *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt ) { + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt ) { int z, stepsX, stepsY; FilterParam *fp; @@ -143,7 +143,7 @@ static int config( struct vf_instance *vf, stepsX = fp->msizeX/2; stepsY = fp->msizeY/2; for( z=0; z<2*stepsY; z++ ) - fp->SC[z] = av_malloc(sizeof(*(fp->SC[z])) * (width+2*stepsX)); + fp->SC[z] = av_malloc(sizeof(*(fp->SC[z])) * (width+2*stepsX)); fp = &vf->priv->chromaParam; effect = fp->amount == 0 ? "don't touch" : fp->amount < 0 ? "blur" : "sharpen"; @@ -152,7 +152,7 @@ static int config( struct vf_instance *vf, stepsX = fp->msizeX/2; stepsY = fp->msizeY/2; for( z=0; z<2*stepsY; z++ ) - fp->SC[z] = av_malloc(sizeof(*(fp->SC[z])) * (width+2*stepsX)); + fp->SC[z] = av_malloc(sizeof(*(fp->SC[z])) * (width+2*stepsX)); return vf_next_config( vf, width, height, d_width, d_height, flags, outfmt ); } @@ -161,9 +161,9 @@ static int config( struct vf_instance *vf, static void get_image( struct vf_instance *vf, mp_image_t *mpi ) { if( mpi->flags & MP_IMGFLAG_PRESERVE ) - return; // don't change + return; // don't change if( mpi->imgfmt!=vf->priv->outfmt ) - return; // colorspace differ + return; // colorspace differ vf->dmpi = vf_get_image( vf->next, mpi->imgfmt, mpi->type, mpi->flags, mpi->w, mpi->h ); mpi->planes[0] = vf->dmpi->planes[0]; @@ -172,8 +172,8 @@ static void get_image( struct vf_instance *vf, mp_image_t *mpi ) { if( mpi->flags & MP_IMGFLAG_PLANAR ) { mpi->planes[1] = vf->dmpi->planes[1]; mpi->planes[2] = vf->dmpi->planes[2]; - mpi->stride[1] = vf->dmpi->stride[1]; - mpi->stride[2] = vf->dmpi->stride[2]; + mpi->stride[1] = vf->dmpi->stride[1]; + mpi->stride[2] = vf->dmpi->stride[2]; } mpi->flags |= MP_IMGFLAG_DIRECT; } @@ -182,8 +182,8 @@ static int put_image( struct vf_instance *vf, mp_image_t *mpi, double pts) { mp_image_t *dmpi; if( !(mpi->flags & MP_IMGFLAG_DIRECT) ) - // no DR, so get a new image! hope we'll get DR buffer: - vf->dmpi = vf_get_image( vf->next,vf->priv->outfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h); + // no DR, so get a new image! hope we'll get DR buffer: + vf->dmpi = vf_get_image( vf->next,vf->priv->outfmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h); dmpi= vf->dmpi; unsharp( dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, &vf->priv->lumaParam ); @@ -194,11 +194,11 @@ static int put_image( struct vf_instance *vf, mp_image_t *mpi, double pts) { #if HAVE_MMX if(gCpuCaps.hasMMX) - __asm__ volatile ("emms\n\t"); + __asm__ volatile ("emms\n\t"); #endif #if HAVE_MMX2 if(gCpuCaps.hasMMX2) - __asm__ volatile ("sfence\n\t"); + __asm__ volatile ("sfence\n\t"); #endif return vf_next_put_image( vf, dmpi, pts); @@ -212,13 +212,13 @@ static void uninit( struct vf_instance *vf ) { fp = &vf->priv->lumaParam; for( z=0; zSC)/sizeof(fp->SC[0]); z++ ) { - av_free( fp->SC[z] ); - fp->SC[z] = NULL; + av_free( fp->SC[z] ); + fp->SC[z] = NULL; } fp = &vf->priv->chromaParam; for( z=0; zSC)/sizeof(fp->SC[0]); z++ ) { - av_free( fp->SC[z] ); - fp->SC[z] = NULL; + av_free( fp->SC[z] ); + fp->SC[z] = NULL; } free( vf->priv ); @@ -232,7 +232,7 @@ static int query_format( struct vf_instance *vf, unsigned int fmt ) { case IMGFMT_YV12: case IMGFMT_I420: case IMGFMT_IYUV: - return vf_next_query_format( vf, vf->priv->outfmt ); + return vf_next_query_format( vf, vf->priv->outfmt ); } return 0; } @@ -280,32 +280,32 @@ static int vf_open( vf_instance_t *vf, char *args ) { memset( vf->priv, 0, sizeof(struct vf_priv_s) ); if( args ) { - char *args2 = strchr( args, 'l' ); - if( args2 ) - parse( &vf->priv->lumaParam, args2 ); - else { - vf->priv->lumaParam.amount = - vf->priv->lumaParam.msizeX = - vf->priv->lumaParam.msizeY = 0; - } - - args2 = strchr( args, 'c' ); - if( args2 ) - parse( &vf->priv->chromaParam, args2 ); - else { - vf->priv->chromaParam.amount = - vf->priv->chromaParam.msizeX = - vf->priv->chromaParam.msizeY = 0; - } - - if( !vf->priv->lumaParam.msizeX && !vf->priv->chromaParam.msizeX ) - return 0; // nothing to do + char *args2 = strchr( args, 'l' ); + if( args2 ) + parse( &vf->priv->lumaParam, args2 ); + else { + vf->priv->lumaParam.amount = + vf->priv->lumaParam.msizeX = + vf->priv->lumaParam.msizeY = 0; + } + + args2 = strchr( args, 'c' ); + if( args2 ) + parse( &vf->priv->chromaParam, args2 ); + else { + vf->priv->chromaParam.amount = + vf->priv->chromaParam.msizeX = + vf->priv->chromaParam.msizeY = 0; + } + + if( !vf->priv->lumaParam.msizeX && !vf->priv->chromaParam.msizeX ) + return 0; // nothing to do } // check csp: vf->priv->outfmt = vf_match_csp( &vf->next, fmt_list, IMGFMT_YV12 ); if( !vf->priv->outfmt ) { - uninit( vf ); + uninit( vf ); return 0; // no csp match :( } diff --git a/mplayer/libmpcodecs/vf_uspp.c b/mplayer/libmpcodecs/vf_uspp.c index 99ce6f5f..949653d8 100644 --- a/mplayer/libmpcodecs/vf_uspp.c +++ b/mplayer/libmpcodecs/vf_uspp.c @@ -113,27 +113,27 @@ struct vf_priv_s { }; static void store_slice_c(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale){ - int y, x; + int y, x; #define STORE(pos) \ - temp= ((src[x + y*src_stride + pos]<>8;\ - if(temp & 0x100) temp= ~(temp>>31);\ - dst[x + y*dst_stride + pos]= temp; - - for(y=0; y>8;\ + if(temp & 0x100) temp= ~(temp>>31);\ + dst[x + y*dst_stride + pos]= temp; + + for(y=0; ypriv->outbuf_size= (width + BLOCK)*(height + BLOCK)*10; vf->priv->outbuf= malloc(vf->priv->outbuf_size); - return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); } static void get_image(struct vf_instance *vf, mp_image_t *mpi){ @@ -257,8 +257,8 @@ static void get_image(struct vf_instance *vf, mp_image_t *mpi){ if(mpi->flags&MP_IMGFLAG_PLANAR){ mpi->planes[1]=vf->dmpi->planes[1]; mpi->planes[2]=vf->dmpi->planes[2]; - mpi->stride[1]=vf->dmpi->stride[1]; - mpi->stride[2]=vf->dmpi->stride[2]; + mpi->stride[1]=vf->dmpi->stride[1]; + mpi->stride[2]=vf->dmpi->stride[2]; } mpi->flags|=MP_IMGFLAG_DIRECT; } @@ -319,12 +319,12 @@ static void uninit(struct vf_instance *vf){ //===========================================================================// static int query_format(struct vf_instance *vf, unsigned int fmt){ switch(fmt){ - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_Y800: - case IMGFMT_Y8: - return vf_next_query_format(vf,fmt); + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_Y800: + case IMGFMT_Y8: + return vf_next_query_format(vf,fmt); } return 0; } @@ -332,11 +332,11 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){ static int control(struct vf_instance *vf, int request, void* data){ switch(request){ case VFCTRL_QUERY_MAX_PP_LEVEL: - return 8; + return 8; case VFCTRL_SET_PP_LEVEL: - vf->priv->log2_count= *((unsigned int*)data); + vf->priv->log2_count= *((unsigned int*)data); //FIXME we have to realloc a few things here - return CONTROL_TRUE; + return CONTROL_TRUE; } return vf_next_control(vf,request,data); } @@ -368,7 +368,7 @@ static int vf_open(vf_instance_t *vf, char *args){ // #if HAVE_MMX // if(gCpuCaps.hasMMX){ -// store_slice= store_slice_mmx; +// store_slice= store_slice_mmx; // } // #endif diff --git a/mplayer/libmpcodecs/vf_yuvcsp.c b/mplayer/libmpcodecs/vf_yuvcsp.c index e4c2c9fc..2e9e3408 100644 --- a/mplayer/libmpcodecs/vf_yuvcsp.c +++ b/mplayer/libmpcodecs/vf_yuvcsp.c @@ -36,7 +36,7 @@ struct vf_priv_s { static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt); } @@ -54,8 +54,8 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ uint8_t *y_out, *cb_out, *cr_out; vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, - MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, - mpi->width, mpi->height); + MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, + mpi->width, mpi->height); y_in = mpi->planes[0]; cb_in = mpi->planes[1]; @@ -66,15 +66,15 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ cr_out = vf->dmpi->planes[2]; for (i = 0; i < mpi->height; i++) - for (j = 0; j < mpi->width; j++) - y_out[i*vf->dmpi->stride[0]+j] = clamp_y(y_in[i*mpi->stride[0]+j]); + for (j = 0; j < mpi->width; j++) + y_out[i*vf->dmpi->stride[0]+j] = clamp_y(y_in[i*mpi->stride[0]+j]); for (i = 0; i < mpi->chroma_height; i++) - for (j = 0; j < mpi->chroma_width; j++) - { - cb_out[i*vf->dmpi->stride[1]+j] = clamp_c(cb_in[i*mpi->stride[1]+j]); - cr_out[i*vf->dmpi->stride[2]+j] = clamp_c(cr_in[i*mpi->stride[2]+j]); - } + for (j = 0; j < mpi->chroma_width; j++) + { + cb_out[i*vf->dmpi->stride[1]+j] = clamp_c(cb_in[i*mpi->stride[1]+j]); + cr_out[i*vf->dmpi->stride[2]+j] = clamp_c(cr_in[i*mpi->stride[2]+j]); + } return vf_next_put_image(vf,vf->dmpi, pts); } @@ -83,16 +83,16 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ /* static void uninit(struct vf_instance *vf){ - free(vf->priv); + free(vf->priv); } */ static int query_format(struct vf_instance *vf, unsigned int fmt){ switch(fmt){ - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: - return 1; + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + return 1; } return 0; } @@ -104,7 +104,7 @@ static int vf_open(vf_instance_t *vf, char *args){ vf->query_format=query_format; // vf->priv=calloc(1, sizeof(struct vf_priv_s)); // if (args) -// vf->priv->csp = atoi(args); +// vf->priv->csp = atoi(args); return 1; } diff --git a/mplayer/libmpcodecs/vf_yvu9.c b/mplayer/libmpcodecs/vf_yvu9.c index e4433077..19e00626 100644 --- a/mplayer/libmpcodecs/vf_yvu9.c +++ b/mplayer/libmpcodecs/vf_yvu9.c @@ -35,11 +35,11 @@ static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ + unsigned int flags, unsigned int outfmt){ if(vf_next_query_format(vf,IMGFMT_YV12)<=0){ - mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_WarnNextFilterDoesntSupport, "YVU9"); - return 0; + mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_WarnNextFilterDoesntSupport, "YVU9"); + return 0; } return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_YV12); @@ -51,26 +51,26 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ // hope we'll get DR buffer: dmpi=vf_get_image(vf->next,IMGFMT_YV12, - MP_IMGTYPE_TEMP, 0/*MP_IMGFLAG_ACCEPT_STRIDE*/, - mpi->w, mpi->h); + MP_IMGTYPE_TEMP, 0/*MP_IMGFLAG_ACCEPT_STRIDE*/, + mpi->w, mpi->h); for(y=0;yh;y++) - fast_memcpy(dmpi->planes[0]+dmpi->stride[0]*y, - mpi->planes[0]+mpi->stride[0]*y, - mpi->w); + fast_memcpy(dmpi->planes[0]+dmpi->stride[0]*y, + mpi->planes[0]+mpi->stride[0]*y, + mpi->w); w=mpi->w/4; h=mpi->h/2; for(y=0;yplanes[1]+mpi->stride[1]*(y>>1); - unsigned char* d=dmpi->planes[1]+dmpi->stride[1]*y; - int x; - for(x=0;xplanes[1]+mpi->stride[1]*(y>>1); + unsigned char* d=dmpi->planes[1]+dmpi->stride[1]*y; + int x; + for(x=0;xplanes[2]+mpi->stride[2]*(y>>1); - unsigned char* d=dmpi->planes[2]+dmpi->stride[2]*y; - int x; - for(x=0;xplanes[2]+mpi->stride[2]*(y>>1); + unsigned char* d=dmpi->planes[2]+dmpi->stride[2]*y; + int x; + for(x=0;x p_end - p) { + mp_msg(MSGT_DEMUX, MSGL_V, "invalid rlen=%d\n", rlen); + break; + } switch(rlen){ case 0x01: // 1 = special, means grouping diff --git a/mplayer/libmpdemux/demux_lavf.c b/mplayer/libmpdemux/demux_lavf.c index d27f98dc..616ed545 100644 --- a/mplayer/libmpdemux/demux_lavf.c +++ b/mplayer/libmpdemux/demux_lavf.c @@ -138,7 +138,7 @@ static int64_t mp_read_seek(void *opaque, int stream_idx, int64_t ts, int flags) static void list_formats(void) { AVInputFormat *fmt; mp_msg(MSGT_DEMUX, MSGL_INFO, "Available lavf input formats:\n"); - for (fmt = first_iformat; fmt; fmt = fmt->next) + for (fmt = av_iformat_next(NULL); fmt; av_iformat_next(fmt)) mp_msg(MSGT_DEMUX, MSGL_INFO, "%15s : %s\n", fmt->name, fmt->long_name); } @@ -211,7 +211,6 @@ static const char * const preferred_list[] = { "gxf", "nut", "nuv", - "webm", "mov,mp4,m4a,3gp,3g2,mj2", "mpc", "mpc8", @@ -270,7 +269,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) { codec->codec_tag = override_tag; switch(codec->codec_type){ - case CODEC_TYPE_AUDIO:{ + case AVMEDIA_TYPE_AUDIO:{ WAVEFORMATEX *wf; sh_audio_t* sh_audio; sh_audio = new_sh_audio_aid(demuxer, i, priv->audio_streams, lang ? lang->value : NULL); @@ -344,7 +343,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) { stream_id = priv->audio_streams++; break; } - case CODEC_TYPE_VIDEO:{ + case AVMEDIA_TYPE_VIDEO:{ sh_video_t* sh_video; BITMAPINFOHEADER *bih; sh_video=new_sh_video_vid(demuxer, i, priv->video_streams); @@ -416,7 +415,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) { stream_id = priv->video_streams++; break; } - case CODEC_TYPE_SUBTITLE:{ + case AVMEDIA_TYPE_SUBTITLE:{ sh_sub_t* sh_sub; char type; /* only support text subtitles for now */ @@ -455,7 +454,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) { stream_id = priv->sub_streams++; break; } - case CODEC_TYPE_ATTACHMENT:{ + case AVMEDIA_TYPE_ATTACHMENT:{ if (st->codec->codec_id == CODEC_ID_TTF) demuxer_add_attachment(demuxer, st->filename, "application/x-truetype-font", @@ -544,7 +543,6 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){ } /* Add metadata. */ - av_metadata_conv(avfc, NULL, avfc->iformat->metadata_conv); while((t = av_metadata_get(avfc->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) demux_info_add(demuxer, t->key, t->value); @@ -642,14 +640,14 @@ static int demux_lavf_fill_buffer(demuxer_t *demux, demux_stream_t *dsds){ if(pkt.pts != AV_NOPTS_VALUE){ dp->pts=pkt.pts * av_q2d(priv->avfc->streams[id]->time_base); priv->last_pts= dp->pts * AV_TIME_BASE; - // always set endpts for subtitles, even if PKT_FLAG_KEY is not set, + // always set endpts for subtitles, even if AV_PKT_FLAG_KEY is not set, // otherwise they will stay on screen to long if e.g. ASS is demuxed from mkv - if((ds == demux->sub || (pkt.flags & PKT_FLAG_KEY)) && + if((ds == demux->sub || (pkt.flags & AV_PKT_FLAG_KEY)) && pkt.convergence_duration > 0) dp->endpts = dp->pts + pkt.convergence_duration * av_q2d(priv->avfc->streams[id]->time_base); } dp->pos=demux->filepos; - dp->flags= !!(pkt.flags&PKT_FLAG_KEY); + dp->flags= !!(pkt.flags&AV_PKT_FLAG_KEY); // append packet to DS stream: ds_add_packet(ds,dp); return 1; @@ -789,15 +787,15 @@ static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg) { switch(priv->avfc->streams[program->stream_index[i]]->codec->codec_type) { - case CODEC_TYPE_VIDEO: + case AVMEDIA_TYPE_VIDEO: if(prog->vid == -2) prog->vid = program->stream_index[i]; break; - case CODEC_TYPE_AUDIO: + case AVMEDIA_TYPE_AUDIO: if(prog->aid == -2) prog->aid = program->stream_index[i]; break; - case CODEC_TYPE_SUBTITLE: + case AVMEDIA_TYPE_SUBTITLE: if(prog->sid == -2 && priv->avfc->streams[program->stream_index[i]]->codec->codec_id == CODEC_ID_TEXT) prog->sid = program->stream_index[i]; break; diff --git a/mplayer/libmpdemux/demux_ts.c b/mplayer/libmpdemux/demux_ts.c index 000de93b..112f355e 100644 --- a/mplayer/libmpdemux/demux_ts.c +++ b/mplayer/libmpdemux/demux_ts.c @@ -406,6 +406,8 @@ static void ts_add_stream(demuxer_t * demuxer, ES_stream_t *es) sh_sub_t *sh = new_sh_sub_sid(demuxer, priv->last_sid, es->pid, pid_lang_from_pmt(priv, es->pid)); if (sh) { switch (es->type) { + case SPU_DVB: + sh->type = 'b'; break; case SPU_DVD: sh->type = 'v'; break; case SPU_PGS: @@ -1481,10 +1483,11 @@ static int pes_parse2(unsigned char *buf, uint16_t packet_len, ES_stream_t *es, } /* SPU SUBS */ else if(type_from_pmt == SPU_DVB || - (packet_len >= 1 && (p[0] == 0x20) && pes_is_aligned)) // && p[1] == 0x00)) + (packet_len >= 2 && (p[0] == 0x20) && pes_is_aligned)) // && p[1] == 0x00)) { - es->start = p; - es->size = packet_len; + // offset/length fiddling to make decoding with lavc possible + es->start = p + 2; + es->size = packet_len - 2; es->type = SPU_DVB; es->payload_size -= packet_len; @@ -2983,11 +2986,6 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet, //IS IT TIME TO QUEUE DATA to the dp_packet? if(is_start && (dp != NULL)) { - // subtitle packets _have_ to be submitted before video, otherwise - // they might get stuck "forever" and subtitles will be completely - // out of sync. - if (is_video) - fill_packet(demuxer, demuxer->sub, &priv->fifo[2].pack, &priv->fifo[2].offset, NULL); retv = fill_packet(demuxer, ds, dp, dp_offset, si); } @@ -3128,6 +3126,9 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet, (*dp)->flags = 0; (*dp)->pos = stream_tell(demuxer->stream); (*dp)->pts = es->pts; + // subtitle packets must be returned immediately if possible + if (is_sub && !tss->payload_size) + retv = fill_packet(demuxer, ds, dp, dp_offset, si); if(retv > 0) return retv; @@ -3169,7 +3170,8 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet, { *dp_offset += sz; - if(*dp_offset >= MAX_PACK_BYTES) + // subtitle packets must be returned immediately if possible + if(*dp_offset >= MAX_PACK_BYTES || (is_sub && !tss->payload_size)) { (*dp)->pts = tss->last_pts; retv = fill_packet(demuxer, ds, dp, dp_offset, si); diff --git a/mplayer/libmpdemux/demuxer.c b/mplayer/libmpdemux/demuxer.c index a41f1a2d..77a399c9 100644 --- a/mplayer/libmpdemux/demuxer.c +++ b/mplayer/libmpdemux/demuxer.c @@ -630,8 +630,7 @@ int ds_fill_buffer(demux_stream_t *ds) free_demux_packet(ds->current); ds->current = NULL; if(demux==NULL) return 0; - if (mp_msg_test(MSGT_DEMUXER, MSGL_DBG3)) - { + if (mp_msg_test(MSGT_DEMUXER, MSGL_DBG3)) { if (ds == demux->audio) mp_dbg(MSGT_DEMUXER, MSGL_DBG3, "ds_fill_buffer(d_audio) called\n"); @@ -650,6 +649,8 @@ int ds_fill_buffer(demux_stream_t *ds) while (1) { if (ds->packs) { demux_packet_t *p = ds->first; + // obviously not yet EOF after all + ds->eof = 0; #if 0 if (demux->reference_clock != MP_NOPTS_VALUE) { if ( p->pts != MP_NOPTS_VALUE @@ -684,6 +685,9 @@ int ds_fill_buffer(demux_stream_t *ds) --ds->packs; return 1; } + // avoid printing the "too many ..." message over and over + if (ds->eof) + break; if (demux->audio->packs >= MAX_PACKS || demux->audio->bytes >= MAX_PACK_BYTES) { mp_msg(MSGT_DEMUXER, MSGL_ERR, MSGTR_TooManyAudioInBuffer, diff --git a/mplayer/libmpdemux/demuxer.h b/mplayer/libmpdemux/demuxer.h index eef92abd..10151525 100644 --- a/mplayer/libmpdemux/demuxer.h +++ b/mplayer/libmpdemux/demuxer.h @@ -294,8 +294,11 @@ static inline demux_packet_t* new_demux_packet(int len){ dp->buffer=NULL; if (len > 0 && (dp->buffer = (unsigned char *)malloc(len + MP_INPUT_BUFFER_PADDING_SIZE))) memset(dp->buffer + len, 0, MP_INPUT_BUFFER_PADDING_SIZE); - else - dp->len = 0; + else if (len) { + // do not even return a valid packet if allocation failed + free(dp); + return NULL; + } return dp; } diff --git a/mplayer/libmpdemux/mf.c b/mplayer/libmpdemux/mf.c index e2c80dfb..88d81c7e 100644 --- a/mplayer/libmpdemux/mf.c +++ b/mplayer/libmpdemux/mf.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -63,8 +64,8 @@ mf_t* open_mf(char * filename){ FILE *lst_f=fopen(filename + 1,"r"); if ( lst_f ) { - fname=malloc( 255 ); - while ( fgets( fname,255,lst_f ) ) + fname=malloc(PATH_MAX); + while ( fgets( fname,PATH_MAX,lst_f ) ) { /* remove spaces from end of fname */ char *t=fname + strlen( fname ) - 1; diff --git a/mplayer/libmpdemux/mp_taglists.c b/mplayer/libmpdemux/mp_taglists.c index d09894b0..cab033a5 100644 --- a/mplayer/libmpdemux/mp_taglists.c +++ b/mplayer/libmpdemux/mp_taglists.c @@ -43,6 +43,7 @@ static const AVCodecTag mp_wav_tags[] = { { CODEC_ID_MUSEPACK7, MKTAG('M', 'P', 'C', ' ')}, { CODEC_ID_MUSEPACK8, MKTAG('M', 'P', 'C', '8')}, { CODEC_ID_NELLYMOSER, MKTAG('N', 'E', 'L', 'L')}, + { CODEC_ID_PCM_LXF, MKTAG('P', 'L', 'X', 'F')}, { CODEC_ID_QCELP, MKTAG('Q', 'c', 'l', 'p')}, { CODEC_ID_QDM2, MKTAG('Q', 'D', 'M', '2')}, { CODEC_ID_RA_144, MKTAG('1', '4', '_', '4')}, @@ -66,6 +67,7 @@ static const AVCodecTag mp_codecid_override_tags[] = { { CODEC_ID_AC3, 0x2000}, { CODEC_ID_ADPCM_IMA_AMV, MKTAG('A', 'M', 'V', 'A')}, { CODEC_ID_DTS, 0x2001}, + { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd')}, { CODEC_ID_EAC3, MKTAG('E', 'A', 'C', '3')}, { CODEC_ID_H264, MKTAG('H', '2', '6', '4')}, { CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'V')}, diff --git a/mplayer/libmpdemux/muxer.c b/mplayer/libmpdemux/muxer.c index 777efd09..d47a19a0 100644 --- a/mplayer/libmpdemux/muxer.c +++ b/mplayer/libmpdemux/muxer.c @@ -69,6 +69,57 @@ muxer_t *muxer_new_muxer(int type,stream_t *stream){ return NULL; } +/* Flush the internal muxer buffer. + * This is normally called from muxer_write_chunk() once all streams + * have seen frames. */ +void muxer_flush(muxer_t *m) { + int num; + + if (!m->muxbuf) + return; + + mp_msg(MSGT_MUXER, MSGL_V, MSGTR_MuxbufSending, m->muxbuf_num); + + /* fix parameters for all streams */ + for (num = 0; m->streams[num]; ++num) { + muxer_stream_t *str = m->streams[num]; + if(str->muxer->fix_stream_parameters) + muxer_stream_fix_parameters(str->muxer, str); + } + + /* write header */ + if (m->cont_write_header) + muxer_write_header(m); + + /* send all buffered frames to muxer */ + for (num = 0; num < m->muxbuf_num; ++num) { + muxbuf_t tmp_buf; + muxbuf_t *buf; + muxer_stream_t *s; + buf = m->muxbuf + num; + s = buf->stream; + + /* 1. save timer and buffer (might have changed by now) */ + tmp_buf.dts = s->timer; + tmp_buf.buffer = s->buffer; + + /* 2. move stored timer and buffer into stream and mux it */ + s->timer = buf->dts; + s->buffer = buf->buffer; + m->cont_write_chunk(s, buf->len, buf->flags, buf->dts, buf->pts); + free(buf->buffer); + buf->buffer = NULL; + + /* 3. restore saved timer and buffer */ + s->timer = tmp_buf.dts; + s->buffer = tmp_buf.buffer; + } + + free(m->muxbuf); + m->muxbuf = NULL; + m->muxbuf_num = 0; +} + /* buffer frames until we either: * (a) have at least one frame from each stream * (b) run out of memory */ @@ -112,43 +163,8 @@ void muxer_write_chunk(muxer_stream_t *s, size_t len, unsigned int flags, double s->muxer->muxbuf_skip_buffer = 0; /* see if we can flush buffer now */ - if (s->muxer->muxbuf_skip_buffer) { - mp_msg(MSGT_MUXER, MSGL_V, MSGTR_MuxbufSending, s->muxer->muxbuf_num); - - /* fix parameters for all streams */ - for (num = 0; s->muxer->streams[num]; ++num) { - muxer_stream_t *str = s->muxer->streams[num]; - if(str->muxer->fix_stream_parameters) - muxer_stream_fix_parameters(str->muxer, str); - } - - /* write header */ - if (s->muxer->cont_write_header) - muxer_write_header(s->muxer); - - /* send all buffered frames to muxer */ - for (num = 0; num < s->muxer->muxbuf_num; ++num) { - muxbuf_t tmp_buf; - buf = s->muxer->muxbuf + num; - s = buf->stream; - - /* 1. save timer and buffer (might have changed by now) */ - tmp_buf.dts = s->timer; - tmp_buf.buffer = s->buffer; - - /* 2. move stored timer and buffer into stream and mux it */ - s->timer = buf->dts; - s->buffer = buf->buffer; - s->muxer->cont_write_chunk(s, buf->len, buf->flags, buf->dts, buf->pts); - - /* 3. restore saved timer and buffer */ - s->timer = tmp_buf.dts; - s->buffer = tmp_buf.buffer; - } - - free(s->muxer->muxbuf); - s->muxer->muxbuf_num = 0; - } + if (s->muxer->muxbuf_skip_buffer) + muxer_flush(s->muxer); } /* this code moved directly from muxer_avi.c */ diff --git a/mplayer/libmpdemux/muxer.h b/mplayer/libmpdemux/muxer.h index d830eb96..b3307050 100644 --- a/mplayer/libmpdemux/muxer.h +++ b/mplayer/libmpdemux/muxer.h @@ -133,6 +133,7 @@ extern const m_option_t mpegopts_conf[]; extern const m_option_t nuvopts_conf[]; muxer_t *muxer_new_muxer(int type,stream_t *stream); +void muxer_flush(muxer_t *m); #define muxer_new_stream(muxer,a) muxer->cont_new_stream(muxer,a) #define muxer_stream_fix_parameters(muxer, a) muxer->fix_stream_parameters(a) void muxer_write_chunk(muxer_stream_t *s, size_t len, unsigned int flags, double dts, double pts); diff --git a/mplayer/libmpdemux/muxer_lavf.c b/mplayer/libmpdemux/muxer_lavf.c index 58968fdc..6f1b58e5 100644 --- a/mplayer/libmpdemux/muxer_lavf.c +++ b/mplayer/libmpdemux/muxer_lavf.c @@ -159,10 +159,10 @@ static muxer_stream_t* lavf_new_stream(muxer_t *muxer, int type) switch(type) { case MUXER_TYPE_VIDEO: - ctx->codec_type = CODEC_TYPE_VIDEO; + ctx->codec_type = AVMEDIA_TYPE_VIDEO; break; case MUXER_TYPE_AUDIO: - ctx->codec_type = CODEC_TYPE_AUDIO; + ctx->codec_type = AVMEDIA_TYPE_AUDIO; break; } @@ -260,7 +260,7 @@ static void write_chunk(muxer_stream_t *stream, size_t len, unsigned int flags, pkt.data = stream->buffer; if(flags & AVIIF_KEYFRAME) - pkt.flags |= PKT_FLAG_KEY; + pkt.flags |= AV_PKT_FLAG_KEY; else pkt.flags = 0; diff --git a/mplayer/libmpdemux/video.c b/mplayer/libmpdemux/video.c index 66276dd6..8b63e856 100644 --- a/mplayer/libmpdemux/video.c +++ b/mplayer/libmpdemux/video.c @@ -130,7 +130,7 @@ switch(video_codec){ } mp_msg(MSGT_DECVIDEO,MSGL_V,"OK!\n"); if(!videobuffer) { - videobuffer=(char*)memalign(8,VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE); + videobuffer = memalign(8, VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE); if (videobuffer) memset(videobuffer+VIDEOBUFFER_SIZE, 0, MP_INPUT_BUFFER_PADDING_SIZE); else { mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_ShMemAllocFail); @@ -225,7 +225,7 @@ switch(video_codec){ } mp_msg(MSGT_DECVIDEO,MSGL_V,"OK!\n"); if(!videobuffer) { - videobuffer=(char*)memalign(8,VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE); + videobuffer = memalign(8, VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE); if (videobuffer) memset(videobuffer+VIDEOBUFFER_SIZE, 0, MP_INPUT_BUFFER_PADDING_SIZE); else { mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_ShMemAllocFail); @@ -290,7 +290,7 @@ switch(video_codec){ mp_msg(MSGT_DECVIDEO,MSGL_V,"OK!\n"); // ========= Read & process sequence header & extension ============ if(!videobuffer) { - videobuffer=(char*)memalign(8,VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE); + videobuffer = memalign(8, VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE); if (videobuffer) memset(videobuffer+VIDEOBUFFER_SIZE, 0, MP_INPUT_BUFFER_PADDING_SIZE); else { mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_ShMemAllocFail); @@ -358,7 +358,7 @@ switch(video_codec){ } mp_msg(MSGT_DECVIDEO,MSGL_INFO,"found\n"); if(!videobuffer) { - videobuffer=(char*)memalign(8,VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE); + videobuffer = memalign(8, VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE); if (videobuffer) memset(videobuffer+VIDEOBUFFER_SIZE, 0, MP_INPUT_BUFFER_PADDING_SIZE); else { mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_ShMemAllocFail); diff --git a/mplayer/libvo/fastmemcpy.h b/mplayer/libvo/fastmemcpy.h index f5429de2..b0e8a63d 100644 --- a/mplayer/libvo/fastmemcpy.h +++ b/mplayer/libvo/fastmemcpy.h @@ -36,30 +36,30 @@ void * mem2agpcpy(void * to, const void * from, size_t len); static inline void * mem2agpcpy_pic(void * dst, const void * src, int bytesPerLine, int height, int dstStride, int srcStride) { - int i; - void *retval=dst; + int i; + void *retval=dst; - if(dstStride == srcStride) - { - if (srcStride < 0) { - src = (uint8_t*)src + (height-1)*srcStride; - dst = (uint8_t*)dst + (height-1)*dstStride; - srcStride = -srcStride; - } + if(dstStride == srcStride) + { + if (srcStride < 0) { + src = (uint8_t*)src + (height-1)*srcStride; + dst = (uint8_t*)dst + (height-1)*dstStride; + srcStride = -srcStride; + } - mem2agpcpy(dst, src, srcStride*height); - } - else - { - for(i=0; i