Skip to content
This repository
Browse code

Merge commit 'b4ef1af8e81c10f4b7164e3038f130a496ec8fda' as 'android-a…

…ac-enc'
  • Loading branch information...
commit 8fc0c1638e44f41600a1840ae7b33b867935eea1 2 parents 0f23787 + b4ef1af
sbosley authored

Showing 261 changed files with 34,722 additions and 0 deletions. Show diff stats Hide diff stats

  1. 9  android-aac-enc/.classpath
  2. 3  android-aac-enc/.gitignore
  3. 33  android-aac-enc/.project
  4. 28  android-aac-enc/AndroidManifest.xml
  5. 32  android-aac-enc/README.md
  6. 85  android-aac-enc/build.xml
  7. 85  android-aac-enc/jni/Android.mk
  8. 24  android-aac-enc/jni/Config.mk
  9. 154  android-aac-enc/jni/aac-enc.c
  10. 1,624  android-aac-enc/jni/basic_op/basicop2.c
  11. 361  android-aac-enc/jni/basic_op/oper_32b.c
  12. BIN  android-aac-enc/jni/doc/voAACEncoderSDK.pdf
  13. 117  android-aac-enc/jni/inc/aac_rom.h
  14. 117  android-aac-enc/jni/inc/aacenc_core.h
  15. 57  android-aac-enc/jni/inc/adj_thr.h
  16. 69  android-aac-enc/jni/inc/adj_thr_data.h
  17. 46  android-aac-enc/jni/inc/band_nrg.h
  18. 1,171  android-aac-enc/jni/inc/basic_op.h
  19. 106  android-aac-enc/jni/inc/bit_cnt.h
  20. 89  android-aac-enc/jni/inc/bitbuffer.h
  21. 50  android-aac-enc/jni/inc/bitenc.h
  22. 72  android-aac-enc/jni/inc/block_switch.h
  23. 37  android-aac-enc/jni/inc/channel_map.h
  24. 106  android-aac-enc/jni/inc/cmnMemory.h
  25. 36  android-aac-enc/jni/inc/config.h
  26. 82  android-aac-enc/jni/inc/dyn_bits.h
  27. 44  android-aac-enc/jni/inc/grp_data.h
  28. 106  android-aac-enc/jni/inc/interface.h
  29. 75  android-aac-enc/jni/inc/line_pe.h
  30. 35  android-aac-enc/jni/inc/memalign.h
  31. 45  android-aac-enc/jni/inc/ms_stereo.h
  32. 89  android-aac-enc/jni/inc/oper_32b.h
  33. 42  android-aac-enc/jni/inc/pre_echo_control.h
  34. 107  android-aac-enc/jni/inc/psy_configuration.h
  35. 80  android-aac-enc/jni/inc/psy_const.h
  36. 66  android-aac-enc/jni/inc/psy_data.h
  37. 69  android-aac-enc/jni/inc/psy_main.h
  38. 143  android-aac-enc/jni/inc/qc_data.h
  39. 64  android-aac-enc/jni/inc/qc_main.h
  40. 42  android-aac-enc/jni/inc/quantize.h
  41. 46  android-aac-enc/jni/inc/sf_estim.h
  42. 33  android-aac-enc/jni/inc/spreading.h
  43. 34  android-aac-enc/jni/inc/stat_bits.h
  44. 108  android-aac-enc/jni/inc/tns.h
  45. 75  android-aac-enc/jni/inc/tns_func.h
  46. 52  android-aac-enc/jni/inc/tns_param.h
  47. 36  android-aac-enc/jni/inc/transform.h
  48. 63  android-aac-enc/jni/inc/typedef.h
  49. 187  android-aac-enc/jni/inc/typedefs.h
  50. 74  android-aac-enc/jni/inc/voAAC.h
  51. 87  android-aac-enc/jni/inc/voAMRWB.h
  52. 173  android-aac-enc/jni/inc/voAudio.h
  53. 193  android-aac-enc/jni/inc/voIndex.h
  54. 65  android-aac-enc/jni/inc/voMem.h
  55. 221  android-aac-enc/jni/inc/voType.h
  56. 9  android-aac-enc/jni/patent_disclaimer.txt
  57. 2,363  android-aac-enc/jni/src/aac_rom.c
  58. 495  android-aac-enc/jni/src/aacenc.c
  59. 239  android-aac-enc/jni/src/aacenc_core.c
  60. 1,225  android-aac-enc/jni/src/adj_thr.c
  61. 167  android-aac-enc/jni/src/asm/ARMV5E/AutoCorrelation_v5.s
  62. 112  android-aac-enc/jni/src/asm/ARMV5E/CalcWindowEnergy_v5.s
  63. 131  android-aac-enc/jni/src/asm/ARMV5E/PrePostMDCT_v5.s
  64. 252  android-aac-enc/jni/src/asm/ARMV5E/R4R8First_v5.s
  65. 169  android-aac-enc/jni/src/asm/ARMV5E/Radix4FFT_v5.s
  66. 204  android-aac-enc/jni/src/asm/ARMV5E/band_nrg_v5.s
  67. 135  android-aac-enc/jni/src/asm/ARMV7/PrePostMDCT_v7.s
  68. 146  android-aac-enc/jni/src/asm/ARMV7/R4R8First_v7.s
  69. 143  android-aac-enc/jni/src/asm/ARMV7/Radix4FFT_v7.s
  70. 102  android-aac-enc/jni/src/band_nrg.c
  71. 885  android-aac-enc/jni/src/bit_cnt.c
  72. 173  android-aac-enc/jni/src/bitbuffer.c
  73. 690  android-aac-enc/jni/src/bitenc.c
  74. 431  android-aac-enc/jni/src/block_switch.c
  75. 123  android-aac-enc/jni/src/channel_map.c
  76. 71  android-aac-enc/jni/src/cmnMemory.c
  77. 545  android-aac-enc/jni/src/dyn_bits.c
  78. 188  android-aac-enc/jni/src/grp_data.c
  79. 112  android-aac-enc/jni/src/interface.c
  80. 145  android-aac-enc/jni/src/line_pe.c
  81. 112  android-aac-enc/jni/src/memalign.c
  82. 139  android-aac-enc/jni/src/ms_stereo.c
  83. 113  android-aac-enc/jni/src/pre_echo_control.c
  84. 505  android-aac-enc/jni/src/psy_configuration.c
  85. 811  android-aac-enc/jni/src/psy_main.c
  86. 580  android-aac-enc/jni/src/qc_main.c
  87. 445  android-aac-enc/jni/src/quantize.c
  88. 882  android-aac-enc/jni/src/sf_estim.c
  89. 52  android-aac-enc/jni/src/spreading.c
  90. 237  android-aac-enc/jni/src/stat_bits.c
  91. 932  android-aac-enc/jni/src/tns.c
  92. 678  android-aac-enc/jni/src/transform.c
  93. BIN  android-aac-enc/libs/armeabi/libaac-encoder.so
  94. BIN  android-aac-enc/libs/xom-1.2.7.jar
  95. 10  android-aac-enc/local.properties
  96. 40  android-aac-enc/proguard.cfg
  97. 11  android-aac-enc/project.properties
  98. BIN  android-aac-enc/res/drawable-hdpi/ic_launcher.png
  99. BIN  android-aac-enc/res/drawable-ldpi/ic_launcher.png
  100. BIN  android-aac-enc/res/drawable-mdpi/ic_launcher.png
  101. 23  android-aac-enc/res/layout/main.xml
  102. 227  android-aac-enc/res/raw/isoparser.properties
  103. 7  android-aac-enc/res/values/strings.xml
  104. 130  android-aac-enc/src/com/coremedia/iso/AbstractBoxParser.java
  105. 47  android-aac-enc/src/com/coremedia/iso/Ascii.java
  106. 31  android-aac-enc/src/com/coremedia/iso/BoxParser.java
  107. 90  android-aac-enc/src/com/coremedia/iso/ChannelHelper.java
  108. 50  android-aac-enc/src/com/coremedia/iso/Hex.java
  109. 186  android-aac-enc/src/com/coremedia/iso/IsoFile.java
  110. 89  android-aac-enc/src/com/coremedia/iso/IsoFileConvenienceHelper.java
  111. 148  android-aac-enc/src/com/coremedia/iso/IsoTypeReader.java
  112. 39  android-aac-enc/src/com/coremedia/iso/IsoTypeReaderVariable.java
  113. 103  android-aac-enc/src/com/coremedia/iso/IsoTypeWriter.java
  114. 45  android-aac-enc/src/com/coremedia/iso/IsoTypeWriterVariable.java
  115. 207  android-aac-enc/src/com/coremedia/iso/PropertyBoxParserImpl.java
  116. 59  android-aac-enc/src/com/coremedia/iso/Utf8.java
  117. 29  android-aac-enc/src/com/coremedia/iso/boxes/AbstractMediaHeaderBox.java
  118. 112  android-aac-enc/src/com/coremedia/iso/boxes/AlbumBox.java
  119. 94  android-aac-enc/src/com/coremedia/iso/boxes/AuthorBox.java
  120. 91  android-aac-enc/src/com/coremedia/iso/boxes/BitRateBox.java
  121. 51  android-aac-enc/src/com/coremedia/iso/boxes/Box.java
  122. 51  android-aac-enc/src/com/coremedia/iso/boxes/ChunkOffset64BitBox.java
  123. 21  android-aac-enc/src/com/coremedia/iso/boxes/ChunkOffsetBox.java
  124. 110  android-aac-enc/src/com/coremedia/iso/boxes/ClassificationBox.java
  125. 101  android-aac-enc/src/com/coremedia/iso/boxes/CompositionShiftLeastGreatestAtom.java
  126. 150  android-aac-enc/src/com/coremedia/iso/boxes/CompositionTimeToSample.java
  127. 74  android-aac-enc/src/com/coremedia/iso/boxes/ContainerBox.java
  128. 86  android-aac-enc/src/com/coremedia/iso/boxes/CopyrightBox.java
  129. 53  android-aac-enc/src/com/coremedia/iso/boxes/DataEntryUrlBox.java
  130. 69  android-aac-enc/src/com/coremedia/iso/boxes/DataEntryUrnBox.java
  131. 36  android-aac-enc/src/com/coremedia/iso/boxes/DataInformationBox.java
  132. 65  android-aac-enc/src/com/coremedia/iso/boxes/DataReferenceBox.java
  133. 77  android-aac-enc/src/com/coremedia/iso/boxes/DescriptionBox.java
  134. 34  android-aac-enc/src/com/coremedia/iso/boxes/EditBox.java
  135. 248  android-aac-enc/src/com/coremedia/iso/boxes/EditListBox.java
  136. 144  android-aac-enc/src/com/coremedia/iso/boxes/FileTypeBox.java
  137. 64  android-aac-enc/src/com/coremedia/iso/boxes/FreeBox.java
  138. 63  android-aac-enc/src/com/coremedia/iso/boxes/FreeSpaceBox.java
  139. 17  android-aac-enc/src/com/coremedia/iso/boxes/FullBox.java
  140. 39  android-aac-enc/src/com/coremedia/iso/boxes/GenericMediaHeaderBoxImpl.java
  141. 80  android-aac-enc/src/com/coremedia/iso/boxes/GenreBox.java
  142. 151  android-aac-enc/src/com/coremedia/iso/boxes/HandlerBox.java
  143. 91  android-aac-enc/src/com/coremedia/iso/boxes/HintMediaHeaderBox.java
  144. 43  android-aac-enc/src/com/coremedia/iso/boxes/ItemDataBox.java
  145. 360  android-aac-enc/src/com/coremedia/iso/boxes/ItemLocationBox.java
  146. 61  android-aac-enc/src/com/coremedia/iso/boxes/ItemProtectionBox.java
  147. 95  android-aac-enc/src/com/coremedia/iso/boxes/KeywordsBox.java
  148. 61  android-aac-enc/src/com/coremedia/iso/boxes/MediaBox.java
  149. 147  android-aac-enc/src/com/coremedia/iso/boxes/MediaHeaderBox.java
  150. 49  android-aac-enc/src/com/coremedia/iso/boxes/MediaInformationBox.java
  151. 113  android-aac-enc/src/com/coremedia/iso/boxes/MetaBox.java
  152. 67  android-aac-enc/src/com/coremedia/iso/boxes/MovieBox.java
  153. 210  android-aac-enc/src/com/coremedia/iso/boxes/MovieHeaderBox.java
  154. 43  android-aac-enc/src/com/coremedia/iso/boxes/NullMediaHeaderBox.java
  155. 0  android-aac-enc/src/com/coremedia/iso/boxes/ObjectDescriptorBox.java
  156. 87  android-aac-enc/src/com/coremedia/iso/boxes/OmaDrmAccessUnitFormatBox.java
  157. 69  android-aac-enc/src/com/coremedia/iso/boxes/OriginalFormatBox.java
  158. 78  android-aac-enc/src/com/coremedia/iso/boxes/PerformerBox.java
  159. 95  android-aac-enc/src/com/coremedia/iso/boxes/ProgressiveDownloadInformationBox.java
  160. 42  android-aac-enc/src/com/coremedia/iso/boxes/ProtectionSchemeInformationBox.java
  161. 124  android-aac-enc/src/com/coremedia/iso/boxes/RatingBox.java
  162. 63  android-aac-enc/src/com/coremedia/iso/boxes/RecordingYearBox.java
  163. 127  android-aac-enc/src/com/coremedia/iso/boxes/SampleAuxiliaryInformationOffsetsBox.java
  164. 134  android-aac-enc/src/com/coremedia/iso/boxes/SampleAuxiliaryInformationSizesBox.java
  165. 136  android-aac-enc/src/com/coremedia/iso/boxes/SampleDependencyTypeBox.java
  166. 81  android-aac-enc/src/com/coremedia/iso/boxes/SampleDescriptionBox.java
  167. 121  android-aac-enc/src/com/coremedia/iso/boxes/SampleSizeBox.java
  168. 124  android-aac-enc/src/com/coremedia/iso/boxes/SampleTableBox.java
  169. 156  android-aac-enc/src/com/coremedia/iso/boxes/SampleToChunkBox.java
  170. 122  android-aac-enc/src/com/coremedia/iso/boxes/SampleToGroupBox.java
  171. 33  android-aac-enc/src/com/coremedia/iso/boxes/SchemeInformationBox.java
  172. 101  android-aac-enc/src/com/coremedia/iso/boxes/SchemeTypeBox.java
  173. 58  android-aac-enc/src/com/coremedia/iso/boxes/SoundMediaHeaderBox.java
  174. 71  android-aac-enc/src/com/coremedia/iso/boxes/StaticChunkOffsetBox.java
  175. 208  android-aac-enc/src/com/coremedia/iso/boxes/SubSampleInformationBox.java
  176. 30  android-aac-enc/src/com/coremedia/iso/boxes/SubtitleMediaHeaderBox.java
  177. 83  android-aac-enc/src/com/coremedia/iso/boxes/SyncSampleBox.java
  178. 152  android-aac-enc/src/com/coremedia/iso/boxes/TimeToSampleBox.java
  179. 89  android-aac-enc/src/com/coremedia/iso/boxes/TitleBox.java
  180. 71  android-aac-enc/src/com/coremedia/iso/boxes/TrackBox.java
  181. 249  android-aac-enc/src/com/coremedia/iso/boxes/TrackHeaderBox.java
  182. 41  android-aac-enc/src/com/coremedia/iso/boxes/TrackReferenceBox.java
  183. 76  android-aac-enc/src/com/coremedia/iso/boxes/TrackReferenceTypeBox.java
  184. 59  android-aac-enc/src/com/coremedia/iso/boxes/UnknownBox.java
  185. 64  android-aac-enc/src/com/coremedia/iso/boxes/UserBox.java
  186. 59  android-aac-enc/src/com/coremedia/iso/boxes/UserDataBox.java
  187. 81  android-aac-enc/src/com/coremedia/iso/boxes/VideoMediaHeaderBox.java
  188. 10  android-aac-enc/src/com/coremedia/iso/boxes/WriteListener.java
  189. 44  android-aac-enc/src/com/coremedia/iso/boxes/XmlBox.java
  190. 164  android-aac-enc/src/com/coremedia/iso/boxes/apple/AbstractAppleMetaDataBox.java
  191. 16  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleAlbumArtistBox.java
  192. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleAlbumBox.java
  193. 16  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleArtistBox.java
  194. 16  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleCommentBox.java
  195. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleCompilationBox.java
  196. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleCopyrightBox.java
  197. 44  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleCoverBox.java
  198. 28  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleCustomGenreBox.java
  199. 92  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleDataBox.java
  200. 53  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleDataRateBox.java
  201. 71  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleDataReferenceBox.java
  202. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleDescriptionBox.java
  203. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleEncoderBox.java
  204. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleGaplessPlaybackBox.java
  205. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleGenericBox.java
  206. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleGroupingBox.java
  207. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleIdBox.java
  208. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleItemListBox.java
  209. 163  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleLosslessSpecificBox.java
  210. 47  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleMeanBox.java
  211. 39  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleMediaTypeBox.java
  212. 45  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleNameBox.java
  213. 16  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleNetworkBox.java
  214. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/ApplePurchaseDateBox.java
  215. 16  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleRatingBox.java
  216. 16  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleRecordingYearBox.java
  217. 28  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleReferenceMovieBox.java
  218. 27  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleReferenceMovieDescriptorBox.java
  219. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleShowBox.java
  220. 14  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleSortAlbumBox.java
  221. 14  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleStandardGenreBox.java
  222. 27  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleStoreAccountTypeBox.java
  223. 54  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleStoreCountryCodeBox.java
  224. 16  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleSynopsisBox.java
  225. 28  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleTempBox.java
  226. 16  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleTrackAuthorBox.java
  227. 48  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleTrackNumberBox.java
  228. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleTrackTitleBox.java
  229. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleTvEpisodeBox.java
  230. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleTvEpisodeNumberBox.java
  231. 15  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleTvSeasonBox.java
  232. 16  android-aac-enc/src/com/coremedia/iso/boxes/apple/AppleWaveBox.java
  233. 108  android-aac-enc/src/com/coremedia/iso/boxes/dece/TrickPlayBox.java
  234. 31  android-aac-enc/src/com/coremedia/iso/boxes/fragment/MovieExtendsBox.java
  235. 67  android-aac-enc/src/com/coremedia/iso/boxes/fragment/MovieExtendsHeaderBox.java
  236. 96  android-aac-enc/src/com/coremedia/iso/boxes/fragment/MovieFragmentBox.java
  237. 72  android-aac-enc/src/com/coremedia/iso/boxes/fragment/MovieFragmentHeaderBox.java
  238. 34  android-aac-enc/src/com/coremedia/iso/boxes/fragment/MovieFragmentRandomAccessBox.java
  239. 62  android-aac-enc/src/com/coremedia/iso/boxes/fragment/MovieFragmentRandomAccessOffsetBox.java
  240. 207  android-aac-enc/src/com/coremedia/iso/boxes/fragment/SampleFlags.java
  241. 115  android-aac-enc/src/com/coremedia/iso/boxes/fragment/TrackExtendsBox.java
  242. 76  android-aac-enc/src/com/coremedia/iso/boxes/fragment/TrackFragmentBaseMediaDecodeTimeBox.java
  243. 43  android-aac-enc/src/com/coremedia/iso/boxes/fragment/TrackFragmentBox.java
  244. 208  android-aac-enc/src/com/coremedia/iso/boxes/fragment/TrackFragmentHeaderBox.java
  245. 287  android-aac-enc/src/com/coremedia/iso/boxes/fragment/TrackFragmentRandomAccessBox.java
  246. 381  android-aac-enc/src/com/coremedia/iso/boxes/fragment/TrackRunBox.java
  247. 285  android-aac-enc/src/com/coremedia/iso/boxes/h264/AvcConfigurationBox.java
  248. 84  android-aac-enc/src/com/coremedia/iso/boxes/mdat/DummyMap.java
  249. 94  android-aac-enc/src/com/coremedia/iso/boxes/mdat/MediaDataBox.java
  250. 194  android-aac-enc/src/com/coremedia/iso/boxes/mdat/SampleList.java
  251. 12  android-aac-enc/src/com/coremedia/iso/boxes/mdat/Segment.java
  252. BIN  android-aac-enc/src/com/coremedia/iso/boxes/odf-boxes.zip
  253. BIN  android-aac-enc/src/com/coremedia/iso/boxes/rtp-boxes.zip
  254. 101  android-aac-enc/src/com/coremedia/iso/boxes/sampleentry/AmrSpecificBox.java
  255. 251  android-aac-enc/src/com/coremedia/iso/boxes/sampleentry/AudioSampleEntry.java
  256. 43  android-aac-enc/src/com/coremedia/iso/boxes/sampleentry/MpegSampleEntry.java
  257. 45  android-aac-enc/src/com/coremedia/iso/boxes/sampleentry/Ovc1VisualSampleEntryImpl.java
  258. 157  android-aac-enc/src/com/coremedia/iso/boxes/sampleentry/SampleEntry.java
  259. 76  android-aac-enc/src/com/coremedia/iso/boxes/sampleentry/SubtitleSampleEntry.java
  260. 305  android-aac-enc/src/com/coremedia/iso/boxes/sampleentry/TextSampleEntry.java
9  android-aac-enc/.classpath
... ...
@@ -0,0 +1,9 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<classpath>
  3
+	<classpathentry kind="src" path="src"/>
  4
+	<classpathentry kind="src" path="gen"/>
  5
+	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
  6
+	<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
  7
+	<classpathentry kind="lib" path="libs/xom-1.2.7.jar"/>
  8
+	<classpathentry kind="output" path="bin/classes"/>
  9
+</classpath>
3  android-aac-enc/.gitignore
... ...
@@ -0,0 +1,3 @@
  1
+gen
  2
+bin
  3
+obj
33  android-aac-enc/.project
... ...
@@ -0,0 +1,33 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<projectDescription>
  3
+	<name>aac-enc</name>
  4
+	<comment></comment>
  5
+	<projects>
  6
+	</projects>
  7
+	<buildSpec>
  8
+		<buildCommand>
  9
+			<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
  10
+			<arguments>
  11
+			</arguments>
  12
+		</buildCommand>
  13
+		<buildCommand>
  14
+			<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
  15
+			<arguments>
  16
+			</arguments>
  17
+		</buildCommand>
  18
+		<buildCommand>
  19
+			<name>org.eclipse.jdt.core.javabuilder</name>
  20
+			<arguments>
  21
+			</arguments>
  22
+		</buildCommand>
  23
+		<buildCommand>
  24
+			<name>com.android.ide.eclipse.adt.ApkBuilder</name>
  25
+			<arguments>
  26
+			</arguments>
  27
+		</buildCommand>
  28
+	</buildSpec>
  29
+	<natures>
  30
+		<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
  31
+		<nature>org.eclipse.jdt.core.javanature</nature>
  32
+	</natures>
  33
+</projectDescription>
28  android-aac-enc/AndroidManifest.xml
... ...
@@ -0,0 +1,28 @@
  1
+<?xml version="1.0" encoding="utf-8"?>
  2
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3
+    package="com.todoroo.aacenc"
  4
+    android:versionCode="1"
  5
+    android:versionName="1.0" >
  6
+
  7
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  8
+    <uses-permission android:name="android.permission.RECORD_AUDIO" />
  9
+    <uses-permission android:name="android.permission.INTERNET"/>
  10
+    
  11
+
  12
+    <uses-sdk android:minSdkVersion="7" />
  13
+
  14
+    <application
  15
+        android:icon="@drawable/ic_launcher"
  16
+        android:label="@string/app_name" >
  17
+        <activity
  18
+            android:label="@string/app_name"
  19
+            android:name=".Main" >
  20
+            <intent-filter >
  21
+                <action android:name="android.intent.action.MAIN" />
  22
+
  23
+                <category android:name="android.intent.category.LAUNCHER" />
  24
+            </intent-filter>
  25
+        </activity>
  26
+    </application>
  27
+
  28
+</manifest>
32  android-aac-enc/README.md
Source Rendered
... ...
@@ -0,0 +1,32 @@
  1
+Android AAC Encoder project
  2
+============================
  3
+
  4
+Extraction of Android Stagefright VO AAC encoder with a nice Java API.
  5
+
  6
+In addition, includes a patched [MP4Parser](http://code.google.com/p/mp4parser) Java library for wrapping AAC files in an MP4 container to produce M4A audio files playable by Google Chrome and Apple QuickTime.
  7
+
  8
+This project is set up as a single Eclipse project with a Main.java example activity. AAC encoding logic is found in jni/aac-enc.c, which needs to be built with the [Android NDK](http://developer.android.com/sdk/ndk/index.html). I used NDK r7c, but any version should work.
  9
+
  10
+Why?
  11
+----
  12
+
  13
+- smaller code footprint than FFmpeg (< 500k compared to > 2M)
  14
+- less native code to compile = less work to support new architectures
  15
+- easiest way to make an M4A file
  16
+
  17
+
  18
+License
  19
+-------
  20
+
  21
+This project is released under the [Apache License, version 2](http://www.apache.org/licenses/LICENSE-2.0)
  22
+
  23
+Patents
  24
+-------
  25
+
  26
+This project grants you no rights to any of the patents this technology may require. However, since Android version 4.0 and up ship with the Stagefright VO AAC encoder, it is my understanding that you can release code that depends on these libraries for any version of Android. Please note that I am not a lawyer.
  27
+
  28
+
  29
+Have changes?
  30
+-------------
  31
+
  32
+Pull requests are accepted!
85  android-aac-enc/build.xml
... ...
@@ -0,0 +1,85 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<project name="Main" default="help">
  3
+
  4
+    <!-- The local.properties file is created and updated by the 'android' tool.
  5
+         It contains the path to the SDK. It should *NOT* be checked into
  6
+         Version Control Systems. -->
  7
+    <property file="local.properties" />
  8
+
  9
+    <!-- The ant.properties file can be created by you. It is only edited by the
  10
+         'android' tool to add properties to it.
  11
+         This is the place to change some Ant specific build properties.
  12
+         Here are some properties you may want to change/update:
  13
+
  14
+         source.dir
  15
+             The name of the source directory. Default is 'src'.
  16
+         out.dir
  17
+             The name of the output directory. Default is 'bin'.
  18
+
  19
+         For other overridable properties, look at the beginning of the rules
  20
+         files in the SDK, at tools/ant/build.xml
  21
+
  22
+         Properties related to the SDK location or the project target should
  23
+         be updated using the 'android' tool with the 'update' action.
  24
+
  25
+         This file is an integral part of the build system for your
  26
+         application and should be checked into Version Control Systems.
  27
+
  28
+         -->
  29
+    <property file="ant.properties" />
  30
+
  31
+    <!-- The project.properties file is created and updated by the 'android'
  32
+         tool, as well as ADT.
  33
+
  34
+         This contains project specific properties such as project target, and library
  35
+         dependencies. Lower level build properties are stored in ant.properties
  36
+         (or in .classpath for Eclipse projects).
  37
+
  38
+         This file is an integral part of the build system for your
  39
+         application and should be checked into Version Control Systems. -->
  40
+    <loadproperties srcFile="project.properties" />
  41
+
  42
+    <!-- quick check on sdk.dir -->
  43
+    <fail
  44
+            message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
  45
+            unless="sdk.dir"
  46
+    />
  47
+
  48
+
  49
+<!-- extension targets. Uncomment the ones where you want to do custom work
  50
+     in between standard targets -->
  51
+<!--
  52
+    <target name="-pre-build">
  53
+    </target>
  54
+    <target name="-pre-compile">
  55
+    </target>
  56
+
  57
+    /* This is typically used for code obfuscation.
  58
+       Compiled code location: ${out.classes.absolute.dir}
  59
+       If this is not done in place, override ${out.dex.input.absolute.dir} */
  60
+    <target name="-post-compile">
  61
+    </target>
  62
+-->
  63
+
  64
+    <!-- Import the actual build file.
  65
+
  66
+         To customize existing targets, there are two options:
  67
+         - Customize only one target:
  68
+             - copy/paste the target into this file, *before* the
  69
+               <import> task.
  70
+             - customize it to your needs.
  71
+         - Customize the whole content of build.xml
  72
+             - copy/paste the content of the rules files (minus the top node)
  73
+               into this file, replacing the <import> task.
  74
+             - customize to your needs.
  75
+
  76
+         ***********************
  77
+         ****** IMPORTANT ******
  78
+         ***********************
  79
+         In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
  80
+         in order to avoid having your file be overridden by tools such as "android update project"
  81
+    -->
  82
+    <!-- version-tag: 1 -->
  83
+    <import file="${sdk.dir}/tools/ant/build.xml" />
  84
+
  85
+</project>
85  android-aac-enc/jni/Android.mk
... ...
@@ -0,0 +1,85 @@
  1
+LOCAL_PATH := $(call my-dir)
  2
+
  3
+include $(CLEAR_VARS)
  4
+include $(LOCAL_PATH)/Config.mk
  5
+
  6
+LOCAL_MODULE := aac-encoder
  7
+
  8
+ENC_SRC := src
  9
+
  10
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc
  11
+
  12
+LOCAL_SRC_FILES = \
  13
+    aac-enc.c \
  14
+    $(ENC_SRC)/cmnMemory.c \
  15
+    basic_op/basicop2.c \
  16
+    basic_op/oper_32b.c \
  17
+    $(ENC_SRC)/aac_rom.c \
  18
+    $(ENC_SRC)/aacenc.c \
  19
+    $(ENC_SRC)/aacenc_core.c \
  20
+    $(ENC_SRC)/adj_thr.c \
  21
+    $(ENC_SRC)/band_nrg.c \
  22
+    $(ENC_SRC)/bit_cnt.c \
  23
+    $(ENC_SRC)/bitbuffer.c \
  24
+    $(ENC_SRC)/bitenc.c \
  25
+    $(ENC_SRC)/block_switch.c \
  26
+    $(ENC_SRC)/channel_map.c \
  27
+    $(ENC_SRC)/dyn_bits.c \
  28
+    $(ENC_SRC)/grp_data.c \
  29
+    $(ENC_SRC)/interface.c \
  30
+    $(ENC_SRC)/line_pe.c \
  31
+    $(ENC_SRC)/memalign.c \
  32
+    $(ENC_SRC)/ms_stereo.c \
  33
+    $(ENC_SRC)/pre_echo_control.c \
  34
+    $(ENC_SRC)/psy_configuration.c \
  35
+    $(ENC_SRC)/psy_main.c \
  36
+    $(ENC_SRC)/qc_main.c \
  37
+    $(ENC_SRC)/quantize.c \
  38
+    $(ENC_SRC)/sf_estim.c \
  39
+    $(ENC_SRC)/spreading.c \
  40
+    $(ENC_SRC)/stat_bits.c \
  41
+    $(ENC_SRC)/tns.c \
  42
+    $(ENC_SRC)/transform.c
  43
+
  44
+ifeq ($(VOTT), v5)
  45
+LOCAL_SRC_FILES += \
  46
+	$(ENC_SRC)/asm/ARMV5E/AutoCorrelation_v5.s \
  47
+	$(ENC_SRC)/asm/ARMV5E/band_nrg_v5.s \
  48
+	$(ENC_SRC)/asm/ARMV5E/CalcWindowEnergy_v5.s \
  49
+	$(ENC_SRC)/asm/ARMV5E/PrePostMDCT_v5.s \
  50
+	$(ENC_SRC)/asm/ARMV5E/R4R8First_v5.s \
  51
+	$(ENC_SRC)/asm/ARMV5E/Radix4FFT_v5.s
  52
+endif
  53
+
  54
+ifeq ($(VOTT), v7)
  55
+LOCAL_SRC_FILES += \
  56
+	$(ENC_SRC)/asm/ARMV5E/AutoCorrelation_v5.s \
  57
+	$(ENC_SRC)/asm/ARMV5E/band_nrg_v5.s \
  58
+	$(ENC_SRC)/asm/ARMV5E/CalcWindowEnergy_v5.s \
  59
+	$(ENC_SRC)/asm/ARMV7/PrePostMDCT_v7.s \
  60
+	$(ENC_SRC)/asm/ARMV7/R4R8First_v7.s \
  61
+	$(ENC_SRC)/asm/ARMV7/Radix4FFT_v7.s
  62
+endif
  63
+
  64
+LOCAL_ARM_MODE := arm
  65
+
  66
+LOCAL_LDLIBS := -llog
  67
+
  68
+LOCAL_STATIC_LIBRARIES := 
  69
+LOCAL_SHARED_LIBRARIES :=
  70
+
  71
+LOCAL_CFLAGS := $(VO_CFLAGS)
  72
+
  73
+ifeq ($(VOTT), v5)
  74
+LOCAL_CFLAGS += -DARMV5E -DARM_INASM -DARMV5_INASM
  75
+LOCAL_C_INCLUDES += $(ENC_SRC)/asm/ARMV5E
  76
+endif
  77
+
  78
+ifeq ($(VOTT), v7)
  79
+LOCAL_CFLAGS += -DARMV5E -DARMV7Neon -DARM_INASM -DARMV5_INASM -DARMV6_INASM
  80
+LOCAL_C_INCLUDES += $(ENC_SRC)/asm/ARMV5E
  81
+LOCAL_C_INCLUDES += $(ENC_SRC)/asm/ARMV7
  82
+endif
  83
+
  84
+include $(BUILD_SHARED_LIBRARY)
  85
+
24  android-aac-enc/jni/Config.mk
... ...
@@ -0,0 +1,24 @@
  1
+#
  2
+# This configure file is just for Linux projects against Android
  3
+#
  4
+
  5
+VOPRJ :=
  6
+VONJ :=
  7
+
  8
+# WARNING:
  9
+# Using v7 breaks generic build
  10
+ifeq ($(TARGET_ARCH),arm)
  11
+VOTT := v5
  12
+else
  13
+VOTT := pc
  14
+endif
  15
+
  16
+# Do we also need to check on ARCH_ARM_HAVE_ARMV7A? - probably not
  17
+ifeq ($(ARCH_ARM_HAVE_NEON),true)
  18
+VOTT := v7
  19
+endif
  20
+
  21
+VOTEST := 0
  22
+
  23
+VO_CFLAGS:=-DLINUX
  24
+
154  android-aac-enc/jni/aac-enc.c
... ...
@@ -0,0 +1,154 @@
  1
+#include <string.h>
  2
+#include <stdio.h>
  3
+#include <jni.h>
  4
+#include <inc/voAAC.h>
  5
+#include <inc/cmnMemory.h>
  6
+#include <android/log.h> 
  7
+
  8
+#define DEBUG 0
  9
+
  10
+#if DEBUG
  11
+#define LOG(msg, args...) __android_log_print(ANDROID_LOG_ERROR, "aac-enc", msg, ## args)
  12
+#else
  13
+#define LOG(msg, args...)
  14
+#endif
  15
+
  16
+/* utility functions */
  17
+
  18
+void throwException(JNIEnv* env, const char *name, const char *msg)
  19
+{
  20
+  jclass cls = (*env)->FindClass(env, name);
  21
+  /* if cls is NULL, an exception has already been thrown */
  22
+  if (cls != NULL) {
  23
+    (*env)->ThrowNew(env, cls, msg);
  24
+  }
  25
+  /* free the local ref */
  26
+  (*env)->DeleteLocalRef(env, cls);
  27
+}
  28
+
  29
+/* internal storage */
  30
+
  31
+FILE* outfile;
  32
+
  33
+VO_AUDIO_CODECAPI codec_api;
  34
+VO_HANDLE handle = 0;
  35
+VO_AUDIO_CODECAPI codec_api = { 0 };
  36
+VO_MEM_OPERATOR mem_operator = { 0 };
  37
+VO_CODEC_INIT_USERDATA user_data;
  38
+AACENC_PARAM params = { 0 };
  39
+
  40
+/* java native functions */
  41
+
  42
+void
  43
+Java_com_todoroo_aacenc_AACEncoder_init( JNIEnv* env,
  44
+                                         jobject thiz,
  45
+                                         int bitrate,
  46
+                                         int channels,
  47
+                                         int sampleRate,
  48
+                                         int bitsPerSample,
  49
+                                         jstring outputFile)
  50
+{
  51
+
  52
+  if (bitsPerSample != 16) {
  53
+    throwException(env, "java/lang/IllegalArgumentException", 
  54
+                   "Unsupported sample depth. Only 16 bits per sample is supported");
  55
+    return;
  56
+  }
  57
+  
  58
+  voGetAACEncAPI(&codec_api);
  59
+
  60
+  mem_operator.Alloc = cmnMemAlloc;
  61
+  mem_operator.Copy = cmnMemCopy;
  62
+  mem_operator.Free = cmnMemFree;
  63
+  mem_operator.Set = cmnMemSet;
  64
+  mem_operator.Check = cmnMemCheck;
  65
+  user_data.memflag = VO_IMF_USERMEMOPERATOR;
  66
+  user_data.memData = &mem_operator;
  67
+  codec_api.Init(&handle, VO_AUDIO_CodingAAC, &user_data);
  68
+
  69
+  params.sampleRate = sampleRate;
  70
+  params.bitRate = bitrate;
  71
+  params.nChannels = channels;
  72
+  params.adtsUsed = 1;
  73
+
  74
+  if (codec_api.SetParam(handle, VO_PID_AAC_ENCPARAM, &params) != VO_ERR_NONE) {
  75
+    throwException(env, "java/lang/IllegalArgumentException", 
  76
+                   "Unable to set encoding parameters");
  77
+    return;
  78
+  }
  79
+
  80
+  const char* output_file = (*env)->GetStringUTFChars(env, outputFile, (jboolean) 0);
  81
+  outfile = fopen(output_file, "wb");
  82
+  LOG("writing to %s", output_file);
  83
+  (*env)->ReleaseStringUTFChars(env, outputFile, output_file);
  84
+
  85
+  LOG("initialized handle: %x", handle);
  86
+
  87
+}
  88
+
  89
+void
  90
+Java_com_todoroo_aacenc_AACEncoder_encode( JNIEnv* env,
  91
+                                           jobject thiz,
  92
+                                           jbyteArray inputArray)
  93
+{
  94
+
  95
+  LOG("writing to handle: %x", handle);
  96
+
  97
+  jbyte* buffer = (*env)->GetByteArrayElements(env, inputArray, (jboolean) 0);
  98
+  int inputSize = (*env)->GetArrayLength(env, inputArray);
  99
+
  100
+  VO_CODECBUFFER input = { 0 }, output = { 0 };
  101
+  VO_AUDIO_OUTPUTINFO output_info = { 0 };
  102
+
  103
+  int readSize = params.nChannels * 2 * 1024;
  104
+  uint16_t* outbuf = (uint16_t*) malloc(readSize * 2);
  105
+
  106
+  LOG("input buffer: %d", inputSize);
  107
+
  108
+  /* GET OUTPUT DATA */
  109
+  int i;
  110
+  for(i = 0; i < inputSize; i += readSize) {
  111
+
  112
+    input.Buffer = buffer + i;
  113
+    input.Length = readSize;
  114
+    codec_api.SetInputData(handle, &input);
  115
+
  116
+    output.Buffer = outbuf;
  117
+    output.Length = readSize * 2;
  118
+
  119
+    int status = codec_api.GetOutputData(handle, &output, &output_info);
  120
+    if (status == VO_ERR_INPUT_BUFFER_SMALL)
  121
+      break;
  122
+
  123
+    if (status == VO_ERR_OUTPUT_BUFFER_SMALL) {
  124
+      LOG("output buffer was too small, read %d", output_info.InputUsed);
  125
+    } else if (status != VO_ERR_NONE) {
  126
+      char message[100];
  127
+      sprintf(message, "Unable to encode frame: %x", status);
  128
+      throwException(env, "java/lang/RuntimeException", message);
  129
+      return;
  130
+    }
  131
+
  132
+    fwrite(outbuf, 1, output.Length, outfile);
  133
+  }
  134
+
  135
+  LOG("finished output");
  136
+  (*env)->ReleaseByteArrayElements(env, inputArray, buffer, JNI_ABORT);
  137
+  free(outbuf);
  138
+}
  139
+
  140
+void
  141
+Java_com_todoroo_aacenc_AACEncoder_uninit( JNIEnv* env,
  142
+                                           jobject thiz)
  143
+{
  144
+
  145
+  fclose(outfile);
  146
+  codec_api.Uninit(handle);
  147
+
  148
+}
  149
+
  150
+JNIEXPORT jint JNICALL 
  151
+JNI_OnLoad (JavaVM * vm, void * reserved) 
  152
+{ 
  153
+  return JNI_VERSION_1_6; 
  154
+} 
1,624  android-aac-enc/jni/basic_op/basicop2.c
... ...
@@ -0,0 +1,1624 @@
  1
+/*
  2
+ ** Copyright 2003-2010, VisualOn, Inc.
  3
+ **
  4
+ ** Licensed under the Apache License, Version 2.0 (the "License");
  5
+ ** you may not use this file except in compliance with the License.
  6
+ ** You may obtain a copy of the License at
  7
+ **
  8
+ **     http://www.apache.org/licenses/LICENSE-2.0
  9
+ **
  10
+ ** Unless required by applicable law or agreed to in writing, software
  11
+ ** distributed under the License is distributed on an "AS IS" BASIS,
  12
+ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13
+ ** See the License for the specific language governing permissions and
  14
+ ** limitations under the License.
  15
+ */
  16
+/*******************************************************************************
  17
+	File:		basicop2.c
  18
+
  19
+	Content:	Basic arithmetic operators.
  20
+
  21
+*******************************************************************************/
  22
+
  23
+#include "typedef.h"
  24
+#include "basic_op.h"
  25
+
  26
+
  27
+/*___________________________________________________________________________
  28
+ |                                                                           |
  29
+ |   Functions                                                               |
  30
+ |___________________________________________________________________________|
  31
+*/
  32
+
  33
+/*___________________________________________________________________________
  34
+ |                                                                           |
  35
+ |   Function Name : saturate                                                |
  36
+ |                                                                           |
  37
+ |   Purpose :                                                               |
  38
+ |                                                                           |
  39
+ |    Limit the 32 bit input to the range of a 16 bit word.                  |
  40
+ |                                                                           |
  41
+ |   Inputs :                                                                |
  42
+ |                                                                           |
  43
+ |    L_var1                                                                 |
  44
+ |             32 bit long signed integer (Word32) whose value falls in the  |
  45
+ |             range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.                 |
  46
+ |                                                                           |
  47
+ |   Outputs :                                                               |
  48
+ |                                                                           |
  49
+ |    none                                                                   |
  50
+ |                                                                           |
  51
+ |   Return Value :                                                          |
  52
+ |                                                                           |
  53
+ |    var_out                                                                |
  54
+ |             16 bit short signed integer (Word16) whose value falls in the |
  55
+ |             range : 0xffff 8000 <= var_out <= 0x0000 7fff.                |
  56
+ |___________________________________________________________________________|
  57
+*/
  58
+
  59
+#if (!SATRUATE_IS_INLINE)
  60
+Word16 saturate(Word32 L_var1)
  61
+{
  62
+    Word16 var_out;
  63
+
  64
+    if (L_var1 > 0X00007fffL)
  65
+    {
  66
+        var_out = MAX_16;
  67
+    }
  68
+    else if (L_var1 < (Word32) 0xffff8000L)
  69
+    {
  70
+        var_out = MIN_16;
  71
+    }
  72
+    else
  73
+    {
  74
+        var_out = extract_l(L_var1);
  75
+    }
  76
+
  77
+    return (var_out);
  78
+}
  79
+#endif
  80
+
  81
+/*___________________________________________________________________________
  82
+ |                                                                           |
  83
+ |   Function Name : add                                                     |
  84
+ |                                                                           |
  85
+ |   Purpose :                                                               |
  86
+ |                                                                           |
  87
+ |    Performs the addition (var1+var2) with overflow control and saturation;|
  88
+ |    the 16 bit result is set at +32767 when overflow occurs or at -32768   |
  89
+ |    when underflow occurs.                                                 |
  90
+ |                                                                           |
  91
+ |   Complexity weight : 1                                                   |
  92
+ |                                                                           |
  93
+ |   Inputs :                                                                |
  94
+ |                                                                           |
  95
+ |    var1                                                                   |
  96
+ |             16 bit short signed integer (Word16) whose value falls in the |
  97
+ |             range : 0xffff 8000 <= var1 <= 0x0000 7fff.                   |
  98
+ |                                                                           |
  99
+ |    var2                                                                   |
  100
+ |             16 bit short signed integer (Word16) whose value falls in the |
  101
+ |             range : 0xffff 8000 <= var1 <= 0x0000 7fff.                   |
  102
+ |                                                                           |
  103
+ |   Outputs :                                                               |
  104
+ |                                                                           |
  105
+ |    none                                                                   |
  106
+ |                                                                           |
  107
+ |   Return Value :                                                          |
  108
+ |                                                                           |
  109
+ |    var_out                                                                |
  110
+ |             16 bit short signed integer (Word16) whose value falls in the |
  111
+ |             range : 0xffff 8000 <= var_out <= 0x0000 7fff.                |
  112
+ |___________________________________________________________________________|
  113
+*/
  114
+
  115
+#if (!ADD_IS_INLINE)
  116
+Word16 add (Word16 var1, Word16 var2)
  117
+{
  118
+    Word16 var_out;
  119
+    Word32 L_sum;
  120
+
  121
+    L_sum = (Word32)var1 + (Word32)var2;
  122
+    var_out = saturate(L_sum);
  123
+
  124
+    return (var_out);
  125
+}
  126
+#endif
  127
+
  128
+/*___________________________________________________________________________
  129
+ |                                                                           |
  130
+ |   Function Name : sub                                                     |
  131
+ |                                                                           |
  132
+ |   Purpose :                                                               |
  133
+ |                                                                           |
  134
+ |    Performs the subtraction (var1+var2) with overflow control and satu-   |
  135
+ |    ration; the 16 bit result is set at +32767 when overflow occurs or at  |
  136
+ |    -32768 when underflow occurs.                                          |
  137
+ |                                                                           |
  138
+ |   Complexity weight : 1                                                   |
  139
+ |                                                                           |
  140
+ |   Inputs :                                                                |
  141
+ |                                                                           |
  142
+ |    var1                                                                   |
  143
+ |             16 bit short signed integer (Word16) whose value falls in the |
  144
+ |             range : 0xffff 8000 <= var1 <= 0x0000 7fff.                   |
  145
+ |                                                                           |
  146
+ |    var2                                                                   |
  147
+ |             16 bit short signed integer (Word16) whose value falls in the |
  148
+ |             range : 0xffff 8000 <= var1 <= 0x0000 7fff.                   |
  149
+ |                                                                           |
  150
+ |   Outputs :                                                               |
  151
+ |                                                                           |
  152
+ |    none                                                                   |
  153
+ |                                                                           |
  154
+ |   Return Value :                                                          |
  155
+ |                                                                           |
  156
+ |    var_out                                                                |
  157
+ |             16 bit short signed integer (Word16) whose value falls in the |
  158
+ |             range : 0xffff 8000 <= var_out <= 0x0000 7fff.                |
  159
+ |___________________________________________________________________________|
  160
+*/
  161
+#if (!SUB_IS_INLINE)
  162
+Word16 sub(Word16 var1, Word16 var2)
  163
+{
  164
+    Word16 var_out;
  165
+    Word32 L_diff;
  166
+
  167
+    L_diff = (Word32) var1 - var2;
  168
+    var_out = saturate(L_diff);
  169
+
  170
+    return (var_out);
  171
+}
  172
+#endif
  173
+
  174
+/*___________________________________________________________________________
  175
+ |                                                                           |
  176
+ |   Function Name : abs_s                                                   |
  177
+ |                                                                           |
  178
+ |   Purpose :                                                               |
  179
+ |                                                                           |
  180
+ |    Absolute value of var1; abs_s(-32768) = 32767.                         |
  181
+ |                                                                           |
  182
+ |   Complexity weight : 1                                                   |
  183
+ |                                                                           |
  184
+ |   Inputs :                                                                |
  185
+ |                                                                           |
  186
+ |    var1                                                                   |
  187
+ |             16 bit short signed integer (Word16) whose value falls in the |
  188
+ |             range : 0xffff 8000 <= var1 <= 0x0000 7fff.                   |
  189
+ |                                                                           |
  190
+ |   Outputs :                                                               |
  191
+ |                                                                           |
  192
+ |    none                                                                   |
  193
+ |                                                                           |
  194
+ |   Return Value :                                                          |
  195
+ |                                                                           |
  196
+ |    var_out                                                                |
  197
+ |             16 bit short signed integer (Word16) whose value falls in the |
  198
+ |             range : 0x0000 0000 <= var_out <= 0x0000 7fff.                |
  199
+ |___________________________________________________________________________|
  200
+*/
  201
+//Word16 abs_s (Word16 var1)
  202
+//{
  203
+//    Word16 var_out;
  204
+//
  205
+//    if (var1 == MIN_16)
  206
+//    {
  207
+//        var_out = MAX_16;
  208
+//    }
  209
+//    else
  210
+//    {
  211
+//        if (var1 < 0)
  212
+//        {
  213
+//            var_out = (Word16)-var1;
  214
+//        }
  215
+//        else
  216
+//        {
  217
+//            var_out = var1;
  218
+//        }
  219
+//    }
  220
+//
  221
+//    return (var_out);
  222
+//}
  223
+
  224
+
  225
+/*___________________________________________________________________________
  226
+ |                                                                           |
  227
+ |   Function Name : shl                                                     |
  228
+ |                                                                           |
  229
+ |   Purpose :                                                               |
  230
+ |                                                                           |
  231
+ |   Arithmetically shift the 16 bit input var1 left var2 positions.Zero fill|
  232
+ |   the var2 LSB of the result. If var2 is negative, arithmetically shift   |
  233
+ |   var1 right by -var2 with sign extension. Saturate the result in case of |
  234
+ |   underflows or overflows.                                                |
  235
+ |                                                                           |
  236
+ |   Complexity weight : 1                                                   |
  237
+ |                                                                           |
  238
+ |   Inputs :                                                                |
  239
+ |                                                                           |
  240
+ |    var1                                                                   |
  241
+ |             16 bit short signed integer (Word16) whose value falls in the |
  242
+ |             range : 0xffff 8000 <= var1 <= 0x0000 7fff.                   |
  243
+ |                                                                           |
  244
+ |    var2                                                                   |
  245
+ |             16 bit short signed integer (Word16) whose value falls in the |
  246
+ |             range : 0xffff 8000 <= var1 <= 0x0000 7fff.                   |
  247
+ |                                                                           |
  248
+ |   Outputs :                                                               |
  249
+ |                                                                           |
  250
+ |    none                                                                   |
  251
+ |                                                                           |
  252
+ |   Return Value :                                                          |
  253
+ |                                                                           |
  254
+ |    var_out                                                                |
  255
+ |             16 bit short signed integer (Word16) whose value falls in the |
  256
+ |             range : 0xffff 8000 <= var_out <= 0x0000 7fff.                |
  257
+ |___________________________________________________________________________|
  258
+*/
  259
+
  260
+#if (!SHL_IS_INLINE)
  261
+Word16 shl (Word16 var1, Word16 var2)
  262
+{
  263
+    Word16 var_out;
  264
+    Word32 result;
  265
+
  266
+    if (var2 < 0)
  267
+    {
  268
+        if (var2 < -16)
  269
+            var2 = -16;
  270
+        var_out = shr (var1, (Word16)-var2);
  271
+    }
  272
+    else
  273
+    {
  274
+        result = (Word32) var1 *((Word32) 1 << var2);
  275
+
  276
+        if ((var2 > 15 && var1 != 0) || (result != (Word32) ((Word16) result)))
  277
+        {
  278
+            //Overflow = 1;
  279
+            var_out = (Word16)((var1 > 0) ? MAX_16 : MIN_16);
  280
+        }
  281
+        else
  282
+        {
  283
+            var_out = extract_l(result);
  284
+        }
  285
+    }
  286
+
  287
+    return (var_out);
  288
+}
  289
+#endif
  290
+// end
  291
+
  292
+/*___________________________________________________________________________
  293
+ |                                                                           |
  294
+ |   Function Name : shr                                                     |
  295
+ |                                                                           |
  296
+ |   Purpose :                                                               |
  297
+ |                                                                           |
  298
+ |   Arithmetically shift the 16 bit input var1 right var2 positions with    |
  299
+ |   sign extension. If var2 is negative, arithmetically shift var1 left by  |
  300
+ |   -var2 with sign extension. Saturate the result in case of underflows or |
  301
+ |   overflows.                                                              |
  302
+ |                                                                           |
  303
+ |   Complexity weight : 1                                                   |
  304
+ |                                                                           |
  305
+ |   Inputs :                                                                |
  306
+ |                                                                           |
  307
+ |    var1                                                                   |
  308
+ |             16 bit short signed integer (Word16) whose value falls in the |
  309
+ |             range : 0xffff 8000 <= var1 <= 0x0000 7fff.                   |
  310
+ |                                                                           |
  311
+ |    var2                                                                   |
  312
+ |             16 bit short signed integer (Word16) whose value falls in the |
  313
+ |             range : 0xffff 8000 <= var1 <= 0x0000 7fff.                   |
  314
+ |                                                                           |
  315
+ |   Outputs :                                                               |
  316
+ |                                                                           |
  317
+ |    none                                                                   |
  318
+ |                                                                           |
  319
+ |   Return Value :                                                          |
  320
+ |                                                                           |
  321
+ |    var_out                                                                |
  322
+ |             16 bit short signed integer (Word16) whose value falls in the |
  323
+ |             range : 0xffff 8000 <= var_out <= 0x0000 7fff.                |
  324
+ |___________________________________________________________________________|
  325
+*/
  326
+
  327
+#if (!SHR_IS_INLINE)
  328
+Word16 shr (Word16 var1, Word16 var2)
  329
+{
  330
+    Word16 var_out;
  331
+
  332
+    if (var2 < 0)
  333
+    {
  334
+        if (var2 < -16)
  335
+            var2 = -16;
  336
+        var_out = shl (var1, (Word16)-var2);
  337
+    }
  338
+    else
  339
+    {
  340
+        if (var2 >= 15)
  341
+        {
  342
+            var_out = (Word16)((var1 < 0) ? -1 : 0);
  343
+        }
  344
+        else
  345
+        {
  346
+            if (var1 < 0)
  347
+            {
  348
+                var_out = (Word16)(~((~var1) >> var2));
  349
+            }
  350
+            else
  351
+            {
  352
+                var_out = (Word16)(var1 >> var2);
  353
+            }
  354
+        }
  355
+    }
  356
+
  357
+    return (var_out);
  358
+}
  359
+#endif
  360
+
  361
+
  362
+/*___________________________________________________________________________
  363
+ |                                                                           |
  364
+ |   Function Name : mult                                                    |
  365
+ |                                                                           |
  366
+ |   Purpose :                                                               |
  367
+ |                                                                           |
  368
+ |    Performs the multiplication of var1 by var2 and gives a 16 bit result  |
  369
+ |    which is scaled i.e.:                                                  |
  370
+ |             mult(var1,var2) = extract_l(L_shr((var1 times var2),15)) and  |
  371
+ |             mult(-32768,-32768) = 32767.                                  |
  372
+ |                                                                           |
  373
+ |   Complexity weight : 1                                                   |
  374
+ |                                                                           |
  375
+ |   Inputs :                                                                |
  376
+ |                                                                           |
  377
+ |    var1                                                                   |
  378
+ |             16 bit short signed integer (Word16) whose value falls in the |
  379
+ |             range : 0xffff 8000 <= var1 <= 0x0000 7fff.                   |
  380
+ |                                                                           |
  381
+ |    var2                                                                   |
  382
+ |             16 bit short signed integer (Word16) whose value falls in the |
  383
+ |             range : 0xffff 8000 <= var1 <= 0x0000 7fff.                   |
  384
+ |                                                                           |
  385
+ |   Outputs :                                                               |
  386
+ |                                                                           |
  387
+ |    none                                                                   |
  388
+ |                                                                           |
  389
+ |   Return Value :                                                          |
  390
+ |                                                                           |
  391
+ |    var_out                                                                |
  392
+ |             16 bit short signed integer (Word16) whose value falls in the |
  393
+ |             range : 0xffff 8000 <= var_out <= 0x0000 7fff.                |
  394
+ |___________________________________________________________________________|
  395
+*/
  396
+#if (!MULT_IS_INLINE)
  397
+Word16 mult (Word16 var1, Word16 var2)
  398
+{
  399
+    Word16 var_out;
  400
+    Word32 L_product;
  401
+
  402
+    L_product = (Word32) var1 *(Word32) var2;
  403
+
  404
+    L_product = (L_product & (Word32) 0xffff8000L) >> 15;
  405
+
  406
+    if (L_product & (Word32) 0x00010000L)
  407
+        L_product = L_product | (Word32) 0xffff0000L;
  408
+
  409
+    var_out = saturate(L_product);
  410
+
  411
+    return (var_out);
  412
+}
  413
+#endif
  414
+
  415
+/*___________________________________________________________________________
  416
+ |                                                                           |
  417
+ |   Function Name : L_mult                                                  |
  418
+ |                                                                           |
  419
+ |   Purpose :                                                               |
  420
+ |                                                                           |
  421
+ |   L_mult is the 32 bit result of the multiplication of var1 times var2    |
  422
+ |   with one shift left i.e.:                                               |
  423
+ |        L_mult(var1,var2) = L_shl((var1 times var2),1) and                 |
  424
+ |        L_mult(-32768,-32768) = 2147483647.                                |
  425
+ |                                                                           |
  426
+ |   Complexity weight : 1                                                   |
  427
+ |                                                                           |
  428
+ |   Inputs :                                                                |
  429
+ |                                                                           |
  430
+ |    var1                                                                   |
  431
+ |             16 bit short signed integer (Word16) whose value falls in the |
  432
+ |             range : 0xffff 8000 <= var1 <= 0x0000 7fff.                   |
  433
+ |                                                                           |
  434
+ |    var2                                                                   |
  435
+ |             16 bit short signed integer (Word16) whose value falls in the |
  436
+ |             range : 0xffff 8000 <= var1 <= 0x0000 7fff.                   |
  437
+ |                                                                           |
  438
+ |   Outputs :                                                               |
  439
+ |                                                                           |
  440
+ |    none                                                                   |
  441
+ |                                                                           |
  442
+ |   Return Value :                                                          |
  443
+ |                                                                           |
  444
+ |    L_var_out                                                              |
  445
+ |             32 bit long signed integer (Word32) whose value falls in the  |
  446
+ |             range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.              |
  447
+ |___________________________________________________________________________|
  448
+*/
  449
+
  450
+#if (!L_MULT_IS_INLINE)
  451
+Word32 L_mult(Word16 var1, Word16 var2)
  452
+{
  453
+    Word32 L_var_out;
  454
+
  455
+    L_var_out = (Word32) var1 *(Word32) var2;
  456
+
  457
+    if (L_var_out != (Word32) 0x40000000L)
  458
+    {
  459
+        L_var_out <<= 1;
  460
+    }
  461
+    else
  462
+    {
  463
+        L_var_out = MAX_32;
  464
+    }
  465
+
  466
+    return (L_var_out);
  467
+}
  468
+#endif
  469
+// end
  470
+
  471
+/*___________________________________________________________________________
  472
+ |                                                                           |
  473
+ |   Function Name : negate                                                  |
  474
+ |                                                                           |
  475
+ |   Purpose :                                                               |
  476
+ |                                                                           |
  477
+ |   Negate var1 with saturation, saturate in the case where input is -32768:|
  478
+ |                negate(var1) = sub(0,var1).                                |
  479
+ |                                                                           |
  480
+ |   Complexity weight : 1                                                   |
  481
+ |                                                                           |
  482
+ |   Inputs :                                                                |
  483
+ |                                                                           |
  484
+ |    var1                                                                   |
  485
+ |             16 bit short signed integer (Word16) whose value falls in the |
  486
+ |             range : 0xffff 8000 <= var1 <= 0x0000 7fff.                   |
  487
+ |                                                                           |
  488
+ |   Outputs :                                                               |
  489
+ |                                                                           |
  490
+ |    none                                                                   |
  491
+ |                                                                           |
  492
+ |   Return Value :                                                          |
  493
+ |                                                                           |
  494
+ |    var_out                                                                |
  495
+ |             16 bit short signed integer (Word16) whose value falls in the |
  496
+ |             range : 0xffff 8000 <= var_out <= 0x0000 7fff.                |
  497
+ |___________________________________________________________________________|
  498
+*/
  499
+//Word16 negate (Word16 var1)
  500
+//{
  501
+//    Word16 var_out;
  502
+//
  503
+//    var_out = (Word16)((var1 == MIN_16) ? MAX_16 : -var1);
  504
+//
  505
+//    return (var_out);
  506
+//}
  507
+
  508
+
  509
+/*___________________________________________________________________________
  510
+ |                                                                           |
  511
+ |   Function Name : extract_h                                               |
  512
+ |                                                                           |
  513
+ |   Purpose :                                                               |
  514
+ |                                                                           |
  515
+ |   Return the 16 MSB of L_var1.                                            |
  516
+ |                                                                           |
  517
+ |   Complexity weight : 1                                                   |
  518
+ |                                                                           |
  519
+ |   Inputs :                                                                |
  520
+ |                                                                           |
  521
+ |    L_var1                                                                 |
  522
+ |             32 bit long signed integer (Word32 ) whose value falls in the |
  523
+ |             range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.                 |
  524
+ |                                                                           |
  525
+ |   Outputs :                                                               |
  526
+ |                                                                           |
  527
+ |    none                                                                   |
  528
+ |                                                                           |
  529
+ |   Return Value :                                                          |
  530
+ |                                                                           |