123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331 |
- /**************************************************************************
- *
- * ITU-T SOFTWARE TOOLS' GENERAL PUBLIC LICENSE
- *
- * This "General Public License" is published in the Annex 1 of the
- * ITU-T Recommendation on "SOFTWARE TOOLS FOR HOMOGENITY OF RESULTS
- * IN THE STANDARDIZATION PROCESS OF SPEECH AND AUDIO CODERS",
- * approved in Geneva, 2000.
- *
- * TERMS AND CONDITIONS
- *
- * 1. This License Agreement applies to any module or other work
- * related to the ITU-T Software Tool Library, and developed by the
- * User's Group on Software Tools. The "Module", below, refers to any
- * such module or work, and a "work based on the Module" means either
- * the Module or any work containing the Module or a portion of it,
- * either verbatim or with modifications. Each licensee is addressed
- * as "you".
- *
- * 2. You may copy and distribute verbatim copies of the Module's
- * source code as you receive it, in any medium, provided that you:
- * - conspicuously and appropriately publish on each copy an appropriate
- * copyright notice and disclaimer of warranty;
- * - keep intact all the notices that refer to this General Public
- * License and to the absence of any warranty; and
- * - give any other recipients of the Module a copy of this General
- * Public License along with the Module.
- * You may charge a fee for the physical act of transferring a copy.
- *
- * 3. You may modify your copy or copies of the Module or any portion
- * of it, and copy and distribute such modifications under the terms
- * of Paragraph 1 above, provided that you also do the following:
- *
- * o cause the modified files to carry prominent notices stating
- * that you changed the files and the date of any change; and
- *
- * o cause the whole of any work that you distribute or publish,
- * that in whole or in part contains the Module or any part
- * thereof, either with or without modifications, to be licensed
- * at no charge to all third parties under the terms of this
- * General Public License (except that you may choose to grant
- * warranty protection to some or all third parties, at your
- * option).
- *
- * o If the modified module normally reads commands interactively
- * when run, you must cause it, when started running for such
- * interactive use in the simplest and most usual way, to print or
- * display an announcement including an appropriate copyright
- * notice and a notice that there is no warranty (or else, saying
- * that you provide a warranty) and that users may redistribute
- * the module under these conditions, and telling the user how to
- * view a copy of this General Public License.
- *
- * You may charge a fee for the physical act of transferring a copy,
- * and you may at your option offer warranty protection in exchange
- * for a fee.
- *
- * Mere aggregation of another independent work with the Module (or
- * its derivative) on a volume of a storage or distribution medium
- * does not bring the other work under the scope of these terms.
- *
- * 4. You may copy and distribute the Module (or a portion or
- * derivative of it, under Paragraph 2) in object code or executable
- * form under the terms of Paragraphs 1 and 2 above provided that you
- * also do one of the following:
- *
- * o accompany it with the complete corresponding machine-
- * readable source code, which must be distributed under the terms
- * of Paragraphs 1 and 2 above; or,
- *
- * o accompany it with a written offer, valid for at least three
- * years, to give any third party free (except for a nominal
- * charge for the cost of distribution) a complete machine-
- * readable copy of the corresponding source code, to be
- * distributed under the terms of Paragraphs 1 and 2 above; or,
- *
- * o accompany it with the information you received as to where
- * the corresponding source code may be obtained. (This
- * alternative is allowed only for noncommercial distribution and
- * only if you received the module in object code or executable
- * form alone.)
- *
- * Source code for a work means the preferred form of the work for
- * making modifications to it. For an executable file, complete
- * source code means all the source code for all modules it contains;
- * but, as a special exception, it need not include source code for
- * modules which are standard libraries that accompany the operating
- * system on which the executable file runs, or for standard header
- * files or definitions files that accompany that operating system.
- *
- * 5. You may not copy, modify, sublicense, distribute or transfer
- * the Module except as expressly provided under this General Public
- * License. Any attempt otherwise to copy, modify, sublicense,
- * distribute or transfer the Module is void, and will automatically
- * terminate your rights to use the Module under this License.
- * However, parties who have received copies, or rights to use copies,
- * from you under this General Public License will not have their
- * licenses terminated so long as such parties remain in full
- * compliance.
- *
- * 6. By copying, distributing or modifying the Module (or any work
- * based on the Module) you indicate your acceptance of this license
- * to do so, and all its terms and conditions.
- *
- * 7. Each time you redistribute the Module (or any work based on the
- * Module), the recipient automatically receives a license from the
- * original licensor to copy, distribute or modify the Module subject
- * to these terms and conditions. You may not impose any further
- * restrictions on the recipients' exercise of the rights granted
- * herein.
- *
- * 8. The ITU-T may publish revised and/or new versions of this
- * General Public License from time to time. Such new versions will
- * be similar in spirit to the present version, but may differ in
- * detail to address new problems or concerns.
- *
- * Each version is given a distinguishing version number. If the
- * Module specifies a version number of the license which applies to
- * it and "any later version", you have the option of following the
- * terms and conditions either of that version or of any later version
- * published by the ITU-T. If the Module does not specify a version
- * number of the license, you may choose any version ever published by
- * the ITU-T.
- *
- * 9. If you wish to incorporate parts of the Module into other free
- * modules whose distribution conditions are different, write to the
- * author to ask for permission. For software which is copyrighted by
- * the ITU-T, write to the ITU-T Secretariat; exceptions may be made
- * for this. This decision will be guided by the two goals of
- * preserving the free status of all derivatives of this free software
- * and of promoting the sharing and reuse of software generally.
- *
- *
- * NO WARRANTY
- *
- * 10. BECAUSE THE MODULE IS LICENSED FREE OF CHARGE, THERE IS NO
- * WARRANTY FOR THE MODULE, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
- * EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS
- * AND/OR OTHER PARTIES PROVIDE THE MODULE "AS IS" WITHOUT WARRANTY OF
- * ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
- * PERFORMANCE OF THE MODULE IS WITH YOU. SHOULD THE MODULE PROVE
- * DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR
- * OR CORRECTION.
- *
- * 11. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
- * WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
- * MODIFY AND/OR REDISTRIBUTE THE MODULE AS PERMITTED ABOVE, BE LIABLE
- * TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
- * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
- * THE MODULE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
- * RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR
- * A FAILURE OF THE MODULE TO OPERATE WITH ANY OTHER MODULES), EVEN IF
- * SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGES.
- *
- * END OF TERMS AND CONDITIONS
- ***************************************************************************/
-
- ;------------------------------------------------------------------------------
- ;Global Declarations:
- ;------------------------------------------------------------------------------
- .global _G726_agen
- .global _G726_bgen
- ;void G726_bgen(short *inp,short *dq1,short *b1);
- ;void G726_agen(short *inp,short *a2p,short *a2r,short *a1r);
- ;------------------------------------------------------------------------------
- ;Code Section in Program Memory
- ;------------------------------------------------------------------------------
- .section libg726a, code
- /******************************************************************************
- *
- * Function Name: G726_agen
- *
- * System: RISC
- *
- * Platform: dsPIC33F
- *
- * Description: A filter coefficients generation
- * Combination of upa2, limc, trigb,upa1, limd and trigb
- *
- * Cycle Count: 49
- *
- * Input Parameters: w0-inp, w1-a2p, w2-a2r, w3-a1r
- *
- * Output Parameters: None
- *
- * History:
- *
- * Date | By | Remarks
- * ---------------+-------------------+----------------------------------
- * Oct-20-2005 Raghavendra S. Created. (cycles - 58)
- * Nov-11-2005 Ravikiran P. Optimised (cycles - 54)
- ******************************************************************************/
- .text
- _G726_agen:
- mov.w [w0+4],w4 ;uga2a = pks2 * 0x1000;
- sl w4,#12,w4 ;w4-uga2a
-
- mov.w [w0+6],w5 ;w5-a1
- mov.w w5,w6 ;fa = a1;,w6-fa
-
- mov.w #-8191,w7
- cpsgt w5,w7 ;if(a1 < -8191)
- mov.w w7,w6 ;fa = -8191;
- CHECK2: mov.w #8191,w7
- cpslt w5,w7 ;if(a1 > 8191)
- mov.w w7,w6 ;fa = 8191;
- CHECKOUT:mul.ss w6,[++w0],w6 ;fa = -(pks1 * fa);, w7-pks1, w6-fa
- sub w4,w6,w4 ;uga2b = (uga2a + fa);, w4-uga2b
- asr w4,#5,w4
- mul.ss w4,[--w0],w6 ;uga2 = (uga2b >> 5)*sigpk;,w6-uga2
-
- mov.w [w0+8],w4 ;ula2 = -(a2 >> 7);
- asr w4,#7,w7 ;w7-u1a2
- sub w6,w7,w6 ;ua2 = uga2 + ula2;, w6-ua2
- add w4,w6,w6 ;a2t = a2 + ua2;
- mov.w w6,[w1] ;*a2p = a2t;, w6-a2t, w1-a2p
- mov.w #0x3000,w4
- cp w6,w4 ;if( a2t > 0x3000)
- bra le, CHECK3
- mov.w w4,[w1] ;*a2p = 0x3000;
- CHECK3: mov.w #-12288,w4
- cp w6,w4 ;if(a2t < -(0x3000))
- bra ge,CHECK4
- mov.w w4,[w1] ;*a2p = -(0x3000);
- CHECK4: mov.d [w0],w6 ;ga1 = sigpk * pks1 * 0xc0;
- mul.ss w6,w7,w6
- mov.w #0x00C0,w7
- mul.ss w6,w7,w6 ;w6-uga1
- asr w5,#8,w7 ;ula1 = -(a1 >> 8);
- sub w6,w7,w6 ;ua1 =(uga1 + ula1);,w7-u1a1,w6-ua1
- add w5,w6,w5 ;a1t = (a1 + ua1);, w5-alt
- mov.w #0x3C00,w4
- sub w4,[w1],w4 ;upper = (0x3c00 - *a2p);
- neg w4,w6 ;lower = -upper;, w4-upper,w6-lower
- mov.w w5,w7 ;a1p = a1t; ,w7-alp
- cpsgt w5,w6 ;if (a1t < lower)
- mov.w w6,w7 ;a1p = lower;
- ALPGE: cpslt w5,w4 ;if (a1t > upper)
- mov.w w4,w7 ;a1p = upper;, w7-alp
- ALPLE: mov.w [w0+10],w4 ;*a2r = (tr == 0) ? *a2p : 0;
- cp0 w4 ;*a1r = (tr == 0) ? a1p : 0;
- bra z,A1S
- clr.w [w3]
- clr.w [w2]
- bra OUT2
- A1S: mov.w w7,[w3]
- mov.w [w1],[w2]
- OUT2: return
- /*****************************************************************************
- *
- * Function Name: G726_bgen
- *
- * System: RISC
- *
- * Platform: dsPIC33F
- *
- * Description: Update for Coefficients of sixth order Predictor
- *
- * Cycle Count: 67
- *
- * Input Parameters: w0 - inp_array,w1 - Pointer to state->dq0, w2 - state->b1r
- *
- * Output Parameters: none
- *
- * History:
- *
- * Date | By | Remarks
- * ---------------+-------------------+----------------------------------
- * Oct-07-2005 Sabarinath.P Created.
- * Nov-03-2005 Sabarinath.P Optimized and Tested ( Cycle - 111 )
- * Nov-07-2005 Sharanabasava M. Modified and Released( Cycle - 84 )
- * Nov-08-2005 Sabarinath.P Tested & Released ( Cycle - 72 )
- ***************************************************************************/
- _G726_bgen:
- mov [w0 + 4],w5 ;w5=tr ;w6=ugb;w7=dqmag
- cp w5,#1
- bra nz,FALSE
- repeat #5 ;loop=6
- clr [w2++] ;*(br+loopcnt) =0;
- bra BGENOUT
- FALSE:
- mov [w0],w3 ;w3=leak
- mov [w0 + 2],w7 ;w4=dq
- bclr w7,#15 ;dqmag = dq & 32767;
- cp0 w7
- bra le,SKIP
- mov #128,w7 ;w7=ugb
- cp0 [++w0]
- bra gt,SKIP
- mov #-128,w7
- SKIP:
- clr w6
- do #5,LOOP
- mov [w1 + w6],w5 ;ugb_l = (*(dq1+cnt) > 0) ? ugb : -ugb;
- mov w7,w4
- btsc w5,#15
- neg w7,w4
- CMP:
- mov [w2],w5 ;ulb = - (bb >> leak);
- asr w5,w3,w5 ;bp = bb + ugb_l + ulb;
- sub w4,w5,w5 ;bp = bb + ugb_l - ulb ;
- add w6,#4,w6
- LOOP:
- add w5,[w2],[w2++]
- BGENOUT:
- return
- ;--------End of All Code Sections ---------------------------------------------
- .end ;End of program code in this file
|