History

s->target_i and global are in dB but s->target_tp and true_peak are linear. Instead of mixing these in the calculations, convert the former first to have all following calculations in the same unit.

Sebastian Dröge committed 6 years ago

Commit ed3da721 parent 9ce7de91 file · +2 −3Browse files

Unified · Split

libavfilter/af_loudnorm.c+2−3
@@ -453,10 +453,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 452 unmodified lines
453453 true_peak = tmp;
454454 }
455455
456− offset = s->target_i - global;
457− offset_tp = true_peak + offset;
456+ offset = pow(10., (s->target_i - global) / 20.);
457+ offset_tp = true_peak * offset;
458458 s->offset = offset_tp < s->target_tp ? offset : s->target_tp - true_peak;
459− s->offset = pow(10., s->offset / 20.);
460459 s->frame_type = LINEAR_MODE;
461460 }
462461

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t