Commit 6159bd0d authored by Justin Ruggles's avatar Justin Ruggles Committed by Michael Niedermayer

ac3enc: fix bug in stereo rematrixing decision.

The rematrixing strategy reuse flags are not reset between frames, so they
need to be initialized for all blocks, not just block 0.
Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
(cherry picked from commit 5b54d4b3)
parent ee60e04c
...@@ -310,9 +310,9 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s) ...@@ -310,9 +310,9 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
nb_coefs = FFMIN(s->nb_coefs[0], s->nb_coefs[1]); nb_coefs = FFMIN(s->nb_coefs[0], s->nb_coefs[1]);
s->blocks[0].new_rematrixing_strategy = 1;
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
block = &s->blocks[blk]; block = &s->blocks[blk];
block->new_rematrixing_strategy = !blk;
for (bnd = 0; bnd < 4; bnd++) { for (bnd = 0; bnd < 4; bnd++) {
/* calculate calculate sum of squared coeffs for one band in one block */ /* calculate calculate sum of squared coeffs for one band in one block */
int start = ff_ac3_rematrix_band_tab[bnd]; int start = ff_ac3_rematrix_band_tab[bnd];
...@@ -337,7 +337,6 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s) ...@@ -337,7 +337,6 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
/* determine if new rematrixing flags will be sent */ /* determine if new rematrixing flags will be sent */
if (blk && if (blk &&
!block->new_rematrixing_strategy &&
block->rematrixing_flags[bnd] != block0->rematrixing_flags[bnd]) { block->rematrixing_flags[bnd] != block0->rematrixing_flags[bnd]) {
block->new_rematrixing_strategy = 1; block->new_rematrixing_strategy = 1;
} }
......
f8eddf3c4e119bcb2aa89a76d7461259 *./tests/data/acodec/ac3.rm 07bd593823ebd721b3a32ef298bdfc20 *./tests/data/acodec/ac3.rm
98751 ./tests/data/acodec/ac3.rm 98751 ./tests/data/acodec/ac3.rm
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
ret: 0 st:-1 flags:0 ts:-1.000000 ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
ret:-1 st:-1 flags:1 ts: 1.894167 ret: 0 st:-1 flags:1 ts: 1.894167
ret:-1 st: 0 flags:0 ts: 0.788000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
ret: 0 st: 0 flags:0 ts: 0.788000
ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116
ret: 0 st: 0 flags:1 ts:-0.317000 ret: 0 st: 0 flags:1 ts:-0.317000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
ret:-1 st:-1 flags:0 ts: 2.576668 ret: 0 st:-1 flags:0 ts: 2.576668
ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116
ret:-1 st:-1 flags:1 ts: 1.470835 ret:-1 st:-1 flags:1 ts: 1.470835
ret:-1 st: 0 flags:0 ts: 0.365000 ret: 0 st: 0 flags:0 ts: 0.365000
ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116
ret: 0 st: 0 flags:1 ts:-0.741000 ret: 0 st: 0 flags:1 ts:-0.741000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
ret:-1 st:-1 flags:0 ts: 2.153336 ret:-1 st:-1 flags:0 ts: 2.153336
...@@ -16,20 +20,26 @@ ret: 0 st: 0 flags:0 ts:-0.058000 ...@@ -16,20 +20,26 @@ ret: 0 st: 0 flags:0 ts:-0.058000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
ret:-1 st: 0 flags:1 ts: 2.836000 ret:-1 st: 0 flags:1 ts: 2.836000
ret:-1 st:-1 flags:0 ts: 1.730004 ret:-1 st:-1 flags:0 ts: 1.730004
ret:-1 st:-1 flags:1 ts: 0.624171 ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
ret: 0 st: 0 flags:0 ts:-0.482000 ret: 0 st: 0 flags:0 ts:-0.482000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
ret:-1 st: 0 flags:1 ts: 2.413000 ret: 0 st: 0 flags:1 ts: 2.413000
ret: 0 st: 0 flags:1 dts: 2.229000 pts: 2.229000 pos: 36705 size: 556
ret:-1 st:-1 flags:0 ts: 1.306672 ret:-1 st:-1 flags:0 ts: 1.306672
ret:-1 st:-1 flags:1 ts: 0.200839 ret: 0 st:-1 flags:1 ts: 0.200839
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
ret: 0 st: 0 flags:0 ts:-0.905000 ret: 0 st: 0 flags:0 ts:-0.905000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
ret:-1 st: 0 flags:1 ts: 1.989000 ret:-1 st: 0 flags:1 ts: 1.989000
ret:-1 st:-1 flags:0 ts: 0.883340 ret: 0 st:-1 flags:0 ts: 0.883340
ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116
ret: 0 st:-1 flags:1 ts:-0.222493 ret: 0 st:-1 flags:1 ts:-0.222493
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
ret:-1 st: 0 flags:0 ts: 2.672000 ret: 0 st: 0 flags:0 ts: 2.672000
ret: 0 st: 0 flags:1 dts:6354.691000 pts:6354.691000 pos: 10783 size: 304
ret:-1 st: 0 flags:1 ts: 1.566000 ret:-1 st: 0 flags:1 ts: 1.566000
ret:-1 st:-1 flags:0 ts: 0.460008 ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 0 flags:1 dts:4160806.587000 pts:4160806.587000 pos: 3883 size: 116
ret: 0 st:-1 flags:1 ts:-0.645825 ret: 0 st:-1 flags:1 ts:-0.645825
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment