2 AHI - Hardware independent audio subsystem
3 Copyright (C) 1996-2005 Martin Blom <martin@blom.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Cambridge,
23 #include "addroutines.h"
25 typedef long long LONGLONG
;
27 /******************************************************************************
28 ** Add-Routines ***************************************************************
29 ******************************************************************************/
49 The fraction offset is divided by two in order to make sure that the
50 calculation of linearsample fits a LONG (0 =< offsetf <= 32767).
52 The routines could be faster, of course. One idea is to split the for loop
53 into two loops in order to eliminate the FirstOffsetI test in the second loop.
57 /*****************************************************************************/
59 /* Forward mixing code */
61 #define offseti ( (long) ( offset >> 32 ) )
63 #define offsetf ( (long) ( (unsigned long) ( offset & 0xffffffffULL ) >> 17) )
70 Fixed64 offset
= *Offset
;
72 LONG startpoint
, endpoint
= 0; // Make compiler happy
75 lastpoint
= 0; // 0 doesn't affect the StopAtZero code
77 for( i
= 0; i
< Samples
; i
++)
79 if( offseti
== FirstOffsetI
) {
80 startpoint
= *StartPointLeft
;
84 startpoint
= src
[ offseti
- 1 ] << 8;
87 endpoint
= src
[ offseti
] << 8;
89 startpoint
+= (((endpoint
- startpoint
) * offsetf
) >> 15);
92 ( ( lastpoint
< 0 && startpoint
>= 0 ) ||
93 ( lastpoint
> 0 && startpoint
<= 0 ) ) )
98 lastpoint
= startpoint
;
100 dst
[ 0 ] += ScaleLeft
* startpoint
;
101 dst
[ 1 ] += ScaleRight
* startpoint
;
107 *StartPointLeft
= endpoint
;
116 AddBytes71( ADDARGS
)
120 Fixed64 offset
= *Offset
;
122 LONG startpointL
, startpointR
, endpointL
= 0, endpointR
= 0; // Make compiler happy
123 LONG lastpointL
, lastpointR
;
125 lastpointL
= lastpointR
= 0; // 0 doesn't affect the StopAtZero code
127 for( i
= 0; i
< Samples
; i
++)
129 if( offseti
== FirstOffsetI
) {
130 startpointL
= *StartPointLeft
;
131 startpointR
= *StartPointRight
;
135 startpointL
= src
[ offseti
* 2 + 0 - 2 ] << 8;
136 startpointR
= src
[ offseti
* 2 + 1 - 2 ] << 8;
139 endpointL
= src
[ offseti
* 2 + 0 ] << 8;
140 endpointR
= src
[ offseti
* 2 + 1 ] << 8;
142 startpointL
+= (((endpointL
- startpointL
) * offsetf
) >> 15);
143 startpointR
+= (((endpointR
- startpointR
) * offsetf
) >> 15);
146 ( ( lastpointL
< 0 && startpointL
>= 0 ) ||
147 ( lastpointR
< 0 && startpointR
>= 0 ) ||
148 ( lastpointL
> 0 && startpointL
<= 0 ) ||
149 ( lastpointR
> 0 && startpointR
<= 0 ) ) )
154 lastpointL
= startpointL
;
155 lastpointR
= startpointR
;
157 dst
[ 0 ] += ScaleLeft
* startpointL
;
158 dst
[ 1 ] += ScaleRight
* startpointR
;
164 *StartPointLeft
= endpointL
;
165 *StartPointRight
= endpointR
;
177 Fixed64 offset
= *Offset
;
179 LONG startpoint
, endpoint
= 0; // Make compiler happy
182 lastpoint
= 0; // 0 doesn't affect the StopAtZero code
184 for( i
= 0; i
< Samples
; i
++)
186 if( offseti
== FirstOffsetI
) {
187 startpoint
= *StartPointLeft
;
191 startpoint
= src
[ offseti
- 1 ];
194 endpoint
= src
[ offseti
];
196 startpoint
+= (((endpoint
- startpoint
) * offsetf
) >> 15);
199 ( ( lastpoint
< 0 && startpoint
>= 0 ) ||
200 ( lastpoint
> 0 && startpoint
<= 0 ) ) )
205 lastpoint
= startpoint
;
207 dst
[ 0 ] += ScaleLeft
* startpoint
;
208 dst
[ 1 ] += ScaleRight
* startpoint
;
214 *StartPointLeft
= endpoint
;
224 AddWords71( ADDARGS
)
228 Fixed64 offset
= *Offset
;
230 LONG startpointL
, startpointR
, endpointL
= 0, endpointR
= 0; // Make compiler happy
231 LONG lastpointL
, lastpointR
;
233 lastpointL
= lastpointR
= 0; // 0 doesn't affect the StopAtZero code
235 for( i
= 0; i
< Samples
; i
++)
237 if( offseti
== FirstOffsetI
) {
238 startpointL
= *StartPointLeft
;
239 startpointR
= *StartPointRight
;
243 startpointL
= src
[ offseti
* 2 + 0 - 2 ];
244 startpointR
= src
[ offseti
* 2 + 1 - 2 ];
247 endpointL
= src
[ offseti
* 2 + 0 ];
248 endpointR
= src
[ offseti
* 2 + 1 ];
250 startpointL
+= (((endpointL
- startpointL
) * offsetf
) >> 15);
251 startpointR
+= (((endpointR
- startpointR
) * offsetf
) >> 15);
254 ( ( lastpointL
< 0 && startpointL
>= 0 ) ||
255 ( lastpointR
< 0 && startpointR
>= 0 ) ||
256 ( lastpointL
> 0 && startpointL
<= 0 ) ||
257 ( lastpointR
> 0 && startpointR
<= 0 ) ) )
262 lastpointL
= startpointL
;
263 lastpointR
= startpointR
;
265 dst
[ 0 ] += ScaleLeft
* startpointL
;
266 dst
[ 1 ] += ScaleRight
* startpointR
;
272 *StartPointLeft
= endpointL
;
273 *StartPointRight
= endpointR
;
284 /*****************************************************************************/
286 #define offseti ( (long) ( offset >> 32 ) )
288 #define offsetf ( offset & 0xffffffffULL )
295 Fixed64 offset
= *Offset
;
297 LONG startpoint
, endpoint
= 0; // Make compiler happy
300 lastpoint
= 0; // 0 doesn't affect the StopAtZero code
302 for( i
= 0; i
< Samples
; i
++)
304 if( offseti
== FirstOffsetI
) {
305 startpoint
= *StartPointLeft
<< 16;
309 startpoint
= src
[ offseti
- 1 ];
312 endpoint
= src
[ offseti
];
314 startpoint
+= (LONG
) (((LONGLONG
) (endpoint
- startpoint
) * offsetf
) >> 32);
317 ( ( lastpoint
< 0 && startpoint
>= 0 ) ||
318 ( lastpoint
> 0 && startpoint
<= 0 ) ) )
323 lastpoint
= startpoint
;
325 dst
[ 0 ] += (LONG
) ( ( (LONGLONG
) ScaleLeft
* startpoint
) >> 16 );
326 dst
[ 1 ] += (LONG
) ( ( (LONGLONG
) ScaleRight
* startpoint
) >> 16 );
332 *StartPointLeft
= endpoint
>> 16;
342 AddLongs71( ADDARGS
)
346 Fixed64 offset
= *Offset
;
348 LONG startpointL
, startpointR
, endpointL
= 0, endpointR
= 0; // Make compiler happy
349 LONG lastpointL
, lastpointR
;
351 lastpointL
= lastpointR
= 0; // 0 doesn't affect the StopAtZero code
353 for( i
= 0; i
< Samples
; i
++)
355 if( offseti
== FirstOffsetI
) {
356 startpointL
= *StartPointLeft
<< 16;
357 startpointR
= *StartPointRight
<< 16;
361 startpointL
= src
[ offseti
* 2 + 0 - 2 ];
362 startpointR
= src
[ offseti
* 2 + 1 - 2 ];
365 endpointL
= src
[ offseti
* 2 + 0 ];
366 endpointR
= src
[ offseti
* 2 + 1 ];
368 startpointL
+= (LONG
) (((LONGLONG
) (endpointL
- startpointL
) * offsetf
) >> 32);
369 startpointR
+= (LONG
) (((LONGLONG
) (endpointR
- startpointR
) * offsetf
) >> 32);
372 ( ( lastpointL
< 0 && startpointL
>= 0 ) ||
373 ( lastpointR
< 0 && startpointR
>= 0 ) ||
374 ( lastpointL
> 0 && startpointL
<= 0 ) ||
375 ( lastpointR
> 0 && startpointR
<= 0 ) ) )
380 lastpointL
= startpointL
;
381 lastpointR
= startpointR
;
383 dst
[ 0 ] += (LONG
) ( ( (LONGLONG
) ScaleLeft
* startpointL
) >> 16 );
384 dst
[ 1 ] += (LONG
) ( ( (LONGLONG
) ScaleRight
* startpointR
) >> 16 );
390 *StartPointLeft
= endpointL
>> 16;
391 *StartPointRight
= endpointR
>> 16;
405 Fixed64 offset
= *Offset
;
407 LONG startpointL
, startpointR
;
408 LONG startpointRL
, startpointRR
;
409 LONG startpointSL
, startpointSR
;
410 LONG startpointC
, startpointLFE
;
411 LONG endpointL
= 0, endpointR
= 0; // Make compiler happy
412 LONG endpointRL
= 0, endpointRR
= 0; // Make compiler happy
413 LONG endpointSL
= 0, endpointSR
= 0; // Make compiler happy
414 LONG endpointC
= 0, endpointLFE
= 0; // Make compiler happy
415 LONG lastpointL
, lastpointR
;
416 LONG scale_mono
= ( ScaleLeft
+ ScaleRight
) / 2;
418 lastpointL
= lastpointR
= 0; // 0 doesn't affect the StopAtZero code
420 for( i
= 0; i
< Samples
; i
++)
422 if( offseti
== FirstOffsetI
) {
423 startpointL
= StartPoints
[ CD_L
] << 16;
424 startpointR
= StartPoints
[ CD_R
] << 16;
425 startpointRL
= StartPoints
[ CD_RL
] << 16;
426 startpointRR
= StartPoints
[ CD_RR
] << 16;
427 startpointSL
= StartPoints
[ CD_SL
] << 16;
428 startpointSR
= StartPoints
[ CD_SR
] << 16;
429 startpointC
= StartPoints
[ CD_C
] << 16;
430 startpointLFE
= StartPoints
[ CD_LFE
] << 16;
434 startpointL
= src
[ offseti
* 8 + 0 - 8 ];
435 startpointR
= src
[ offseti
* 8 + 1 - 8 ];
436 startpointRL
= src
[ offseti
* 8 + 2 - 8 ];
437 startpointRR
= src
[ offseti
* 8 + 3 - 8 ];
438 startpointSL
= src
[ offseti
* 8 + 4 - 8 ];
439 startpointSR
= src
[ offseti
* 8 + 5 - 8 ];
440 startpointC
= src
[ offseti
* 8 + 6 - 8 ];
441 startpointLFE
= src
[ offseti
* 8 + 7 - 8 ];
444 endpointL
= src
[ offseti
* 8 + 0 ];
445 endpointR
= src
[ offseti
* 8 + 1 ];
446 endpointRL
= src
[ offseti
* 8 + 2 ];
447 endpointRR
= src
[ offseti
* 8 + 3 ];
448 endpointSL
= src
[ offseti
* 8 + 4 ];
449 endpointSR
= src
[ offseti
* 8 + 5 ];
450 endpointC
= src
[ offseti
* 8 + 6 ];
451 endpointLFE
= src
[ offseti
* 8 + 7 ];
453 startpointL
+= (LONG
) (((LONGLONG
) (endpointL
- startpointL
) * offsetf
) >> 32);
454 startpointR
+= (LONG
) (((LONGLONG
) (endpointR
- startpointR
) * offsetf
) >> 32);
455 startpointRL
+= (LONG
) (((LONGLONG
) (endpointRL
- startpointRL
) * offsetf
) >> 32);
456 startpointRR
+= (LONG
) (((LONGLONG
) (endpointRR
- startpointRR
) * offsetf
) >> 32);
457 startpointSL
+= (LONG
) (((LONGLONG
) (endpointSL
- startpointSL
) * offsetf
) >> 32);
458 startpointSR
+= (LONG
) (((LONGLONG
) (endpointSR
- startpointSR
) * offsetf
) >> 32);
459 startpointC
+= (LONG
) (((LONGLONG
) (endpointC
- startpointC
) * offsetf
) >> 32);
460 startpointLFE
+= (LONG
) (((LONGLONG
) (endpointLFE
- startpointLFE
) * offsetf
) >> 32);
463 ( ( lastpointL
< 0 && startpointL
>= 0 ) ||
464 ( lastpointR
< 0 && startpointR
>= 0 ) ||
465 ( lastpointL
> 0 && startpointL
<= 0 ) ||
466 ( lastpointR
> 0 && startpointR
<= 0 ) ) )
471 lastpointL
= startpointL
;
472 lastpointR
= startpointR
;
474 *dst
++ += (LONG
) ( ( (LONGLONG
) ScaleLeft
* startpointL
) >> 16 );
475 *dst
++ += (LONG
) ( ( (LONGLONG
) ScaleRight
* startpointR
) >> 16 );
476 *dst
++ += (LONG
) ( ( (LONGLONG
) ScaleLeft
* startpointRL
) >> 16 );
477 *dst
++ += (LONG
) ( ( (LONGLONG
) ScaleRight
* startpointRR
) >> 16 );
478 *dst
++ += (LONG
) ( ( (LONGLONG
) ScaleLeft
* startpointSL
) >> 16 );
479 *dst
++ += (LONG
) ( ( (LONGLONG
) ScaleRight
* startpointSR
) >> 16 );
480 *dst
++ += (LONG
) ( ( (LONGLONG
) scale_mono
* startpointC
) >> 16 );
481 *dst
++ += (LONG
) ( ( (LONGLONG
) scale_mono
* startpointLFE
) >> 16 );
486 StartPoints
[ CD_L
] = endpointL
>> 16;
487 StartPoints
[ CD_R
] = endpointR
>> 16;
488 StartPoints
[ CD_RL
] = endpointRL
>> 16;
489 StartPoints
[ CD_RR
] = endpointRR
>> 16;
490 StartPoints
[ CD_SL
] = endpointSL
>> 16;
491 StartPoints
[ CD_SR
] = endpointSR
>> 16;
492 StartPoints
[ CD_C
] = endpointC
>> 16;
493 StartPoints
[ CD_LFE
] = endpointLFE
>> 16;
505 /*****************************************************************************/
507 /* Backward mixing code */
509 #define offseti ( (long) ( offset >> 32 ) )
511 #define offsetf ( (long) ( 32768 - ( (unsigned long) ( offset & 0xffffffffULL ) >> 17 ) ) )
514 AddByte71B( ADDARGS
)
518 Fixed64 offset
= *Offset
;
520 LONG startpoint
, endpoint
= 0; // Make compiler happy
523 lastpoint
= 0; // 0 doesn't affect the StopAtZero code
525 for( i
= 0; i
< Samples
; i
++)
527 if( offseti
== FirstOffsetI
) {
528 startpoint
= *StartPointLeft
;
532 startpoint
= src
[ offseti
+ 1 ] << 8;
535 endpoint
= src
[ offseti
] << 8;
537 startpoint
+= (((endpoint
- startpoint
) * offsetf
) >> 15);
540 ( ( lastpoint
< 0 && startpoint
>= 0 ) ||
541 ( lastpoint
> 0 && startpoint
<= 0 ) ) )
546 lastpoint
= startpoint
;
548 dst
[ 0 ] += ScaleLeft
* startpoint
;
549 dst
[ 1 ] += ScaleRight
* startpoint
;
555 *StartPointLeft
= endpoint
;
564 AddBytes71B( ADDARGS
)
568 Fixed64 offset
= *Offset
;
570 LONG startpointL
, startpointR
, endpointL
= 0, endpointR
= 0; // Make compiler happy
571 LONG lastpointL
, lastpointR
;
573 lastpointL
= lastpointR
= 0; // 0 doesn't affect the StopAtZero code
575 for( i
= 0; i
< Samples
; i
++)
577 if( offseti
== FirstOffsetI
) {
578 startpointL
= *StartPointLeft
;
579 startpointR
= *StartPointRight
;
583 startpointL
= src
[ offseti
* 2 + 0 + 2 ] << 8;
584 startpointR
= src
[ offseti
* 2 + 1 + 2 ] << 8;
587 endpointL
= src
[ offseti
* 2 + 0 ] << 8;
588 endpointR
= src
[ offseti
* 2 + 1 ] << 8;
590 startpointL
+= (((endpointL
- startpointL
) * offsetf
) >> 15);
591 startpointR
+= (((endpointR
- startpointR
) * offsetf
) >> 15);
594 ( ( lastpointL
< 0 && startpointL
>= 0 ) ||
595 ( lastpointR
< 0 && startpointR
>= 0 ) ||
596 ( lastpointL
> 0 && startpointL
<= 0 ) ||
597 ( lastpointR
> 0 && startpointR
<= 0 ) ) )
602 lastpointL
= startpointL
;
603 lastpointR
= startpointR
;
605 dst
[ 0 ] += ScaleLeft
* startpointL
;
606 dst
[ 1 ] += ScaleRight
* startpointR
;
612 *StartPointLeft
= endpointL
;
613 *StartPointRight
= endpointR
;
623 AddWord71B( ADDARGS
)
627 Fixed64 offset
= *Offset
;
629 LONG startpoint
, endpoint
= 0; // Make compiler happy
632 lastpoint
= 0; // 0 doesn't affect the StopAtZero code
634 for( i
= 0; i
< Samples
; i
++)
636 if( offseti
== FirstOffsetI
) {
637 startpoint
= *StartPointLeft
;
641 startpoint
= src
[ offseti
+ 1 ];
644 endpoint
= src
[ offseti
];
646 startpoint
+= (((endpoint
- startpoint
) * offsetf
) >> 15);
649 ( ( lastpoint
< 0 && startpoint
>= 0 ) ||
650 ( lastpoint
> 0 && startpoint
<= 0 ) ) )
655 lastpoint
= startpoint
;
657 dst
[ 0 ] += ScaleLeft
* startpoint
;
658 dst
[ 1 ] += ScaleRight
* startpoint
;
664 *StartPointLeft
= endpoint
;
674 AddWords71B( ADDARGS
)
678 Fixed64 offset
= *Offset
;
680 LONG startpointL
, startpointR
, endpointL
= 0, endpointR
= 0; // Make compiler happy
681 LONG lastpointL
, lastpointR
;
683 lastpointL
= lastpointR
= 0; // 0 doesn't affect the StopAtZero code
685 for( i
= 0; i
< Samples
; i
++)
687 if( offseti
== FirstOffsetI
) {
688 startpointL
= *StartPointLeft
;
689 startpointR
= *StartPointRight
;
693 startpointL
= src
[ offseti
* 2 + 0 + 2 ];
694 startpointR
= src
[ offseti
* 2 + 1 + 2 ];
697 endpointL
= src
[ offseti
* 2 + 0 ];
698 endpointR
= src
[ offseti
* 2 + 1 ];
700 startpointL
+= (((endpointL
- startpointL
) * offsetf
) >> 15);
701 startpointR
+= (((endpointR
- startpointR
) * offsetf
) >> 15);
704 ( ( lastpointL
< 0 && startpointL
>= 0 ) ||
705 ( lastpointR
< 0 && startpointR
>= 0 ) ||
706 ( lastpointL
> 0 && startpointL
<= 0 ) ||
707 ( lastpointR
> 0 && startpointR
<= 0 ) ) )
712 lastpointL
= startpointL
;
713 lastpointR
= startpointR
;
715 dst
[ 0 ] += ScaleLeft
* startpointL
;
716 dst
[ 1 ] += ScaleRight
* startpointR
;
722 *StartPointLeft
= endpointL
;
723 *StartPointRight
= endpointR
;
734 /*****************************************************************************/
736 #define offseti ( (long) ( offset >> 32 ) )
738 #define offsetf ( (long) ( 32768 - ( (unsigned long) ( offset & 0xffffffffULL ) >> 17 ) ) )
741 AddLong71B( ADDARGS
)
745 Fixed64 offset
= *Offset
;
747 LONG startpoint
, endpoint
= 0; // Make compiler happy
750 lastpoint
= 0; // 0 doesn't affect the StopAtZero code
752 for( i
= 0; i
< Samples
; i
++)
754 if( offseti
== FirstOffsetI
) {
755 startpoint
= *StartPointLeft
<< 16;
759 startpoint
= src
[ offseti
+ 1 ];
762 endpoint
= src
[ offseti
];
764 startpoint
+= (LONG
) (((LONGLONG
) (endpoint
- startpoint
) * offsetf
) >> 32);
767 ( ( lastpoint
< 0 && startpoint
>= 0 ) ||
768 ( lastpoint
> 0 && startpoint
<= 0 ) ) )
773 lastpoint
= startpoint
;
775 dst
[ 0 ] += (LONG
) ( ( (LONGLONG
) ScaleLeft
* startpoint
) >> 16 );
776 dst
[ 1 ] += (LONG
) ( ( (LONGLONG
) ScaleRight
* startpoint
) >> 16 );
782 *StartPointLeft
= endpoint
>> 16;
792 AddLongs71B( ADDARGS
)
796 Fixed64 offset
= *Offset
;
798 LONG startpointL
, startpointR
, endpointL
= 0, endpointR
= 0; // Make compiler happy
799 LONG lastpointL
, lastpointR
;
801 lastpointL
= lastpointR
= 0; // 0 doesn't affect the StopAtZero code
803 for( i
= 0; i
< Samples
; i
++)
805 if( offseti
== FirstOffsetI
) {
806 startpointL
= *StartPointLeft
<< 16;
807 startpointR
= *StartPointRight
<< 16;
811 startpointL
= src
[ offseti
* 2 + 0 + 2 ];
812 startpointR
= src
[ offseti
* 2 + 1 + 2 ];
815 endpointL
= src
[ offseti
* 2 + 0 ];
816 endpointR
= src
[ offseti
* 2 + 1 ];
818 startpointL
+= (LONG
) (((LONGLONG
) (endpointL
- startpointL
) * offsetf
) >> 32);
819 startpointR
+= (LONG
) (((LONGLONG
) (endpointR
- startpointR
) * offsetf
) >> 32);
822 ( ( lastpointL
< 0 && startpointL
>= 0 ) ||
823 ( lastpointR
< 0 && startpointR
>= 0 ) ||
824 ( lastpointL
> 0 && startpointL
<= 0 ) ||
825 ( lastpointR
> 0 && startpointR
<= 0 ) ) )
830 lastpointL
= startpointL
;
831 lastpointR
= startpointR
;
833 dst
[ 0 ] += (LONG
) ( ( (LONGLONG
) ScaleLeft
* startpointL
) >> 16 );
834 dst
[ 1 ] += (LONG
) ( ( (LONGLONG
) ScaleRight
* startpointR
) >> 16 );
840 *StartPointLeft
= endpointL
>> 16;
841 *StartPointRight
= endpointR
>> 16;
851 Add7171B( ADDARGS71
)
855 Fixed64 offset
= *Offset
;
857 LONG startpointL
, startpointR
;
858 LONG startpointRL
, startpointRR
;
859 LONG startpointSL
, startpointSR
;
860 LONG startpointC
, startpointLFE
;
861 LONG endpointL
= 0, endpointR
= 0; // Make compiler happy
862 LONG endpointRL
= 0, endpointRR
= 0; // Make compiler happy
863 LONG endpointSL
= 0, endpointSR
= 0; // Make compiler happy
864 LONG endpointC
= 0, endpointLFE
= 0; // Make compiler happy
865 LONG lastpointL
, lastpointR
;
866 LONG scale_mono
= ( ScaleLeft
+ ScaleRight
) / 2;
868 lastpointL
= lastpointR
= 0; // 0 doesn't affect the StopAtZero code
870 for( i
= 0; i
< Samples
; i
++)
872 if( offseti
== FirstOffsetI
) {
873 startpointL
= StartPoints
[ CD_L
] << 16;
874 startpointR
= StartPoints
[ CD_R
] << 16;
875 startpointRL
= StartPoints
[ CD_RL
] << 16;
876 startpointRR
= StartPoints
[ CD_RR
] << 16;
877 startpointSL
= StartPoints
[ CD_SL
] << 16;
878 startpointSR
= StartPoints
[ CD_SR
] << 16;
879 startpointC
= StartPoints
[ CD_C
] << 16;
880 startpointLFE
= StartPoints
[ CD_LFE
] << 16;
884 startpointL
= src
[ offseti
* 8 + 0 + 8 ];
885 startpointR
= src
[ offseti
* 8 + 1 + 8 ];
886 startpointRL
= src
[ offseti
* 8 + 2 + 8 ];
887 startpointRR
= src
[ offseti
* 8 + 3 + 8 ];
888 startpointSL
= src
[ offseti
* 8 + 4 + 8 ];
889 startpointSR
= src
[ offseti
* 8 + 5 + 8 ];
890 startpointC
= src
[ offseti
* 8 + 6 + 8 ];
891 startpointLFE
= src
[ offseti
* 8 + 7 + 8 ];
894 endpointL
= src
[ offseti
* 8 + 0 ];
895 endpointR
= src
[ offseti
* 8 + 1 ];
896 endpointRL
= src
[ offseti
* 8 + 2 ];
897 endpointRR
= src
[ offseti
* 8 + 3 ];
898 endpointSL
= src
[ offseti
* 8 + 4 ];
899 endpointSR
= src
[ offseti
* 8 + 5 ];
900 endpointC
= src
[ offseti
* 8 + 6 ];
901 endpointLFE
= src
[ offseti
* 8 + 7 ];
903 startpointL
+= (LONG
) (((LONGLONG
) (endpointL
- startpointL
) * offsetf
) >> 32);
904 startpointR
+= (LONG
) (((LONGLONG
) (endpointR
- startpointR
) * offsetf
) >> 32);
905 startpointRL
+= (LONG
) (((LONGLONG
) (endpointRL
- startpointRL
) * offsetf
) >> 32);
906 startpointRR
+= (LONG
) (((LONGLONG
) (endpointRR
- startpointRR
) * offsetf
) >> 32);
907 startpointSL
+= (LONG
) (((LONGLONG
) (endpointSL
- startpointSL
) * offsetf
) >> 32);
908 startpointSR
+= (LONG
) (((LONGLONG
) (endpointSR
- startpointSR
) * offsetf
) >> 32);
909 startpointC
+= (LONG
) (((LONGLONG
) (endpointC
- startpointC
) * offsetf
) >> 32);
910 startpointLFE
+= (LONG
) (((LONGLONG
) (endpointLFE
- startpointLFE
) * offsetf
) >> 32);
913 ( ( lastpointL
< 0 && startpointL
>= 0 ) ||
914 ( lastpointR
< 0 && startpointR
>= 0 ) ||
915 ( lastpointL
> 0 && startpointL
<= 0 ) ||
916 ( lastpointR
> 0 && startpointR
<= 0 ) ) )
921 lastpointL
= startpointL
;
922 lastpointR
= startpointR
;
924 *dst
++ += (LONG
) ( ( (LONGLONG
) ScaleLeft
* startpointL
) >> 16 );
925 *dst
++ += (LONG
) ( ( (LONGLONG
) ScaleRight
* startpointR
) >> 16 );
926 *dst
++ += (LONG
) ( ( (LONGLONG
) ScaleLeft
* startpointRL
) >> 16 );
927 *dst
++ += (LONG
) ( ( (LONGLONG
) ScaleRight
* startpointRR
) >> 16 );
928 *dst
++ += (LONG
) ( ( (LONGLONG
) ScaleLeft
* startpointSL
) >> 16 );
929 *dst
++ += (LONG
) ( ( (LONGLONG
) ScaleRight
* startpointSR
) >> 16 );
930 *dst
++ += (LONG
) ( ( (LONGLONG
) scale_mono
* startpointC
) >> 16 );
931 *dst
++ += (LONG
) ( ( (LONGLONG
) scale_mono
* startpointLFE
) >> 16 );
936 StartPoints
[ CD_L
] = endpointL
>> 16;
937 StartPoints
[ CD_R
] = endpointR
>> 16;
938 StartPoints
[ CD_RL
] = endpointRL
>> 16;
939 StartPoints
[ CD_RR
] = endpointRR
>> 16;
940 StartPoints
[ CD_SL
] = endpointSL
>> 16;
941 StartPoints
[ CD_SR
] = endpointSR
>> 16;
942 StartPoints
[ CD_C
] = endpointC
>> 16;
943 StartPoints
[ CD_LFE
] = endpointLFE
>> 16;