mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
stream_encoder : Improve selection of residual accumulator width
In the precompute_partition_info_sums_ function, instead of selecting 64-bit accumulator when the signal bps is larger than 16, revert to the original approach based on partition size, but make room for few extra bits to not overflow with unusual signals where the average residual magnitude may be larger than bps. It slightly improves the performance with standard encoding levels and 16-bit files as the 17-bit side channel can still be processed with the 32-bit accumulator and correctly selects the 64-bit accumulator with very large 16-bit partitions. This is related to commits6f7ec60cand187e596e. Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
This commit is contained in:
committed by
Erik de Castro Lopo
parent
71246dcc81
commit
f081524c19
@@ -37,6 +37,7 @@
|
||||
#ifndef FLAC__NO_ASM
|
||||
#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && defined FLAC__HAS_X86INTRIN
|
||||
#include "private/stream_encoder.h"
|
||||
#include "private/bitmath.h"
|
||||
#ifdef FLAC__SSSE3_SUPPORTED
|
||||
|
||||
#include <stdlib.h> /* for abs() */
|
||||
@@ -58,7 +59,7 @@ void FLAC__precompute_partition_info_sums_intrin_ssse3(const FLAC__int32 residua
|
||||
unsigned e1, e3;
|
||||
__m128i mm_res, mm_sum;
|
||||
|
||||
if(bps <= 16) {
|
||||
if(FLAC__bitmath_ilog2(default_partition_samples) + bps + FLAC__MAX_EXTRA_RESIDUAL_BPS < 32) {
|
||||
for(partition = residual_sample = 0; partition < partitions; partition++) {
|
||||
end += default_partition_samples;
|
||||
mm_sum = _mm_setzero_si128();
|
||||
|
||||
Reference in New Issue
Block a user