Quiet Frame Decompress: Difference between revisions

From mywiki
Jump to navigation Jump to search
No edit summary
Line 17: Line 17:
==Instruction trace flac for analQuiet.flac==
==Instruction trace flac for analQuiet.flac==
Skip metadata not pertinent <ref>(see [[FLAC Agent Build]] for metadata.  Assuming equivalent in pertinent details.</ref>
Skip metadata not pertinent <ref>(see [[FLAC Agent Build]] for metadata.  Assuming equivalent in pertinent details.</ref>
=====Sync Frame=====
==Sync Frame==
{| class="wikitable" style="margin:auto"
{| class="wikitable" style="margin:auto"
|+ FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC
|+ FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC
Line 41: Line 41:
|}
|}


  Read Frame Header Metadata  
  Read Frame Sync Fixed Header Channel Side
Starting at 0x_1192 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'''
* 0b1010 & 0b0111 = Case 2 FLAC__CHANNEL_ASSIGNMENT_MID_SIDE '''Channel Handling'''
* 0b110 = C 24 bits per sample ''bps''
* 0b_0  Mandatory 0.  ''Validation''
''32 bits consumed.''
{| class="wikitable" style="margin:auto"
|+ Variables
|-
! Variable!! Decimal !! Hex !! Location Flac File
|-
|Bits || 8 || 8
|-
|br->word || || 0xfff8c3ac005e || 1192
|-
|br->consumed_bits || 32 || 0x20
|-
|}
==Read Frame Header==
{| class="wikitable" style="margin:auto"
|+ FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC
|-
! 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
|-
| 2041 || SDC || read_frame || Unk || read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FLAC__bool do_full_decode)
|-
| 350 || BRC || FLAC__bitreader_reset_read_crc16 || Unk || (FLAC__BitReader *br, FLAC__uint16 seed)
|-
| 2277 || SDC || read_frame_header_ || Unk || read_frame_header_(FLAC__StreamDecoder *decoder)byte.
|-
| 381 || BDC || FLAC__bitreader_is_consumed_byte_aligned || '''0''' || (const FLAC__BitReader *br)
|-
| 2319 || SDC ||read in the raw header as bytes so we can CRC it, and parse it on the way
|if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
|-
| 418 || BDC || FLAC__bitreader_read_raw_uint32 || ''variables below'' || (FLAC__BitReader *br, FLAC__uint32 *val, uint32_t bits)
|}
 
Read Frame Last Half Header Metadata  
Starting at 0x_1192 FFF8 C38C
Starting at 0x_1192 FFF8 C38C
  & value 007F
  & value 007F

Revision as of 00:49, 17 March 2025


EditDate 2025-03-16

Related Threads: FLAC Agent Build

Page created to understand how fLaC decompresses the 0 Quiet Frame so it can be incorporated into analAI

Key differences:

  1. Mid-side compression

Could well be the key lossless transformation mid = (left + right)/2 and side = left − right.Web References https://www.reddit.com/r/audioengineering/comments/u2t2o4/questions about the way flac works relatively/

Issues:

  1. Warmup does not appear in wave or raw file which I don't understand as I get the same warmup values in analAI as FLaC seems to produce.

Seems I may have to include additional step for mid side channel de-correlation. lossless transformation mid = (left + right)/2 and side = left − right. [1]. One sure issue with this is the side channel requires an extra bit (25 vs 24) which might explain the missed warmup values but right now I don’t think so. Either way it needs to be fixed.

Instruction trace flac for analQuiet.flac

Skip metadata not pertinent [2]

Sync Frame

FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC
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
2041 SDC read_frame Unk read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FLAC__bool do_full_decode)
350 BRC FLAC__bitreader_reset_read_crc16 Unk (FLAC__BitReader *br, FLAC__uint16 seed)
2277 SDC read_frame_header_ Unk read_frame_header_(FLAC__StreamDecoder *decoder)byte.
381 BDC FLAC__bitreader_is_consumed_byte_aligned 0 (const FLAC__BitReader *br)
2319 SDC read in the raw header as bytes so we can CRC it, and parse it on the way if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
418 BDC FLAC__bitreader_read_raw_uint32 variables below (FLAC__BitReader *br, FLAC__uint32 *val, uint32_t bits)
Read Frame Sync Fixed Header Channel Side 

Starting at 0x_1192 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'
  • 0b1010 & 0b0111 = Case 2 FLAC__CHANNEL_ASSIGNMENT_MID_SIDE Channel Handling
  • 0b110 = C 24 bits per sample bps
  • 0b_0 Mandatory 0. Validation

32 bits consumed.

Variables
Variable Decimal Hex Location Flac File
Bits 8 8
br->word 0xfff8c3ac005e 1192
br->consumed_bits 32 0x20

Read Frame Header

FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC
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
2041 SDC read_frame Unk read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FLAC__bool do_full_decode)
350 BRC FLAC__bitreader_reset_read_crc16 Unk (FLAC__BitReader *br, FLAC__uint16 seed)
2277 SDC read_frame_header_ Unk read_frame_header_(FLAC__StreamDecoder *decoder)byte.
381 BDC FLAC__bitreader_is_consumed_byte_aligned 0 (const FLAC__BitReader *br)
2319 SDC read in the raw header as bytes so we can CRC it, and parse it on the way if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8))
418 BDC FLAC__bitreader_read_raw_uint32 variables below (FLAC__BitReader *br, FLAC__uint32 *val, uint32_t bits)
Read Frame Last Half Header Metadata 

Starting at 0x_1192 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'
  • 0b1010 & 0b0111 = Case 2 FLAC__CHANNEL_ASSIGNMENT_MID_SIDE Channel Handling
  • 0b110 = C 24 bits per sample bps
  • 0b_0 Mandatory 0. Validation

32 bits consumed.

Variables
Variable Decimal Hex Location Flac File
Bits 8 8
br->word 0xfff8c3ac005e 1192
br->consumed_bits 32 0x20

References