Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#1072 closed enhancement (fixed)

Audio clipping on G.722 regarding 14-bit PCM for codec input/output

Reported by: nanang Owned by: nanang
Priority: normal Milestone: release-1.7
Component: pjmedia Version: trunk
Keywords: sipit26 Cc:
Backport to 1.x milestone: Backported:

Description

Some G.722 implementations use 16-bit PCM, some others use 14-bit PCM. Currently, our implementation uses 14 bit PCM, which will cause clipping when talking to 16-bit PCM implementation.

Manual setting for enabling/disabling the shifting should be simpler (as in G.722.1).

However automatic detection can be possible and perhaps preferred, e.g:

  • by default we use 14-bit, so decoder will shift left 2 bits,
  • if the shifting causes clipping, stop the shifting in decoder and encoder.

Change History (2)

comment:1 Changed 14 years ago by nanang

  • Resolution set to fixed
  • Status changed from new to closed

(In [3202]) Close #1072:

  • Added API pjmedia_codec_g722_set_pcm_shift() to enable configurable level-adjusment setting.
  • Also added macro PJMEDIA_G722_DEFAULT_PCM_SHIFT (default value is 2) to accomplish 14-16 bit PCM conversion for G722 input/output.
  • Added a feature in G722 to stop level-adjusment/PCM-shifting when clipping occured, compile-time configurable via PJMEDIA_G722_STOP_PCM_SHIFT_ON_CLIPPING macro.

comment:2 Changed 14 years ago by nanang

(In [3250]) Re #1072: fixed buffer overflow bugs introduced by r3202.

Note: See TracTickets for help on using tickets.