mkvtoolnix/tests/test-634dialog_normalization_gain_removal.rb
Moritz Bunkus f53b618904
E-AC-3 dialog norm gain removal: handle dependent frames correctly
Dependent frames are part of the same Matroska block as the
previous regular frame. The old code assumed there was only a single
AC-3 frame in a Matroska block, though. For files containing dependent
frames, this meant:

• Only the first AC-3 frame's dialog normalization gain was
  overwritten.
• Only the last AC-3 frame's second checksum was updated.

Additionally mkvmerge assumed wrongfully that E-AC-3 frames contain
two CRCs just like regular AC-3 frames do whereas E-AC-3 frames only
contain a CRC at the end of the frame, not at the start.

The result was:

• Mixed dialog normalization gain levels
• The first and last AC-3 frames were invalid as their header
  data (first frame) respectively their checksum (last frame) was
  wrong.

Fixes #2386.
2018-09-25 21:15:20 +02:00

18 lines
731 B
Ruby
Executable File

#!/usr/bin/ruby -w
# T_634dialog_normalization_gain_removal
describe "mkvmerge / dialog normalization gain removal"
%w{
ac3/dialog_normalization.ac3
dts/dialog_normalization.dts
truehd/dialog_normalization.thd
truehd/dialog_normalization_atmos.thd
ac3/dependent-frames-and-dialog-normalization-gain-removal.eac3
}.each do |file_name|
test_merge "data/#{file_name}"
test_merge "data/#{file_name}", :args => "--remove-dialog-normalization-gain 0", :output => "#{tmp}-1", :keep_tmp => true
test_merge "#{tmp}-1", :args => "--remove-dialog-normalization-gain 0", :output => "#{tmp}-2", :keep_tmp => true
test_merge "#{tmp}-2", :output => "#{tmp}-3"
end