FLAC Agent Build: Difference between revisions
No edit summary |
|||
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DiscussionThread | {{DiscussionThread | ||
|Synopsis=I am building a self-learning FLAC Agent and this will track the trials and tribulations of the build here. | |Synopsis=I am building a self-learning FLAC Agent and this will track the trials and tribulations of the build here. | ||
|Analysis=So after weeks,if not months, of analysis finally figured out | |Analysis=Naturally I was wrong, again. It seemed too simple and offered no real prediction so lo and behold I was wrong. All I was looking at was the compression of the residual signal, which I should have known be the raw PCM/Wav values were not in there. | ||
Not back to the drawing board because the residual signal is critical to building the signal but back to the mines because the the vein of information I am pursuing is still hidden in the code. | |||
Coefficients will either be my shoal that I sink on or my safe harbor where I thrive through the storms to come. | |||
So after weeks,if not months, of analysis finally figured out fLaC compression is way simpler than I thought. As near as I can figure right now it works not on predicting the stream but rather on focusing on each individual sample's amplitude and having a simple code algorithm to represent it in few bits than the 24 assigned in my case. For example 0xFFFB81 or -1151 can be represented by 0x8fd through | |||
'''int value = (int)(x >> 1) ^ -(int)(x & 1);''' | '''int value = (int)(x >> 1) ^ -(int)(x & 1);''' | ||
using 10 bits to represent 24 basically by stripping | using 10 bits to represent 24 basically by stripping repetitive high order bits flagging negative. | ||
'''Much more straightforward than I imagined''' | '''Much more straightforward than I imagined''' | ||
I decided to loose my agent against | I decided to loose my agent against fLaC files on the NVDIA GPU I have so closed on using C/C++ and CUDA. | ||
Got linker to work. created a.out in Debug directory | Got linker to work. created a.out in Debug directory | ||
Line 17: | Line 23: | ||
|EditDate=2024-08-06 | |EditDate=2024-08-06 | ||
|Prime Category=Information Services | |Prime Category=Information Services | ||
|WebRef=https://developer.nvidia.com/cuda-toolkit \ https://xiph.org/flac/ \ https://ftp.osuosl.org/pub/xiph/releases/flac/ \ https://www.rfc-editor.org/rfc/rfc9639.html#name-examples | |WebRef=https://developer.nvidia.com/cuda-toolkit \ https://xiph.org/flac/ \ https://ftp.osuosl.org/pub/xiph/releases/flac/ \ https://www.rfc-editor.org/rfc/rfc9639.html#name-examples \ https://en.wikipedia.org/wiki/Linear_prediction | ||
}} | }} | ||
I want to build an agent that will read flac music files and identify patterns in them. Once it has the patterns identified I want to see if can draw images in line with the evolving songs and long term improvise based on optimum patterns. Very long term may play sounds that draw a message the machine wants to tell us. | I want to build an agent that will read flac music files and identify patterns in them. Once it has the patterns identified I want to see if can draw images in line with the evolving songs and long term improvise based on optimum patterns. Very long term may play sounds that draw a message the machine wants to tell us. | ||
Line 361: | Line 367: | ||
=====qlp_coeff===== | =====qlp_coeff===== | ||
[[w:Linear prediction]] | |||
File Data | File Data | ||
word = 0x71e69de55c518b82 start 2370 | word = 0x71e69de55c518b82 start 2370 | ||
Line 428: | Line 436: | ||
|} | |} | ||
===Core Algorithm=== | ===Core Algorithm=== | ||
====Read | ====Read Residual RICE==== | ||
'''work from sdc 2976''' | '''work from sdc 2976''' | ||
File Data 2383.b_3 ''x.b0 0100'' '''0b000 0001.x44''' | File Data 2383.b_3 ''x.b0 0100'' '''0b000 0001.x44''' | ||
Line 693: | Line 700: | ||
=====Notes for code analysis===== | =====Notes for code analysis===== | ||
4 bytes / int 32 Bits. | |||
little endian memory dump of in storage buffer | |||
'''19 7F D1 4F 19 7F D1 4F 19 7F D1 4F FD 44 01 37''' 56 26 0A 25 B2 EE F6 7F 9D 10 5D 79 62 33 5B 9F B4 0E 65 24 15 7A 35 13 '''370144FD4FD17F19''' at 2380 in test.flac. | |||
File | |||
3701 44FD 4FD1 4FD1 7F19 ''7FF6 EEB2 250A 2656'' '''''does not line up with contiguous memory location. Only 64 bit word valid in memory (if reversed)''''' | |||
loc '''2380''' in file | |||
word | |||
====LPC Residual==== | |||
'''work from sdc 2987 ''' sample += u; = 4088 for 0 partition 4096 thereafter | |||
residual* 24 bit values in memory starting with: <ref>Little Endian''' | |||
<nowiki> | |||
Address 0 - 3 4 - 7 8 - B C - F | |||
0000555555863340 81FBFFFF 81FDFFFF FE060000 D0FCFFFF | |||
0000555555863350 09FEFFFF 8AFEFFFF 25040000 76F9FFFF | |||
0000555555863360 4BFBFFFF 29FEFFFF 99FFFFFF D8FFFFFF | |||
0000555555863370 BA040000 ECFDFFFF 26020000 A8FEFFFF | |||
0000555555863380 15020000 46020000 87000000 2FFFFFFF | |||
0000555555863390 6DFDFFFF 3AFEFFFF 0CFBFFFF 8F030000 | |||
00005555558633A0 68FCFFFF ADFFFFFF 17050000 C8000000 | |||
00005555558633B0 27030000 10000000 0B040000 C4FDFFFF | |||
00005555558633C0 DFFDFFFF 42030000 CAFBFFFF 41030000 | |||
00005555558633D0 15020000 EBFEFFFF CD030000 84FFFFFF | |||
00005555558633E0 4C020000 40020000 B3FBFFFF E4010000 | |||
</nowiki> | |||
=====Next Edit===== | |||
==Linear Predictive Coding== | |||
[[Linear Predictive Coding]] | |||
{| class="wikitable" style="margin:auto" | |||
|+ Frame Header 2 | |||
|- | |||
! Line Number !! Code Package !! LOC purpose !! Operation Description | |||
|- | |||
| 2987 || SDC || read_residual_partitioned_rice|| sample += u; <br/> | |||
Key parameters | |||
* sample = 4088 for partition 0 4096 thereafter | |||
|- | |||
| 2883 || SDC || read_subframe_lpc || break | |||
|- | |||
| 2889 ||SDC || Do Full Decode || | |||
|- | |||
| 2892 || SDC || Get Warm-up values || 8 previously stored warm-up values based on order=8 | |||
|- | |||
| 2894 || SDC || call FLAC lpc max bps || | |||
|- | |||
| 960 || LPC || FLAC__lpc_max_residual_bps ||Variables | |||
* uint32_t subframe_bps = 24 | |||
* const FLAC__int32 * flac_restrict qlp_coeff : 0x555555859EFC <Hex> | |||
Address 0 - 3 4 - 7 8 - B C - F | |||
0000555555859EF0 08000000 0F000000 0D000000 E51D0000 | |||
0000555555859F00 282E0000 E0E2FFFF F4CFFFFF 170C0000 | |||
0000555555859F10 17210000 72010000 6EF2FFFF | |||
* uint32_t order = 8 | |||
* int lp_quantization = 13 0xD | |||
|- | |||
| 948 || LPC || FLAC__lpc_max_prediction_before_shift_bps|| | |||
|- | |||
| 2895 || SDC || read_subframe_lpc_|| Checks less than 32 bits | |||
|- | |||
|2898 || SDC ||read_subframe_lpc_|| FLAC__lpc_restore_signal_wide | |||
|- | |||
|} | |||
===Pertinent Code=== | |||
960 LPC FLAC__int32 predictor_sum_bps = FLAC__lpc_max_prediction_before_shift_bps(subframe_bps, qlp_coeff, order) - lp_quantization; | |||
===Notes for code analysis=== | |||
4 bytes / int 32 Bits. | 4 bytes / int 32 Bits. | ||
Latest revision as of 16:50, 13 February 2025
EditDate | 2024-08-06 |
---|
Related Threads: FLAC Agent
I am building a self-learning FLAC Agent and this will track the trials and tribulations of the build here.
Naturally I was wrong, again. It seemed too simple and offered no real prediction so lo and behold I was wrong. All I was looking at was the compression of the residual signal, which I should have known be the raw PCM/Wav values were not in there.
Not back to the drawing board because the residual signal is critical to building the signal but back to the mines because the the vein of information I am pursuing is still hidden in the code.
Coefficients will either be my shoal that I sink on or my safe harbor where I thrive through the storms to come.
So after weeks,if not months, of analysis finally figured out fLaC compression is way simpler than I thought. As near as I can figure right now it works not on predicting the stream but rather on focusing on each individual sample's amplitude and having a simple code algorithm to represent it in few bits than the 24 assigned in my case. For example 0xFFFB81 or -1151 can be represented by 0x8fd through
int value = (int)(x >> 1) ^ -(int)(x & 1);
using 10 bits to represent 24 basically by stripping repetitive high order bits flagging negative.
Much more straightforward than I imagined
I decided to loose my agent against fLaC files on the NVDIA GPU I have so closed on using C/C++ and CUDA.
Got linker to work. created a.out in Debug directory
Corrected the linker so it's now debuggable and gdb allows me to see assembler code so I'm finally talking directly to the machine again.
Brings me back.Web References https://developer.nvidia.com/cuda-toolkit, https://xiph.org/flac/, https://ftp.osuosl.org/pub/xiph/releases/flac/, https://www.rfc-editor.org/rfc/rfc9639.html#name-examples, https://en.wikipedia.org/wiki/Linear prediction
I want to build an agent that will read flac music files and identify patterns in them. Once it has the patterns identified I want to see if can draw images in line with the evolving songs and long term improvise based on optimum patterns. Very long term may play sounds that draw a message the machine wants to tell us.
Log
-- Johnny (talk) 01:43, 8 December 2024 (UTC) Figured out how to dump memory. Export to /tmp --Johnny (talk) 17:41, 21 November 2024 (UTC) Printed off stream_decoder.c from FLAC xiph code and tracing through documenting reads from file. So far seems they do way more 8 bit and less reads than I'll need. See below for sequence of reads.
—Johnny (talk) 20:53, 14 November 2024 (UTC) 2 break throughs today. Found shorten a program from Tony Robinson at Cambridge that is the compression logic behind flac and it’s in C. File:Robinson tr156.ps
—Johnny (talk) 15:43, 14 November 2024 (UTC) Well I think I figured it out, going to check this afternoon. In the export session I was sending both mono tracks to the left and right stereo channels so naturally they were identical. Garbage in garbage out. Going to try splitting them. Top voice to right channel and bottom guitar to the left hand of God.
—Johnny (talk) 12:58, 14 November 2024 (UTC) Tan into core problem last night. Channel/Track 0===1. Need to determine where in file creation scheme this is happening.
--Johnny (talk) 11:02, 29 October 2024 (UTC) Reading the flac file and starting to breakdown metadata. Expect to lift and streamline decoding code. Just found out we can create our own metadata bloc and hope to store successive passes of agent there.
--Johnny (talk) 20:51, 6 August 2024 (UTC) Got linker to work.
--Johnny (talk) 19:14, 6 August 2024 (UTC) First had to get a working version of Eclipse that ran on the version of Ubuntu I had. This required updating Eclipse to include the development version so I am currently running Eclipse version=4.32.0 and Ubuntu Oracular Oriole (development branch) which was the only version I found that allowed my instruction debug due to comaptibility issues after Ubuntu updated to Wayland from X11.
Once I had a working development environment I install [ttps://ftp.osuosl.org/pub/xiph/releases/flac/ libFLAC] Unfortunately I've been unable to get a clean link in the development environment so I'm now trying Configure C project with cmake in eclipse manual method to assemble and successfully compile decoder.
Analyze flac stream
The test.flac file
0000:0000 | 66 4C 61 43 00 00 00 22 10 00 10 00 00 01 59 00 | fLaC..."......Y. 0000:0010 | 1D 88 2E E0 03 70 04 BE 30 D0 4F CA 4A C4 B1 96 | ...à.p.¾0ÐOÊJı. 0000:0020 | E4 DE 2B A3 C8 66 BD 20 A4 31 03 00 02 F4 00 00 | äÞ+£Èf½ ¤1...ô.. 0000:0030 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 | ................ 0000:0040 | 00 00 00 00 00 1D 40 00 00 00 00 00 00 2C 42 C9 | ......@......,BÉ 0000:0050 | 10 00 00 00 00 00 00 3A 90 00 00 00 00 00 00 5A | .......:.......Z 0000:0060 | B2 A9 10 00 00 00 00 00 00 57 E0 00 00 00 00 00 | ²©.......Wà..... 0000:0070 | 00 89 59 38 10 00 00 00 00 00 00 75 30 00 00 00 | ..Y8.......u0... 0000:0080 | 00 00 00 B8 D2 F6 10 00 00 00 00 00 00 92 70 00 | ...¸Òö........p. 0000:0090 | 00 00 00 00 00 E7 CB 21 10 00 00 00 00 00 00 AF | .....çË!.......¯ 0000:00A0 | C0 00 00 00 00 00 01 17 62 29 10 00 00 00 00 00 | À.......b)...... 0000:00B0 | 00 CD 10 00 00 00 00 00 01 46 C7 46 10 00 00 00 | .Í.......FÇF.... 0000:00C0 | 00 00 00 EA 60 00 00 00 00 00 01 76 C5 7E 10 00 | ...ê`......vÅ~.. 0000:00D0 | 00 00 00 00 01 07 A0 00 00 00 00 00 01 A6 43 11 | ...... ......¦C. 0000:00E0 | 10 00 00 00 00 00 01 24 F0 00 00 00 00 00 01 D6 | .......$ð......Ö 0000:00F0 | 3E CE 10 00 00 00 00 00 01 42 40 00 00 00 00 00 | >Î.......B@..... 0000:0100 | 02 06 0E DF 10 00 00 00 00 00 01 5F 90 00 00 00 | ...ß......._.... 0000:0110 | 00 00 02 35 51 2A 10 00 00 00 00 00 01 7C D0 00 | ...5Q*.......|Ð. 0000:0120 | 00 00 00 00 02 64 C4 5D 10 00 00 00 00 00 01 9A | .....dÄ]........ 0000:0130 | 20 00 00 00 00 00 02 94 36 7C 10 00 00 00 00 00 | .......6|...... 0000:0140 | 01 B7 70 00 00 00 00 00 02 C3 E5 15 10 00 00 00 | .·p......Ãå..... 0000:0150 | 00 00 01 D4 C0 00 00 00 00 00 02 F3 EE 56 10 00 | ...ÔÀ......óîV.. 0000:0160 | 00 00 00 00 01 F2 00 00 00 00 00 00 03 23 B2 77 | .....ò.......#²w 0000:0170 | 10 00 00 00 00 00 02 0F 50 00 00 00 00 00 03 53 | ........P......S 0000:0180 | 78 02 10 00 00 00 00 00 02 2C A0 00 00 00 00 00 | x........, ..... 0000:0190 | 03 83 A9 4D 10 00 00 00 00 00 02 49 F0 00 00 00 | ..©M.......Ið... 0000:01A0 | 00 00 03 B2 CA 1E 10 00 00 00 00 00 02 67 30 00 | ...²Ê........g0. 0000:01B0 | 00 00 00 00 03 E2 21 59 10 00 00 00 00 00 02 84 | .....â!Y........ 0000:01C0 | 80 00 00 00 00 00 04 11 6A 20 10 00 00 00 00 00 | ........j ...... 0000:01D0 | 02 A1 D0 00 00 00 00 00 04 40 99 8E 10 00 00 00 | .¡Ð......@...... 0000:01E0 | 00 00 02 BF 20 00 00 00 00 00 04 70 26 72 10 00 | ...¿ ......p&r.. 0000:01F0 | 00 00 00 00 02 DC 60 00 00 00 00 00 04 9F AC 04 | .....Ü`.......¬. 0000:0200 | 10 00 00 00 00 00 02 F9 B0 00 00 00 00 00 04 CF | .......ù°......Ï 0000:0210 | 68 DE 10 00 00 00 00 00 03 17 00 00 00 00 00 00 | hÞ.............. 0000:0220 | 04 FF BB 39 10 00 00 00 00 00 03 34 50 00 00 00 | .ÿ»9.......4P... 0000:0230 | 00 00 05 30 0F 68 10 00 00 00 00 00 03 51 90 00 | ...0.h.......Q.. 0000:0240 | 00 00 00 00 05 5F BE 20 10 00 00 00 00 00 03 6E | ....._¾ .......n 0000:0250 | E0 00 00 00 00 00 05 8F 2A F4 10 00 00 00 00 00 | à.......*ô...... 0000:0260 | 03 8C 30 00 00 00 00 00 05 BE CE 03 10 00 00 00 | ..0......¾Î..... 0000:0270 | 00 00 03 A9 80 00 00 00 00 00 05 EE 42 EF 10 00 | ...©.......îBï.. 0000:0280 | 00 00 00 00 03 C6 C0 00 00 00 00 00 06 1E 70 80 | .....ÆÀ.......p. 0000:0290 | 10 00 00 00 00 00 03 E4 10 00 00 00 00 00 06 4E | .......ä.......N 0000:02A0 | 24 95 10 00 00 00 00 00 04 01 60 00 00 00 00 00 | $.........`..... 0000:02B0 | 06 7E 2E 0E 10 00 00 00 00 00 04 1E B0 00 00 00 | .~..........°... 0000:02C0 | 00 00 06 AE 5B CB 10 00 00 00 00 00 04 3B F0 00 | ...®[Ë.......;ð. 0000:02D0 | 00 00 00 00 06 DD 86 77 10 00 00 00 00 00 04 59 | .....Ý.w.......Y 0000:02E0 | 40 00 00 00 00 00 07 0D D9 09 10 00 00 00 00 00 | @.......Ù....... 0000:02F0 | 04 76 90 00 00 00 00 00 07 3D 1D 71 10 00 00 00 | .v.......=.q.... 0000:0300 | 00 00 04 93 E0 00 00 00 00 00 07 6C 91 E0 10 00 | ....à......l.à.. 0000:0310 | 00 00 00 00 04 B1 20 00 00 00 00 00 07 9A A0 3A | .....± ....... : 0000:0320 | 10 00 04 00 00 28 20 00 00 00 72 65 66 65 72 65 | .....( ...refere 0000:0330 | 6E 63 65 20 6C 69 62 46 4C 41 43 20 31 2E 34 2E | nce libFLAC 1.4. 0000:0340 | 33 20 32 30 32 33 30 36 32 33 00 00 00 00 81 00 | 3 20230623...... 0000:0350 | 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ............... 0000:0360 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ ... 0000:2350 | 00 00 FF F8 C3 8C 00 F0 4E FF 89 81 FF 8E 74 FF | ..ÿøÃ..ðNÿ..ÿ.tÿ 0000:2360 | 92 E9 FF 95 46 FF 91 DF FF 8E A2 FF 86 61 FF 7B | .éÿ.Fÿ.ßÿ.¢ÿ.aÿ{ 0000:2370 | 71 E6 9D E5 5C 51 8B 82 7F A0 C1 74 22 E0 5C B9 | qæ.å\Q... Át"à\¹ 0000:2380 | 37 01 44 FD 4F D1 7F 19 7F F6 EE B2 25 0A 26 56 | 7.DýOÑ...öî²%.&V 0000:2390 | 9F 5B 33 62 79 5D 10 9D 13 35 7A 15 24 65 0E B4 | .[3by]...5z.$e.´ 0000:23A0 | 2A 4B E2 CB CE E3 CE 5F 29 4C 5D 64 19 3A 10 10 | *KâËÎãÎ_)L]d.:.. 0000:23B0 | 59 1D D1 05 A1 08 D6 D0 48 55 8A 5E 6A 7B A4 C2 | Y.Ñ.¡.ÖÐHU.^j{¤Â 0000:23C0 | 40 12 67 E4 60 3E 4B CB E3 AD 01 86 B8 6B 7B 62 | @.gä`>KËã...¸k{b
The test.raw file
Little Endian
Remember reverse order little endian 8189FF = FF8981 and that in test.flac file 2 channels are identical.
0000:0000 | 81 89 FF 81 89 FF 74 8E FF 74 8E FF E9 92 FF E9 | ..ÿ..ÿt.ÿt.ÿé.ÿé 0000:0010 | 92 FF 46 95 FF 46 95 FF DF 91 FF DF 91 FF A2 8E | .ÿF.ÿF.ÿß.ÿß.ÿ¢. 0000:0020 | FF A2 8E FF 61 86 FF 61 86 FF 71 7B FF 71 7B FF | ÿ¢.ÿa.ÿa.ÿq{ÿq{ÿ
#Warmup ends
- Find FF70C6
0000:0030 | C6 70 FF C6 70 FF AA 64 FF AA 64 FF 47 63 FF 47 | ÆpÿÆpÿªdÿªdÿGcÿG 0000:0040 | 63 FF D8 58 FF D8 58 FF FD 5D FF FD 5D FF 5A 59 | cÿØXÿØXÿý]ÿý]ÿZY 0000:0050 | FF 5A 59 FF 06 61 FF 06 61 FF EA 58 FF EA 58 FF | ÿZYÿ.aÿ.aÿêXÿêXÿ 0000:0060 | 55 59 FF 55 59 FF 1A 4D FF 1A 4D FF 43 43 FF 43 | UYÿUYÿ.Mÿ.MÿCCÿC 0000:0070 | 43 FF 3B 37 FF 3B 37 FF AA 2F FF AA 2F FF D8 25 | Cÿ;7ÿ;7ÿª/ÿª/ÿØ% 0000:0080 | FF D8 25 FF E6 27 FF E6 27 FF 34 24 FF 34 24 FF | ÿØ%ÿæ'ÿæ'ÿ4$ÿ4$ÿ 0000:0090 | FD 2B FF FD 2B FF 71 30 FF 71 30 FF 75 36 FF 75 | ý+ÿý+ÿq0ÿq0ÿu6ÿu 0000:00A0 | 36 FF 00 3B FF 00 3B FF EB 39 FF EB 39 FF 7A 37 | 6ÿ.;ÿ.;ÿë9ÿë9ÿz7 0000:00B0 | FF 7A 37 FF FB 2B FF FB 2B FF 31 29 FF 31 29 FF | ÿz7ÿû+ÿû+ÿ1)ÿ1)ÿ 0000:00C0 | 89 17 FF 89 17 FF 17 17 FF 17 17 FF 08 12 FF 08 | ..ÿ..ÿ..ÿ..ÿ..ÿ. 0000:00D0 | 12 FF C5 13 FF C5 13 FF CA 1E FF CA 1E FF BD 24 | .ÿÅ.ÿÅ.ÿÊ.ÿÊ.ÿ½$ 0000:00E0 | FF BD 24 FF 82 36 FF 82 36 FF C9 3A FF C9 3A FF | ÿ½$ÿ.6ÿ.6ÿÉ:ÿÉ:ÿ 0000:00F0 | 73 45 FF 73 45 FF C9 47 FF C9 47 FF 2C 43 FF 2C | sEÿsEÿÉGÿÉGÿ,Cÿ,
Big Endian
Warmup to 0x30
0000:0000 | FF 89 81 FF 89 81 FF 8E 74 FF 8E 74 FF 92 E9 FF | ÿ..ÿ..ÿ.tÿ.tÿ.éÿ 0000:0010 | 92 E9 FF 95 46 FF 95 46 FF 91 DF FF 91 DF FF 8E | .éÿ.Fÿ.Fÿ.ßÿ.ßÿ. 0000:0020 | A2 FF 8E A2 FF 86 61 FF 86 61 FF 7B 71 FF 7B 71 | ¢ÿ.¢ÿ.aÿ.aÿ{qÿ{q
Start Frame 0 Decompress 4088 entries
0000:0030 | FF 70 C6 FF 70 C6 FF 64 AA FF 64 AA FF 63 47 FF | ÿpÆÿpÆÿdªÿdªÿcGÿ 0000:0040 | 63 47 FF 58 D8 FF 58 D8 FF 5D FD FF 5D FD FF 59 | cGÿXØÿXØÿ]ýÿ]ýÿY 0000:0050 | 5A FF 59 5A FF 61 06 FF 61 06 FF 58 EA FF 58 EA | ZÿYZÿa.ÿa.ÿXêÿXê
Trace of reads
Acronyms:
SDC = Stream_Decoder.c BitR - Bitreader.c
Metadata Reads
Line Number | Code Package | Module | Value | Opertion Description |
---|---|---|---|---|
1339 | SDC | Find Metadata | fLaC 0x_664C6143 |
Verifying 8 bits at a time that file starts with fLAc. |
1394 | SDC | Read Metadata | 0b_0 | Read 1 bit to determine last metadata block.. |
1398 | SDC | Read Metadata | 0b_0000000 | Read 7 bits. Metadata Type 0 Streaminfo |
1401 | SDC | Read Metadata | 0x_000022 | Read 24 bits indicating length 34. |
1578 | SDC | Read StreamInfo | 0x664C614300000022 | Read 34 bytes 0x_22 into Streaminfo structure
|
Line Number | Code Package | Module | Value | Operation Description | |
---|---|---|---|---|---|
1040 | SDC | Decode till End Meta | case FLAC__STREAM_DECODER_READ_METADATA | Read all Metadata Blocks | |
1394 | SDC | Read Metadata | 0b_0 | Read 1 bit to determine last metadata block. | |
1398 | SDC | Read Metadata | 0b_0000011 | Read 7 bits. Metadata Type 3 FLAC__METADATA_TYPE_SEEKTABLE | |
1401 | SDC | Read Metadata | 0x_0002F4 | Read 24 bits indicating length 756. | Will determine later if we need seektable information |
Line Number | Code Package | Module | Value | Operation Description |
---|---|---|---|---|
1040 | SDC | Decode till End Meta | case FLAC__STREAM_DECODER_READ_METADATA | Read all Metadata Blocks |
1394 | SDC | Read Metadata | 0b_0 | Read 1 bit to determine last metadata block. |
1398 | SDC | Read Metadata | 0b_0000100 | Read 7 bits. Metadata Type 4 FLAC__METADATA_TYPE_VORBIS_COMMENT |
1401 | SDC | Read Metadata | 0x_000028 | Read 24 bits indicating length 40. |
1478 | SDC | Read Metadata | 4 | Type 4 case FLAC__METADATA_TYPE_VORBIS_COMMENT |
Line Number | Code Package | Module | Value | Operation Description |
---|---|---|---|---|
1040 | SDC | Decode till End Meta | case FLAC__STREAM_DECODER_READ_METADATA | Read all Metadata Blocks |
1394 | SDC | Read Metadata | 0b_1 | Read 1 bit to determine last metadata block last=true. |
1398 | SDC | Read Metadata | 0b_0000001 | Read 7 bits. Metadata Type 1 FLAC__METADATA_TYPE_PADDING: |
1401 | SDC | Read Metadata | 0x002000 | Read 24 bits indicating length 8192. |
1453 | SDC | Read Metadata | skip_it=true | Type 1 FLAC__METADATA_TYPE_PADDING: skip to 2352 |
Data Reads
Old Format Good overview with some details that are missing and need to be found in code.
Sync Frame
Line Number | Code Package | Module | Value | Opertion Description |
---|---|---|---|---|
1047 | SDC | Find Metadata | 0xFFF8 | FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC FFF8 |
1071 | SDC | stream decoder process | 0xFFF8 | FLAC__stream_decoder_process_until_end_of_stream |
1989 | SDC | frame_sync_ | 0xFFF8 | Read 7 bits. Metadata Type 0 Streaminfo |
418 | BRC | FLAC__bitreader_read_raw_uint32 | 0xFFF8 | Read 8 bits at a time validating each byte. |
2009 | SDC | frame_sync_ | 0b1111 1111 | FF start right at end of metadata padding. 2532 |
2020 | SDC | frame_sync_ | 0b1111 10 | Right shift F8 to 0x_7c |
Read Frame Header Metadata
Starting at 0x_2352 FFF8 C38C
& value 007F
- 0b_1111 1111 1111 10 Frame Header sync'. 14 bits
- 0b_0 mandatory 0 value Validation Bit 15
- 0b_0 0 = fixed blocking strategy Fixed Blocks or Not Bit 16
- 0b_1100 0x_C 12-8 = 4 so 2 to the 4th power = 16 time 256 = 4096 samples. ( 2358 SDC read frame header) frame blocksize
- 0b_0011 0x3 3 sample rate 192,000 ( 2379 SDC read frame header) samplerate'
- 0b1000 8 left/side stereo: channel 0 is the left channel, channel 1 is the side(difference) channel ( 2423 SDC read frame header) Channel Handling
- 0b110 = C 24 bits per sample bps
- 0b_0 Mandatory 0. Validation
Line Number | Code Package | Module | Value | Operation Description |
---|---|---|---|---|
3700 | SDC | file_tell_callback_ | 0x4000 | Absolute position 16,384 |
889 | SDC | FLAC__stream_decoder_get_decode_position | 0_x2354 | Start of Frame after frame header at 9044 in. |
1075 | SDC | stream decoder process | case FLAC__STREAM_DECODER_READ_FRAME: | Read Frame |
2041 | SDC | read_frame | 0x_0002F4 | Read frame to decode. |
350 | BRC | FLAC__bitreader_reset_read_crc16 | reset crc | FLAC__bitreader_reset_read_crc16 |
2277 | SDC | read_frame_header_ | 0x_FFF8C38C | Frame header breakdown
|
2358 | SDC | read_frame_header_ | 0b1100 | 4 bits frame.header.blocksize = 256 << (x-8) 4096 256 * 24 . |
2379 | SDC | read_frame_header_ | 0b0011 | 4 bits map 3 to 192000 frame.header.sample_rate = 192000 |
2423 | SDC | read_frame_header_ | 0b1000 | 4 Bits map to left side channel frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE; |
2364 | SDC | read_frame_header_ | 0b110 | 3 bits map to 24 bps frame.header.bits_per_sample = 24 |
Get Frame Number and CRC8
Line Number | Code Package | Module | Value | Operation Description |
---|---|---|---|---|
2499 | SDC | read_frame_header_ | Fixed Block size | UTF8 -> BRC |
928 | BRC | FLAC__bitreader_read_utf8_uint32 | 0b_0000 | Get Frame Number 8 bits and store past 4 bytes already stored |
934 | BRC | FLAC__bitreader_read_raw_uint32 | 0x_00 | Read full byte even frame number |
2509 | SDC | read_frame_header | 0x00 | Frame 0 |
2554 | SDC | read_frame_header | 0x_F0 | CRC8 |
Warmup
Line Number | Code Package | Module | Value | Operation Description |
---|---|---|---|---|
2554 | SDC | read_frame_header | 0x_F0 | Read next 8 bits -> uint 32 |
934 | BRC | FLAC__bitreader_read_raw_uint32 | 0x_F0 | Read next byte. |
2556 | SDC | read_frame_header | 0xF0 | crc8 = 0x_F) 240 |
2072 | SDC | read_frame | 0x_F0 | Read Left Side Set 2 Channels |
2600 | SDC | read_subframe | 0x_4E | read uint 8 bits then 24 bit sequences FLAC FRAME MAGIC NUMBER LPC Frame |
2635 | SDC | read_subframe | 0x_4E | Select
|
2666 | SDC | read_subframe | 0x_4E | Set predictor_order ((0x4E>>1)&31)+1 = 8
|
2806 | SDC | read_subframe_lpc | 0xff8981 | Read 24 bits 1 for each predictor order so 8 in this case. |
2823 | SDC | read_subframe_lpc | 0xff8981 | predictor order = 8 so 8 64 bit warm-ups loaded starting at 2359 stopping 2371.
|
qlp_coeff
File Data
word = 0x71e69de55c518b82 start 2370 bits read in previous routine 0x71 Start at 2371 0xE6 9DE5 5C51 8B82 bits 0b1110 01101 001 1101 1110 0101 010 1110 0010 1000 1 0101 1100 0101 0001 1000 1011 1000 0010 1 D E 5 2 E 2 8
Line Number | Code Package | Module | Value | Operation Description |
---|---|---|---|---|
2827 | SDC | read_subframe_lpc | 0b_1110 | Read 4 bits subframe->qlp_coeff_precision = u32+1 = 15; |
2844 | SDC | read_subframe_lpc | 0b_01101 | read 5 bits quantization_level = i32 = 13 subframe->quantization_level = i32; = i32; |
2850 | SDC | read_subframe_lpc | 0x_1DE5 | read 15 bits based on precision determined above qlp_coeff[u] = 0-8 predictor
if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, subframe->qlp_coeff_precision precision = 15 )) return false; /* read_callback_ sets the state for us */ subframe->qlp_coeff[u 0-7] = i32; }
|
9 bits Next word consumed.
SDC to Rice Reader
File Data 2381.b_a x37.b0 0b000 0001.x44
word = 0x370144fd4fd17f19 bits read in previous routine b0011 0111 0 0x37.b0 starting bits 0b000 0001 the 0x44FD 4FD1 7F19
little endian memory dump of in storage buffer
19 7F D1 4F 19 7F D1 4F 19 7F D1 4F FD 44 01 37 56 26 0A 25 B2 EE F6 7F 9D 10 5D 79 62 33 5B 9F B4 0E 65 24 15 7A 35 13 370144FD4FD17F19 at 2380 in test.flac.
File
3701 44FD 4FD1 4FD1 7F19 7FF6 EEB2 250A 2656 does not line up with contiguous memory location. Only 64 bit word valid in memory (if reversed) loc 2380 in file
word
0x370144fd4fd17f19
Line Number | Code Package | Module | Value | Operation Description |
---|---|---|---|---|
2854 | SDC | read_subframe_lpc | 0b_00 | Read 2 bits 0 location 2381.b01 0b00. RICE Entropy coding method 0 versus RICE2 Entropy code method 1. Consumed word bit 11 9+2 |
2868 | SDC | read_subframe_lpc | 0b_0000 | 2381.b03 0b1010 read 4 bits sub-frame->entropy_coding_method.data.partitioned_rice.order = u32 = 0 Consumed word bit 15 11 + 4 |
2950 | SDC | read residual rice | 0b_1010 | 2381.b07 0b1 010 read 4 bits sub-frame->entropy_coding_method.data.partitioned_rice.order = u32 = 0 Consumed word bit 19 15 + 4 |
2975 | SDC | read residual rice | NA | for 0 partition number samples equals blocksize - predictor 4096 - 8 |
Core Algorithm
Read Residual RICE
work from sdc 2976
File Data 2383.b_3 x.b0 0100 0b000 0001.x44
consumed_words = 0x70 112 consumed_bits = 0x13 19 word = 0x370144fd4fd17f19 bits read in previous routine b0011 0111 0 0x37.b0 starting bits 0b000 0001 the 0x44FD 4FD1 7F19
Line Number | Code Package | LOC purpose | Value | Operation Description |
---|---|---|---|---|
2976 | SDC | bitreader_read_rice_signed_block.c | NDA | Call core lpc decompression. Key parameters
|
1 | bitread_rice_signed | Initialize for RICE bit Read | Read bits unaligned. | |
17 | bitread_rice_signed | Set key values | 0xFF8, 0xA | set-up for frame rice read
|
47 | bitread_rice_signed | Shift out already consumed bits | word in 0x370144fd4fd17f19 b out 0x27ea7e8bf8c80000 |
Shifting out consumed bits from word b = br->buffer[cwords =0x70 = 112] << br->consumed_bits(= 0x13 19) =
|
51 | bitread_rice_signed | msbs shift paramaters | b in 27ea7e8bf8c80000 x = y out 2 |
x = y = COUNT_ZERO_MSBS2(b); Key to understand msbs = 2 |
64 | bitread_rice_signed | msbs values and residual value | b in 27ea7e8bf8c80000 x = y in 2 b out 0x3f53f45fc6400000 ucbits out 0x2a 42 msbs = 2 |
|
Pertinent Code
while(val < end) {
Pass 1
b = 0x27ea7e8bf8c80000 x = 0 y = 0 /* read the unary MSBs and end bit */ x = y = COUNT_ZERO_MSBS2(b); /* x=y=2 b = 0x27ea7e8bf8c80000 x = 2 y = 2 /* if(x == FLAC__BITS_PER_WORD) { x = ucbits; do { /* didn't find stop bit yet, have to keep going... */ cwords++; if (cwords >= words) goto incomplete_msbs; b = br->buffer[cwords]; y = COUNT_ZERO_MSBS2(b); x += y; } while(y == FLAC__BITS_PER_WORD); } */ b <<= y; b = 0x9fa9fa2fe3200000 x = 2 y = 2 b <<= 1; /* account for stop bit */ b = 0x3f53f45fc6400000 x = 2 y = 2 ucbits = (ucbits - x - 1) % FLAC__BITS_PER_WORD; b = 0x3f53f45fc6400000 x = 2 y = 2 ucbits = 0x2a 42 msbs = x; b = 0x3f53f45fc6400000 x = 2 y = 2 ucbits = 0x2a 42 msbs = 2 if(x > limit) return false; /* read the binary LSBs */ x = (FLAC__uint32)(b >> (FLAC__BITS_PER_WORD - parameter)); /* parameter < 32, so we can cast to 32-bit uint32_t */ b = 0x3f53f45fc6400000 x = 0xfd y = 2 ucbits = 0x2a 42 msbs = 2 parameter = 0xA 10 if(parameter <= ucbits) { ucbits -= parameter; b = 0x3f53f45fc6400000 x = 0xfd y = 2 ucbits = 0x20 32 msbs = 2 parameter = 0xA 10 b <<= parameter; b = 0x4fd17f1900000000 x = 0xfd y = 2 ucbits = 0x20 32 msbs = 2 parameter = 0xA 10 } else { /* there are still bits left to read, they will all be in the next word */ cwords++; if (cwords >= words) goto incomplete_lsbs; b = br->buffer[cwords]; ucbits += FLAC__BITS_PER_WORD - parameter; x |= (FLAC__uint32)(b >> ucbits); b <<= FLAC__BITS_PER_WORD - ucbits; } lsbs = x; b = 0x4fd17f1900000000 x = 0xfd y = 2 ucbits = 0x20 32 msbs = 2 parameter = 0xA 10 lsbs = 0xfd /* compose the value */ x = (msbs << parameter) | lsbs; b = 0x4fd17f1900000000 x = 0x8fd y = 2 ucbits = 0x20 32 msbs = 2 parameter = 0xA 10 lsbs = 0xfd *val++ = (int)(x >> 1) ^ -(int)(x & 1); b = 0x4fd17f1900000000 x = 0x8fd y = 2 ucbits = 0x20 32 msbs = 2 parameter = 0xA 10 lsbs = 0xfd
- val++ = FFFFBF18
Pass 2
b = 0x4fd17f1900000000 x = 0x8fd y = 2 /* read the unary MSBs and end bit */ x = y = COUNT_ZERO_MSBS2(b); /* x=y=2 b = 0x4fd17f1900000000 x = 1 y = 1 /* if(x == FLAC__BITS_PER_WORD) { x = ucbits; do { /* didn't find stop bit yet, have to keep going... */ cwords++; if (cwords >= words) goto incomplete_msbs; b = br->buffer[cwords]; y = COUNT_ZERO_MSBS2(b); x += y; } while(y == FLAC__BITS_PER_WORD); } */ b <<= y; b = 0x9fa2fe3200000000 x = 1 y = 1 b <<= 1; /* account for stop bit */ b = 0x3f45fc6400000000 x = 1 y = 1 ucbits = (ucbits - x - 1) % FLAC__BITS_PER_WORD; b = 0x3f45fc6400000000 x = 1 y = 1 ucbits = 0x1e 30 msbs = x; b = 0x3f45fc6400000000 x = 1 y = 1 ucbits = 0x1E 30 msbs = 1 if(x > limit) return false; /* read the binary LSBs */ x = (FLAC__uint32)(b >> (FLAC__BITS_PER_WORD - parameter)); /* parameter < 32, so we can cast to 32-bit uint32_t */ b = 0x3f45fc6400000000 x = 0xfd y = 1 ucbits = 0x1E 30 msbs = 1 parameter = 0xA 10 if(parameter <= ucbits) { ucbits -= parameter; b = 0x3f45fc6400000000 x = 0xfd y = 1 ucbits = 0x14 20 msbs = 1 parameter = 0xA 10 b <<= parameter; b = 0x17f1900000000000 x = 0xfd y = 1 ucbits = 0x14 20 msbs = 1 parameter = 0xA 10 } else { /* there are still bits left to read, they will all be in the next word */ cwords++; if (cwords >= words) goto incomplete_lsbs; b = br->buffer[cwords]; ucbits += FLAC__BITS_PER_WORD - parameter; x |= (FLAC__uint32)(b >> ucbits); b <<= FLAC__BITS_PER_WORD - ucbits; } lsbs = x; b = 0x17f1900000000000 x = 0xfd y = 1 ucbits = 0x14 20 msbs = 1 parameter = 0xA 10 lsbs = 0xfd /* compose the value */ x = (msbs << parameter) | lsbs; b = 0x17f1900000000000 x = 0x4fd y = 1 ucbits = 0x14 20 msbs = 1 parameter = 0xA 10 lsbs = 0xfd *val++ = (int)(x >> 1) ^ -(int)(x & 1); b = 0x17f1900000000000 x = 0x4fd y = 1 ucbits = 0x14 20 msbs = 1 parameter = 0xA 10 lsbs = 0xfd
- val++ = ffffDF18
continue;
Notes for code analysis
4 bytes / int 32 Bits.
little endian memory dump of in storage buffer
19 7F D1 4F 19 7F D1 4F 19 7F D1 4F FD 44 01 37 56 26 0A 25 B2 EE F6 7F 9D 10 5D 79 62 33 5B 9F B4 0E 65 24 15 7A 35 13 370144FD4FD17F19 at 2380 in test.flac.
File
3701 44FD 4FD1 4FD1 7F19 7FF6 EEB2 250A 2656 does not line up with contiguous memory location. Only 64 bit word valid in memory (if reversed) loc 2380 in file
word
LPC Residual
work from sdc 2987 sample += u; = 4088 for 0 partition 4096 thereafter residual* 24 bit values in memory starting with: <ref>Little Endian Address 0 - 3 4 - 7 8 - B C - F 0000555555863340 81FBFFFF 81FDFFFF FE060000 D0FCFFFF 0000555555863350 09FEFFFF 8AFEFFFF 25040000 76F9FFFF 0000555555863360 4BFBFFFF 29FEFFFF 99FFFFFF D8FFFFFF 0000555555863370 BA040000 ECFDFFFF 26020000 A8FEFFFF 0000555555863380 15020000 46020000 87000000 2FFFFFFF 0000555555863390 6DFDFFFF 3AFEFFFF 0CFBFFFF 8F030000 00005555558633A0 68FCFFFF ADFFFFFF 17050000 C8000000 00005555558633B0 27030000 10000000 0B040000 C4FDFFFF 00005555558633C0 DFFDFFFF 42030000 CAFBFFFF 41030000 00005555558633D0 15020000 EBFEFFFF CD030000 84FFFFFF 00005555558633E0 4C020000 40020000 B3FBFFFF E4010000
Next Edit
Linear Predictive Coding
Line Number | Code Package | LOC purpose | Operation Description |
---|---|---|---|
2987 | SDC | read_residual_partitioned_rice | sample += u; Key parameters
|
2883 | SDC | read_subframe_lpc | break |
2889 | SDC | Do Full Decode | |
2892 | SDC | Get Warm-up values | 8 previously stored warm-up values based on order=8 |
2894 | SDC | call FLAC lpc max bps | |
960 | LPC | FLAC__lpc_max_residual_bps | Variables
Address 0 - 3 4 - 7 8 - B C - F 0000555555859EF0 08000000 0F000000 0D000000 E51D0000 0000555555859F00 282E0000 E0E2FFFF F4CFFFFF 170C0000 0000555555859F10 17210000 72010000 6EF2FFFF
|
948 | LPC | FLAC__lpc_max_prediction_before_shift_bps | |
2895 | SDC | read_subframe_lpc_ | Checks less than 32 bits |
2898 | SDC | read_subframe_lpc_ | FLAC__lpc_restore_signal_wide |
Pertinent Code
960 LPC FLAC__int32 predictor_sum_bps = FLAC__lpc_max_prediction_before_shift_bps(subframe_bps, qlp_coeff, order) - lp_quantization;
Notes for code analysis
4 bytes / int 32 Bits.
little endian memory dump of in storage buffer
19 7F D1 4F 19 7F D1 4F 19 7F D1 4F FD 44 01 37 56 26 0A 25 B2 EE F6 7F 9D 10 5D 79 62 33 5B 9F B4 0E 65 24 15 7A 35 13 370144FD4FD17F19 at 2380 in test.flac.
File
3701 44FD 4FD1 4FD1 7F19 7FF6 EEB2 250A 2656 does not line up with contiguous memory location. Only 64 bit word valid in memory (if reversed) loc 2380 in file
word
Flac overview
- Metadata Block Header
- <1> Last-metadata-block flag: '1' if this block is the last metadata block before the audio blocks, '0' otherwise.
- <7> BLOCK_TYPE
- 0 : STREAMINFO
- 1 : PADDING
- 2 : APPLICATION
- 3 : SEEKTABLE
- 4 : VORBIS_COMMENT
- 5 : CUESHEET
- 6 : PICTURE
- 7-126 : reserved
- 127 : invalid, to avoid confusion with a frame sync code
- <24> Length (in bytes) of metadata to follow (does not include the size of the METADATA_BLOCK_HEADER)
- Streaminfo Mandatory Metadata Block
- <16> The minimum block size (in samples) used in the stream.
- <16> The maximum block size (in samples) used in the stream. (Minimum blocksize == maximum blocksize) implies a fixed-blocksize stream.
- <24> The minimum frame size (in bytes) used in the stream. May be 0 to imply the value is not known.
- <24> The maximum frame size (in bytes) used in the stream. May be 0 to imply the value is not known.
- <20> Sample rate in Hz. Though 20 bits are available, the maximum sample rate is limited by the structure of frame headers to 655350Hz. Also, a value of 0 is invalid.
- <3> (number of channels)-1. FLAC supports from 1 to 8 channels
- <5> (bits per sample)-1. FLAC supports from 4 to 32 bits per sample.
- <36> Total samples in stream. 'Samples' means inter-channel sample, i.e. one second of 44.1Khz audio will have 44100 samples regardless of the number of channels. A value of zero here means the number of total samples is unknown.
- <128> MD5 signature of the unencoded audio data. This allows the decoder to determine if an error exists in the audio data even when the error does not result in an invalid bitstream.
- NOTES
- FLAC specifies a minimum block size of 16 and a maximum block size of 65535, meaning the bit patterns corresponding to the numbers 0-15 in the minimum blocksize and maximum blocksize fields are invalid.
- Flac format
Decompose test.flac
- 0-4 "fLaC" ID Bytes
0 Metadata Block Streaminfo (Mandatory) 0
Value | Hex | Description | Number Bits |
---|---|---|---|
fLAc | 664C 6143 | fLAc Streaminfo Identity tag | 4 bytes |
0 | "0(b)" | Not last Metadata Block | 1 Bit |
0 | "0000000(b)" | Streaminfo Block type | 7 Bits |
34 | "000022" | Metadata Block length hex 22 | 24 Bits |
Value | Hex | Description | Number Bits |
---|---|---|---|
4,096 | "1000" | The minimum block size (in samples) used in the stream. | 16 Bits |
4,096 | "1000" | The maximum block size (in samples) used in the stream. | 16 Bits |
345 | "000159" | The minimum frame size (in bytes) used in the stream. May be 0 to imply the value is not known. | 24 Bits |
7,560 | "001D88" | The minimum frame size (in bytes) used in the stream. May be 0 to imply the value is not known. | 24 Bits |
192,000 | "2EE00" | Sample rate in Hz. Though 20 bits are available, the maximum sample rate is limited by the structure of frame headers to 655350Hz. Also, a value of 0 is invalid. | 20 Bits |
2 | "001(b)" | (number of channels)-1. FLAC supports from 1 to 8 channels | 3 Bits |
24 | "10111(b)" | (bits per sample)-1. FLAC supports from 4 to 32 bits per sample. | 5 Bits |
79573200 | "004BE30D0" | Total samples in stream. 'Samples' means inter-channel sample, i.e. one second of 44.1Khz audio will have 44100 samples regardless of the number of channels. A value of zero here means the number of total samples is unknown. | 36 Bits |
NA | "4FCA4AC4B196E4DE2BA3C866BD20A431" | MD5 signature of the unencoded audio data. This allows the decoder to determine if an error exists in the audio data even when the error does not result in an invalid bitstream. | 128 Bits |
1 Metadata Block SeekTable 2A
Value | Hex | Description | Number Bits |
---|---|---|---|
0 | "0" | Not last Metadata Block | 1 Bit |
3 | "0000011(b)" | SeekTable Block type | 7 Bits |
756 | "0002F4" | Number of seek points 42 | 24 Bits |
Value | Hex | Description | Number Bits |
---|---|---|---|
0 Seek point | |||
0 | "0000000000000000" | 0 Seek Point Sample number of first sample in the target frame. | 64 Bits |
0 | "0000000000000000" | Offset (in bytes) from the first byte of the first frame header to the first byte of the target frame's header. | 64 Bits |
4,096 | "1000" | Number of samples in the target frame. | 16 Bits |
1 Seek Point | |||
1916928 | "00000000001D4000" | 1 Seek Point Sample number of first sample in the target frame. | 64 Bits |
2900681 | "00000000002C42C9" | Offset (in bytes) from the first byte of the first frame header to the first byte of the target frame's header. | 64 Bits |
4,096 | "1000" | Number of samples in the target frame. | 16 Bits |
2 Seek Point | |||
3837952 | "00000000003A9000" | 2 Seek Point Sample number of first sample in the target frame. | 64 Bits |
5943977 | "00000000005AB2A9" | Offset (in bytes) from the first byte of the first frame header to the first byte of the target frame's header. | 64 Bits |
0 | "1000" | Number of samples in the target frame. | 16 Bits |
3 Seek Point | |||
5758976 | "000000000057E000" | 3 Seek Point Sample number of first sample in the target frame. | 64 Bits |
9001272 | "0000000000895938" | Offset (in bytes) from the first byte of the first frame header to the first byte of the target frame's header. | 64 Bits |
4,096 | "1000" | Number of samples in the target frame. | 16 Bits |
...Last Seek Point | |||
78716928 | "0000000004B12000" | Last Seek Point Sample number of first sample in the target frame. | 64 Bits |
127574074 | "00000000079AA03A" | Offset (in bytes) from the first byte of the first frame header to the first byte of the target frame's header. | 64 Bits |
4,096 | "1000" | Number of samples in the target frame. | 16 Bits |
2 Metadata Block Vorbis 322
Value | Hex | Description | Number Bits |
---|---|---|---|
0 | "0(b)" | Not last Metadata Block | 1 Bit |
4 | "0000100(b)" | Voorbis Block type | 7 Bits |
40 | "000028" | Metadata Block length | 24 Bits |
Block Data not Pertinent at this time
3 Metadata Block Padding 34E
Value | Hex | Description | Number Bits |
---|---|---|---|
1 | "1" | Is last Metadata Block | 1 Bit |
1 | "0000001(b)" | Padding Block type | 7 Bits |
8192 | "002000" | Metadata Block length | 24 Bits |
Block Data not pertinent
0 Stream Frame Header 2352
FF F8 C3 8C 00 F0 4E FF 89 81 FF 8E 74 FF 92 E9 FF 95 46 FF 91 DF FF 8E A2 FF 86 61 FF 7B 71 E6 9D E5
Value | Hex | Description | Number Bits |
---|---|---|---|
FFF8 1111 1111 1111 10(b) | FFF8 | Sync code '11111111111110' | 14 bits |
0 | "0(b)" | Reserved: [1] Mandatory Value 0 | 1 Bit |
0 | "0(b)" | Blocking strategy:
|
1 Bit |
C 1100 | "1100(b)" | Block size in inter-channel samples:
|
4 Bits |
3 0011 | "0011(b)" | Sample rate:
|
4 Bits |
8 1000 | "1000(b)" | Channel assignment
|
4 Bits |
C 110 | "110(b)" | Sample size in bits:
|
3 Bits |
0 | "0(b)" | Reserved: [1] Mandatory Value 0 | 1 Bit |
00 | "00000000(b)" | Frame Number 0 | 8 Bit |
F0 | "11110000(b)" | CRC-8 (polynomial = x^8 + x^2 + x^1 + x^0, initialized with 0) of everything before the crc, including the sync code | 8 Bit |
4EFF | "0100111011111111(b)" | CRC-16 (polynomial = x^16 + x^15 + x^2 + x^0, initialized with 0) of everything before the crc, back to and including the frame header sync code | 16 Bit |
Warm up Frames?
FF 89 81 FF 8E 74 FF 92 E9 FF 91 DF FF 95 46 FF 8E A2 FF 86 61 FF 7B 71 E6 9D E5
0 Stream Frame Sub-Header 2352
FF 7B 71 E6 9D E5
Value | Hex | Description | Number Bits |
---|---|---|---|
FFF8 1111 1111 1111 10(b) | FFF8 | Sync code '11111111111110' | 14 bits |
0 | "0(b)" | Zero bit padding, to prevent sync-fooling string of 1s | 1 Bit |
0 | "0(b)" | Subframe type:
000000 : SUBFRAME_CONSTANT 000001 : SUBFRAME_VERBATIM 00001x : reserved 0001xx : reserved 001xxx : if(xxx <= 4) SUBFRAME_FIXED, xxx=order ; else reserved 01xxxx : reserved 1xxxxx : SUBFRAME_LPC, xxxxx=order-1 |
6 Bit |
C 1100 | "1100(b)" | Block size in inter-channel samples:
|
4 Bits |
3 0011 | "0011(b)" | Sample rate:
|
4 Bits |
8 1000 | "1000(b)" | Channel assignment
|
4 Bits |
C 110 | "110(b)" | Sample size in bits:
|
3 Bits |
0 | "0(b)" | Reserved: [1] Mandatory Value 0 | 1 Bit |
00 | "00000000(b)" | CRC-8 (polynomial = x^8 + x^2 + x^1 + x^0, initialized with 0) of everything before the crc, including the sync code | 8 Bit |
F04E | "1111000001001110(b)" | CRC-16 (polynomial = x^16 + x^15 + x^2 + x^0, initialized with 0) of everything before the crc, back to and including the frame header sync code | 16 Bit |
Manual Configure FLAC in Eclipse
- cmake project in Eclipse manual confiure. Johnny (talk) 19:16, 6 August 2024 (UTC)
- Follow full directions and do CMake first to populate directories.
- When updating make command include -C ${ConfigName} om behavior page.
- Debugging now.
- ↑ The math behind it all File:Robinson tr156.ps.
- ↑ word 2358 4eff8981ff8e74ff word 107 4E is 0b0100 1110 78 FLAC FRAME MAGIC NUMBER. Ours is 0x4E 78 ((x>>1)&31)+1; Predictor Order 8 which gives us 8 Warm-ups and then 4096-8 4088 LPC samples.
One entry for each predictor order so in this case 8 entries from 2359 to 2371
- 0xffffffffffff8981 -30335
- 0xffffffffffff8e74 -29068
- 0xffffffffffff92e9 -27927
- 0xffffffffffff9546 -27322
- 0xffffffffffff91df -28193
- 0xffffffffffff8ea2 -29022
- 0xffffffffffff8661 -31135
- 0xffffffffffff7b71 -33935