[bTSstream-devel] [Git][videolan/bitstream][master] aac: add function to calculate profile_and_level

Christophe Massiot gitlab at videolan.org
Sun Oct 25 23:09:09 CET 2020



Christophe Massiot pushed to branch master at VideoLAN / bitstream


Commits:
314e0740 by Christophe Massiot at 2020-10-25T23:08:30+01:00
aac: add function to calculate profile_and_level

- - - - -


1 changed file:

- mpeg/aac.h


Changes:

=====================================
mpeg/aac.h
=====================================
@@ -29,6 +29,7 @@
  * Normative references:
  *  - ISO/IEC 14496-3 Subpart 4:1998(E)
  *    (Advanced Audio Coding, Time/Frequency Coding)
+ *  - ISO/IEC 13818-1:2013(E) (MPEG-2 Systems)
  */
 
 #ifndef __BITSTREAM_MPEG_AAC_H__
@@ -252,6 +253,39 @@ static inline void loas_set_length(uint8_t *p, uint16_t val)
 #define ASC_FLT_HVXC_FIXED      6
 #define ASC_FLT_HVXC_4          7
 
+/* Returns the profile_and_level structure for MPEG-4 audio descriptor */
+static inline uint8_t asc_get_profilelevel(uint8_t asc_aot, uint8_t channels, uint32_t rate)
+{
+    uint8_t profilelevel;
+    switch (asc_aot) {
+        case ASC_TYPE_LC:
+            profilelevel = 0x50;
+            break;
+
+        case ASC_TYPE_SBR:
+            profilelevel = 0x58;
+            break;
+
+        case ASC_TYPE_ER_LD:
+            return 0x38;
+
+        case ASC_TYPE_PS:
+            profilelevel = 0x60;
+            break;
+
+        default:
+            return 0xf;
+    }
+
+    if (rate > 48000)
+        return profilelevel + 3;
+    if (channels > 2)
+        return profilelevel + 2;
+    if (rate > 24000)
+        return profilelevel + 1;
+    return profilelevel;
+}
+
 /*****************************************************************************
  * AAC syntactic elements
  *****************************************************************************/



View it on GitLab: https://code.videolan.org/videolan/bitstream/-/commit/314e0740885c64e16860107ffae627fa5c94b81b

-- 
View it on GitLab: https://code.videolan.org/videolan/bitstream/-/commit/314e0740885c64e16860107ffae627fa5c94b81b
You're receiving this email because of your account on code.videolan.org.




More information about the biTStream-devel mailing list