Skip to content

Commit

Permalink
Added a saturation overflow checks on PCM data (#44)
Browse files Browse the repository at this point in the history
* Added saturation overflow check on PCM data

[x] Tested for conformance.

---------

Co-authored-by: Saketh Sathuvalli <100603@ittiam.com>
  • Loading branch information
SakethSathuvalli and Saketh Sathuvalli committed Feb 1, 2023
1 parent 0b8499a commit 3b23f65
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions decoder/ia_core_coder_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
#define MAX_16 (WORD16)0x7fff
#define MIN_16 (WORD16)0x8000

#define MAX_24 (WORD32)0x007fffffL
#define MIN_24 (WORD32)0xFF800000L

#define NULLPTR ((VOID *)0)

#define IT_NULL ((VOID *)0)
Expand Down
2 changes: 2 additions & 0 deletions decoder/ia_core_coder_decode_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,8 @@ IA_ERRORCODE ia_core_coder_dec_ext_ele_proc(VOID *temp_handle, WORD32 *num_chann
{
pcm_sample =
(WORD32)(pstr_dec_data->str_usac_data.time_sample_vector[channel][s] * 256.0f);
pcm_sample = ia_max_int(ia_min_int(pcm_sample, MAX_24), MIN_24);

*ptr_ext_ren_pcm++ = (WORD32)pcm_sample & 0xff;
*ptr_ext_ren_pcm++ = ((WORD32)pcm_sample >> 8) & 0xff;
*ptr_ext_ren_pcm++ = ((WORD32)pcm_sample >> 16) & 0xff;
Expand Down

0 comments on commit 3b23f65

Please sign in to comment.