FastLED 3.10.6
Loading...
Searching...
No Matches
AutoResearchMp3.h File Reference

Detailed Description

On-device verification of the fixed-point MP3 decoder.

FastLED ships minimp3 in fixed-point mode by default – the choice is made in the header, not by a build flag – so every embedded target runs the integer pipeline. That pipeline is where 32-bit-specific defects live, and host testing on x86-64 is structurally blind to a whole class of them: an int64 add costs one instruction there and two plus carry on a 32-bit machine, signed overflow that the optimiser is entitled to assume away behaves differently under different register pressure, and alignment padding in the scratch arena differs outright.

So this checks the decode is bit-exact against the host, not merely plausible: an FNV-1a over the emitted PCM, compared to the value the same mp3dec_decode_frame_r produced on the host. A checksum rather than a PSNR because there is no tolerance to allow – the fixed-point decoder is deterministic, and any difference at all is a defect worth seeing.

Definition in file AutoResearchMp3.h.

#include <FastLED.h>
#include "fl/stl/int.h"
#include "fl/stl/cstring.h"
#include "fl/stl/unique_ptr.h"
#include "AutoResearchMp3Fixture.h"
#include "fl/codec/mp3.h"
#include "third_party/minimp3/minimp3.h"
+ Include dependency graph for AutoResearchMp3.h:

Go to the source code of this file.

Classes

struct  autoresearch::mp3_check::Decoded
 
struct  autoresearch::mp3_check::Result
 

Namespaces

namespace  autoresearch
 
namespace  autoresearch::mp3_check
 

Functions

Decoded autoresearch::mp3_check::decodeStream (fl::third_party::mp3dec_t *dec, fl::third_party::mp3dec_scratch_t *scratch, fl::i16 *pcm, const mp3_fixture::Stream &stream)
 Decode one stream.
 
fl::u32 autoresearch::mp3_check::fnv1a (fl::u32 hash, const fl::i16 *samples, fl::u32 count)
 
fl::u32 autoresearch::mp3_check::fnv1a_mix (fl::u32 hash, fl::u32 value)
 Fold one stream's checksum into the run-wide one, so a single reported value covers every stream in order.
 
void autoresearch::mp3_check::recordFailure (Result &r, const char *name, fl::u32 expected_hash, fl::u32 actual_hash, fl::u32 expected_samples, fl::u32 actual_samples)
 
Result autoresearch::mp3_check::run ()
 

Class Documentation

◆ autoresearch::mp3_check::Decoded

struct autoresearch::mp3_check::Decoded
Class Members
u32 channels
u32 fnv1a
u32 frames
u32 hz
u32 layer
u32 samples

◆ autoresearch::mp3_check::Result

struct autoresearch::mp3_check::Result
Class Members
u32 actual_fnv1a
u32 actual_samples
u32 audio_micros
u32 combined_fnv1a
u32 decode_micros
u32 expected_fnv1a
u32 expected_samples
const char * first_failure
u32 frames_decoded
u32 samples_decoded
u32 scratch_bytes
bool shared_decoder_matched
u32 streams_failed
u32 streams_run
bool success
u32 verify_micros