[PATCH 1/2] imaadp32.acm: Fix block size calculations.

Zebediah Figura z.figura12 at gmail.com
Thu Jun 8 10:11:00 CDT 2017


On 06/08/2017 08:35 AM, Andrew Eikum wrote:
> On Wed, Jun 07, 2017 at 10:29:42AM -0500, Zebediah Figura wrote:
>> Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
>> ---
>>   dlls/imaadp32.acm/imaadp32.c | 11 ++---------
>>   1 file changed, 2 insertions(+), 9 deletions(-)
>>
>> diff --git a/dlls/imaadp32.acm/imaadp32.c b/dlls/imaadp32.acm/imaadp32.c
>> index 78a0ac4c6c..ecc111c071 100644
>> --- a/dlls/imaadp32.acm/imaadp32.c
>> +++ b/dlls/imaadp32.acm/imaadp32.c
>> @@ -154,7 +154,7 @@ static void     init_wfx_ima_adpcm(IMAADPCMWAVEFORMAT* awfx/*, DWORD nba*/)
>>       }
>>       pwfx->cbSize = sizeof(WORD);
>>   
>> -    awfx->wSamplesPerBlock = (pwfx->nBlockAlign - (4 * pwfx->nChannels) * 2) / pwfx->nChannels + 1;
>> +    awfx->wSamplesPerBlock = pwfx->nBlockAlign * (2 / pwfx->nChannels) - 7;
> 
> If this reference is accurate:
> 
>    https://wiki.multimedia.cx/index.php/Microsoft_IMA_ADPCM
> 
> Then I think the old version is actually almost correct. I think they
> just distributed the 2 factor incorrectly.
> 
> Can you try this and double check my math?
> 
> +    awfx->wSamplesPerBlock = ((pwfx->nBlockAlign - (4 * pwfx->nChannels)) * 2) / pwfx->nChannels + 1;
> 
> Andrew
> 

Yeah, it's more transparent that way. I'll resend this patch.



More information about the wine-devel mailing list