Opened 4 months ago

Closed 4 months ago

#6596 closed enhancement (fixed)

Add a little-endian G726 encoder

Reported by: alban.meffre Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords: G726
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

the G726 codec ffmpeg implementation seems not to comply with ITU standard
below are the files and commands needed to perform verification

* test vectors *

original test vectors from the ITU in ASCII format (https://www.itu.int/net/itu-t/sigdb/speaudio/Gseries.htm)

NRM.M : the test input vector encoded in mu law (sample rate 8kHz, mono)
RN24FM.I : the expected result , unpacked to right justified codes

input_mulaw.bin : binary version of the above NRM.M input file
input_mulaw.wav : playable version

$ ffmpeg -f mulaw -ar 8000 -i input_mulaw.bin -acodec copy input_mulaw.wav

* encoding with ITU compliant G726 encoder *

g726encode.exe : g726 encoder from the ITU-T user's group on software tools

output_g726.bin : output result

$ g726encode.exe -3 -u -i input_mulaw.bin -o output_g726.bin

* binary comparison between output and ITU test vector *

RN24FM.bin : bit packed binary version of the above RN24FM.I file

!!!!!! these two file's contents are identical -> g726encode.exe IS ITU compliant !!!!!!

* decode and listen to the result *

output_g726_decoded_pcm_s16le.bin : decoded result of g726encode.exe

$ g726decode.exe -3 -l -i output_g726.bin -o output_g726_decoded_pcm_s16le.bin

this file can be played correctely -> g726decode.exe IS ITU compliant too

$ ffplay -f s16le -ar 8000 output_g726_decoded_pcm_s16le.bin

* encoding with ffmpeg and listen to the result *

output_g726_ffmpeg.bin : ffmpeg g726 encode output result
output_g726_ffmpeg.wav : ffmpeg g726 encode output result (playable)

$ ffmpeg -f mulaw -ar 8000 -i input_mulaw.bin -acodec g726 -code_size 3 output_g726_ffmpeg.wav
$ ffmpeg -f mulaw -ar 8000 -i input_mulaw.bin -acodec g726 -code_size 3 -f u8 output_g726_ffmpeg.bin

output_g726_ffmpeg_decoded_pcm_s16le.bin : decoded result of output_g726_ffmpeg.bin

$ g726decode.exe -3 -l -i output_g726_ffmpeg.bin -o output_g726_ffmpeg_decoded_pcm_s16le.bin

!!!!!! this file cannot be played correctely -> ffmpeg's implementation of the g726 codec is not compliant with ITU !!!!!!

$ ffplay -f s16le -ar 8000 output_g726_ffmpeg_decoded_pcm_s16le.bin

Attachments (1)

bug report.zip (121.8 KB) - added by alban.meffre 4 months ago.
archive containing all the test files

Download all attachments as: .zip

Change History (4)

Changed 4 months ago by alban.meffre

archive containing all the test files

comment:1 Changed 4 months ago by cehoyos

  • Keywords ITU standard compliance removed
  • Priority changed from critical to normal

comment:2 Changed 4 months ago by cehoyos

  • Component changed from avformat to avcodec
  • Priority changed from normal to wish
  • Reproduced by developer set
  • Status changed from new to open
  • Summary changed from G726 codec suspected to not comply with ITU standard to Add a little-endian G726 encoder
  • Type changed from defect to enhancement

comment:3 Changed 4 months ago by cehoyos

  • Resolution set to fixed
  • Status changed from open to closed

FFmpeg has a little-endian ("right-justified") G.726 encoder since 898ea658c8a46a105bcf831691a9aad3bb0f606d, FFmpeg's G.726 implementation is not bit-exact though, see ticket #5482 for a sample with audible artefacts.

Note: See TracTickets for help on using tickets.