From aa50c2d8b380da7fbb56cd916af2065e1d57f582 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 6 Sep 2015 19:57:33 +0200 Subject: [PATCH] fixed includes --- aac/aaccodebook.cpp | 2618 +++++++++++++++++++++++++ aac/aaccodebook.h | 85 + aac/aacframe.cpp | 2125 ++++++++++++++++++++ aac/aacframe.h | 565 ++++++ abstractattachment.cpp | 6 +- abstractattachment.h | 2 +- abstractchapter.cpp | 2 +- abstractchapter.h | 4 +- abstractcontainer.cpp | 2 +- abstractcontainer.h | 6 +- abstracttrack.cpp | 8 +- abstracttrack.h | 8 +- adts/adtsframe.cpp | 4 +- adts/adtsstream.cpp | 6 +- adts/adtsstream.h | 4 +- avc/avcconfiguration.cpp | 2 +- avc/avcconfiguration.h | 2 +- avc/avcinfo.cpp | 2 +- avc/avcinfo.h | 4 +- avi/bitmapinfoheader.cpp | 2 +- backuphelper.cpp | 4 +- basicfileinfo.cpp | 2 +- caseinsensitivecomparer.h | 42 + exceptions.cpp | 2 +- fieldbasedtag.h | 2 +- genericcontainer.h | 2 +- genericfileelement.h | 6 +- generictagfield.h | 2 +- id3/id3genres.cpp | 2 +- id3/id3v1tag.cpp | 6 +- id3/id3v1tag.h | 2 +- id3/id3v2frame.cpp | 8 +- id3/id3v2frame.h | 8 +- id3/id3v2frameids.cpp | 4 +- id3/id3v2tag.cpp | 6 +- id3/id3v2tag.h | 4 +- matroska/ebmlelement.cpp | 10 +- matroska/ebmlelement.h | 8 +- matroska/matroskaattachment.cpp | 8 +- matroska/matroskaattachment.h | 2 +- matroska/matroskachapter.cpp | 6 +- matroska/matroskachapter.h | 2 +- matroska/matroskacodecid.cpp | 2 +- matroska/matroskacontainer.cpp | 18 +- matroska/matroskacontainer.h | 12 +- matroska/matroskacues.cpp | 4 +- matroska/matroskacues.h | 2 +- matroska/matroskaeditionentry.cpp | 6 +- matroska/matroskaeditionentry.h | 2 +- matroska/matroskaid.cpp | 4 +- matroska/matroskaseekinfo.cpp | 6 +- matroska/matroskaseekinfo.h | 4 +- matroska/matroskatag.cpp | 6 +- matroska/matroskatag.h | 4 +- matroska/matroskatagfield.cpp | 8 +- matroska/matroskatagfield.h | 4 +- matroska/matroskatagid.cpp | 2 +- matroska/matroskatrack.cpp | 20 +- matroska/matroskatrack.h | 2 +- mediafileinfo.cpp | 42 +- mediafileinfo.h | 8 +- mediaformat.cpp | 2 +- mp4/mp4atom.cpp | 12 +- mp4/mp4atom.h | 4 +- mp4/mp4container.cpp | 10 +- mp4/mp4container.h | 8 +- mp4/mp4ids.cpp | 4 +- mp4/mp4tag.cpp | 10 +- mp4/mp4tag.h | 4 +- mp4/mp4tagfield.cpp | 10 +- mp4/mp4tagfield.h | 4 +- mp4/mp4track.cpp | 18 +- mp4/mp4track.h | 4 +- mp4/mpeg4descriptor.cpp | 6 +- mp4/mpeg4descriptor.h | 2 +- mpegaudio/mpegaudioframe.cpp | 4 +- mpegaudio/mpegaudioframestream.cpp | 6 +- mpegaudio/mpegaudioframestream.h | 4 +- notification.cpp | 2 +- ogg/oggcontainer.cpp | 6 +- ogg/oggcontainer.h | 10 +- ogg/oggiterator.cpp | 4 +- ogg/oggiterator.h | 2 +- ogg/oggpage.cpp | 4 +- ogg/oggstream.cpp | 14 +- ogg/oggstream.h | 5 +- signature.cpp | 2 +- signature.h | 2 +- statusprovider.cpp | 2 +- statusprovider.h | 2 +- tag.cpp | 2 +- tag.h | 6 +- tagparser.pro | 5 +- tagtarget.cpp | 4 +- tagvalue.cpp | 4 +- tagvalue.h | 2 +- vorbis/vorbiscomment.cpp | 8 +- vorbis/vorbiscomment.h | 6 +- vorbis/vorbiscommentfield.cpp | 10 +- vorbis/vorbiscommentfield.h | 4 +- vorbis/vorbiscommentids.cpp | 2 +- vorbis/vorbisidentificationheader.cpp | 8 +- wav/waveaudiostream.cpp | 6 +- wav/waveaudiostream.h | 2 +- 104 files changed, 5713 insertions(+), 274 deletions(-) create mode 100644 aac/aaccodebook.cpp create mode 100644 aac/aaccodebook.h create mode 100644 aac/aacframe.cpp create mode 100644 aac/aacframe.h create mode 100644 caseinsensitivecomparer.h diff --git a/aac/aaccodebook.cpp b/aac/aaccodebook.cpp new file mode 100644 index 0000000..3715ada --- /dev/null +++ b/aac/aaccodebook.cpp @@ -0,0 +1,2618 @@ +#include "./aaccodebook.h" + +namespace Media { + +const AacHcb *const aacHcbTable[] = { + 0, aacHcb1Step1, aacHcb2Step1, 0, aacHcb4Step1, 0, aacHcb6Step1, 0, aacHcb8Step1, 0, aacHcb10Step1, aacHcb11Step1 +}; + +const AacHcb2Pair *const aacHcb2PairTable[] = { + 0, 0, 0, 0, 0, 0, aacHcb6Step2, 0, aacHcb8Step2, 0, aacHcb10Step2, aacHcb11Step2 +}; + +const AacHcb2Quad *const aacHcb2QuadTable[] = { + 0, aacHcb1Step2, aacHcb2Step2, 0, aacHcb4Step2, 0, 0, 0, 0, 0, 0, 0 +}; + +const AacHcbBinPair *const aacHcbBinTable[] = { + 0, 0, 0, 0, 0, aacHcb5, 0, aacHcb7, 0, aacHcb9, 0, 0 +}; + +const byte aacHcbN[] = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 }; + +uint8_t unsigned_cb[] = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, + /* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 +}; + +const int aacHcb2QuadTableSize[] = { 0, 114, 86, 0, 185, 0, 0, 0, 0, 0, 0, 0 }; +const int aacHcb2PairTableSize[] = { 0, 0, 0, 0, 0, 0, 126, 0, 83, 0, 210, 373 }; +const int aacHcbBinTableSize[] = { 0, 0, 0, 161, 0, 161, 0, 127, 0, 337, 0, 0 }; + +const AacHcb aacHcb1Step1[] = { + { /* 00000 */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* 10000 */ 1, 0 }, + { /* 10001 */ 2, 0 }, + { /* 10010 */ 3, 0 }, + { /* 10011 */ 4, 0 }, + { /* 10100 */ 5, 0 }, + { /* 10101 */ 6, 0 }, + { /* 10110 */ 7, 0 }, + { /* 10111 */ 8, 0 }, + + // 7 bit codewords + { /* 11000 */ 9, 2 }, + { /* 11001 */ 13, 2 }, + { /* 11010 */ 17, 2 }, + { /* 11011 */ 21, 2 }, + { /* 11100 */ 25, 2 }, + { /* 11101 */ 29, 2 }, + + // 9 bit codewords + { /* 11110 */ 33, 4 }, + + // 9/10/11 bit codewords + { /* 11111 */ 49, 6 } +}; + +const AacHcb2Quad aacHcb1Step2[] = { + // 1 bit codeword + { 1, 0, 0, 0, 0 }, + + // 5 bit codewords + { 5, 1, 0, 0, 0 }, + { 5, -1, 0, 0, 0 }, + { 5, 0, 0, 0, -1 }, + { 5, 0, 1, 0, 0 }, + { 5, 0, 0, 0, 1 }, + { 5, 0, 0, -1, 0 }, + { 5, 0, 0, 1, 0 }, + { 5, 0, -1, 0, 0 }, + + // 7 bit codewords + // first 5 bits: 11000 + { 7, 1, -1, 0, 0 }, + { 7, -1, 1, 0, 0 }, + { 7, 0, 0, -1, 1 }, + { 7, 0, 1, -1, 0 }, + // first 5 bits: 11001 + { 7, 0, -1, 1, 0 }, + { 7, 0, 0, 1, -1 }, + { 7, 1, 1, 0, 0 }, + { 7, 0, 0, -1, -1 }, + // first 5 bits: 11010 + { 7, -1, -1, 0, 0 }, + { 7, 0, -1, -1, 0 }, + { 7, 1, 0, -1, 0 }, + { 7, 0, 1, 0, -1 }, + // first 5 bits: 11011 + { 7, -1, 0, 1, 0 }, + { 7, 0, 0, 1, 1 }, + { 7, 1, 0, 1, 0 }, + { 7, 0, -1, 0, 1 }, + // first 5 bits: 11100 + { 7, 0, 1, 1, 0 }, + { 7, 0, 1, 0, 1 }, + { 7, -1, 0, -1, 0 }, + { 7, 1, 0, 0, 1 }, + // first 5 bits: 11101 + { 7, -1, 0, 0, -1 }, + { 7, 1, 0, 0, -1 }, + { 7, -1, 0, 0, 1 }, + { 7, 0, -1, 0, -1 }, + + // 9 bit codeword + // first 5 bits: 11110 + { 9, 1, 1, -1, 0 }, + { 9, -1, 1, -1, 0 }, + { 9, 1, -1, 1, 0 }, + { 9, 0, 1, 1, -1 }, + { 9, 0, 1, -1, 1 }, + { 9, 0, -1, 1, 1 }, + { 9, 0, -1, 1, -1 }, + { 9, 1, -1, -1, 0 }, + { 9, 1, 0, -1, 1 }, + { 9, 0, 1, -1, -1 }, + { 9, -1, 1, 1, 0 }, + { 9, -1, 0, 1, -1 }, + { 9, -1, -1, 1, 0 }, + { 9, 0, -1, -1, 1 }, + { 9, 1, -1, 0, 1 }, + { 9, 1, -1, 0, -1 }, + + // 9/10/11 bit codewords + // first 5 bits: 11111 + // 9 bit: reading 11 bits -> 2 too much so 4 entries for each codeword + { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, + { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, + { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, + { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, + { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, + { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, + { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, + { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, + // 10 bit: reading 11 bits -> 1 too much so 2 entries for each codeword + { 10, -1, -1, 0, 1 }, { 10, -1, -1, 0, 1 }, + { 10, -1, 0, -1, -1 }, { 10, -1, 0, -1, -1 }, + { 10, 1, 1, 0, -1 }, { 10, 1, 1, 0, -1 }, + { 10, 1, 0, -1, -1 }, { 10, 1, 0, -1, -1 }, + { 10, -1, 0, -1, 1 }, { 10, -1, 0, -1, 1 }, + { 10, -1, -1, 0, -1 }, { 10, -1, -1, 0, -1 }, + { 10, -1, 0, 1, 1 }, { 10, -1, 0, 1, 1 }, + { 10, 1, 0, 1, 1 }, { 10, 1, 0, 1, 1 }, + // 11 bit + { 11, 1, -1, 1, -1 }, + { 11, -1, 1, -1, 1 }, + { 11, -1, 1, 1, -1 }, + { 11, 1, -1, -1, 1 }, + { 11, 1, 1, 1, 1 }, + { 11, -1, -1, 1, 1 }, + { 11, 1, 1, -1, -1 }, + { 11, -1, -1, 1, -1 }, + { 11, -1, -1, -1, -1 }, + { 11, 1, 1, -1, 1 }, + { 11, 1, -1, 1, 1 }, + { 11, -1, 1, 1, 1 }, + { 11, -1, 1, -1, -1 }, + { 11, -1, -1, -1, 1 }, + { 11, 1, -1, -1, -1 }, + { 11, 1, 1, 1, -1 } +}; + +const AacHcb aacHcb2Step1[] = { + { /* 00000 */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* 00100 */ 1, 0 }, + { /* */ 1, 0 }, + { /* 00110 */ 2, 0 }, + { /* 00111 */ 3, 0 }, + { /* 01000 */ 4, 0 }, + { /* 01001 */ 5, 0 }, + { /* 01010 */ 6, 0 }, + { /* 01011 */ 7, 0 }, + { /* 01100 */ 8, 0 }, + + // 6 bit codewords + { /* 01101 */ 9, 1 }, + { /* 01110 */ 11, 1 }, + { /* 01111 */ 13, 1 }, + { /* 10000 */ 15, 1 }, + { /* 10001 */ 17, 1 }, + { /* 10010 */ 19, 1 }, + { /* 10011 */ 21, 1 }, + { /* 10100 */ 23, 1 }, + { /* 10101 */ 25, 1 }, + { /* 10110 */ 27, 1 }, + { /* 10111 */ 29, 1 }, + { /* 11000 */ 31, 1 }, + + // 7 bit codewords + { /* 11001 */ 33, 2 }, + { /* 11010 */ 37, 2 }, + { /* 11011 */ 41, 2 }, + + // 7/8 bit codewords + { /* 11100 */ 45, 3 }, + + // 8 bit codewords + { /* 11101 */ 53, 3 }, + { /* 11110 */ 61, 3 }, + + // 8/9 bit codewords + { /* 11111 */ 69, 4 } +}; + +const AacHcb2Quad aacHcb2Step2[] = { + // 3 bit codeword + { 3, 0, 0, 0, 0 }, + + // 4 bit codeword + { 4, 1, 0, 0, 0 }, + + // 5 bit codewords + { 5, -1, 0, 0, 0 }, + { 5, 0, 0, 0, 1 }, + { 5, 0, 0, -1, 0 }, + { 5, 0, 0, 0, -1 }, + { 5, 0, -1, 0, 0 }, + { 5, 0, 0, 1, 0 }, + { 5, 0, 1, 0, 0 }, + + // 6 bit codewords + { 6, 0, -1, 1, 0 }, + { 6, -1, 1, 0, 0 }, + { 6, 0, 1, -1, 0 }, + { 6, 0, 0, 1, -1 }, + { 6, 0, 1, 0, -1 }, + { 6, 0, 0, -1, 1 }, + { 6, -1, 0, 0, -1 }, + { 6, 1, -1, 0, 0 }, + { 6, 1, 0, -1, 0 }, + { 6, -1, -1, 0, 0 }, + { 6, 0, 0, -1, -1 }, + { 6, 1, 0, 1, 0 }, + { 6, 1, 0, 0, 1 }, + { 6, 0, -1, 0, 1 }, + { 6, -1, 0, 1, 0 }, + { 6, 0, 1, 0, 1 }, + { 6, 0, -1, -1, 0 }, + { 6, -1, 0, 0, 1 }, + { 6, 0, -1, 0, -1 }, + { 6, -1, 0, -1, 0 }, + { 6, 1, 1, 0, 0 }, + { 6, 0, 1, 1, 0 }, + { 6, 0, 0, 1, 1 }, + { 6, 1, 0, 0, -1 }, + + // 7 bit codewords + { 7, 0, 1, -1, 1 }, + { 7, 1, 0, -1, 1 }, + { 7, -1, 1, -1, 0 }, + { 7, 0, -1, 1, -1 }, + { 7, 1, -1, 1, 0 }, + { 7, 1, 1, 0, -1 }, + { 7, 1, 0, 1, 1 }, + { 7, -1, 1, 1, 0 }, + { 7, 0, -1, -1, 1 }, + { 7, 1, 1, 1, 0 }, + { 7, -1, 0, 1, -1 }, + { 7, -1, -1, -1, 0 }, + + // 7/8 bit codewords + { 7, -1, 0, -1, 1 }, { 7, -1, 0, -1, 1 }, + { 7, 1, -1, -1, 0 }, { 7, 1, -1, -1, 0 }, + { 7, 1, 1, -1, 0 }, { 7, 1, 1, -1, 0 }, + { 8, 1, -1, 0, 1 }, + { 8, -1, 1, 0, -1 }, + + // 8 bit codewords + { 8, -1, -1, 1, 0 }, + { 8, -1, 0, 1, 1 }, + { 8, -1, -1, 0, 1 }, + { 8, -1, -1, 0, -1 }, + { 8, 0, -1, -1, -1 }, + { 8, 1, 0, 1, -1 }, + { 8, 1, 0, -1, -1 }, + { 8, 0, 1, -1, -1 }, + { 8, 0, 1, 1, 1 }, + { 8, -1, 1, 0, 1 }, + { 8, -1, 0, -1, -1 }, + { 8, 0, 1, 1, -1 }, + { 8, 1, -1, 0, -1 }, + { 8, 0, -1, 1, 1 }, + { 8, 1, 1, 0, 1 }, + { 8, 1, -1, 1, -1 }, + + // 8/9 bit codewords + { 8, -1, 1, -1, 1 }, { 8, -1, 1, -1, 1 }, + { 9, 1, -1, -1, 1 }, + { 9, -1, -1, -1, -1 }, + { 9, -1, 1, 1, -1 }, + { 9, -1, 1, 1, 1 }, + { 9, 1, 1, 1, 1 }, + { 9, -1, -1, 1, -1 }, + { 9, 1, -1, 1, 1 }, + { 9, -1, 1, -1, -1 }, + { 9, -1, -1, 1, 1 }, + { 9, 1, 1, -1, -1 }, + { 9, 1, -1, -1, -1 }, + { 9, -1, -1, -1, 1 }, + { 9, 1, 1, -1, 1 }, + { 9, 1, 1, 1, -1 } +}; + +const AacHcbBinQuad aacHcb3[] = { + { /* 0 */ 0, { 1, 2, 0, 0 } }, + { /* 1 */ 1, { 0, 0, 0, 0 } }, // 0 + { /* 2 */ 0, { 1, 2, 0, 0 } }, + { /* 3 */ 0, { 2, 3, 0, 0 } }, + { /* 4 */ 0, { 3, 4, 0, 0 } }, + { /* 5 */ 0, { 4, 5, 0, 0 } }, + { /* 6 */ 0, { 5, 6, 0, 0 } }, + { /* 7 */ 0, { 6, 7, 0, 0 } }, + { /* 8 */ 0, { 7, 8, 0, 0 } }, + { /* 9 */ 1, { 1, 0, 0, 0 } }, // 1000 + { /* 10 */ 1, { 0, 0, 0, 1 } }, // 1001 + { /* 11 */ 1, { 0, 1, 0, 0 } }, // 1010 + { /* 12 */ 1, { 0, 0, 1, 0 } }, // 1011 + { /* 13 */ 0, { 4, 5, 0, 0 } }, + { /* 14 */ 0, { 5, 6, 0, 0 } }, + { /* 15 */ 0, { 6, 7, 0, 0 } }, + { /* 16 */ 0, { 7, 8, 0, 0 } }, + { /* 17 */ 1, { 1, 1, 0, 0 } }, + { /* 18 */ 1, { 0, 0, 1, 1 } }, + { /* 19 */ 0, { 6, 7, 0, 0 } }, + { /* 20 */ 0, { 7, 8, 0, 0 } }, + { /* 21 */ 0, { 8, 9, 0, 0 } }, + { /* 22 */ 0, { 9, 10, 0, 0 } }, + { /* 23 */ 0, { 10, 11, 0, 0 } }, + { /* 24 */ 0, { 11, 12, 0, 0 } }, + { /* 25 */ 1, { 0, 1, 1, 0 } }, // 110100 + { /* 26 */ 1, { 0, 1, 0, 1 } }, // 110101 + { /* 27 */ 1, { 1, 0, 1, 0 } }, // 110110 + { /* 28 */ 1, { 0, 1, 1, 1 } }, // 110111 + { /* 29 */ 1, { 1, 0, 0, 1 } }, // 111000 + { /* 30 */ 1, { 1, 1, 1, 0 } }, // 111001 + { /* 31 */ 0, { 6, 7, 0, 0 } }, + { /* 32 */ 0, { 7, 8, 0, 0 } }, + { /* 33 */ 0, { 8, 9, 0, 0 } }, + { /* 34 */ 0, { 9, 10, 0, 0 } }, + { /* 35 */ 0, { 10, 11, 0, 0 } }, + { /* 36 */ 0, { 11, 12, 0, 0 } }, + { /* 37 */ 1, { 1, 1, 1, 1 } }, // 1110100 + { /* 38 */ 1, { 1, 0, 1, 1 } }, // 1110101 + { /* 39 */ 1, { 1, 1, 0, 1 } }, // 1110110 + { /* 40 */ 0, { 9, 10, 0, 0 } }, + { /* 41 */ 0, { 10, 11, 0, 0 } }, + { /* 42 */ 0, { 11, 12, 0, 0 } }, + { /* 43 */ 0, { 12, 13, 0, 0 } }, + { /* 44 */ 0, { 13, 14, 0, 0 } }, + { /* 45 */ 0, { 14, 15, 0, 0 } }, + { /* 46 */ 0, { 15, 16, 0, 0 } }, + { /* 47 */ 0, { 16, 17, 0, 0 } }, + { /* 48 */ 0, { 17, 18, 0, 0 } }, + { /* 49 */ 1, { 2, 0, 0, 0 } }, // 11101110 + { /* 50 */ 1, { 0, 0, 0, 2 } }, // 11101111 + { /* 51 */ 1, { 0, 0, 1, 2 } }, // 11110000 + { /* 52 */ 1, { 2, 1, 0, 0 } }, // 11110001 + { /* 53 */ 1, { 1, 2, 1, 0 } }, // 11110010 + { /* 54 */ 0, { 13, 14, 0, 0 } }, + { /* 55 */ 0, { 14, 15, 0, 0 } }, + { /* 56 */ 0, { 15, 16, 0, 0 } }, + { /* 57 */ 0, { 16, 17, 0, 0 } }, + { /* 58 */ 0, { 17, 18, 0, 0 } }, + { /* 59 */ 0, { 18, 19, 0, 0 } }, + { /* 60 */ 0, { 19, 20, 0, 0 } }, + { /* 61 */ 0, { 20, 21, 0, 0 } }, + { /* 62 */ 0, { 21, 22, 0, 0 } }, + { /* 63 */ 0, { 22, 23, 0, 0 } }, + { /* 64 */ 0, { 23, 24, 0, 0 } }, + { /* 65 */ 0, { 24, 25, 0, 0 } }, + { /* 66 */ 0, { 25, 26, 0, 0 } }, + { /* 67 */ 1, { 0, 0, 2, 1 } }, + { /* 68 */ 1, { 0, 1, 2, 1 } }, + { /* 69 */ 1, { 1, 2, 0, 0 } }, + { /* 70 */ 1, { 0, 1, 1, 2 } }, + { /* 71 */ 1, { 2, 1, 1, 0 } }, + { /* 72 */ 1, { 0, 0, 2, 0 } }, + { /* 73 */ 1, { 0, 2, 1, 0 } }, + { /* 74 */ 1, { 0, 1, 2, 0 } }, + { /* 75 */ 1, { 0, 2, 0, 0 } }, + { /* 76 */ 1, { 0, 1, 0, 2 } }, + { /* 77 */ 1, { 2, 0, 1, 0 } }, + { /* 78 */ 1, { 1, 2, 1, 1 } }, + { /* 79 */ 1, { 0, 2, 1, 1 } }, + { /* 80 */ 1, { 1, 1, 2, 0 } }, + { /* 81 */ 1, { 1, 1, 2, 1 } }, + { /* 82 */ 0, { 11, 12, 0, 0 } }, + { /* 83 */ 0, { 12, 13, 0, 0 } }, + { /* 84 */ 0, { 13, 14, 0, 0 } }, + { /* 85 */ 0, { 14, 15, 0, 0 } }, + { /* 86 */ 0, { 15, 16, 0, 0 } }, + { /* 87 */ 0, { 16, 17, 0, 0 } }, + { /* 88 */ 0, { 17, 18, 0, 0 } }, + { /* 89 */ 0, { 18, 19, 0, 0 } }, + { /* 90 */ 0, { 19, 20, 0, 0 } }, + { /* 91 */ 0, { 20, 21, 0, 0 } }, + { /* 92 */ 0, { 21, 22, 0, 0 } }, + { /* 93 */ 1, { 1, 2, 0, 1 } }, // 1111101010 + { /* 94 */ 1, { 1, 0, 2, 0 } }, // 1111101011 + { /* 95 */ 1, { 1, 0, 2, 1 } }, // 1111101100 + { /* 96 */ 1, { 0, 2, 0, 1 } }, // 1111101101 + { /* 97 */ 1, { 2, 1, 1, 1 } }, // 1111101110 + { /* 98 */ 1, { 1, 1, 1, 2 } }, // 1111101111 + { /* 99 */ 1, { 2, 1, 0, 1 } }, // 1111110000 + { /* 00 */ 1, { 1, 0, 1, 2 } }, // 1111110001 + { /* 01 */ 1, { 0, 0, 2, 2 } }, // 1111110010 + { /* 02 */ 1, { 0, 1, 2, 2 } }, // 1111110011 + { /* 03 */ 1, { 2, 2, 1, 0 } }, // 1111110100 + { /* 04 */ 1, { 1, 2, 2, 0 } }, // 1111110101 + { /* 05 */ 1, { 1, 0, 0, 2 } }, // 1111110110 + { /* 06 */ 1, { 2, 0, 0, 1 } }, // 1111110111 + { /* 07 */ 1, { 0, 2, 2, 1 } }, // 1111111000 + { /* 08 */ 0, { 7, 8, 0, 0 } }, + { /* 09 */ 0, { 8, 9, 0, 0 } }, + { /* 10 */ 0, { 9, 10, 0, 0 } }, + { /* 11 */ 0, { 10, 11, 0, 0 } }, + { /* 12 */ 0, { 11, 12, 0, 0 } }, + { /* 13 */ 0, { 12, 13, 0, 0 } }, + { /* 14 */ 0, { 13, 14, 0, 0 } }, + { /* 15 */ 1, { 2, 2, 0, 0 } }, // 11111110010 + { /* 16 */ 1, { 1, 2, 2, 1 } }, // 11111110011 + { /* 17 */ 1, { 1, 1, 0, 2 } }, // 11111110100 + { /* 18 */ 1, { 2, 0, 1, 1 } }, // 11111110101 + { /* 19 */ 1, { 1, 1, 2, 2 } }, // 11111110110 + { /* 20 */ 1, { 2, 2, 1, 1 } }, // 11111110111 + { /* 21 */ 1, { 0, 2, 2, 0 } }, // 11111111000 + { /* 22 */ 1, { 0, 2, 1, 2 } }, // 11111111001 + { /* 23 */ 0, { 6, 7, 0, 0 } }, + { /* 24 */ 0, { 7, 8, 0, 0 } }, + { /* 25 */ 0, { 8, 9, 0, 0 } }, + { /* 26 */ 0, { 9, 10, 0, 0 } }, + { /* 27 */ 0, { 10, 11, 0, 0 } }, + { /* 28 */ 0, { 11, 12, 0, 0 } }, + { /* 29 */ 1, { 1, 0, 2, 2 } }, // 111111110100 + { /* 30 */ 1, { 2, 2, 0, 1 } }, // 111111110101 + { /* 31 */ 1, { 2, 1, 2, 0 } }, // 111111110110 + { /* 32 */ 1, { 2, 2, 2, 0 } }, // 111111110111 + { /* 33 */ 1, { 0, 2, 2, 2 } }, // 111111111000 + { /* 34 */ 1, { 2, 2, 2, 1 } }, // 111111111001 + { /* 35 */ 1, { 2, 1, 2, 1 } }, // 111111111010 + { /* 36 */ 1, { 1, 2, 1, 2 } }, // 111111111011 + { /* 37 */ 1, { 1, 2, 2, 2 } }, // 111111111100 + { /* 38 */ 0, { 3, 4, 0, 0 } }, + { /* 39 */ 0, { 4, 5, 0, 0 } }, + { /* 40 */ 0, { 5, 6, 0, 0 } }, + { /* 41 */ 1, { 0, 2, 0, 2 } }, // 1111111111010 + { /* 42 */ 1, { 2, 0, 2, 0 } }, // 1111111111011 + { /* 43 */ 1, { 1, 2, 0, 2 } }, // 1111111111100 + { /* 44 */ 0, { 3, 4, 0, 0 } }, + { /* 45 */ 0, { 4, 5, 0, 0 } }, + { /* 46 */ 0, { 5, 6, 0, 0 } }, + { /* 47 */ 1, { 2, 0, 2, 1 } }, // 11111111111010 + { /* 48 */ 1, { 2, 1, 1, 2 } }, // 11111111111011 + { /* 49 */ 1, { 2, 1, 0, 2 } }, // 11111111111100 + { /* 50 */ 0, { 3, 4, 0, 0 } }, + { /* 51 */ 0, { 4, 5, 0, 0 } }, + { /* 52 */ 0, { 5, 6, 0, 0 } }, + { /* 53 */ 1, { 2, 2, 2, 2 } }, // 111111111111010 + { /* 54 */ 1, { 2, 2, 1, 2 } }, // 111111111111011 + { /* 55 */ 1, { 2, 1, 2, 2 } }, // 111111111111100 + { /* 56 */ 1, { 2, 0, 1, 2 } }, // 111111111111101 + { /* 57 */ 1, { 2, 0, 0, 2 } }, // 111111111111110 + { /* 58 */ 0, { 1, 2, 0, 0 } }, + { /* 59 */ 1, { 2, 2, 0, 2 } }, // 1111111111111110 + { /* 60 */ 1, { 2, 0, 2, 2 } } // 1111111111111111 +}; + +const AacHcb aacHcb4Step1[] = { + // 4 bit codewords + { /* 00000 */ 0, 0 }, + { /* */ 0, 0 }, + { /* 00010 */ 1, 0 }, + { /* */ 1, 0 }, + { /* 00100 */ 2, 0 }, + { /* */ 2, 0 }, + { /* 00110 */ 3, 0 }, + { /* */ 3, 0 }, + { /* 01000 */ 4, 0 }, + { /* */ 4, 0 }, + { /* 01010 */ 5, 0 }, + { /* */ 5, 0 }, + { /* 01100 */ 6, 0 }, + { /* */ 6, 0 }, + { /* 01110 */ 7, 0 }, + { /* */ 7, 0 }, + { /* 10000 */ 8, 0 }, + { /* */ 8, 0 }, + { /* 10010 */ 9, 0 }, + { /* */ 9, 0 }, + + // 5 bit codewords + { /* 10100 */ 10, 0 }, + { /* 10101 */ 11, 0 }, + { /* 10110 */ 12, 0 }, + { /* 10111 */ 13, 0 }, + { /* 11000 */ 14, 0 }, + { /* 11001 */ 15, 0 }, + + // 7 bit codewords + { /* 11010 */ 16, 2 }, + { /* 11011 */ 20, 2 }, + + // 7/8 bit codewords + { /* 11100 */ 24, 3 }, + + // 8 bit codewords + { /* 11101 */ 32, 3 }, + + // 8/9 bit codewords + { /* 11110 */ 40, 4 }, + + // 9/10/11/12 bit codewords + { /* 11111 */ 56, 7 } +}; + +const AacHcb2Quad aacHcb4Step2[] = { + // 4 bit codewords + { 4, 1, 1, 1, 1 }, + { 4, 0, 1, 1, 1 }, + { 4, 1, 1, 0, 1 }, + { 4, 1, 1, 1, 0 }, + { 4, 1, 0, 1, 1 }, + { 4, 1, 0, 0, 0 }, + { 4, 1, 1, 0, 0 }, + { 4, 0, 0, 0, 0 }, + { 4, 0, 0, 1, 1 }, + { 4, 1, 0, 1, 0 }, + + // 5 bit codewords + { 5, 1, 0, 0, 1 }, + { 5, 0, 1, 1, 0 }, + { 5, 0, 0, 0, 1 }, + { 5, 0, 1, 0, 1 }, + { 5, 0, 0, 1, 0 }, + { 5, 0, 1, 0, 0 }, + + // 7 bit codewords + // first 5 bits: 11010 + { 7, 2, 1, 1, 1 }, + { 7, 1, 1, 2, 1 }, + { 7, 1, 2, 1, 1 }, + { 7, 1, 1, 1, 2 }, + // first 5 bits: 11011 + { 7, 2, 1, 1, 0 }, + { 7, 2, 1, 0, 1 }, + { 7, 1, 2, 1, 0 }, + { 7, 2, 0, 1, 1 }, + + // 7/8 bit codewords + // first 5 bits: 11100 + { 7, 0, 1, 2, 1 }, { 7, 0, 1, 2, 1 }, + { 8, 0, 1, 1, 2 }, + { 8, 1, 1, 2, 0 }, + { 8, 0, 2, 1, 1 }, + { 8, 1, 0, 1, 2 }, + { 8, 1, 2, 0, 1 }, + { 8, 1, 1, 0, 2 }, + + // 8 bit codewords + { 8, 1, 0, 2, 1 }, + { 8, 2, 1, 0, 0 }, + { 8, 2, 0, 1, 0 }, + { 8, 1, 2, 0, 0 }, + { 8, 2, 0, 0, 1 }, + { 8, 0, 1, 0, 2 }, + { 8, 0, 2, 1, 0 }, + { 8, 0, 0, 1, 2 }, + + // 8/9 bit codewords + { 8, 0, 1, 2, 0 }, { 8, 0, 1, 2, 0 }, + { 8, 0, 2, 0, 1 }, { 8, 0, 2, 0, 1 }, + { 8, 1, 0, 0, 2 }, { 8, 1, 0, 0, 2 }, + { 8, 0, 0, 2, 1 }, { 8, 0, 0, 2, 1 }, + { 8, 1, 0, 2, 0 }, { 8, 1, 0, 2, 0 }, + { 8, 2, 0, 0, 0 }, { 8, 2, 0, 0, 0 }, + { 8, 0, 0, 0, 2 }, { 8, 0, 0, 0, 2 }, + { 9, 0, 2, 0, 0 }, + { 9, 0, 0, 2, 0 }, + + // 9/10/11 bit codewords + // 9 bit codewords repeated 2^3 = 8 times + { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, + { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, + { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, + { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, + { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, + { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, + { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, + { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, + { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, + { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, + { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, + { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, + // 10 bit codewords repeated 2^2 = 4 times + { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, + { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, + { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, + { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, + { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, + { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, + { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, + { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, + { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, + { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, + { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, + { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, + { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, + { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, + // 11 bit codewords repeated 2^1 = 2 times + { 11, 2, 1, 2, 2 }, { 11, 2, 1, 2, 2 }, + { 11, 2, 2, 1, 2 }, { 11, 2, 2, 1, 2 }, + { 11, 0, 2, 2, 0 }, { 11, 0, 2, 2, 0 }, + { 11, 2, 2, 0, 0 }, { 11, 2, 2, 0, 0 }, + { 11, 0, 0, 2, 2 }, { 11, 0, 0, 2, 2 }, + { 11, 2, 0, 2, 0 }, { 11, 2, 0, 2, 0 }, + { 11, 0, 2, 0, 2 }, { 11, 0, 2, 0, 2 }, + { 11, 2, 0, 0, 2 }, { 11, 2, 0, 0, 2 }, + { 11, 2, 2, 2, 2 }, { 11, 2, 2, 2, 2 }, + { 11, 0, 2, 2, 2 }, { 11, 0, 2, 2, 2 }, + { 11, 2, 2, 2, 0 }, { 11, 2, 2, 2, 0 }, + // 12 bit codewords + { 12, 2, 2, 0, 2 }, + { 12, 2, 0, 2, 2 }, +}; + +const AacHcbBinPair aacHcb5[] = { + { /* 0 */ 0, { 1, 2 } }, + { /* 1 */ 1, { 0, 0 } }, // 0 + { /* 2 */ 0, { 1, 2 } }, + { /* 3 */ 0, { 2, 3 } }, + { /* 4 */ 0, { 3, 4 } }, + { /* 5 */ 0, { 4, 5 } }, + { /* 6 */ 0, { 5, 6 } }, + { /* 7 */ 0, { 6, 7 } }, + { /* 8 */ 0, { 7, 8 } }, + { /* 9 */ 1, { -1, 0 } }, // 1000 + { /* 10 */ 1, { 1, 0 } }, // 1001 + { /* 11 */ 1, { 0, 1 } }, // 1010 + { /* 12 */ 1, { 0, -1 } }, // 1011 + { /* 13 */ 0, { 4, 5 } }, + { /* 14 */ 0, { 5, 6 } }, + { /* 15 */ 0, { 6, 7 } }, + { /* 16 */ 0, { 7, 8 } }, + { /* 17 */ 1, { 1, -1 } }, + { /* 18 */ 1, { -1, 1 } }, + { /* 19 */ 1, { -1, -1 } }, + { /* 20 */ 1, { 1, 1 } }, + { /* 21 */ 0, { 4, 5 } }, + { /* 22 */ 0, { 5, 6 } }, + { /* 23 */ 0, { 6, 7 } }, + { /* 24 */ 0, { 7, 8 } }, + { /* 25 */ 0, { 8, 9 } }, + { /* 26 */ 0, { 9, 10 } }, + { /* 27 */ 0, { 10, 11 } }, + { /* 28 */ 0, { 11, 12 } }, + { /* 29 */ 0, { 12, 13 } }, + { /* 30 */ 0, { 13, 14 } }, + { /* 31 */ 0, { 14, 15 } }, + { /* 32 */ 0, { 15, 16 } }, + { /* 33 */ 1, { -2, 0 } }, + { /* 34 */ 1, { 0, 2 } }, + { /* 35 */ 1, { 2, 0 } }, + { /* 36 */ 1, { 0, -2 } }, + { /* 37 */ 0, { 12, 13 } }, + { /* 38 */ 0, { 13, 14 } }, + { /* 39 */ 0, { 14, 15 } }, + { /* 40 */ 0, { 15, 16 } }, + { /* 41 */ 0, { 16, 17 } }, + { /* 42 */ 0, { 17, 18 } }, + { /* 43 */ 0, { 18, 19 } }, + { /* 44 */ 0, { 19, 20 } }, + { /* 45 */ 0, { 20, 21 } }, + { /* 46 */ 0, { 21, 22 } }, + { /* 47 */ 0, { 22, 23 } }, + { /* 48 */ 0, { 23, 24 } }, + { /* 49 */ 1, { -2, -1 } }, + { /* 50 */ 1, { 2, 1 } }, + { /* 51 */ 1, { -1, -2 } }, + { /* 52 */ 1, { 1, 2 } }, + { /* 53 */ 1, { -2, 1 } }, + { /* 54 */ 1, { 2, -1 } }, + { /* 55 */ 1, { -1, 2 } }, + { /* 56 */ 1, { 1, -2 } }, + { /* 57 */ 1, { -3, 0 } }, + { /* 58 */ 1, { 3, 0 } }, + { /* 59 */ 1, { 0, -3 } }, + { /* 60 */ 1, { 0, 3 } }, + { /* 61 */ 0, { 12, 13 } }, + { /* 62 */ 0, { 13, 14 } }, + { /* 63 */ 0, { 14, 15 } }, + { /* 64 */ 0, { 15, 16 } }, + { /* 65 */ 0, { 16, 17 } }, + { /* 66 */ 0, { 17, 18 } }, + { /* 67 */ 0, { 18, 19 } }, + { /* 68 */ 0, { 19, 20 } }, + { /* 69 */ 0, { 20, 21 } }, + { /* 70 */ 0, { 21, 22 } }, + { /* 71 */ 0, { 22, 23 } }, + { /* 72 */ 0, { 23, 24 } }, + { /* 73 */ 1, { -3, -1 } }, + { /* 74 */ 1, { 1, 3 } }, + { /* 75 */ 1, { 3, 1 } }, + { /* 76 */ 1, { -1, -3 } }, + { /* 77 */ 1, { -3, 1 } }, + { /* 78 */ 1, { 3, -1 } }, + { /* 79 */ 1, { 1, -3 } }, + { /* 80 */ 1, { -1, 3 } }, + { /* 81 */ 1, { -2, 2 } }, + { /* 82 */ 1, { 2, 2 } }, + { /* 83 */ 1, { -2, -2 } }, + { /* 84 */ 1, { 2, -2 } }, + { /* 85 */ 0, { 12, 13 } }, + { /* 86 */ 0, { 13, 14 } }, + { /* 87 */ 0, { 14, 15 } }, + { /* 88 */ 0, { 15, 16 } }, + { /* 89 */ 0, { 16, 17 } }, + { /* 90 */ 0, { 17, 18 } }, + { /* 91 */ 0, { 18, 19 } }, + { /* 92 */ 0, { 19, 20 } }, + { /* 93 */ 0, { 20, 21 } }, + { /* 94 */ 0, { 21, 22 } }, + { /* 95 */ 0, { 22, 23 } }, + { /* 96 */ 0, { 23, 24 } }, + { /* 97 */ 1, { -3, -2 } }, + { /* 98 */ 1, { 3, -2 } }, + { /* 99 */ 1, { -2, 3 } }, + { /* 00 */ 1, { 2, -3 } }, + { /* 01 */ 1, { 3, 2 } }, + { /* 02 */ 1, { 2, 3 } }, + { /* 03 */ 1, { -3, 2 } }, + { /* 04 */ 1, { -2, -3 } }, + { /* 05 */ 1, { 0, -4 } }, + { /* 06 */ 1, { -4, 0 } }, + { /* 07 */ 1, { 4, 1 } }, + { /* 08 */ 1, { 4, 0 } }, + { /* 09 */ 0, { 12, 13 } }, + { /* 10 */ 0, { 13, 14 } }, + { /* 11 */ 0, { 14, 15 } }, + { /* 12 */ 0, { 15, 16 } }, + { /* 13 */ 0, { 16, 17 } }, + { /* 14 */ 0, { 17, 18 } }, + { /* 15 */ 0, { 18, 19 } }, + { /* 16 */ 0, { 19, 20 } }, + { /* 17 */ 0, { 20, 21 } }, + { /* 18 */ 0, { 21, 22 } }, + { /* 19 */ 0, { 22, 23 } }, + { /* 20 */ 0, { 23, 24 } }, + { /* 21 */ 1, { -4, -1 } }, + { /* 22 */ 1, { 0, 4 } }, + { /* 23 */ 1, { 4, -1 } }, + { /* 24 */ 1, { -1, -4 } }, + { /* 25 */ 1, { 1, 4 } }, + { /* 26 */ 1, { -1, 4 } }, + { /* 27 */ 1, { -4, 1 } }, + { /* 28 */ 1, { 1, -4 } }, + { /* 29 */ 1, { 3, -3 } }, + { /* 30 */ 1, { -3, -3 } }, + { /* 31 */ 1, { -3, 3 } }, + { /* 32 */ 1, { -2, 4 } }, + { /* 33 */ 1, { -4, -2 } }, + { /* 34 */ 1, { 4, 2 } }, + { /* 35 */ 1, { 2, -4 } }, + { /* 36 */ 1, { 2, 4 } }, + { /* 37 */ 1, { 3, 3 } }, + { /* 38 */ 1, { -4, 2 } }, + { /* 39 */ 0, { 6, 7 } }, + { /* 40 */ 0, { 7, 8 } }, + { /* 41 */ 0, { 8, 9 } }, + { /* 42 */ 0, { 9, 10 } }, + { /* 43 */ 0, { 10, 11 } }, + { /* 44 */ 0, { 11, 12 } }, + { /* 45 */ 1, { -2, -4 } }, + { /* 46 */ 1, { 4, -2 } }, + { /* 47 */ 1, { 3, -4 } }, + { /* 48 */ 1, { -4, -3 } }, + { /* 49 */ 1, { -4, 3 } }, + { /* 50 */ 1, { 3, 4 } }, + { /* 51 */ 1, { -3, 4 } }, + { /* 52 */ 1, { 4, 3 } }, + { /* 53 */ 1, { 4, -3 } }, + { /* 54 */ 1, { -3, -4 } }, + { /* 55 */ 0, { 2, 3 } }, + { /* 56 */ 0, { 3, 4 } }, + { /* 57 */ 1, { 4, -4 } }, + { /* 58 */ 1, { -4, 4 } }, + { /* 59 */ 1, { 4, 4 } }, + { /* 60 */ 1, { -4, -4 } } +}; + +const AacHcb aacHcb6Step1[] = { + // 4 bit codewords + { /* 00000 */ 0, 0 }, + { /* */ 0, 0 }, + { /* 00010 */ 1, 0 }, + { /* */ 1, 0 }, + { /* 00100 */ 2, 0 }, + { /* */ 2, 0 }, + { /* 00110 */ 3, 0 }, + { /* */ 3, 0 }, + { /* 01000 */ 4, 0 }, + { /* */ 4, 0 }, + { /* 01010 */ 5, 0 }, + { /* */ 5, 0 }, + { /* 01100 */ 6, 0 }, + { /* */ 6, 0 }, + { /* 01110 */ 7, 0 }, + { /* */ 7, 0 }, + { /* 10000 */ 8, 0 }, + { /* */ 8, 0 }, + + // 6 bit codewords + { /* 10010 */ 9, 1 }, + { /* 10011 */ 11, 1 }, + { /* 10100 */ 13, 1 }, + { /* 10101 */ 15, 1 }, + { /* 10110 */ 17, 1 }, + { /* 10111 */ 19, 1 }, + { /* 11000 */ 21, 1 }, + { /* 11001 */ 23, 1 }, + + // 7 bit codewords + { /* 11010 */ 25, 2 }, + { /* 11011 */ 29, 2 }, + { /* 11100 */ 33, 2 }, + + // 7/8 bit codewords + { /* 11101 */ 37, 3 }, + + // 8/9 bit codewords + { /* 11110 */ 45, 4 }, + + // 9/10/11 bit codewords + { /* 11111 */ 61, 6 } +}; + +const AacHcb2Pair aacHcb6Step2[] = { + // 4 bit codewords + { 4, 0, 0 }, + { 4, 1, 0 }, + { 4, 0, -1 }, + { 4, 0, 1 }, + { 4, -1, 0 }, + { 4, 1, 1 }, + { 4, -1, 1 }, + { 4, 1, -1 }, + { 4, -1, -1 }, + + // 6 bit codewords + { 6, 2, -1 }, + { 6, 2, 1 }, + { 6, -2, 1 }, + { 6, -2, -1 }, + { 6, -2, 0 }, + { 6, -1, 2 }, + { 6, 2, 0 }, + { 6, 1, -2 }, + { 6, 1, 2 }, + { 6, 0, -2 }, + { 6, -1, -2 }, + { 6, 0, 2 }, + { 6, 2, -2 }, + { 6, -2, 2 }, + { 6, -2, -2 }, + { 6, 2, 2 }, + + // 7 bit codewords + { 7, -3, 1 }, + { 7, 3, 1 }, + { 7, 3, -1 }, + { 7, -1, 3 }, + { 7, -3, -1 }, + { 7, 1, 3 }, + { 7, 1, -3 }, + { 7, -1, -3 }, + { 7, 3, 0 }, + { 7, -3, 0 }, + { 7, 0, -3 }, + { 7, 0, 3 }, + + // 7/8 bit codewords + { 7, 3, 2 }, { 7, 3, 2 }, + { 8, -3, -2 }, + { 8, -2, 3 }, + { 8, 2, 3 }, + { 8, 3, -2 }, + { 8, 2, -3 }, + { 8, -2, -3 }, + + // 8 bit codewords + { 8, -3, 2 }, { 8, -3, 2 }, + { 8, 3, 3 }, { 8, 3, 3 }, + { 9, 3, -3 }, + { 9, -3, -3 }, + { 9, -3, 3 }, + { 9, 1, -4 }, + { 9, -1, -4 }, + { 9, 4, 1 }, + { 9, -4, 1 }, + { 9, -4, -1 }, + { 9, 1, 4 }, + { 9, 4, -1 }, + { 9, -1, 4 }, + { 9, 0, -4 }, + + // 9/10/11 bit codewords + { 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 }, + { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 }, + { 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 }, + { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 }, + { 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 }, + { 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 }, + { 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 }, + { 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 }, + { 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 }, + { 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 }, + { 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 }, + { 10, -3, -4 }, { 10, -3, -4 }, + { 10, -3, 4 }, { 10, -3, 4 }, + { 10, 3, -4 }, { 10, 3, -4 }, + { 10, 4, -3 }, { 10, 4, -3 }, + { 10, 3, 4 }, { 10, 3, 4 }, + { 10, 4, 3 }, { 10, 4, 3 }, + { 10, -4, 3 }, { 10, -4, 3 }, + { 10, -4, -3 }, { 10, -4, -3 }, + { 11, 4, 4 }, + { 11, -4, 4 }, + { 11, -4, -4 }, + { 11, 4, -4 } +}; + +const AacHcbBinPair aacHcb7[] = { + { /* 0 */ 0, { 1, 2 } }, + { /* 1 */ 1, { 0, 0 } }, + { /* 2 */ 0, { 1, 2 } }, + { /* 3 */ 0, { 2, 3 } }, + { /* 4 */ 0, { 3, 4 } }, + { /* 5 */ 1, { 1, 0 } }, + { /* 6 */ 1, { 0, 1 } }, + { /* 7 */ 0, { 2, 3 } }, + { /* 8 */ 0, { 3, 4 } }, + { /* 9 */ 1, { 1, 1 } }, + { /* 10 */ 0, { 3, 4 } }, + { /* 11 */ 0, { 4, 5 } }, + { /* 12 */ 0, { 5, 6 } }, + { /* 13 */ 0, { 6, 7 } }, + { /* 14 */ 0, { 7, 8 } }, + { /* 15 */ 0, { 8, 9 } }, + { /* 16 */ 0, { 9, 10 } }, + { /* 17 */ 0, { 10, 11 } }, + { /* 18 */ 0, { 11, 12 } }, + { /* 19 */ 1, { 2, 1 } }, + { /* 20 */ 1, { 1, 2 } }, + { /* 21 */ 1, { 2, 0 } }, + { /* 22 */ 1, { 0, 2 } }, + { /* 23 */ 0, { 8, 9 } }, + { /* 24 */ 0, { 9, 10 } }, + { /* 25 */ 0, { 10, 11 } }, + { /* 26 */ 0, { 11, 12 } }, + { /* 27 */ 0, { 12, 13 } }, + { /* 28 */ 0, { 13, 14 } }, + { /* 29 */ 0, { 14, 15 } }, + { /* 30 */ 0, { 15, 16 } }, + { /* 31 */ 1, { 3, 1 } }, + { /* 32 */ 1, { 1, 3 } }, + { /* 33 */ 1, { 2, 2 } }, + { /* 34 */ 1, { 3, 0 } }, + { /* 35 */ 1, { 0, 3 } }, + { /* 36 */ 0, { 11, 12 } }, + { /* 37 */ 0, { 12, 13 } }, + { /* 38 */ 0, { 13, 14 } }, + { /* 39 */ 0, { 14, 15 } }, + { /* 40 */ 0, { 15, 16 } }, + { /* 41 */ 0, { 16, 17 } }, + { /* 42 */ 0, { 17, 18 } }, + { /* 43 */ 0, { 18, 19 } }, + { /* 44 */ 0, { 19, 20 } }, + { /* 45 */ 0, { 20, 21 } }, + { /* 46 */ 0, { 21, 22 } }, + { /* 47 */ 1, { 2, 3 } }, + { /* 48 */ 1, { 3, 2 } }, + { /* 49 */ 1, { 1, 4 } }, + { /* 50 */ 1, { 4, 1 } }, + { /* 51 */ 1, { 1, 5 } }, + { /* 52 */ 1, { 5, 1 } }, + { /* 53 */ 1, { 3, 3 } }, + { /* 54 */ 1, { 2, 4 } }, + { /* 55 */ 1, { 0, 4 } }, + { /* 56 */ 1, { 4, 0 } }, + { /* 57 */ 0, { 12, 13 } }, + { /* 58 */ 0, { 13, 14 } }, + { /* 59 */ 0, { 14, 15 } }, + { /* 60 */ 0, { 15, 16 } }, + { /* 61 */ 0, { 16, 17 } }, + { /* 62 */ 0, { 17, 18 } }, + { /* 63 */ 0, { 18, 19 } }, + { /* 64 */ 0, { 19, 20 } }, + { /* 65 */ 0, { 20, 21 } }, + { /* 66 */ 0, { 21, 22 } }, + { /* 67 */ 0, { 22, 23 } }, + { /* 68 */ 0, { 23, 24 } }, + { /* 69 */ 1, { 4, 2 } }, + { /* 70 */ 1, { 2, 5 } }, + { /* 71 */ 1, { 5, 2 } }, + { /* 72 */ 1, { 0, 5 } }, + { /* 73 */ 1, { 6, 1 } }, + { /* 74 */ 1, { 5, 0 } }, + { /* 75 */ 1, { 1, 6 } }, + { /* 76 */ 1, { 4, 3 } }, + { /* 77 */ 1, { 3, 5 } }, + { /* 78 */ 1, { 3, 4 } }, + { /* 79 */ 1, { 5, 3 } }, + { /* 80 */ 1, { 2, 6 } }, + { /* 81 */ 1, { 6, 2 } }, + { /* 82 */ 1, { 1, 7 } }, + { /* 83 */ 0, { 10, 11 } }, + { /* 84 */ 0, { 11, 12 } }, + { /* 85 */ 0, { 12, 13 } }, + { /* 86 */ 0, { 13, 14 } }, + { /* 87 */ 0, { 14, 15 } }, + { /* 88 */ 0, { 15, 16 } }, + { /* 89 */ 0, { 16, 17 } }, + { /* 90 */ 0, { 17, 18 } }, + { /* 91 */ 0, { 18, 19 } }, + { /* 92 */ 0, { 19, 20 } }, + { /* 93 */ 1, { 3, 6 } }, + { /* 94 */ 1, { 0, 6 } }, + { /* 95 */ 1, { 6, 0 } }, + { /* 96 */ 1, { 4, 4 } }, + { /* 97 */ 1, { 7, 1 } }, + { /* 98 */ 1, { 4, 5 } }, + { /* 99 */ 1, { 7, 2 } }, + { /* 00 */ 1, { 5, 4 } }, + { /* 01 */ 1, { 6, 3 } }, + { /* 02 */ 1, { 2, 7 } }, + { /* 03 */ 1, { 7, 3 } }, + { /* 04 */ 1, { 6, 4 } }, + { /* 05 */ 1, { 5, 5 } }, + { /* 06 */ 1, { 4, 6 } }, + { /* 07 */ 1, { 3, 7 } }, + { /* 08 */ 0, { 5, 6 } }, + { /* 09 */ 0, { 6, 7 } }, + { /* 10 */ 0, { 7, 8 } }, + { /* 11 */ 0, { 8, 9 } }, + { /* 12 */ 0, { 9, 10 } }, + { /* 13 */ 1, { 7, 0 } }, + { /* 14 */ 1, { 0, 7 } }, + { /* 15 */ 1, { 6, 5 } }, + { /* 16 */ 1, { 5, 6 } }, + { /* 17 */ 1, { 7, 4 } }, + { /* 18 */ 1, { 4, 7 } }, + { /* 19 */ 1, { 5, 7 } }, + { /* 20 */ 1, { 7, 5 } }, + { /* 21 */ 0, { 2, 3 } }, + { /* 22 */ 0, { 3, 4 } }, + { /* 23 */ 1, { 7, 6 } }, + { /* 24 */ 1, { 6, 6 } }, + { /* 25 */ 1, { 6, 7 } }, + { /* 26 */ 1, { 7, 7 } } +}; + +const AacHcb aacHcb8Step1[] = { + // 3 bit codeword + { /* 00000 */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + + // 4 bit codewords + { /* 00100 */ 1, 0 }, + { /* */ 1, 0 }, + { /* 00110 */ 2, 0 }, + { /* */ 2, 0 }, + { /* 01000 */ 3, 0 }, + { /* */ 3, 0 }, + { /* 01010 */ 4, 0 }, + { /* */ 4, 0 }, + { /* 01100 */ 5, 0 }, + { /* */ 5, 0 }, + + // 5 bit codewords + { /* 01110 */ 6, 0 }, + { /* 01111 */ 7, 0 }, + { /* 10000 */ 8, 0 }, + { /* 10001 */ 9, 0 }, + { /* 10010 */ 10, 0 }, + { /* 10011 */ 11, 0 }, + { /* 10100 */ 12, 0 }, + + // 6 bit codewords + { /* 10101 */ 13, 1 }, + { /* 10110 */ 15, 1 }, + { /* 10111 */ 17, 1 }, + { /* 11000 */ 19, 1 }, + { /* 11001 */ 21, 1 }, + + // 7 bit codewords + { /* 11010 */ 23, 2 }, + { /* 11011 */ 27, 2 }, + { /* 11100 */ 31, 2 }, + + // 7/8 bit codewords + { /* 11101 */ 35, 3 }, + + // 8 bit codewords + { /* 11110 */ 43, 3 }, + + // 8/9/10 bit codewords + { /* 11111 */ 51, 5 } +}; + +const AacHcb2Pair aacHcb8Step2[] = { + // 3 bit codeword + { 3, 1, 1 }, + + // 4 bit codewords + { 4, 2, 1 }, + { 4, 1, 0 }, + { 4, 1, 2 }, + { 4, 0, 1 }, + { 4, 2, 2 }, + + // 5 bit codewords + { 5, 0, 0 }, + { 5, 2, 0 }, + { 5, 0, 2 }, + { 5, 3, 1 }, + { 5, 1, 3 }, + { 5, 3, 2 }, + { 5, 2, 3 }, + + // 6 bit codewords + { 6, 3, 3 }, + { 6, 4, 1 }, + { 6, 1, 4 }, + { 6, 4, 2 }, + { 6, 2, 4 }, + { 6, 3, 0 }, + { 6, 0, 3 }, + { 6, 4, 3 }, + { 6, 3, 4 }, + { 6, 5, 2 }, + + // 7 bit codewords + { 7, 5, 1 }, + { 7, 2, 5 }, + { 7, 1, 5 }, + { 7, 5, 3 }, + { 7, 3, 5 }, + { 7, 4, 4 }, + { 7, 5, 4 }, + { 7, 0, 4 }, + { 7, 4, 5 }, + { 7, 4, 0 }, + { 7, 2, 6 }, + { 7, 6, 2 }, + + // 7/8 bit codewords + { 7, 6, 1 }, { 7, 6, 1 }, + { 7, 1, 6 }, { 7, 1, 6 }, + { 8, 3, 6 }, + { 8, 6, 3 }, + { 8, 5, 5 }, + { 8, 5, 0 }, + + // 8 bit codewords + { 8, 6, 4 }, + { 8, 0, 5 }, + { 8, 4, 6 }, + { 8, 7, 1 }, + { 8, 7, 2 }, + { 8, 2, 7 }, + { 8, 6, 5 }, + { 8, 7, 3 }, + + // 8/9/10 bit codewords + { 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 }, + { 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 }, + { 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 }, + { 9, 6, 6 }, { 9, 6, 6 }, + { 9, 7, 4 }, { 9, 7, 4 }, + { 9, 6, 0 }, { 9, 6, 0 }, + { 9, 4, 7 }, { 9, 4, 7 }, + { 9, 0, 6 }, { 9, 0, 6 }, + { 9, 7, 5 }, { 9, 7, 5 }, + { 9, 7, 6 }, { 9, 7, 6 }, + { 9, 6, 7 }, { 9, 6, 7 }, + { 10, 5, 7 }, + { 10, 7, 0 }, + { 10, 0, 7 }, + { 10, 7, 7 } +}; + +const AacHcbBinPair aacHcb9[] = { + { /* 0 */ 0, { 1, 2 } }, + { /* 1 */ 1, { 0, 0 } }, + { /* 2 */ 0, { 1, 2 } }, + { /* 3 */ 0, { 2, 3 } }, + { /* 4 */ 0, { 3, 4 } }, + { /* 5 */ 1, { 1, 0 } }, + { /* 6 */ 1, { 0, 1 } }, + { /* 7 */ 0, { 2, 3 } }, + { /* 8 */ 0, { 3, 4 } }, + { /* 9 */ 1, { 1, 1 } }, + { /* 10 */ 0, { 3, 4 } }, + { /* 11 */ 0, { 4, 5 } }, + { /* 12 */ 0, { 5, 6 } }, + { /* 13 */ 0, { 6, 7 } }, + { /* 14 */ 0, { 7, 8 } }, + { /* 15 */ 0, { 8, 9 } }, + { /* 16 */ 0, { 9, 10 } }, + { /* 17 */ 0, { 10, 11 } }, + { /* 18 */ 0, { 11, 12 } }, + { /* 19 */ 1, { 2, 1 } }, + { /* 20 */ 1, { 1, 2 } }, + { /* 21 */ 1, { 2, 0 } }, + { /* 22 */ 1, { 0, 2 } }, + { /* 23 */ 0, { 8, 9 } }, + { /* 24 */ 0, { 9, 10 } }, + { /* 25 */ 0, { 10, 11 } }, + { /* 26 */ 0, { 11, 12 } }, + { /* 27 */ 0, { 12, 13 } }, + { /* 28 */ 0, { 13, 14 } }, + { /* 29 */ 0, { 14, 15 } }, + { /* 30 */ 0, { 15, 16 } }, + { /* 31 */ 1, { 3, 1 } }, + { /* 32 */ 1, { 2, 2 } }, + { /* 33 */ 1, { 1, 3 } }, + { /* 34 */ 0, { 13, 14 } }, + { /* 35 */ 0, { 14, 15 } }, + { /* 36 */ 0, { 15, 16 } }, + { /* 37 */ 0, { 16, 17 } }, + { /* 38 */ 0, { 17, 18 } }, + { /* 39 */ 0, { 18, 19 } }, + { /* 40 */ 0, { 19, 20 } }, + { /* 41 */ 0, { 20, 21 } }, + { /* 42 */ 0, { 21, 22 } }, + { /* 43 */ 0, { 22, 23 } }, + { /* 44 */ 0, { 23, 24 } }, + { /* 45 */ 0, { 24, 25 } }, + { /* 46 */ 0, { 25, 26 } }, + { /* 47 */ 1, { 3, 0 } }, + { /* 48 */ 1, { 0, 3 } }, + { /* 49 */ 1, { 2, 3 } }, + { /* 50 */ 1, { 3, 2 } }, + { /* 51 */ 1, { 1, 4 } }, + { /* 52 */ 1, { 4, 1 } }, + { /* 53 */ 1, { 2, 4 } }, + { /* 54 */ 1, { 1, 5 } }, + { /* 55 */ 0, { 18, 19 } }, + { /* 56 */ 0, { 19, 20 } }, + { /* 57 */ 0, { 20, 21 } }, + { /* 58 */ 0, { 21, 22 } }, + { /* 59 */ 0, { 22, 23 } }, + { /* 60 */ 0, { 23, 24 } }, + { /* 61 */ 0, { 24, 25 } }, + { /* 62 */ 0, { 25, 26 } }, + { /* 63 */ 0, { 26, 27 } }, + { /* 64 */ 0, { 27, 28 } }, + { /* 65 */ 0, { 28, 29 } }, + { /* 66 */ 0, { 29, 30 } }, + { /* 67 */ 0, { 30, 31 } }, + { /* 68 */ 0, { 31, 32 } }, + { /* 69 */ 0, { 32, 33 } }, + { /* 70 */ 0, { 33, 34 } }, + { /* 71 */ 0, { 34, 35 } }, + { /* 72 */ 0, { 35, 36 } }, + { /* 73 */ 1, { 4, 2 } }, + { /* 74 */ 1, { 3, 3 } }, + { /* 75 */ 1, { 0, 4 } }, + { /* 76 */ 1, { 4, 0 } }, + { /* 77 */ 1, { 5, 1 } }, + { /* 78 */ 1, { 2, 5 } }, + { /* 79 */ 1, { 1, 6 } }, + { /* 80 */ 1, { 3, 4 } }, + { /* 81 */ 1, { 5, 2 } }, + { /* 82 */ 1, { 6, 1 } }, + { /* 83 */ 1, { 4, 3 } }, + { /* 84 */ 0, { 25, 26 } }, + { /* 85 */ 0, { 26, 27 } }, + { /* 86 */ 0, { 27, 28 } }, + { /* 87 */ 0, { 28, 29 } }, + { /* 88 */ 0, { 29, 30 } }, + { /* 89 */ 0, { 30, 31 } }, + { /* 90 */ 0, { 31, 32 } }, + { /* 91 */ 0, { 32, 33 } }, + { /* 92 */ 0, { 33, 34 } }, + { /* 93 */ 0, { 34, 35 } }, + { /* 94 */ 0, { 35, 36 } }, + { /* 95 */ 0, { 36, 37 } }, + { /* 96 */ 0, { 37, 38 } }, + { /* 97 */ 0, { 38, 39 } }, + { /* 98 */ 0, { 39, 40 } }, + { /* 99 */ 0, { 40, 41 } }, + { /* 00 */ 0, { 41, 42 } }, + { /* 01 */ 0, { 42, 43 } }, + { /* 02 */ 0, { 43, 44 } }, + { /* 03 */ 0, { 44, 45 } }, + { /* 04 */ 0, { 45, 46 } }, + { /* 05 */ 0, { 46, 47 } }, + { /* 06 */ 0, { 47, 48 } }, + { /* 07 */ 0, { 48, 49 } }, + { /* 08 */ 0, { 49, 50 } }, + { /* 09 */ 1, { 0, 5 } }, + { /* 10 */ 1, { 2, 6 } }, + { /* 11 */ 1, { 5, 0 } }, + { /* 12 */ 1, { 1, 7 } }, + { /* 13 */ 1, { 3, 5 } }, + { /* 14 */ 1, { 1, 8 } }, + { /* 15 */ 1, { 8, 1 } }, + { /* 16 */ 1, { 4, 4 } }, + { /* 17 */ 1, { 5, 3 } }, + { /* 18 */ 1, { 6, 2 } }, + { /* 19 */ 1, { 7, 1 } }, + { /* 20 */ 1, { 0, 6 } }, + { /* 21 */ 1, { 8, 2 } }, + { /* 22 */ 1, { 2, 8 } }, + { /* 23 */ 1, { 3, 6 } }, + { /* 24 */ 1, { 2, 7 } }, + { /* 25 */ 1, { 4, 5 } }, + { /* 26 */ 1, { 9, 1 } }, + { /* 27 */ 1, { 1, 9 } }, + { /* 28 */ 1, { 7, 2 } }, + { /* 29 */ 0, { 30, 31 } }, + { /* 30 */ 0, { 31, 32 } }, + { /* 31 */ 0, { 32, 33 } }, + { /* 32 */ 0, { 33, 34 } }, + { /* 33 */ 0, { 34, 35 } }, + { /* 34 */ 0, { 35, 36 } }, + { /* 35 */ 0, { 36, 37 } }, + { /* 36 */ 0, { 37, 38 } }, + { /* 37 */ 0, { 38, 39 } }, + { /* 38 */ 0, { 39, 40 } }, + { /* 39 */ 0, { 40, 41 } }, + { /* 40 */ 0, { 41, 42 } }, + { /* 41 */ 0, { 42, 43 } }, + { /* 42 */ 0, { 43, 44 } }, + { /* 43 */ 0, { 44, 45 } }, + { /* 44 */ 0, { 45, 46 } }, + { /* 45 */ 0, { 46, 47 } }, + { /* 46 */ 0, { 47, 48 } }, + { /* 47 */ 0, { 48, 49 } }, + { /* 48 */ 0, { 49, 50 } }, + { /* 49 */ 0, { 50, 51 } }, + { /* 50 */ 0, { 51, 52 } }, + { /* 51 */ 0, { 52, 53 } }, + { /* 52 */ 0, { 53, 54 } }, + { /* 53 */ 0, { 54, 55 } }, + { /* 54 */ 0, { 55, 56 } }, + { /* 55 */ 0, { 56, 57 } }, + { /* 56 */ 0, { 57, 58 } }, + { /* 57 */ 0, { 58, 59 } }, + { /* 58 */ 0, { 59, 60 } }, + { /* 59 */ 1, { 6, 0 } }, + { /* 60 */ 1, { 5, 4 } }, + { /* 61 */ 1, { 6, 3 } }, + { /* 62 */ 1, { 8, 3 } }, + { /* 63 */ 1, { 0, 7 } }, + { /* 64 */ 1, { 9, 2 } }, + { /* 65 */ 1, { 3, 8 } }, + { /* 66 */ 1, { 4, 6 } }, + { /* 67 */ 1, { 3, 7 } }, + { /* 68 */ 1, { 0, 8 } }, + { /* 69 */ 1, { 10, 1 } }, + { /* 70 */ 1, { 6, 4 } }, + { /* 71 */ 1, { 2, 9 } }, + { /* 72 */ 1, { 5, 5 } }, + { /* 73 */ 1, { 8, 0 } }, + { /* 74 */ 1, { 7, 0 } }, + { /* 75 */ 1, { 7, 3 } }, + { /* 76 */ 1, { 10, 2 } }, + { /* 77 */ 1, { 9, 3 } }, + { /* 78 */ 1, { 8, 4 } }, + { /* 79 */ 1, { 1, 10 } }, + { /* 80 */ 1, { 7, 4 } }, + { /* 81 */ 1, { 6, 5 } }, + { /* 82 */ 1, { 5, 6 } }, + { /* 83 */ 1, { 4, 8 } }, + { /* 84 */ 1, { 4, 7 } }, + { /* 85 */ 1, { 3, 9 } }, + { /* 86 */ 1, { 11, 1 } }, + { /* 87 */ 1, { 5, 8 } }, + { /* 88 */ 1, { 9, 0 } }, + { /* 89 */ 1, { 8, 5 } }, + { /* 90 */ 0, { 29, 30 } }, + { /* 91 */ 0, { 30, 31 } }, + { /* 92 */ 0, { 31, 32 } }, + { /* 93 */ 0, { 32, 33 } }, + { /* 94 */ 0, { 33, 34 } }, + { /* 95 */ 0, { 34, 35 } }, + { /* 96 */ 0, { 35, 36 } }, + { /* 97 */ 0, { 36, 37 } }, + { /* 98 */ 0, { 37, 38 } }, + { /* 99 */ 0, { 38, 39 } }, + { /* 00 */ 0, { 39, 40 } }, + { /* 01 */ 0, { 40, 41 } }, + { /* 02 */ 0, { 41, 42 } }, + { /* 03 */ 0, { 42, 43 } }, + { /* 04 */ 0, { 43, 44 } }, + { /* 05 */ 0, { 44, 45 } }, + { /* 06 */ 0, { 45, 46 } }, + { /* 07 */ 0, { 46, 47 } }, + { /* 08 */ 0, { 47, 48 } }, + { /* 09 */ 0, { 48, 49 } }, + { /* 10 */ 0, { 49, 50 } }, + { /* 11 */ 0, { 50, 51 } }, + { /* 12 */ 0, { 51, 52 } }, + { /* 13 */ 0, { 52, 53 } }, + { /* 14 */ 0, { 53, 54 } }, + { /* 15 */ 0, { 54, 55 } }, + { /* 16 */ 0, { 55, 56 } }, + { /* 17 */ 0, { 56, 57 } }, + { /* 18 */ 0, { 57, 58 } }, + { /* 19 */ 1, { 10, 3 } }, + { /* 20 */ 1, { 2, 10 } }, + { /* 21 */ 1, { 0, 9 } }, + { /* 22 */ 1, { 11, 2 } }, + { /* 23 */ 1, { 9, 4 } }, + { /* 24 */ 1, { 6, 6 } }, + { /* 25 */ 1, { 12, 1 } }, + { /* 26 */ 1, { 4, 9 } }, + { /* 27 */ 1, { 8, 6 } }, + { /* 28 */ 1, { 1, 11 } }, + { /* 29 */ 1, { 9, 5 } }, + { /* 30 */ 1, { 10, 4 } }, + { /* 31 */ 1, { 5, 7 } }, + { /* 32 */ 1, { 7, 5 } }, + { /* 33 */ 1, { 2, 11 } }, + { /* 34 */ 1, { 1, 12 } }, + { /* 35 */ 1, { 12, 2 } }, + { /* 36 */ 1, { 11, 3 } }, + { /* 37 */ 1, { 3, 10 } }, + { /* 38 */ 1, { 5, 9 } }, + { /* 39 */ 1, { 6, 7 } }, + { /* 40 */ 1, { 8, 7 } }, + { /* 41 */ 1, { 11, 4 } }, + { /* 42 */ 1, { 0, 10 } }, + { /* 43 */ 1, { 7, 6 } }, + { /* 44 */ 1, { 12, 3 } }, + { /* 45 */ 1, { 10, 0 } }, + { /* 46 */ 1, { 10, 5 } }, + { /* 47 */ 1, { 4, 10 } }, + { /* 48 */ 1, { 6, 8 } }, + { /* 49 */ 1, { 2, 12 } }, + { /* 50 */ 1, { 9, 6 } }, + { /* 51 */ 1, { 9, 7 } }, + { /* 52 */ 1, { 4, 11 } }, + { /* 53 */ 1, { 11, 0 } }, + { /* 54 */ 1, { 6, 9 } }, + { /* 55 */ 1, { 3, 11 } }, + { /* 56 */ 1, { 5, 10 } }, + { /* 57 */ 0, { 20, 21 } }, + { /* 58 */ 0, { 21, 22 } }, + { /* 59 */ 0, { 22, 23 } }, + { /* 60 */ 0, { 23, 24 } }, + { /* 61 */ 0, { 24, 25 } }, + { /* 62 */ 0, { 25, 26 } }, + { /* 63 */ 0, { 26, 27 } }, + { /* 64 */ 0, { 27, 28 } }, + { /* 65 */ 0, { 28, 29 } }, + { /* 66 */ 0, { 29, 30 } }, + { /* 67 */ 0, { 30, 31 } }, + { /* 68 */ 0, { 31, 32 } }, + { /* 69 */ 0, { 32, 33 } }, + { /* 70 */ 0, { 33, 34 } }, + { /* 71 */ 0, { 34, 35 } }, + { /* 72 */ 0, { 35, 36 } }, + { /* 73 */ 0, { 36, 37 } }, + { /* 74 */ 0, { 37, 38 } }, + { /* 75 */ 0, { 38, 39 } }, + { /* 76 */ 0, { 39, 40 } }, + { /* 77 */ 1, { 8, 8 } }, + { /* 78 */ 1, { 7, 8 } }, + { /* 79 */ 1, { 12, 5 } }, + { /* 80 */ 1, { 3, 12 } }, + { /* 81 */ 1, { 11, 5 } }, + { /* 82 */ 1, { 7, 7 } }, + { /* 83 */ 1, { 12, 4 } }, + { /* 84 */ 1, { 11, 6 } }, + { /* 85 */ 1, { 10, 6 } }, + { /* 86 */ 1, { 4, 12 } }, + { /* 87 */ 1, { 7, 9 } }, + { /* 88 */ 1, { 5, 11 } }, + { /* 89 */ 1, { 0, 11 } }, + { /* 90 */ 1, { 12, 6 } }, + { /* 91 */ 1, { 6, 10 } }, + { /* 92 */ 1, { 12, 0 } }, + { /* 93 */ 1, { 10, 7 } }, + { /* 94 */ 1, { 5, 12 } }, + { /* 95 */ 1, { 7, 10 } }, + { /* 96 */ 1, { 9, 8 } }, + { /* 97 */ 1, { 0, 12 } }, + { /* 98 */ 1, { 11, 7 } }, + { /* 99 */ 1, { 8, 9 } }, + { /* 00 */ 1, { 9, 9 } }, + { /* 01 */ 1, { 10, 8 } }, + { /* 02 */ 1, { 7, 11 } }, + { /* 03 */ 1, { 12, 7 } }, + { /* 04 */ 1, { 6, 11 } }, + { /* 05 */ 1, { 8, 11 } }, + { /* 06 */ 1, { 11, 8 } }, + { /* 07 */ 1, { 7, 12 } }, + { /* 08 */ 1, { 6, 12 } }, + { /* 09 */ 0, { 8, 9 } }, + { /* 10 */ 0, { 9, 10 } }, + { /* 11 */ 0, { 10, 11 } }, + { /* 12 */ 0, { 11, 12 } }, + { /* 13 */ 0, { 12, 13 } }, + { /* 14 */ 0, { 13, 14 } }, + { /* 15 */ 0, { 14, 15 } }, + { /* 16 */ 0, { 15, 16 } }, + { /* 17 */ 1, { 8, 10 } }, + { /* 18 */ 1, { 10, 9 } }, + { /* 19 */ 1, { 8, 12 } }, + { /* 20 */ 1, { 9, 10 } }, + { /* 21 */ 1, { 9, 11 } }, + { /* 22 */ 1, { 9, 12 } }, + { /* 23 */ 1, { 10, 11 } }, + { /* 24 */ 1, { 12, 9 } }, + { /* 25 */ 1, { 10, 10 } }, + { /* 26 */ 1, { 11, 9 } }, + { /* 27 */ 1, { 12, 8 } }, + { /* 28 */ 1, { 11, 10 } }, + { /* 29 */ 1, { 12, 10 } }, + { /* 30 */ 1, { 12, 11 } }, + { /* 31 */ 0, { 2, 3 } }, + { /* 32 */ 0, { 3, 4 } }, + { /* 33 */ 1, { 10, 12 } }, + { /* 34 */ 1, { 11, 11 } }, + { /* 35 */ 1, { 11, 12 } }, + { /* 36 */ 1, { 12, 12 } } +}; + +const AacHcb aacHcb10Step1[] = { + // 4 bit codewords + { /* 000000 */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* 000100 */ 1, 0 }, + { /* */ 1, 0 }, + { /* */ 1, 0 }, + { /* */ 1, 0 }, + { /* 001000 */ 2, 0 }, + { /* */ 2, 0 }, + { /* */ 2, 0 }, + { /* */ 2, 0 }, + // 5 bit codewords + { /* 001100 */ 3, 0 }, + { /* */ 3, 0 }, + { /* 001110 */ 4, 0 }, + { /* */ 4, 0 }, + { /* 010000 */ 5, 0 }, + { /* */ 5, 0 }, + { /* 010010 */ 6, 0 }, + { /* */ 6, 0 }, + { /* 010100 */ 7, 0 }, + { /* */ 7, 0 }, + { /* 010110 */ 8, 0 }, + { /* */ 8, 0 }, + { /* 011000 */ 9, 0 }, + { /* */ 9, 0 }, + { /* 011010 */ 10, 0 }, + { /* */ 10, 0 }, + // 6 bit codewords + { /* 011100 */ 11, 0 }, + { /* 011101 */ 12, 0 }, + { /* 011110 */ 13, 0 }, + { /* 011111 */ 14, 0 }, + { /* 100000 */ 15, 0 }, + { /* 100001 */ 16, 0 }, + { /* 100010 */ 17, 0 }, + { /* 100011 */ 18, 0 }, + { /* 100100 */ 19, 0 }, + { /* 100101 */ 20, 0 }, + { /* 100110 */ 21, 0 }, + { /* 100111 */ 22, 0 }, + { /* 101000 */ 23, 0 }, + { /* 101001 */ 24, 0 }, + // 7 bit codewords + { /* 101010 */ 25, 1 }, + { /* 101011 */ 27, 1 }, + { /* 101100 */ 29, 1 }, + { /* 101101 */ 31, 1 }, + { /* 101110 */ 33, 1 }, + { /* 101111 */ 35, 1 }, + { /* 110000 */ 37, 1 }, + { /* 110001 */ 39, 1 }, + // 7/8 bit codewords + { /* 110010 */ 41, 2 }, + // 8 bit codewords + { /* 110011 */ 45, 2 }, + { /* 110100 */ 49, 2 }, + { /* 110101 */ 53, 2 }, + { /* 110110 */ 57, 2 }, + { /* 110111 */ 61, 2 }, + // 8/9 bit codewords + { /* 111000 */ 65, 3 }, + // 9 bit codewords + { /* 111001 */ 73, 3 }, + { /* 111010 */ 81, 3 }, + { /* 111011 */ 89, 3 }, + // 9/10 bit codewords + { /* 111100 */ 97, 4 }, + // 10 bit codewords + { /* 111101 */ 113, 4 }, + { /* 111110 */ 129, 4 }, + // 10/11/12 bit codewords + { /* 111111 */ 145, 6 } +}; + +const AacHcb2Pair aacHcb10Step2[] = { + // 4 bit codewords + { 4, 1, 1 }, + { 4, 1, 2 }, + { 4, 2, 1 }, + + // 5 bit codewords + { 5, 2, 2 }, + { 5, 1, 0 }, + { 5, 0, 1 }, + { 5, 1, 3 }, + { 5, 3, 2 }, + { 5, 3, 1 }, + { 5, 2, 3 }, + { 5, 3, 3 }, + + // 6 bit codewords + { 6, 2, 0 }, + { 6, 0, 2 }, + { 6, 2, 4 }, + { 6, 4, 2 }, + { 6, 1, 4 }, + { 6, 4, 1 }, + { 6, 0, 0 }, + { 6, 4, 3 }, + { 6, 3, 4 }, + { 6, 3, 0 }, + { 6, 0, 3 }, + { 6, 4, 4 }, + { 6, 2, 5 }, + { 6, 5, 2 }, + + // 7 bit codewords + { 7, 1, 5 }, + { 7, 5, 1 }, + { 7, 5, 3 }, + { 7, 3, 5 }, + { 7, 5, 4 }, + { 7, 4, 5 }, + { 7, 6, 2 }, + { 7, 2, 6 }, + { 7, 6, 3 }, + { 7, 4, 0 }, + { 7, 6, 1 }, + { 7, 0, 4 }, + { 7, 1, 6 }, + { 7, 3, 6 }, + { 7, 5, 5 }, + { 7, 6, 4 }, + + // 7/8 bit codewords + { 7, 4, 6 }, { 7, 4, 6 }, + { 8, 6, 5 }, + { 8, 7, 2 }, + + // 8 bit codewords + { 8, 3, 7 }, + { 8, 2, 7 }, + { 8, 5, 6 }, + { 8, 8, 2 }, + { 8, 7, 3 }, + { 8, 5, 0 }, + { 8, 7, 1 }, + { 8, 0, 5 }, + { 8, 8, 1 }, + { 8, 1, 7 }, + { 8, 8, 3 }, + { 8, 7, 4 }, + { 8, 4, 7 }, + { 8, 2, 8 }, + { 8, 6, 6 }, + { 8, 7, 5 }, + { 8, 1, 8 }, + { 8, 3, 8 }, + { 8, 8, 4 }, + { 8, 4, 8 }, + + // 8/9 bit codewords + { 8, 5, 7 }, { 8, 5, 7 }, + { 8, 8, 5 }, { 8, 8, 5 }, + { 8, 5, 8 }, { 8, 5, 8 }, + { 9, 7, 6 }, + { 9, 6, 7 }, + + // 9 bit codewords + { 9, 9, 2 }, + { 9, 6, 0 }, + { 9, 6, 8 }, + { 9, 9, 3 }, + { 9, 3, 9 }, + { 9, 9, 1 }, + { 9, 2, 9 }, + { 9, 0, 6 }, + { 9, 8, 6 }, + { 9, 9, 4 }, + { 9, 4, 9 }, + { 9, 10, 2 }, + { 9, 1, 9 }, + { 9, 7, 7 }, + { 9, 8, 7 }, + { 9, 9, 5 }, + { 9, 7, 8 }, + { 9, 10, 3 }, + { 9, 5, 9 }, + { 9, 10, 4 }, + { 9, 2, 10 }, + { 9, 10, 1 }, + { 9, 3, 10 }, + { 9, 9, 6 }, + + // 9/10 bit codewords + { 9, 6, 9 }, { 9, 6, 9 }, + { 9, 8, 0 }, { 9, 8, 0 }, + { 9, 4, 10 }, { 9, 4, 10 }, + { 9, 7, 0 }, { 9, 7, 0 }, + { 9, 11, 2 }, { 9, 11, 2 }, + { 10, 7, 9 }, + { 10, 11, 3 }, + { 10, 10, 6 }, + { 10, 1, 10 }, + { 10, 11, 1 }, + { 10, 9, 7 }, + + // 10 bit codewords + { 10, 0, 7 }, + { 10, 8, 8 }, + { 10, 10, 5 }, + { 10, 3, 11 }, + { 10, 5, 10 }, + { 10, 8, 9 }, + { 10, 11, 5 }, + { 10, 0, 8 }, + { 10, 11, 4 }, + { 10, 2, 11 }, + { 10, 7, 10 }, + { 10, 6, 10 }, + { 10, 10, 7 }, + { 10, 4, 11 }, + { 10, 1, 11 }, + { 10, 12, 2 }, + { 10, 9, 8 }, + { 10, 12, 3 }, + { 10, 11, 6 }, + { 10, 5, 11 }, + { 10, 12, 4 }, + { 10, 11, 7 }, + { 10, 12, 5 }, + { 10, 3, 12 }, + { 10, 6, 11 }, + { 10, 9, 0 }, + { 10, 10, 8 }, + { 10, 10, 0 }, + { 10, 12, 1 }, + { 10, 0, 9 }, + { 10, 4, 12 }, + { 10, 9, 9 }, + + // 10/11/12 bit codewords + { 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 }, + { 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 }, + { 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 }, + { 11, 9, 10 }, { 11, 9, 10 }, + { 11, 1, 12 }, { 11, 1, 12 }, + { 11, 11, 8 }, { 11, 11, 8 }, + { 11, 12, 7 }, { 11, 12, 7 }, + { 11, 7, 11 }, { 11, 7, 11 }, + { 11, 5, 12 }, { 11, 5, 12 }, + { 11, 6, 12 }, { 11, 6, 12 }, + { 11, 10, 9 }, { 11, 10, 9 }, + { 11, 8, 11 }, { 11, 8, 11 }, + { 11, 12, 8 }, { 11, 12, 8 }, + { 11, 0, 10 }, { 11, 0, 10 }, + { 11, 7, 12 }, { 11, 7, 12 }, + { 11, 11, 0 }, { 11, 11, 0 }, + { 11, 10, 10 }, { 11, 10, 10 }, + { 11, 11, 9 }, { 11, 11, 9 }, + { 11, 11, 10 }, { 11, 11, 10 }, + { 11, 0, 11 }, { 11, 0, 11 }, + { 11, 11, 11 }, { 11, 11, 11 }, + { 11, 9, 11 }, { 11, 9, 11 }, + { 11, 10, 11 }, { 11, 10, 11 }, + { 11, 12, 0 }, { 11, 12, 0 }, + { 11, 8, 12 }, { 11, 8, 12 }, + { 12, 12, 9 }, + { 12, 10, 12 }, + { 12, 9, 12 }, + { 12, 11, 12 }, + { 12, 12, 11 }, + { 12, 0, 12 }, + { 12, 12, 10 }, + { 12, 12, 12 } +}; + +const AacHcb aacHcb11Step1[] = { + // 4 bits + { /* 00000 */ 0, 0 }, + { /* */ 0, 0 }, + { /* 00010 */ 1, 0 }, + { /* */ 1, 0 }, + + // 5 bits + { /* 00100 */ 2, 0 }, + { /* 00101 */ 3, 0 }, + { /* 00110 */ 4, 0 }, + { /* 00111 */ 5, 0 }, + { /* 01000 */ 6, 0 }, + { /* 01001 */ 7, 0 }, + + // 6 bits + { /* 01010 */ 8, 1 }, + { /* 01011 */ 10, 1 }, + { /* 01100 */ 12, 1 }, + + // 6/7 bits + { /* 01101 */ 14, 2 }, + + // 7 bits + { /* 01110 */ 18, 2 }, + { /* 01111 */ 22, 2 }, + { /* 10000 */ 26, 2 }, + + // 7/8 bits + { /* 10001 */ 30, 3 }, + + // 8 bits + { /* 10010 */ 38, 3 }, + { /* 10011 */ 46, 3 }, + { /* 10100 */ 54, 3 }, + { /* 10101 */ 62, 3 }, + { /* 10110 */ 70, 3 }, + { /* 10111 */ 78, 3 }, + + // 8/9 bits + { /* 11000 */ 86, 4 }, + + // 9 bits + { /* 11001 */ 102, 4 }, + { /* 11010 */ 118, 4 }, + { /* 11011 */ 134, 4 }, + + // 9/10 bits + { /* 11100 */ 150, 5 }, + + // 10 bits + { /* 11101 */ 182, 5 }, + { /* 11110 */ 214, 5 }, + + // 10/11/12 bits + { /* 11111 */ 246, 7 } +}; + +const AacHcb2Pair aacHcb11Step2[] = { + // 4 + { 4, 0, 0 }, + { 4, 1, 1 }, + + // 5 + { 5, 16, 16 }, + { 5, 1, 0 }, + { 5, 0, 1 }, + { 5, 2, 1 }, + { 5, 1, 2 }, + { 5, 2, 2 }, + + // 6 + { 6, 1, 3 }, + { 6, 3, 1 }, + { 6, 3, 2 }, + { 6, 2, 0 }, + { 6, 2, 3 }, + { 6, 0, 2 }, + + // 6/7 + { 6, 3, 3 }, { 6, 3, 3 }, + { 7, 4, 1 }, + { 7, 1, 4 }, + + // 7 + { 7, 4, 2 }, + { 7, 2, 4 }, + { 7, 4, 3 }, + { 7, 3, 4 }, + { 7, 3, 0 }, + { 7, 0, 3 }, + { 7, 5, 1 }, + { 7, 5, 2 }, + { 7, 2, 5 }, + { 7, 4, 4 }, + { 7, 1, 5 }, + { 7, 5, 3 }, + + // 7/8 + { 7, 3, 5 }, { 7, 3, 5 }, + { 7, 5, 4 }, { 7, 5, 4 }, + { 8, 4, 5 }, + { 8, 6, 2 }, + { 8, 2, 6 }, + { 8, 6, 1 }, + + // 8 + { 8, 6, 3 }, + { 8, 3, 6 }, + { 8, 1, 6 }, + { 8, 4, 16 }, + { 8, 3, 16 }, + { 8, 16, 5 }, + { 8, 16, 3 }, + { 8, 16, 4 }, + { 8, 6, 4 }, + { 8, 16, 6 }, + { 8, 4, 0 }, + { 8, 4, 6 }, + { 8, 0, 4 }, + { 8, 2, 16 }, + { 8, 5, 5 }, + { 8, 5, 16 }, + { 8, 16, 7 }, + { 8, 16, 2 }, + { 8, 16, 8 }, + { 8, 2, 7 }, + { 8, 7, 2 }, + { 8, 3, 7 }, + { 8, 6, 5 }, + { 8, 5, 6 }, + { 8, 6, 16 }, + { 8, 16, 10 }, + { 8, 7, 3 }, + { 8, 7, 1 }, + { 8, 16, 9 }, + { 8, 7, 16 }, + { 8, 1, 16 }, + { 8, 1, 7 }, + { 8, 4, 7 }, + { 8, 16, 11 }, + { 8, 7, 4 }, + { 8, 16, 12 }, + { 8, 8, 16 }, + { 8, 16, 1 }, + { 8, 6, 6 }, + { 8, 9, 16 }, + { 8, 2, 8 }, + { 8, 5, 7 }, + { 8, 10, 16 }, + { 8, 16, 13 }, + { 8, 8, 3 }, + { 8, 8, 2 }, + { 8, 3, 8 }, + { 8, 5, 0 }, + + // 8/9 + { 8, 16, 14 }, { 8, 16, 14 }, + { 8, 11, 16 }, { 8, 11, 16 }, + { 8, 7, 5 }, { 8, 7, 5 }, + { 8, 4, 8 }, { 8, 4, 8 }, + { 8, 6, 7 }, { 8, 6, 7 }, + { 8, 7, 6 }, { 8, 7, 6 }, + { 8, 0, 5 }, { 8, 0, 5 }, + { 9, 8, 4 }, + { 9, 16, 15 }, + + // 9 + { 9, 12, 16 }, + { 9, 1, 8 }, + { 9, 8, 1 }, + { 9, 14, 16 }, + { 9, 5, 8 }, + { 9, 13, 16 }, + { 9, 3, 9 }, + { 9, 8, 5 }, + { 9, 7, 7 }, + { 9, 2, 9 }, + { 9, 8, 6 }, + { 9, 9, 2 }, + { 9, 9, 3 }, + { 9, 15, 16 }, + { 9, 4, 9 }, + { 9, 6, 8 }, + { 9, 6, 0 }, + { 9, 9, 4 }, + { 9, 5, 9 }, + { 9, 8, 7 }, + { 9, 7, 8 }, + { 9, 1, 9 }, + { 9, 10, 3 }, + { 9, 0, 6 }, + { 9, 10, 2 }, + { 9, 9, 1 }, + { 9, 9, 5 }, + { 9, 4, 10 }, + { 9, 2, 10 }, + { 9, 9, 6 }, + { 9, 3, 10 }, + { 9, 6, 9 }, + { 9, 10, 4 }, + { 9, 8, 8 }, + { 9, 10, 5 }, + { 9, 9, 7 }, + { 9, 11, 3 }, + { 9, 1, 10 }, + { 9, 7, 0 }, + { 9, 10, 6 }, + { 9, 7, 9 }, + { 9, 3, 11 }, + { 9, 5, 10 }, + { 9, 10, 1 }, + { 9, 4, 11 }, + { 9, 11, 2 }, + { 9, 13, 2 }, + { 9, 6, 10 }, + + // 9/10 + { 9, 13, 3 }, { 9, 13, 3 }, + { 9, 2, 11 }, { 9, 2, 11 }, + { 9, 16, 0 }, { 9, 16, 0 }, + { 9, 5, 11 }, { 9, 5, 11 }, + { 9, 11, 5 }, { 9, 11, 5 }, + { 10, 11, 4 }, + { 10, 9, 8 }, + { 10, 7, 10 }, + { 10, 8, 9 }, + { 10, 0, 16 }, + { 10, 4, 13 }, + { 10, 0, 7 }, + { 10, 3, 13 }, + { 10, 11, 6 }, + { 10, 13, 1 }, + { 10, 13, 4 }, + { 10, 12, 3 }, + { 10, 2, 13 }, + { 10, 13, 5 }, + { 10, 8, 10 }, + { 10, 6, 11 }, + { 10, 10, 8 }, + { 10, 10, 7 }, + { 10, 14, 2 }, + { 10, 12, 4 }, + { 10, 1, 11 }, + { 10, 4, 12 }, + + // 10 + { 10, 11, 1 }, + { 10, 3, 12 }, + { 10, 1, 13 }, + { 10, 12, 2 }, + { 10, 7, 11 }, + { 10, 3, 14 }, + { 10, 5, 12 }, + { 10, 5, 13 }, + { 10, 14, 4 }, + { 10, 4, 14 }, + { 10, 11, 7 }, + { 10, 14, 3 }, + { 10, 12, 5 }, + { 10, 13, 6 }, + { 10, 12, 6 }, + { 10, 8, 0 }, + { 10, 11, 8 }, + { 10, 2, 12 }, + { 10, 9, 9 }, + { 10, 14, 5 }, + { 10, 6, 13 }, + { 10, 10, 10 }, + { 10, 15, 2 }, + { 10, 8, 11 }, + { 10, 9, 10 }, + { 10, 14, 6 }, + { 10, 10, 9 }, + { 10, 5, 14 }, + { 10, 11, 9 }, + { 10, 14, 1 }, + { 10, 2, 14 }, + { 10, 6, 12 }, + { 10, 1, 12 }, + { 10, 13, 8 }, + { 10, 0, 8 }, + { 10, 13, 7 }, + { 10, 7, 12 }, + { 10, 12, 7 }, + { 10, 7, 13 }, + { 10, 15, 3 }, + { 10, 12, 1 }, + { 10, 6, 14 }, + { 10, 2, 15 }, + { 10, 15, 5 }, + { 10, 15, 4 }, + { 10, 1, 14 }, + { 10, 9, 11 }, + { 10, 4, 15 }, + { 10, 14, 7 }, + { 10, 8, 13 }, + { 10, 13, 9 }, + { 10, 8, 12 }, + { 10, 5, 15 }, + { 10, 3, 15 }, + { 10, 10, 11 }, + { 10, 11, 10 }, + { 10, 12, 8 }, + { 10, 15, 6 }, + { 10, 15, 7 }, + { 10, 8, 14 }, + { 10, 15, 1 }, + { 10, 7, 14 }, + { 10, 9, 0 }, + { 10, 0, 9 }, + + // 10/11/12 + { 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 }, + { 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 }, + { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }, + { 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 }, + { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 }, + { 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 }, + { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 }, + { 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 }, + { 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 }, + + { 11, 9, 14 }, { 11, 9, 14 }, + { 11, 15, 8 }, { 11, 15, 8 }, + { 11, 11, 11 }, { 11, 11, 11 }, + { 11, 11, 14 }, { 11, 11, 14 }, + { 11, 1, 15 }, { 11, 1, 15 }, + { 11, 10, 12 }, { 11, 10, 12 }, + { 11, 10, 14 }, { 11, 10, 14 }, + { 11, 13, 11 }, { 11, 13, 11 }, + { 11, 13, 10 }, { 11, 13, 10 }, + { 11, 11, 13 }, { 11, 11, 13 }, + { 11, 11, 12 }, { 11, 11, 12 }, + { 11, 8, 15 }, { 11, 8, 15 }, + { 11, 14, 11 }, { 11, 14, 11 }, + { 11, 13, 12 }, { 11, 13, 12 }, + { 11, 12, 13 }, { 11, 12, 13 }, + { 11, 15, 9 }, { 11, 15, 9 }, + { 11, 14, 10 }, { 11, 14, 10 }, + { 11, 10, 0 }, { 11, 10, 0 }, + { 11, 12, 11 }, { 11, 12, 11 }, + { 11, 9, 15 }, { 11, 9, 15 }, + { 11, 0, 10 }, { 11, 0, 10 }, + { 11, 12, 12 }, { 11, 12, 12 }, + { 11, 11, 0 }, { 11, 11, 0 }, + { 11, 12, 14 }, { 11, 12, 14 }, + { 11, 10, 15 }, { 11, 10, 15 }, + { 11, 13, 13 }, { 11, 13, 13 }, + { 11, 0, 13 }, { 11, 0, 13 }, + { 11, 14, 12 }, { 11, 14, 12 }, + { 11, 15, 10 }, { 11, 15, 10 }, + { 11, 15, 11 }, { 11, 15, 11 }, + { 11, 11, 15 }, { 11, 11, 15 }, + { 11, 14, 13 }, { 11, 14, 13 }, + { 11, 13, 0 }, { 11, 13, 0 }, + { 11, 0, 11 }, { 11, 0, 11 }, + { 11, 13, 14 }, { 11, 13, 14 }, + { 11, 15, 12 }, { 11, 15, 12 }, + { 11, 15, 13 }, { 11, 15, 13 }, + { 11, 12, 15 }, { 11, 12, 15 }, + { 11, 14, 0 }, { 11, 14, 0 }, + { 11, 14, 14 }, { 11, 14, 14 }, + { 11, 13, 15 }, { 11, 13, 15 }, + { 11, 12, 0 }, { 11, 12, 0 }, + { 11, 14, 15 }, { 11, 14, 15 }, + { 12, 0, 14 }, + { 12, 0, 12 }, + { 12, 15, 14 }, + { 12, 15, 0 }, + { 12, 0, 15 }, + { 12, 15, 15 } +}; + +const byte aacHcbSf[][2] = { + { /* 0 */ 1, 2 }, + { /* 1 */ 60, 0 }, + { /* 2 */ 1, 2 }, + { /* 3 */ 2, 3 }, + { /* 4 */ 3, 4 }, + { /* 5 */ 59, 0 }, + { /* 6 */ 3, 4 }, + { /* 7 */ 4, 5 }, + { /* 8 */ 5, 6 }, + { /* 9 */ 61, 0 }, + { /* 10 */ 58, 0 }, + { /* 11 */ 62, 0 }, + { /* 12 */ 3, 4 }, + { /* 13 */ 4, 5 }, + { /* 14 */ 5, 6 }, + { /* 15 */ 57, 0 }, + { /* 16 */ 63, 0 }, + { /* 17 */ 4, 5 }, + { /* 18 */ 5, 6 }, + { /* 19 */ 6, 7 }, + { /* 20 */ 7, 8 }, + { /* 21 */ 56, 0 }, + { /* 22 */ 64, 0 }, + { /* 23 */ 55, 0 }, + { /* 24 */ 65, 0 }, + { /* 25 */ 4, 5 }, + { /* 26 */ 5, 6 }, + { /* 27 */ 6, 7 }, + { /* 28 */ 7, 8 }, + { /* 29 */ 66, 0 }, + { /* 30 */ 54, 0 }, + { /* 31 */ 67, 0 }, + { /* 32 */ 5, 6 }, + { /* 33 */ 6, 7 }, + { /* 34 */ 7, 8 }, + { /* 35 */ 8, 9 }, + { /* 36 */ 9, 10 }, + { /* 37 */ 53, 0 }, + { /* 38 */ 68, 0 }, + { /* 39 */ 52, 0 }, + { /* 40 */ 69, 0 }, + { /* 41 */ 51, 0 }, + { /* 42 */ 5, 6 }, + { /* 43 */ 6, 7 }, + { /* 44 */ 7, 8 }, + { /* 45 */ 8, 9 }, + { /* 46 */ 9, 10 }, + { /* 47 */ 70, 0 }, + { /* 48 */ 50, 0 }, + { /* 49 */ 49, 0 }, + { /* 50 */ 71, 0 }, + { /* 51 */ 6, 7 }, + { /* 52 */ 7, 8 }, + { /* 53 */ 8, 9 }, + { /* 54 */ 9, 10 }, + { /* 55 */ 10, 11 }, + { /* 56 */ 11, 12 }, + { /* 57 */ 72, 0 }, + { /* 58 */ 48, 0 }, + { /* 59 */ 73, 0 }, + { /* 60 */ 47, 0 }, + { /* 61 */ 74, 0 }, + { /* 62 */ 46, 0 }, + { /* 63 */ 6, 7 }, + { /* 64 */ 7, 8 }, + { /* 65 */ 8, 9 }, + { /* 66 */ 9, 10 }, + { /* 67 */ 10, 11 }, + { /* 68 */ 11, 12 }, + { /* 69 */ 76, 0 }, + { /* 70 */ 75, 0 }, + { /* 71 */ 77, 0 }, + { /* 72 */ 78, 0 }, + { /* 73 */ 45, 0 }, + { /* 74 */ 43, 0 }, + { /* 75 */ 6, 7 }, + { /* 76 */ 7, 8 }, + { /* 77 */ 8, 9 }, + { /* 78 */ 9, 10 }, + { /* 79 */ 10, 11 }, + { /* 80 */ 11, 12 }, + { /* 81 */ 44, 0 }, + { /* 82 */ 79, 0 }, + { /* 83 */ 42, 0 }, + { /* 84 */ 41, 0 }, + { /* 85 */ 80, 0 }, + { /* 86 */ 40, 0 }, + { /* 87 */ 6, 7 }, + { /* 88 */ 7, 8 }, + { /* 89 */ 8, 9 }, + { /* 90 */ 9, 10 }, + { /* 91 */ 10, 11 }, + { /* 92 */ 11, 12 }, + { /* 93 */ 81, 0 }, + { /* 94 */ 39, 0 }, + { /* 95 */ 82, 0 }, + { /* 96 */ 38, 0 }, + { /* 97 */ 83, 0 }, + { /* 98 */ 7, 8 }, + { /* 99 */ 8, 9 }, + { /* 00 */ 9, 10 }, + { /* 01 */ 10, 11 }, + { /* 02 */ 11, 12 }, + { /* 03 */ 12, 13 }, + { /* 04 */ 13, 14 }, + { /* 05 */ 37, 0 }, + { /* 06 */ 35, 0 }, + { /* 07 */ 85, 0 }, + { /* 08 */ 33, 0 }, + { /* 09 */ 36, 0 }, + { /* 10 */ 34, 0 }, + { /* 11 */ 84, 0 }, + { /* 12 */ 32, 0 }, + { /* 13 */ 6, 7 }, + { /* 14 */ 7, 8 }, + { /* 15 */ 8, 9 }, + { /* 16 */ 9, 10 }, + { /* 17 */ 10, 11 }, + { /* 18 */ 11, 12 }, + { /* 19 */ 87, 0 }, + { /* 20 */ 89, 0 }, + { /* 21 */ 30, 0 }, + { /* 22 */ 31, 0 }, + { /* 23 */ 8, 9 }, + { /* 24 */ 9, 10 }, + { /* 25 */ 10, 11 }, + { /* 26 */ 11, 12 }, + { /* 27 */ 12, 13 }, + { /* 28 */ 13, 14 }, + { /* 29 */ 14, 15 }, + { /* 30 */ 15, 16 }, + { /* 31 */ 86, 0 }, + { /* 32 */ 29, 0 }, + { /* 33 */ 26, 0 }, + { /* 34 */ 27, 0 }, + { /* 35 */ 28, 0 }, + { /* 36 */ 24, 0 }, + { /* 37 */ 88, 0 }, + { /* 38 */ 9, 10 }, + { /* 39 */ 10, 11 }, + { /* 40 */ 11, 12 }, + { /* 41 */ 12, 13 }, + { /* 42 */ 13, 14 }, + { /* 43 */ 14, 15 }, + { /* 44 */ 15, 16 }, + { /* 45 */ 16, 17 }, + { /* 46 */ 17, 18 }, + { /* 47 */ 25, 0 }, + { /* 48 */ 22, 0 }, + { /* 49 */ 23, 0 }, + { /* 50 */ 15, 16 }, + { /* 51 */ 16, 17 }, + { /* 52 */ 17, 18 }, + { /* 53 */ 18, 19 }, + { /* 54 */ 19, 20 }, + { /* 55 */ 20, 21 }, + { /* 56 */ 21, 22 }, + { /* 57 */ 22, 23 }, + { /* 58 */ 23, 24 }, + { /* 59 */ 24, 25 }, + { /* 60 */ 25, 26 }, + { /* 61 */ 26, 27 }, + { /* 62 */ 27, 28 }, + { /* 63 */ 28, 29 }, + { /* 64 */ 29, 30 }, + { /* 65 */ 90, 0 }, + { /* 66 */ 21, 0 }, + { /* 67 */ 19, 0 }, + { /* 68 */ 3, 0 }, + { /* 69 */ 1, 0 }, + { /* 70 */ 2, 0 }, + { /* 71 */ 0, 0 }, + { /* 72 */ 23, 24 }, + { /* 73 */ 24, 25 }, + { /* 74 */ 25, 26 }, + { /* 75 */ 26, 27 }, + { /* 76 */ 27, 28 }, + { /* 77 */ 28, 29 }, + { /* 78 */ 29, 30 }, + { /* 79 */ 30, 31 }, + { /* 80 */ 31, 32 }, + { /* 81 */ 32, 33 }, + { /* 82 */ 33, 34 }, + { /* 83 */ 34, 35 }, + { /* 84 */ 35, 36 }, + { /* 85 */ 36, 37 }, + { /* 86 */ 37, 38 }, + { /* 87 */ 38, 39 }, + { /* 88 */ 39, 40 }, + { /* 89 */ 40, 41 }, + { /* 90 */ 41, 42 }, + { /* 91 */ 42, 43 }, + { /* 92 */ 43, 44 }, + { /* 93 */ 44, 45 }, + { /* 94 */ 45, 46 }, + { /* 95 */ 98, 0 }, + { /* 96 */ 99, 0 }, + { /* 97 */ 100, 0 }, + { /* 98 */ 101, 0 }, + { /* 99 */ 102, 0 }, + { /* 00 */ 117, 0 }, + { /* 01 */ 97, 0 }, + { /* 02 */ 91, 0 }, + { /* 03 */ 92, 0 }, + { /* 04 */ 93, 0 }, + { /* 05 */ 94, 0 }, + { /* 06 */ 95, 0 }, + { /* 07 */ 96, 0 }, + { /* 08 */ 104, 0 }, + { /* 09 */ 111, 0 }, + { /* 10 */ 112, 0 }, + { /* 11 */ 113, 0 }, + { /* 12 */ 114, 0 }, + { /* 13 */ 115, 0 }, + { /* 14 */ 116, 0 }, + { /* 15 */ 110, 0 }, + { /* 16 */ 105, 0 }, + { /* 17 */ 106, 0 }, + { /* 18 */ 107, 0 }, + { /* 19 */ 108, 0 }, + { /* 20 */ 109, 0 }, + { /* 21 */ 118, 0 }, + { /* 22 */ 6, 0 }, + { /* 23 */ 8, 0 }, + { /* 24 */ 9, 0 }, + { /* 25 */ 10, 0 }, + { /* 26 */ 5, 0 }, + { /* 27 */ 103, 0 }, + { /* 28 */ 120, 0 }, + { /* 29 */ 119, 0 }, + { /* 30 */ 4, 0 }, + { /* 31 */ 7, 0 }, + { /* 32 */ 15, 0 }, + { /* 33 */ 16, 0 }, + { /* 34 */ 18, 0 }, + { /* 35 */ 20, 0 }, + { /* 36 */ 17, 0 }, + { /* 37 */ 11, 0 }, + { /* 38 */ 12, 0 }, + { /* 39 */ 14, 0 }, + { /* 40 */ 13, 0 } +}; + +const sbyte tHuffmanEnv15dB[120][2] = { + { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 }, + { 5, 6 }, { -62, -67 }, { 7, 8 }, { -61, -68 }, + { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 }, + { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 }, + { 17, 18 }, { -73, -56 }, { 19, 21 }, { -74, 20 }, + { -55, -75 }, { 22, 26 }, { 23, 24 }, { -54, -76 }, + { -77, 25 }, { -53, -78 }, { 27, 34 }, { 28, 29 }, + { -52, -79 }, { 30, 31 }, { -80, -51 }, { 32, 33 }, + { -83, -82 }, { -81, -50 }, { 35, 57 }, { 36, 40 }, + { 37, 38 }, { -88, -84 }, { -48, 39 }, { -90, -85 }, + { 41, 46 }, { 42, 43 }, { -49, -87 }, { 44, 45 }, + { -89, -86 }, {-124,-123 }, { 47, 50 }, { 48, 49 }, + {-122,-121 }, {-120,-119 }, { 51, 54 }, { 52, 53 }, + {-118,-117 }, {-116,-115 }, { 55, 56 }, {-114,-113 }, + {-112,-111 }, { 58, 89 }, { 59, 74 }, { 60, 67 }, + { 61, 64 }, { 62, 63 }, {-110,-109 }, {-108,-107 }, + { 65, 66 }, {-106,-105 }, {-104,-103 }, { 68, 71 }, + { 69, 70 }, {-102,-101 }, {-100, -99 }, { 72, 73 }, + { -98, -97 }, { -96, -95 }, { 75, 82 }, { 76, 79 }, + { 77, 78 }, { -94, -93 }, { -92, -91 }, { 80, 81 }, + { -47, -46 }, { -45, -44 }, { 83, 86 }, { 84, 85 }, + { -43, -42 }, { -41, -40 }, { 87, 88 }, { -39, -38 }, + { -37, -36 }, { 90, 105 }, { 91, 98 }, { 92, 95 }, + { 93, 94 }, { -35, -34 }, { -33, -32 }, { 96, 97 }, + { -31, -30 }, { -29, -28 }, { 99, 102 }, { 100, 101 }, + { -27, -26 }, { -25, -24 }, { 103, 104 }, { -23, -22 }, + { -21, -20 }, { 106, 113 }, { 107, 110 }, { 108, 109 }, + { -19, -18 }, { -17, -16 }, { 111, 112 }, { -15, -14 }, + { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 }, + { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 } +}; + +const sbyte fHuffmanEnv15dB[120][2] = { + { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 }, + { 5, 6 }, { -67, -62 }, { 7, 8 }, { -68, -61 }, + { 9, 10 }, { -69, -60 }, { 11, 13 }, { -70, 12 }, + { -59, -71 }, { 14, 16 }, { -58, 15 }, { -72, -57 }, + { 17, 19 }, { -73, 18 }, { -56, -74 }, { 20, 23 }, + { 21, 22 }, { -55, -75 }, { -54, -53 }, { 24, 27 }, + { 25, 26 }, { -76, -52 }, { -77, -51 }, { 28, 31 }, + { 29, 30 }, { -50, -78 }, { -79, -49 }, { 32, 36 }, + { 33, 34 }, { -48, -47 }, { -80, 35 }, { -81, -82 }, + { 37, 47 }, { 38, 41 }, { 39, 40 }, { -83, -46 }, + { -45, -84 }, { 42, 44 }, { -85, 43 }, { -44, -43 }, + { 45, 46 }, { -88, -87 }, { -86, -90 }, { 48, 66 }, + { 49, 56 }, { 50, 53 }, { 51, 52 }, { -92, -42 }, + { -41, -39 }, { 54, 55 }, {-105, -89 }, { -38, -37 }, + { 57, 60 }, { 58, 59 }, { -94, -91 }, { -40, -36 }, + { 61, 63 }, { -20, 62 }, {-115,-110 }, { 64, 65 }, + {-108,-107 }, {-101, -97 }, { 67, 89 }, { 68, 75 }, + { 69, 72 }, { 70, 71 }, { -95, -93 }, { -34, -27 }, + { 73, 74 }, { -22, -17 }, { -16,-124 }, { 76, 82 }, + { 77, 79 }, {-123, 78 }, {-122,-121 }, { 80, 81 }, + {-120,-119 }, {-118,-117 }, { 83, 86 }, { 84, 85 }, + {-116,-114 }, {-113,-112 }, { 87, 88 }, {-111,-109 }, + {-106,-104 }, { 90, 105 }, { 91, 98 }, { 92, 95 }, + { 93, 94 }, {-103,-102 }, {-100, -99 }, { 96, 97 }, + { -98, -96 }, { -35, -33 }, { 99, 102 }, { 100, 101 }, + { -32, -31 }, { -30, -29 }, { 103, 104 }, { -28, -26 }, + { -25, -24 }, { 106, 113 }, { 107, 110 }, { 108, 109 }, + { -23, -21 }, { -19, -18 }, { 111, 112 }, { -15, -14 }, + { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 }, + { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 } +}; + +const sbyte tHuffmanEnvBal15dB[48][2] = { + { -64, 1 }, { -63, 2 }, { -65, 3 }, { -62, 4 }, + { -66, 5 }, { -61, 6 }, { -67, 7 }, { -60, 8 }, + { -68, 9 }, { 10, 11 }, { -69, -59 }, { 12, 13 }, + { -70, -58 }, { 14, 28 }, { 15, 21 }, { 16, 18 }, + { -57, 17 }, { -71, -56 }, { 19, 20 }, { -88, -87 }, + { -86, -85 }, { 22, 25 }, { 23, 24 }, { -84, -83 }, + { -82, -81 }, { 26, 27 }, { -80, -79 }, { -78, -77 }, + { 29, 36 }, { 30, 33 }, { 31, 32 }, { -76, -75 }, + { -74, -73 }, { 34, 35 }, { -72, -55 }, { -54, -53 }, + { 37, 41 }, { 38, 39 }, { -52, -51 }, { -50, 40 }, + { -49, -48 }, { 42, 45 }, { 43, 44 }, { -47, -46 }, + { -45, -44 }, { 46, 47 }, { -43, -42 }, { -41, -40 } +}; + +const sbyte fHuffmanEnvBal15dB[48][2] = { + { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, + { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, + { -60, 9 }, { 10, 11 }, { -69, -59 }, { -70, 12 }, + { -58, 13 }, { 14, 17 }, { -71, 15 }, { -57, 16 }, + { -56, -73 }, { 18, 32 }, { 19, 25 }, { 20, 22 }, + { -72, 21 }, { -88, -87 }, { 23, 24 }, { -86, -85 }, + { -84, -83 }, { 26, 29 }, { 27, 28 }, { -82, -81 }, + { -80, -79 }, { 30, 31 }, { -78, -77 }, { -76, -75 }, + { 33, 40 }, { 34, 37 }, { 35, 36 }, { -74, -55 }, + { -54, -53 }, { 38, 39 }, { -52, -51 }, { -50, -49 }, + { 41, 44 }, { 42, 43 }, { -48, -47 }, { -46, -45 }, + { 45, 46 }, { -44, -43 }, { -42, 47 }, { -41, -40 } +}; + +const sbyte tHuffmanEnv30dB[62][2] = { + { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, + { -62, 5 }, { -67, 6 }, { -61, 7 }, { -68, 8 }, + { -60, 9 }, { 10, 11 }, { -69, -59 }, { 12, 14 }, + { -70, 13 }, { -71, -58 }, { 15, 18 }, { 16, 17 }, + { -72, -57 }, { -73, -74 }, { 19, 22 }, { -56, 20 }, + { -55, 21 }, { -54, -77 }, { 23, 31 }, { 24, 25 }, + { -75, -76 }, { 26, 27 }, { -78, -53 }, { 28, 29 }, + { -52, -95 }, { -94, 30 }, { -93, -92 }, { 32, 47 }, + { 33, 40 }, { 34, 37 }, { 35, 36 }, { -91, -90 }, + { -89, -88 }, { 38, 39 }, { -87, -86 }, { -85, -84 }, + { 41, 44 }, { 42, 43 }, { -83, -82 }, { -81, -80 }, + { 45, 46 }, { -79, -51 }, { -50, -49 }, { 48, 55 }, + { 49, 52 }, { 50, 51 }, { -48, -47 }, { -46, -45 }, + { 53, 54 }, { -44, -43 }, { -42, -41 }, { 56, 59 }, + { 57, 58 }, { -40, -39 }, { -38, -37 }, { 60, 61 }, + { -36, -35 }, { -34, -33 } +}; + +const sbyte fHuffmanEnv30dB[62][2] = { + { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, + { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 }, + { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 }, + { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 }, + { 17, 19 }, { -56, 18 }, { -55, -73 }, { 20, 24 }, + { 21, 22 }, { -74, -54 }, { -53, 23 }, { -75, -76 }, + { 25, 30 }, { 26, 27 }, { -52, -51 }, { 28, 29 }, + { -77, -79 }, { -50, -49 }, { 31, 39 }, { 32, 35 }, + { 33, 34 }, { -78, -46 }, { -82, -88 }, { 36, 37 }, + { -83, -48 }, { -47, 38 }, { -86, -85 }, { 40, 47 }, + { 41, 44 }, { 42, 43 }, { -80, -44 }, { -43, -42 }, + { 45, 46 }, { -39, -87 }, { -84, -40 }, { 48, 55 }, + { 49, 52 }, { 50, 51 }, { -95, -94 }, { -93, -92 }, + { 53, 54 }, { -91, -90 }, { -89, -81 }, { 56, 59 }, + { 57, 58 }, { -45, -41 }, { -38, -37 }, { 60, 61 }, + { -36, -35 }, { -34, -33 } +}; + +const sbyte tHuffmanEnvBal30dB[24][2] = { + { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 }, + { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, + { -60, 9 }, { 10, 16 }, { 11, 13 }, { -69, 12 }, + { -76, -75 }, { 14, 15 }, { -74, -73 }, { -72, -71 }, + { 17, 20 }, { 18, 19 }, { -70, -59 }, { -58, -57 }, + { 21, 22 }, { -56, -55 }, { -54, 23 }, { -53, -52 } +}; + +const sbyte fHuffmanEnvBal30dB[24][2] = { + { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, + { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, + { -60, 9 }, { 10, 13 }, { -69, 11 }, { -59, 12 }, + { -58, -76 }, { 14, 17 }, { 15, 16 }, { -75, -74 }, + { -73, -72 }, { 18, 21 }, { 19, 20 }, { -71, -70 }, + { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 } +}; + +const sbyte tHuffmanNoise30dB[62][2] = { + { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 }, + { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 }, + { 9, 30 }, { 10, 15 }, { -60, 11 }, { -69, 12 }, + { 13, 14 }, { -59, -53 }, { -95, -94 }, { 16, 23 }, + { 17, 20 }, { 18, 19 }, { -93, -92 }, { -91, -90 }, + { 21, 22 }, { -89, -88 }, { -87, -86 }, { 24, 27 }, + { 25, 26 }, { -85, -84 }, { -83, -82 }, { 28, 29 }, + { -81, -80 }, { -79, -78 }, { 31, 46 }, { 32, 39 }, + { 33, 36 }, { 34, 35 }, { -77, -76 }, { -75, -74 }, + { 37, 38 }, { -73, -72 }, { -71, -70 }, { 40, 43 }, + { 41, 42 }, { -58, -57 }, { -56, -55 }, { 44, 45 }, + { -54, -52 }, { -51, -50 }, { 47, 54 }, { 48, 51 }, + { 49, 50 }, { -49, -48 }, { -47, -46 }, { 52, 53 }, + { -45, -44 }, { -43, -42 }, { 55, 58 }, { 56, 57 }, + { -41, -40 }, { -39, -38 }, { 59, 60 }, { -37, -36 }, + { -35, 61 }, { -34, -33 } +}; + +const sbyte tHuffmanNoiseBal30dB[24][2] = { + { -64, 1 }, { -65, 2 }, { -63, 3 }, { 4, 9 }, + { -66, 5 }, { -62, 6 }, { 7, 8 }, { -76, -75 }, + { -74, -73 }, { 10, 17 }, { 11, 14 }, { 12, 13 }, + { -72, -71 }, { -70, -69 }, { 15, 16 }, { -68, -67 }, + { -61, -60 }, { 18, 21 }, { 19, 20 }, { -59, -58 }, + { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 } +}; + +} diff --git a/aac/aaccodebook.h b/aac/aaccodebook.h new file mode 100644 index 0000000..b51bc71 --- /dev/null +++ b/aac/aaccodebook.h @@ -0,0 +1,85 @@ +#ifndef AACCODEBOOK_H +#define AACCODEBOOK_H + +#include +#include + +namespace Media { + +struct LIB_EXPORT AacHcb +{ + byte offset; + byte extraBits; +}; + +struct LIB_EXPORT AacHcb2Pair +{ + byte bits; + sbyte x; + sbyte y; +}; + +struct LIB_EXPORT AacHcb2Quad +{ + byte bits; + sbyte x; + sbyte y; + sbyte v; + sbyte w; +}; + +struct LIB_EXPORT AacHcbBinPair +{ + byte isLeaf; + sbyte data[2]; +}; + +struct LIB_EXPORT AacHcbBinQuad +{ + byte isLeaf; + sbyte data[4]; +}; + +extern const AacHcb *const aacHcbTable[]; +extern const AacHcb2Pair *const aacHcb2PairTable[]; +extern const AacHcb2Quad *const aacHcb2QuadTable[]; +extern const AacHcbBinPair *const aacHcbBinTable[]; +extern const byte aacHcbN[]; +extern const int aacHcb2QuadTableSize[]; +extern const int aacHcb2PairTableSize[]; +extern const int aacHcbBinTableSize[]; + +extern const AacHcb aacHcb1Step1[]; +extern const AacHcb2Quad aacHcb1Step2[]; +extern const AacHcb aacHcb2Step1[]; +extern const AacHcb2Quad aacHcb2Step2[]; +extern const AacHcbBinQuad aacHcb3[]; +extern const AacHcb aacHcb4Step1[]; +extern const AacHcb2Quad aacHcb4Step2[]; +extern const AacHcbBinPair aacHcb5[]; +extern const AacHcb aacHcb6Step1[]; +extern const AacHcb2Pair aacHcb6Step2[]; +extern const AacHcbBinPair aacHcb7[]; +extern const AacHcb aacHcb8Step1[]; +extern const AacHcb2Pair aacHcb8Step2[]; +extern const AacHcbBinPair aacHcb9[]; +extern const AacHcb aacHcb10Step1[]; +extern const AacHcb2Pair aacHcb10Step2[]; +extern const AacHcb aacHcb11Step1[]; +extern const AacHcb2Pair aacHcb11Step2[]; +extern const byte aacHcbSf[][2]; + +extern const sbyte tHuffmanEnv15dB[120][2]; +extern const sbyte fHuffmanEnv15dB[120][2]; +extern const sbyte tHuffmanEnvBal15dB[48][2]; +extern const sbyte fHuffmanEnvBal15dB[48][2]; +extern const sbyte tHuffmanEnv30dB[62][2]; +extern const sbyte fHuffmanEnv30dB[62][2]; +extern const sbyte tHuffmanEnvBal30dB[24][2]; +extern const sbyte fHuffmanEnvBal30dB[24][2]; +extern const sbyte tHuffmanNoise30dB[62][2]; +extern const sbyte tHuffmanNoiseBal30dB[24][2]; + +} + +#endif // AACCODEBOOK_H diff --git a/aac/aacframe.cpp b/aac/aacframe.cpp new file mode 100644 index 0000000..dfbfbd3 --- /dev/null +++ b/aac/aacframe.cpp @@ -0,0 +1,2125 @@ +#include "./aacframe.h" +#include "./aaccodebook.h" + +#include "../adts/adtsframe.h" + +#include "../mp4/mp4ids.h" + +#include "../exceptions.h" + +#include +#include + +#include + +using namespace std; +using namespace IoUtilities; + +namespace Media { + +/*! + * \cond + */ + +const byte maxPredictionSfb[16] = { + 33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34, 64, 64, 64, 64 +}; + +const uint8_t swb512WindowCount[] = { + 0, 0, 0, 36, 36, 37, 31, 31, 0, 0, 0, 0 +}; + +const byte swb480WindowCount[] = { + 0, 0, 0, 35, 35, 37, 30, 30, 0, 0, 0, 0 +}; + +const byte swb960WindowCount[] = { + 40, 40, 45, 49, 49, 49, 46, 46, 42, 42, 42, 40 +}; + +const byte swb1024WindowCount[] = { + 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40 +}; + +const byte swb128WindowCount[] = { + 12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15 +}; + +const uint16 swbOffset1024_96[] = { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, + 64, 72, 80, 88, 96, 108, 120, 132, 144, 156, 172, 188, 212, 240, + 276, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960, 1024 +}; + +const uint16 swbOffset128_96[] = { + 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128 +}; + +const uint16 swbOffset1024_64[] = { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, + 64, 72, 80, 88, 100, 112, 124, 140, 156, 172, 192, 216, 240, 268, + 304, 344, 384, 424, 464, 504, 544, 584, 624, 664, 704, 744, 784, 824, + 864, 904, 944, 984, 1024 +}; + +const uint16 swbOffset128_64[] = { + 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128 +}; + +const uint16 swbOffset1024_48[] = { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, + 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292, + 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, + 768, 800, 832, 864, 896, 928, 1024 +}; + +const uint16 swbOffset512_48[] = { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 68, 76, 84, + 92, 100, 112, 124, 136, 148, 164, 184, 208, 236, 268, 300, 332, 364, 396, + 428, 460, 512 +}; + +const uint16 swbOffset480_48[] = { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72 ,80 ,88, + 96, 108, 120, 132, 144, 156, 172, 188, 212, 240, 272, 304, 336, 368, 400, + 432, 480 +}; + +const uint16 swbOffset128_48[] = { + 0, 4, 8, 12, 16, 20, 28, 36, 44, 56, 68, 80, 96, 112, 128 +}; + +const uint16 swbOffset1024_32[] = { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, + 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292, + 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, + 768, 800, 832, 864, 896, 928, 960, 992, 1024 +}; + +const uint16 swbOffset512_32[] = { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, + 88, 96, 108, 120, 132, 144, 160, 176, 192, 212, 236, 260, 288, 320, 352, + 384, 416, 448, 480, 512 +}; + +const uint16 swbOffset480_32[] = { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, + 88, 96, 104, 112, 124, 136, 148, 164, 180, 200, 224, 256, 288, 320, 352, + 384, 416, 448, 480 +}; + +const uint16 swbOffset1024_24[] = { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, + 76, 84, 92, 100, 108, 116, 124, 136, 148, 160, 172, 188, 204, 220, + 240, 260, 284, 308, 336, 364, 396, 432, 468, 508, 552, 600, 652, 704, + 768, 832, 896, 960, 1024 +}; + +const uint16 swbOffset512_24[] = { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, + 80, 92, 104, 120, 140, 164, 192, 224, 256, 288, 320, 352, 384, 416, + 448, 480, 512 +}; + +const uint16 swbOffset480_24[] = { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, 80, 92, 104, 120, + 140, 164, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 +}; + +const uint16 swbOffset128_24[] = { + 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 64, 76, 92, 108, 128 +}; + +const uint16 swbOffset1024_16[] = { + 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 100, 112, 124, + 136, 148, 160, 172, 184, 196, 212, 228, 244, 260, 280, 300, 320, 344, + 368, 396, 424, 456, 492, 532, 572, 616, 664, 716, 772, 832, 896, 960, 1024 +}; + +const uint16 swbOffset128_16[] = { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 60, 72, 88, 108, 128 +}; + +const uint16 swbOffset1024_8[] = { + 0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 172, + 188, 204, 220, 236, 252, 268, 288, 308, 328, 348, 372, 396, 420, 448, + 476, 508, 544, 580, 620, 664, 712, 764, 820, 880, 944, 1024 +}; + +const uint16 swbOffset128_8[] = { + 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 60, 72, 88, 108, 128 +}; + +const uint16 *swbOffset1024Window[] = { + swbOffset1024_96, /* 96000 */ + swbOffset1024_96, /* 88200 */ + swbOffset1024_64, /* 64000 */ + swbOffset1024_48, /* 48000 */ + swbOffset1024_48, /* 44100 */ + swbOffset1024_32, /* 32000 */ + swbOffset1024_24, /* 24000 */ + swbOffset1024_24, /* 22050 */ + swbOffset1024_16, /* 16000 */ + swbOffset1024_16, /* 12000 */ + swbOffset1024_16, /* 11025 */ + swbOffset1024_8 /* 8000 */ +}; + +const uint16 *swbOffset512Window[] = { + 0, /* 96000 */ + 0, /* 88200 */ + 0, /* 64000 */ + swbOffset512_48, /* 48000 */ + swbOffset512_48, /* 44100 */ + swbOffset512_32, /* 32000 */ + swbOffset512_24, /* 24000 */ + swbOffset512_24, /* 22050 */ + 0, /* 16000 */ + 0, /* 12000 */ + 0, /* 11025 */ + 0 /* 8000 */ +}; + +const uint16 *swbOffset480Window[] = { + 0, /* 96000 */ + 0, /* 88200 */ + 0, /* 64000 */ + swbOffset480_48, /* 48000 */ + swbOffset480_48, /* 44100 */ + swbOffset480_32, /* 32000 */ + swbOffset480_24, /* 24000 */ + swbOffset480_24, /* 22050 */ + 0, /* 16000 */ + 0, /* 12000 */ + 0, /* 11025 */ + 0 /* 8000 */ +}; + +const uint16 *swbOffset128Window[] = { + swbOffset128_96, /* 96000 */ + swbOffset128_96, /* 88200 */ + swbOffset128_64, /* 64000 */ + swbOffset128_48, /* 48000 */ + swbOffset128_48, /* 44100 */ + swbOffset128_48, /* 32000 */ + swbOffset128_24, /* 24000 */ + swbOffset128_24, /* 22050 */ + swbOffset128_16, /* 16000 */ + swbOffset128_16, /* 12000 */ + swbOffset128_16, /* 11025 */ + swbOffset128_8 /* 8000 */ +}; + +/*! + * \endcond + */ + +/*! + * \brief Constructs a new LTP info object. + */ +AacLtpInfo::AacLtpInfo() : + lastBand(0), + dataPresent(0), + lag(0), + lagUpdate(0), + coef(0), + longUsed{0}, + shortUsed{0}, + shortLagPresent{0}, + shortLag{0} +{} + +/*! + * \brief Constructs a new predictor info object. + */ +AacPredictorInfo::AacPredictorInfo() : + maxSfb(0), + reset(0), + resetGroupNumber(0), + predictionUsed{0} +{} + +/*! + * \brief Constructs a new pulse info object. + */ +AacPulseInfo::AacPulseInfo() : + count(0), + startSfb(0), + offset{0}, + amp{0} +{} + +/*! + * \brief Constructs a new TNS info object. + */ +AacTnsInfo::AacTnsInfo() : + filt{0}, + coefRes{0}, + length{{0}}, + order{{0}}, + direction{{0}}, + coefCompress{{0}}, + coef{{{0}}} +{} + +/*! + * \brief Constructs a new SSR info object. + */ +AacSsrInfo::AacSsrInfo() : + maxBand(0), + adjustNum{{0}}, + alevcode{{{0}}}, + aloccode{{{0}}} +{} + +/*! + * \brief Constructs a new DRC info object. + */ +AacDrcInfo::AacDrcInfo() : + present(0), + bandCount(0), + pceInstanceTag(0), + excludedChannelsPresent(0), + bandTop{0}, + progRefLevel(0), + dynamicRangeSign{0}, + dynamicRangeControl{0}, + excludeMask{0}, + additionalExcludedChannels{0} +{} + +/*! + * \brief Constructs a new PS info object. + */ +AacPsInfo::AacPsInfo() +{} + +/*! + * \brief Constructs a new DRM-PS info object. + */ +AacDrmPsInfo::AacDrmPsInfo() +{} + +/*! + * \brief Constructs a new SBR info object. + */ +AacSbrInfo::AacSbrInfo(byte sbrElementType, uint16 samplingFrequency, uint16 frameLength, bool isDrm) : + aacElementId(sbrElementType), + samplingFrequency(samplingFrequency), + + maxAacLine(0), + + rate(0), + justSeeked(0), + ret(0), + + ampRes{0}, + + k0(0), + kx(0), + m(0), + nMaster(0), + nHigh(0), + nLow(0), + nq(0), + nl{0}, + n{0}, + + fMaster{0}, + fTableRes{{0}}, + fTableNoise{0}, + fTableLim{{0}}, + fGroup{{0}}, + ng{0}, + + tableMapKToG{0}, + + absBordLead{0}, + absBordTrail{0}, + relLeadCount{0}, + relTrailCount{0}, + + le{0}, + lePrev{0}, + lq{0}, + + te{{0}}, + tq{{0}}, + f{{0}}, + fPrev{0}, + + //*G_temp_prev{{0}}, + //*Q_temp_prev{{0}}, + //GQ_ringbuf_index{0}, + + e{{{0}}}, + ePrev{{0}}, + //E_orig{{{0}}}, + //E_curr{{{0}}}, + q{{{0}}}, + //Q_div{{{0}}}, + //Q_div2{{{0}}}, + qPrev{{0}}, + + la{0}, + laPrev{0}, + + bsInvfMode{{0}}, + bsInvfModePrev{{0}}, + //bwArray{{0}}, + //bwArray_prev{{0}}, + + noPatches(0), + patchNoSubbands{0}, + patchStartSubband{0}, + + bsAddHarmonic{{0}}, + bsAddHarmonicPrev{{0}}, + + indexNoisePrev{0}, + psiIsPrev{0}, + + bsStartFreqPrev(-1), + bsStopFreqPrev(0), + bsXoverBandPrev(0), + bsFreqScalePrev(0), + bsAlterScalePrev(0), + bsNoiseBandsPrev(0), + + prevEnvIsShort{-1, -1}, + + kxPrev(0), + bsco(0), + bscoPrev(0), + mPrev(0), + frameLength(frameLength), + + reset(1), + frame(0), + headerCount(0), + + idAac(0), + //qmfa_info *qmfa{0}, + //qmfs_info *qmfs{0}, + + //qmf_t Xsbr{{{0}}}, + + isDrmSbr(isDrm), + //drm_ps_info *drm_ps; + + timeSlotsRateCount(aacSbrRate * (frameLength == 960 ? aacNoTimeSlots960 : aacNoTimeSlots)), + timeSlotsCount(frameLength == 960 ? aacNoTimeSlots960 : aacNoTimeSlots), + tHfGen(8), + tHfAdj(2), + + psUsed(0), + psResetFlag(0), + + bsHeaderFlag(0), + bsCrcFlag(0), + bsSbrCrcBits(0), + bsProtocolVersion(0), + bsAmpRes(1), + bsStartFreq(5), + bsStopFreq(0), + bsXoverBand(0), + bsFreqScale(2), + bsAlterScale(1), + bsNoiseBands(2), + bsLimiterBands(2), + bsLimiterGains(2), + bsInterpolFreq(1), + bsSmoothingMode(1), + bsSamplerateMode(1), + bsAddHarmonicFlag{0}, + bsAddHarmonicFlagPrev{0}, + bsExtendedData(0), + bsExtensionId(0), + bsExtensionData(0), + bsCoupling(0), + bsFrameClass{0}, + bsRelBord{{0}}, + bsRelBord0{{0}}, + bsRelBord1{{0}}, + bsPointer{0}, + bsAbsBord0{0}, + bsAbsBord1{0}, + bsRelCount0{0}, + bsRelCount1{0}, + bsDfEnv{{0}}, + bsDfNoise{{0}} +{ + throw NotImplementedException(); // TODO + switch(sbrElementType) { + using namespace AacSyntaxElementTypes; + case ChannelPairElement: + + break; + default: + ; + } +} + +/*! + * \brief Constructs a new program config object. + */ +AacProgramConfig::AacProgramConfig() : + elementInstanceTag(0), + objectType(0), + samplingFrequencyIndex(0), + frontChannelElementCount(0), + sideChannelElementCount(0), + backChannelElementCount(0), + lfeChannelElementCount(0), + assocDataElementCount(0), + validCcElementCount(0), + monoMixdownPresent(0), + monoMixdownElementNumber(0), + stereoMixdownPresent(0), + stereoMixdownElementNumber(0), + matrixMixdownIdxPresent(0), + pseudoSurroundEnable(0), + matrixMixdownIdx(0), + frontElementIsCpe{0}, + frontElementTagSelect{0}, + sideElementIsCpe{0}, + sideElementTagSelect{0}, + backElementIsCpe{0}, + backElementTagSelect{0}, + lfeElementTagSelect{0}, + assocDataElementTagSelect{0}, + ccElementIsIndSw{0}, + validCcElementTagSelect{0}, + channels(0), + commentFieldBytes(0), + commentFieldData{0}, + frontChannelCount(0), + sideChannelCount(0), + backChannelCount(0), + lfeChannelCount(0), + sceChannel{0}, + cpeChannel{0} +{} + +/*! + * \brief Constructs a new ICS info object. + */ +AacIcsInfo::AacIcsInfo() : + maxSfb(0), + swbCount(0), + windowGroupCount(0), + windowCount(0), + windowSequence(0), + windowGroupLengths{0}, + windowShape(0), + scaleFactorGrouping(0), + sectionSfbOffset{{0}}, + swbOffset{0}, + maxSwbOffset(0), + sectionCb{{0}}, + sectionStart{{0}}, + sectionEnd{{0}}, + sfbCb{{0}}, + sectionsPerGroup{0}, + globalGain(0), + scaleFactors{{0}}, + midSideCodingMaskPresent(0), + midSideCodingUsed{{0}}, + noiseUsed(0), + isUsed(0), + pulseDataPresent(0), + tnsDataPresent(0), + gainControlPresent(0), + predictorDataPresent(0), + reorderedSpectralDataLength(0), + longestCodewordLength(0), + sfConcealment(0), + revGlobalGain(0), + rvlcSfLength(0), + dpcmNoiseNrg(0), + sfEscapesPresent(0), + rvlcEscapesLength(0), + dpcmNoiseLastPos(0) +{} + +/*! + * \class Media::AacFrameElementParser + * \brief The AacFrameElementParser class parses AAC frame elements. + * \remarks + * - Only reads reads the basic syntax yet; does not reconstruct samples. + * - This class is not well tested yet. + */ + +/*! + * \brief Parses "Long Term Prediction" info. + */ +void AacFrameElementParser::parseLtpInfo(const AacIcsInfo &ics, AacLtpInfo <p) +{ + ltp.lag = 0; + if(m_mpeg4AudioObjectId == Mpeg4AudioObjectIds::ErAacLd) { + if((ltp.lagUpdate = m_reader.readBit())) { + ltp.lag = m_reader.readBits(10); + } + } else { + ltp.lag = m_reader.readBits(11); + } + if(ltp.lag > (m_frameLength << 1)) { + throw InvalidDataException(); + } + ltp.coef = m_reader.readBits(3); + switch(ics.windowSequence) { + case AacIcsSequenceTypes::EightShortSequence: + for(byte w = 0; w < ics.windowCount; ++w) { + if((ltp.shortUsed[w] = m_reader.readBit())) { + if((ltp.shortLagPresent[w] = m_reader.readBit())) { + ltp.shortLag[w] = m_reader.readBits(4); + } + } + } + break; + default: + ltp.lastBand = std::min(ics.maxSfb, aacMaxLtpSfb); + for(byte sfb = 0; sfb < ltp.lastBand; ++sfb) { + ltp.longUsed[sfb] = m_reader.readBit(); + } + } +} + +/*! + * \brief Parses "individual channel stream" info. + */ +void AacFrameElementParser::parseIcsInfo(AacIcsInfo &ics) +{ + using namespace AacIcsSequenceTypes; + if(m_reader.readBit()) { // isc reserved bit (must be 0) + throw InvalidDataException(); + } + ics.windowSequence = m_reader.readBits(2); + ics.windowShape = m_reader.readBit(); + if(m_mpeg4AudioObjectId == Mpeg4AudioObjectIds::ErAacLd && ics.windowSequence != OnlyLongSequence) { + throw InvalidDataException(); // no block switching in LD + } + if(ics.windowSequence == EightShortSequence) { + ics.maxSfb = m_reader.readBits(4); + ics.scaleFactorGrouping = m_reader.readBits(7); + } else { + ics.maxSfb = m_reader.readBits(6); + } + calculateWindowGroupingInfo(ics); + if(ics.windowSequence != EightShortSequence) { + if((ics.predictorDataPresent = m_reader.readBit())) { + switch(m_mpeg4AudioObjectId) { + case Mpeg4AudioObjectIds::AacMain: + // MPEG-2 style AAC predictor + if((ics.predictor.reset = m_reader.readBit())) { + ics.predictor.resetGroupNumber = m_reader.readBits(5); + ics.predictor.maxSfb = ics.maxSfb; + } + if(ics.predictor.maxSfb > maxPredictionSfb[m_mpeg4SamplingFrequencyIndex]) { + ics.predictor.maxSfb = maxPredictionSfb[m_mpeg4SamplingFrequencyIndex]; + } + for(byte sfb = 0; sfb < ics.predictor.maxSfb; ++sfb) { + ics.predictor.predictionUsed[sfb] = m_reader.readBit(); + } + break; + default: + // "Long Term Prediction" + if(m_mpeg4AudioObjectId < Mpeg4AudioObjectIds::ErAacLc) { + if((ics.ltp1.dataPresent = m_reader.readBit())) { + parseLtpInfo(ics, ics.ltp1); + } + if(m_commonWindow) { + if((ics.ltp2.dataPresent = m_reader.readBit())) { + parseLtpInfo(ics, ics.ltp2); + } + } + } + if(!m_commonWindow && (m_mpeg4AudioObjectId >= Mpeg4AudioObjectIds::ErAacLc)) { + if((ics.ltp1.dataPresent = m_reader.readBit())) { + parseLtpInfo(ics, ics.ltp1); + } + } + } + } + } +} + +/*! + * \brief Parses section data. + */ +void AacFrameElementParser::parseSectionData(AacIcsInfo &ics) +{ + const byte sectionBits = ics.windowSequence == AacIcsSequenceTypes::EightShortSequence ? 3 : 5; + const byte sectionEscValue = (1 << sectionBits) - 1; + for(byte groupIndex = 0, sectionIndex = 0; groupIndex < ics.windowGroupCount; ++groupIndex, sectionIndex = 0) { + for(byte i = 0, sectionLength, sectionLengthIncrease; i < ics.maxSfb; i += sectionLength, ++sectionIndex) { + ics.sectionCb[groupIndex][sectionIndex] = m_reader.readBits(m_aacSectionDataResilienceFlag ? 5 : 4); + sectionLength = 0; + sectionLengthIncrease = + (!m_aacSectionDataResilienceFlag && (ics.sectionCb[groupIndex][sectionIndex] < 16 || ics.sectionCb[groupIndex][sectionIndex] > 32) && ics.sectionCb[groupIndex][sectionIndex] != 11) + ? m_reader.readBits(sectionBits) : 1; + while(sectionLengthIncrease == sectionEscValue) { + sectionLength += sectionLengthIncrease; + sectionLengthIncrease = m_reader.readBits(sectionBits); + } + sectionLength += sectionLengthIncrease; + ics.sectionStart[groupIndex][sectionIndex] = i; + ics.sectionEnd[groupIndex][sectionIndex] = i + sectionLength; + if(ics.windowSequence == AacIcsSequenceTypes::EightShortSequence) { + if(i + sectionLength > 8 * 15) { + throw InvalidDataException(); + } else if(sectionIndex >= 8 * 15) { + throw InvalidDataException(); + } + } else { + if(i + sectionLength > aacMaxSfb) { + throw InvalidDataException(); + } else if(sectionIndex >= aacMaxSfb) { + throw InvalidDataException(); + } + } + for(byte sfb = i; sfb < i + sectionLength; ++sfb) { + ics.sfbCb[groupIndex][sfb] = ics.sectionCb[groupIndex][sectionIndex]; + } + } + ics.sectionsPerGroup[groupIndex] = sectionIndex; + } +} + +/*! + * \brief Decodes scale factor data (called by parseScaleFactorData()). + */ +void AacFrameElementParser::decodeScaleFactorData(AacIcsInfo &ics) +{ + int16 tmp; + byte noisePcmFlag = 1; + int16 scaleFactor = ics.globalGain; + int16 isPosition = 0; + int16 noiseEnergy = ics.globalGain - 90; + using namespace AacScaleFactorTypes; + for(byte group = 0; group < ics.windowGroupCount; ++group) { + for(byte sfb = 0; sfb < ics.maxSfb; ++sfb) { + switch(ics.sfbCb[group][sfb]) { + case ZeroHcb: // zero book + ics.scaleFactors[group][sfb] = 0; + break; + case IntensityHcb: // intensity books + case IntensityHcb2: + ics.scaleFactors[group][sfb] = (isPosition += (parseHuffmanScaleFactor() - 60)); + break; + case NoiseHcb: // noise books + if(noisePcmFlag) { + noisePcmFlag = 0; + tmp = m_reader.readBits(9); + } else { + tmp = parseHuffmanScaleFactor() - 60; + } + ics.scaleFactors[group][sfb] = (noiseEnergy += tmp); + break; + default: // spectral books + scaleFactor += parseHuffmanScaleFactor() - 60; + if(scaleFactor < 0 || scaleFactor > 255) { + throw InvalidDataException(); + } else { + ics.scaleFactors[group][sfb] = 0; + } + } + } + } +} + +/*! + * \brief Decodes RVLC scale factor data. + */ +void AacFrameElementParser::decodeRvlcScaleFactorData(AacIcsInfo &ics) +{ + if(ics.rvlcSfLength) { + m_reader.skipBits(ics.rvlcSfLength); + } + if(ics.sfEscapesPresent) { + m_reader.skipBits(ics.rvlcEscapesLength); + } + // TODO: decode RVLC scale factors and escapes +} + +/*! + * \brief Parses scale factor data. + */ +void AacFrameElementParser::parseScaleFactorData(AacIcsInfo &ics) +{ + if(!m_aacScalefactorDataResilienceFlag) { + decodeScaleFactorData(ics); + } else { + decodeRvlcScaleFactorData(ics); + } +} + +/*! + * \brief Parses pulse data. + */ +void AacFrameElementParser::parsePulseData(AacIcsInfo &ics) +{ + AacPulseInfo &p = ics.pulse; + p.count = m_reader.readBits(2); + p.startSfb = m_reader.readBits(6); + if(p.startSfb > ics.swbCount) { + throw InvalidDataException(); + } + for(byte i = 0; i <= p.count; ++i) { + p.offset[i] = m_reader.readBits(5); + p.amp[i] = m_reader.readBits(4); + } +} + +/*! + * \brief Parses TNS data. + */ +void AacFrameElementParser::parseTnsData(AacIcsInfo &ics) +{ + byte filtBits, lengthBits, orderBits, startCoefBits, coefBits; + if(ics.windowSequence == AacIcsSequenceTypes::EightShortSequence) { + filtBits = 1; + lengthBits = 4; + orderBits = 3; + } else { + filtBits = 2; + lengthBits = 6; + orderBits = 5; + } + for(byte window = 0; window < ics.windowCount; ++window) { + if((ics.tns.filt[window] = m_reader.readBits(filtBits))) { + startCoefBits = (ics.tns.coefRes[window] = m_reader.readBit()) ? 4 : 3; + } + for(byte filt = 0; filt < ics.tns.filt[window]; ++filt) { + ics.tns.length[window][filt] = m_reader.readBits(lengthBits); + if((ics.tns.order[window][filt] = m_reader.readBits(orderBits))) { + ics.tns.direction[window][filt] = m_reader.readBit(); + ics.tns.coefCompress[window][filt] = m_reader.readBit(); + coefBits = startCoefBits - ics.tns.coefCompress[window][filt]; + for(byte i = 0; i < ics.tns.order[window][filt]; ++i) { + ics.tns.coef[window][filt][i] = m_reader.readBits(coefBits); + } + } + } + } +} + +/*! + * \brief Parses gain control data. + */ +void AacFrameElementParser::parseGainControlData(AacIcsInfo &ics) +{ + AacSsrInfo &ssr = ics.ssr; + ssr.maxBand = m_reader.readBits(2); + switch(ics.windowSequence) { + using namespace AacIcsSequenceTypes; + case OnlyLongSequence: + for(byte bd = 1; bd <= ssr.maxBand; ++bd) { + for(byte wd = 0; wd < 1; ++wd) { + ssr.adjustNum[bd][wd] = m_reader.readBits(3); + for(byte ad = 0; ad < ssr.adjustNum[bd][wd]; ++ad) { + ssr.alevcode[bd][wd][ad] = m_reader.readBits(4); + ssr.aloccode[bd][wd][ad] = m_reader.readBits(5); + } + } + } + break; + case LongStartSequence: + for(byte bd = 1; bd <= ssr.maxBand; ++bd) { + for(byte wd = 0; wd < 2; ++wd) { + ssr.adjustNum[bd][wd] = m_reader.readBits(3); + for(byte ad = 0; ad < ssr.adjustNum[bd][wd]; ++ad) { + ssr.alevcode[bd][wd][ad] = m_reader.readBits(4); + ssr.aloccode[bd][wd][ad] = m_reader.readBits(wd ? 2 : 4); + } + } + } + break; + case EightShortSequence: + for(byte bd = 1; bd <= ssr.maxBand; ++bd) { + for(byte wd = 0; wd < 8; ++wd) { + ssr.adjustNum[bd][wd] = m_reader.readBits(3); + for(byte ad = 0; ad < ssr.adjustNum[bd][wd]; ++ad) { + ssr.alevcode[bd][wd][ad] = m_reader.readBits(4); + ssr.aloccode[bd][wd][ad] = m_reader.readBits(2); + } + } + } + break; + case LongStopSequence: + for(byte bd = 1; bd <= ssr.maxBand; ++bd) { + for(byte wd = 0; wd < 2; ++wd) { + ssr.adjustNum[bd][wd] = m_reader.readBits(3); + for(byte ad = 0; ad < ssr.adjustNum[bd][wd]; ++ad) { + ssr.alevcode[bd][wd][ad] = m_reader.readBits(4); + ssr.aloccode[bd][wd][ad] = m_reader.readBits(wd ? 5 : 4); + } + } + } + break; + } +} + +/*! + * \brief Parses spectral data. + */ +void AacFrameElementParser::parseSpectralData(AacIcsInfo &ics, int16 *specData) +{ + //byte groups = 0; + //uint16 nshort = m_frameLength / 8; + for(byte group = 0; group < ics.windowGroupCount; ++group) { + //byte p = groups * nshort; + for(byte section = 0; section < ics.sectionsPerGroup[group]; ++section) { + using namespace AacScaleFactorTypes; + byte sectionCb = ics.sectionCb[group][section]; + uint16 increment = (sectionCb >= FirstPairHcb) ? 2 : 4; + switch(sectionCb) { + case ZeroHcb: + case NoiseHcb: + case IntensityHcb: + case IntensityHcb2: + //p += (ics.sectionSfbOffset[group][ics.sectionEnd[group][section]] - ics.sectionSfbOffset[group][ics.sectionStart[group][section]]); + break; + default: + for(uint16 k = ics.sectionSfbOffset[group][ics.sectionStart[group][section]]; k < ics.sectionSfbOffset[group][ics.sectionEnd[group][section]]; k += increment) { + parseHuffmanSpectralData(sectionCb, specData); + //p += increment; + } + } + } + //groups += ics.windowGroupLengths[group]; + } +} + +/*! + * \brief Parses "side info". + */ +void AacFrameElementParser::parseSideInfo(AacIcsInfo &ics, bool scaleFlag) +{ + ics.globalGain = m_reader.readBits(8); + if(!m_commonWindow && !scaleFlag) { + parseIcsInfo(ics); + } + parseSectionData(ics); + parseScaleFactorData(ics); + if(!scaleFlag) { + if((ics.pulseDataPresent = m_reader.readBit())) { + parsePulseData(ics); + } + if((ics.tnsDataPresent = m_reader.readBit())) { + parseTnsData(ics); + } + if((ics.gainControlPresent = m_reader.readBit())) { + if(m_mpeg4AudioObjectId != Mpeg4AudioObjectIds::AacSsr) { + throw InvalidDataException(); + } else { + parseGainControlData(ics); + } + } + } + if(m_aacScalefactorDataResilienceFlag) { + decodeRvlcScaleFactorData(ics); + } +} + +byte AacFrameElementParser::parseExcludedChannels() +{ + for(byte i = 0; i < 7; ++i) { + m_drc.excludeMask[i] = m_reader.readBit(); + } + byte size = 0; + for(; (m_drc.additionalExcludedChannels[size] = m_reader.readBit()); ++size) { + for(byte i = 0; i < 7; ++i) { + m_drc.excludeMask[i] = m_reader.readBit(); + } + } + return size + 1; +} + +byte AacFrameElementParser::parseDynamicRange() +{ + byte size = 1; + m_drc.bandCount = 1; + if(m_reader.readBit()) { // excluded channels present + m_drc.pceInstanceTag = m_reader.readBits(4); + m_reader.skipBits(4); // skip reserved bits + ++size; + } + if((m_drc.excludedChannelsPresent = m_reader.readBit())) { + size += parseExcludedChannels(); + } + if(m_reader.readBit()) { // has bands data + m_drc.bandCount += m_reader.readBits(4); + m_reader.skipBits(4); // skip reserved bits + ++size; + for(byte i = 0; i < m_drc.bandCount; ++i, ++size) { + m_drc.bandTop[i] = m_reader.readBits(8); + } + } + if(m_reader.readBit()) { // has prog ref level + m_drc.progRefLevel = m_reader.readBits(7); + m_reader.skipBits(1); // skip reserved bit + ++size; + } + for(byte i = 0; i < m_drc.bandCount; ++i) { + m_drc.dynamicRangeSign[i] = m_reader.readBit(); + m_drc.dynamicRangeControl[i] = m_reader.readBits(7); + ++size; + } + return size; +} + +int16 AacFrameElementParser::sbrHuffmanDec(SbrHuffTab table) +{ + byte bit; + int16 index = 0; + while(index >= 0) { + bit = m_reader.readBit(); + index = table[index][bit]; + } + return index + 64; +} + +void AacFrameElementParser::parseSbrGrid(std::shared_ptr &sbr, byte channel) +{ + byte tmp, bsEnvCount, bsRelCount0, bsRelCount1; + switch((sbr->bsFrameClass[channel] = m_reader.readBits(2))) { + using namespace BsFrameClasses; + case FixFix: + tmp = m_reader.readBits(2); + sbr->absBordLead[channel] = 0; + sbr->absBordTrail[channel] = sbr->timeSlotsCount; + sbr->relLeadCount[channel] = (bsEnvCount = min(1 << tmp, 5)) - 1; + sbr->relTrailCount[channel] = 0; + tmp = m_reader.readBit(); + for(byte env = 0; env < bsEnvCount; ++env) { + sbr->f[channel][env] = tmp; + } + break; + case FixVar: + sbr->absBordLead[channel] = 0; + sbr->absBordTrail[channel] = m_reader.readBits(2) + sbr->timeSlotsCount; + sbr->relLeadCount[channel] = 0; + sbr->relTrailCount[channel] = bsEnvCount = m_reader.readBits(2); + for(byte rel = 0; rel < bsEnvCount; ++rel) { + sbr->bsRelBord[channel][rel] = 2 * m_reader.readBits(2) + 2; + } + sbr->bsPointer[channel] = m_reader.readBits(sbrLog2(bsEnvCount + 2)); + for(byte env = 0; env <= bsEnvCount; ++env) { + sbr->f[channel][bsEnvCount - env] = m_reader.readBit(); + } + break; + case VarFix: + sbr->absBordLead[channel] = m_reader.readBits(2); + sbr->absBordTrail[channel] = sbr->timeSlotsCount; + sbr->relLeadCount[channel] = bsEnvCount = m_reader.readBits(2); + sbr->relTrailCount[channel] = 0; + for(byte rel = 0; rel < bsEnvCount; ++rel) { + sbr->bsRelBord[channel][rel] = 2 * m_reader.readBits(2) + 2; + } + sbr->bsPointer[channel] = m_reader.readBits(sbrLog2(bsEnvCount + 2)); + for(byte env = 0; env < bsEnvCount; ++env) { + sbr->f[channel][env] = m_reader.readBit(); + } + break; + case VarVar: + sbr->absBordLead[channel] = m_reader.readBits(2); + sbr->absBordTrail[channel] = m_reader.readBits(2) + sbr->timeSlotsCount; + bsRelCount0 = m_reader.readBits(2); + bsRelCount1 = m_reader.readBits(2); + bsEnvCount = min(5, sbr->bsRelCount0[channel] + sbr->bsRelCount1[channel] + 1); + for(byte rel = 0; rel < sbr->bsRelCount0[channel]; ++rel) { + sbr->bsRelBord0[channel][rel] = 2 * m_reader.readBits(2) + 2; + } + for(byte rel = 0; rel < sbr->bsRelCount1[channel]; ++rel) { + sbr->bsRelBord1[channel][rel] = 2 * m_reader.readBits(2) + 2; + } + sbr->bsPointer[channel] = m_reader.readBits(sbrLog2(sbr->bsRelCount0[channel] + sbr->bsRelCount1[channel] + 2)); + for(byte env = 0; env < bsEnvCount; ++env) { + sbr->f[channel][env] = m_reader.readBit(); + } + sbr->relLeadCount[channel] = sbr->bsRelCount0[channel]; + sbr->relTrailCount[channel] = sbr->bsRelCount1[channel]; + break; + default: + ; + } + if((sbr->le[channel] = min(bsEnvCount, sbr->bsFrameClass[channel] == BsFrameClasses::VarVar ? 5 : 4)) <= 0) { + throw InvalidDataException(); + } + sbr->lq[channel] = sbr->le[channel] > 1 ? 2 : 1; + // TODO: envelope time border vector, noise floor time border vector +} + +void AacFrameElementParser::parseSbrDtdf(std::shared_ptr &sbr, byte channel) +{ + for(byte i = 0; i < sbr->le[channel]; ++i) { + sbr->bsDfEnv[channel][i] = m_reader.readBit(); + } + for(byte i = 0; i < sbr->lq[channel]; ++i) { + sbr->bsDfNoise[channel][i] = m_reader.readBit(); + } +} + +void AacFrameElementParser::parseInvfMode(std::shared_ptr &sbr, byte channel) +{ + for(byte i = 0; i < sbr->nq; ++i) { + sbr->bsInvfMode[channel][i] = m_reader.readBits(2); + } +} + +void AacFrameElementParser::parseSbrEnvelope(std::shared_ptr &sbr, byte channel) +{ + sbyte delta; + SbrHuffTab tHuff, fHuff; + if((sbr->le[channel] == 1) && (sbr->bsFrameClass[channel] == BsFrameClasses::FixFix)) { + sbr->ampRes[channel] = 0; + } else { + sbr->ampRes[channel] = sbr->bsAmpRes; + } + if((sbr->bsCoupling) && (channel == 1)) { + delta = 1; + if(sbr->ampRes[channel]) { + tHuff = tHuffmanEnvBal30dB; + fHuff = fHuffmanEnvBal30dB; + } else { + tHuff = tHuffmanEnvBal15dB; + fHuff = fHuffmanEnvBal15dB; + } + } else { + delta = 0; + if(sbr->ampRes[channel]) { + tHuff = tHuffmanEnv30dB; + fHuff = fHuffmanEnv30dB; + } else { + tHuff = tHuffmanEnv15dB; + fHuff = fHuffmanEnv15dB; + } + } + for(byte env = 0; env < sbr->le[channel]; ++env) { + if(sbr->bsDfEnv[channel][env] == 0) { + if((sbr->bsCoupling == 1) && (channel == 1)) { + if(sbr->ampRes[channel]) { + sbr->e[channel][0][env] = m_reader.readBits(5) << delta; + } else { + sbr->e[channel][0][env] = m_reader.readBits(6) << delta; + } + } else { + if(sbr->ampRes[channel]) { + sbr->e[channel][0][env] = m_reader.readBits(6) << delta; + } else { + sbr->e[channel][0][env] = m_reader.readBits(7) << delta; + } + } + for(byte band = 1; band < sbr->n[sbr->f[channel][env]]; ++band) { + sbr->e[channel][band][env] = sbrHuffmanDec(fHuff) << delta; + } + } else { + for(byte band = 0; band < sbr->n[sbr->f[channel][env]]; ++band) { + sbr->e[channel][band][env] = sbrHuffmanDec(fHuff) << delta; + } + } + } + // TODO: extract envelope data +} + +void AacFrameElementParser::parseSbrNoise(std::shared_ptr &sbr, byte channel) +{ + sbyte delta; + SbrHuffTab tHuff, fHuff; + if((sbr->bsCoupling == 1) && (channel == 1)) { + delta = 1; + tHuff = tHuffmanNoiseBal30dB; + fHuff = fHuffmanEnvBal30dB; + } else { + delta = 1; + tHuff = tHuffmanNoise30dB; + fHuff = fHuffmanEnv30dB; + } + for(byte noise = 0; noise < sbr->lq[channel]; ++noise) { + if(sbr->bsDfNoise[channel][noise] == 0) { + if((sbr->bsCoupling == 1) && (channel == 1)) { + sbr->q[channel][0][noise] = m_reader.readBits(5) << delta; + } else { + sbr->q[channel][0][noise] = m_reader.readBits(5) << delta; + } + for(byte band = 1; band < sbr->nq; ++band) { + sbr->q[channel][band][noise] = sbrHuffmanDec(fHuff) << delta; + } + } else { + for(byte band = 0; band < sbr->nq; ++band) { + sbr->q[channel][band][noise] = sbrHuffmanDec(fHuff) << delta; + } + } + } + // TODO: extract noise floor data +} + +void AacFrameElementParser::parseSbrSinusoidalCoding(std::shared_ptr &sbr, byte channel) +{ + for(byte i = 0; i < sbr->nHigh; ++i) { + sbr->bsAddHarmonic[channel][i] = m_reader.readBit(); + } +} + +uint16 AacFrameElementParser::parseSbrExtension(std::shared_ptr &sbr, byte extensionId, byte) +{ + byte header; + uint16 res; + switch(extensionId) { + using namespace AacSbrExtensionIds; + case Ps: + if(sbr->psResetFlag) { + sbr->ps->headerRead = 0; + } + res = parsePsData(sbr->ps, header); + if(sbr->psUsed == 0 && header == 1) { + sbr->psUsed = 1; + } + if(header == 1) { + sbr->psResetFlag = 0; + } + return res; + case DrmParametricStereo: + sbr->psUsed = 1; + return parseDrmPsData(sbr->drmPs); + default: + sbr->bsExtendedData = m_reader.readBits(6); + return 6; + } +} + +uint16 AacFrameElementParser::parsePsData(std::shared_ptr &ps, byte &header) +{ + if(m_reader.readBit()) { + header = 1; + ps->headerRead = 1; + ps->use34HybridBands = 0; + if((ps->enableIID = m_reader.readBit())) { + ps->iidMode = m_reader.readBits(3); + } + + } + throw NotImplementedException(); // TODO +} + +uint16 AacFrameElementParser::parseDrmPsData(std::shared_ptr &drmPs) +{ + throw NotImplementedException(); // TODO +} + +void AacFrameElementParser::parseSbrSingleChannelElement(std::shared_ptr &sbr) +{ + if(m_reader.readBit()) { // bs data extra + m_reader.skipBits(4); // skip bs reserved + } + if(sbr->isDrmSbr) { + m_reader.skipBits(1); // bs coupling + } + parseSbrGrid(sbr, 0); + parseSbrDtdf(sbr, 0); + parseInvfMode(sbr, 0); + parseSbrEnvelope(sbr, 0); + parseSbrNoise(sbr, 0); + // TODO: envelope noise dequantisation + if((sbr->bsAddHarmonicFlag[0] = m_reader.readBit())) { + parseSbrSinusoidalCoding(sbr, 0); + } + if((sbr->bsExtendedData = m_reader.readBit())) { + uint16 cnt = m_reader.readBits(4); + if(cnt == 0xF) { + cnt += m_reader.readBits(8); + } + uint16 bitsLeft = 8 * cnt; + while(bitsLeft > 7) { + sbr->bsExtensionId = m_reader.readBits(2); + uint16 tmpBitCount = 2 + parseSbrExtension(sbr, sbr->bsExtensionId, bitsLeft); + if(tmpBitCount > bitsLeft) { + throw InvalidDataException(); + } else { + bitsLeft -= tmpBitCount; + } + } + if(bitsLeft) { // read remaining bits + m_reader.skipBits(bitsLeft); + } + } +} + +void AacFrameElementParser::parseSbrChannelPairElement(std::shared_ptr &sbr) +{ + if(m_reader.readBit()) { // bs data extra + m_reader.skipBits(8); // skip bs reserved + } + if((sbr->bsCoupling = m_reader.readBit())) { + parseSbrGrid(sbr, 0); + // copy data from left to right + sbr->bsFrameClass[1] = sbr->bsFrameClass[0]; + sbr->le[1] = sbr->le[0]; + sbr->lq[1] = sbr->lq[0]; + sbr->bsPointer[1] = sbr->bsPointer[0]; + for(byte n = 0; n < sbr->le[0]; ++n) { + sbr->te[1][n] = sbr->te[0][n]; + sbr->f[1][n] = sbr->f[0][n]; + } + for(byte n = 0; n < sbr->lq[0]; ++n) { + sbr->tq[1][n] = sbr->tq[0][n]; + } + parseSbrDtdf(sbr, 0); + parseSbrDtdf(sbr, 1); + parseInvfMode(sbr, 0); + for(byte n = 0; n < sbr->nq; ++n) { + sbr->bsInvfMode[1][n] = sbr->bsInvfMode[0][n]; + } + parseSbrEnvelope(sbr, 0); + parseSbrNoise(sbr, 0); + parseSbrEnvelope(sbr, 1); + parseSbrNoise(sbr, 1); + } else { + parseSbrGrid(sbr, 0); + parseSbrGrid(sbr, 1); + parseSbrDtdf(sbr, 0); + parseSbrDtdf(sbr, 1); + parseInvfMode(sbr, 0); + parseInvfMode(sbr, 1); + parseSbrEnvelope(sbr, 0); + parseSbrEnvelope(sbr, 1); + parseSbrNoise(sbr, 0); + parseSbrNoise(sbr, 1); + } + if((sbr->bsAddHarmonicFlag[0] = m_reader.readBit())) { + parseSbrSinusoidalCoding(sbr, 0); + } + if((sbr->bsAddHarmonicFlag[1] = m_reader.readBit())) { + parseSbrSinusoidalCoding(sbr, 1); + } + // TODO: envelope noise dequantisation (for both channels) + if(sbr->bsCoupling) { + // TODO: unmap envelope noise + } + if((sbr->bsExtendedData = m_reader.readBit())) { + uint16 cnt = m_reader.readBits(4); + if(cnt == 0xF) { + cnt += m_reader.readBits(8); + } + uint16 bitsLeft = 8 * cnt; + while(bitsLeft > 7) { + sbr->bsExtensionId = m_reader.readBits(2); + uint16 tmpBitCount = 2 + parseSbrExtension(sbr, sbr->bsExtensionId, bitsLeft); + if(tmpBitCount > bitsLeft) { + throw InvalidDataException(); + } else { + bitsLeft -= tmpBitCount; + } + } + if(bitsLeft) { // read remaining bits + m_reader.skipBits(bitsLeft); + } + } +} + +shared_ptr AacFrameElementParser::makeSbrInfo(byte sbrElement, bool isDrm) +{ + if(m_mpeg4ExtensionSamplingFrequencyIndex >= sizeof(mpeg4SamplingFrequencyTable) && m_mpeg4SamplingFrequencyIndex >= sizeof(mpeg4SamplingFrequencyTable)) { + throw InvalidDataException(); // sampling frequency index is invalid + } + return make_shared(m_elementId[sbrElement], m_mpeg4ExtensionSamplingFrequencyIndex < sizeof(mpeg4SamplingFrequencyTable) ? mpeg4SamplingFrequencyTable[m_mpeg4ExtensionSamplingFrequencyIndex] : mpeg4SamplingFrequencyTable[m_mpeg4SamplingFrequencyIndex] * 2, m_frameLength, isDrm); +} + +void AacFrameElementParser::parseSbrExtensionData(byte sbrElement, uint16 count, bool crcFlag) +{ + uint16 alignBitCount = 0; + std::shared_ptr &sbr = m_sbrElements[sbrElement]; + if(m_psResetFlag) { + sbr->psResetFlag = m_psResetFlag; + } + if(!sbr->isDrmSbr) { + if(crcFlag) { + sbr->bsSbrCrcBits = m_reader.readBits(10); + } + } + //auto startFrequ = sbr->bsStartFreq; + //auto samplerateMode = sbr->bsSamplerateMode; + //auto stopFrequ = sbr->bsStopFreq; + //auto frequScale = sbr->bsFreqScale; + //auto alterScale = sbr->bsAlterScale; + //auto xoverBand = sbr->bsXoverBand; + if((sbr->bsHeaderFlag = m_reader.readBit())) { + sbr->bsStartFreq = m_reader.readBits(4); + sbr->bsStopFreq = m_reader.readBits(4); + sbr->bsXoverBand = m_reader.readBits(3); + m_reader.skipBits(2); + byte bsExtraHeader1 = m_reader.readBit(); + byte bsExtraHeader2 = m_reader.readBit(); + if(bsExtraHeader1) { + sbr->bsFreqScale = m_reader.readBits(2); + sbr->bsAlterScale = m_reader.readBit(); + sbr->bsNoiseBands = m_reader.readBits(2); + } else { + sbr->bsFreqScale = 2; + sbr->bsAlterScale = 1; + sbr->bsNoiseBands = 2; + } + if(bsExtraHeader2) { + sbr->bsLimiterBands = m_reader.readBits(2); + sbr->bsLimiterGains = m_reader.readBits(2); + sbr->bsInterpolFreq = m_reader.readBit(); + sbr->bsSmoothingMode = m_reader.readBit(); + } else { + sbr->bsLimiterBands = 2; + sbr->bsLimiterGains = 2; + sbr->bsInterpolFreq = 1; + sbr->bsSmoothingMode = 1; + } + } + if(sbr->headerCount) { + if(sbr->reset || (sbr->bsHeaderFlag && sbr->justSeeked)) { + // TODO: calc SBR tables; restore old values on error + } + sbr->rate = sbr->bsSamplerateMode ? 2 : 1; + switch(sbr->aacElementId) { + using namespace AacSyntaxElementTypes; + case SingleChannelElement: + parseSbrSingleChannelElement(sbr); + break; + case ChannelPairElement: + parseSbrChannelPairElement(sbr); + break; + } + } +} + +byte AacFrameElementParser::parseHuffmanScaleFactor() +{ + uint16 offset = 0; + while(aacHcbSf[offset][1]) { + offset += aacHcbSf[offset][m_reader.readBit()]; + if(offset > 240) { + throw InvalidDataException(); + } + } + return aacHcbSf[offset][0]; +} + +void AacFrameElementParser::parseHuffmanSpectralData(byte cb, int16 *sp) +{ + switch(cb) { + case 1: case 2: // 2-step method for data quadruples + huffman2StepQuad(cb, sp); + break; + case 3: // binary search for data quadruples + huffmanBinaryQuadSign(cb, sp); + break; + case 4: // binary search for data paris + huffmanBinaryPair(cb, sp); + break; + case 5: // 2-step method for data pairs + huffman2StepPair(cb, sp); + break; + case 6: // 2-step method for data pairs + huffman2StepPair(cb, sp); + break; + case 7: case 9: // binary search for data pairs + huffmanBinaryPairSign(cb, sp); + break; + case 8: case 10: // 2-step method for data pairs + huffman2StepPairSign(cb, sp); + break; + case 11: + try { + huffman2StepPairSign(11, sp); + } catch(const InvalidDataException &) { + sp[0] = huffmanGetEscape(sp[0]); + sp[1] = huffmanGetEscape(sp[1]); + throw; + } + sp[0] = huffmanGetEscape(sp[0]); + sp[1] = huffmanGetEscape(sp[1]); + break; + case 12: + try { + huffman2StepPair(11, sp); + } catch(const InvalidDataException &) { + sp[0] = huffmanCodebook(0); + sp[1] = huffmanCodebook(1); + throw; + } + sp[0] = huffmanCodebook(0); + sp[1] = huffmanCodebook(1); + break; + case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: + case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: + try { + huffman2StepPairSign(11, sp); + } catch(const InvalidDataException &) { + sp[0] = huffmanGetEscape(sp[0]); + sp[1] = huffmanGetEscape(sp[1]); + vcb11CheckLav(cb, sp); + throw; + } + sp[0] = huffmanGetEscape(sp[0]); + sp[1] = huffmanGetEscape(sp[1]); + vcb11CheckLav(cb, sp); + break; + default: + throw InvalidDataException(); // non existend codebook number + } +} + +void AacFrameElementParser::huffmanSignBits(int16 *sp, byte len) +{ + for(int16 *end = sp + len; sp < end; ++sp) { + if(*sp) { + if(m_reader.readBit()) { + *sp = -(*sp); + } + } + } +} + +void AacFrameElementParser::huffman2StepQuad(byte cb, int16 *sp) +{ + uint32 cw = m_reader.showBits(aacHcbN[cb]); + uint16 offset = aacHcbTable[cb][cw].offset; + uint8_t extraBits = aacHcbTable[cb][cw].extraBits; + if (extraBits) { + m_reader.skipBits(aacHcbN[cb]); + offset += m_reader.showBits(extraBits); + m_reader.skipBits(aacHcb2QuadTable[cb][offset].bits - aacHcbN[cb]); + } else { + m_reader.skipBits(aacHcb2QuadTable[cb][offset].bits); + } + if (offset > aacHcb2QuadTableSize[cb]) { + throw InvalidDataException(); + } + sp[0] = aacHcb2QuadTable[cb][offset].x; + sp[1] = aacHcb2QuadTable[cb][offset].y; + sp[2] = aacHcb2QuadTable[cb][offset].v; + sp[3] = aacHcb2QuadTable[cb][offset].w; +} + +void AacFrameElementParser::huffmanBinaryQuadSign(byte cb, int16 *sp) +{ + try { + huffman2StepQuad(cb, sp); + } catch(const InvalidDataException &) { + huffmanSignBits(sp, 4); + throw; + } + huffmanSignBits(sp, 4); +} + +void AacFrameElementParser::huffmanBinaryPair(byte cb, int16 *sp) +{ + uint16 offset = 0; + while(!aacHcbBinTable[cb][offset].isLeaf) { + offset += aacHcbBinTable[cb][offset].data[m_reader.readBit()]; + } + if(offset > aacHcbBinTableSize[cb]) { + throw InvalidDataException(); + } + sp[0] = aacHcbBinTable[cb][offset].data[0]; + sp[1] = aacHcbBinTable[cb][offset].data[1]; +} + +void AacFrameElementParser::huffman2StepPair(byte cb, int16 *sp) +{ + uint32 cw = m_reader.showBits(aacHcbN[cb]); + uint16 offset = aacHcbTable[cb][cw].offset; + uint8_t extraBits = aacHcbTable[cb][cw].extraBits; + if (extraBits) { + m_reader.skipBits(aacHcbN[cb]); + offset += m_reader.showBits(extraBits); + m_reader.skipBits(aacHcb2PairTable[cb][offset].bits - aacHcbN[cb]); + } else { + m_reader.skipBits(aacHcb2PairTable[cb][offset].bits); + } + if (offset > aacHcb2PairTableSize[cb]) { + throw InvalidDataException(); + } + sp[0] = aacHcb2PairTable[cb][offset].x; + sp[1] = aacHcb2PairTable[cb][offset].y; +} + +void AacFrameElementParser::huffmanBinaryPairSign(byte cb, int16 *sp) +{ + try { + huffmanBinaryPair(cb, sp); + } catch(const InvalidDataException &) { + huffmanSignBits(sp, 2); + throw; + } + huffmanSignBits(sp, 2); +} + +void AacFrameElementParser::huffman2StepPairSign(byte cb, int16 *sp) +{ + try { + huffman2StepPair(cb, sp); + } catch(const InvalidDataException &) { + huffmanSignBits(sp, 2); + throw; + } + huffmanSignBits(sp, 2); +} + +int16 AacFrameElementParser::huffmanGetEscape(int16 sp) +{ + byte neg; + if(sp < 0) { + if (sp != -16) + return sp; + neg = 1; + } else { + if (sp != 16) + return sp; + neg = 0; + } + byte size; + for(size = 4; m_reader.readBit(); ++size) { + } + const int16 off = m_reader.readBits(size); + return neg ? -(off | (1 << size)) : (off | (1 << size)); +} + +void AacFrameElementParser::vcb11CheckLav(byte cb, int16 *sp) +{ + static const uint16_t vcb11LavTab[] = { + 16, 31, 47, 63, 95, 127, 159, 191, 223, + 255, 319, 383, 511, 767, 1023, 2047 + }; + uint16 max = 0; + if (cb < 16 || cb > 31) + return; + max = vcb11LavTab[cb - 16]; + if ((abs(sp[0]) > max) || (abs(sp[1]) > max)) { + sp[0] = 0; + sp[1] = 0; + } +} + +/*! + * \brief Calculates "window grouping info". + */ +void AacFrameElementParser::calculateWindowGroupingInfo(AacIcsInfo &ics) +{ + using namespace AacIcsSequenceTypes; + switch(ics.windowSequence) { + case OnlyLongSequence: + case LongStartSequence: + case LongStopSequence: + ics.windowCount = ics.windowGroupCount = ics.windowGroupLengths[0] = 1; + if(m_mpeg4AudioObjectId == Mpeg4AudioObjectIds::ErAacLd) { + if(m_frameLength == 512) { + ics.swbCount = swb512WindowCount[m_mpeg4SamplingFrequencyIndex]; + } else { // if 480 + ics.swbCount = swb480WindowCount[m_mpeg4SamplingFrequencyIndex]; + } + } else { + if(m_frameLength == 1024) { + ics.swbCount = swb1024WindowCount[m_mpeg4SamplingFrequencyIndex]; + } else { + ics.swbCount = swb960WindowCount[m_mpeg4SamplingFrequencyIndex]; + } + } + if(ics.maxSfb > ics.swbCount) { + throw InvalidDataException(); + } + if(m_mpeg4AudioObjectId == Mpeg4AudioObjectIds::ErAacLd) { + if(m_frameLength == 512) { + for(byte i = 0; i <= ics.swbCount; ++i) { + ics.sectionSfbOffset[0][i] = swbOffset512Window[m_mpeg4SamplingFrequencyIndex][i]; + ics.swbOffset[i] = swbOffset512Window[m_mpeg4SamplingFrequencyIndex][i]; + } + } else { + for(byte i = 0; i <= ics.swbCount; ++i) { + ics.sectionSfbOffset[0][i] = swbOffset480Window[m_mpeg4SamplingFrequencyIndex][i]; + ics.swbOffset[i] = swbOffset480Window[m_mpeg4SamplingFrequencyIndex][i]; + } + } + } else { + for(byte i = 0; i <= ics.swbCount; ++i) { + ics.sectionSfbOffset[0][i] = swbOffset1024Window[m_mpeg4SamplingFrequencyIndex][i]; + ics.swbOffset[i] = swbOffset1024Window[m_mpeg4SamplingFrequencyIndex][i]; + } + } + ics.sectionSfbOffset[0][ics.swbCount] = ics.swbOffset[ics.swbCount] = ics.maxSwbOffset = m_frameLength; + break; + case EightShortSequence: + ics.windowCount = 8; + ics.windowGroupCount = ics.windowGroupLengths[0] = 1; + ics.swbCount = swb128WindowCount[m_mpeg4SamplingFrequencyIndex]; + if(ics.maxSfb > ics.swbCount) { + throw InvalidDataException(); + } + for(byte i = 0; i < ics.swbCount; ++i) { + ics.swbOffset[i] = swbOffset128Window[m_mpeg4SamplingFrequencyIndex][i]; + } + ics.swbOffset[ics.swbCount] = ics.maxSwbOffset = m_frameLength / 8; + for(byte i = 0; i < ics.windowCount - 1; ++i) { + if(!ics.scaleFactorGrouping & (1 << (6 - i))) { + ics.windowGroupLengths[ics.windowGroupCount] = 1; + ++ics.windowGroupCount; + } else { + ++(ics.windowGroupLengths[ics.windowGroupCount - 1]); + } + } + for(byte g = 0; g < ics.windowGroupCount; ++g) { + byte sectionSfb = 0; + uint16 offset = 0, width; + for(byte i = 0; i < ics.swbCount; ++i) { + if(i + 1 == ics.swbCount) { + width = (m_frameLength / 8) - swbOffset128Window[m_mpeg4SamplingFrequencyIndex][i]; + } else { + width = swbOffset128Window[m_mpeg4SamplingFrequencyIndex][i + 1] - swbOffset128Window[m_mpeg4SamplingFrequencyIndex][i]; + } + width *= ics.windowGroupLengths[g]; + ics.sectionSfbOffset[g][sectionSfb++] = offset; + offset += width; + } + ics.sectionSfbOffset[g][sectionSfb] = offset; + } + break; + default: + throw InvalidDataException(); + } +} + +/*! + * \brief Parses "individual channel stream" (basic audio unit). + */ +void AacFrameElementParser::parseIndividualChannelStream(AacIcsInfo &ics, int16 *specData, bool scaleFlag) +{ + parseSideInfo(ics, scaleFlag); + if(m_mpeg4AudioObjectId >= Mpeg4AudioObjectIds::ErAacLc) { + if(ics.tnsDataPresent) { + parseTnsData(ics); + } + } + if(m_mpeg4AudioObjectId == Mpeg4AudioObjectIds::ErParametric) { // DRM stuff? + // TODO: check CRC + throw NotImplementedException(); + } + if(m_aacSpectralDataResilienceFlag) { + // TODO: parseReorderedSpectralData(ic); + throw NotImplementedException(); + } else { + parseSpectralData(ics, specData); + } + if(ics.pulseDataPresent) { + if(ics.windowSequence == AacIcsSequenceTypes::EightShortSequence) { + throw InvalidDataException(); // pulse coding not allowed for short blocks + } else { + // TODO: reconstruct pulse coding + //decodePulseData(ic); + } + } +} + +/*! + * \brief Parses "single channel element". + */ +void AacFrameElementParser::parseSingleChannelElement() +{ + if(m_elementCount + 1 > aacMaxSyntaxElements) { + throw NotImplementedException(); // can not parse frame with more than aacMaxSyntaxElements syntax elements + } + // TODO: check whether limit of channels is exceeded + + int16 specData[1024] = {0}; + m_elementId[m_elementCount] = AacSyntaxElementTypes::SingleChannelElement; + m_elementInstanceTag[m_elementCount] = m_reader.readBits(4); + //m_channel = channel; + //m_pairedChannel = -1; + parseIndividualChannelStream(m_ics1, specData); + if(m_ics1.isUsed) { + throw InvalidDataException(); // IS not allowed in single channel + } + // check wheter next bitstream element is a fill element (for SBR decoding) + if(m_reader.showBits(3) == AacSyntaxElementTypes::FillElement) { + parseFillElement(m_elementCount); + } + // TODO: reconstruct single channel element + // TODO: map output channels position to internal data channels + m_channelCount += m_elementChannelCount[m_elementCount]; + ++m_elementCount; +} + +/*! + * \brief Parses "channel pair element". + */ +void AacFrameElementParser::parseChannelPairElement() +{ + if(m_elementCount + 2 > aacMaxSyntaxElements) { + throw NotImplementedException(); // can not parse frame with more than aacMaxSyntaxElements syntax elements + } + // TODO: check whether limit of channels is exceeded + m_elementId[m_elementCount] = AacSyntaxElementTypes::ChannelPairElement; + m_elementChannelCount[m_elementCount] = 2; // number of output channels in CPE is always 2 + + int16 specData1[1024] = {0}; + int16 specData2[1024] = {0}; + //m_channel = channels; + //m_pairedChannel = channels + 1; + m_elementInstanceTag[m_elementCount] = m_reader.readBits(4); + if((m_commonWindow = m_reader.readBit())) { + // both channels have common ics data + parseIcsInfo(m_ics1); + if((m_ics1.midSideCodingMaskPresent = m_reader.readBits(2) == 1)) { // ms mask present + for(byte g = 0; g < m_ics1.windowGroupCount; ++g) { + for(byte sfb = 0; sfb < m_ics1.maxSfb; ++sfb) { + m_ics1.midSideCodingUsed[g][sfb] = m_reader.readBit(); + } + } + //m_reader.skipBits(m_ics1.windowGroupCount * m_ics1.maxSfb); + } + if(m_mpeg4AudioObjectId >= Mpeg4AudioObjectIds::ErAacLc && m_ics1.predictorDataPresent) { + if((m_ics1.ltp1.dataPresent = m_reader.readBit())) { + parseLtpInfo(m_ics1, m_ics1.ltp1); + } + } + m_ics2 = m_ics1; + } else { + m_ics1.midSideCodingMaskPresent = false; + } + parseIndividualChannelStream(m_ics1, specData1); + if(m_commonWindow && m_mpeg4AudioObjectId >= Mpeg4AudioObjectIds::ErAacLc && m_ics1.predictorDataPresent) { + if((m_ics1.ltp2.dataPresent = m_reader.readBit())) { + parseLtpInfo(m_ics1, m_ics1.ltp2); + } + } + parseIndividualChannelStream(m_ics2, specData2); + // check if next bitstream element is a fill element (for SBR decoding) + if(m_reader.showBits(3) == AacSyntaxElementTypes::FillElement) { + parseFillElement(m_elementCount); + } + // TODO: reconstruct channel pair + // TODO: map output channels position to internal data channels + m_channelCount += 2; + ++m_elementCount; +} + +/*! + * \brief Parses/skips "channel coupling element". + */ +void AacFrameElementParser::parseCouplingChannelElement() +{ + m_reader.skipBits(4); // element instance tag + byte swCceFlag = m_reader.readBit(); + byte coupledElementCount = m_reader.readBits(3); + byte gainElementLists = 0; + for(byte c = 0; c < coupledElementCount; ++c) { + ++gainElementLists; + byte ccTargetIsCpe = m_reader.readBit(); + //byte ccTargetTagSelect = m_reader.readBits(4); + m_reader.skipBits(4); // cc target tag select + if(ccTargetIsCpe) { + // cc left and right + if(m_reader.readBit() & m_reader.readBit()) { + ++gainElementLists; + } + } + } + m_reader.skipBits(4); // 1 bit cc domain, 1 bit gain element sign, 2 bits gain element scale + AacIcsInfo ics; + int16 specData[1024]; + parseIndividualChannelStream(ics, specData); + for(byte c = 1; c < gainElementLists; ++c) { + if(swCceFlag || m_reader.readBit()) { + parseHuffmanScaleFactor(); + } else { + for(byte group = 0; group < ics.windowCount; ++group) { + for(byte sfb = 0; sfb < ics.maxSfb; ++sfb) { + if(ics.sfbCb[group][sfb] != AacScaleFactorTypes::ZeroHcb) { + parseHuffmanScaleFactor(); + } + } + } + } + + } +} + +/*! + * \brief Parses "low frequency element". + */ +void AacFrameElementParser::parseLowFrequencyElement() +{ + parseSingleChannelElement(); +} + +/*! + * \brief Parses/skips "data stream element". + */ +void AacFrameElementParser::parseDataStreamElement() +{ + byte byteAligned = m_reader.readBit(); + uint16 count = m_reader.readBits(8); + if(count == 0xFF) { + count += m_reader.readBits(8); + } + if(byteAligned) { + m_reader.align(); + } + m_reader.skipBits(count * 8); +} + +/*! + * \brief Parses "program config element". + */ +void AacFrameElementParser::parseProgramConfigElement() +{ + m_pce.elementInstanceTag = m_reader.readBits(4); + m_pce.objectType = m_reader.readBits(2); + m_pce.samplingFrequencyIndex = m_reader.readBits(4); + m_pce.frontChannelElementCount = m_reader.readBits(4); + m_pce.sideChannelElementCount = m_reader.readBits(4); + m_pce.backChannelElementCount = m_reader.readBits(4); + m_pce.lfeChannelElementCount = m_reader.readBits(2); + m_pce.assocDataElementCount = m_reader.readBits(3); + m_pce.validCcElementCount = m_reader.readBits(4); + if((m_pce.monoMixdownPresent = m_reader.readBit())) { + m_pce.monoMixdownElementNumber = m_reader.readBits(4); + } + if((m_pce.stereoMixdownPresent = m_reader.readBit())) { + m_pce.stereoMixdownElementNumber = m_reader.readBits(4); + } + if((m_pce.matrixMixdownIdxPresent = m_reader.readBit())) { + m_pce.matrixMixdownIdx = m_reader.readBits(2); + m_pce.pseudoSurroundEnable = m_reader.readBit(); + } + byte i; + for(i = 0; i < m_pce.frontChannelElementCount; ++i) { + m_pce.frontElementIsCpe[i] = m_reader.readBit(); + m_pce.frontElementTagSelect[i] = m_reader.readBits(4); + if(m_pce.frontElementIsCpe[i]) { // channel coupling element + m_pce.cpeChannel[m_pce.frontElementTagSelect[i]] = m_pce.channels; + m_pce.frontChannelCount += 2; + m_pce.channels += 2; + } else { // single channel element + m_pce.sceChannel[m_pce.frontElementTagSelect[i]] = m_pce.channels; + ++m_pce.frontChannelCount; + ++m_pce.channels; + } + } + for(i = 0; i < m_pce.sideChannelElementCount; ++i) { + m_pce.sideElementIsCpe[i] = m_reader.readBit(); + m_pce.sideElementTagSelect[i] = m_reader.readBits(4); + if(m_pce.sideElementIsCpe[i]) { // channel coupling element + m_pce.cpeChannel[m_pce.sideElementTagSelect[i]] = m_pce.channels; + m_pce.sideChannelCount += 2; + m_pce.channels += 2; + } else { // single channel element + m_pce.sceChannel[m_pce.sideElementTagSelect[i]] = m_pce.channels; + ++m_pce.sideChannelCount; + ++m_pce.channels; + } + } + for(i = 0; i < m_pce.backChannelElementCount; ++i) { + m_pce.backElementIsCpe[i] = m_reader.readBit(); + m_pce.backElementTagSelect[i] = m_reader.readBits(4); + if(m_pce.backElementIsCpe[i]) { // channel coupling element + m_pce.cpeChannel[m_pce.backElementTagSelect[i]] = m_pce.channels; + m_pce.backChannelCount += 2; + m_pce.channels += 2; + } else { // single channel element + m_pce.sceChannel[m_pce.backElementTagSelect[i]] = m_pce.channels; + ++m_pce.backChannelCount; + ++m_pce.channels; + } + } + for(i = 0; i < m_pce.lfeChannelElementCount; ++i) { + m_pce.lfeElementTagSelect[i] = m_reader.readBits(4); + m_pce.sceChannel[m_pce.lfeElementTagSelect[i]] = m_pce.channels; + ++m_pce.lfeChannelCount; + ++m_pce.channels; + } + for(i = 0; i < m_pce.assocDataElementCount; ++i) { + m_pce.assocDataElementTagSelect[i] = m_reader.readBits(4); + } + for(i = 0; i < m_pce.validCcElementCount; ++i) { + m_pce.ccElementIsIndSw[i] = m_reader.readBit(); + m_pce.validCcElementTagSelect[i] = m_reader.readBits(4); + } + m_reader.align(); + m_pce.commentFieldBytes = m_reader.readBits(8); + for(i = 0; i < m_pce.commentFieldBytes; ++i) { + m_pce.commentFieldData[i] = m_reader.readBits(8); + } + m_pce.commentFieldData[i] = 0; + if(m_pce.channels > aacMaxChannels) { + throw NotImplementedException(); // supported channel maximum exceeded + } +} + +/*! + * \brief Parses "fill element". + */ +void AacFrameElementParser::parseFillElement(byte sbrElement) +{ + uint16 count = m_reader.readBits(4); + bool crcFlag = 0; + if(count == 0xF) { + count += m_reader.readBits(8); + } + while(count > 0) { + continueWhile: + switch(m_reader.readBits(4)) { // extension type + using namespace AacExtensionTypes; + case DynamicRange: + count -= parseDynamicRange(); + break; + case SbrDataCrc: + crcFlag = true; + case SbrData: + if(sbrElement == aacInvalidSbrElement) { + throw InvalidDataException(); + } else { + // ensure SBR element exists + if(!m_sbrElements[sbrElement]) { + m_sbrElements[sbrElement] = makeSbrInfo(sbrElement); + } + parseSbrExtensionData(sbrElement, count, crcFlag); + // set global flags + m_sbrPresentFlag = 1; + if(m_sbrElements[sbrElement]->ps) { + m_psUsed[sbrElement] = 1; + m_psUsedGlobal = 1; + } + } + count = 0; + break; + case FillData: + m_reader.skipBits(4 + 8 * (count - 1)); + count = 0; + break; + case DataElement: + // data element version + if(m_reader.readBits(4) == 0) { + // ANC data + byte dataElementLength = 0, loopCounter = 0; + uint16 dataElementLengthPart; + do { + dataElementLengthPart = m_reader.readBits(8); + dataElementLength += dataElementLengthPart; + ++loopCounter; + } while(dataElementLengthPart == 0xFF); + for(uint16 i = 0; i < dataElementLength; ++i) { + m_reader.skipBits(8); // data element byte + count -= dataElementLength + loopCounter + 1; + goto continueWhile; + } + } + m_reader.skipBits(8 * (count - 1)); + count = 0; + case Fill: + case SacData: + default: + m_reader.skipBits(4 + 8 * (count - 1)); + count = 0; + } + } +} + +/*! + * \brief Parses a raw data block. + * + * Reads the element type first and then calls the appropriate method for the element type. + */ +void AacFrameElementParser::parseRawDataBlock() +{ + if(m_mpeg4AudioObjectId < Mpeg4AudioObjectIds::ErAacLc) { + for(;;) { + switch(m_reader.readBits(3)) { // parse element type + using namespace AacSyntaxElementTypes; + case SingleChannelElement: + parseSingleChannelElement(); + break; + case ChannelPairElement: + parseChannelPairElement(); + break; + case ChannelCouplingElement: + parseCouplingChannelElement(); + break; + case LowFrequencyElement: + parseLowFrequencyElement(); + break; + case DataStreamElement: + parseDataStreamElement(); + break; + case ProgramConfigElement: + parseProgramConfigElement(); + break; + case FillElement: + parseFillElement(); + break; + case EndOfFrame: + goto endOfBlock; + default: + ; + } + } + } else { // error resilience + switch(m_mpeg4ChannelConfig) { + using namespace Mpeg4ChannelConfigs; + using namespace AacSyntaxElementTypes; + case FrontCenter: + parseSingleChannelElement(); + break; + case FrontLeftFrontRight: + parseChannelPairElement(); + break; + case FrontCenterFrontLeftFrontRight: + parseSingleChannelElement(); + parseChannelPairElement(); + break; + case FrontCenterFrontLeftFrontRightBackCenter: + parseSingleChannelElement(); + parseChannelPairElement(); + parseSingleChannelElement(); + break; + case FrontCenterFrontLeftFrontRightBackLeftBackRight: + parseSingleChannelElement(); + parseChannelPairElement(); + parseChannelPairElement(); + break; + case FrontCenterFrontLeftFrontRightBackLeftBackRightLFEChannel: + parseSingleChannelElement(); + parseChannelPairElement(); + parseChannelPairElement(); + parseSingleChannelElement(); + break; + case FrontCenterFrontLeftFrontRightSideLeftSideRightBackLeftBackRightLFEChannel: + parseSingleChannelElement(); + parseChannelPairElement(); + parseChannelPairElement(); + parseChannelPairElement(); + parseSingleChannelElement(); + break; + } + } + endOfBlock:; +} + +/*! + * \brief Parses the frame data from the specified \a stream at the current position. + */ +void AacFrameElementParser::parse(const AdtsFrame &adtsFrame, std::istream &stream, std::size_t dataSize) +{ + auto data = make_unique(dataSize); + stream.read(data.get(), dataSize); + parse(adtsFrame, data, dataSize); +} + +/*! + * \brief Parses the specified frame \a data. + */ +void AacFrameElementParser::parse(const AdtsFrame &adtsFrame, std::unique_ptr &data, std::size_t dataSize) +{ + m_reader.reset(data.get(), dataSize); + m_mpeg4AudioObjectId = adtsFrame.mpeg4AudioObjectId(); + m_mpeg4SamplingFrequencyIndex = adtsFrame.mpeg4SamplingFrequencyIndex(); + parseRawDataBlock(); +} + +} diff --git a/aac/aacframe.h b/aac/aacframe.h new file mode 100644 index 0000000..60eb69b --- /dev/null +++ b/aac/aacframe.h @@ -0,0 +1,565 @@ +#ifndef AACFRAME_H +#define AACFRAME_H + +#include + +#include + +namespace Media { + +class AdtsFrame; + +constexpr auto aacMaxChannels = 64; +constexpr auto aacMaxSyntaxElements = 48; +constexpr auto aacMaxWindowGroups = 8; +constexpr auto aacMaxSfb = 51; +constexpr auto aacMaxLtpSfb = 40; +constexpr auto aacMaxltpSfbS = 8; +constexpr auto aacInvalidSbrElement = 0xFF; +constexpr auto aacNoTimeSlots960 = 15; +constexpr auto aacNoTimeSlots = 16; +constexpr auto aacSbrRate = 2; +constexpr auto aacSbrM = 49; +constexpr auto aacSbrMaxLe = 5; +constexpr auto aacSbrMaxNtsrhfg = 40; + +typedef const sbyte (*SbrHuffTab)[2]; + +namespace AacSyntaxElementTypes { +enum KnownTypes : byte +{ + SingleChannelElement, /**< codes a single audio channel */ + ChannelPairElement, /**< codes steroe signal */ + ChannelCouplingElement, /**< something to do with channel coupling (not implemented in libfaad2) */ + LowFrequencyElement, /**< low-frequency effects? referenced as "special effects" in RTP doc */ + DataStreamElement, /**< user data */ + ProgramConfigElement, /**< describes bitstream */ + FillElement, /**< pad space/extension data */ + EndOfFrame /**< marks the end of the frame */ +}; +} + +namespace AacIcsSequenceTypes { +enum KnownTypes : byte { + OnlyLongSequence, + LongStartSequence, + EightShortSequence, + LongStopSequence +}; +} + +namespace AacScaleFactorTypes { +enum KnownTypes : byte { + ZeroHcb = 0, + FirstPairHcb = 5, + EscHcb = 11, + QuadLen = 4, + PairLen = 2, + NoiseHcb = 13, + IntensityHcb2 = 14, + IntensityHcb = 15 +}; +} + +namespace AacExtensionTypes { +enum KnownTypes : byte { + Fill = 0, + FillData = 1, + DataElement = 2, + DynamicRange = 11, + SacData = 12, + SbrData = 13, + SbrDataCrc = 14 +}; +} + +namespace BsFrameClasses { +enum BsFrameClass : byte { + FixFix, + FixVar, + VarFix, + VarVar +}; +} + +namespace AacSbrExtensionIds { +enum KnownIds : byte { + DrmParametricStereo = 0, + Ps = 2 +}; +} + +struct LIB_EXPORT AacLtpInfo +{ + AacLtpInfo(); + byte lastBand; + byte dataPresent; + uint16 lag; + byte lagUpdate; + byte coef; + byte longUsed[aacMaxLtpSfb]; + byte shortUsed[8]; + byte shortLagPresent[8]; + byte shortLag[8]; +}; + +struct LIB_EXPORT AacPredictorInfo +{ + AacPredictorInfo(); + byte maxSfb; + byte reset; + byte resetGroupNumber; + byte predictionUsed[aacMaxSfb]; +}; + +struct LIB_EXPORT AacPulseInfo +{ + AacPulseInfo(); + byte count; + byte startSfb; + byte offset[4]; + byte amp[4]; +}; + +struct LIB_EXPORT AacTnsInfo +{ + AacTnsInfo(); + byte filt[8]; + byte coefRes[8]; + byte length[8][4]; + byte order[8][4]; + byte direction[8][4]; + byte coefCompress[8][4]; + byte coef[8][4][32]; +}; + +struct LIB_EXPORT AacSsrInfo +{ + AacSsrInfo(); + byte maxBand; + byte adjustNum[4][8]; + byte alevcode[4][8][8]; + byte aloccode[4][8][8]; +}; + +struct LIB_EXPORT AacDrcInfo +{ + AacDrcInfo(); + byte present; + byte bandCount; + byte pceInstanceTag; + byte excludedChannelsPresent; + byte bandTop[17]; + byte progRefLevel; + byte dynamicRangeSign[17]; + byte dynamicRangeControl[17]; + byte excludeMask[aacMaxChannels]; + byte additionalExcludedChannels[aacMaxChannels]; +}; + +struct LIB_EXPORT AacPsInfo +{ + AacPsInfo(); + byte headerRead; + byte use34HybridBands; + byte enableIID; // Inter-channel Intensity Difference + byte iidMode; + byte iidParCount; + byte iidopdParCount; + // TODO +}; + +struct LIB_EXPORT AacDrmPsInfo +{ + AacDrmPsInfo(); + byte headerRead; + byte use34HybridBands; + byte enableIID; // Inter-channel Intensity Difference + byte iidMode; + byte iidParCount; + byte iidopdParCount; + // TODO +}; + +struct LIB_EXPORT AacSbrInfo +{ + AacSbrInfo(byte sbrElementType, uint16 samplingFrequency, uint16 frameLength, bool isDrm); + + byte aacElementId; + byte samplingFrequency; + + uint32 maxAacLine; + + byte rate; + byte justSeeked; + byte ret; + + byte ampRes[2]; + + byte k0; + byte kx; + byte m; + byte nMaster; + byte nHigh; + byte nLow; + byte nq; + byte nl[4]; + byte n[2]; + + byte fMaster[64]; + byte fTableRes[2][64]; + byte fTableNoise[64]; + byte fTableLim[4][64]; + byte fGroup[5][64]; + byte ng[5]; + + byte tableMapKToG[64]; + + byte absBordLead[2]; + byte absBordTrail[2]; + byte relLeadCount[2]; + byte relTrailCount[2]; + + byte le[2]; + byte lePrev[2]; + byte lq[2]; + + byte te[2][aacSbrMaxLe + 1]; + byte tq[2][3]; + byte f[2][aacSbrMaxLe + 1]; + byte fPrev[2]; + + //real_t *gTempPrev[2][5]; + //real_t *qTempPrev[2][5]; + //sbyte gqRingbufIndex[2]; + + int16 e[2][64][aacSbrMaxLe]; + int16 ePrev[2][64]; + //real_t eOrig[2][64][aacSbrMaxLe]; + //real_t eCurr[2][64][aacSbrMaxLe]; + int32 q[2][64][2]; + //real_t qDiv[2][64][2]; + //real_t qDiv2[2][64][2]; + int32 qPrev[2][64]; + + sbyte la[2]; + sbyte laPrev[2]; + + byte bsInvfMode[2][aacSbrMaxLe]; + byte bsInvfModePrev[2][aacSbrMaxLe]; + //real_t bwArray[2][64]; + //real_t bwArrayPrev[2][64]; + + byte noPatches; + byte patchNoSubbands[64]; + byte patchStartSubband[64]; + + byte bsAddHarmonic[2][64]; + byte bsAddHarmonicPrev[2][64]; + + uint16 indexNoisePrev[2]; + byte psiIsPrev[2]; + + byte bsStartFreqPrev; + byte bsStopFreqPrev; + byte bsXoverBandPrev; + byte bsFreqScalePrev; + byte bsAlterScalePrev; + byte bsNoiseBandsPrev; + + sbyte prevEnvIsShort[2]; + + sbyte kxPrev; + byte bsco; + byte bscoPrev; + byte mPrev; + uint16 frameLength; + + byte reset; + uint32 frame; + uint32 headerCount; + + byte idAac; + //qmfa_info *qmfa[2]; + //qmfs_info *qmfs[2]; + + //qmf_t Xsbr[2][aacSbrMaxNtsrhfg][64]; + + byte isDrmSbr; + std::shared_ptr drmPs; + + byte timeSlotsRateCount; + byte timeSlotsCount; + byte tHfGen; + byte tHfAdj; + + std::shared_ptr ps; + byte psUsed; + byte psResetFlag; + + byte bsHeaderFlag; + byte bsCrcFlag; + uint16 bsSbrCrcBits; + byte bsProtocolVersion; + byte bsAmpRes; + byte bsStartFreq; + byte bsStopFreq; + byte bsXoverBand; + byte bsFreqScale; + byte bsAlterScale; + byte bsNoiseBands; + byte bsLimiterBands; + byte bsLimiterGains; + byte bsInterpolFreq; + byte bsSmoothingMode; + byte bsSamplerateMode; + byte bsAddHarmonicFlag[2]; + byte bsAddHarmonicFlagPrev[2]; + byte bsExtendedData; + byte bsExtensionId; + byte bsExtensionData; + byte bsCoupling; + byte bsFrameClass[2]; + byte bsRelBord[2][9]; + byte bsRelBord0[2][9]; + byte bsRelBord1[2][9]; + byte bsPointer[2]; + byte bsAbsBord0[2]; + byte bsAbsBord1[2]; + byte bsRelCount0[2]; + byte bsRelCount1[2]; + byte bsDfEnv[2][9]; + byte bsDfNoise[2][3]; +}; + +struct LIB_EXPORT AacProgramConfig +{ + AacProgramConfig(); + byte elementInstanceTag; + byte objectType; + byte samplingFrequencyIndex; + byte frontChannelElementCount; + byte sideChannelElementCount; + byte backChannelElementCount; + byte lfeChannelElementCount; + byte assocDataElementCount; + byte validCcElementCount; + byte monoMixdownPresent; + byte monoMixdownElementNumber; + byte stereoMixdownPresent; + byte stereoMixdownElementNumber; + byte matrixMixdownIdxPresent; + byte pseudoSurroundEnable; + byte matrixMixdownIdx; + byte frontElementIsCpe[16]; + byte frontElementTagSelect[16]; + byte sideElementIsCpe[16]; + byte sideElementTagSelect[16]; + byte backElementIsCpe[16]; + byte backElementTagSelect[16]; + byte lfeElementTagSelect[16]; + byte assocDataElementTagSelect[16]; + byte ccElementIsIndSw[16]; + byte validCcElementTagSelect[16]; + byte channels; + byte commentFieldBytes; + byte commentFieldData[257]; + byte frontChannelCount; + byte sideChannelCount; + byte backChannelCount; + byte lfeChannelCount; + byte sceChannel[16]; + byte cpeChannel[16]; +}; + +struct LIB_EXPORT AacIcsInfo +{ + AacIcsInfo(); + + byte maxSfb; + + byte swbCount; + byte windowGroupCount; + byte windowCount; + byte windowSequence; + byte windowGroupLengths[8]; + byte windowShape; + byte scaleFactorGrouping; + uint16 sectionSfbOffset[8][15 * 8]; + uint16 swbOffset[52]; + uint16 maxSwbOffset; + + byte sectionCb[8][15 * 8]; + uint16 sectionStart[8][15 * 8]; + uint16 sectionEnd[8][15 * 8]; + byte sfbCb[8][15 * 8]; + byte sectionsPerGroup[8]; + + byte globalGain; + uint16 scaleFactors[8][51]; + + byte midSideCodingMaskPresent; + byte midSideCodingUsed[aacMaxWindowGroups][aacMaxSfb]; + + byte noiseUsed; + byte isUsed; + + byte pulseDataPresent; + byte tnsDataPresent; + byte gainControlPresent; + byte predictorDataPresent; + + AacPulseInfo pulse; + AacTnsInfo tns; + AacPredictorInfo predictor; + AacLtpInfo ltp1; + AacLtpInfo ltp2; + AacSsrInfo ssr; + std::shared_ptr sbr; + + // error resilience + uint16 reorderedSpectralDataLength; + byte longestCodewordLength; + byte sfConcealment; + byte revGlobalGain; + uint16 rvlcSfLength; + uint16 dpcmNoiseNrg; + byte sfEscapesPresent; + byte rvlcEscapesLength; + uint16 dpcmNoiseLastPos; +}; + +class LIB_EXPORT AacFrameElementParser +{ +public: + AacFrameElementParser(byte audioObjectId, byte samplingFrequencyIndex, byte extensionSamplingFrequencyIndex, byte channelConfig, uint16 frameLength = 1024); + + void parse(const AdtsFrame &adtsFrame, std::unique_ptr &data, std::size_t dataSize); + void parse(const AdtsFrame &adtsFrame, std::istream &stream, std::size_t dataSize); + +private: + void parseLtpInfo(const AacIcsInfo &ics, AacLtpInfo <p); + void parseIcsInfo(AacIcsInfo &ics); + void parseSectionData(AacIcsInfo &ics); + void decodeScaleFactorData(AacIcsInfo &ics); + void decodeRvlcScaleFactorData(AacIcsInfo &ics); + void parseScaleFactorData(AacIcsInfo &ics); + void parsePulseData(AacIcsInfo &ics); + void parseTnsData(AacIcsInfo &ics); + void parseGainControlData(AacIcsInfo &ics); + void parseSpectralData(AacIcsInfo &ics, int16 *specData); + void parseSideInfo(AacIcsInfo &ics, bool scaleFlag); + byte parseExcludedChannels(); + byte parseDynamicRange(); + static sbyte sbrLog2(const sbyte val); + int16 sbrHuffmanDec(SbrHuffTab table); + void parseSbrGrid(std::shared_ptr &sbr, byte channel); + void parseSbrDtdf(std::shared_ptr &sbr, byte channel); + void parseInvfMode(std::shared_ptr &sbr, byte channel); + void parseSbrEnvelope(std::shared_ptr &sbr, byte channel); + void parseSbrNoise(std::shared_ptr &sbr, byte channel); + void parseSbrSinusoidalCoding(std::shared_ptr &sbr, byte channel); + uint16 parseSbrExtension(std::shared_ptr &sbr, byte extensionId, byte bitsLeft); + uint16 parsePsData(std::shared_ptr &ps, byte &header); + uint16 parseDrmPsData(std::shared_ptr &drmPs); + void parseSbrSingleChannelElement(std::shared_ptr &sbr); + void parseSbrChannelPairElement(std::shared_ptr &sbr); + std::shared_ptr makeSbrInfo(byte sbrElement, bool isDrm = false); + void parseSbrExtensionData(byte sbrElement, uint16 count, bool crcFlag); + byte parseHuffmanScaleFactor(); + void parseHuffmanSpectralData(byte cb, int16 *sp); + void huffmanSignBits(int16 *sp, byte len); + void huffman2StepQuad(byte cb, int16 *sp); + void huffmanBinaryQuadSign(byte cb, int16 *sp); + void huffmanBinaryPair(byte cb, int16 *sp); + void huffman2StepPair(byte cb, int16 *sp); + void huffmanBinaryPairSign(byte cb, int16 *sp); + void huffman2StepPairSign(byte cb, int16 *sp); + int16 huffmanGetEscape(int16 sp); + constexpr static int16 huffmanCodebook(byte i); + static void vcb11CheckLav(byte cb, int16 *sp); + void calculateWindowGroupingInfo(AacIcsInfo &ics); + void parseIndividualChannelStream(AacIcsInfo &ics, int16 *specData, bool scaleFlag = false); + void parseSingleChannelElement(); + void parseChannelPairElement(); + void parseCouplingChannelElement(); + void parseLowFrequencyElement(); + void parseDataStreamElement(); + void parseProgramConfigElement(); + void parseFillElement(byte sbrElement = aacInvalidSbrElement); + void parseRawDataBlock(); + + // these fields contain setup information + IoUtilities::BitReader m_reader; + byte m_mpeg4AudioObjectId; + byte m_mpeg4SamplingFrequencyIndex; + byte m_mpeg4ExtensionSamplingFrequencyIndex; + byte m_mpeg4ChannelConfig; + uint16 m_frameLength; + byte m_aacSectionDataResilienceFlag; + byte m_aacScalefactorDataResilienceFlag; + byte m_aacSpectralDataResilienceFlag; + // these fields will be parsed + byte m_elementId[aacMaxChannels]; + byte m_channelCount; + byte m_elementCount; + byte m_elementChannelCount[aacMaxSyntaxElements]; + //byte m_channel; + //int16 m_pairedChannel; + byte m_elementInstanceTag[aacMaxSyntaxElements]; + byte m_commonWindow; + AacIcsInfo m_ics1; + AacIcsInfo m_ics2; + AacDrcInfo m_drc; + AacProgramConfig m_pce; + byte m_sbrPresentFlag; + byte m_forceUpSampling; + byte m_downSampledSbr; + std::shared_ptr m_sbrElements[aacMaxSyntaxElements]; + byte m_psUsed[aacMaxSyntaxElements]; + byte m_psUsedGlobal; + byte m_psResetFlag; +}; + +/*! + * \brief Constructs a new parser with the specified setup information. + */ +inline AacFrameElementParser::AacFrameElementParser(byte audioObjectId, byte samplingFrequencyIndex, byte extensionSamplingFrequencyIndex, byte channelConfig, uint16 frameLength) : + m_reader(nullptr, nullptr), + m_mpeg4AudioObjectId(audioObjectId), + m_mpeg4SamplingFrequencyIndex(samplingFrequencyIndex), + m_mpeg4ExtensionSamplingFrequencyIndex(extensionSamplingFrequencyIndex), + m_mpeg4ChannelConfig(channelConfig), + m_frameLength(frameLength), + m_aacSpectralDataResilienceFlag(0), + m_elementId{0}, + m_channelCount(0), + m_elementCount(0), + m_elementChannelCount{0}, + m_elementInstanceTag{0}, + m_commonWindow(0), + //m_channel(0), + //m_pairedChannel(0), + m_sbrPresentFlag(0), + m_forceUpSampling(0), + m_downSampledSbr(0), + m_sbrElements{0}, + m_psUsed{0}, + m_psUsedGlobal(0), + m_psResetFlag(0) +{} + +inline sbyte AacFrameElementParser::sbrLog2(const sbyte val) +{ + static const int log2tab[] = {0, 0, 1, 2, 2, 3, 3, 3, 3, 4}; + return (val < 10 && val >= 0) ? log2tab[val] : 0; +} + +constexpr int16 AacFrameElementParser::huffmanCodebook(byte i) +{ + return static_cast(i ? (16428320 & 0xFFFF) : ((16428320 >> 16) & 0xFFFF)); +} + +} + +#endif // AACFRAME_H diff --git a/abstractattachment.cpp b/abstractattachment.cpp index 52bbf25..5c457af 100644 --- a/abstractattachment.cpp +++ b/abstractattachment.cpp @@ -1,7 +1,7 @@ -#include "abstractattachment.h" +#include "./abstractattachment.h" -#include "mediafileinfo.h" -#include "exceptions.h" +#include "./mediafileinfo.h" +#include "./exceptions.h" #include diff --git a/abstractattachment.h b/abstractattachment.h index 297f0fb..d68fb6e 100644 --- a/abstractattachment.h +++ b/abstractattachment.h @@ -1,7 +1,7 @@ #ifndef MEDIA_ABSTRACTATTACHMENT_H #define MEDIA_ABSTRACTATTACHMENT_H -#include "statusprovider.h" +#include "./statusprovider.h" #include #include diff --git a/abstractchapter.cpp b/abstractchapter.cpp index 59afff7..d1961d6 100644 --- a/abstractchapter.cpp +++ b/abstractchapter.cpp @@ -1,4 +1,4 @@ -#include "abstractchapter.h" +#include "./abstractchapter.h" #include diff --git a/abstractchapter.h b/abstractchapter.h index 4c5ab6b..cb94913 100644 --- a/abstractchapter.h +++ b/abstractchapter.h @@ -1,8 +1,8 @@ #ifndef MEDIA_ABSTRACTCHAPTER_H #define MEDIA_ABSTRACTCHAPTER_H -#include "statusprovider.h" -#include "localeawarestring.h" +#include "./statusprovider.h" +#include "./localeawarestring.h" #include diff --git a/abstractcontainer.cpp b/abstractcontainer.cpp index 96d931c..e9bc715 100644 --- a/abstractcontainer.cpp +++ b/abstractcontainer.cpp @@ -1,4 +1,4 @@ -#include "abstractcontainer.h" +#include "./abstractcontainer.h" using namespace std; using namespace ChronoUtilities; diff --git a/abstractcontainer.h b/abstractcontainer.h index 83c6137..3e2c763 100644 --- a/abstractcontainer.h +++ b/abstractcontainer.h @@ -1,9 +1,9 @@ #ifndef MEDIA_ABSTRACTCONTAINER_H #define MEDIA_ABSTRACTCONTAINER_H -#include "statusprovider.h" -#include "exceptions.h" -#include "tagtarget.h" +#include "./statusprovider.h" +#include "./exceptions.h" +#include "./tagtarget.h" #include #include diff --git a/abstracttrack.cpp b/abstracttrack.cpp index 58f1584..2107746 100644 --- a/abstracttrack.cpp +++ b/abstracttrack.cpp @@ -1,8 +1,8 @@ -#include "abstracttrack.h" -#include "exceptions.h" -#include "mediaformat.h" +#include "./abstracttrack.h" +#include "./exceptions.h" +#include "./mediaformat.h" -#include "mp4/mp4ids.h" +#include "./mp4/mp4ids.h" #include "mpegaudio/mpegaudioframe.h" diff --git a/abstracttrack.h b/abstracttrack.h index 5d71eb8..ff33943 100644 --- a/abstracttrack.h +++ b/abstracttrack.h @@ -1,10 +1,10 @@ #ifndef ABSTRACTTRACK_H #define ABSTRACTTRACK_H -#include "statusprovider.h" -#include "size.h" -#include "margin.h" -#include "mediaformat.h" +#include "./statusprovider.h" +#include "./size.h" +#include "./margin.h" +#include "./mediaformat.h" #include #include diff --git a/adts/adtsframe.cpp b/adts/adtsframe.cpp index ac68ea6..aade003 100644 --- a/adts/adtsframe.cpp +++ b/adts/adtsframe.cpp @@ -1,6 +1,6 @@ -#include "adtsframe.h" +#include "./adtsframe.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include diff --git a/adts/adtsstream.cpp b/adts/adtsstream.cpp index d941339..28ab34c 100644 --- a/adts/adtsstream.cpp +++ b/adts/adtsstream.cpp @@ -1,8 +1,8 @@ -#include "adtsstream.h" +#include "./adtsstream.h" -#include "tagparser/mp4/mp4ids.h" +#include "../mp4/mp4ids.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include diff --git a/adts/adtsstream.h b/adts/adtsstream.h index 12ff311..ff99839 100644 --- a/adts/adtsstream.h +++ b/adts/adtsstream.h @@ -1,9 +1,9 @@ #ifndef MEDIA_ADTSSTREAM_H #define MEDIA_ADTSSTREAM_H -#include "adtsframe.h" +#include "./adtsframe.h" -#include "tagparser/abstracttrack.h" +#include "../abstracttrack.h" namespace Media { diff --git a/avc/avcconfiguration.cpp b/avc/avcconfiguration.cpp index 07352d5..b5dbee6 100644 --- a/avc/avcconfiguration.cpp +++ b/avc/avcconfiguration.cpp @@ -1,4 +1,4 @@ -#include "avcconfiguration.h" +#include "./avcconfiguration.h" namespace Media { diff --git a/avc/avcconfiguration.h b/avc/avcconfiguration.h index 53ae1dc..904d9ef 100644 --- a/avc/avcconfiguration.h +++ b/avc/avcconfiguration.h @@ -1,7 +1,7 @@ #ifndef AVCCONFIGURATION_H #define AVCCONFIGURATION_H -#include "avcinfo.h" +#include "./avcinfo.h" #include diff --git a/avc/avcinfo.cpp b/avc/avcinfo.cpp index bcf7891..76e3f3d 100644 --- a/avc/avcinfo.cpp +++ b/avc/avcinfo.cpp @@ -1,4 +1,4 @@ -#include "avcinfo.h" +#include "./avcinfo.h" #include diff --git a/avc/avcinfo.h b/avc/avcinfo.h index f2dbb1b..0089083 100644 --- a/avc/avcinfo.h +++ b/avc/avcinfo.h @@ -1,8 +1,8 @@ #ifndef AVCINFO_H #define AVCINFO_H -#include "tagparser/margin.h" -#include "tagparser/size.h" +#include "../margin.h" +#include "../size.h" namespace Media { diff --git a/avi/bitmapinfoheader.cpp b/avi/bitmapinfoheader.cpp index 8afb71b..2be22ba 100644 --- a/avi/bitmapinfoheader.cpp +++ b/avi/bitmapinfoheader.cpp @@ -1,4 +1,4 @@ -#include "bitmapinfoheader.h" +#include "./bitmapinfoheader.h" #include diff --git a/backuphelper.cpp b/backuphelper.cpp index 38aa9a7..1a054c8 100644 --- a/backuphelper.cpp +++ b/backuphelper.cpp @@ -1,5 +1,5 @@ -#include "backuphelper.h" -#include "basicfileinfo.h" +#include "./backuphelper.h" +#include "./basicfileinfo.h" #include #include diff --git a/basicfileinfo.cpp b/basicfileinfo.cpp index 3dbe015..3ab27d0 100644 --- a/basicfileinfo.cpp +++ b/basicfileinfo.cpp @@ -1,4 +1,4 @@ -#include "basicfileinfo.h" +#include "./basicfileinfo.h" using namespace std; diff --git a/caseinsensitivecomparer.h b/caseinsensitivecomparer.h new file mode 100644 index 0000000..8351275 --- /dev/null +++ b/caseinsensitivecomparer.h @@ -0,0 +1,42 @@ +#ifndef CASEINSENSITIVECOMPARER +#define CASEINSENSITIVECOMPARER + +#include + +#include + +#include + +namespace Media { + +/*! + * \brief The CaseInsensitiveCharComparer struct defines a method for case-insensivive character comparsion (less). + */ +struct LIB_EXPORT CaseInsensitiveCharComparer +{ + static constexpr unsigned char toLower(const unsigned char c) + { + return (c >= 'A' && c <= 'Z') ? (c + ('a' - 'A')) : c; + } + + bool operator()(const unsigned char lhs, const unsigned char rhs) const + { + return toLower(lhs) < toLower(rhs); + } +}; + +/*! + * \brief The CaseInsensitiveStringComparer struct defines a method for case-insensivive string comparsion (less). + */ +struct LIB_EXPORT CaseInsensitiveStringComparer +{ + bool operator()(const std::string &lhs, const std::string &rhs) const + { + return std::lexicographical_compare(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend(), CaseInsensitiveCharComparer()); + } +}; + +} + +#endif // CASEINSENSITIVECOMPARER + diff --git a/exceptions.cpp b/exceptions.cpp index 0a4384c..53d37d9 100644 --- a/exceptions.cpp +++ b/exceptions.cpp @@ -1,4 +1,4 @@ -#include "exceptions.h" +#include "./exceptions.h" using namespace std; diff --git a/fieldbasedtag.h b/fieldbasedtag.h index b492325..3d17054 100644 --- a/fieldbasedtag.h +++ b/fieldbasedtag.h @@ -1,7 +1,7 @@ #ifndef FIELDBASEDTAG_H #define FIELDBASEDTAG_H -#include "tag.h" +#include "./tag.h" #include #include diff --git a/genericcontainer.h b/genericcontainer.h index d4faec6..1635067 100644 --- a/genericcontainer.h +++ b/genericcontainer.h @@ -1,7 +1,7 @@ #ifndef MEDIA_GENERICCONTAINER_H #define MEDIA_GENERICCONTAINER_H -#include "abstractcontainer.h" +#include "./abstractcontainer.h" #include #include diff --git a/genericfileelement.h b/genericfileelement.h index f27a938..ac4696c 100644 --- a/genericfileelement.h +++ b/genericfileelement.h @@ -1,9 +1,9 @@ #ifndef GENERICFILEELEMENT_H #define GENERICFILEELEMENT_H -#include "notification.h" -#include "exceptions.h" -#include "statusprovider.h" +#include "./notification.h" +#include "./exceptions.h" +#include "./statusprovider.h" #include #include diff --git a/generictagfield.h b/generictagfield.h index 8946f64..7d434c0 100644 --- a/generictagfield.h +++ b/generictagfield.h @@ -1,7 +1,7 @@ #ifndef TAGFIELD_H #define TAGFIELD_H -#include "tagvalue.h" +#include "./tagvalue.h" namespace Media { diff --git a/id3/id3genres.cpp b/id3/id3genres.cpp index 6854433..fe6b753 100644 --- a/id3/id3genres.cpp +++ b/id3/id3genres.cpp @@ -1,4 +1,4 @@ -#include "id3genres.h" +#include "./id3genres.h" using namespace std; diff --git a/id3/id3v1tag.cpp b/id3/id3v1tag.cpp index f1f7b40..1df714f 100644 --- a/id3/id3v1tag.cpp +++ b/id3/id3v1tag.cpp @@ -1,7 +1,7 @@ -#include "id3v1tag.h" -#include "id3genres.h" +#include "./id3v1tag.h" +#include "./id3genres.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include diff --git a/id3/id3v1tag.h b/id3/id3v1tag.h index 9b49b54..742fa70 100644 --- a/id3/id3v1tag.h +++ b/id3/id3v1tag.h @@ -1,7 +1,7 @@ #ifndef ID3V1TAG_H #define ID3V1TAG_H -#include "tagparser/tag.h" +#include "../tag.h" namespace Media { diff --git a/id3/id3v2frame.cpp b/id3/id3v2frame.cpp index 07fa10e..0bd54e1 100644 --- a/id3/id3v2frame.cpp +++ b/id3/id3v2frame.cpp @@ -1,8 +1,8 @@ -#include "id3v2frame.h" -#include "id3genres.h" -#include "id3v2frameids.h" +#include "./id3v2frame.h" +#include "./id3genres.h" +#include "./id3v2frameids.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include #include diff --git a/id3/id3v2frame.h b/id3/id3v2frame.h index befda26..15e97aa 100644 --- a/id3/id3v2frame.h +++ b/id3/id3v2frame.h @@ -1,11 +1,11 @@ #ifndef ID3V2FRAME_H #define ID3V2FRAME_H -#include "id3v2frameids.h" +#include "./id3v2frameids.h" -#include "tagparser/generictagfield.h" -#include "tagparser/tagvalue.h" -#include "tagparser/statusprovider.h" +#include "../generictagfield.h" +#include "../tagvalue.h" +#include "../statusprovider.h" #include #include diff --git a/id3/id3v2frameids.cpp b/id3/id3v2frameids.cpp index 51b422c..a4ed30c 100644 --- a/id3/id3v2frameids.cpp +++ b/id3/id3v2frameids.cpp @@ -1,6 +1,6 @@ -#include "id3v2frameids.h" +#include "./id3v2frameids.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" namespace Media { diff --git a/id3/id3v2tag.cpp b/id3/id3v2tag.cpp index e1f612e..9dc913c 100644 --- a/id3/id3v2tag.cpp +++ b/id3/id3v2tag.cpp @@ -1,7 +1,7 @@ -#include "id3v2tag.h" -#include "id3v2frameids.h" +#include "./id3v2tag.h" +#include "./id3v2frameids.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include diff --git a/id3/id3v2tag.h b/id3/id3v2tag.h index 5d191e1..36c4ed6 100644 --- a/id3/id3v2tag.h +++ b/id3/id3v2tag.h @@ -1,9 +1,9 @@ #ifndef ID3V2TAG_H #define ID3V2TAG_H -#include "id3v2frame.h" +#include "./id3v2frame.h" -#include "tagparser/fieldbasedtag.h" +#include "../fieldbasedtag.h" #include diff --git a/matroska/ebmlelement.cpp b/matroska/ebmlelement.cpp index 56b1b24..8435fa4 100644 --- a/matroska/ebmlelement.cpp +++ b/matroska/ebmlelement.cpp @@ -1,9 +1,9 @@ -#include "ebmlelement.h" -#include "ebmlid.h" -#include "matroskacontainer.h" -#include "matroskaid.h" +#include "./ebmlelement.h" +#include "./ebmlid.h" +#include "./matroskacontainer.h" +#include "./matroskaid.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include #include diff --git a/matroska/ebmlelement.h b/matroska/ebmlelement.h index fb0e8fe..99fe40b 100644 --- a/matroska/ebmlelement.h +++ b/matroska/ebmlelement.h @@ -1,11 +1,11 @@ #ifndef EBMLELEMENT_H #define EBMLELEMENT_H -#include "ebmlid.h" -#include "matroskaid.h" +#include "./ebmlid.h" +#include "./matroskaid.h" -#include "tagparser/statusprovider.h" -#include "tagparser/genericfileelement.h" +#include "../statusprovider.h" +#include "../genericfileelement.h" #include diff --git a/matroska/matroskaattachment.cpp b/matroska/matroskaattachment.cpp index 1621574..8b2e98e 100644 --- a/matroska/matroskaattachment.cpp +++ b/matroska/matroskaattachment.cpp @@ -1,7 +1,7 @@ -#include "matroskaattachment.h" -#include "matroskacontainer.h" -#include "ebmlelement.h" -#include "matroskaid.h" +#include "./matroskaattachment.h" +#include "./matroskacontainer.h" +#include "./ebmlelement.h" +#include "./matroskaid.h" #include #include diff --git a/matroska/matroskaattachment.h b/matroska/matroskaattachment.h index 759c930..5be2c4b 100644 --- a/matroska/matroskaattachment.h +++ b/matroska/matroskaattachment.h @@ -1,7 +1,7 @@ #ifndef MEDIA_MATROSKAATTACHMENT_H #define MEDIA_MATROSKAATTACHMENT_H -#include "tagparser/abstractattachment.h" +#include "../abstractattachment.h" namespace Media { diff --git a/matroska/matroskachapter.cpp b/matroska/matroskachapter.cpp index a488f7e..995709e 100644 --- a/matroska/matroskachapter.cpp +++ b/matroska/matroskachapter.cpp @@ -1,6 +1,6 @@ -#include "matroskachapter.h" -#include "ebmlelement.h" -#include "matroskaid.h" +#include "./matroskachapter.h" +#include "./ebmlelement.h" +#include "./matroskaid.h" #include diff --git a/matroska/matroskachapter.h b/matroska/matroskachapter.h index 64e1cfb..44e0a83 100644 --- a/matroska/matroskachapter.h +++ b/matroska/matroskachapter.h @@ -1,7 +1,7 @@ #ifndef MEDIA_MATROSKACHAPTER_H #define MEDIA_MATROSKACHAPTER_H -#include "tagparser/abstractchapter.h" +#include "../abstractchapter.h" #include diff --git a/matroska/matroskacodecid.cpp b/matroska/matroskacodecid.cpp index 264f263..726e1a7 100644 --- a/matroska/matroskacodecid.cpp +++ b/matroska/matroskacodecid.cpp @@ -1,4 +1,4 @@ -#include "matroskacodecid.h" +#include "./matroskacodecid.h" namespace Media { diff --git a/matroska/matroskacontainer.cpp b/matroska/matroskacontainer.cpp index c0214ca..7863f8c 100644 --- a/matroska/matroskacontainer.cpp +++ b/matroska/matroskacontainer.cpp @@ -1,13 +1,13 @@ -#include "matroskacontainer.h" -#include "ebmlid.h" -#include "matroskaid.h" -#include "matroskacues.h" -#include "matroskaeditionentry.h" -#include "matroskaseekinfo.h" +#include "./matroskacontainer.h" +#include "./ebmlid.h" +#include "./matroskaid.h" +#include "./matroskacues.h" +#include "./matroskaeditionentry.h" +#include "./matroskaseekinfo.h" -#include "tagparser/mediafileinfo.h" -#include "tagparser/exceptions.h" -#include "tagparser/backuphelper.h" +#include "../mediafileinfo.h" +#include "../exceptions.h" +#include "../backuphelper.h" #include #include diff --git a/matroska/matroskacontainer.h b/matroska/matroskacontainer.h index 3e763bf..435b4cc 100644 --- a/matroska/matroskacontainer.h +++ b/matroska/matroskacontainer.h @@ -1,13 +1,13 @@ #ifndef MATROSKACONTAINER_H #define MATROSKACONTAINER_H -#include "ebmlelement.h" -#include "matroskatag.h" -#include "matroskatrack.h" -#include "matroskachapter.h" -#include "matroskaattachment.h" +#include "./ebmlelement.h" +#include "./matroskatag.h" +#include "./matroskatrack.h" +#include "./matroskachapter.h" +#include "./matroskaattachment.h" -#include "tagparser/genericcontainer.h" +#include "../genericcontainer.h" #include diff --git a/matroska/matroskacues.cpp b/matroska/matroskacues.cpp index f19f9ba..c3ba6fd 100644 --- a/matroska/matroskacues.cpp +++ b/matroska/matroskacues.cpp @@ -1,5 +1,5 @@ -#include "matroskacues.h" -#include "matroskacontainer.h" +#include "./matroskacues.h" +#include "./matroskacontainer.h" #include diff --git a/matroska/matroskacues.h b/matroska/matroskacues.h index 64eb0b0..491b54c 100644 --- a/matroska/matroskacues.h +++ b/matroska/matroskacues.h @@ -1,7 +1,7 @@ #ifndef MEDIA_MATROSKACUES_H #define MEDIA_MATROSKACUES_H -#include "ebmlelement.h" +#include "./ebmlelement.h" #include #include diff --git a/matroska/matroskaeditionentry.cpp b/matroska/matroskaeditionentry.cpp index ff09ed7..adca42d 100644 --- a/matroska/matroskaeditionentry.cpp +++ b/matroska/matroskaeditionentry.cpp @@ -1,6 +1,6 @@ -#include "matroskaeditionentry.h" -#include "ebmlelement.h" -#include "matroskaid.h" +#include "./matroskaeditionentry.h" +#include "./ebmlelement.h" +#include "./matroskaid.h" #include diff --git a/matroska/matroskaeditionentry.h b/matroska/matroskaeditionentry.h index 7fd0d95..c9079ee 100644 --- a/matroska/matroskaeditionentry.h +++ b/matroska/matroskaeditionentry.h @@ -1,7 +1,7 @@ #ifndef MEDIA_MATROSKAEDITIONENTRY_H #define MEDIA_MATROSKAEDITIONENTRY_H -#include "matroskachapter.h" +#include "./matroskachapter.h" namespace Media { diff --git a/matroska/matroskaid.cpp b/matroska/matroskaid.cpp index 622bf51..8cd3751 100644 --- a/matroska/matroskaid.cpp +++ b/matroska/matroskaid.cpp @@ -1,5 +1,5 @@ -#include "ebmlid.h" -#include "matroskaid.h" +#include "./ebmlid.h" +#include "./matroskaid.h" namespace Media { diff --git a/matroska/matroskaseekinfo.cpp b/matroska/matroskaseekinfo.cpp index d7ead8a..417c13d 100644 --- a/matroska/matroskaseekinfo.cpp +++ b/matroska/matroskaseekinfo.cpp @@ -1,7 +1,7 @@ -#include "matroskaseekinfo.h" -#include "matroskaid.h" +#include "./matroskaseekinfo.h" +#include "./matroskaid.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include diff --git a/matroska/matroskaseekinfo.h b/matroska/matroskaseekinfo.h index fbc2ef1..ef2e302 100644 --- a/matroska/matroskaseekinfo.h +++ b/matroska/matroskaseekinfo.h @@ -1,9 +1,9 @@ #ifndef MEDIA_MATROSKASEEKINFO_H #define MEDIA_MATROSKASEEKINFO_H -#include "ebmlelement.h" +#include "./ebmlelement.h" -#include "tagparser/statusprovider.h" +#include "../statusprovider.h" #include diff --git a/matroska/matroskatag.cpp b/matroska/matroskatag.cpp index e453d76..2910d8f 100644 --- a/matroska/matroskatag.cpp +++ b/matroska/matroskatag.cpp @@ -1,6 +1,6 @@ -#include "matroskatag.h" -#include "ebmlelement.h" -#include "matroskatagid.h" +#include "./matroskatag.h" +#include "./ebmlelement.h" +#include "./matroskatagid.h" #include #include diff --git a/matroska/matroskatag.h b/matroska/matroskatag.h index aadc737..116d151 100644 --- a/matroska/matroskatag.h +++ b/matroska/matroskatag.h @@ -1,9 +1,9 @@ #ifndef MEDIA_MATROSKATAG_H #define MEDIA_MATROSKATAG_H -#include "matroskatagfield.h" +#include "./matroskatagfield.h" -#include "tagparser/fieldbasedtag.h" +#include "../fieldbasedtag.h" namespace Media { diff --git a/matroska/matroskatagfield.cpp b/matroska/matroskatagfield.cpp index 6208478..51dbdd2 100644 --- a/matroska/matroskatagfield.cpp +++ b/matroska/matroskatagfield.cpp @@ -1,8 +1,8 @@ -#include "matroskatagfield.h" -#include "ebmlelement.h" -#include "matroskacontainer.h" +#include "./matroskatagfield.h" +#include "./ebmlelement.h" +#include "./matroskacontainer.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include #include diff --git a/matroska/matroskatagfield.h b/matroska/matroskatagfield.h index a6afbaa..d406ca9 100644 --- a/matroska/matroskatagfield.h +++ b/matroska/matroskatagfield.h @@ -1,8 +1,8 @@ #ifndef MEDIA_MATROSKATAGFIELD_H #define MEDIA_MATROSKATAGFIELD_H -#include "tagparser/generictagfield.h" -#include "tagparser/statusprovider.h" +#include "../generictagfield.h" +#include "../statusprovider.h" namespace Media { diff --git a/matroska/matroskatagid.cpp b/matroska/matroskatagid.cpp index be38cfb..f267c76 100644 --- a/matroska/matroskatagid.cpp +++ b/matroska/matroskatagid.cpp @@ -1,4 +1,4 @@ -#include "matroskatagid.h" +#include "./matroskatagid.h" #include diff --git a/matroska/matroskatrack.cpp b/matroska/matroskatrack.cpp index d87da1c..41fc903 100644 --- a/matroska/matroskatrack.cpp +++ b/matroska/matroskatrack.cpp @@ -1,17 +1,17 @@ -#include "ebmlelement.h" -#include "matroskatrack.h" -#include "matroskacontainer.h" -#include "matroskaid.h" +#include "./ebmlelement.h" +#include "./matroskatrack.h" +#include "./matroskacontainer.h" +#include "./matroskaid.h" -#include "tagparser/avi/bitmapinfoheader.h" +#include "../avi/bitmapinfoheader.h" -#include "tagparser/wav/waveaudiostream.h" +#include "../wav/waveaudiostream.h" -#include "tagparser/mp4/mp4ids.h" -#include "tagparser/mp4/mp4track.h" +#include "../mp4/mp4ids.h" +#include "../mp4/mp4track.h" -#include "tagparser/mediaformat.h" -#include "tagparser/exceptions.h" +#include "../mediaformat.h" +#include "../exceptions.h" #include diff --git a/matroska/matroskatrack.h b/matroska/matroskatrack.h index 113bd85..06c9684 100644 --- a/matroska/matroskatrack.h +++ b/matroska/matroskatrack.h @@ -1,7 +1,7 @@ #ifndef MEDIA_MATROSKATRACK_H #define MEDIA_MATROSKATRACK_H -#include "tagparser/abstracttrack.h" +#include "../abstracttrack.h" namespace Media { diff --git a/mediafileinfo.cpp b/mediafileinfo.cpp index 9dd813d..fb99425 100644 --- a/mediafileinfo.cpp +++ b/mediafileinfo.cpp @@ -1,31 +1,31 @@ -#include "mediafileinfo.h" -#include "exceptions.h" -#include "tag.h" -#include "signature.h" -#include "abstracttrack.h" -#include "backuphelper.h" +#include "./mediafileinfo.h" +#include "./exceptions.h" +#include "./tag.h" +#include "./signature.h" +#include "./abstracttrack.h" +#include "./backuphelper.h" -#include "id3/id3v1tag.h" -#include "id3/id3v2tag.h" +#include "./id3/id3v1tag.h" +#include "./id3/id3v2tag.h" -#include "wav/waveaudiostream.h" +#include "./wav/waveaudiostream.h" -#include "mpegaudio/mpegaudioframestream.h" +#include "./mpegaudio/mpegaudioframestream.h" -#include "adts/adtsstream.h" +#include "./adts/adtsstream.h" -#include "mp4/mp4container.h" -#include "mp4/mp4atom.h" -#include "mp4/mp4tag.h" -#include "mp4/mp4ids.h" -#include "mp4/mp4track.h" +#include "./mp4/mp4container.h" +#include "./mp4/mp4atom.h" +#include "./mp4/mp4tag.h" +#include "./mp4/mp4ids.h" +#include "./mp4/mp4track.h" -#include "matroska/ebmlelement.h" -#include "matroska/matroskacontainer.h" -#include "matroska/matroskatag.h" -#include "matroska/matroskatrack.h" +#include "./matroska/ebmlelement.h" +#include "./matroska/matroskacontainer.h" +#include "./matroska/matroskatag.h" +#include "./matroska/matroskatrack.h" -#include "ogg/oggcontainer.h" +#include "./ogg/oggcontainer.h" #include #include diff --git a/mediafileinfo.h b/mediafileinfo.h index cfac652..054015c 100644 --- a/mediafileinfo.h +++ b/mediafileinfo.h @@ -1,10 +1,10 @@ #ifndef MEDIAINFO_H #define MEDIAINFO_H -#include "signature.h" -#include "statusprovider.h" -#include "basicfileinfo.h" -#include "abstractcontainer.h" +#include "./signature.h" +#include "./statusprovider.h" +#include "./basicfileinfo.h" +#include "./abstractcontainer.h" #include #include diff --git a/mediaformat.cpp b/mediaformat.cpp index 3959bc7..838d2db 100644 --- a/mediaformat.cpp +++ b/mediaformat.cpp @@ -1,4 +1,4 @@ -#include "mediaformat.h" +#include "./mediaformat.h" namespace Media { diff --git a/mp4/mp4atom.cpp b/mp4/mp4atom.cpp index a384ce8..c44b9c2 100644 --- a/mp4/mp4atom.cpp +++ b/mp4/mp4atom.cpp @@ -1,10 +1,10 @@ -#include "mp4track.h" -#include "mp4tag.h" -#include "mp4atom.h" -#include "mp4ids.h" -#include "mp4container.h" +#include "./mp4track.h" +#include "./mp4tag.h" +#include "./mp4atom.h" +#include "./mp4ids.h" +#include "./mp4container.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include #include diff --git a/mp4/mp4atom.h b/mp4/mp4atom.h index baadb83..f6c4074 100644 --- a/mp4/mp4atom.h +++ b/mp4/mp4atom.h @@ -1,9 +1,9 @@ #ifndef MP4ATOM_H #define MP4ATOM_H -#include "mp4ids.h" +#include "./mp4ids.h" -#include "tagparser/genericfileelement.h" +#include "../genericfileelement.h" #include #include diff --git a/mp4/mp4container.cpp b/mp4/mp4container.cpp index b7d0db7..4fe0184 100644 --- a/mp4/mp4container.cpp +++ b/mp4/mp4container.cpp @@ -1,9 +1,9 @@ -#include "mp4container.h" -#include "mp4ids.h" +#include "./mp4container.h" +#include "./mp4ids.h" -#include "tagparser/exceptions.h" -#include "tagparser/mediafileinfo.h" -#include "tagparser/backuphelper.h" +#include "../exceptions.h" +#include "../mediafileinfo.h" +#include "../backuphelper.h" #include #include diff --git a/mp4/mp4container.h b/mp4/mp4container.h index b34891b..c560bf3 100644 --- a/mp4/mp4container.h +++ b/mp4/mp4container.h @@ -1,11 +1,11 @@ #ifndef MEDIA_MP4CONTAINER_H #define MEDIA_MP4CONTAINER_H -#include "mp4atom.h" -#include "mp4tag.h" -#include "mp4track.h" +#include "./mp4atom.h" +#include "./mp4tag.h" +#include "./mp4track.h" -#include "tagparser/genericcontainer.h" +#include "../genericcontainer.h" #include diff --git a/mp4/mp4ids.cpp b/mp4/mp4ids.cpp index 7f2165c..b490eaa 100644 --- a/mp4/mp4ids.cpp +++ b/mp4/mp4ids.cpp @@ -1,6 +1,6 @@ -#include "mp4ids.h" +#include "./mp4ids.h" -#include "tagparser/mediaformat.h" +#include "../mediaformat.h" namespace Media { diff --git a/mp4/mp4tag.cpp b/mp4/mp4tag.cpp index 041cbe0..737e31a 100644 --- a/mp4/mp4tag.cpp +++ b/mp4/mp4tag.cpp @@ -1,9 +1,9 @@ -#include "mp4container.h" -#include "mp4tag.h" -#include "mp4ids.h" -#include "mp4atom.h" +#include "./mp4container.h" +#include "./mp4tag.h" +#include "./mp4ids.h" +#include "./mp4atom.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include #include diff --git a/mp4/mp4tag.h b/mp4/mp4tag.h index 5974047..5242140 100644 --- a/mp4/mp4tag.h +++ b/mp4/mp4tag.h @@ -1,9 +1,9 @@ #ifndef MP4TAG_H #define MP4TAG_H -#include "mp4tagfield.h" +#include "./mp4tagfield.h" -#include "tagparser/fieldbasedtag.h" +#include "../fieldbasedtag.h" namespace Media { diff --git a/mp4/mp4tagfield.cpp b/mp4/mp4tagfield.cpp index 9f8afc5..6faf7fa 100644 --- a/mp4/mp4tagfield.cpp +++ b/mp4/mp4tagfield.cpp @@ -1,9 +1,9 @@ -#include "mp4container.h" -#include "mp4tagfield.h" -#include "mp4atom.h" -#include "mp4ids.h" +#include "./mp4container.h" +#include "./mp4tagfield.h" +#include "./mp4atom.h" +#include "./mp4ids.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include #include diff --git a/mp4/mp4tagfield.h b/mp4/mp4tagfield.h index 83c18a4..b92ffde 100644 --- a/mp4/mp4tagfield.h +++ b/mp4/mp4tagfield.h @@ -1,8 +1,8 @@ #ifndef MP4TAGATOM_H #define MP4TAGATOM_H -#include "tagparser/generictagfield.h" -#include "tagparser/statusprovider.h" +#include "../generictagfield.h" +#include "../statusprovider.h" #include diff --git a/mp4/mp4track.cpp b/mp4/mp4track.cpp index a5cf4b3..63b5524 100644 --- a/mp4/mp4track.cpp +++ b/mp4/mp4track.cpp @@ -1,14 +1,14 @@ -#include "mp4atom.h" -#include "mp4container.h" -#include "mp4track.h" -#include "mp4ids.h" -#include "mpeg4descriptor.h" +#include "./mp4atom.h" +#include "./mp4container.h" +#include "./mp4track.h" +#include "./mp4ids.h" +#include "./mpeg4descriptor.h" -#include "tagparser/mpegaudio/mpegaudioframe.h" -#include "tagparser/mpegaudio/mpegaudioframestream.h" +#include "../mpegaudio/mpegaudioframe.h" +#include "../mpegaudio/mpegaudioframestream.h" -#include "tagparser/exceptions.h" -#include "tagparser/mediaformat.h" +#include "../exceptions.h" +#include "../mediaformat.h" #include #include diff --git a/mp4/mp4track.h b/mp4/mp4track.h index a1ef6ef..af335cd 100644 --- a/mp4/mp4track.h +++ b/mp4/mp4track.h @@ -2,10 +2,10 @@ #define MP4TRACK_H #ifdef UNDER_CONSTRUCTION -#include "tagparser/avc/avcconfiguration.h" +#include "../avc/avcconfiguration.h" #endif -#include "tagparser/abstracttrack.h" +#include "../abstracttrack.h" #include #include diff --git a/mp4/mpeg4descriptor.cpp b/mp4/mpeg4descriptor.cpp index 6090062..2b136c8 100644 --- a/mp4/mpeg4descriptor.cpp +++ b/mp4/mpeg4descriptor.cpp @@ -1,6 +1,6 @@ -#include "mpeg4descriptor.h" -#include "mp4container.h" -#include "mp4ids.h" +#include "./mpeg4descriptor.h" +#include "./mp4container.h" +#include "./mp4ids.h" #include #include diff --git a/mp4/mpeg4descriptor.h b/mp4/mpeg4descriptor.h index d01b4c3..efc2b87 100644 --- a/mp4/mpeg4descriptor.h +++ b/mp4/mpeg4descriptor.h @@ -1,7 +1,7 @@ #ifndef MPEG4DESCRIPTOR_H #define MPEG4DESCRIPTOR_H -#include "tagparser/genericfileelement.h" +#include "../genericfileelement.h" #include diff --git a/mpegaudio/mpegaudioframe.cpp b/mpegaudio/mpegaudioframe.cpp index b9581b9..6897e4e 100644 --- a/mpegaudio/mpegaudioframe.cpp +++ b/mpegaudio/mpegaudioframe.cpp @@ -1,6 +1,6 @@ -#include "mpegaudioframe.h" +#include "./mpegaudioframe.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include diff --git a/mpegaudio/mpegaudioframestream.cpp b/mpegaudio/mpegaudioframestream.cpp index b759870..b986023 100644 --- a/mpegaudio/mpegaudioframestream.cpp +++ b/mpegaudio/mpegaudioframestream.cpp @@ -1,7 +1,7 @@ -#include "mpegaudioframestream.h" +#include "./mpegaudioframestream.h" -#include "tagparser/exceptions.h" -#include "tagparser/mediaformat.h" +#include "../exceptions.h" +#include "../mediaformat.h" #include diff --git a/mpegaudio/mpegaudioframestream.h b/mpegaudio/mpegaudioframestream.h index 5c375fa..266725b 100644 --- a/mpegaudio/mpegaudioframestream.h +++ b/mpegaudio/mpegaudioframestream.h @@ -1,9 +1,9 @@ #ifndef MPEGAUDIOFRAMESTREAM_H #define MPEGAUDIOFRAMESTREAM_H -#include "mpegaudioframe.h" +#include "./mpegaudioframe.h" -#include "tagparser/abstracttrack.h" +#include "../abstracttrack.h" #include diff --git a/notification.cpp b/notification.cpp index 2100a4d..8a1dbab 100644 --- a/notification.cpp +++ b/notification.cpp @@ -1,4 +1,4 @@ -#include "notification.h" +#include "./notification.h" using namespace std; using namespace ChronoUtilities; diff --git a/ogg/oggcontainer.cpp b/ogg/oggcontainer.cpp index f0cab3b..7fd5730 100644 --- a/ogg/oggcontainer.cpp +++ b/ogg/oggcontainer.cpp @@ -1,7 +1,7 @@ -#include "oggcontainer.h" +#include "./oggcontainer.h" -#include "tagparser/mediafileinfo.h" -#include "tagparser/backuphelper.h" +#include "../mediafileinfo.h" +#include "../backuphelper.h" #include #include diff --git a/ogg/oggcontainer.h b/ogg/oggcontainer.h index 206f7dd..80195ff 100644 --- a/ogg/oggcontainer.h +++ b/ogg/oggcontainer.h @@ -1,13 +1,13 @@ #ifndef MEDIA_OGGCONTAINER_H #define MEDIA_OGGCONTAINER_H -#include "oggpage.h" -#include "oggstream.h" -#include "oggiterator.h" +#include "./oggpage.h" +#include "./oggstream.h" +#include "./oggiterator.h" -#include "tagparser/vorbis/vorbiscomment.h" +#include "../vorbis/vorbiscomment.h" -#include "tagparser/genericcontainer.h" +#include "../genericcontainer.h" #include #include diff --git a/ogg/oggiterator.cpp b/ogg/oggiterator.cpp index 6c1e59b..cd32e7c 100644 --- a/ogg/oggiterator.cpp +++ b/ogg/oggiterator.cpp @@ -1,6 +1,6 @@ -#include "oggiterator.h" +#include "./oggiterator.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" namespace Media { diff --git a/ogg/oggiterator.h b/ogg/oggiterator.h index 1c7ec35..5f015e8 100644 --- a/ogg/oggiterator.h +++ b/ogg/oggiterator.h @@ -1,7 +1,7 @@ #ifndef MEDIA_OGGITERATOR_H #define MEDIA_OGGITERATOR_H -#include "oggpage.h" +#include "./oggpage.h" #include #include diff --git a/ogg/oggpage.cpp b/ogg/oggpage.cpp index 6a8c3d0..17df78b 100644 --- a/ogg/oggpage.cpp +++ b/ogg/oggpage.cpp @@ -1,6 +1,6 @@ -#include "oggpage.h" +#include "./oggpage.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include #include diff --git a/ogg/oggstream.cpp b/ogg/oggstream.cpp index c2279f1..1e0bb15 100644 --- a/ogg/oggstream.cpp +++ b/ogg/oggstream.cpp @@ -1,12 +1,12 @@ -#include "oggstream.h" -#include "oggcontainer.h" +#include "./oggstream.h" +#include "./oggcontainer.h" -#include "tagparser/vorbis/vorbispackagetypes.h" -#include "tagparser/vorbis/vorbisidentificationheader.h" +#include "../vorbis/vorbispackagetypes.h" +#include "../vorbis/vorbisidentificationheader.h" -#include "tagparser/mediafileinfo.h" -#include "tagparser/exceptions.h" -#include "tagparser/mediaformat.h" +#include "../mediafileinfo.h" +#include "../exceptions.h" +#include "../mediaformat.h" #include diff --git a/ogg/oggstream.h b/ogg/oggstream.h index 564fda7..7d81a40 100644 --- a/ogg/oggstream.h +++ b/ogg/oggstream.h @@ -1,8 +1,9 @@ #ifndef MEDIA_OGGSTREAM_H #define MEDIA_OGGSTREAM_H -#include "oggpage.h" -#include "abstracttrack.h" +#include "./oggpage.h" + +#include "../abstracttrack.h" namespace Media { diff --git a/signature.cpp b/signature.cpp index 54c6f0c..a6bff84 100644 --- a/signature.cpp +++ b/signature.cpp @@ -1,4 +1,4 @@ -#include "signature.h" +#include "./signature.h" #include diff --git a/signature.h b/signature.h index 72b8447..a7a5f10 100644 --- a/signature.h +++ b/signature.h @@ -1,7 +1,7 @@ #ifndef SIGNATURE_H #define SIGNATURE_H -#include "mediaformat.h" +#include "./mediaformat.h" #include #include diff --git a/statusprovider.cpp b/statusprovider.cpp index d290b56..c283f87 100644 --- a/statusprovider.cpp +++ b/statusprovider.cpp @@ -1,4 +1,4 @@ -#include "statusprovider.h" +#include "./statusprovider.h" using namespace std; diff --git a/statusprovider.h b/statusprovider.h index 22bdca4..08df578 100644 --- a/statusprovider.h +++ b/statusprovider.h @@ -1,7 +1,7 @@ #ifndef STATUSPROVIDER_H #define STATUSPROVIDER_H -#include "notification.h" +#include "./notification.h" #include #include diff --git a/tag.cpp b/tag.cpp index 8987bbf..1b63e8c 100644 --- a/tag.cpp +++ b/tag.cpp @@ -1,4 +1,4 @@ -#include "tag.h" +#include "./tag.h" using namespace std; diff --git a/tag.h b/tag.h index 2a45dc6..39795a5 100644 --- a/tag.h +++ b/tag.h @@ -1,9 +1,9 @@ #ifndef TAG_H #define TAG_H -#include "statusprovider.h" -#include "tagvalue.h" -#include "tagtarget.h" +#include "./statusprovider.h" +#include "./tagvalue.h" +#include "./tagtarget.h" #include #include diff --git a/tagparser.pro b/tagparser.pro index 1989436..df01ac7 100644 --- a/tagparser.pro +++ b/tagparser.pro @@ -1,5 +1,8 @@ projectname = tagparser -VERSION = 2.0.0 +appname = "Tag Parser" +appauthor = Martchus +appurl = "https://github.com/$${appauthor}/$${projectname}" +VERSION = 2.0.1 # include ../../common.pri when building as part of a subdirs project; otherwise include general.pri !include(../../common.pri) { diff --git a/tagtarget.cpp b/tagtarget.cpp index 5b41ced..cef9dfa 100644 --- a/tagtarget.cpp +++ b/tagtarget.cpp @@ -1,6 +1,6 @@ -#include "tagtarget.h" +#include "./tagtarget.h" -#include "matroska/matroskatagid.h" +#include "./matroska/matroskatagid.h" #include diff --git a/tagvalue.cpp b/tagvalue.cpp index 0d54465..eedcf62 100644 --- a/tagvalue.cpp +++ b/tagvalue.cpp @@ -1,6 +1,6 @@ -#include "tagvalue.h" +#include "./tagvalue.h" -#include "id3/id3genres.h" +#include "./id3/id3genres.h" #include #include diff --git a/tagvalue.h b/tagvalue.h index d16c2a3..775d328 100644 --- a/tagvalue.h +++ b/tagvalue.h @@ -1,7 +1,7 @@ #ifndef TAGVALUE_H #define TAGVALUE_H -#include "positioninset.h" +#include "./positioninset.h" #include #include diff --git a/vorbis/vorbiscomment.cpp b/vorbis/vorbiscomment.cpp index db15b98..374e18b 100644 --- a/vorbis/vorbiscomment.cpp +++ b/vorbis/vorbiscomment.cpp @@ -1,9 +1,9 @@ -#include "vorbiscomment.h" -#include "vorbiscommentids.h" +#include "./vorbiscomment.h" +#include "./vorbiscommentids.h" -#include "tagparser/ogg/oggiterator.h" +#include "../ogg/oggiterator.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include #include diff --git a/vorbis/vorbiscomment.h b/vorbis/vorbiscomment.h index 19f631c..4944b4e 100644 --- a/vorbis/vorbiscomment.h +++ b/vorbis/vorbiscomment.h @@ -1,10 +1,10 @@ #ifndef MEDIA_VORBISCOMMENT_H #define MEDIA_VORBISCOMMENT_H -#include "vorbiscommentfield.h" +#include "./vorbiscommentfield.h" -#include "tagparser/caseinsensitivecomparer.h" -#include "tagparser/fieldbasedtag.h" +#include "../caseinsensitivecomparer.h" +#include "../fieldbasedtag.h" namespace Media { diff --git a/vorbis/vorbiscommentfield.cpp b/vorbis/vorbiscommentfield.cpp index f7e85bb..b55118f 100644 --- a/vorbis/vorbiscommentfield.cpp +++ b/vorbis/vorbiscommentfield.cpp @@ -1,11 +1,11 @@ -#include "vorbiscommentfield.h" -#include "vorbiscommentids.h" +#include "./vorbiscommentfield.h" +#include "./vorbiscommentids.h" -#include "tagparser/ogg/oggiterator.h" +#include "../ogg/oggiterator.h" -#include "tagparser/id3/id3v2frame.h" +#include "../id3/id3v2frame.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include #include diff --git a/vorbis/vorbiscommentfield.h b/vorbis/vorbiscommentfield.h index bdcc0c6..7281480 100644 --- a/vorbis/vorbiscommentfield.h +++ b/vorbis/vorbiscommentfield.h @@ -1,8 +1,8 @@ #ifndef MEDIA_VORBISCOMMENTFIELD_H #define MEDIA_VORBISCOMMENTFIELD_H -#include "tagparser/generictagfield.h" -#include "tagparser/statusprovider.h" +#include "../generictagfield.h" +#include "../statusprovider.h" namespace IoUtilities { class BinaryReader; diff --git a/vorbis/vorbiscommentids.cpp b/vorbis/vorbiscommentids.cpp index 48a13cf..276819a 100644 --- a/vorbis/vorbiscommentids.cpp +++ b/vorbis/vorbiscommentids.cpp @@ -1,4 +1,4 @@ -#include "vorbiscommentids.h" +#include "./vorbiscommentids.h" namespace Media { diff --git a/vorbis/vorbisidentificationheader.cpp b/vorbis/vorbisidentificationheader.cpp index 36acc52..f2c2f85 100644 --- a/vorbis/vorbisidentificationheader.cpp +++ b/vorbis/vorbisidentificationheader.cpp @@ -1,9 +1,9 @@ -#include "vorbisidentificationheader.h" -#include "vorbispackagetypes.h" +#include "./vorbisidentificationheader.h" +#include "./vorbispackagetypes.h" -#include "tagparser/ogg/oggiterator.h" +#include "../ogg/oggiterator.h" -#include "tagparser/exceptions.h" +#include "../exceptions.h" #include diff --git a/wav/waveaudiostream.cpp b/wav/waveaudiostream.cpp index 70aa1c2..d3382e3 100644 --- a/wav/waveaudiostream.cpp +++ b/wav/waveaudiostream.cpp @@ -1,7 +1,7 @@ -#include "waveaudiostream.h" +#include "./waveaudiostream.h" -#include "tagparser/exceptions.h" -#include "tagparser/mediaformat.h" +#include "../exceptions.h" +#include "../mediaformat.h" #include diff --git a/wav/waveaudiostream.h b/wav/waveaudiostream.h index adb06ac..ac0e01f 100644 --- a/wav/waveaudiostream.h +++ b/wav/waveaudiostream.h @@ -1,7 +1,7 @@ #ifndef WAVEAUDIOSTREAM_H #define WAVEAUDIOSTREAM_H -#include "abstracttrack.h" +#include "../abstracttrack.h" #include