List Info

Thread: CR: Duration based Audio Error Concealment




CR: Duration based Audio Error Concealment
user name
2008-03-26 12:09:39

        "Nokia submits this code under the terms of a commercial contribution agreement with RealNetworks, and I am authorized to contribute this code under said agreement."

         
        Modified by:  ext-anuj.dhamijanokia.com
         
        Reviewed by:
         
        Date: 03/24/2008
         
        Project: SymbianMmf_rel
         
        Synopsis: Change the Audio Error Concealment logic to be based on Duration instead of Number of Packets

        Overview:
        Current Audio Error Concealment involves replicating prior (faded) audio packets for a predefined number of packets in case of packet drop. Modify this to replicate packets for a predefined duration rather than number of packets. This predefined duration is defined as a parameter in configuration file. Its default value is set to 20 milliseconds.

        Fix:
        Introduce new class members in HXSymbianSwAudioDecoder for Configured Error Concealment Duration and Consecutive Loss Duration (Counter). Read in the Configured value for Error Concealment from configuration file when Decoder is opened. Every time packet drop occurs increment Consecutive loss duration by the duration of the frame and introduce the faded copy of last audio frame played. If Consecutive Loss Duration exceeds the configured Error Concealment duration then insert silence.

        Reset the Consecutive Loss Duration to zero in Decode method which is invoked when packets are received without any error.

        New Field Added to configuration file: AudioErrorConcDuration

        Files modified & changes:

        srcdatatypemp4audiomdfpubplatformsymbiansymbianswdecoder.h
        srcdatatypemp4audiomdfplatformsymbiansymbianswdecoder.cpp

        srcclientappssymbiancommonconfigR1_Mobile_4_0_Factory.cfg

        Image Size and Heap Use impact: None

        Module Release testing (STIF, Audio) : Passed

        Test case(s) Added ; : No

        Memory leak check performed : Passed, No leaks found
         
        Platforms and Profiles Build Verified: helix-client-s60-32-mmf-mdf-arm

        Platforms and Profiles Functionality verified: armv5
         
        Branch: Head, 210CayS & 221CayS


        Index: symbianswdecoder.h
        ===================================================================
        RCS file: /cvsroot/datatype/mp4/audio/mdf/pub/platform/symbian/symbianswdecoder.h,v
        retrieving revision 1.1.2.1
        diff -u -w -r1.1.2.1 symbianswdecoder.h
        --- symbianswdecoder.h  3 Oct 2007 22:43:30 -0000 ;      1.1.2.1
        +++ symbianswdecoder.h  24 Mar 2008 20:13:42 -0000
        -73,7 +73,8
             CMMFDataBuffer*   ;          m_pSourceBuffer;
             CMMFDataBuffer*   ;          m_pDestBuffer;
             HXBOOL          ;           ; m_bPrevBuffValid;
        -    UINT32          ;           ; m_ulConsecutiveLossCount;
        +    UINT32          ;           ; m_ulConsecutiveLossDuration;
        +    UINT32          ;           ; m_ulErrorConcDuration;
         };

         #endif // __SYMBIAN_SW_DECODER_H__

        Index: symbianswdecoder.cpp
        ===================================================================
        RCS file: /cvsroot/datatype/mp4/audio/mdf/platform/symbian/symbianswdecoder.cpp,v
        retrieving revision 1.2.2.3
        diff -u -w -r1.2.2.3 symbianswdecoder.cpp
        --- symbianswdecoder.cpp    ;    3 Oct 2007 22:42:23 -0000 ;      1.2.2.3
        +++ symbianswdecoder.cpp    ;    24 Mar 2008 20:12:33 -0000
        -46,16 +46,15
         #include "symbianaudiodecoder.h";
         #include "symbianswdecoder.h"

        -// Came up with this value after considering the quality of audio
        -// Increasing the value of REPEAT_MAX_LIMIT creates noise
        -#define REPEAT_MAX_LIMIT ;    10
        +#include "hxprefutil.h"

         HXSymbianSwAudioDecoder::HXSymbianSwAudioDecoder():
                m_pSoftwareCodec(NULL), // set by OpenDecoder()
                m_pSourceBuffer(NULL),  // set by OpenDecoder()
                m_pDestBuffer(NULL),    // set by OpenDecoder()
                m_bPrevBuffValid(FALSE),
        -       m_ulConsecutiveLossCount(0)
        +       m_ulConsecutiveLossDuration(0),
        +       m_ulErrorConcDuration(0)
         {
         }

        -141,8 +140,14
             {
                // perform codec specific configuration
                result = m_pAudConfig->ConfigureDecoder(m_pSoftwareCodec);
        +       if(m_pContext)
        +       {
        +         ;       if(HXR_OK!=ReadPrefUINT32(m_pContext, "AudioErrorConcDuration", m_ulErrorConcDuration))
        +         ;       {
        +         ;           ;    m_ulErrorConcDuration = 20;
        +         ;       }
        +       }
             }
        -
             return result;
         }

        -251,7 +256,7
                   ;     nBytesConsumed = (UINT32) result.iSrcBytesProcessed;
                   ;     nSamplesOut = ConvertBytesToSamples(result.iDstBytesAdded);
                   ;     m_bPrevBuffValid = TRUE;
        -         ;      m_ulConsecutiveLossCount = 0;
        +         ;      m_ulConsecutiveLossDuration = 0;
                   ; }
                }
             }
        -265,8 +270,11
         // causes to consume memory and performance
         void HXSymbianSwAudioDecoder::RepeatAndFadeRepair(INT16 *samplesOut, UINT32 nSamplesOut)
         {
        -    // Fade, if we have lost multiple consecutive frames upto REPEAT_MAX_LIMIT
        - &nbsp;  if ( m_bPrevBuffValid && 0 < m_ulConsecutiveLossCount && m_ulConsecutiveLossCount < REPEAT_MAX_LIMIT )
        + &nbsp;  // Fade, if we have lost multiple consecutive frames upto configiured Error Conc duration
        + &nbsp;  if ( m_bPrevBuffValid &&
        + &nbsp; &nbsp; &nbsp;  ( 0 < m_ulConsecutiveLossDuration ) &&
        + &nbsp; &nbsp; &nbsp;  (m_ulConsecutiveLossDuration < m_ulErrorConcDuration)
        + &nbsp; &nbsp; &nbsp; )
         &nbsp; &nbsp; {
         &nbsp; &nbsp; &nbsp; &nbsp; double samples_per_frame = (double)m_pAudConfig->SamplesPerFrame();
         &nbsp; &nbsp; &nbsp; &nbsp; double fade_duration_in_frames = (double)m_pAudConfig->MillisPerFrame();
        -283,12 +291,12
         &nbsp; &nbsp; &nbsp; &nbsp;   ;  scale_factor -= fade_per_sample;
         &nbsp; &nbsp; &nbsp; &nbsp; }
         &nbsp; &nbsp; }
        - &nbsp;  // Loss after REPEAT_MAX_LIMIT insert silence
        - &nbsp;  else if ( !m_bPrevBuffValid || m_ulConsecutiveLossCount >= REPEAT_MAX_LIMIT )
        + &nbsp;  // Loss after Error Conc duration insert silence
        + &nbsp;  else if ( !m_bPrevBuffValid || m_ulConsecutiveLossDuration >= m_ulErrorConcDuration)
         &nbsp; &nbsp; {
         &nbsp; &nbsp; &nbsp; &nbsp; memset(samplesOut, 0, nSamplesOut * sizeof(INT16));
         &nbsp; &nbsp; }

        - &nbsp;  m_ulConsecutiveLossCount++;
        + &nbsp;  m_ulConsecutiveLossDuration += m_pAudConfig->MillisPerFrame();
         }
         

        Index: R1_Mobile_4_0_Factory.cfg
        ===================================================================
        RCS file: /cvsroot/clientapps/symbiancommon/config/R1_Mobile_4_0_Factory.cfg,v
        retrieving revision 1.26.2.22.2.1
        diff -u -w -r1.26.2.22.2.1 R1_Mobile_4_0_Factory.cfg
        --- R1_Mobile_4_0_Factory.cfg &nbsp; 26 Feb 2008 21:53:58 -0000 ; &nbsp; &nbsp; 1.26.2.22.2.1
        +++ R1_Mobile_4_0_Factory.cfg &nbsp; 24 Mar 2008 20:16:03 -0000
        -118,3 +118,7
         LANMaximumBandwidth=3000000
         LANSustainBandwidth=2100000

        +#Audio Error Concealment Duration (milliseconds)
        +#In case of packet drop interpolate Audio Packets for this duration
        +#defaults to 20 milliseconds
        +AudioErrorConcDuration=20


        ------------
        thnx & regds
        AD &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp; 



RE: CR: Duration based Audio Error Concealment
country flaguser name
United States
2008-03-26 13:08:27
Looks good.

=============================================
Eric Hyche (ehychereal.com)
Technical Lead
RealNetworks, Inc.  

> -----Original Message-----
> From: datatype-dev-bounceshelixcommunity.org 
> [mailto:datatype-dev-bounceshelixcommunity.org] On
Behalf Of 
> ext-anuj.dhamijanokia.com
> Sent: Wednesday, March 26, 2008 1:10 PM
> To: nokia-private-dev-bounceshelixcommunity.org; 
> datatype-devhelixcommunity.org
> Subject: [datatype-dev] CR: Duration based Audio Error
Concealment
> 
> 			"Nokia submits this code under the 
> terms of a commercial contribution agreement with 
> RealNetworks, and I am authorized to contribute this
code 
> under said agreement."
> 
> 			  
> 			Modified by:  ext-anuj.dhamijanokia.com 
> 			  
> 			Reviewed by: 
> 			  
> 			Date: 03/24/2008 
> 			  
> 			Project: SymbianMmf_rel 
> 			  
> 			Synopsis: Change the Audio Error 
> Concealment logic to be based on Duration instead of
Number 
> of Packets 
> 
> 			Overview: 
> 			Current Audio Error Concealment 
> involves replicating prior (faded) audio packets for a

> predefined number of packets in case of packet drop.
Modify 
> this to replicate packets for a predefined duration
rather 
> than number of packets. This predefined duration is
defined 
> as a parameter in configuration file. Its default value
is 
> set to 20 milliseconds.
> 
> 			Fix: 
> 			Introduce new class members in 
> HXSymbianSwAudioDecoder for Configured Error
Concealment 
> Duration and Consecutive Loss Duration (Counter). Read
in the 
> Configured value for Error Concealment from
configuration 
> file when Decoder is opened. Every time packet drop
occurs 
> increment Consecutive loss duration by the duration of
the 
> frame and introduce the faded copy of last audio frame

> played. If Consecutive Loss Duration exceeds the
configured 
> Error Concealment duration then insert silence.
> 
> 			Reset the Consecutive Loss Duration to 
> zero in Decode method which is invoked when packets are

> received without any error.
> 
> 			New Field Added to configuration file: 
> AudioErrorConcDuration 
> 
> 			Files modified & changes: 
> 
> 			
>
srcdatatypemp4audiomdfpubplatformsymbiansymbianswdec
oder.h 
> 			
>
srcdatatypemp4audiomdfplatformsymbiansymbianswdecoder
.cpp 
> 
> 			
>
srcclientappssymbiancommonconfigR1_Mobile_4_0_Factory.cf
g 
> 
> 			Image Size and Heap Use impact: None 
> 
> 			Module Release testing (STIF, Audio) : Passed 
> 
> 			Test case(s) Added  : No 
> 
> 			Memory leak check performed : Passed, 
> No leaks found 
> 			  
> 			Platforms and Profiles Build Verified: 
> helix-client-s60-32-mmf-mdf-arm 
> 
> 			Platforms and Profiles Functionality 
> verified: armv5 
> 			  
> 			Branch: Head, 210CayS & 221CayS 
> 
> 
> 			Index: symbianswdecoder.h 
> 			
>
============================================================
======= 
> 			RCS file: 
>
/cvsroot/datatype/mp4/audio/mdf/pub/platform/symbian/symbian
sw
> decoder.h,v 
> 			retrieving revision 1.1.2.1 
> 			diff -u -w -r1.1.2.1 symbianswdecoder.h 
> 			--- symbianswdecoder.h  3 Oct 2007 
> 22:43:30 -0000       1.1.2.1 
> 			+++ symbianswdecoder.h  24 Mar 2008 
> 20:13:42 -0000 
> 			 -73,7 +73,8  
> 			     CMMFDataBuffer*             
> m_pSourceBuffer; 
> 			     CMMFDataBuffer*             m_pDestBuffer; 
> 			     HXBOOL                      
> m_bPrevBuffValid; 
> 			-    UINT32                      
> m_ulConsecutiveLossCount; 
> 			+    UINT32                      
> m_ulConsecutiveLossDuration; 
> 			+    UINT32                      
> m_ulErrorConcDuration; 
> 			 }; 
> 
> 			 #endif // __SYMBIAN_SW_DECODER_H__ 
> 
> 			Index: symbianswdecoder.cpp 
> 			
>
============================================================
======= 
> 			RCS file: 
>
/cvsroot/datatype/mp4/audio/mdf/platform/symbian/symbianswde
co
> der.cpp,v 
> 			retrieving revision 1.2.2.3 
> 			diff -u -w -r1.2.2.3 symbianswdecoder.cpp 
> 			--- symbianswdecoder.cpp        3 Oct 
> 2007 22:42:23 -0000       1.2.2.3 
> 			+++ symbianswdecoder.cpp        24 Mar 
> 2008 20:12:33 -0000 
> 			 -46,16 +46,15  
> 			 #include "symbianaudiodecoder.h" 
> 			 #include "symbianswdecoder.h" 
> 
> 			-// Came up with this value after 
> considering the quality of audio 
> 			-// Increasing the value of 
> REPEAT_MAX_LIMIT creates noise 
> 			-#define REPEAT_MAX_LIMIT     10 
> 			+#include "hxprefutil.h" 
> 
> 			 
> HXSymbianSwAudioDecoder::HXSymbianSwAudioDecoder(): 
> 			        m_pSoftwareCodec(NULL), // set 
> by OpenDecoder() 
> 			        m_pSourceBuffer(NULL),  // set 
> by OpenDecoder() 
> 			        m_pDestBuffer(NULL),    // set 
> by OpenDecoder() 
> 			        m_bPrevBuffValid(FALSE), 
> 			-       m_ulConsecutiveLossCount(0) 
> 			+       m_ulConsecutiveLossDuration(0), 
> 			+       m_ulErrorConcDuration(0) 
> 			 { 
> 			 } 
> 
> 			 -141,8 +140,14  
> 			     { 
> 			        // perform codec specific configuration 
> 			        result = 
> m_pAudConfig->ConfigureDecoder(m_pSoftwareCodec); 
> 			+       if(m_pContext) 
> 			+       { 
> 			+                
> if(HXR_OK!=ReadPrefUINT32(m_pContext, 
> "AudioErrorConcDuration",
m_ulErrorConcDuration)) 
> 			+                { 
> 			+                        
> m_ulErrorConcDuration = 20; 
> 			+                } 
> 			+       } 
> 			     } 
> 			- 
> 			     return result; 
> 			 } 
> 
> 			 -251,7 +256,7  
> 			                nBytesConsumed = 
> (UINT32) result.iSrcBytesProcessed; 
> 			                nSamplesOut = 
> ConvertBytesToSamples(result.iDstBytesAdded); 
> 			                m_bPrevBuffValid = TRUE; 
> 			-               m_ulConsecutiveLossCount = 0; 
> 			+               
> m_ulConsecutiveLossDuration = 0; 
> 			            } 
> 			        } 
> 			     } 
> 			 -265,8 +270,11  
> 			 // causes to consume memory and performance 
> 			 void 
> HXSymbianSwAudioDecoder::RepeatAndFadeRepair(INT16 
> *samplesOut, UINT32 nSamplesOut) 
> 			 { 
> 			-    // Fade, if we have lost multiple 
> consecutive frames upto REPEAT_MAX_LIMIT 
> 			-    if ( m_bPrevBuffValid && 0 < 
> m_ulConsecutiveLossCount &&
m_ulConsecutiveLossCount < 
> REPEAT_MAX_LIMIT ) 
> 			+    // Fade, if we have lost multiple 
> consecutive frames upto configiured Error Conc duration

> 			+    if ( m_bPrevBuffValid && 
> 			+        ( 0 < m_ulConsecutiveLossDuration )
&& 
> 			+        (m_ulConsecutiveLossDuration < 
> m_ulErrorConcDuration) 
> 			+       ) 
> 			     { 
> 			         double samples_per_frame = 
> (double)m_pAudConfig->SamplesPerFrame(); 
> 			         double fade_duration_in_frames 
> = (double)m_pAudConfig->MillisPerFrame(); 
> 			 -283,12 +291,12  
> 			             scale_factor -= fade_per_sample; 
> 			         } 
> 			     } 
> 			-    // Loss after REPEAT_MAX_LIMIT 
> insert silence 
> 			-    else if ( !m_bPrevBuffValid || 
> m_ulConsecutiveLossCount >= REPEAT_MAX_LIMIT ) 
> 			+    // Loss after Error Conc duration 
> insert silence 
> 			+    else if ( !m_bPrevBuffValid || 
> m_ulConsecutiveLossDuration >=
m_ulErrorConcDuration) 
> 			     { 
> 			         memset(samplesOut, 0, 
> nSamplesOut * sizeof(INT16)); 
> 			     } 
> 
> 			-    m_ulConsecutiveLossCount++; 
> 			+    m_ulConsecutiveLossDuration += 
> m_pAudConfig->MillisPerFrame(); 
> 			 } 
> 			  
> 
> 			Index: R1_Mobile_4_0_Factory.cfg 
> 			
>
============================================================
======= 
> 			RCS file: 
>
/cvsroot/clientapps/symbiancommon/config/R1_Mobile_4_0_Facto
ry.cfg,v 
> 			retrieving revision 1.26.2.22.2.1 
> 			diff -u -w -r1.26.2.22.2.1 
> R1_Mobile_4_0_Factory.cfg 
> 			--- R1_Mobile_4_0_Factory.cfg   26 Feb 
> 2008 21:53:58 -0000      1.26.2.22.2.1 
> 			+++ R1_Mobile_4_0_Factory.cfg   24 Mar 
> 2008 20:16:03 -0000 
> 			 -118,3 +118,7  
> 			 LANMaximumBandwidth=3000000 
> 			 LANSustainBandwidth=2100000 
> 
> 			+#Audio Error Concealment Duration 
> (milliseconds) 
> 			+#In case of packet drop interpolate 
> Audio Packets for this duration 
> 			+#defaults to 20 milliseconds 
> 			+AudioErrorConcDuration=20 
> 
> 
> 			------------ 
> 			thnx & regds 
> 			AD              
> 
> 
> 
> 


_______________________________________________
Datatype-dev mailing list
Datatype-devhelixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/da
tatype-dev

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )