[alsa-devel] [PATCH v5] ASoC: Apply msbits constraint for sample size bigger than the msbits

Peter Ujfalusi peter.ujfalusi at ti.com
Thu Jan 19 13:40:35 CET 2012


On 01/19/2012 11:48 AM, Mark Brown wrote:
> On Thu, Jan 19, 2012 at 09:27:33AM +0100, Peter Ujfalusi wrote:
> 
>> Are you going to take the for version of patch, or should I resend it?
>> I can add a comment to explain that we bail out, and not checking the
>> sample sizes lower than the requested msbits, if it helps.
> 
> I'd just replace it with a continue on sizes we don't want, much
> simpler.

If I can do this (bits == 24):
i = 0
check (i < ARRAY_SIZE(sample_sizes))
check (sample_sizes[i] <= bits)
 apply constraint
i++
check (i < ARRAY_SIZE(sample_sizes))
check (sample_sizes[i] <= bits)
 go out

--------------------------------------
I will not do this (bits == 24):
static int sample_sizes[] = {
	8, 16, 24, 32,
};

i = 0
check (i < ARRAY_SIZE(sample_sizes))
check (sample_sizes[i] > bits)
i++
check (i < ARRAY_SIZE(sample_sizes))
check (sample_sizes[i] > bits)
i++
check (i < ARRAY_SIZE(sample_sizes))
check (sample_sizes[i] > bits)
i++
check (i < ARRAY_SIZE(sample_sizes))
check (sample_sizes[i] > bits)
 apply constraint
i++
check (i < ARRAY_SIZE(sample_sizes))
 go out

--------------------------------------
nor this (bits == 24):
static int sample_sizes[] = {
	32, 24, 16, 8,
};

i = 0
check (i < ARRAY_SIZE(sample_sizes))
check (sample_sizes[i] <= bits)
 apply constraint
i++
check (i < ARRAY_SIZE(sample_sizes))
check (sample_sizes[i] <= bits)
i++
check (i < ARRAY_SIZE(sample_sizes))
check (sample_sizes[i] <= bits)
i++
check (i < ARRAY_SIZE(sample_sizes))
check (sample_sizes[i] <= bits)
i++
check (i < ARRAY_SIZE(sample_sizes))
 go out

-- 
Péter


More information about the Alsa-devel mailing list