Coverage Report

Created: 2025-07-18 07:02

/src/libhevc/encoder/ia_basic_ops40.h
Line
Count
Source (jump to first uncovered line)
1
/******************************************************************************
2
 *
3
 * Copyright (C) 2018 The Android Open Source Project
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at:
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 *
17
 *****************************************************************************
18
 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19
*/
20
21
/*****************************************************************************/
22
/*                                                                           */
23
/*  file name        : ia_basic_ops40.h                                      */
24
/*                                                                           */
25
/*  description      : this file has all basic operations, which have        */
26
/*                     40 bit intermediate operations                        */
27
/*                                                                           */
28
/*  list of functions: 1. norm40                                             */
29
/*                     2. add32_shr40                                        */
30
/*                     3. sub32_shr40                                        */
31
/*                     4. mult32x16in32_shl                                  */
32
/*                     5. mult32x16in32                                      */
33
/*                     6. mult32x16in32_shl_sat                              */
34
/*                     7. mult32_shl                                         */
35
/*                     8. mult32                                             */
36
/*                     9. mult32_shl_sat                                     */
37
/*                     10.mac32x16in32                                       */
38
/*                     11.mac32x16in32_shl                                   */
39
/*                     12.mac32x16in32_shl_sat                               */
40
/*                     13.mac32                                              */
41
/*                     14.mac32_shl                                          */
42
/*                     15.mac32_shl_sat                                      */
43
/*                     16.msu32x16in32                                       */
44
/*                     17.msu32x16in32_shl                                   */
45
/*                     18.msu32x16in32_shl_sat                               */
46
/*                     19.msu32                                              */
47
/*                     20.msu32_shl                                          */
48
/*                     21.msu32_shl_sat                                      */
49
/*                     22.mac3216_arr40                                      */
50
/*                     23.mac32_arr40                                        */
51
/*                     24.mac16_arr40                                        */
52
/*                     25.add32_arr40                                        */
53
/*                                                                           */
54
/*  issues / problems: none                                                  */
55
/*                                                                           */
56
/*  revision history :                                                       */
57
/*                                                                           */
58
/*        DD MM YYYY       author                changes                     */
59
/*        06 12 2002       ashok M/chetan K      created                     */
60
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
61
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
62
/*                                                                           */
63
/*****************************************************************************/
64
65
#ifndef __IA_BASIC_OPS40_H__
66
#define __IA_BASIC_OPS40_H__
67
68
/*****************************************************************************/
69
/* file includes                                                             */
70
/*  ia_type_def.h                                                            */
71
/*  ia_basic_ops32.h                                                         */
72
/*****************************************************************************/
73
74
/*****************************************************************************/
75
/*                                                                           */
76
/*  function name : norm40                                                   */
77
/*                                                                           */
78
/*  description   : normalize input to 32 bits, return denormalizing info    */
79
/*                  static function                                          */
80
/*                                                                           */
81
/*  inputs        : WORD40  *in                                              */
82
/*                                                                           */
83
/*  globals       : none                                                     */
84
/*                                                                           */
85
/*  processing    : if input above 32_bits then only the upper 8 bits        */
86
/*                  normalized to fit in 32_bits else normal 32_bit norming  */
87
/*                                                                           */
88
/*  outputs       : normalized 32 bit value                                  */
89
/*                                                                           */
90
/*  returns       : WORD16 exponent                                          */
91
/*                                                                           */
92
/*  assumptions   : if supplied input is 0 the result returned is 31         */
93
/*                                                                           */
94
/*  issues        : none                                                     */
95
/*                                                                           */
96
/*  revision history :                                                       */
97
/*                                                                           */
98
/*        DD MM YYYY       author                changes                     */
99
/*        06 12 2002       ashok M/chetan K      created                     */
100
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
101
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
102
/*                                                                           */
103
/*****************************************************************************/
104
105
static PLATFORM_INLINE WORD16 norm40(WORD40 *in)
106
0
{
107
0
    WORD16 expo;
108
0
    WORD32 tempo;
109
0
    WORD40 cmp_val = (WORD40)-2147483648.0;
110
0
111
0
    if(0 == (*in))
112
0
        return 31;
113
0
114
0
    if(((*in) <= 0x7fffffff) && ((WORD40)(*in) >= cmp_val))
115
0
    {
116
0
        tempo = (WORD32)(*in);
117
0
        expo = norm32(tempo);
118
0
        *in = tempo << expo;
119
0
120
0
        return (expo);
121
0
    }
122
0
123
0
    tempo = (WORD32)((*in) >> 31);
124
0
    expo = 31 - (norm32(tempo));
125
0
    *in = (*in) >> expo;
126
0
127
0
    return (-expo);
128
0
}
Unexecuted instantiation: var_q_operator.c:norm40
Unexecuted instantiation: sqrt_interp.c:norm40
129
130
/*****************************************************************************/
131
/*                                                                           */
132
/*  function name : add32_shr40                                              */
133
/*                                                                           */
134
/*  description   : adds two numbers and right shifts once                   */
135
/*                                                                           */
136
/*  inputs        : WORD32 a, WORD32 b                                       */
137
/*                                                                           */
138
/*  outputs       : none                                                     */
139
/*                                                                           */
140
/*  globals       : none                                                     */
141
/*                                                                           */
142
/*  processing    : add and right shift                                      */
143
/*                                                                           */
144
/*  returns       : WORD32 sum                                               */
145
/*                                                                           */
146
/*  issues        : none                                                     */
147
/*                                                                           */
148
/*  revision history :                                                       */
149
/*                                                                           */
150
/*        DD MM YYYY       author                changes                     */
151
/*        06 12 2002       ashok M/chetan K      created                     */
152
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
153
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
154
/*                                                                           */
155
/*****************************************************************************/
156
157
static PLATFORM_INLINE WORD32 add32_shr40(WORD32 a, WORD32 b)
158
0
{
159
0
    WORD40 sum;
160
0
161
0
    sum = (WORD40)a + (WORD40)b;
162
0
    sum = sum >> 1;
163
0
164
0
    return ((WORD32)sum);
165
0
}
Unexecuted instantiation: var_q_operator.c:add32_shr40
Unexecuted instantiation: sqrt_interp.c:add32_shr40
166
167
/*****************************************************************************/
168
/*                                                                           */
169
/*  function name : sub32_shr40                                              */
170
/*                                                                           */
171
/*  description   : subtracts and right shifts once                          */
172
/*                                                                           */
173
/*  inputs        : WORD32 a, WORD32 b                                       */
174
/*                                                                           */
175
/*  outputs       : none                                                     */
176
/*                                                                           */
177
/*  globals       : none                                                     */
178
/*                                                                           */
179
/*  processing    : substract and right shift                                */
180
/*                                                                           */
181
/*  returns       : WORD32 sum                                               */
182
/*                                                                           */
183
/*  issues        : none                                                     */
184
/*                                                                           */
185
/*  revision history :                                                       */
186
/*                                                                           */
187
/*        DD MM YYYY       author                changes                     */
188
/*        06 12 2002       ashok M/chetan K      created                     */
189
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
190
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
191
/*                                                                           */
192
/*****************************************************************************/
193
194
static PLATFORM_INLINE WORD32 sub32_shr40(WORD32 a, WORD32 b)
195
0
{
196
0
    WORD40 sum;
197
0
198
0
    sum = (WORD40)a - (WORD40)b;
199
0
    sum = sum >> 1;
200
0
201
0
    return ((WORD32)sum);
202
0
}
Unexecuted instantiation: var_q_operator.c:sub32_shr40
Unexecuted instantiation: sqrt_interp.c:sub32_shr40
203
204
/*****************************************************************************/
205
/*                                                                           */
206
/*  function name : mult32x16in32_shl                                        */
207
/*                                                                           */
208
/*  description   : multiply WORD32 with WORD16 return bits 46 to 15         */
209
/*                  doesnt take care of saturation                           */
210
/*                                                                           */
211
/*  inputs        : WORD32 a, WORD16 b                                       */
212
/*                                                                           */
213
/*  outputs       : none                                                     */
214
/*                                                                           */
215
/*  globals       : none                                                     */
216
/*                                                                           */
217
/*  processing    : multiply and right shift by 15                           */
218
/*                                                                           */
219
/*  returns       : WORD32 result                                            */
220
/*                                                                           */
221
/*  issues        : none                                                     */
222
/*                                                                           */
223
/*  revision history :                                                       */
224
/*                                                                           */
225
/*        DD MM YYYY       author                changes                     */
226
/*        06 12 2002       ashok M/chetan K      created                     */
227
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
228
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
229
/*                                                                           */
230
/*****************************************************************************/
231
232
static PLATFORM_INLINE WORD32 mult32x16in32_shl(WORD32 a, WORD16 b)
233
0
{
234
0
    WORD32 result;
235
0
    LWORD64 temp_result;
236
237
0
    temp_result = (LWORD64)a * (LWORD64)b;
238
239
0
    result = (WORD32)((temp_result + 16384) >> 15);
240
241
0
    return (result);
242
0
}
Unexecuted instantiation: var_q_operator.c:mult32x16in32_shl
Unexecuted instantiation: sqrt_interp.c:mult32x16in32_shl
243
244
/*****************************************************************************/
245
/*                                                                           */
246
/*  function name : mult32x16in32                                            */
247
/*                                                                           */
248
/*  description   : multiply WORD32 with WORD16 return bits 47 to 16         */
249
/*                                                                           */
250
/*  inputs        : WORD32 a, WORD16 b                                       */
251
/*                                                                           */
252
/*  outputs       : none                                                     */
253
/*                                                                           */
254
/*  globals       : none                                                     */
255
/*                                                                           */
256
/*  processing    : multiply and right shift by 16                           */
257
/*                                                                           */
258
/*  returns       : WORD32 result                                            */
259
/*                                                                           */
260
/*  issues        : none                                                     */
261
/*                                                                           */
262
/*  revision history :                                                       */
263
/*                                                                           */
264
/*        DD MM YYYY       author                changes                     */
265
/*        06 12 2002       ashok M/chetan K      created                     */
266
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
267
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
268
/*                                                                           */
269
/*****************************************************************************/
270
271
static PLATFORM_INLINE WORD32 mult32x16in32(WORD32 a, WORD16 b)
272
0
{
273
0
    WORD32 result;
274
0
    LWORD64 temp_result;
275
0
276
0
    temp_result = (LWORD64)a * (LWORD64)b;
277
0
278
0
    result = (WORD32)((temp_result + 16384) >> 16);
279
0
280
0
    return (result);
281
0
}
Unexecuted instantiation: var_q_operator.c:mult32x16in32
Unexecuted instantiation: sqrt_interp.c:mult32x16in32
282
283
/*****************************************************************************/
284
/*                                                                           */
285
/*  function name : mult32x16in32_shl_sat                                    */
286
/*                                                                           */
287
/*  description   : multiply WORD32 with WORD16 return bits 46 to 15         */
288
/*                  take care of saturation (MIN32 x MIN16 = MAX32)          */
289
/*                                                                           */
290
/*  inputs        : WORD32 a, WORD16 b                                       */
291
/*                                                                           */
292
/*  outputs       : none                                                     */
293
/*                                                                           */
294
/*  globals       : none                                                     */
295
/*                                                                           */
296
/*  processing    : if input mi_ns return MAX32 else                         */
297
/*                  multiply and right shift by 15                           */
298
/*                                                                           */
299
/*  returns       : WORD32 result                                            */
300
/*                                                                           */
301
/*  issues        : none                                                     */
302
/*                                                                           */
303
/*  revision history :                                                       */
304
/*                                                                           */
305
/*        DD MM YYYY       author                changes                     */
306
/*        06 12 2002       ashok M/chetan K      created                     */
307
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
308
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
309
/*                                                                           */
310
/*****************************************************************************/
311
312
static PLATFORM_INLINE WORD32 mult32x16in32_shl_sat(WORD32 a, WORD16 b)
313
0
{
314
0
    WORD32 result;
315
0
316
0
    if(a == (WORD32)0x80000000 && b == (WORD16)0x8000)
317
0
    {
318
0
        result = (WORD32)0x7fffffff;
319
0
    }
320
0
    else
321
0
    {
322
0
        result = mult32x16in32_shl(a, b);
323
0
    }
324
0
325
0
    return (result);
326
0
}
Unexecuted instantiation: var_q_operator.c:mult32x16in32_shl_sat
Unexecuted instantiation: sqrt_interp.c:mult32x16in32_shl_sat
327
328
/*****************************************************************************/
329
/*                                                                           */
330
/*  function name : mult32_shl                                               */
331
/*                                                                           */
332
/*  description   : multiply WORD32 with WORD32 return bits 62 to 31         */
333
/*                  doesnt take care of saturation                           */
334
/*                                                                           */
335
/*  inputs        : WORD32 a, WORD32 b                                       */
336
/*                                                                           */
337
/*  outputs       : none                                                     */
338
/*                                                                           */
339
/*  globals       : none                                                     */
340
/*                                                                           */
341
/*  processing    : multiply and right shift by 31                           */
342
/*                                                                           */
343
/*  returns       : WORD32 result                                            */
344
/*                                                                           */
345
/*  issues        : none                                                     */
346
/*                                                                           */
347
/*  revision history :                                                       */
348
/*                                                                           */
349
/*        DD MM YYYY       author                changes                     */
350
/*        06 12 2002       ashok M/chetan K      created                     */
351
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
352
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
353
/*                                                                           */
354
/*****************************************************************************/
355
356
static PLATFORM_INLINE WORD32 mult32_shl(WORD32 a, WORD32 b)
357
0
{
358
0
    WORD32 result;
359
0
    LWORD64 temp_result;
360
0
361
0
    temp_result = (LWORD64)a * (LWORD64)b;
362
0
    result = (WORD32)(temp_result >> 31);
363
0
364
0
    return (result);
365
0
}
Unexecuted instantiation: var_q_operator.c:mult32_shl
Unexecuted instantiation: sqrt_interp.c:mult32_shl
366
367
/*****************************************************************************/
368
/*                                                                           */
369
/*  function name : mult32                                                   */
370
/*                                                                           */
371
/*  description   : multiply WORD32 with WORD32 return bits 63 to 32         */
372
/*                                                                           */
373
/*  inputs        : WORD32 a, WORD16 b                                       */
374
/*                                                                           */
375
/*  outputs       : none                                                     */
376
/*                                                                           */
377
/*  globals       : none                                                     */
378
/*                                                                           */
379
/*  processing    : multiply and right shift by 32                           */
380
/*                                                                           */
381
/*  returns       : WORD32 result                                            */
382
/*                                                                           */
383
/*  issues        : none                                                     */
384
/*                                                                           */
385
/*  revision history :                                                       */
386
/*                                                                           */
387
/*        DD MM YYYY       author                changes                     */
388
/*        06 12 2002       ashok M/chetan K      created                     */
389
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
390
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
391
/*                                                                           */
392
/*****************************************************************************/
393
394
static PLATFORM_INLINE WORD32 mult32(WORD32 a, WORD32 b)
395
10.0M
{
396
10.0M
    WORD32 result;
397
10.0M
    LWORD64 temp_result;
398
399
10.0M
    temp_result = (LWORD64)a * (LWORD64)b;
400
10.0M
    result = (WORD32)(temp_result >> 32);
401
402
10.0M
    return (result);
403
10.0M
}
var_q_operator.c:mult32
Line
Count
Source
395
10.0M
{
396
10.0M
    WORD32 result;
397
10.0M
    LWORD64 temp_result;
398
399
10.0M
    temp_result = (LWORD64)a * (LWORD64)b;
400
10.0M
    result = (WORD32)(temp_result >> 32);
401
402
10.0M
    return (result);
403
10.0M
}
Unexecuted instantiation: sqrt_interp.c:mult32
404
405
/*****************************************************************************/
406
/*                                                                           */
407
/*  function name : mult32_shl_sat                                           */
408
/*                                                                           */
409
/*  description   : multiply WORD32 with WORD32 return bits 62 to 31         */
410
/*                  take care of saturation (MIN32 x MIN32 = MAX32)          */
411
/*                                                                           */
412
/*  inputs        : WORD32 a, WORD32 b                                       */
413
/*                                                                           */
414
/*  outputs       : none                                                     */
415
/*                                                                           */
416
/*  globals       : none                                                     */
417
/*                                                                           */
418
/*  processing    : if input mi_ns return MAX32 else                         */
419
/*                  multiply and right shift by 31                           */
420
/*                                                                           */
421
/*  returns       : WORD32 result                                            */
422
/*                                                                           */
423
/*  issues        : none                                                     */
424
/*                                                                           */
425
/*  revision history :                                                       */
426
/*                                                                           */
427
/*        DD MM YYYY       author                changes                     */
428
/*        06 12 2002       ashok M/chetan K      created                     */
429
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
430
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
431
/*                                                                           */
432
/*****************************************************************************/
433
434
#define MPYHIRC(x, y)                                                                              \
435
122k
    (((int)((short)(x >> 16) * (unsigned short)(y & 0x0000FFFF) + 0x4000) >> 15) +                 \
436
122k
     ((int)((short)(x >> 16) * (short)((y) >> 16)) << 1))
437
438
122k
#define MPYLUHS(x, y) ((int)((unsigned short)(x & 0x0000FFFF) * (short)(y >> 16)))
439
440
static PLATFORM_INLINE WORD32 mult32_shl_sat(WORD32 a, WORD32 b)
441
122k
{
442
122k
    WORD32 high;
443
444
122k
    high = (MPYHIRC(a, b) + (MPYLUHS(a, b) >> 15));
445
446
122k
    return high;
447
122k
}
Unexecuted instantiation: var_q_operator.c:mult32_shl_sat
sqrt_interp.c:mult32_shl_sat
Line
Count
Source
441
122k
{
442
122k
    WORD32 high;
443
444
122k
    high = (MPYHIRC(a, b) + (MPYLUHS(a, b) >> 15));
445
446
122k
    return high;
447
122k
}
448
449
/*****************************************************************************/
450
/*                                                                           */
451
/*  function name : mac32x16in32                                             */
452
/*                                                                           */
453
/*  description   : multiply WORD32 with WORD16 add bits 47 to 16 to acc     */
454
/*                                                                           */
455
/*  inputs        : WORD32 a, WORD32 b, WORD16 c                             */
456
/*                                                                           */
457
/*  outputs       : none                                                     */
458
/*                                                                           */
459
/*  globals       : none                                                     */
460
/*                                                                           */
461
/*  processing    : multiply, right shift by 16 & add to acc                 */
462
/*                                                                           */
463
/*  returns       : WORD32 accumulated result                                */
464
/*                                                                           */
465
/*  issues        : none                                                     */
466
/*                                                                           */
467
/*  revision history :                                                       */
468
/*                                                                           */
469
/*        DD MM YYYY       author                changes                     */
470
/*        06 12 2002       ashok M/chetan K      created                     */
471
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
472
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
473
/*                                                                           */
474
/*****************************************************************************/
475
476
static PLATFORM_INLINE WORD32 mac32x16in32(WORD32 a, WORD32 b, WORD16 c)
477
0
{
478
0
    WORD32 result;
479
0
480
0
    result = a + mult32x16in32(b, c);
481
0
482
0
    return (result);
483
0
}
Unexecuted instantiation: var_q_operator.c:mac32x16in32
Unexecuted instantiation: sqrt_interp.c:mac32x16in32
484
485
/*****************************************************************************/
486
/*                                                                           */
487
/*  function name : mac32x16in32_shl                                         */
488
/*                                                                           */
489
/*  description   : multiply WORD32 with WORD16 add bits 46 to 15 to acc     */
490
/*                  doesnt take care of saturation                           */
491
/*                                                                           */
492
/*  inputs        : WORD32 a, WORD32 b, WORD16 c                             */
493
/*                                                                           */
494
/*  outputs       : none                                                     */
495
/*                                                                           */
496
/*  globals       : none                                                     */
497
/*                                                                           */
498
/*  processing    : multiply, right shift by 15 & add to acc                 */
499
/*                                                                           */
500
/*  returns       : WORD32 accumulated result                                */
501
/*                                                                           */
502
/*  issues        : none                                                     */
503
/*                                                                           */
504
/*  revision history :                                                       */
505
/*                                                                           */
506
/*        DD MM YYYY       author                changes                     */
507
/*        06 12 2002       ashok M/chetan K      created                     */
508
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
509
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
510
/*                                                                           */
511
/*****************************************************************************/
512
513
static PLATFORM_INLINE WORD32 mac32x16in32_shl(WORD32 a, WORD32 b, WORD16 c)
514
0
{
515
0
    WORD32 result;
516
0
517
0
    result = a + mult32x16in32_shl(b, c);
518
0
519
0
    return (result);
520
0
}
Unexecuted instantiation: var_q_operator.c:mac32x16in32_shl
Unexecuted instantiation: sqrt_interp.c:mac32x16in32_shl
521
522
/*****************************************************************************/
523
/*                                                                           */
524
/*  function name : mac32x16in32_shl_sat                                     */
525
/*                                                                           */
526
/*  description   : multiply WORD32 with WORD16 add bits 46 to 15 to acc     */
527
/*                  takes care of saturation in multiply and addition        */
528
/*                                                                           */
529
/*  inputs        : WORD32 a, WORD32 b, WORD16 c                             */
530
/*                                                                           */
531
/*  outputs       : none                                                     */
532
/*                                                                           */
533
/*  globals       : none                                                     */
534
/*                                                                           */
535
/*  processing    : if input mi_ns add MAX32 else multiply,                  */
536
/*                  right shift by 15 & add to acc with saturation           */
537
/*                                                                           */
538
/*  returns       : WORD32 accumulated result                                */
539
/*                                                                           */
540
/*  issues        : none                                                     */
541
/*                                                                           */
542
/*  revision history :                                                       */
543
/*                                                                           */
544
/*        DD MM YYYY       author                changes                     */
545
/*        06 12 2002       ashok M/chetan K      created                     */
546
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
547
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
548
/*                                                                           */
549
/*****************************************************************************/
550
551
static PLATFORM_INLINE WORD32 mac32x16in32_shl_sat(WORD32 a, WORD32 b, WORD16 c)
552
0
{
553
0
    return (add32_sat(a, mult32x16in32_shl_sat(b, c)));
554
0
}
Unexecuted instantiation: var_q_operator.c:mac32x16in32_shl_sat
Unexecuted instantiation: sqrt_interp.c:mac32x16in32_shl_sat
555
556
/*****************************************************************************/
557
/*                                                                           */
558
/*  function name : mac32                                                    */
559
/*                                                                           */
560
/*  description   : multiply WORD32 with WORD32 add bits 63 to 32 to acc     */
561
/*                                                                           */
562
/*  inputs        : WORD32 a, WORD32 b, WORD32 c                             */
563
/*                                                                           */
564
/*  outputs       : none                                                     */
565
/*                                                                           */
566
/*  globals       : none                                                     */
567
/*                                                                           */
568
/*  processing    : multiply, right shift by 32 & add to acc                 */
569
/*                                                                           */
570
/*  returns       : WORD32 accumulated result                                */
571
/*                                                                           */
572
/*  issues        : none                                                     */
573
/*                                                                           */
574
/*  revision history :                                                       */
575
/*                                                                           */
576
/*        DD MM YYYY       author                changes                     */
577
/*        06 12 2002       ashok M/chetan K      created                     */
578
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
579
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
580
/*                                                                           */
581
/*****************************************************************************/
582
583
static PLATFORM_INLINE WORD32 mac32(WORD32 a, WORD32 b, WORD32 c)
584
0
{
585
0
    WORD32 result;
586
0
587
0
    result = a + mult32(b, c);
588
0
589
0
    return (result);
590
0
}
Unexecuted instantiation: var_q_operator.c:mac32
Unexecuted instantiation: sqrt_interp.c:mac32
591
592
/*****************************************************************************/
593
/*                                                                           */
594
/*  function name : mac32_shl                                                 */
595
/*                                                                           */
596
/*  description   : multiply WORD32 with WORD32 add bits 62 to 31 to acc     */
597
/*                  doesnt take care of saturation                           */
598
/*                                                                           */
599
/*  inputs        : WORD32 a, WORD32 b, WORD32 c                             */
600
/*                                                                           */
601
/*  outputs       : none                                                     */
602
/*                                                                           */
603
/*  globals       : none                                                     */
604
/*                                                                           */
605
/*  processing    : multiply, right shift by 31 & add to acc                 */
606
/*                                                                           */
607
/*  returns       : WORD32 accumulated result                                */
608
/*                                                                           */
609
/*  issues        : none                                                     */
610
/*                                                                           */
611
/*  revision history :                                                       */
612
/*                                                                           */
613
/*        DD MM YYYY       author                changes                     */
614
/*        06 12 2002       ashok M/chetan K      created                     */
615
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
616
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
617
/*                                                                           */
618
/*****************************************************************************/
619
620
static PLATFORM_INLINE WORD32 mac32_shl(WORD32 a, WORD32 b, WORD32 c)
621
0
{
622
0
    WORD32 result;
623
0
624
0
    result = a + mult32_shl(b, c);
625
0
626
0
    return (result);
627
0
}
Unexecuted instantiation: var_q_operator.c:mac32_shl
Unexecuted instantiation: sqrt_interp.c:mac32_shl
628
629
/*****************************************************************************/
630
/*                                                                           */
631
/*  function name : mac32_shl_sat                                              */
632
/*                                                                           */
633
/*  description   : multiply WORD32 with WORD32 add bits 62 to 31 to acc     */
634
/*                  takes care of saturation in multiply and addition        */
635
/*                                                                           */
636
/*  inputs        : WORD32 a, WORD32 b, WORD32 c                             */
637
/*                                                                           */
638
/*  outputs       : none                                                     */
639
/*                                                                           */
640
/*  globals       : none                                                     */
641
/*                                                                           */
642
/*  processing    : if input mi_ns add MAX32 else multiply,                   */
643
/*                  right shift by 31 & add to acc with saturation           */
644
/*                                                                           */
645
/*  returns       : WORD32 accumulated result                                */
646
/*                                                                           */
647
/*  issues        : none                                                     */
648
/*                                                                           */
649
/*  revision history :                                                       */
650
/*                                                                           */
651
/*        DD MM YYYY       author                changes                     */
652
/*        06 12 2002       ashok M/chetan K      created                     */
653
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
654
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
655
/*                                                                           */
656
/*****************************************************************************/
657
658
static PLATFORM_INLINE WORD32 mac32_shl_sat(WORD32 a, WORD32 b, WORD32 c)
659
0
{
660
0
    return (add32_sat(a, mult32_shl_sat(b, c)));
661
0
}
Unexecuted instantiation: var_q_operator.c:mac32_shl_sat
Unexecuted instantiation: sqrt_interp.c:mac32_shl_sat
662
663
/*****************************************************************************/
664
/*                                                                           */
665
/*  function name : msu32x16in32                                             */
666
/*                                                                           */
667
/*  description   : multiply WORD32 with WORD16 sub bits 47 to 16 from acc   */
668
/*                                                                           */
669
/*  inputs        : WORD32 a, WORD32 b, WORD16 c                             */
670
/*                                                                           */
671
/*  outputs       : none                                                     */
672
/*                                                                           */
673
/*  globals       : none                                                     */
674
/*                                                                           */
675
/*  processing    : multiply, right shift by 16 & sub from acc               */
676
/*                                                                           */
677
/*  returns       : WORD32 accumulated result                                */
678
/*                                                                           */
679
/*  issues        : none                                                     */
680
/*                                                                           */
681
/*  revision history :                                                       */
682
/*                                                                           */
683
/*        DD MM YYYY       author                changes                     */
684
/*        06 12 2002       ashok M/chetan K      created                     */
685
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
686
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
687
/*                                                                           */
688
/*****************************************************************************/
689
690
static PLATFORM_INLINE WORD32 msu32x16in32(WORD32 a, WORD32 b, WORD16 c)
691
0
{
692
0
    WORD32 result;
693
0
694
0
    result = a - mult32x16in32(b, c);
695
0
696
0
    return (result);
697
0
}
Unexecuted instantiation: var_q_operator.c:msu32x16in32
Unexecuted instantiation: sqrt_interp.c:msu32x16in32
698
699
/*****************************************************************************/
700
/*                                                                           */
701
/*  function name : msu32x16in32_shl                                          */
702
/*                                                                           */
703
/*  description   : multiply WORD32 with WORD16 sub bits 46 to 15 from acc   */
704
/*                  doesnt take care of saturation                           */
705
/*                                                                           */
706
/*  inputs        : WORD32 a, WORD32 b, WORD16 c                             */
707
/*                                                                           */
708
/*  outputs       : none                                                     */
709
/*                                                                           */
710
/*  globals       : none                                                     */
711
/*                                                                           */
712
/*  processing    : multiply, right shift by 15 & sub from acc               */
713
/*                                                                           */
714
/*  returns       : WORD32 accumulated result                                */
715
/*                                                                           */
716
/*  issues        : none                                                     */
717
/*                                                                           */
718
/*  revision history :                                                       */
719
/*                                                                           */
720
/*        DD MM YYYY       author                changes                     */
721
/*        06 12 2002       ashok M/chetan K      created                     */
722
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
723
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
724
/*                                                                           */
725
/*****************************************************************************/
726
727
static PLATFORM_INLINE WORD32 msu32x16in32_shl(WORD32 a, WORD32 b, WORD16 c)
728
0
{
729
0
    WORD32 result;
730
0
731
0
    result = a - mult32x16in32_shl(b, c);
732
0
733
0
    return (result);
734
0
}
Unexecuted instantiation: var_q_operator.c:msu32x16in32_shl
Unexecuted instantiation: sqrt_interp.c:msu32x16in32_shl
735
736
/*****************************************************************************/
737
/*                                                                           */
738
/*  function name : msu32x16in32_shl_sat                                     */
739
/*                                                                           */
740
/*  description   : multiply WORD32 with WORD16 sub bits 46 to 15 from acc   */
741
/*                  takes care of saturation in multiply and addition        */
742
/*                                                                           */
743
/*  inputs        : WORD32 a, WORD32 b, WORD16 c                             */
744
/*                                                                           */
745
/*  outputs       : none                                                     */
746
/*                                                                           */
747
/*  globals       : none                                                     */
748
/*                                                                           */
749
/*  processing    : if input mi_ns sub MAX32 else multiply,                  */
750
/*                  right shift by 15 & sub from acc with saturation         */
751
/*                                                                           */
752
/*  returns       : WORD32 accumulated result                                */
753
/*                                                                           */
754
/*  issues        : none                                                     */
755
/*                                                                           */
756
/*  revision history :                                                       */
757
/*                                                                           */
758
/*        DD MM YYYY       author                changes                     */
759
/*        06 12 2002       ashok M/chetan K      created                     */
760
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
761
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
762
/*                                                                           */
763
/*****************************************************************************/
764
765
static PLATFORM_INLINE WORD32 msu32x16in32_shl_sat(WORD32 a, WORD32 b, WORD16 c)
766
0
{
767
0
    return (sub32_sat(a, mult32x16in32_shl_sat(b, c)));
768
0
}
Unexecuted instantiation: var_q_operator.c:msu32x16in32_shl_sat
Unexecuted instantiation: sqrt_interp.c:msu32x16in32_shl_sat
769
770
/*****************************************************************************/
771
/*                                                                           */
772
/*  function name : msu32                                                    */
773
/*                                                                           */
774
/*  description   : multiply WORD32 with WORD32 sub bits 63 to 32 from acc   */
775
/*                                                                           */
776
/*  inputs        : WORD32 a, WORD32 b, WORD32 c                             */
777
/*                                                                           */
778
/*  outputs       : none                                                     */
779
/*                                                                           */
780
/*  globals       : none                                                     */
781
/*                                                                           */
782
/*  processing    : multiply, right shift by 32 & sub from acc               */
783
/*                                                                           */
784
/*  returns       : WORD32 accumulated result                                */
785
/*                                                                           */
786
/*  issues        : none                                                     */
787
/*                                                                           */
788
/*  revision history :                                                       */
789
/*                                                                           */
790
/*        DD MM YYYY       author                changes                     */
791
/*        06 12 2002       ashok M/chetan K      created                     */
792
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
793
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
794
/*                                                                           */
795
/*****************************************************************************/
796
797
static PLATFORM_INLINE WORD32 msu32(WORD32 a, WORD32 b, WORD32 c)
798
0
{
799
0
    WORD32 result;
800
0
801
0
    result = a - mult32(b, c);
802
0
803
0
    return (result);
804
0
}
Unexecuted instantiation: var_q_operator.c:msu32
Unexecuted instantiation: sqrt_interp.c:msu32
805
806
/*****************************************************************************/
807
/*                                                                           */
808
/*  function name : msu32_shl                                                */
809
/*                                                                           */
810
/*  description   : multiply WORD32 with WORD32 sub bits 62 to 31 from acc   */
811
/*                  doesnt take care of saturation                           */
812
/*                                                                           */
813
/*  inputs        : WORD32 a, WORD32 b, WORD32 c                             */
814
/*                                                                           */
815
/*  outputs       : none                                                     */
816
/*                                                                           */
817
/*  globals       : none                                                     */
818
/*                                                                           */
819
/*  processing    : multiply, right shift by 31 & sub from acc               */
820
/*                                                                           */
821
/*  returns       : WORD32 accumulated result                                */
822
/*                                                                           */
823
/*  issues        : none                                                     */
824
/*                                                                           */
825
/*  revision history :                                                       */
826
/*                                                                           */
827
/*        DD MM YYYY       author                changes                     */
828
/*        06 12 2002       ashok M/chetan K      created                     */
829
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
830
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
831
/*                                                                           */
832
/*****************************************************************************/
833
834
static PLATFORM_INLINE WORD32 msu32_shl(WORD32 a, WORD32 b, WORD32 c)
835
0
{
836
0
    WORD32 result;
837
0
838
0
    result = a - mult32_shl(b, c);
839
0
840
0
    return (result);
841
0
}
Unexecuted instantiation: var_q_operator.c:msu32_shl
Unexecuted instantiation: sqrt_interp.c:msu32_shl
842
843
/*****************************************************************************/
844
/*                                                                           */
845
/*  function name : msu32_shl_sat                                            */
846
/*                                                                           */
847
/*  description   : multiply WORD32 with WORD32 sub bits 62 to 31 from acc   */
848
/*                  takes care of saturation in multiply and addition        */
849
/*                                                                           */
850
/*  inputs        : WORD32 a, WORD32 b, WORD32 c                             */
851
/*                                                                           */
852
/*  outputs       : none                                                     */
853
/*                                                                           */
854
/*  globals       : none                                                     */
855
/*                                                                           */
856
/*  processing    : if input mi_ns sub MAX32 else multiply,                  */
857
/*                  right shift by 31 & sub from acc with saturation         */
858
/*                                                                           */
859
/*  returns       : WORD32 accumulated result                                */
860
/*                                                                           */
861
/*  issues        : none                                                     */
862
/*                                                                           */
863
/*  revision history :                                                       */
864
/*                                                                           */
865
/*        DD MM YYYY       author                changes                     */
866
/*        06 12 2002       ashok M/chetan K      created                     */
867
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
868
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
869
/*                                                                           */
870
/*****************************************************************************/
871
872
static PLATFORM_INLINE WORD32 msu32_shl_sat(WORD32 a, WORD32 b, WORD32 c)
873
0
{
874
0
    return (sub32_sat(a, mult32_shl_sat(b, c)));
875
0
}
Unexecuted instantiation: var_q_operator.c:msu32_shl_sat
Unexecuted instantiation: sqrt_interp.c:msu32_shl_sat
876
877
/*****************************************************************************/
878
/*                                                                           */
879
/*  function name : mac3216_arr40                                            */
880
/*                                                                           */
881
/*  description   : returns normalized 32 bit accumulated result and         */
882
/*                  denormalizing info                                       */
883
/*                                                                           */
884
/*  inputs        : WORD32 x[], WORD16 y[], LOOPINDEX length                 */
885
/*                                                                           */
886
/*  outputs       : WORD16 *q_val                                            */
887
/*                                                                           */
888
/*  globals       : none                                                     */
889
/*                                                                           */
890
/*  processing    : multiply and accumalate in WORD40 finally normalize      */
891
/*                                                                           */
892
/*  returns       : WORD32 accumulated result                                */
893
/*                                                                           */
894
/*  assumptions   : length < 256 for strict definition of WORD40             */
895
/*                                                                           */
896
/*  issues        : none                                                     */
897
/*                                                                           */
898
/*  revision history :                                                       */
899
/*                                                                           */
900
/*        DD MM YYYY       author                changes                     */
901
/*        06 12 2002       ashok M/chetan K      created                     */
902
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
903
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
904
/*                                                                           */
905
/*****************************************************************************/
906
907
static PLATFORM_INLINE WORD32 mac3216_arr40(WORD32 *x, WORD16 *y, LOOPINDEX length, WORD16 *q_val)
908
0
{
909
0
    LOOPINDEX i;
910
0
    WORD40 sum = 0;
911
0
912
0
    for(i = 0; i < length; i++)
913
0
    {
914
0
        sum += (WORD40)(mult32x16in32(x[i], y[i]));
915
0
    }
916
0
917
0
    *q_val = norm40(&sum);
918
0
919
0
    return (WORD32)sum;
920
0
}
Unexecuted instantiation: var_q_operator.c:mac3216_arr40
Unexecuted instantiation: sqrt_interp.c:mac3216_arr40
921
922
/*****************************************************************************/
923
/*                                                                           */
924
/*  function name : mac32_arr40                                              */
925
/*                                                                           */
926
/*  description   : returns normalized 32 bit accumulated result and         */
927
/*                  denormalizing info                                       */
928
/*                                                                           */
929
/*  inputs        : WORD32 x[], WORD32 y[], LOOPINDEX length                 */
930
/*                                                                           */
931
/*  outputs       : WORD16 *q_val                                            */
932
/*                                                                           */
933
/*  globals       : none                                                     */
934
/*                                                                           */
935
/*  processing    : multiply and accumalate in WORD40 finally normalize      */
936
/*                                                                           */
937
/*  returns       : WORD32 accumulated result                                */
938
/*                                                                           */
939
/*  assumptions   : length < 256 for strict definition of WORD40             */
940
/*                                                                           */
941
/*  issues        : none                                                     */
942
/*                                                                           */
943
/*  revision history :                                                       */
944
/*                                                                           */
945
/*        DD MM YYYY       author                changes                     */
946
/*        06 12 2002       ashok M/chetan K      created                     */
947
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
948
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
949
/*                                                                           */
950
/*****************************************************************************/
951
952
static PLATFORM_INLINE WORD32 mac32_arr40(WORD32 *x, WORD32 *y, LOOPINDEX length, WORD16 *q_val)
953
0
{
954
0
    LOOPINDEX i;
955
0
    WORD40 sum = 0;
956
0
957
0
    for(i = 0; i < length; i++)
958
0
    {
959
0
        sum += (WORD40)(mult32(x[i], y[i]));
960
0
    }
961
0
962
0
    *q_val = norm40(&sum);
963
0
964
0
    return ((WORD32)sum);
965
0
}
Unexecuted instantiation: var_q_operator.c:mac32_arr40
Unexecuted instantiation: sqrt_interp.c:mac32_arr40
966
967
/*****************************************************************************/
968
/*                                                                           */
969
/*  function name : mac16_arr40                                              */
970
/*                                                                           */
971
/*  description   : returns normalized 32 bit accumulated result and         */
972
/*                  denormalizing info                                       */
973
/*                                                                           */
974
/*  inputs        : WORD16 x[], WORD16 y[], LOOPINDEX length                 */
975
/*                                                                           */
976
/*  outputs       : WORD16 *q_val                                            */
977
/*                                                                           */
978
/*  globals       : none                                                     */
979
/*                                                                           */
980
/*  processing    : multiply and accumalate in WORD40 finally normalize      */
981
/*                                                                           */
982
/*  returns       : WORD32 accumulated result                                */
983
/*                                                                           */
984
/*  assumptions   : length < 256 for strict definition of WORD40             */
985
/*                                                                           */
986
/*  issues        : none                                                     */
987
/*                                                                           */
988
/*  revision history :                                                       */
989
/*                                                                           */
990
/*        DD MM YYYY       author                changes                     */
991
/*        06 12 2002       ashok M/chetan K      created                     */
992
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
993
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
994
/*                                                                           */
995
/*****************************************************************************/
996
997
static PLATFORM_INLINE WORD32 mac16_arr40(WORD16 *x, WORD16 *y, LOOPINDEX length, WORD16 *q_val)
998
0
{
999
0
    LOOPINDEX i;
1000
0
    WORD40 sum = 0;
1001
0
1002
0
    for(i = 0; i < length; i++)
1003
0
    {
1004
0
        sum += (WORD40)((WORD32)x[i] * (WORD32)y[i]);
1005
0
    }
1006
0
1007
0
    *q_val = norm40(&sum);
1008
0
1009
0
    return ((WORD32)sum);
1010
0
}
Unexecuted instantiation: var_q_operator.c:mac16_arr40
Unexecuted instantiation: sqrt_interp.c:mac16_arr40
1011
1012
/*****************************************************************************/
1013
/*                                                                           */
1014
/*  function name : add32_arr40                                              */
1015
/*                                                                           */
1016
/*  description   : returns normalized 32 bit accumulated result and         */
1017
/*                  denormalizing info                                       */
1018
/*                                                                           */
1019
/*  inputs        : WORD32 x[], LOOPINDEX length                             */
1020
/*                                                                           */
1021
/*  outputs       : WORD16 *q_val                                            */
1022
/*                                                                           */
1023
/*  globals       : none                                                     */
1024
/*                                                                           */
1025
/*  processing    : accumalate in WORD40 finally normalize                   */
1026
/*                                                                           */
1027
/*  returns       : WORD32 accumulated result                                */
1028
/*                                                                           */
1029
/*  assumptions   : length < 256 for strict definition of WORD40             */
1030
/*                                                                           */
1031
/*  issues        : none                                                     */
1032
/*                                                                           */
1033
/*  revision history :                                                       */
1034
/*                                                                           */
1035
/*        DD MM YYYY       author                changes                     */
1036
/*        06 12 2002       ashok M/chetan K      created                     */
1037
/*        21 11 2003       raghavendra K R       modified(bug fixes)         */
1038
/*        15 11 2004       tejaswi/vishal        modified(bug fixes/cleanup) */
1039
/*                                                                           */
1040
/*****************************************************************************/
1041
1042
static PLATFORM_INLINE WORD32 add32_arr40(WORD32 *in_arr, LOOPINDEX length, WORD16 *q_val)
1043
0
{
1044
0
    LOOPINDEX i;
1045
0
    WORD40 sum = 0;
1046
0
1047
0
    for(i = 0; i < length; i++)
1048
0
    {
1049
0
        sum += (WORD40)in_arr[i];
1050
0
    }
1051
0
1052
0
    *q_val = norm40(&sum);
1053
0
1054
0
    return ((WORD32)sum);
1055
0
}
Unexecuted instantiation: var_q_operator.c:add32_arr40
Unexecuted instantiation: sqrt_interp.c:add32_arr40
1056
1057
#endif /* __IA_BASIC_OPS40_H__ */