Forums

NB-AMR seek implementation

Started by Padmanabha V Reddy July 20, 2011
Hi,

I am finding that after seek the output of NB-AMR decoder is distorted.
I have observed this behavior with
1. codecs from Google (as part Android), as well as
2. in PC based decoder called AMRPlayer software(For this, I have actually dumped the input given to Google's decoder and fed it to AMRPlayer, thereby I'm simulating the seek but not doing the seek even though it has it).

The test vector I used is a 1kHz sine wave for ~45s encoded as NB-AMR.
The expected o/p of decoder is again a sine wave.
But the o/p is distorted after I seek from 3s to 25s of the file.
The waveform found below:
http://imgcandy.com/pm-Y74G.html

I'm making wild guess that this can be corrected by passing homing sequence right after the seek.

Please post your analysis.
On Tue, July 19, 2011 2:59 am, Padmanabha V Reddy wrote:
> Hi,
>
> I am finding that after seek the output of NB-AMR decoder is distorted.
> I have observed this behavior with
> 1. codecs from Google (as part Android), as well as
> 2. in PC based decoder called AMRPlayer software(For this, I have
> actually dumped the input given to Google's decoder and fed it to
> AMRPlayer, thereby I'm simulating the seek but not doing the seek even
> though it has it).

Hello,

The proper way to "seek" is to decode the entire stream up to the new
position.

However, if you are developing your own stream format and playback
software and want to make it seek-able, then add your own 'reference'
frames every second or so that can restore the decoding state at that
location.

--
Phil Frisbie, Jr.
Hawk Software
hawksoft.com
Hi Phil,

Yes, decoding without skipping works perfectly fine.
But, decoding the content till the new position could be costly.
Also, if I'm seeking backwards, how do you suggest the implementation.

I don't think AMR has the concept of reference frames. Are you referring to
the decoder homing sequence.
Adding reference frames, if at all defined by standard, is not feasible
since I'm just the codec implementer but the content to play is chosen by
end user.

-Padmanabha

On Thu, Jul 21, 2011 at 5:53 AM, Phil Frisbie, Jr. wrote:

> On Tue, July 19, 2011 2:59 am, Padmanabha V Reddy wrote:
> > Hi,
> >
> > I am finding that after seek the output of NB-AMR decoder is distorted.
> > I have observed this behavior with
> > 1. codecs from Google (as part Android), as well as
> > 2. in PC based decoder called AMRPlayer software(For this, I have
> > actually dumped the input given to Google's decoder and fed it to
> > AMRPlayer, thereby I'm simulating the seek but not doing the seek even
> > though it has it).
>
> Hello,
>
> The proper way to "seek" is to decode the entire stream up to the new
> position.
>
> However, if you are developing your own stream format and playback
> software and want to make it seek-able, then add your own 'reference'
> frames every second or so that can restore the decoding state at that
> location.
>
> --
> Phil Frisbie, Jr.
> Hawk Software
> hawksoft.com
Hi Padmanabha,

You cannot do what you want using standard codecs. To understand,
research how audio decoding works with video streams. The only reason you
can seek forwards or backwards with video is because the encoder, decoder,
and stream protocol are designed that way, and normal speech codec streams
are designed to be sequential.

And no, the AMR homing sequence is used to reset the codec to a known
state in case of previous transmission errors.

Bottom line: This cannot be solved properly at just the decoder level; you
must have help from the encoder and stream protocol.

On Thu, July 21, 2011 9:14 am, Padmanabha V wrote:
> Hi Phil,
>
> Yes, decoding without skipping works perfectly fine.
> But, decoding the content till the new position could be costly.
> Also, if I'm seeking backwards, how do you suggest the implementation.
>
> I don't think AMR has the concept of reference frames. Are you referring
> to
> the decoder homing sequence.
> Adding reference frames, if at all defined by standard, is not feasible
> since I'm just the codec implementer but the content to play is chosen by
> end user.
>
> -Padmanabha

--
Phil Frisbie, Jr.
Hawk Software
hawksoft.com