Opened 2 weeks ago

Closed 2 weeks ago

#2228 closed defect (fixed)

Bug in PCM shift in G722

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

Description

There are some issues:

  • Clipping detector (to stop shifting). The clip detector in the G722 decoder kicked in immediately when the decoding started, and that it seemed to be due to negative signal levels being fed into the clip detector. The current implementation of the G722 decoder returns values in the range [-16384, 16383]. The way the current clip detector is constructed it will always detect clipping on negative values because of the bit representation of negative values, i.e: MSB is always 1 in two's complement.
  • Simple shifting in encoding and decoding, due to bit representation of negative values, simple right/left bits shift may result in unexpected value, e.g: left shifting a positive value may get a negative value, right shifting a negative value will result in a positive value.

This ticket will fix the bugs in clipping detector and in encoding/decoding. Also update clipping detector so the shifting will be reduced step by step after a potential clipping is detected, instead of stopped immediately as in current implementation.

Thanks to Martin Navne for the report and the patch.

Change History (3)

comment:1 Changed 2 weeks ago by nanang

In 6064:

Re #2228: Fixed bugs in PCM shifting in G722 codec.

comment:2 Changed 2 weeks ago by nanang

In 6065:

Re #2228: Also updated PCM shifting in G722.1.

comment:3 Changed 2 weeks ago by nanang

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.